@salesgenterp/ui-components 0.1.20 → 0.3.0
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 +36 -2060
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +58 -2077
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -4
package/dist/index.js
CHANGED
|
@@ -1,63 +1,16 @@
|
|
|
1
1
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
2
2
|
|
|
3
|
+
var material = require('@mui/material');
|
|
3
4
|
var React = require('react');
|
|
4
5
|
var React__default = _interopDefault(React);
|
|
5
|
-
var antd = require('antd');
|
|
6
|
-
var styled = require('styled-components');
|
|
7
|
-
var styled__default = _interopDefault(styled);
|
|
8
|
-
var Card = _interopDefault(require('@mui/material/Card'));
|
|
9
|
-
var CardHeader = _interopDefault(require('@mui/material/CardHeader'));
|
|
10
|
-
var CardMedia = _interopDefault(require('@mui/material/CardMedia'));
|
|
11
|
-
var CardContent = _interopDefault(require('@mui/material/CardContent'));
|
|
12
|
-
var CardActions = _interopDefault(require('@mui/material/CardActions'));
|
|
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
6
|
var gr = require('react-icons/gr');
|
|
23
7
|
require('react-icons/gi');
|
|
24
8
|
var bs = require('react-icons/bs');
|
|
9
|
+
var styled = _interopDefault(require('styled-components'));
|
|
25
10
|
var ri = require('react-icons/ri');
|
|
26
11
|
var ai = require('react-icons/ai');
|
|
27
12
|
var reactSpinners = require('react-spinners');
|
|
28
13
|
|
|
29
|
-
function _extends() {
|
|
30
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
31
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
32
|
-
var source = arguments[i];
|
|
33
|
-
|
|
34
|
-
for (var key in source) {
|
|
35
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
36
|
-
target[key] = source[key];
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return target;
|
|
42
|
-
};
|
|
43
|
-
return _extends.apply(this, arguments);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
47
|
-
if (source == null) return {};
|
|
48
|
-
var target = {};
|
|
49
|
-
var sourceKeys = Object.keys(source);
|
|
50
|
-
var key, i;
|
|
51
|
-
|
|
52
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
53
|
-
key = sourceKeys[i];
|
|
54
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
55
|
-
target[key] = source[key];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return target;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
14
|
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
62
15
|
if (!raw) {
|
|
63
16
|
raw = strings.slice(0);
|
|
@@ -67,2028 +20,35 @@ function _taggedTemplateLiteralLoose(strings, raw) {
|
|
|
67
20
|
return strings;
|
|
68
21
|
}
|
|
69
22
|
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
return "\n border-color: " + color + " !important;\n background: " + color + " !important;\n ";
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
var buttonSVGStyles = function buttonSVGStyles(theme) {
|
|
76
|
-
return "\n svg {\n fill: " + theme.colors.white + "\n } \n";
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
var primaryButtonStyle = function primaryButtonStyle(_ref) {
|
|
80
|
-
var theme = _ref.theme;
|
|
81
|
-
return "\n " + buttonColor(theme) + "\n\n &:hover,\n &:focus,\n &:active {\n " + buttonColor(theme) + "\n }\n \n " + buttonSVGStyles(theme) + "\n";
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
var labelPrimaryStyle = function labelPrimaryStyle(_ref) {
|
|
85
|
-
var theme = _ref.theme;
|
|
86
|
-
return " color: " + theme.colors.primary;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
90
|
-
var StyledOne = styled__default.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n align-items: center;\n\n > div:not(:last-child) {\n margin-bottom: 10px;\n }\n"])));
|
|
91
|
-
var StyledPrice = styled__default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n ", ";\n font-weight: bold;\n"])), labelPrimaryStyle);
|
|
92
|
-
var StyledOutOfStock = styled__default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n ", ";\n font-weight: 500;\n"])), labelPrimaryStyle);
|
|
93
|
-
var StyledStockBG = styled__default.div(_templateObject4 || (_templateObject4 = _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"])));
|
|
94
|
-
var StyledUpdateQty = styled__default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n display: flex;\n column-gap: 5px;\n\n input {\n width: 50px;\n }\n"])));
|
|
95
|
-
var StyledNumberInput = styled__default(antd.Input)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n text-align: center;\n"])));
|
|
96
|
-
var StyledFlex = styled__default.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n display: flex;\n justify-content: space-between;\n width: 100%;\n"])));
|
|
97
|
-
var AddToCartContainer = styled__default(StyledFlex)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose([""])));
|
|
98
|
-
var StyledNotifyMe = styled__default(StyledFlex)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose([""])));
|
|
99
|
-
var StyledNotifyButton = styled__default(antd.Button)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["\n margin-left: 15px;\n color: white;\n ", ";\n"])), primaryButtonStyle);
|
|
100
|
-
var StyledProductCounter = styled__default.div(_templateObject11 || (_templateObject11 = _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"])), function (_ref) {
|
|
101
|
-
var theme = _ref.theme;
|
|
102
|
-
return theme.colors.primary;
|
|
103
|
-
});
|
|
104
|
-
var StyledLoginView = styled__default.div(_templateObject12 || (_templateObject12 = _taggedTemplateLiteralLoose(["\n text-transform: uppercase;\n button {\n padding: 0;\n margin-right: 5px;\n text-transform: uppercase;\n }\n"])));
|
|
105
|
-
|
|
106
|
-
var preventOuterClick = function preventOuterClick(e) {
|
|
107
|
-
e.preventDefault();
|
|
108
|
-
e.stopPropagation();
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
var ProductCounter = function ProductCounter(_ref) {
|
|
112
|
-
var qty = _ref.qty;
|
|
113
|
-
var hasQty = qty > 0;
|
|
114
|
-
return hasQty && /*#__PURE__*/React__default.createElement(StyledProductCounter, null, qty);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
var QtyMeter = function QtyMeter(_ref2) {
|
|
118
|
-
var updatedQty = _ref2.updatedQty;
|
|
119
|
-
|
|
120
|
-
var _useState = React.useState(0),
|
|
121
|
-
qtyToBuy = _useState[0],
|
|
122
|
-
setQtyToBuy = _useState[1];
|
|
123
|
-
|
|
124
|
-
var _useState2 = React.useState(true),
|
|
125
|
-
showInput = _useState2[0],
|
|
126
|
-
setShowInput = _useState2[1];
|
|
127
|
-
|
|
128
|
-
var containerRef = React.useRef(null);
|
|
129
|
-
|
|
130
|
-
var _useContext = React.useContext(ProductContext),
|
|
131
|
-
totalQty = _useContext.item.qty;
|
|
132
|
-
|
|
133
|
-
React.useEffect(function () {
|
|
134
|
-
var onResize = function onResize() {
|
|
135
|
-
var _containerRef$current = containerRef.current.closest('.ant-card').getBoundingClientRect(),
|
|
136
|
-
width = _containerRef$current.width;
|
|
137
|
-
|
|
138
|
-
setShowInput(width > 200);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
window.addEventListener('resize', onResize);
|
|
142
|
-
onResize();
|
|
143
|
-
return function () {
|
|
144
|
-
window.removeEventListener('resize', onResize);
|
|
145
|
-
};
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
var updateQty = function updateQty(value) {
|
|
149
|
-
setQtyToBuy(value);
|
|
150
|
-
updatedQty(value);
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
var increaseQty = function increaseQty(e) {
|
|
154
|
-
preventOuterClick(e);
|
|
155
|
-
|
|
156
|
-
if (qtyToBuy >= 0 && qtyToBuy < totalQty) {
|
|
157
|
-
updateQty(qtyToBuy + 1);
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
var decreaseQty = function decreaseQty(e) {
|
|
162
|
-
preventOuterClick(e);
|
|
163
|
-
|
|
164
|
-
if (qtyToBuy > 0) {
|
|
165
|
-
updateQty(qtyToBuy - 1);
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
var onInputChange = function onInputChange(e) {
|
|
170
|
-
var value = e.target.value;
|
|
171
|
-
var regex = /^[0-9]+$/;
|
|
172
|
-
|
|
173
|
-
if (value.match(regex)) {
|
|
174
|
-
updateQty(+value);
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ProductCounter, {
|
|
179
|
-
qty: qtyToBuy
|
|
180
|
-
}), /*#__PURE__*/React__default.createElement(StyledUpdateQty, {
|
|
181
|
-
ref: containerRef,
|
|
182
|
-
className: "qty-container"
|
|
183
|
-
}, /*#__PURE__*/React__default.createElement(antd.Button, {
|
|
184
|
-
onClick: increaseQty,
|
|
185
|
-
className: "increment"
|
|
186
|
-
}, "+"), showInput && /*#__PURE__*/React__default.createElement(StyledNumberInput, {
|
|
187
|
-
value: qtyToBuy,
|
|
188
|
-
onChange: onInputChange,
|
|
189
|
-
onClick: preventOuterClick
|
|
190
|
-
}), /*#__PURE__*/React__default.createElement(antd.Button, {
|
|
191
|
-
onClick: decreaseQty,
|
|
192
|
-
className: "decrement"
|
|
193
|
-
}, "-")));
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
var IconContext = /*#__PURE__*/React.createContext({});
|
|
197
|
-
|
|
198
|
-
function _defineProperty(obj, key, value) {
|
|
199
|
-
if (key in obj) {
|
|
200
|
-
Object.defineProperty(obj, key, {
|
|
201
|
-
value: value,
|
|
202
|
-
enumerable: true,
|
|
203
|
-
configurable: true,
|
|
204
|
-
writable: true
|
|
205
|
-
});
|
|
206
|
-
} else {
|
|
207
|
-
obj[key] = value;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return obj;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function ownKeys(object, enumerableOnly) {
|
|
214
|
-
var keys = Object.keys(object);
|
|
215
|
-
|
|
216
|
-
if (Object.getOwnPropertySymbols) {
|
|
217
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
218
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
219
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
220
|
-
})), keys.push.apply(keys, symbols);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return keys;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function _objectSpread2(target) {
|
|
227
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
228
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
229
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
230
|
-
_defineProperty(target, key, source[key]);
|
|
231
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
232
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
return target;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function _arrayWithHoles(arr) {
|
|
240
|
-
if (Array.isArray(arr)) return arr;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function _iterableToArrayLimit(arr, i) {
|
|
244
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
245
|
-
|
|
246
|
-
if (_i == null) return;
|
|
247
|
-
var _arr = [];
|
|
248
|
-
var _n = true;
|
|
249
|
-
var _d = false;
|
|
250
|
-
|
|
251
|
-
var _s, _e;
|
|
252
|
-
|
|
253
|
-
try {
|
|
254
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
255
|
-
_arr.push(_s.value);
|
|
256
|
-
|
|
257
|
-
if (i && _arr.length === i) break;
|
|
258
|
-
}
|
|
259
|
-
} catch (err) {
|
|
260
|
-
_d = true;
|
|
261
|
-
_e = err;
|
|
262
|
-
} finally {
|
|
263
|
-
try {
|
|
264
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
265
|
-
} finally {
|
|
266
|
-
if (_d) throw _e;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
return _arr;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
function _arrayLikeToArray(arr, len) {
|
|
274
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
275
|
-
|
|
276
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
277
|
-
arr2[i] = arr[i];
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return arr2;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
284
|
-
if (!o) return;
|
|
285
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
286
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
287
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
288
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
289
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function _nonIterableRest() {
|
|
293
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
function _slicedToArray(arr, i) {
|
|
297
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
301
|
-
if (source == null) return {};
|
|
302
|
-
var target = {};
|
|
303
|
-
var sourceKeys = Object.keys(source);
|
|
304
|
-
var key, i;
|
|
305
|
-
|
|
306
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
307
|
-
key = sourceKeys[i];
|
|
308
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
309
|
-
target[key] = source[key];
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
return target;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
function _objectWithoutProperties(source, excluded) {
|
|
316
|
-
if (source == null) return {};
|
|
317
|
-
var target = _objectWithoutPropertiesLoose$1(source, excluded);
|
|
318
|
-
var key, i;
|
|
319
|
-
|
|
320
|
-
if (Object.getOwnPropertySymbols) {
|
|
321
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
322
|
-
|
|
323
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
324
|
-
key = sourceSymbolKeys[i];
|
|
325
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
326
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
327
|
-
target[key] = source[key];
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
return target;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function createCommonjsModule(fn, module) {
|
|
335
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
var classnames = createCommonjsModule(function (module) {
|
|
339
|
-
/*!
|
|
340
|
-
Copyright (c) 2018 Jed Watson.
|
|
341
|
-
Licensed under the MIT License (MIT), see
|
|
342
|
-
http://jedwatson.github.io/classnames
|
|
343
|
-
*/
|
|
344
|
-
/* global define */
|
|
345
|
-
|
|
346
|
-
(function () {
|
|
347
|
-
|
|
348
|
-
var hasOwn = {}.hasOwnProperty;
|
|
349
|
-
|
|
350
|
-
function classNames() {
|
|
351
|
-
var classes = [];
|
|
352
|
-
|
|
353
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
354
|
-
var arg = arguments[i];
|
|
355
|
-
if (!arg) continue;
|
|
356
|
-
|
|
357
|
-
var argType = typeof arg;
|
|
358
|
-
|
|
359
|
-
if (argType === 'string' || argType === 'number') {
|
|
360
|
-
classes.push(arg);
|
|
361
|
-
} else if (Array.isArray(arg)) {
|
|
362
|
-
if (arg.length) {
|
|
363
|
-
var inner = classNames.apply(null, arg);
|
|
364
|
-
if (inner) {
|
|
365
|
-
classes.push(inner);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
} else if (argType === 'object') {
|
|
369
|
-
if (arg.toString === Object.prototype.toString) {
|
|
370
|
-
for (var key in arg) {
|
|
371
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
372
|
-
classes.push(key);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
} else {
|
|
376
|
-
classes.push(arg.toString());
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
return classes.join(' ');
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
if ( module.exports) {
|
|
385
|
-
classNames.default = classNames;
|
|
386
|
-
module.exports = classNames;
|
|
387
|
-
} else {
|
|
388
|
-
window.classNames = classNames;
|
|
389
|
-
}
|
|
390
|
-
}());
|
|
391
|
-
});
|
|
392
|
-
|
|
393
|
-
function _typeof(obj) {
|
|
394
|
-
"@babel/helpers - typeof";
|
|
395
|
-
|
|
396
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
397
|
-
return typeof obj;
|
|
398
|
-
} : function (obj) {
|
|
399
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
400
|
-
}, _typeof(obj);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Take input from [0, n] and return it as [0, 1]
|
|
405
|
-
* @hidden
|
|
406
|
-
*/
|
|
407
|
-
function bound01(n, max) {
|
|
408
|
-
if (isOnePointZero(n)) {
|
|
409
|
-
n = '100%';
|
|
410
|
-
}
|
|
411
|
-
var isPercent = isPercentage(n);
|
|
412
|
-
n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
|
|
413
|
-
// Automatically convert percentage into number
|
|
414
|
-
if (isPercent) {
|
|
415
|
-
n = parseInt(String(n * max), 10) / 100;
|
|
416
|
-
}
|
|
417
|
-
// Handle floating point rounding errors
|
|
418
|
-
if (Math.abs(n - max) < 0.000001) {
|
|
419
|
-
return 1;
|
|
420
|
-
}
|
|
421
|
-
// Convert into [0, 1] range if it isn't already
|
|
422
|
-
if (max === 360) {
|
|
423
|
-
// If n is a hue given in degrees,
|
|
424
|
-
// wrap around out-of-range values into [0, 360] range
|
|
425
|
-
// then convert into [0, 1].
|
|
426
|
-
n = (n < 0 ? (n % max) + max : n % max) / parseFloat(String(max));
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
// If n not a hue given in degrees
|
|
430
|
-
// Convert into [0, 1] range if it isn't already.
|
|
431
|
-
n = (n % max) / parseFloat(String(max));
|
|
432
|
-
}
|
|
433
|
-
return n;
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
437
|
-
* <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
438
|
-
* @hidden
|
|
439
|
-
*/
|
|
440
|
-
function isOnePointZero(n) {
|
|
441
|
-
return typeof n === 'string' && n.indexOf('.') !== -1 && parseFloat(n) === 1;
|
|
442
|
-
}
|
|
443
|
-
/**
|
|
444
|
-
* Check to see if string passed in is a percentage
|
|
445
|
-
* @hidden
|
|
446
|
-
*/
|
|
447
|
-
function isPercentage(n) {
|
|
448
|
-
return typeof n === 'string' && n.indexOf('%') !== -1;
|
|
449
|
-
}
|
|
450
|
-
/**
|
|
451
|
-
* Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
452
|
-
* @hidden
|
|
453
|
-
*/
|
|
454
|
-
function boundAlpha(a) {
|
|
455
|
-
a = parseFloat(a);
|
|
456
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
457
|
-
a = 1;
|
|
458
|
-
}
|
|
459
|
-
return a;
|
|
460
|
-
}
|
|
461
|
-
/**
|
|
462
|
-
* Replace a decimal with it's percentage value
|
|
463
|
-
* @hidden
|
|
464
|
-
*/
|
|
465
|
-
function convertToPercentage(n) {
|
|
466
|
-
if (n <= 1) {
|
|
467
|
-
return "".concat(Number(n) * 100, "%");
|
|
468
|
-
}
|
|
469
|
-
return n;
|
|
470
|
-
}
|
|
471
|
-
/**
|
|
472
|
-
* Force a hex value to have 2 characters
|
|
473
|
-
* @hidden
|
|
474
|
-
*/
|
|
475
|
-
function pad2(c) {
|
|
476
|
-
return c.length === 1 ? '0' + c : String(c);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
|
480
|
-
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
481
|
-
/**
|
|
482
|
-
* Handle bounds / percentage checking to conform to CSS color spec
|
|
483
|
-
* <http://www.w3.org/TR/css3-color/>
|
|
484
|
-
* *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
485
|
-
* *Returns:* { r, g, b } in [0, 255]
|
|
486
|
-
*/
|
|
487
|
-
function rgbToRgb(r, g, b) {
|
|
488
|
-
return {
|
|
489
|
-
r: bound01(r, 255) * 255,
|
|
490
|
-
g: bound01(g, 255) * 255,
|
|
491
|
-
b: bound01(b, 255) * 255,
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
function hue2rgb(p, q, t) {
|
|
495
|
-
if (t < 0) {
|
|
496
|
-
t += 1;
|
|
497
|
-
}
|
|
498
|
-
if (t > 1) {
|
|
499
|
-
t -= 1;
|
|
500
|
-
}
|
|
501
|
-
if (t < 1 / 6) {
|
|
502
|
-
return p + (q - p) * (6 * t);
|
|
503
|
-
}
|
|
504
|
-
if (t < 1 / 2) {
|
|
505
|
-
return q;
|
|
506
|
-
}
|
|
507
|
-
if (t < 2 / 3) {
|
|
508
|
-
return p + (q - p) * (2 / 3 - t) * 6;
|
|
509
|
-
}
|
|
510
|
-
return p;
|
|
511
|
-
}
|
|
512
|
-
/**
|
|
513
|
-
* Converts an HSL color value to RGB.
|
|
514
|
-
*
|
|
515
|
-
* *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
|
516
|
-
* *Returns:* { r, g, b } in the set [0, 255]
|
|
517
|
-
*/
|
|
518
|
-
function hslToRgb(h, s, l) {
|
|
519
|
-
var r;
|
|
520
|
-
var g;
|
|
521
|
-
var b;
|
|
522
|
-
h = bound01(h, 360);
|
|
523
|
-
s = bound01(s, 100);
|
|
524
|
-
l = bound01(l, 100);
|
|
525
|
-
if (s === 0) {
|
|
526
|
-
// achromatic
|
|
527
|
-
g = l;
|
|
528
|
-
b = l;
|
|
529
|
-
r = l;
|
|
530
|
-
}
|
|
531
|
-
else {
|
|
532
|
-
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
533
|
-
var p = 2 * l - q;
|
|
534
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
535
|
-
g = hue2rgb(p, q, h);
|
|
536
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
537
|
-
}
|
|
538
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* Converts an RGB color value to HSV
|
|
542
|
-
*
|
|
543
|
-
* *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
544
|
-
* *Returns:* { h, s, v } in [0,1]
|
|
545
|
-
*/
|
|
546
|
-
function rgbToHsv(r, g, b) {
|
|
547
|
-
r = bound01(r, 255);
|
|
548
|
-
g = bound01(g, 255);
|
|
549
|
-
b = bound01(b, 255);
|
|
550
|
-
var max = Math.max(r, g, b);
|
|
551
|
-
var min = Math.min(r, g, b);
|
|
552
|
-
var h = 0;
|
|
553
|
-
var v = max;
|
|
554
|
-
var d = max - min;
|
|
555
|
-
var s = max === 0 ? 0 : d / max;
|
|
556
|
-
if (max === min) {
|
|
557
|
-
h = 0; // achromatic
|
|
558
|
-
}
|
|
559
|
-
else {
|
|
560
|
-
switch (max) {
|
|
561
|
-
case r:
|
|
562
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
563
|
-
break;
|
|
564
|
-
case g:
|
|
565
|
-
h = (b - r) / d + 2;
|
|
566
|
-
break;
|
|
567
|
-
case b:
|
|
568
|
-
h = (r - g) / d + 4;
|
|
569
|
-
break;
|
|
570
|
-
}
|
|
571
|
-
h /= 6;
|
|
572
|
-
}
|
|
573
|
-
return { h: h, s: s, v: v };
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* Converts an HSV color value to RGB.
|
|
577
|
-
*
|
|
578
|
-
* *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
579
|
-
* *Returns:* { r, g, b } in the set [0, 255]
|
|
580
|
-
*/
|
|
581
|
-
function hsvToRgb(h, s, v) {
|
|
582
|
-
h = bound01(h, 360) * 6;
|
|
583
|
-
s = bound01(s, 100);
|
|
584
|
-
v = bound01(v, 100);
|
|
585
|
-
var i = Math.floor(h);
|
|
586
|
-
var f = h - i;
|
|
587
|
-
var p = v * (1 - s);
|
|
588
|
-
var q = v * (1 - f * s);
|
|
589
|
-
var t = v * (1 - (1 - f) * s);
|
|
590
|
-
var mod = i % 6;
|
|
591
|
-
var r = [v, q, p, p, t, v][mod];
|
|
592
|
-
var g = [t, v, v, q, p, p][mod];
|
|
593
|
-
var b = [p, p, t, v, v, q][mod];
|
|
594
|
-
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
595
|
-
}
|
|
596
|
-
/**
|
|
597
|
-
* Converts an RGB color to hex
|
|
598
|
-
*
|
|
599
|
-
* Assumes r, g, and b are contained in the set [0, 255]
|
|
600
|
-
* Returns a 3 or 6 character hex
|
|
601
|
-
*/
|
|
602
|
-
function rgbToHex(r, g, b, allow3Char) {
|
|
603
|
-
var hex = [
|
|
604
|
-
pad2(Math.round(r).toString(16)),
|
|
605
|
-
pad2(Math.round(g).toString(16)),
|
|
606
|
-
pad2(Math.round(b).toString(16)),
|
|
607
|
-
];
|
|
608
|
-
// Return a 3 character hex if possible
|
|
609
|
-
if (allow3Char &&
|
|
610
|
-
hex[0].startsWith(hex[0].charAt(1)) &&
|
|
611
|
-
hex[1].startsWith(hex[1].charAt(1)) &&
|
|
612
|
-
hex[2].startsWith(hex[2].charAt(1))) {
|
|
613
|
-
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
614
|
-
}
|
|
615
|
-
return hex.join('');
|
|
616
|
-
}
|
|
617
|
-
/** Converts a hex value to a decimal */
|
|
618
|
-
function convertHexToDecimal(h) {
|
|
619
|
-
return parseIntFromHex(h) / 255;
|
|
620
|
-
}
|
|
621
|
-
/** Parse a base-16 hex value into a base-10 integer */
|
|
622
|
-
function parseIntFromHex(val) {
|
|
623
|
-
return parseInt(val, 16);
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
// https://github.com/bahamas10/css-color-names/blob/master/css-color-names.json
|
|
627
|
-
/**
|
|
628
|
-
* @hidden
|
|
629
|
-
*/
|
|
630
|
-
var names = {
|
|
631
|
-
aliceblue: '#f0f8ff',
|
|
632
|
-
antiquewhite: '#faebd7',
|
|
633
|
-
aqua: '#00ffff',
|
|
634
|
-
aquamarine: '#7fffd4',
|
|
635
|
-
azure: '#f0ffff',
|
|
636
|
-
beige: '#f5f5dc',
|
|
637
|
-
bisque: '#ffe4c4',
|
|
638
|
-
black: '#000000',
|
|
639
|
-
blanchedalmond: '#ffebcd',
|
|
640
|
-
blue: '#0000ff',
|
|
641
|
-
blueviolet: '#8a2be2',
|
|
642
|
-
brown: '#a52a2a',
|
|
643
|
-
burlywood: '#deb887',
|
|
644
|
-
cadetblue: '#5f9ea0',
|
|
645
|
-
chartreuse: '#7fff00',
|
|
646
|
-
chocolate: '#d2691e',
|
|
647
|
-
coral: '#ff7f50',
|
|
648
|
-
cornflowerblue: '#6495ed',
|
|
649
|
-
cornsilk: '#fff8dc',
|
|
650
|
-
crimson: '#dc143c',
|
|
651
|
-
cyan: '#00ffff',
|
|
652
|
-
darkblue: '#00008b',
|
|
653
|
-
darkcyan: '#008b8b',
|
|
654
|
-
darkgoldenrod: '#b8860b',
|
|
655
|
-
darkgray: '#a9a9a9',
|
|
656
|
-
darkgreen: '#006400',
|
|
657
|
-
darkgrey: '#a9a9a9',
|
|
658
|
-
darkkhaki: '#bdb76b',
|
|
659
|
-
darkmagenta: '#8b008b',
|
|
660
|
-
darkolivegreen: '#556b2f',
|
|
661
|
-
darkorange: '#ff8c00',
|
|
662
|
-
darkorchid: '#9932cc',
|
|
663
|
-
darkred: '#8b0000',
|
|
664
|
-
darksalmon: '#e9967a',
|
|
665
|
-
darkseagreen: '#8fbc8f',
|
|
666
|
-
darkslateblue: '#483d8b',
|
|
667
|
-
darkslategray: '#2f4f4f',
|
|
668
|
-
darkslategrey: '#2f4f4f',
|
|
669
|
-
darkturquoise: '#00ced1',
|
|
670
|
-
darkviolet: '#9400d3',
|
|
671
|
-
deeppink: '#ff1493',
|
|
672
|
-
deepskyblue: '#00bfff',
|
|
673
|
-
dimgray: '#696969',
|
|
674
|
-
dimgrey: '#696969',
|
|
675
|
-
dodgerblue: '#1e90ff',
|
|
676
|
-
firebrick: '#b22222',
|
|
677
|
-
floralwhite: '#fffaf0',
|
|
678
|
-
forestgreen: '#228b22',
|
|
679
|
-
fuchsia: '#ff00ff',
|
|
680
|
-
gainsboro: '#dcdcdc',
|
|
681
|
-
ghostwhite: '#f8f8ff',
|
|
682
|
-
goldenrod: '#daa520',
|
|
683
|
-
gold: '#ffd700',
|
|
684
|
-
gray: '#808080',
|
|
685
|
-
green: '#008000',
|
|
686
|
-
greenyellow: '#adff2f',
|
|
687
|
-
grey: '#808080',
|
|
688
|
-
honeydew: '#f0fff0',
|
|
689
|
-
hotpink: '#ff69b4',
|
|
690
|
-
indianred: '#cd5c5c',
|
|
691
|
-
indigo: '#4b0082',
|
|
692
|
-
ivory: '#fffff0',
|
|
693
|
-
khaki: '#f0e68c',
|
|
694
|
-
lavenderblush: '#fff0f5',
|
|
695
|
-
lavender: '#e6e6fa',
|
|
696
|
-
lawngreen: '#7cfc00',
|
|
697
|
-
lemonchiffon: '#fffacd',
|
|
698
|
-
lightblue: '#add8e6',
|
|
699
|
-
lightcoral: '#f08080',
|
|
700
|
-
lightcyan: '#e0ffff',
|
|
701
|
-
lightgoldenrodyellow: '#fafad2',
|
|
702
|
-
lightgray: '#d3d3d3',
|
|
703
|
-
lightgreen: '#90ee90',
|
|
704
|
-
lightgrey: '#d3d3d3',
|
|
705
|
-
lightpink: '#ffb6c1',
|
|
706
|
-
lightsalmon: '#ffa07a',
|
|
707
|
-
lightseagreen: '#20b2aa',
|
|
708
|
-
lightskyblue: '#87cefa',
|
|
709
|
-
lightslategray: '#778899',
|
|
710
|
-
lightslategrey: '#778899',
|
|
711
|
-
lightsteelblue: '#b0c4de',
|
|
712
|
-
lightyellow: '#ffffe0',
|
|
713
|
-
lime: '#00ff00',
|
|
714
|
-
limegreen: '#32cd32',
|
|
715
|
-
linen: '#faf0e6',
|
|
716
|
-
magenta: '#ff00ff',
|
|
717
|
-
maroon: '#800000',
|
|
718
|
-
mediumaquamarine: '#66cdaa',
|
|
719
|
-
mediumblue: '#0000cd',
|
|
720
|
-
mediumorchid: '#ba55d3',
|
|
721
|
-
mediumpurple: '#9370db',
|
|
722
|
-
mediumseagreen: '#3cb371',
|
|
723
|
-
mediumslateblue: '#7b68ee',
|
|
724
|
-
mediumspringgreen: '#00fa9a',
|
|
725
|
-
mediumturquoise: '#48d1cc',
|
|
726
|
-
mediumvioletred: '#c71585',
|
|
727
|
-
midnightblue: '#191970',
|
|
728
|
-
mintcream: '#f5fffa',
|
|
729
|
-
mistyrose: '#ffe4e1',
|
|
730
|
-
moccasin: '#ffe4b5',
|
|
731
|
-
navajowhite: '#ffdead',
|
|
732
|
-
navy: '#000080',
|
|
733
|
-
oldlace: '#fdf5e6',
|
|
734
|
-
olive: '#808000',
|
|
735
|
-
olivedrab: '#6b8e23',
|
|
736
|
-
orange: '#ffa500',
|
|
737
|
-
orangered: '#ff4500',
|
|
738
|
-
orchid: '#da70d6',
|
|
739
|
-
palegoldenrod: '#eee8aa',
|
|
740
|
-
palegreen: '#98fb98',
|
|
741
|
-
paleturquoise: '#afeeee',
|
|
742
|
-
palevioletred: '#db7093',
|
|
743
|
-
papayawhip: '#ffefd5',
|
|
744
|
-
peachpuff: '#ffdab9',
|
|
745
|
-
peru: '#cd853f',
|
|
746
|
-
pink: '#ffc0cb',
|
|
747
|
-
plum: '#dda0dd',
|
|
748
|
-
powderblue: '#b0e0e6',
|
|
749
|
-
purple: '#800080',
|
|
750
|
-
rebeccapurple: '#663399',
|
|
751
|
-
red: '#ff0000',
|
|
752
|
-
rosybrown: '#bc8f8f',
|
|
753
|
-
royalblue: '#4169e1',
|
|
754
|
-
saddlebrown: '#8b4513',
|
|
755
|
-
salmon: '#fa8072',
|
|
756
|
-
sandybrown: '#f4a460',
|
|
757
|
-
seagreen: '#2e8b57',
|
|
758
|
-
seashell: '#fff5ee',
|
|
759
|
-
sienna: '#a0522d',
|
|
760
|
-
silver: '#c0c0c0',
|
|
761
|
-
skyblue: '#87ceeb',
|
|
762
|
-
slateblue: '#6a5acd',
|
|
763
|
-
slategray: '#708090',
|
|
764
|
-
slategrey: '#708090',
|
|
765
|
-
snow: '#fffafa',
|
|
766
|
-
springgreen: '#00ff7f',
|
|
767
|
-
steelblue: '#4682b4',
|
|
768
|
-
tan: '#d2b48c',
|
|
769
|
-
teal: '#008080',
|
|
770
|
-
thistle: '#d8bfd8',
|
|
771
|
-
tomato: '#ff6347',
|
|
772
|
-
turquoise: '#40e0d0',
|
|
773
|
-
violet: '#ee82ee',
|
|
774
|
-
wheat: '#f5deb3',
|
|
775
|
-
white: '#ffffff',
|
|
776
|
-
whitesmoke: '#f5f5f5',
|
|
777
|
-
yellow: '#ffff00',
|
|
778
|
-
yellowgreen: '#9acd32',
|
|
779
|
-
};
|
|
780
|
-
|
|
781
|
-
/**
|
|
782
|
-
* Given a string or object, convert that input to RGB
|
|
783
|
-
*
|
|
784
|
-
* Possible string inputs:
|
|
785
|
-
* ```
|
|
786
|
-
* "red"
|
|
787
|
-
* "#f00" or "f00"
|
|
788
|
-
* "#ff0000" or "ff0000"
|
|
789
|
-
* "#ff000000" or "ff000000"
|
|
790
|
-
* "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
791
|
-
* "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
792
|
-
* "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
793
|
-
* "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
794
|
-
* "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
795
|
-
* "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
796
|
-
* "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
797
|
-
* ```
|
|
798
|
-
*/
|
|
799
|
-
function inputToRGB(color) {
|
|
800
|
-
var rgb = { r: 0, g: 0, b: 0 };
|
|
801
|
-
var a = 1;
|
|
802
|
-
var s = null;
|
|
803
|
-
var v = null;
|
|
804
|
-
var l = null;
|
|
805
|
-
var ok = false;
|
|
806
|
-
var format = false;
|
|
807
|
-
if (typeof color === 'string') {
|
|
808
|
-
color = stringInputToObject(color);
|
|
809
|
-
}
|
|
810
|
-
if (typeof color === 'object') {
|
|
811
|
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
812
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
813
|
-
ok = true;
|
|
814
|
-
format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb';
|
|
815
|
-
}
|
|
816
|
-
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
817
|
-
s = convertToPercentage(color.s);
|
|
818
|
-
v = convertToPercentage(color.v);
|
|
819
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
820
|
-
ok = true;
|
|
821
|
-
format = 'hsv';
|
|
822
|
-
}
|
|
823
|
-
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
824
|
-
s = convertToPercentage(color.s);
|
|
825
|
-
l = convertToPercentage(color.l);
|
|
826
|
-
rgb = hslToRgb(color.h, s, l);
|
|
827
|
-
ok = true;
|
|
828
|
-
format = 'hsl';
|
|
829
|
-
}
|
|
830
|
-
if (Object.prototype.hasOwnProperty.call(color, 'a')) {
|
|
831
|
-
a = color.a;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
a = boundAlpha(a);
|
|
835
|
-
return {
|
|
836
|
-
ok: ok,
|
|
837
|
-
format: color.format || format,
|
|
838
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
839
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
840
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
841
|
-
a: a,
|
|
842
|
-
};
|
|
843
|
-
}
|
|
844
|
-
// <http://www.w3.org/TR/css3-values/#integers>
|
|
845
|
-
var CSS_INTEGER = '[-\\+]?\\d+%?';
|
|
846
|
-
// <http://www.w3.org/TR/css3-values/#number-value>
|
|
847
|
-
var CSS_NUMBER = '[-\\+]?\\d*\\.\\d+%?';
|
|
848
|
-
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
|
849
|
-
var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
|
|
850
|
-
// Actual matching.
|
|
851
|
-
// Parentheses and commas are optional, but not required.
|
|
852
|
-
// Whitespace can take the place of commas or opening paren
|
|
853
|
-
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
|
854
|
-
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
|
|
855
|
-
var matchers = {
|
|
856
|
-
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
857
|
-
rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),
|
|
858
|
-
rgba: new RegExp('rgba' + PERMISSIVE_MATCH4),
|
|
859
|
-
hsl: new RegExp('hsl' + PERMISSIVE_MATCH3),
|
|
860
|
-
hsla: new RegExp('hsla' + PERMISSIVE_MATCH4),
|
|
861
|
-
hsv: new RegExp('hsv' + PERMISSIVE_MATCH3),
|
|
862
|
-
hsva: new RegExp('hsva' + PERMISSIVE_MATCH4),
|
|
863
|
-
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
864
|
-
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
865
|
-
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
866
|
-
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
867
|
-
};
|
|
868
|
-
/**
|
|
869
|
-
* Permissive string parsing. Take in a number of formats, and output an object
|
|
870
|
-
* based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
|
871
|
-
*/
|
|
872
|
-
function stringInputToObject(color) {
|
|
873
|
-
color = color.trim().toLowerCase();
|
|
874
|
-
if (color.length === 0) {
|
|
875
|
-
return false;
|
|
876
|
-
}
|
|
877
|
-
var named = false;
|
|
878
|
-
if (names[color]) {
|
|
879
|
-
color = names[color];
|
|
880
|
-
named = true;
|
|
881
|
-
}
|
|
882
|
-
else if (color === 'transparent') {
|
|
883
|
-
return { r: 0, g: 0, b: 0, a: 0, format: 'name' };
|
|
884
|
-
}
|
|
885
|
-
// Try to match string input using regular expressions.
|
|
886
|
-
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
|
887
|
-
// Just return an object and let the conversion functions handle that.
|
|
888
|
-
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
889
|
-
var match = matchers.rgb.exec(color);
|
|
890
|
-
if (match) {
|
|
891
|
-
return { r: match[1], g: match[2], b: match[3] };
|
|
892
|
-
}
|
|
893
|
-
match = matchers.rgba.exec(color);
|
|
894
|
-
if (match) {
|
|
895
|
-
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
896
|
-
}
|
|
897
|
-
match = matchers.hsl.exec(color);
|
|
898
|
-
if (match) {
|
|
899
|
-
return { h: match[1], s: match[2], l: match[3] };
|
|
900
|
-
}
|
|
901
|
-
match = matchers.hsla.exec(color);
|
|
902
|
-
if (match) {
|
|
903
|
-
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
904
|
-
}
|
|
905
|
-
match = matchers.hsv.exec(color);
|
|
906
|
-
if (match) {
|
|
907
|
-
return { h: match[1], s: match[2], v: match[3] };
|
|
908
|
-
}
|
|
909
|
-
match = matchers.hsva.exec(color);
|
|
910
|
-
if (match) {
|
|
911
|
-
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
912
|
-
}
|
|
913
|
-
match = matchers.hex8.exec(color);
|
|
914
|
-
if (match) {
|
|
915
|
-
return {
|
|
916
|
-
r: parseIntFromHex(match[1]),
|
|
917
|
-
g: parseIntFromHex(match[2]),
|
|
918
|
-
b: parseIntFromHex(match[3]),
|
|
919
|
-
a: convertHexToDecimal(match[4]),
|
|
920
|
-
format: named ? 'name' : 'hex8',
|
|
921
|
-
};
|
|
922
|
-
}
|
|
923
|
-
match = matchers.hex6.exec(color);
|
|
924
|
-
if (match) {
|
|
925
|
-
return {
|
|
926
|
-
r: parseIntFromHex(match[1]),
|
|
927
|
-
g: parseIntFromHex(match[2]),
|
|
928
|
-
b: parseIntFromHex(match[3]),
|
|
929
|
-
format: named ? 'name' : 'hex',
|
|
930
|
-
};
|
|
931
|
-
}
|
|
932
|
-
match = matchers.hex4.exec(color);
|
|
933
|
-
if (match) {
|
|
934
|
-
return {
|
|
935
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
936
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
937
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
938
|
-
a: convertHexToDecimal(match[4] + match[4]),
|
|
939
|
-
format: named ? 'name' : 'hex8',
|
|
940
|
-
};
|
|
941
|
-
}
|
|
942
|
-
match = matchers.hex3.exec(color);
|
|
943
|
-
if (match) {
|
|
944
|
-
return {
|
|
945
|
-
r: parseIntFromHex(match[1] + match[1]),
|
|
946
|
-
g: parseIntFromHex(match[2] + match[2]),
|
|
947
|
-
b: parseIntFromHex(match[3] + match[3]),
|
|
948
|
-
format: named ? 'name' : 'hex',
|
|
949
|
-
};
|
|
950
|
-
}
|
|
951
|
-
return false;
|
|
952
|
-
}
|
|
953
|
-
/**
|
|
954
|
-
* Check to see if it looks like a CSS unit
|
|
955
|
-
* (see `matchers` above for definition).
|
|
956
|
-
*/
|
|
957
|
-
function isValidCSSUnit(color) {
|
|
958
|
-
return Boolean(matchers.CSS_UNIT.exec(String(color)));
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
var hueStep = 2; // 色相阶梯
|
|
962
|
-
|
|
963
|
-
var saturationStep = 0.16; // 饱和度阶梯,浅色部分
|
|
964
|
-
|
|
965
|
-
var saturationStep2 = 0.05; // 饱和度阶梯,深色部分
|
|
966
|
-
|
|
967
|
-
var brightnessStep1 = 0.05; // 亮度阶梯,浅色部分
|
|
968
|
-
|
|
969
|
-
var brightnessStep2 = 0.15; // 亮度阶梯,深色部分
|
|
970
|
-
|
|
971
|
-
var lightColorCount = 5; // 浅色数量,主色上
|
|
972
|
-
|
|
973
|
-
var darkColorCount = 4; // 深色数量,主色下
|
|
974
|
-
// 暗色主题颜色映射关系表
|
|
975
|
-
|
|
976
|
-
var darkColorMap = [{
|
|
977
|
-
index: 7,
|
|
978
|
-
opacity: 0.15
|
|
979
|
-
}, {
|
|
980
|
-
index: 6,
|
|
981
|
-
opacity: 0.25
|
|
982
|
-
}, {
|
|
983
|
-
index: 5,
|
|
984
|
-
opacity: 0.3
|
|
985
|
-
}, {
|
|
986
|
-
index: 5,
|
|
987
|
-
opacity: 0.45
|
|
988
|
-
}, {
|
|
989
|
-
index: 5,
|
|
990
|
-
opacity: 0.65
|
|
991
|
-
}, {
|
|
992
|
-
index: 5,
|
|
993
|
-
opacity: 0.85
|
|
994
|
-
}, {
|
|
995
|
-
index: 4,
|
|
996
|
-
opacity: 0.9
|
|
997
|
-
}, {
|
|
998
|
-
index: 3,
|
|
999
|
-
opacity: 0.95
|
|
1000
|
-
}, {
|
|
1001
|
-
index: 2,
|
|
1002
|
-
opacity: 0.97
|
|
1003
|
-
}, {
|
|
1004
|
-
index: 1,
|
|
1005
|
-
opacity: 0.98
|
|
1006
|
-
}]; // Wrapper function ported from TinyColor.prototype.toHsv
|
|
1007
|
-
// Keep it here because of `hsv.h * 360`
|
|
1008
|
-
|
|
1009
|
-
function toHsv(_ref) {
|
|
1010
|
-
var r = _ref.r,
|
|
1011
|
-
g = _ref.g,
|
|
1012
|
-
b = _ref.b;
|
|
1013
|
-
var hsv = rgbToHsv(r, g, b);
|
|
1014
|
-
return {
|
|
1015
|
-
h: hsv.h * 360,
|
|
1016
|
-
s: hsv.s,
|
|
1017
|
-
v: hsv.v
|
|
1018
|
-
};
|
|
1019
|
-
} // Wrapper function ported from TinyColor.prototype.toHexString
|
|
1020
|
-
// Keep it here because of the prefix `#`
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
function toHex(_ref2) {
|
|
1024
|
-
var r = _ref2.r,
|
|
1025
|
-
g = _ref2.g,
|
|
1026
|
-
b = _ref2.b;
|
|
1027
|
-
return "#".concat(rgbToHex(r, g, b, false));
|
|
1028
|
-
} // Wrapper function ported from TinyColor.prototype.mix, not treeshakable.
|
|
1029
|
-
// Amount in range [0, 1]
|
|
1030
|
-
// Assume color1 & color2 has no alpha, since the following src code did so.
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
function mix(rgb1, rgb2, amount) {
|
|
1034
|
-
var p = amount / 100;
|
|
1035
|
-
var rgb = {
|
|
1036
|
-
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
1037
|
-
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
1038
|
-
b: (rgb2.b - rgb1.b) * p + rgb1.b
|
|
1039
|
-
};
|
|
1040
|
-
return rgb;
|
|
1041
|
-
}
|
|
1042
|
-
|
|
1043
|
-
function getHue(hsv, i, light) {
|
|
1044
|
-
var hue; // 根据色相不同,色相转向不同
|
|
1045
|
-
|
|
1046
|
-
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
|
|
1047
|
-
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
|
|
1048
|
-
} else {
|
|
1049
|
-
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
if (hue < 0) {
|
|
1053
|
-
hue += 360;
|
|
1054
|
-
} else if (hue >= 360) {
|
|
1055
|
-
hue -= 360;
|
|
1056
|
-
}
|
|
1057
|
-
|
|
1058
|
-
return hue;
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
function getSaturation(hsv, i, light) {
|
|
1062
|
-
// grey color don't change saturation
|
|
1063
|
-
if (hsv.h === 0 && hsv.s === 0) {
|
|
1064
|
-
return hsv.s;
|
|
1065
|
-
}
|
|
1066
|
-
|
|
1067
|
-
var saturation;
|
|
1068
|
-
|
|
1069
|
-
if (light) {
|
|
1070
|
-
saturation = hsv.s - saturationStep * i;
|
|
1071
|
-
} else if (i === darkColorCount) {
|
|
1072
|
-
saturation = hsv.s + saturationStep;
|
|
1073
|
-
} else {
|
|
1074
|
-
saturation = hsv.s + saturationStep2 * i;
|
|
1075
|
-
} // 边界值修正
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
if (saturation > 1) {
|
|
1079
|
-
saturation = 1;
|
|
1080
|
-
} // 第一格的 s 限制在 0.06-0.1 之间
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
if (light && i === lightColorCount && saturation > 0.1) {
|
|
1084
|
-
saturation = 0.1;
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
if (saturation < 0.06) {
|
|
1088
|
-
saturation = 0.06;
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
return Number(saturation.toFixed(2));
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
function getValue(hsv, i, light) {
|
|
1095
|
-
var value;
|
|
1096
|
-
|
|
1097
|
-
if (light) {
|
|
1098
|
-
value = hsv.v + brightnessStep1 * i;
|
|
1099
|
-
} else {
|
|
1100
|
-
value = hsv.v - brightnessStep2 * i;
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
|
-
if (value > 1) {
|
|
1104
|
-
value = 1;
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
return Number(value.toFixed(2));
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
function generate(color) {
|
|
1111
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1112
|
-
var patterns = [];
|
|
1113
|
-
var pColor = inputToRGB(color);
|
|
1114
|
-
|
|
1115
|
-
for (var i = lightColorCount; i > 0; i -= 1) {
|
|
1116
|
-
var hsv = toHsv(pColor);
|
|
1117
|
-
var colorString = toHex(inputToRGB({
|
|
1118
|
-
h: getHue(hsv, i, true),
|
|
1119
|
-
s: getSaturation(hsv, i, true),
|
|
1120
|
-
v: getValue(hsv, i, true)
|
|
1121
|
-
}));
|
|
1122
|
-
patterns.push(colorString);
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
patterns.push(toHex(pColor));
|
|
1126
|
-
|
|
1127
|
-
for (var _i = 1; _i <= darkColorCount; _i += 1) {
|
|
1128
|
-
var _hsv = toHsv(pColor);
|
|
1129
|
-
|
|
1130
|
-
var _colorString = toHex(inputToRGB({
|
|
1131
|
-
h: getHue(_hsv, _i),
|
|
1132
|
-
s: getSaturation(_hsv, _i),
|
|
1133
|
-
v: getValue(_hsv, _i)
|
|
1134
|
-
}));
|
|
1135
|
-
|
|
1136
|
-
patterns.push(_colorString);
|
|
1137
|
-
} // dark theme patterns
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
if (opts.theme === 'dark') {
|
|
1141
|
-
return darkColorMap.map(function (_ref3) {
|
|
1142
|
-
var index = _ref3.index,
|
|
1143
|
-
opacity = _ref3.opacity;
|
|
1144
|
-
var darkColorString = toHex(mix(inputToRGB(opts.backgroundColor || '#141414'), inputToRGB(patterns[index]), opacity * 100));
|
|
1145
|
-
return darkColorString;
|
|
1146
|
-
});
|
|
1147
|
-
}
|
|
1148
|
-
|
|
1149
|
-
return patterns;
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
var presetPrimaryColors = {
|
|
1153
|
-
red: '#F5222D',
|
|
1154
|
-
volcano: '#FA541C',
|
|
1155
|
-
orange: '#FA8C16',
|
|
1156
|
-
gold: '#FAAD14',
|
|
1157
|
-
yellow: '#FADB14',
|
|
1158
|
-
lime: '#A0D911',
|
|
1159
|
-
green: '#52C41A',
|
|
1160
|
-
cyan: '#13C2C2',
|
|
1161
|
-
blue: '#1890FF',
|
|
1162
|
-
geekblue: '#2F54EB',
|
|
1163
|
-
purple: '#722ED1',
|
|
1164
|
-
magenta: '#EB2F96',
|
|
1165
|
-
grey: '#666666'
|
|
1166
|
-
};
|
|
1167
|
-
var presetPalettes = {};
|
|
1168
|
-
var presetDarkPalettes = {};
|
|
1169
|
-
Object.keys(presetPrimaryColors).forEach(function (key) {
|
|
1170
|
-
presetPalettes[key] = generate(presetPrimaryColors[key]);
|
|
1171
|
-
presetPalettes[key].primary = presetPalettes[key][5]; // dark presetPalettes
|
|
1172
|
-
|
|
1173
|
-
presetDarkPalettes[key] = generate(presetPrimaryColors[key], {
|
|
1174
|
-
theme: 'dark',
|
|
1175
|
-
backgroundColor: '#141414'
|
|
1176
|
-
});
|
|
1177
|
-
presetDarkPalettes[key].primary = presetDarkPalettes[key][5];
|
|
1178
|
-
});
|
|
1179
|
-
|
|
1180
|
-
/* eslint-disable no-console */
|
|
1181
|
-
var warned = {};
|
|
1182
|
-
function warning(valid, message) {
|
|
1183
|
-
// Support uglify
|
|
1184
|
-
if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
|
1185
|
-
console.error("Warning: ".concat(message));
|
|
1186
|
-
}
|
|
1187
|
-
}
|
|
1188
|
-
function call(method, valid, message) {
|
|
1189
|
-
if (!valid && !warned[message]) {
|
|
1190
|
-
method(false, message);
|
|
1191
|
-
warned[message] = true;
|
|
1192
|
-
}
|
|
1193
|
-
}
|
|
1194
|
-
function warningOnce(valid, message) {
|
|
1195
|
-
call(warning, valid, message);
|
|
1196
|
-
}
|
|
1197
|
-
/* eslint-enable */
|
|
1198
|
-
|
|
1199
|
-
function canUseDom() {
|
|
1200
|
-
return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
1201
|
-
}
|
|
1202
|
-
|
|
1203
|
-
var MARK_KEY = "rc-util-key";
|
|
1204
|
-
|
|
1205
|
-
function getMark() {
|
|
1206
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1207
|
-
mark = _ref.mark;
|
|
1208
|
-
|
|
1209
|
-
if (mark) {
|
|
1210
|
-
return mark.startsWith('data-') ? mark : "data-".concat(mark);
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
|
-
return MARK_KEY;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
function getContainer(option) {
|
|
1217
|
-
if (option.attachTo) {
|
|
1218
|
-
return option.attachTo;
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
var head = document.querySelector('head');
|
|
1222
|
-
return head || document.body;
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
function injectCSS(css) {
|
|
1226
|
-
var _option$csp;
|
|
1227
|
-
|
|
1228
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1229
|
-
|
|
1230
|
-
if (!canUseDom()) {
|
|
1231
|
-
return null;
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
var styleNode = document.createElement('style');
|
|
1235
|
-
|
|
1236
|
-
if ((_option$csp = option.csp) === null || _option$csp === void 0 ? void 0 : _option$csp.nonce) {
|
|
1237
|
-
var _option$csp2;
|
|
1238
|
-
|
|
1239
|
-
styleNode.nonce = (_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce;
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
styleNode.innerHTML = css;
|
|
1243
|
-
var container = getContainer(option);
|
|
1244
|
-
var firstChild = container.firstChild;
|
|
1245
|
-
|
|
1246
|
-
if (option.prepend && container.prepend) {
|
|
1247
|
-
// Use `prepend` first
|
|
1248
|
-
container.prepend(styleNode);
|
|
1249
|
-
} else if (option.prepend && firstChild) {
|
|
1250
|
-
// Fallback to `insertBefore` like IE not support `prepend`
|
|
1251
|
-
container.insertBefore(styleNode, firstChild);
|
|
1252
|
-
} else {
|
|
1253
|
-
container.appendChild(styleNode);
|
|
1254
|
-
}
|
|
1255
|
-
|
|
1256
|
-
return styleNode;
|
|
1257
|
-
}
|
|
1258
|
-
var containerCache = new Map();
|
|
1259
|
-
|
|
1260
|
-
function findExistNode(key) {
|
|
1261
|
-
var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1262
|
-
var container = getContainer(option);
|
|
1263
|
-
return Array.from(containerCache.get(container).children).find(function (node) {
|
|
1264
|
-
return node.tagName === 'STYLE' && node.getAttribute(getMark(option)) === key;
|
|
1265
|
-
});
|
|
1266
|
-
}
|
|
1267
|
-
function updateCSS(css, key) {
|
|
1268
|
-
var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1269
|
-
var container = getContainer(option); // Get real parent
|
|
1270
|
-
|
|
1271
|
-
if (!containerCache.has(container)) {
|
|
1272
|
-
var placeholderStyle = injectCSS('', option);
|
|
1273
|
-
var parentNode = placeholderStyle.parentNode;
|
|
1274
|
-
containerCache.set(container, parentNode);
|
|
1275
|
-
parentNode.removeChild(placeholderStyle);
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
var existNode = findExistNode(key, option);
|
|
1279
|
-
|
|
1280
|
-
if (existNode) {
|
|
1281
|
-
var _option$csp3, _option$csp4;
|
|
1282
|
-
|
|
1283
|
-
if (((_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce) && existNode.nonce !== ((_option$csp4 = option.csp) === null || _option$csp4 === void 0 ? void 0 : _option$csp4.nonce)) {
|
|
1284
|
-
var _option$csp5;
|
|
1285
|
-
|
|
1286
|
-
existNode.nonce = (_option$csp5 = option.csp) === null || _option$csp5 === void 0 ? void 0 : _option$csp5.nonce;
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
|
-
if (existNode.innerHTML !== css) {
|
|
1290
|
-
existNode.innerHTML = css;
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
return existNode;
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1296
|
-
var newNode = injectCSS(css, option);
|
|
1297
|
-
newNode.setAttribute(getMark(option), key);
|
|
1298
|
-
return newNode;
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
function warning$1(valid, message) {
|
|
1302
|
-
warningOnce(valid, "[@ant-design/icons] ".concat(message));
|
|
1303
|
-
}
|
|
1304
|
-
function isIconDefinition(target) {
|
|
1305
|
-
return _typeof(target) === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (_typeof(target.icon) === 'object' || typeof target.icon === 'function');
|
|
1306
|
-
}
|
|
1307
|
-
function normalizeAttrs() {
|
|
1308
|
-
var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1309
|
-
return Object.keys(attrs).reduce(function (acc, key) {
|
|
1310
|
-
var val = attrs[key];
|
|
1311
|
-
|
|
1312
|
-
switch (key) {
|
|
1313
|
-
case 'class':
|
|
1314
|
-
acc.className = val;
|
|
1315
|
-
delete acc.class;
|
|
1316
|
-
break;
|
|
1317
|
-
|
|
1318
|
-
default:
|
|
1319
|
-
acc[key] = val;
|
|
1320
|
-
}
|
|
1321
|
-
|
|
1322
|
-
return acc;
|
|
1323
|
-
}, {});
|
|
1324
|
-
}
|
|
1325
|
-
function generate$1(node, key, rootProps) {
|
|
1326
|
-
if (!rootProps) {
|
|
1327
|
-
return /*#__PURE__*/React__default.createElement(node.tag, _objectSpread2({
|
|
1328
|
-
key: key
|
|
1329
|
-
}, normalizeAttrs(node.attrs)), (node.children || []).map(function (child, index) {
|
|
1330
|
-
return generate$1(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
|
1331
|
-
}));
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
return /*#__PURE__*/React__default.createElement(node.tag, _objectSpread2(_objectSpread2({
|
|
1335
|
-
key: key
|
|
1336
|
-
}, normalizeAttrs(node.attrs)), rootProps), (node.children || []).map(function (child, index) {
|
|
1337
|
-
return generate$1(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
|
1338
|
-
}));
|
|
1339
|
-
}
|
|
1340
|
-
function getSecondaryColor(primaryColor) {
|
|
1341
|
-
// choose the second color
|
|
1342
|
-
return generate(primaryColor)[0];
|
|
1343
|
-
}
|
|
1344
|
-
function normalizeTwoToneColors(twoToneColor) {
|
|
1345
|
-
if (!twoToneColor) {
|
|
1346
|
-
return [];
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
|
|
1350
|
-
} // These props make sure that the SVG behaviours like general text.
|
|
1351
|
-
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";
|
|
1352
|
-
var useInsertStyles = function useInsertStyles() {
|
|
1353
|
-
var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : iconStyles;
|
|
1354
|
-
|
|
1355
|
-
var _useContext = React.useContext(IconContext),
|
|
1356
|
-
csp = _useContext.csp;
|
|
1357
|
-
|
|
1358
|
-
React.useEffect(function () {
|
|
1359
|
-
updateCSS(styleStr, '@ant-design-icons', {
|
|
1360
|
-
prepend: true,
|
|
1361
|
-
csp: csp
|
|
1362
|
-
});
|
|
1363
|
-
}, []);
|
|
1364
|
-
};
|
|
1365
|
-
|
|
1366
|
-
var _excluded = ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"];
|
|
1367
|
-
var twoToneColorPalette = {
|
|
1368
|
-
primaryColor: '#333',
|
|
1369
|
-
secondaryColor: '#E6E6E6',
|
|
1370
|
-
calculated: false
|
|
1371
|
-
};
|
|
1372
|
-
|
|
1373
|
-
function setTwoToneColors(_ref) {
|
|
1374
|
-
var primaryColor = _ref.primaryColor,
|
|
1375
|
-
secondaryColor = _ref.secondaryColor;
|
|
1376
|
-
twoToneColorPalette.primaryColor = primaryColor;
|
|
1377
|
-
twoToneColorPalette.secondaryColor = secondaryColor || getSecondaryColor(primaryColor);
|
|
1378
|
-
twoToneColorPalette.calculated = !!secondaryColor;
|
|
1379
|
-
}
|
|
1380
|
-
|
|
1381
|
-
function getTwoToneColors() {
|
|
1382
|
-
return _objectSpread2({}, twoToneColorPalette);
|
|
1383
|
-
}
|
|
1384
|
-
|
|
1385
|
-
var IconBase = function IconBase(props) {
|
|
1386
|
-
var icon = props.icon,
|
|
1387
|
-
className = props.className,
|
|
1388
|
-
onClick = props.onClick,
|
|
1389
|
-
style = props.style,
|
|
1390
|
-
primaryColor = props.primaryColor,
|
|
1391
|
-
secondaryColor = props.secondaryColor,
|
|
1392
|
-
restProps = _objectWithoutProperties(props, _excluded);
|
|
1393
|
-
|
|
1394
|
-
var colors = twoToneColorPalette;
|
|
1395
|
-
|
|
1396
|
-
if (primaryColor) {
|
|
1397
|
-
colors = {
|
|
1398
|
-
primaryColor: primaryColor,
|
|
1399
|
-
secondaryColor: secondaryColor || getSecondaryColor(primaryColor)
|
|
1400
|
-
};
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
useInsertStyles();
|
|
1404
|
-
warning$1(isIconDefinition(icon), "icon should be icon definiton, but got ".concat(icon));
|
|
1405
|
-
|
|
1406
|
-
if (!isIconDefinition(icon)) {
|
|
1407
|
-
return null;
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
var target = icon;
|
|
1411
|
-
|
|
1412
|
-
if (target && typeof target.icon === 'function') {
|
|
1413
|
-
target = _objectSpread2(_objectSpread2({}, target), {}, {
|
|
1414
|
-
icon: target.icon(colors.primaryColor, colors.secondaryColor)
|
|
1415
|
-
});
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
return generate$1(target.icon, "svg-".concat(target.name), _objectSpread2({
|
|
1419
|
-
className: className,
|
|
1420
|
-
onClick: onClick,
|
|
1421
|
-
style: style,
|
|
1422
|
-
'data-icon': target.name,
|
|
1423
|
-
width: '1em',
|
|
1424
|
-
height: '1em',
|
|
1425
|
-
fill: 'currentColor',
|
|
1426
|
-
'aria-hidden': 'true'
|
|
1427
|
-
}, restProps));
|
|
1428
|
-
};
|
|
1429
|
-
|
|
1430
|
-
IconBase.displayName = 'IconReact';
|
|
1431
|
-
IconBase.getTwoToneColors = getTwoToneColors;
|
|
1432
|
-
IconBase.setTwoToneColors = setTwoToneColors;
|
|
1433
|
-
|
|
1434
|
-
function setTwoToneColor(twoToneColor) {
|
|
1435
|
-
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
|
|
1436
|
-
_normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
|
|
1437
|
-
primaryColor = _normalizeTwoToneColo2[0],
|
|
1438
|
-
secondaryColor = _normalizeTwoToneColo2[1];
|
|
1439
|
-
|
|
1440
|
-
return IconBase.setTwoToneColors({
|
|
1441
|
-
primaryColor: primaryColor,
|
|
1442
|
-
secondaryColor: secondaryColor
|
|
1443
|
-
});
|
|
1444
|
-
}
|
|
1445
|
-
function getTwoToneColor() {
|
|
1446
|
-
var colors = IconBase.getTwoToneColors();
|
|
1447
|
-
|
|
1448
|
-
if (!colors.calculated) {
|
|
1449
|
-
return colors.primaryColor;
|
|
1450
|
-
}
|
|
1451
|
-
|
|
1452
|
-
return [colors.primaryColor, colors.secondaryColor];
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
var _excluded$1 = ["className", "icon", "spin", "rotate", "tabIndex", "onClick", "twoToneColor"];
|
|
1456
|
-
// should move it to antd main repo?
|
|
1457
|
-
|
|
1458
|
-
setTwoToneColor('#1890ff');
|
|
1459
|
-
var Icon = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
1460
|
-
var _classNames;
|
|
1461
|
-
|
|
1462
|
-
var className = props.className,
|
|
1463
|
-
icon = props.icon,
|
|
1464
|
-
spin = props.spin,
|
|
1465
|
-
rotate = props.rotate,
|
|
1466
|
-
tabIndex = props.tabIndex,
|
|
1467
|
-
onClick = props.onClick,
|
|
1468
|
-
twoToneColor = props.twoToneColor,
|
|
1469
|
-
restProps = _objectWithoutProperties(props, _excluded$1);
|
|
1470
|
-
|
|
1471
|
-
var _React$useContext = React.useContext(IconContext),
|
|
1472
|
-
_React$useContext$pre = _React$useContext.prefixCls,
|
|
1473
|
-
prefixCls = _React$useContext$pre === void 0 ? 'anticon' : _React$useContext$pre;
|
|
1474
|
-
|
|
1475
|
-
var classString = classnames(prefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-").concat(icon.name), !!icon.name), _defineProperty(_classNames, "".concat(prefixCls, "-spin"), !!spin || icon.name === 'loading'), _classNames), className);
|
|
1476
|
-
var iconTabIndex = tabIndex;
|
|
1477
|
-
|
|
1478
|
-
if (iconTabIndex === undefined && onClick) {
|
|
1479
|
-
iconTabIndex = -1;
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
var svgStyle = rotate ? {
|
|
1483
|
-
msTransform: "rotate(".concat(rotate, "deg)"),
|
|
1484
|
-
transform: "rotate(".concat(rotate, "deg)")
|
|
1485
|
-
} : undefined;
|
|
1486
|
-
|
|
1487
|
-
var _normalizeTwoToneColo = normalizeTwoToneColors(twoToneColor),
|
|
1488
|
-
_normalizeTwoToneColo2 = _slicedToArray(_normalizeTwoToneColo, 2),
|
|
1489
|
-
primaryColor = _normalizeTwoToneColo2[0],
|
|
1490
|
-
secondaryColor = _normalizeTwoToneColo2[1];
|
|
1491
|
-
|
|
1492
|
-
return /*#__PURE__*/React.createElement("span", _objectSpread2(_objectSpread2({
|
|
1493
|
-
role: "img",
|
|
1494
|
-
"aria-label": icon.name
|
|
1495
|
-
}, restProps), {}, {
|
|
1496
|
-
ref: ref,
|
|
1497
|
-
tabIndex: iconTabIndex,
|
|
1498
|
-
onClick: onClick,
|
|
1499
|
-
className: classString
|
|
1500
|
-
}), /*#__PURE__*/React.createElement(IconBase, {
|
|
1501
|
-
icon: icon,
|
|
1502
|
-
primaryColor: primaryColor,
|
|
1503
|
-
secondaryColor: secondaryColor,
|
|
1504
|
-
style: svgStyle
|
|
1505
|
-
}));
|
|
1506
|
-
});
|
|
1507
|
-
Icon.displayName = 'AntdIcon';
|
|
1508
|
-
Icon.getTwoToneColor = getTwoToneColor;
|
|
1509
|
-
Icon.setTwoToneColor = setTwoToneColor;
|
|
1510
|
-
|
|
1511
|
-
// This icon file is generated automatically.
|
|
1512
|
-
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" };
|
|
1513
|
-
|
|
1514
|
-
var BellOutlined$1 = function BellOutlined$1(props, ref) {
|
|
1515
|
-
return /*#__PURE__*/React.createElement(Icon, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1516
|
-
ref: ref,
|
|
1517
|
-
icon: BellOutlined
|
|
1518
|
-
}));
|
|
1519
|
-
};
|
|
1520
|
-
|
|
1521
|
-
BellOutlined$1.displayName = 'BellOutlined';
|
|
1522
|
-
var BellOutlined$2 = /*#__PURE__*/React.forwardRef(BellOutlined$1);
|
|
1523
|
-
|
|
1524
|
-
// This icon file is generated automatically.
|
|
1525
|
-
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" };
|
|
1526
|
-
|
|
1527
|
-
var ShoppingCartOutlined$1 = function ShoppingCartOutlined$1(props, ref) {
|
|
1528
|
-
return /*#__PURE__*/React.createElement(Icon, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
1529
|
-
ref: ref,
|
|
1530
|
-
icon: ShoppingCartOutlined
|
|
1531
|
-
}));
|
|
1532
|
-
};
|
|
1533
|
-
|
|
1534
|
-
ShoppingCartOutlined$1.displayName = 'ShoppingCartOutlined';
|
|
1535
|
-
var ShoppingCartOutlined$2 = /*#__PURE__*/React.forwardRef(ShoppingCartOutlined$1);
|
|
1536
|
-
|
|
1537
|
-
var NotifyMeButton = function NotifyMeButton(_ref) {
|
|
1538
|
-
var onClick = _ref.onClick;
|
|
1539
|
-
return /*#__PURE__*/React__default.createElement(StyledNotifyButton, {
|
|
1540
|
-
onClick: onClick
|
|
1541
|
-
}, /*#__PURE__*/React__default.createElement(BellOutlined$2, null));
|
|
1542
|
-
};
|
|
1543
|
-
|
|
1544
|
-
var NotifyMe = function NotifyMe() {
|
|
1545
|
-
var _useState = React.useState(''),
|
|
1546
|
-
email = _useState[0],
|
|
1547
|
-
setEmail = _useState[1];
|
|
1548
|
-
|
|
1549
|
-
var _useContext = React.useContext(ProductContext),
|
|
1550
|
-
id = _useContext.item.id,
|
|
1551
|
-
onNotifyClick = _useContext.onNotifyClick;
|
|
1552
|
-
|
|
1553
|
-
var onInputChange = function onInputChange(_ref2) {
|
|
1554
|
-
var value = _ref2.target.value;
|
|
1555
|
-
setEmail(value);
|
|
1556
|
-
};
|
|
1557
|
-
|
|
1558
|
-
var onNotifyPressed = function onNotifyPressed(e) {
|
|
1559
|
-
preventOuterClick(e);
|
|
1560
|
-
onNotifyClick({
|
|
1561
|
-
email: email,
|
|
1562
|
-
id: id
|
|
1563
|
-
});
|
|
1564
|
-
};
|
|
1565
|
-
|
|
1566
|
-
return /*#__PURE__*/React__default.createElement(StyledNotifyMe, null, /*#__PURE__*/React__default.createElement(antd.Input, {
|
|
1567
|
-
onChange: onInputChange,
|
|
1568
|
-
onClick: preventOuterClick
|
|
1569
|
-
}), /*#__PURE__*/React__default.createElement(NotifyMeButton, {
|
|
1570
|
-
onClick: onNotifyPressed
|
|
1571
|
-
}));
|
|
1572
|
-
};
|
|
1573
|
-
|
|
1574
|
-
var _templateObject$1;
|
|
1575
|
-
var StyledAddToCartIconButton = styled__default(antd.Button)(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n ", ";\n"])), primaryButtonStyle);
|
|
1576
|
-
var AddToCartButton = function AddToCartButton(_ref) {
|
|
1577
|
-
var onClick = _ref.onClick;
|
|
1578
|
-
return /*#__PURE__*/React__default.createElement(StyledAddToCartIconButton, {
|
|
1579
|
-
onClick: onClick
|
|
1580
|
-
}, /*#__PURE__*/React__default.createElement(ShoppingCartOutlined$2, null));
|
|
1581
|
-
};
|
|
1582
|
-
|
|
1583
|
-
var LoginView = function LoginView(_ref) {
|
|
1584
|
-
var onClick = _ref.onClick;
|
|
1585
|
-
return /*#__PURE__*/React__default.createElement(StyledLoginView, null, /*#__PURE__*/React__default.createElement(antd.Button, {
|
|
1586
|
-
type: "link",
|
|
1587
|
-
danger: true,
|
|
1588
|
-
onClick: onClick
|
|
1589
|
-
}, "Login"), "to view price.");
|
|
1590
|
-
};
|
|
1591
|
-
|
|
1592
|
-
var One = function One() {
|
|
1593
|
-
var _useContext = React.useContext(ProductContext),
|
|
1594
|
-
_useContext$item = _useContext.item,
|
|
1595
|
-
price = _useContext$item.price,
|
|
1596
|
-
currency = _useContext$item.currency,
|
|
1597
|
-
qty = _useContext$item.qty,
|
|
1598
|
-
id = _useContext$item.id,
|
|
1599
|
-
addToCart = _useContext.addToCart,
|
|
1600
|
-
showLogin = _useContext.showLogin,
|
|
1601
|
-
onLoginClick = _useContext.onLoginClick;
|
|
1602
|
-
|
|
1603
|
-
var _useState = React.useState(0),
|
|
1604
|
-
newUpdatedQty = _useState[0],
|
|
1605
|
-
setNewUpdatedQty = _useState[1];
|
|
1606
|
-
|
|
1607
|
-
var amount = currency + " " + price;
|
|
1608
|
-
var productCount = qty > 50 ? '50+' : qty;
|
|
1609
|
-
var inStockMessage = "In-stock: " + productCount;
|
|
1610
|
-
var outOfStock = /*#__PURE__*/React__default.createElement(StyledOutOfStock, null, "Out Of Stock");
|
|
1611
|
-
var isProductOutOfStock = qty === 0;
|
|
1612
|
-
var stockTitle = isProductOutOfStock ? outOfStock : inStockMessage;
|
|
1613
|
-
|
|
1614
|
-
var handleAddToCart = function handleAddToCart(e) {
|
|
1615
|
-
preventOuterClick(e);
|
|
1616
|
-
addToCart({
|
|
1617
|
-
id: id,
|
|
1618
|
-
qty: newUpdatedQty
|
|
1619
|
-
});
|
|
1620
|
-
};
|
|
1621
|
-
|
|
1622
|
-
var renderSubModules = function renderSubModules() {
|
|
1623
|
-
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, {
|
|
1624
|
-
updatedQty: setNewUpdatedQty
|
|
1625
|
-
}), /*#__PURE__*/React__default.createElement(AddToCartButton, {
|
|
1626
|
-
onClick: handleAddToCart
|
|
1627
|
-
})));
|
|
1628
|
-
};
|
|
1629
|
-
|
|
1630
|
-
return /*#__PURE__*/React__default.createElement(StyledOne, null, showLogin ? /*#__PURE__*/React__default.createElement(LoginView, {
|
|
1631
|
-
onClick: function onClick(e) {
|
|
1632
|
-
preventOuterClick(e);
|
|
1633
|
-
onLoginClick(e);
|
|
1634
|
-
}
|
|
1635
|
-
}) : renderSubModules());
|
|
1636
|
-
};
|
|
1637
|
-
|
|
1638
|
-
var _templateObject$2, _templateObject2$1, _templateObject3$1, _templateObject4$1;
|
|
1639
|
-
var StyledTwo = styled__default.div(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["\n min-height: 60px;\n"])));
|
|
1640
|
-
var StyledPrice$1 = styled__default.div(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n font-size: 20px;\n margin-bottom: 10px;\n"])));
|
|
1641
|
-
var StyledOutOfStock$1 = styled__default.div(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteralLoose(["\n height: 35px;\n text-transform: uppercase;\n\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
|
|
1642
|
-
var StyledAddToCartButton = styled__default(antd.Button)(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteralLoose(["\n height: 35px;\n\n ", "\n"])), primaryButtonStyle);
|
|
1643
|
-
|
|
1644
|
-
function Two() {
|
|
1645
|
-
var _useContext = React.useContext(ProductContext),
|
|
1646
|
-
_useContext$item = _useContext.item,
|
|
1647
|
-
price = _useContext$item.price,
|
|
1648
|
-
currency = _useContext$item.currency,
|
|
1649
|
-
qty = _useContext$item.qty,
|
|
1650
|
-
id = _useContext$item.id,
|
|
1651
|
-
addToCart = _useContext.addToCart;
|
|
1652
|
-
|
|
1653
|
-
var amount = currency + " " + price;
|
|
1654
|
-
var isProductOutOfStock = qty === 0;
|
|
1655
|
-
|
|
1656
|
-
var onAddToCartClick = function onAddToCartClick(e) {
|
|
1657
|
-
preventOuterClick(e);
|
|
1658
|
-
addToCart({
|
|
1659
|
-
id: id,
|
|
1660
|
-
qty: 1
|
|
1661
|
-
});
|
|
1662
|
-
};
|
|
1663
|
-
|
|
1664
|
-
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, {
|
|
1665
|
-
type: "primary",
|
|
1666
|
-
icon: /*#__PURE__*/React__default.createElement(ShoppingCartOutlined$2, null),
|
|
1667
|
-
onClick: onAddToCartClick
|
|
1668
|
-
}, "Add to Cart"));
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
var _templateObject$3, _templateObject2$2, _templateObject3$2, _templateObject4$2, _templateObject5$1;
|
|
1672
|
-
var StyledThree = styled__default.div(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteralLoose([""])));
|
|
1673
|
-
var StyledPrice$2 = styled__default.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n font-weight: bold;\n ", ";\n"])), labelPrimaryStyle);
|
|
1674
|
-
var StyledAddToCartButton$1 = styled__default(antd.Button)(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n width: 100%;\n ", ";\n"])), primaryButtonStyle);
|
|
1675
|
-
var StyledPriceQtyContainer = styled__default(StyledFlex)(_templateObject4$2 || (_templateObject4$2 = _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"])));
|
|
1676
|
-
var StyledQty = styled__default.div(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteralLoose([""])));
|
|
1677
|
-
|
|
1678
|
-
function Three() {
|
|
1679
|
-
var _useContext = React.useContext(ProductContext),
|
|
1680
|
-
_useContext$item = _useContext.item,
|
|
1681
|
-
price = _useContext$item.price,
|
|
1682
|
-
currency = _useContext$item.currency,
|
|
1683
|
-
qty = _useContext$item.qty,
|
|
1684
|
-
id = _useContext$item.id,
|
|
1685
|
-
addToCart = _useContext.addToCart;
|
|
1686
|
-
|
|
1687
|
-
var _useState = React.useState(0),
|
|
1688
|
-
newUpdatedQty = _useState[0],
|
|
1689
|
-
setNewUpdatedQty = _useState[1];
|
|
1690
|
-
|
|
1691
|
-
var amount = currency + " " + price;
|
|
1692
|
-
var isProductOutOfStock = qty === 0;
|
|
1693
|
-
|
|
1694
|
-
var onAddToCartClick = function onAddToCartClick(e) {
|
|
1695
|
-
preventOuterClick(e);
|
|
1696
|
-
addToCart({
|
|
1697
|
-
id: id,
|
|
1698
|
-
qty: newUpdatedQty
|
|
1699
|
-
});
|
|
1700
|
-
};
|
|
1701
|
-
|
|
1702
|
-
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, {
|
|
1703
|
-
updatedQty: setNewUpdatedQty
|
|
1704
|
-
}))), isProductOutOfStock ? /*#__PURE__*/React__default.createElement(NotifyMe, null) : /*#__PURE__*/React__default.createElement(StyledAddToCartButton$1, {
|
|
1705
|
-
type: "primary",
|
|
1706
|
-
icon: /*#__PURE__*/React__default.createElement(ShoppingCartOutlined$2, null),
|
|
1707
|
-
onClick: onAddToCartClick
|
|
1708
|
-
}, "Add to Cart"));
|
|
1709
|
-
}
|
|
1710
|
-
|
|
1711
|
-
var _templateObject$4;
|
|
1712
|
-
|
|
1713
|
-
var imageLayout = function imageLayout(_ref) {
|
|
1714
|
-
var image = _ref.layout.image;
|
|
1715
|
-
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";
|
|
1716
|
-
};
|
|
1717
|
-
|
|
1718
|
-
var titleLayout = function titleLayout(_ref2) {
|
|
1719
|
-
var title = _ref2.layout.title;
|
|
1720
|
-
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";
|
|
1721
|
-
};
|
|
1722
|
-
|
|
1723
|
-
var descriptionLayout = function descriptionLayout(_ref3) {
|
|
1724
|
-
var detail = _ref3.layout.detail;
|
|
1725
|
-
return "\n margin-bottom: " + detail.mb + "px;\n";
|
|
1726
|
-
};
|
|
1727
|
-
|
|
1728
|
-
var StyledCardProductContainer = styled__default(antd.Card)(_templateObject$4 || (_templateObject$4 = _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"])), imageLayout, titleLayout, descriptionLayout);
|
|
1729
|
-
|
|
1730
|
-
var OneQuickAction = function OneQuickAction() {
|
|
1731
|
-
var _useContext = React.useContext(ProductContext),
|
|
1732
|
-
id = _useContext.item.id,
|
|
1733
|
-
addToCart = _useContext.addToCart;
|
|
1734
|
-
|
|
1735
|
-
return /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement(AddToCartButton, {
|
|
1736
|
-
onClick: function onClick(e) {
|
|
1737
|
-
preventOuterClick(e);
|
|
1738
|
-
addToCart({
|
|
1739
|
-
id: id,
|
|
1740
|
-
qty: 1
|
|
1741
|
-
});
|
|
1742
|
-
}
|
|
1743
|
-
}));
|
|
1744
|
-
};
|
|
1745
|
-
|
|
1746
|
-
var _templateObject$5;
|
|
1747
|
-
var StyledQuickActions = styled__default.div(_templateObject$5 || (_templateObject$5 = _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"])));
|
|
1748
|
-
var QuickAction = function QuickAction(props) {
|
|
1749
|
-
return /*#__PURE__*/React__default.createElement(StyledQuickActions, _extends({}, props, {
|
|
1750
|
-
className: "quick-action"
|
|
1751
|
-
}), props.children);
|
|
1752
|
-
};
|
|
1753
|
-
|
|
1754
|
-
var Breakpoint = function Breakpoint() {};
|
|
1755
|
-
|
|
1756
|
-
Breakpoint.xs = 'xs';
|
|
1757
|
-
Breakpoint.sm = 'sm';
|
|
1758
|
-
Breakpoint.md = 'md';
|
|
1759
|
-
Breakpoint.lg = 'lg';
|
|
1760
|
-
Breakpoint.xl = 'xl';
|
|
1761
|
-
Breakpoint.xxl = 'xxl';
|
|
1762
|
-
|
|
1763
|
-
var Variant = function Variant() {};
|
|
1764
|
-
|
|
1765
|
-
Variant.ONE = 'one';
|
|
1766
|
-
Variant.TWO = 'two';
|
|
1767
|
-
Variant.THREE = 'three';
|
|
1768
|
-
|
|
1769
|
-
var Meta = antd.Card.Meta;
|
|
1770
|
-
|
|
1771
|
-
var noop = function noop() {};
|
|
1772
|
-
|
|
1773
|
-
var defaultProps = {
|
|
1774
|
-
addToCart: noop,
|
|
1775
|
-
onNotifyClick: noop,
|
|
1776
|
-
onLoginClick: noop,
|
|
1777
|
-
item: {},
|
|
1778
|
-
variant: '',
|
|
1779
|
-
showLogin: false
|
|
1780
|
-
};
|
|
1781
|
-
var ProductContext = React__default.createContext(defaultProps);
|
|
1782
|
-
|
|
1783
|
-
var getComponent = function getComponent(variant) {
|
|
1784
|
-
switch (variant) {
|
|
1785
|
-
case Variant.ONE:
|
|
1786
|
-
return {
|
|
1787
|
-
quickAction: /*#__PURE__*/React__default.createElement(OneQuickAction, null),
|
|
1788
|
-
subComponent: /*#__PURE__*/React__default.createElement(One, null)
|
|
1789
|
-
};
|
|
1790
|
-
|
|
1791
|
-
case Variant.TWO:
|
|
1792
|
-
return {
|
|
1793
|
-
quickAction: /*#__PURE__*/React__default.createElement(OneQuickAction, null),
|
|
1794
|
-
subComponent: /*#__PURE__*/React__default.createElement(Two, null)
|
|
1795
|
-
};
|
|
1796
|
-
|
|
1797
|
-
case Variant.THREE:
|
|
1798
|
-
return {
|
|
1799
|
-
quickAction: /*#__PURE__*/React__default.createElement(OneQuickAction, null),
|
|
1800
|
-
subComponent: /*#__PURE__*/React__default.createElement(Three, null)
|
|
1801
|
-
};
|
|
1802
|
-
|
|
1803
|
-
default:
|
|
1804
|
-
return {
|
|
1805
|
-
quickAction: '',
|
|
1806
|
-
subComponent: ''
|
|
1807
|
-
};
|
|
1808
|
-
}
|
|
1809
|
-
};
|
|
1810
|
-
|
|
1811
|
-
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==';
|
|
1812
|
-
|
|
1813
|
-
var Product = function Product(props) {
|
|
1814
|
-
var _props$item = props.item,
|
|
1815
|
-
imgUrl = _props$item.imgUrl,
|
|
1816
|
-
title = _props$item.title,
|
|
1817
|
-
description = _props$item.description,
|
|
1818
|
-
qty = _props$item.qty,
|
|
1819
|
-
item = props.item,
|
|
1820
|
-
colValues = props.colValues,
|
|
1821
|
-
layoutModel = props.layoutModel,
|
|
1822
|
-
showBoxShadow = props.showBoxShadow,
|
|
1823
|
-
showLogin = props.showLogin,
|
|
1824
|
-
onImageClick = props.onImageClick,
|
|
1825
|
-
onProductClick = props.onProductClick;
|
|
1826
|
-
var c = getComponent(props.variant);
|
|
1827
|
-
var showQuickAction = layoutModel.showQuickActions && !showLogin && qty > 0;
|
|
1828
|
-
return /*#__PURE__*/React__default.createElement(antd.Col, {
|
|
1829
|
-
span: colValues
|
|
1830
|
-
}, /*#__PURE__*/React__default.createElement(ProductContext.Provider, {
|
|
1831
|
-
value: _extends({}, props)
|
|
1832
|
-
}, /*#__PURE__*/React__default.createElement(StyledCardProductContainer, {
|
|
1833
|
-
onClick: function onClick(e) {
|
|
1834
|
-
return onProductClick(item, e);
|
|
1835
|
-
},
|
|
1836
|
-
layout: layoutModel,
|
|
1837
|
-
hoverable: showBoxShadow,
|
|
1838
|
-
cover: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, showQuickAction && /*#__PURE__*/React__default.createElement(QuickAction, null, c.quickAction), /*#__PURE__*/React__default.createElement(antd.Image, {
|
|
1839
|
-
onClick: function onClick(e) {
|
|
1840
|
-
preventOuterClick(e);
|
|
1841
|
-
onImageClick(item, e);
|
|
1842
|
-
},
|
|
1843
|
-
preview: false,
|
|
1844
|
-
alt: "example",
|
|
1845
|
-
src: imgUrl ? imgUrl : '',
|
|
1846
|
-
fallback: defaultFallbackImageUrl
|
|
1847
|
-
}))
|
|
1848
|
-
}, /*#__PURE__*/React__default.createElement(Meta, {
|
|
1849
|
-
title: title,
|
|
1850
|
-
description: description
|
|
1851
|
-
}), c.subComponent)));
|
|
1852
|
-
};
|
|
1853
|
-
|
|
1854
|
-
var theme = {
|
|
1855
|
-
colors: {
|
|
1856
|
-
primary: 'red',
|
|
1857
|
-
white: 'white'
|
|
1858
|
-
}
|
|
1859
|
-
};
|
|
1860
|
-
|
|
1861
|
-
var _excluded$2 = ["colCount", "items", "theme"];
|
|
1862
|
-
|
|
1863
|
-
var noop$1 = function noop() {};
|
|
1864
|
-
|
|
1865
|
-
var getLayoutModel = function getLayoutModel(_temp) {
|
|
1866
|
-
var _ref = _temp === void 0 ? {} : _temp,
|
|
1867
|
-
_ref$rowSpace = _ref.rowSpace,
|
|
1868
|
-
rowSpace = _ref$rowSpace === void 0 ? 8 : _ref$rowSpace,
|
|
1869
|
-
_ref$colSpace = _ref.colSpace,
|
|
1870
|
-
colSpace = _ref$colSpace === void 0 ? 8 : _ref$colSpace,
|
|
1871
|
-
_ref$imageSize = _ref.imageSize,
|
|
1872
|
-
imageSize = _ref$imageSize === void 0 ? 100 : _ref$imageSize,
|
|
1873
|
-
_ref$imageBottomSpace = _ref.imageBottomSpace,
|
|
1874
|
-
imageBottomSpace = _ref$imageBottomSpace === void 0 ? 15 : _ref$imageBottomSpace,
|
|
1875
|
-
_ref$titleBottomSpace = _ref.titleBottomSpace,
|
|
1876
|
-
titleBottomSpace = _ref$titleBottomSpace === void 0 ? 10 : _ref$titleBottomSpace,
|
|
1877
|
-
_ref$titleLineClamp = _ref.titleLineClamp,
|
|
1878
|
-
titleLineClamp = _ref$titleLineClamp === void 0 ? 2 : _ref$titleLineClamp,
|
|
1879
|
-
_ref$detailBottomSpac = _ref.detailBottomSpace,
|
|
1880
|
-
detailBottomSpace = _ref$detailBottomSpac === void 0 ? 0 : _ref$detailBottomSpac,
|
|
1881
|
-
_ref$showBoxShadow = _ref.showBoxShadow,
|
|
1882
|
-
showBoxShadow = _ref$showBoxShadow === void 0 ? true : _ref$showBoxShadow,
|
|
1883
|
-
_ref$showQuickActions = _ref.showQuickActions,
|
|
1884
|
-
showQuickActions = _ref$showQuickActions === void 0 ? false : _ref$showQuickActions,
|
|
1885
|
-
_ref$backgroundColor = _ref.backgroundColor,
|
|
1886
|
-
backgroundColor = _ref$backgroundColor === void 0 ? 'white' : _ref$backgroundColor,
|
|
1887
|
-
_ref$variant = _ref.variant,
|
|
1888
|
-
variant = _ref$variant === void 0 ? 'one' : _ref$variant;
|
|
1889
|
-
|
|
1890
|
-
return {
|
|
1891
|
-
rowSpace: rowSpace,
|
|
1892
|
-
colSpace: colSpace,
|
|
1893
|
-
showBoxShadow: showBoxShadow,
|
|
1894
|
-
backgroundColor: backgroundColor,
|
|
1895
|
-
showQuickActions: showQuickActions,
|
|
1896
|
-
variant: variant,
|
|
1897
|
-
image: {
|
|
1898
|
-
size: imageSize,
|
|
1899
|
-
mb: imageBottomSpace
|
|
1900
|
-
},
|
|
1901
|
-
title: {
|
|
1902
|
-
lineCamp: titleLineClamp,
|
|
1903
|
-
mb: titleBottomSpace
|
|
1904
|
-
},
|
|
1905
|
-
detail: {
|
|
1906
|
-
mb: detailBottomSpace
|
|
1907
|
-
}
|
|
1908
|
-
};
|
|
1909
|
-
};
|
|
1910
|
-
var defaultProps$1 = {
|
|
1911
|
-
items: [],
|
|
1912
|
-
layoutModel: getLayoutModel(),
|
|
1913
|
-
colCount: 3,
|
|
1914
|
-
onLoginClick: noop$1,
|
|
1915
|
-
onNotifyClick: noop$1,
|
|
1916
|
-
addToCart: noop$1,
|
|
1917
|
-
onImageClick: noop$1,
|
|
1918
|
-
onProductClick: noop$1
|
|
1919
|
-
};
|
|
1920
|
-
|
|
1921
|
-
var ProductSlider = function ProductSlider(props) {
|
|
1922
|
-
if (props === void 0) {
|
|
1923
|
-
props = {};
|
|
1924
|
-
}
|
|
1925
|
-
|
|
1926
|
-
var newProps = _extends({}, defaultProps$1, props);
|
|
1927
|
-
|
|
1928
|
-
var colCount = newProps.colCount,
|
|
1929
|
-
items = newProps.items,
|
|
1930
|
-
theme$1 = newProps.theme,
|
|
1931
|
-
restProps = _objectWithoutPropertiesLoose(newProps, _excluded$2);
|
|
1932
|
-
|
|
1933
|
-
var _restProps$layoutMode = restProps.layoutModel,
|
|
1934
|
-
colSpace = _restProps$layoutMode.colSpace,
|
|
1935
|
-
rowSpace = _restProps$layoutMode.rowSpace,
|
|
1936
|
-
showBoxShadow = _restProps$layoutMode.showBoxShadow,
|
|
1937
|
-
backgroundColor = _restProps$layoutMode.backgroundColor,
|
|
1938
|
-
variant = _restProps$layoutMode.variant;
|
|
1939
|
-
|
|
1940
|
-
var commonProps = _extends({
|
|
1941
|
-
variant: variant,
|
|
1942
|
-
colValues: 24 / colCount,
|
|
1943
|
-
showBoxShadow: showBoxShadow
|
|
1944
|
-
}, restProps);
|
|
1945
|
-
|
|
1946
|
-
var products = items.map(function (item) {
|
|
1947
|
-
return /*#__PURE__*/React__default.createElement(Product, _extends({
|
|
1948
|
-
item: item
|
|
1949
|
-
}, commonProps, {
|
|
1950
|
-
key: item.id
|
|
1951
|
-
}));
|
|
1952
|
-
});
|
|
1953
|
-
|
|
1954
|
-
var newTheme = _extends({}, theme, {
|
|
1955
|
-
colors: _extends({}, theme.colors, theme$1.colors)
|
|
1956
|
-
});
|
|
1957
|
-
|
|
1958
|
-
return /*#__PURE__*/React__default.createElement(styled.ThemeProvider, {
|
|
1959
|
-
theme: newTheme
|
|
1960
|
-
}, /*#__PURE__*/React__default.createElement(antd.Row, {
|
|
1961
|
-
gutter: [colSpace, rowSpace],
|
|
1962
|
-
style: {
|
|
1963
|
-
background: backgroundColor
|
|
1964
|
-
}
|
|
1965
|
-
}, products));
|
|
1966
|
-
};
|
|
1967
|
-
|
|
1968
|
-
var ProductHelper = /*#__PURE__*/function () {
|
|
1969
|
-
function ProductHelper() {
|
|
1970
|
-
this.setupMap();
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
|
-
var _proto = ProductHelper.prototype;
|
|
1974
|
-
|
|
1975
|
-
_proto.setupMap = function setupMap() {
|
|
1976
|
-
this.map = new Map();
|
|
1977
|
-
this.map.set(Breakpoint.xs, 1);
|
|
1978
|
-
this.map.set(Breakpoint.sm, 2);
|
|
1979
|
-
this.map.set(Breakpoint.md, 3);
|
|
1980
|
-
this.map.set(Breakpoint.lg, 4);
|
|
1981
|
-
this.map.set(Breakpoint.xl, 4);
|
|
1982
|
-
this.map.set(Breakpoint.xxl, 6);
|
|
1983
|
-
};
|
|
1984
|
-
|
|
1985
|
-
_proto.productListToShow = function productListToShow(breakpoint) {
|
|
1986
|
-
return this.map.get(breakpoint);
|
|
1987
|
-
};
|
|
1988
|
-
|
|
1989
|
-
return ProductHelper;
|
|
1990
|
-
}();
|
|
1991
|
-
|
|
1992
|
-
var _templateObject$6;
|
|
1993
|
-
|
|
1994
|
-
var newTheme = _extends({}, theme, {
|
|
1995
|
-
colors: _extends({}, theme.colors)
|
|
1996
|
-
});
|
|
1997
|
-
|
|
1998
|
-
var ExpandMore = styled__default(IconButton)(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n transform: ", ";\n margin-left: 'auto';\n"])), function (props) {
|
|
1999
|
-
return props.expand ? 'rotate(180deg)' : 'rotate(0deg)';
|
|
2000
|
-
});
|
|
2001
|
-
|
|
2002
|
-
var TestCard = function TestCard(props) {
|
|
2003
|
-
var _React$useState = React__default.useState(false),
|
|
2004
|
-
expanded = _React$useState[0],
|
|
2005
|
-
setExpanded = _React$useState[1];
|
|
2006
|
-
|
|
2007
|
-
var handleExpandClick = function handleExpandClick() {
|
|
2008
|
-
setExpanded(!expanded);
|
|
2009
|
-
};
|
|
2010
|
-
|
|
2011
|
-
return /*#__PURE__*/React__default.createElement(styled.ThemeProvider, {
|
|
2012
|
-
theme: newTheme
|
|
2013
|
-
}, /*#__PURE__*/React__default.createElement(Card, {
|
|
2014
|
-
sx: {
|
|
2015
|
-
maxWidth: 345
|
|
2016
|
-
}
|
|
2017
|
-
}, /*#__PURE__*/React__default.createElement(CardHeader, {
|
|
2018
|
-
avatar: /*#__PURE__*/React__default.createElement(Avatar, {
|
|
2019
|
-
sx: {
|
|
2020
|
-
bgcolor: 'red'
|
|
2021
|
-
},
|
|
2022
|
-
"aria-label": "recipe"
|
|
2023
|
-
}, "R"),
|
|
2024
|
-
action: /*#__PURE__*/React__default.createElement(IconButton, {
|
|
2025
|
-
"aria-label": "settings"
|
|
2026
|
-
}, /*#__PURE__*/React__default.createElement(MoreVertIcon, null)),
|
|
2027
|
-
title: "Shrimp and Chorizo Paella",
|
|
2028
|
-
subheader: "September 14, 2016"
|
|
2029
|
-
}), /*#__PURE__*/React__default.createElement(CardMedia, {
|
|
2030
|
-
component: "img",
|
|
2031
|
-
height: "194",
|
|
2032
|
-
image: "https://gw.alipayobjects.com/zos/rmsportal/JiqGstEfoWAOHiTxclqi.png",
|
|
2033
|
-
alt: "Paella dish"
|
|
2034
|
-
}), /*#__PURE__*/React__default.createElement(CardContent, null, /*#__PURE__*/React__default.createElement(Typography, {
|
|
2035
|
-
variant: "body2",
|
|
2036
|
-
color: "text.secondary"
|
|
2037
|
-
}, "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, {
|
|
2038
|
-
disableSpacing: true
|
|
2039
|
-
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
2040
|
-
"aria-label": "add to favorites"
|
|
2041
|
-
}, /*#__PURE__*/React__default.createElement(FavoriteIcon, null)), /*#__PURE__*/React__default.createElement(IconButton, {
|
|
2042
|
-
"aria-label": "share"
|
|
2043
|
-
}, /*#__PURE__*/React__default.createElement(ShareIcon, null)), /*#__PURE__*/React__default.createElement(ExpandMore, {
|
|
2044
|
-
expand: expanded,
|
|
2045
|
-
onClick: handleExpandClick,
|
|
2046
|
-
"aria-expanded": expanded,
|
|
2047
|
-
"aria-label": "show more"
|
|
2048
|
-
}, /*#__PURE__*/React__default.createElement(ExpandMoreIcon, null))), /*#__PURE__*/React__default.createElement(Collapse, {
|
|
2049
|
-
"in": expanded,
|
|
2050
|
-
timeout: "auto",
|
|
2051
|
-
unmountOnExit: true
|
|
2052
|
-
}, /*#__PURE__*/React__default.createElement(CardContent, null, /*#__PURE__*/React__default.createElement(Typography, {
|
|
2053
|
-
paragraph: true
|
|
2054
|
-
}, "Method:"), /*#__PURE__*/React__default.createElement(Typography, {
|
|
2055
|
-
paragraph: true
|
|
2056
|
-
}, "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, {
|
|
2057
|
-
paragraph: true
|
|
2058
|
-
}, "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, {
|
|
2059
|
-
paragraph: true
|
|
2060
|
-
}, "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.")))));
|
|
2061
|
-
};
|
|
2062
|
-
|
|
2063
|
-
var _templateObject$7, _templateObject2$3, _templateObject3$3, _templateObject4$3, _templateObject5$2, _templateObject6$1, _templateObject7$1;
|
|
2064
|
-
var CartDrawerContainer = styled__default.div(_templateObject$7 || (_templateObject$7 = _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) {
|
|
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) {
|
|
2065
25
|
return props.maxWidth || '650px';
|
|
2066
26
|
}, function (props) {
|
|
2067
27
|
return props.fontFamily;
|
|
2068
28
|
});
|
|
2069
|
-
var CartDrawerBar =
|
|
2070
|
-
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) {
|
|
2071
31
|
return props.opacity;
|
|
2072
32
|
});
|
|
2073
|
-
var CartDrawerBottomSection =
|
|
2074
|
-
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) {
|
|
2075
35
|
return props.color || 'black';
|
|
2076
36
|
}, function (props) {
|
|
2077
37
|
return props.color || 'black';
|
|
2078
38
|
});
|
|
2079
|
-
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) {
|
|
2080
40
|
return props.color || 'black';
|
|
2081
41
|
});
|
|
2082
|
-
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) {
|
|
2083
43
|
return props.color || 'red';
|
|
2084
44
|
});
|
|
2085
45
|
|
|
2086
|
-
var _templateObject$
|
|
2087
|
-
var CartDrawerProduct =
|
|
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) {
|
|
2088
48
|
return props.color || 'grey';
|
|
2089
49
|
});
|
|
2090
|
-
var CartDrawerQtBox =
|
|
2091
|
-
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"])));
|
|
2092
52
|
|
|
2093
53
|
var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
|
|
2094
54
|
var _product$cartStandard, _product$standardPric;
|
|
@@ -2098,7 +58,8 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
|
|
|
2098
58
|
handleIncrementDecrement = _ref.handleIncrementDecrement,
|
|
2099
59
|
handleRemoveProduct = _ref.handleRemoveProduct,
|
|
2100
60
|
handleRedirect = _ref.handleRedirect,
|
|
2101
|
-
imgnotfoundUrl = _ref.imgnotfoundUrl
|
|
61
|
+
imgnotfoundUrl = _ref.imgnotfoundUrl,
|
|
62
|
+
loading = _ref.loading;
|
|
2102
63
|
var imgnotfoundUrlcommon = '/images/imgnotfound.jpeg';
|
|
2103
64
|
if (imgnotfoundUrl && imgnotfoundUrl !== 'null') imgnotfoundUrlcommon = imgnotfoundUrl;
|
|
2104
65
|
return /*#__PURE__*/React__default.createElement(CartDrawerProduct, {
|
|
@@ -2128,16 +89,19 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
|
|
|
2128
89
|
}, /*#__PURE__*/React__default.createElement(ri.RiDeleteBin5Line, {
|
|
2129
90
|
className: "icon",
|
|
2130
91
|
onClick: function onClick() {
|
|
92
|
+
if (loading) return;
|
|
2131
93
|
handleRemoveProduct(product);
|
|
2132
94
|
}
|
|
2133
95
|
}), /*#__PURE__*/React__default.createElement(CartDrawerQtBox, null, /*#__PURE__*/React__default.createElement("span", {
|
|
2134
96
|
onClick: function onClick() {
|
|
97
|
+
if (loading) return;
|
|
2135
98
|
handleIncrementDecrement('decrement', product);
|
|
2136
99
|
}
|
|
2137
100
|
}, ' ', /*#__PURE__*/React__default.createElement(ai.AiOutlineMinus, null)), ' ', /*#__PURE__*/React__default.createElement("span", {
|
|
2138
101
|
className: 'qt'
|
|
2139
102
|
}, product === null || product === void 0 ? void 0 : product.quantity), /*#__PURE__*/React__default.createElement("span", {
|
|
2140
103
|
onClick: function onClick() {
|
|
104
|
+
if (loading) return;
|
|
2141
105
|
handleIncrementDecrement('increment', product);
|
|
2142
106
|
}
|
|
2143
107
|
}, /*#__PURE__*/React__default.createElement(ai.AiOutlinePlus, null)))));
|
|
@@ -2174,7 +138,8 @@ var CartDrawer = function CartDrawer(_ref) {
|
|
|
2174
138
|
handleRemoveProduct: handleRemoveProduct,
|
|
2175
139
|
color: color,
|
|
2176
140
|
key: i,
|
|
2177
|
-
imgnotfoundUrl: imgnotfoundUrl
|
|
141
|
+
imgnotfoundUrl: imgnotfoundUrl,
|
|
142
|
+
loading: loading
|
|
2178
143
|
}));
|
|
2179
144
|
})) : /*#__PURE__*/React__default.createElement(CartDrawerEmptyCart, {
|
|
2180
145
|
color: color
|
|
@@ -2198,6 +163,21 @@ var CartDrawer = function CartDrawer(_ref) {
|
|
|
2198
163
|
}, "continue to checkout"))));
|
|
2199
164
|
};
|
|
2200
165
|
|
|
166
|
+
var Breakpoint = function Breakpoint() {};
|
|
167
|
+
|
|
168
|
+
Breakpoint.xs = 'xs';
|
|
169
|
+
Breakpoint.sm = 'sm';
|
|
170
|
+
Breakpoint.md = 'md';
|
|
171
|
+
Breakpoint.lg = 'lg';
|
|
172
|
+
Breakpoint.xl = 'xl';
|
|
173
|
+
Breakpoint.xxl = 'xxl';
|
|
174
|
+
|
|
175
|
+
var Variant = function Variant() {};
|
|
176
|
+
|
|
177
|
+
Variant.ONE = 'one';
|
|
178
|
+
Variant.TWO = 'two';
|
|
179
|
+
Variant.THREE = 'three';
|
|
180
|
+
|
|
2201
181
|
function debounce(func, wait, immediate) {
|
|
2202
182
|
var timeout;
|
|
2203
183
|
return function () {
|
|
@@ -2290,10 +270,6 @@ function useGridSize() {
|
|
|
2290
270
|
|
|
2291
271
|
exports.Breakpoint = Breakpoint;
|
|
2292
272
|
exports.CartDrawer = CartDrawer;
|
|
2293
|
-
exports.Product = Product;
|
|
2294
|
-
exports.ProductHelper = ProductHelper;
|
|
2295
|
-
exports.ProductSlider = ProductSlider;
|
|
2296
|
-
exports.TestCard = TestCard;
|
|
2297
273
|
exports.Variant = Variant;
|
|
2298
274
|
exports.useGridSize = useGridSize;
|
|
2299
275
|
exports.useWindowSize = useWindowSize;
|