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