@salesgenterp/ui-components 0.3.1 → 0.3.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1670 -120
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1709 -159
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
|
-
import { Stack, Tooltip } from '@mui/material';
|
|
2
|
-
import
|
|
1
|
+
import { Stack, Tooltip, TableCell, TableContainer, TableRow, Checkbox } from '@mui/material';
|
|
2
|
+
import React__default, { useState, useEffect, createElement } from 'react';
|
|
3
3
|
import { GrClose } from 'react-icons/gr';
|
|
4
4
|
import 'react-icons/gi';
|
|
5
5
|
import { BsCartX } from 'react-icons/bs';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
7
|
import { RiDeleteBin5Line } from 'react-icons/ri';
|
|
8
8
|
import { AiOutlineMinus, AiOutlinePlus, AiOutlineClose } from 'react-icons/ai';
|
|
9
|
-
import { PuffLoader } from 'react-spinners';
|
|
9
|
+
import { PuffLoader, BounceLoader } from 'react-spinners';
|
|
10
|
+
import Box from '@mui/material/Box';
|
|
11
|
+
import Table from '@mui/material/Table';
|
|
12
|
+
import TableBody from '@mui/material/TableBody';
|
|
13
|
+
import TableHead from '@mui/material/TableHead';
|
|
14
|
+
import TableRow$1 from '@mui/material/TableRow';
|
|
15
|
+
import TableSortLabel from '@mui/material/TableSortLabel';
|
|
16
|
+
|
|
17
|
+
function _extends() {
|
|
18
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
19
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
20
|
+
var source = arguments[i];
|
|
21
|
+
|
|
22
|
+
for (var key in source) {
|
|
23
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
24
|
+
target[key] = source[key];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return target;
|
|
30
|
+
};
|
|
31
|
+
return _extends.apply(this, arguments);
|
|
32
|
+
}
|
|
10
33
|
|
|
11
34
|
function _taggedTemplateLiteralLoose(strings, raw) {
|
|
12
35
|
if (!raw) {
|
|
@@ -59,49 +82,49 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
|
|
|
59
82
|
loading = _ref.loading;
|
|
60
83
|
var imgnotfoundUrlcommon = '/images/imgnotfound.jpeg';
|
|
61
84
|
if (imgnotfoundUrl && imgnotfoundUrl !== 'null') imgnotfoundUrlcommon = imgnotfoundUrl;
|
|
62
|
-
return /*#__PURE__*/
|
|
85
|
+
return /*#__PURE__*/React__default.createElement(CartDrawerProduct, {
|
|
63
86
|
color: color
|
|
64
|
-
}, /*#__PURE__*/
|
|
87
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
65
88
|
src: product.imageUrl && product.imageUrl !== 'null' ? product.imageUrl : imgnotfoundUrlcommon,
|
|
66
89
|
alt: 'no product image available'
|
|
67
|
-
}), /*#__PURE__*/
|
|
90
|
+
}), /*#__PURE__*/React__default.createElement(Stack, {
|
|
68
91
|
flexDirection: "column",
|
|
69
92
|
justifyContent: "space-between",
|
|
70
93
|
alignItems: "flex-start",
|
|
71
94
|
className: "middleSection"
|
|
72
|
-
}, /*#__PURE__*/
|
|
95
|
+
}, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
73
96
|
title: product === null || product === void 0 ? void 0 : product.productName,
|
|
74
97
|
placement: "top",
|
|
75
98
|
arrow: true
|
|
76
|
-
}, /*#__PURE__*/
|
|
99
|
+
}, /*#__PURE__*/React__default.createElement("h6", {
|
|
77
100
|
className: "name",
|
|
78
101
|
onClick: function onClick() {
|
|
79
102
|
return handleRedirect(product);
|
|
80
103
|
}
|
|
81
|
-
}, product === null || product === void 0 ? void 0 : product.productName)), /*#__PURE__*/
|
|
104
|
+
}, 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, {
|
|
82
105
|
flexDirection: "column",
|
|
83
106
|
justifyContent: "space-between",
|
|
84
107
|
alignItems: "flex-end",
|
|
85
108
|
className: "endSection"
|
|
86
|
-
}, /*#__PURE__*/
|
|
109
|
+
}, /*#__PURE__*/React__default.createElement(RiDeleteBin5Line, {
|
|
87
110
|
className: "icon",
|
|
88
111
|
onClick: function onClick() {
|
|
89
112
|
if (loading) return;
|
|
90
113
|
handleRemoveProduct(product);
|
|
91
114
|
}
|
|
92
|
-
}), /*#__PURE__*/
|
|
115
|
+
}), /*#__PURE__*/React__default.createElement(CartDrawerQtBox, null, /*#__PURE__*/React__default.createElement("span", {
|
|
93
116
|
onClick: function onClick() {
|
|
94
117
|
if (loading) return;
|
|
95
118
|
handleIncrementDecrement('decrement', product);
|
|
96
119
|
}
|
|
97
|
-
}, ' ', /*#__PURE__*/
|
|
120
|
+
}, ' ', /*#__PURE__*/React__default.createElement(AiOutlineMinus, null)), ' ', /*#__PURE__*/React__default.createElement("span", {
|
|
98
121
|
className: 'qt'
|
|
99
|
-
}, product === null || product === void 0 ? void 0 : product.quantity), /*#__PURE__*/
|
|
122
|
+
}, product === null || product === void 0 ? void 0 : product.quantity), /*#__PURE__*/React__default.createElement("span", {
|
|
100
123
|
onClick: function onClick() {
|
|
101
124
|
if (loading) return;
|
|
102
125
|
handleIncrementDecrement('increment', product);
|
|
103
126
|
}
|
|
104
|
-
}, /*#__PURE__*/
|
|
127
|
+
}, /*#__PURE__*/React__default.createElement(AiOutlinePlus, null)))));
|
|
105
128
|
};
|
|
106
129
|
|
|
107
130
|
var CartDrawer = function CartDrawer(_ref) {
|
|
@@ -116,19 +139,19 @@ var CartDrawer = function CartDrawer(_ref) {
|
|
|
116
139
|
handleClose = _ref.handleClose,
|
|
117
140
|
loading = _ref.loading,
|
|
118
141
|
imgnotfoundUrl = _ref.imgnotfoundUrl;
|
|
119
|
-
return /*#__PURE__*/
|
|
142
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CartDrawerContainer, {
|
|
120
143
|
maxWidth: maxWidth
|
|
121
|
-
}, /*#__PURE__*/
|
|
144
|
+
}, /*#__PURE__*/React__default.createElement(CartDrawerBar, null, /*#__PURE__*/React__default.createElement("h2", null, "Your Cart"), /*#__PURE__*/React__default.createElement(GrClose, {
|
|
122
145
|
className: "icon",
|
|
123
146
|
onClick: function onClick() {
|
|
124
147
|
handleClose();
|
|
125
148
|
}
|
|
126
|
-
})), cartData && (cartData === null || cartData === void 0 ? void 0 : cartData.totalCartQuantity) > 0 ? /*#__PURE__*/
|
|
149
|
+
})), cartData && (cartData === null || cartData === void 0 ? void 0 : cartData.totalCartQuantity) > 0 ? /*#__PURE__*/React__default.createElement(CartDrawerProductContainer, {
|
|
127
150
|
opacity: loading ? '.4' : '1'
|
|
128
151
|
}, cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.map(function (product, i) {
|
|
129
|
-
return /*#__PURE__*/
|
|
152
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, loading && /*#__PURE__*/React__default.createElement(CartDrawerLoader, null, /*#__PURE__*/React__default.createElement(PuffLoader, {
|
|
130
153
|
color: "black"
|
|
131
|
-
})), /*#__PURE__*/
|
|
154
|
+
})), /*#__PURE__*/React__default.createElement(CartDrawerProductCard, {
|
|
132
155
|
product: product,
|
|
133
156
|
handleRedirect: handleRedirect,
|
|
134
157
|
handleIncrementDecrement: handleIncrementDecrement,
|
|
@@ -138,21 +161,21 @@ var CartDrawer = function CartDrawer(_ref) {
|
|
|
138
161
|
imgnotfoundUrl: imgnotfoundUrl,
|
|
139
162
|
loading: loading
|
|
140
163
|
}));
|
|
141
|
-
})) : /*#__PURE__*/
|
|
164
|
+
})) : /*#__PURE__*/React__default.createElement(CartDrawerEmptyCart, {
|
|
142
165
|
color: color
|
|
143
|
-
}, /*#__PURE__*/
|
|
166
|
+
}, /*#__PURE__*/React__default.createElement(BsCartX, {
|
|
144
167
|
className: "icon"
|
|
145
|
-
}), /*#__PURE__*/
|
|
168
|
+
}), /*#__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, {
|
|
146
169
|
flexDirection: "row",
|
|
147
170
|
justifyContent: "space-between",
|
|
148
171
|
alignItems: "center",
|
|
149
172
|
className: "row"
|
|
150
|
-
}, /*#__PURE__*/
|
|
173
|
+
}, /*#__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, {
|
|
151
174
|
color: color,
|
|
152
175
|
onClick: function onClick() {
|
|
153
176
|
return handleRedirect('cart');
|
|
154
177
|
}
|
|
155
|
-
}, "view cart"), /*#__PURE__*/
|
|
178
|
+
}, "view cart"), /*#__PURE__*/React__default.createElement(CartDrawerFilledButton, {
|
|
156
179
|
color: color,
|
|
157
180
|
onClick: function onClick() {
|
|
158
181
|
return handleRedirect('checkout');
|
|
@@ -160,128 +183,1501 @@ var CartDrawer = function CartDrawer(_ref) {
|
|
|
160
183
|
}, "continue to checkout"))));
|
|
161
184
|
};
|
|
162
185
|
|
|
163
|
-
var _templateObject$2, _templateObject2$2, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1;
|
|
164
|
-
var
|
|
165
|
-
return props.
|
|
186
|
+
var _templateObject$2, _templateObject2$2, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1, _templateObject8;
|
|
187
|
+
var CartPageSection = styled.section(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["\n background: ", ";\n max-width: 100%;\n width: fit-content;\n background: ", ";\n overflow: hidden;\n"])), function (props) {
|
|
188
|
+
return props.bg;
|
|
166
189
|
}, function (props) {
|
|
167
|
-
return props.
|
|
190
|
+
return props.bg || '#FAE8E5';
|
|
191
|
+
});
|
|
192
|
+
var CartPageContainer = styled.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n width: 100%;\n max-width: ", ";\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: flex-start;\n border-radius: 28px 28px 28px 14px;\n\n padding-right: max(5vw, 1em);\n padding-left: max(5vw, 1em);\n padding-top: max(5vw, 1em);\n padding-bottom: max(5vw, 1em);\n border-radius: 28px;\n opacity: ", ";\n .scrollDiv {\n width: 68%;\n height: 630px;\n max-height: 630px;\n /* background-color: white; */\n display: flex;\n flex-direction: column;\n overflow-y: auto;\n margin-right: 0.3em;\n &::-webkit-scrollbar {\n width: ", ";\n }\n\n /* Track */\n &::-webkit-scrollbar-track {\n background: ", ";\n border-radius: 16px;\n }\n\n /* Handle */\n &::-webkit-scrollbar-thumb {\n background: ", ";\n border-radius: 16px;\n margin: 5px 2px;\n border: 3px solid;\n border-color: ", ";\n }\n box-shadow: 0px 20px 35px rgba(0, 0, 0, 0.05);\n }\n @media only screen and (max-width: 1340px) {\n flex-direction: column;\n align-items: center;\n padding: 0.5em 0;\n .scrollDiv {\n width: 100%;\n margin: 0;\n margin-bottom: 2em;\n padding: 0 0.4em;\n }\n }\n"])), function (props) {
|
|
193
|
+
return props.maxWidth || '1450px';
|
|
168
194
|
}, function (props) {
|
|
169
|
-
return props.
|
|
195
|
+
return props.loading ? '0.7' : 1;
|
|
170
196
|
}, function (props) {
|
|
171
|
-
return props.
|
|
172
|
-
});
|
|
173
|
-
var CartSummaryRow = styled.div(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: ", ";\n align-items: center;\n color: inherit;\n h6,\n h5 {\n margin: 0;\n font-size: 1em;\n font-weight: 700;\n color: inherit;\n text-transform: capitalize;\n }\n h5 {\n font-size: ", ";\n }\n"])), function (props) {
|
|
174
|
-
return props.justify || 'space-between';
|
|
197
|
+
return props.retail ? '12px' : '8px';
|
|
175
198
|
}, function (props) {
|
|
176
|
-
return props.
|
|
199
|
+
return props.retail ? '#667080' : 'rgba(102, 112, 128, 0.5)';
|
|
200
|
+
}, function (props) {
|
|
201
|
+
return props.retail ? '#BFC3CA' : '#EDEDED';
|
|
202
|
+
}, function (props) {
|
|
203
|
+
return props.retail ? '#667080' : 'rgba(102, 112, 128, 0.5)';
|
|
177
204
|
});
|
|
178
|
-
var
|
|
179
|
-
return props.
|
|
205
|
+
var CardsBox = styled.div(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n width: 100%;\n /* min-height: 1000px; */\n position: relative;\n max-width: 860px;\n margin-right: auto;\n padding: 1em 2em;\n display: ", ";\n grid-template-columns: 1fr 1fr;\n flex-direction: column;\n align-items: flex-start;\n grid-gap: 1em;\n justify-content: flex-start;\n align-items: center;\n border-radius: 20px;\n @media only screen and (max-width: 960px) {\n display: flex;\n }\n @media only screen and (max-width: 640px) {\n padding: 1em 0.2em;\n }\n"])), function (props) {
|
|
206
|
+
return props.retail ? 'grid' : 'flex';
|
|
180
207
|
});
|
|
181
|
-
var
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
208
|
+
var Loader = styled.div(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteralLoose(["\n position: absolute;\n top: 40%;\n left: 47%;\n display: grid;\n place-items: center;\n z-index: 1;\n"])));
|
|
209
|
+
var CartTableCell = styled(TableCell)(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteralLoose(["\n padding-bottom: 1em !important;\n border: none !important;\n background: ", ";\n"])), function (props) {
|
|
210
|
+
return props.bg + " !important";
|
|
211
|
+
});
|
|
212
|
+
var CartTableContainer = styled(TableContainer)(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteralLoose(["\n max-height: 580px;\n padding-right: 2em;\n\n &::-webkit-scrollbar {\n width: ", ";\n }\n\n /* Track */\n &::-webkit-scrollbar-track {\n background: ", ";\n background: ", ";\n border-radius: 16px;\n }\n\n /* Handle */\n &::-webkit-scrollbar-thumb {\n border-radius: 16px;\n margin: 5px 2px;\n background: ", ";\n }\n @media screen and (max-width: 750px) {\n padding: 0;\n }\n"])), function (props) {
|
|
213
|
+
return props.retail ? '12px' : '8px';
|
|
185
214
|
}, function (props) {
|
|
186
|
-
return props.
|
|
215
|
+
return props.retail ? '#667080' : 'rgba(102, 112, 128, 0.5)';
|
|
187
216
|
}, function (props) {
|
|
188
|
-
return props.
|
|
217
|
+
return props.bg || '#fdccc480';
|
|
189
218
|
}, function (props) {
|
|
190
|
-
return props.
|
|
219
|
+
return props.color || '#ef9687';
|
|
191
220
|
});
|
|
192
|
-
var
|
|
193
|
-
|
|
194
|
-
return props.background || 'white';
|
|
221
|
+
var CartButtonsRow = styled.div(_templateObject7$1 || (_templateObject7$1 = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: flex-end;\n align-items: center;\n button {\n background: ", ";\n color: ", ";\n padding: 0.5em 1em;\n margin-right: 1.5em;\n font-size: 0.85em;\n text-transform: uppercase;\n border: none;\n cursor: pointer;\n transition: 0.4s;\n &:hover {\n transform: scale(0.9);\n }\n }\n"])), function (props) {
|
|
222
|
+
return props.bg || 'rgba(253, 0, 21, 1)';
|
|
195
223
|
}, function (props) {
|
|
196
|
-
return props.
|
|
224
|
+
return props.color || 'white';
|
|
197
225
|
});
|
|
226
|
+
var CartPageBox = styled.div(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n width: 1000px;\n max-width: 100%;\n margin-right: 2em;\n position: relative;\n @media only screen and (max-width: 740px) {\n margin-right: 0;\n .CartnoBelowSm {\n display: none;\n }\n }\n"])));
|
|
198
227
|
|
|
199
|
-
|
|
200
|
-
|
|
228
|
+
function createCommonjsModule(fn, module) {
|
|
229
|
+
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
230
|
+
}
|
|
201
231
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
232
|
+
/** @license React v16.13.1
|
|
233
|
+
* react-is.production.min.js
|
|
234
|
+
*
|
|
235
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
236
|
+
*
|
|
237
|
+
* This source code is licensed under the MIT license found in the
|
|
238
|
+
* LICENSE file in the root directory of this source tree.
|
|
239
|
+
*/
|
|
240
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
241
|
+
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
242
|
+
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}var AsyncMode=l;var ConcurrentMode=m;var ContextConsumer=k;var ContextProvider=h;var Element=c;var ForwardRef=n;var Fragment=e;var Lazy=t;var Memo=r;var Portal=d;
|
|
243
|
+
var Profiler=g;var StrictMode=f;var Suspense=p;var isAsyncMode=function(a){return A(a)||z(a)===l};var isConcurrentMode=A;var isContextConsumer=function(a){return z(a)===k};var isContextProvider=function(a){return z(a)===h};var isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};var isForwardRef=function(a){return z(a)===n};var isFragment=function(a){return z(a)===e};var isLazy=function(a){return z(a)===t};
|
|
244
|
+
var isMemo=function(a){return z(a)===r};var isPortal=function(a){return z(a)===d};var isProfiler=function(a){return z(a)===g};var isStrictMode=function(a){return z(a)===f};var isSuspense=function(a){return z(a)===p};
|
|
245
|
+
var isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};var typeOf=z;
|
|
246
|
+
|
|
247
|
+
var reactIs_production_min = {
|
|
248
|
+
AsyncMode: AsyncMode,
|
|
249
|
+
ConcurrentMode: ConcurrentMode,
|
|
250
|
+
ContextConsumer: ContextConsumer,
|
|
251
|
+
ContextProvider: ContextProvider,
|
|
252
|
+
Element: Element,
|
|
253
|
+
ForwardRef: ForwardRef,
|
|
254
|
+
Fragment: Fragment,
|
|
255
|
+
Lazy: Lazy,
|
|
256
|
+
Memo: Memo,
|
|
257
|
+
Portal: Portal,
|
|
258
|
+
Profiler: Profiler,
|
|
259
|
+
StrictMode: StrictMode,
|
|
260
|
+
Suspense: Suspense,
|
|
261
|
+
isAsyncMode: isAsyncMode,
|
|
262
|
+
isConcurrentMode: isConcurrentMode,
|
|
263
|
+
isContextConsumer: isContextConsumer,
|
|
264
|
+
isContextProvider: isContextProvider,
|
|
265
|
+
isElement: isElement,
|
|
266
|
+
isForwardRef: isForwardRef,
|
|
267
|
+
isFragment: isFragment,
|
|
268
|
+
isLazy: isLazy,
|
|
269
|
+
isMemo: isMemo,
|
|
270
|
+
isPortal: isPortal,
|
|
271
|
+
isProfiler: isProfiler,
|
|
272
|
+
isStrictMode: isStrictMode,
|
|
273
|
+
isSuspense: isSuspense,
|
|
274
|
+
isValidElementType: isValidElementType,
|
|
275
|
+
typeOf: typeOf
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
var reactIs_development = createCommonjsModule(function (module, exports) {
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
if (process.env.NODE_ENV !== "production") {
|
|
283
|
+
(function() {
|
|
284
|
+
|
|
285
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
286
|
+
// nor polyfill, then a plain number is used for performance.
|
|
287
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
288
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
289
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
290
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
291
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
292
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
293
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
294
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
295
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
296
|
+
|
|
297
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
298
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
299
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
300
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
301
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
302
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
303
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
304
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
305
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
306
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
307
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
308
|
+
|
|
309
|
+
function isValidElementType(type) {
|
|
310
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
311
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function typeOf(object) {
|
|
315
|
+
if (typeof object === 'object' && object !== null) {
|
|
316
|
+
var $$typeof = object.$$typeof;
|
|
317
|
+
|
|
318
|
+
switch ($$typeof) {
|
|
319
|
+
case REACT_ELEMENT_TYPE:
|
|
320
|
+
var type = object.type;
|
|
321
|
+
|
|
322
|
+
switch (type) {
|
|
323
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
324
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
325
|
+
case REACT_FRAGMENT_TYPE:
|
|
326
|
+
case REACT_PROFILER_TYPE:
|
|
327
|
+
case REACT_STRICT_MODE_TYPE:
|
|
328
|
+
case REACT_SUSPENSE_TYPE:
|
|
329
|
+
return type;
|
|
330
|
+
|
|
331
|
+
default:
|
|
332
|
+
var $$typeofType = type && type.$$typeof;
|
|
333
|
+
|
|
334
|
+
switch ($$typeofType) {
|
|
335
|
+
case REACT_CONTEXT_TYPE:
|
|
336
|
+
case REACT_FORWARD_REF_TYPE:
|
|
337
|
+
case REACT_LAZY_TYPE:
|
|
338
|
+
case REACT_MEMO_TYPE:
|
|
339
|
+
case REACT_PROVIDER_TYPE:
|
|
340
|
+
return $$typeofType;
|
|
341
|
+
|
|
342
|
+
default:
|
|
343
|
+
return $$typeof;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
case REACT_PORTAL_TYPE:
|
|
349
|
+
return $$typeof;
|
|
225
350
|
}
|
|
226
|
-
}
|
|
227
|
-
justify: "flex-start"
|
|
228
|
-
}, /*#__PURE__*/React.createElement("h6", null, "shipping")), shippingData.map(function (li, i) {
|
|
229
|
-
var _li$amount;
|
|
351
|
+
}
|
|
230
352
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
353
|
+
return undefined;
|
|
354
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
355
|
+
|
|
356
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
357
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
358
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
359
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
360
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
361
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
362
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
363
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
364
|
+
var Memo = REACT_MEMO_TYPE;
|
|
365
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
366
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
367
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
368
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
369
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
370
|
+
|
|
371
|
+
function isAsyncMode(object) {
|
|
372
|
+
{
|
|
373
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
374
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
375
|
+
|
|
376
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
381
|
+
}
|
|
382
|
+
function isConcurrentMode(object) {
|
|
383
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
384
|
+
}
|
|
385
|
+
function isContextConsumer(object) {
|
|
386
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
387
|
+
}
|
|
388
|
+
function isContextProvider(object) {
|
|
389
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
390
|
+
}
|
|
391
|
+
function isElement(object) {
|
|
392
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
393
|
+
}
|
|
394
|
+
function isForwardRef(object) {
|
|
395
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
396
|
+
}
|
|
397
|
+
function isFragment(object) {
|
|
398
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
399
|
+
}
|
|
400
|
+
function isLazy(object) {
|
|
401
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
402
|
+
}
|
|
403
|
+
function isMemo(object) {
|
|
404
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
405
|
+
}
|
|
406
|
+
function isPortal(object) {
|
|
407
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
408
|
+
}
|
|
409
|
+
function isProfiler(object) {
|
|
410
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
411
|
+
}
|
|
412
|
+
function isStrictMode(object) {
|
|
413
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
414
|
+
}
|
|
415
|
+
function isSuspense(object) {
|
|
416
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
exports.AsyncMode = AsyncMode;
|
|
420
|
+
exports.ConcurrentMode = ConcurrentMode;
|
|
421
|
+
exports.ContextConsumer = ContextConsumer;
|
|
422
|
+
exports.ContextProvider = ContextProvider;
|
|
423
|
+
exports.Element = Element;
|
|
424
|
+
exports.ForwardRef = ForwardRef;
|
|
425
|
+
exports.Fragment = Fragment;
|
|
426
|
+
exports.Lazy = Lazy;
|
|
427
|
+
exports.Memo = Memo;
|
|
428
|
+
exports.Portal = Portal;
|
|
429
|
+
exports.Profiler = Profiler;
|
|
430
|
+
exports.StrictMode = StrictMode;
|
|
431
|
+
exports.Suspense = Suspense;
|
|
432
|
+
exports.isAsyncMode = isAsyncMode;
|
|
433
|
+
exports.isConcurrentMode = isConcurrentMode;
|
|
434
|
+
exports.isContextConsumer = isContextConsumer;
|
|
435
|
+
exports.isContextProvider = isContextProvider;
|
|
436
|
+
exports.isElement = isElement;
|
|
437
|
+
exports.isForwardRef = isForwardRef;
|
|
438
|
+
exports.isFragment = isFragment;
|
|
439
|
+
exports.isLazy = isLazy;
|
|
440
|
+
exports.isMemo = isMemo;
|
|
441
|
+
exports.isPortal = isPortal;
|
|
442
|
+
exports.isProfiler = isProfiler;
|
|
443
|
+
exports.isStrictMode = isStrictMode;
|
|
444
|
+
exports.isSuspense = isSuspense;
|
|
445
|
+
exports.isValidElementType = isValidElementType;
|
|
446
|
+
exports.typeOf = typeOf;
|
|
447
|
+
})();
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
var reactIs = createCommonjsModule(function (module) {
|
|
452
|
+
|
|
453
|
+
if (process.env.NODE_ENV === 'production') {
|
|
454
|
+
module.exports = reactIs_production_min;
|
|
455
|
+
} else {
|
|
456
|
+
module.exports = reactIs_development;
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
/*
|
|
461
|
+
object-assign
|
|
462
|
+
(c) Sindre Sorhus
|
|
463
|
+
@license MIT
|
|
464
|
+
*/
|
|
465
|
+
/* eslint-disable no-unused-vars */
|
|
466
|
+
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
467
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
468
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
469
|
+
|
|
470
|
+
function toObject(val) {
|
|
471
|
+
if (val === null || val === undefined) {
|
|
472
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
return Object(val);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function shouldUseNative() {
|
|
479
|
+
try {
|
|
480
|
+
if (!Object.assign) {
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// Detect buggy property enumeration order in older V8 versions.
|
|
485
|
+
|
|
486
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
487
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
488
|
+
test1[5] = 'de';
|
|
489
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
490
|
+
return false;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
494
|
+
var test2 = {};
|
|
495
|
+
for (var i = 0; i < 10; i++) {
|
|
496
|
+
test2['_' + String.fromCharCode(i)] = i;
|
|
497
|
+
}
|
|
498
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
|
499
|
+
return test2[n];
|
|
500
|
+
});
|
|
501
|
+
if (order2.join('') !== '0123456789') {
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
|
506
|
+
var test3 = {};
|
|
507
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
508
|
+
test3[letter] = letter;
|
|
509
|
+
});
|
|
510
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
511
|
+
'abcdefghijklmnopqrst') {
|
|
512
|
+
return false;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
return true;
|
|
516
|
+
} catch (err) {
|
|
517
|
+
// We don't expect any of the above to throw, but better to be safe.
|
|
518
|
+
return false;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
var objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
|
|
523
|
+
var from;
|
|
524
|
+
var to = toObject(target);
|
|
525
|
+
var symbols;
|
|
526
|
+
|
|
527
|
+
for (var s = 1; s < arguments.length; s++) {
|
|
528
|
+
from = Object(arguments[s]);
|
|
529
|
+
|
|
530
|
+
for (var key in from) {
|
|
531
|
+
if (hasOwnProperty.call(from, key)) {
|
|
532
|
+
to[key] = from[key];
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
if (getOwnPropertySymbols) {
|
|
537
|
+
symbols = getOwnPropertySymbols(from);
|
|
538
|
+
for (var i = 0; i < symbols.length; i++) {
|
|
539
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
|
540
|
+
to[symbols[i]] = from[symbols[i]];
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
return to;
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
551
|
+
*
|
|
552
|
+
* This source code is licensed under the MIT license found in the
|
|
553
|
+
* LICENSE file in the root directory of this source tree.
|
|
554
|
+
*/
|
|
555
|
+
|
|
556
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
|
557
|
+
|
|
558
|
+
var ReactPropTypesSecret_1 = ReactPropTypesSecret;
|
|
559
|
+
|
|
560
|
+
var has = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
561
|
+
|
|
562
|
+
var printWarning = function() {};
|
|
563
|
+
|
|
564
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
565
|
+
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1;
|
|
566
|
+
var loggedTypeFailures = {};
|
|
567
|
+
var has$1 = has;
|
|
568
|
+
|
|
569
|
+
printWarning = function(text) {
|
|
570
|
+
var message = 'Warning: ' + text;
|
|
571
|
+
if (typeof console !== 'undefined') {
|
|
572
|
+
console.error(message);
|
|
573
|
+
}
|
|
574
|
+
try {
|
|
575
|
+
// --- Welcome to debugging React ---
|
|
576
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
577
|
+
// to find the callsite that caused this warning to fire.
|
|
578
|
+
throw new Error(message);
|
|
579
|
+
} catch (x) { /**/ }
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Assert that the values match with the type specs.
|
|
585
|
+
* Error messages are memorized and will only be shown once.
|
|
586
|
+
*
|
|
587
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
|
588
|
+
* @param {object} values Runtime values that need to be type-checked
|
|
589
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
|
590
|
+
* @param {string} componentName Name of the component for error messages.
|
|
591
|
+
* @param {?Function} getStack Returns the component stack.
|
|
592
|
+
* @private
|
|
593
|
+
*/
|
|
594
|
+
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
595
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
596
|
+
for (var typeSpecName in typeSpecs) {
|
|
597
|
+
if (has$1(typeSpecs, typeSpecName)) {
|
|
598
|
+
var error;
|
|
599
|
+
// Prop type validation may throw. In case they do, we don't want to
|
|
600
|
+
// fail the render phase where it didn't fail before. So we log it.
|
|
601
|
+
// After these have been cleaned up, we'll let them throw.
|
|
602
|
+
try {
|
|
603
|
+
// This is intentionally an invariant that gets caught. It's the same
|
|
604
|
+
// behavior as without this statement except with a better message.
|
|
605
|
+
if (typeof typeSpecs[typeSpecName] !== 'function') {
|
|
606
|
+
var err = Error(
|
|
607
|
+
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
|
|
608
|
+
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
|
|
609
|
+
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
|
|
610
|
+
);
|
|
611
|
+
err.name = 'Invariant Violation';
|
|
612
|
+
throw err;
|
|
613
|
+
}
|
|
614
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1);
|
|
615
|
+
} catch (ex) {
|
|
616
|
+
error = ex;
|
|
617
|
+
}
|
|
618
|
+
if (error && !(error instanceof Error)) {
|
|
619
|
+
printWarning(
|
|
620
|
+
(componentName || 'React class') + ': type specification of ' +
|
|
621
|
+
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
|
|
622
|
+
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
|
|
623
|
+
'You may have forgotten to pass an argument to the type checker ' +
|
|
624
|
+
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
|
|
625
|
+
'shape all require an argument).'
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
629
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
630
|
+
// same error.
|
|
631
|
+
loggedTypeFailures[error.message] = true;
|
|
632
|
+
|
|
633
|
+
var stack = getStack ? getStack() : '';
|
|
634
|
+
|
|
635
|
+
printWarning(
|
|
636
|
+
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
|
+
* Resets warning cache when testing.
|
|
646
|
+
*
|
|
647
|
+
* @private
|
|
648
|
+
*/
|
|
649
|
+
checkPropTypes.resetWarningCache = function() {
|
|
650
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
651
|
+
loggedTypeFailures = {};
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
var checkPropTypes_1 = checkPropTypes;
|
|
656
|
+
|
|
657
|
+
var printWarning$1 = function() {};
|
|
658
|
+
|
|
659
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
660
|
+
printWarning$1 = function(text) {
|
|
661
|
+
var message = 'Warning: ' + text;
|
|
662
|
+
if (typeof console !== 'undefined') {
|
|
663
|
+
console.error(message);
|
|
664
|
+
}
|
|
665
|
+
try {
|
|
666
|
+
// --- Welcome to debugging React ---
|
|
667
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
668
|
+
// to find the callsite that caused this warning to fire.
|
|
669
|
+
throw new Error(message);
|
|
670
|
+
} catch (x) {}
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
function emptyFunctionThatReturnsNull() {
|
|
675
|
+
return null;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
679
|
+
/* global Symbol */
|
|
680
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
681
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Returns the iterator method function contained on the iterable object.
|
|
685
|
+
*
|
|
686
|
+
* Be sure to invoke the function with the iterable as context:
|
|
687
|
+
*
|
|
688
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
|
689
|
+
* if (iteratorFn) {
|
|
690
|
+
* var iterator = iteratorFn.call(myIterable);
|
|
691
|
+
* ...
|
|
692
|
+
* }
|
|
693
|
+
*
|
|
694
|
+
* @param {?object} maybeIterable
|
|
695
|
+
* @return {?function}
|
|
696
|
+
*/
|
|
697
|
+
function getIteratorFn(maybeIterable) {
|
|
698
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
699
|
+
if (typeof iteratorFn === 'function') {
|
|
700
|
+
return iteratorFn;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* Collection of methods that allow declaration and validation of props that are
|
|
706
|
+
* supplied to React components. Example usage:
|
|
707
|
+
*
|
|
708
|
+
* var Props = require('ReactPropTypes');
|
|
709
|
+
* var MyArticle = React.createClass({
|
|
710
|
+
* propTypes: {
|
|
711
|
+
* // An optional string prop named "description".
|
|
712
|
+
* description: Props.string,
|
|
713
|
+
*
|
|
714
|
+
* // A required enum prop named "category".
|
|
715
|
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
|
716
|
+
*
|
|
717
|
+
* // A prop named "dialog" that requires an instance of Dialog.
|
|
718
|
+
* dialog: Props.instanceOf(Dialog).isRequired
|
|
719
|
+
* },
|
|
720
|
+
* render: function() { ... }
|
|
721
|
+
* });
|
|
722
|
+
*
|
|
723
|
+
* A more formal specification of how these methods are used:
|
|
724
|
+
*
|
|
725
|
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
|
726
|
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
|
727
|
+
*
|
|
728
|
+
* Each and every declaration produces a function with the same signature. This
|
|
729
|
+
* allows the creation of custom validation functions. For example:
|
|
730
|
+
*
|
|
731
|
+
* var MyLink = React.createClass({
|
|
732
|
+
* propTypes: {
|
|
733
|
+
* // An optional string or URI prop named "href".
|
|
734
|
+
* href: function(props, propName, componentName) {
|
|
735
|
+
* var propValue = props[propName];
|
|
736
|
+
* if (propValue != null && typeof propValue !== 'string' &&
|
|
737
|
+
* !(propValue instanceof URI)) {
|
|
738
|
+
* return new Error(
|
|
739
|
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
|
740
|
+
* componentName
|
|
741
|
+
* );
|
|
742
|
+
* }
|
|
743
|
+
* }
|
|
744
|
+
* },
|
|
745
|
+
* render: function() {...}
|
|
746
|
+
* });
|
|
747
|
+
*
|
|
748
|
+
* @internal
|
|
749
|
+
*/
|
|
750
|
+
|
|
751
|
+
var ANONYMOUS = '<<anonymous>>';
|
|
752
|
+
|
|
753
|
+
// Important!
|
|
754
|
+
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
|
755
|
+
var ReactPropTypes = {
|
|
756
|
+
array: createPrimitiveTypeChecker('array'),
|
|
757
|
+
bigint: createPrimitiveTypeChecker('bigint'),
|
|
758
|
+
bool: createPrimitiveTypeChecker('boolean'),
|
|
759
|
+
func: createPrimitiveTypeChecker('function'),
|
|
760
|
+
number: createPrimitiveTypeChecker('number'),
|
|
761
|
+
object: createPrimitiveTypeChecker('object'),
|
|
762
|
+
string: createPrimitiveTypeChecker('string'),
|
|
763
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
|
764
|
+
|
|
765
|
+
any: createAnyTypeChecker(),
|
|
766
|
+
arrayOf: createArrayOfTypeChecker,
|
|
767
|
+
element: createElementTypeChecker(),
|
|
768
|
+
elementType: createElementTypeTypeChecker(),
|
|
769
|
+
instanceOf: createInstanceTypeChecker,
|
|
770
|
+
node: createNodeChecker(),
|
|
771
|
+
objectOf: createObjectOfTypeChecker,
|
|
772
|
+
oneOf: createEnumTypeChecker,
|
|
773
|
+
oneOfType: createUnionTypeChecker,
|
|
774
|
+
shape: createShapeTypeChecker,
|
|
775
|
+
exact: createStrictShapeTypeChecker,
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
780
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
781
|
+
*/
|
|
782
|
+
/*eslint-disable no-self-compare*/
|
|
783
|
+
function is(x, y) {
|
|
784
|
+
// SameValue algorithm
|
|
785
|
+
if (x === y) {
|
|
786
|
+
// Steps 1-5, 7-10
|
|
787
|
+
// Steps 6.b-6.e: +0 != -0
|
|
788
|
+
return x !== 0 || 1 / x === 1 / y;
|
|
789
|
+
} else {
|
|
790
|
+
// Step 6.a: NaN == NaN
|
|
791
|
+
return x !== x && y !== y;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
/*eslint-enable no-self-compare*/
|
|
795
|
+
|
|
796
|
+
/**
|
|
797
|
+
* We use an Error-like object for backward compatibility as people may call
|
|
798
|
+
* PropTypes directly and inspect their output. However, we don't use real
|
|
799
|
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
|
800
|
+
* is prohibitively expensive if they are created too often, such as what
|
|
801
|
+
* happens in oneOfType() for any type before the one that matched.
|
|
802
|
+
*/
|
|
803
|
+
function PropTypeError(message, data) {
|
|
804
|
+
this.message = message;
|
|
805
|
+
this.data = data && typeof data === 'object' ? data: {};
|
|
806
|
+
this.stack = '';
|
|
807
|
+
}
|
|
808
|
+
// Make `instanceof Error` still work for returned errors.
|
|
809
|
+
PropTypeError.prototype = Error.prototype;
|
|
810
|
+
|
|
811
|
+
function createChainableTypeChecker(validate) {
|
|
812
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
813
|
+
var manualPropTypeCallCache = {};
|
|
814
|
+
var manualPropTypeWarningCount = 0;
|
|
815
|
+
}
|
|
816
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
817
|
+
componentName = componentName || ANONYMOUS;
|
|
818
|
+
propFullName = propFullName || propName;
|
|
819
|
+
|
|
820
|
+
if (secret !== ReactPropTypesSecret_1) {
|
|
821
|
+
if (throwOnDirectAccess) {
|
|
822
|
+
// New behavior only for users of `prop-types` package
|
|
823
|
+
var err = new Error(
|
|
824
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
825
|
+
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
826
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
827
|
+
);
|
|
828
|
+
err.name = 'Invariant Violation';
|
|
829
|
+
throw err;
|
|
830
|
+
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
|
831
|
+
// Old behavior for people using React.PropTypes
|
|
832
|
+
var cacheKey = componentName + ':' + propName;
|
|
833
|
+
if (
|
|
834
|
+
!manualPropTypeCallCache[cacheKey] &&
|
|
835
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
836
|
+
manualPropTypeWarningCount < 3
|
|
837
|
+
) {
|
|
838
|
+
printWarning$1(
|
|
839
|
+
'You are manually calling a React.PropTypes validation ' +
|
|
840
|
+
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
|
|
841
|
+
'and will throw in the standalone `prop-types` package. ' +
|
|
842
|
+
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
843
|
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
|
|
844
|
+
);
|
|
845
|
+
manualPropTypeCallCache[cacheKey] = true;
|
|
846
|
+
manualPropTypeWarningCount++;
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
if (props[propName] == null) {
|
|
851
|
+
if (isRequired) {
|
|
852
|
+
if (props[propName] === null) {
|
|
853
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
|
854
|
+
}
|
|
855
|
+
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
|
856
|
+
}
|
|
857
|
+
return null;
|
|
858
|
+
} else {
|
|
859
|
+
return validate(props, propName, componentName, location, propFullName);
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
var chainedCheckType = checkType.bind(null, false);
|
|
864
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
865
|
+
|
|
866
|
+
return chainedCheckType;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
function createPrimitiveTypeChecker(expectedType) {
|
|
870
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
871
|
+
var propValue = props[propName];
|
|
872
|
+
var propType = getPropType(propValue);
|
|
873
|
+
if (propType !== expectedType) {
|
|
874
|
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
|
875
|
+
// check, but we can offer a more precise error message here rather than
|
|
876
|
+
// 'of type `object`'.
|
|
877
|
+
var preciseType = getPreciseType(propValue);
|
|
878
|
+
|
|
879
|
+
return new PropTypeError(
|
|
880
|
+
'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
|
|
881
|
+
{expectedType: expectedType}
|
|
882
|
+
);
|
|
883
|
+
}
|
|
884
|
+
return null;
|
|
885
|
+
}
|
|
886
|
+
return createChainableTypeChecker(validate);
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
function createAnyTypeChecker() {
|
|
890
|
+
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
function createArrayOfTypeChecker(typeChecker) {
|
|
894
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
895
|
+
if (typeof typeChecker !== 'function') {
|
|
896
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
|
897
|
+
}
|
|
898
|
+
var propValue = props[propName];
|
|
899
|
+
if (!Array.isArray(propValue)) {
|
|
900
|
+
var propType = getPropType(propValue);
|
|
901
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
|
902
|
+
}
|
|
903
|
+
for (var i = 0; i < propValue.length; i++) {
|
|
904
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1);
|
|
905
|
+
if (error instanceof Error) {
|
|
906
|
+
return error;
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
return null;
|
|
910
|
+
}
|
|
911
|
+
return createChainableTypeChecker(validate);
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
function createElementTypeChecker() {
|
|
915
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
916
|
+
var propValue = props[propName];
|
|
917
|
+
if (!isValidElement(propValue)) {
|
|
918
|
+
var propType = getPropType(propValue);
|
|
919
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
|
920
|
+
}
|
|
921
|
+
return null;
|
|
922
|
+
}
|
|
923
|
+
return createChainableTypeChecker(validate);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
function createElementTypeTypeChecker() {
|
|
927
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
928
|
+
var propValue = props[propName];
|
|
929
|
+
if (!reactIs.isValidElementType(propValue)) {
|
|
930
|
+
var propType = getPropType(propValue);
|
|
931
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
|
|
932
|
+
}
|
|
933
|
+
return null;
|
|
934
|
+
}
|
|
935
|
+
return createChainableTypeChecker(validate);
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
function createInstanceTypeChecker(expectedClass) {
|
|
939
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
940
|
+
if (!(props[propName] instanceof expectedClass)) {
|
|
941
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
942
|
+
var actualClassName = getClassName(props[propName]);
|
|
943
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
|
944
|
+
}
|
|
945
|
+
return null;
|
|
946
|
+
}
|
|
947
|
+
return createChainableTypeChecker(validate);
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
function createEnumTypeChecker(expectedValues) {
|
|
951
|
+
if (!Array.isArray(expectedValues)) {
|
|
952
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
953
|
+
if (arguments.length > 1) {
|
|
954
|
+
printWarning$1(
|
|
955
|
+
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
|
|
956
|
+
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
|
|
957
|
+
);
|
|
958
|
+
} else {
|
|
959
|
+
printWarning$1('Invalid argument supplied to oneOf, expected an array.');
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
return emptyFunctionThatReturnsNull;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
966
|
+
var propValue = props[propName];
|
|
967
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
|
968
|
+
if (is(propValue, expectedValues[i])) {
|
|
969
|
+
return null;
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
974
|
+
var type = getPreciseType(value);
|
|
975
|
+
if (type === 'symbol') {
|
|
976
|
+
return String(value);
|
|
977
|
+
}
|
|
978
|
+
return value;
|
|
979
|
+
});
|
|
980
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
|
981
|
+
}
|
|
982
|
+
return createChainableTypeChecker(validate);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
function createObjectOfTypeChecker(typeChecker) {
|
|
986
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
987
|
+
if (typeof typeChecker !== 'function') {
|
|
988
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
|
989
|
+
}
|
|
990
|
+
var propValue = props[propName];
|
|
991
|
+
var propType = getPropType(propValue);
|
|
992
|
+
if (propType !== 'object') {
|
|
993
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
|
994
|
+
}
|
|
995
|
+
for (var key in propValue) {
|
|
996
|
+
if (has(propValue, key)) {
|
|
997
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
998
|
+
if (error instanceof Error) {
|
|
999
|
+
return error;
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
return null;
|
|
1004
|
+
}
|
|
1005
|
+
return createChainableTypeChecker(validate);
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
1009
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
1010
|
+
process.env.NODE_ENV !== 'production' ? printWarning$1('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
|
1011
|
+
return emptyFunctionThatReturnsNull;
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1015
|
+
var checker = arrayOfTypeCheckers[i];
|
|
1016
|
+
if (typeof checker !== 'function') {
|
|
1017
|
+
printWarning$1(
|
|
1018
|
+
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
1019
|
+
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
|
|
1020
|
+
);
|
|
1021
|
+
return emptyFunctionThatReturnsNull;
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1026
|
+
var expectedTypes = [];
|
|
1027
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
1028
|
+
var checker = arrayOfTypeCheckers[i];
|
|
1029
|
+
var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1);
|
|
1030
|
+
if (checkerResult == null) {
|
|
1031
|
+
return null;
|
|
1032
|
+
}
|
|
1033
|
+
if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
|
|
1034
|
+
expectedTypes.push(checkerResult.data.expectedType);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
|
|
1038
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
|
|
1039
|
+
}
|
|
1040
|
+
return createChainableTypeChecker(validate);
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
function createNodeChecker() {
|
|
1044
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1045
|
+
if (!isNode(props[propName])) {
|
|
1046
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
|
1047
|
+
}
|
|
1048
|
+
return null;
|
|
1049
|
+
}
|
|
1050
|
+
return createChainableTypeChecker(validate);
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
1054
|
+
return new PropTypeError(
|
|
1055
|
+
(componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
|
|
1056
|
+
'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
|
|
1057
|
+
);
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
function createShapeTypeChecker(shapeTypes) {
|
|
1061
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1062
|
+
var propValue = props[propName];
|
|
1063
|
+
var propType = getPropType(propValue);
|
|
1064
|
+
if (propType !== 'object') {
|
|
1065
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1066
|
+
}
|
|
1067
|
+
for (var key in shapeTypes) {
|
|
1068
|
+
var checker = shapeTypes[key];
|
|
1069
|
+
if (typeof checker !== 'function') {
|
|
1070
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1071
|
+
}
|
|
1072
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
1073
|
+
if (error) {
|
|
1074
|
+
return error;
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
return null;
|
|
1078
|
+
}
|
|
1079
|
+
return createChainableTypeChecker(validate);
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
function createStrictShapeTypeChecker(shapeTypes) {
|
|
1083
|
+
function validate(props, propName, componentName, location, propFullName) {
|
|
1084
|
+
var propValue = props[propName];
|
|
1085
|
+
var propType = getPropType(propValue);
|
|
1086
|
+
if (propType !== 'object') {
|
|
1087
|
+
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
|
1088
|
+
}
|
|
1089
|
+
// We need to check all keys in case some are required but missing from props.
|
|
1090
|
+
var allKeys = objectAssign({}, props[propName], shapeTypes);
|
|
1091
|
+
for (var key in allKeys) {
|
|
1092
|
+
var checker = shapeTypes[key];
|
|
1093
|
+
if (has(shapeTypes, key) && typeof checker !== 'function') {
|
|
1094
|
+
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
1095
|
+
}
|
|
1096
|
+
if (!checker) {
|
|
1097
|
+
return new PropTypeError(
|
|
1098
|
+
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
1099
|
+
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
1100
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
1101
|
+
);
|
|
1102
|
+
}
|
|
1103
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
1104
|
+
if (error) {
|
|
1105
|
+
return error;
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
return null;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
return createChainableTypeChecker(validate);
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
function isNode(propValue) {
|
|
1115
|
+
switch (typeof propValue) {
|
|
1116
|
+
case 'number':
|
|
1117
|
+
case 'string':
|
|
1118
|
+
case 'undefined':
|
|
1119
|
+
return true;
|
|
1120
|
+
case 'boolean':
|
|
1121
|
+
return !propValue;
|
|
1122
|
+
case 'object':
|
|
1123
|
+
if (Array.isArray(propValue)) {
|
|
1124
|
+
return propValue.every(isNode);
|
|
1125
|
+
}
|
|
1126
|
+
if (propValue === null || isValidElement(propValue)) {
|
|
1127
|
+
return true;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
var iteratorFn = getIteratorFn(propValue);
|
|
1131
|
+
if (iteratorFn) {
|
|
1132
|
+
var iterator = iteratorFn.call(propValue);
|
|
1133
|
+
var step;
|
|
1134
|
+
if (iteratorFn !== propValue.entries) {
|
|
1135
|
+
while (!(step = iterator.next()).done) {
|
|
1136
|
+
if (!isNode(step.value)) {
|
|
1137
|
+
return false;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
} else {
|
|
1141
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
|
1142
|
+
while (!(step = iterator.next()).done) {
|
|
1143
|
+
var entry = step.value;
|
|
1144
|
+
if (entry) {
|
|
1145
|
+
if (!isNode(entry[1])) {
|
|
1146
|
+
return false;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
} else {
|
|
1152
|
+
return false;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
return true;
|
|
1156
|
+
default:
|
|
1157
|
+
return false;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
function isSymbol(propType, propValue) {
|
|
1162
|
+
// Native Symbol.
|
|
1163
|
+
if (propType === 'symbol') {
|
|
1164
|
+
return true;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
// falsy value can't be a Symbol
|
|
1168
|
+
if (!propValue) {
|
|
1169
|
+
return false;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
|
1173
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
|
1174
|
+
return true;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
|
1178
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
|
1179
|
+
return true;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
return false;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
|
1186
|
+
function getPropType(propValue) {
|
|
1187
|
+
var propType = typeof propValue;
|
|
1188
|
+
if (Array.isArray(propValue)) {
|
|
1189
|
+
return 'array';
|
|
1190
|
+
}
|
|
1191
|
+
if (propValue instanceof RegExp) {
|
|
1192
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
|
1193
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
|
1194
|
+
// passes PropTypes.object.
|
|
1195
|
+
return 'object';
|
|
1196
|
+
}
|
|
1197
|
+
if (isSymbol(propType, propValue)) {
|
|
1198
|
+
return 'symbol';
|
|
1199
|
+
}
|
|
1200
|
+
return propType;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
|
1204
|
+
// See `createPrimitiveTypeChecker`.
|
|
1205
|
+
function getPreciseType(propValue) {
|
|
1206
|
+
if (typeof propValue === 'undefined' || propValue === null) {
|
|
1207
|
+
return '' + propValue;
|
|
1208
|
+
}
|
|
1209
|
+
var propType = getPropType(propValue);
|
|
1210
|
+
if (propType === 'object') {
|
|
1211
|
+
if (propValue instanceof Date) {
|
|
1212
|
+
return 'date';
|
|
1213
|
+
} else if (propValue instanceof RegExp) {
|
|
1214
|
+
return 'regexp';
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
return propType;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
// Returns a string that is postfixed to a warning about an invalid type.
|
|
1221
|
+
// For example, "undefined" or "of type array"
|
|
1222
|
+
function getPostfixForTypeWarning(value) {
|
|
1223
|
+
var type = getPreciseType(value);
|
|
1224
|
+
switch (type) {
|
|
1225
|
+
case 'array':
|
|
1226
|
+
case 'object':
|
|
1227
|
+
return 'an ' + type;
|
|
1228
|
+
case 'boolean':
|
|
1229
|
+
case 'date':
|
|
1230
|
+
case 'regexp':
|
|
1231
|
+
return 'a ' + type;
|
|
1232
|
+
default:
|
|
1233
|
+
return type;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
// Returns class name of the object, if any.
|
|
1238
|
+
function getClassName(propValue) {
|
|
1239
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
|
1240
|
+
return ANONYMOUS;
|
|
1241
|
+
}
|
|
1242
|
+
return propValue.constructor.name;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
ReactPropTypes.checkPropTypes = checkPropTypes_1;
|
|
1246
|
+
ReactPropTypes.resetWarningCache = checkPropTypes_1.resetWarningCache;
|
|
1247
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1248
|
+
|
|
1249
|
+
return ReactPropTypes;
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
function emptyFunction() {}
|
|
1253
|
+
function emptyFunctionWithReset() {}
|
|
1254
|
+
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
1255
|
+
|
|
1256
|
+
var factoryWithThrowingShims = function() {
|
|
1257
|
+
function shim(props, propName, componentName, location, propFullName, secret) {
|
|
1258
|
+
if (secret === ReactPropTypesSecret_1) {
|
|
1259
|
+
// It is still safe when called from React.
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
var err = new Error(
|
|
1263
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
1264
|
+
'Use PropTypes.checkPropTypes() to call them. ' +
|
|
1265
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
1266
|
+
);
|
|
1267
|
+
err.name = 'Invariant Violation';
|
|
1268
|
+
throw err;
|
|
1269
|
+
} shim.isRequired = shim;
|
|
1270
|
+
function getShim() {
|
|
1271
|
+
return shim;
|
|
1272
|
+
} // Important!
|
|
1273
|
+
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
|
1274
|
+
var ReactPropTypes = {
|
|
1275
|
+
array: shim,
|
|
1276
|
+
bigint: shim,
|
|
1277
|
+
bool: shim,
|
|
1278
|
+
func: shim,
|
|
1279
|
+
number: shim,
|
|
1280
|
+
object: shim,
|
|
1281
|
+
string: shim,
|
|
1282
|
+
symbol: shim,
|
|
1283
|
+
|
|
1284
|
+
any: shim,
|
|
1285
|
+
arrayOf: getShim,
|
|
1286
|
+
element: shim,
|
|
1287
|
+
elementType: shim,
|
|
1288
|
+
instanceOf: getShim,
|
|
1289
|
+
node: shim,
|
|
1290
|
+
objectOf: getShim,
|
|
1291
|
+
oneOf: getShim,
|
|
1292
|
+
oneOfType: getShim,
|
|
1293
|
+
shape: getShim,
|
|
1294
|
+
exact: getShim,
|
|
1295
|
+
|
|
1296
|
+
checkPropTypes: emptyFunctionWithReset,
|
|
1297
|
+
resetWarningCache: emptyFunction
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1300
|
+
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
1301
|
+
|
|
1302
|
+
return ReactPropTypes;
|
|
1303
|
+
};
|
|
1304
|
+
|
|
1305
|
+
var propTypes = createCommonjsModule(function (module) {
|
|
1306
|
+
/**
|
|
1307
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
1308
|
+
*
|
|
1309
|
+
* This source code is licensed under the MIT license found in the
|
|
1310
|
+
* LICENSE file in the root directory of this source tree.
|
|
1311
|
+
*/
|
|
1312
|
+
|
|
1313
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
1314
|
+
var ReactIs = reactIs;
|
|
1315
|
+
|
|
1316
|
+
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
1317
|
+
// http://fb.me/prop-types-in-prod
|
|
1318
|
+
var throwOnDirectAccess = true;
|
|
1319
|
+
module.exports = factoryWithTypeCheckers(ReactIs.isElement, throwOnDirectAccess);
|
|
1320
|
+
} else {
|
|
1321
|
+
// By explicitly using `prop-types` you are opting into new production behavior.
|
|
1322
|
+
// http://fb.me/prop-types-in-prod
|
|
1323
|
+
module.exports = factoryWithThrowingShims();
|
|
1324
|
+
}
|
|
1325
|
+
});
|
|
1326
|
+
|
|
1327
|
+
var _templateObject$3, _templateObject2$3, _templateObject3$3, _templateObject4$2, _templateObject5$2, _templateObject6$2;
|
|
1328
|
+
var ProductImage = styled.img(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteralLoose(["\n min-width: 50px;\n min-height: 58px;\n @media only screen and (max-width: 640px) {\n margin: 0.5em 0;\n padding-right: 0.5em;\n }\n"])));
|
|
1329
|
+
var ProductName = styled.h6(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n font-size: 1em;\n line-height: 1.6em;\n max-height: 1.6em;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: auto;\n @media only screen and (max-width: 740px) {\n max-height: 3.8em;\n line-height: 1.25em;\n /* font-size: 0.75rem; */\n }\n"])));
|
|
1330
|
+
var CartTableRow = styled(TableRow)(_templateObject3$3 || (_templateObject3$3 = _taggedTemplateLiteralLoose(["\n position: relative;\n transition: 0.3s;\n background: white;\n .outOfStock {\n font-size: 0.75em;\n color: red;\n text-transform: uppercase;\n font-weight: 500;\n }\n .price {\n font-size: 1.19em;\n font-weight: bold;\n color: #323232;\n }\n .borderLeft {\n height: 100%;\n width: 0;\n background: #fd0015;\n transition: 0.2s;\n width: 0px;\n position: absolute;\n left: 0;\n top: 0;\n border-top-left-radius: 10px;\n display: none;\n border-bottom-left-radius: 10px;\n }\n &:hover {\n background: white !important;\n opacity: 1;\n box-shadow: 1px 2px 6px 2px rgba(0, 0, 0, 0.2);\n z-index: 2;\n border-radius: 20px;\n .borderLeft {\n width: 13px;\n display: inline-block;\n }\n }\n @media only screen and (max-width: 640px) {\n .CartnoPaddingSm {\n padding: 0 !important;\n }\n .price {\n font-size: 0.8rem;\n }\n margin: 0.5em 0;\n .cartCheckBox {\n .css-i4bv87-MuiSvgIcon-root {\n font-size: 10px !important;\n }\n }\n }\n"])));
|
|
1331
|
+
var CartTableCell$1 = styled(TableCell)(_templateObject4$2 || (_templateObject4$2 = _taggedTemplateLiteralLoose(["\n border: none !important;\n"])));
|
|
1332
|
+
var QuantityBox = styled.div(_templateObject5$2 || (_templateObject5$2 = _taggedTemplateLiteralLoose(["\n height: 1.75em;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n div {\n /* width:30px; */\n height: 100%;\n aspect-ratio: 1.1/1;\n display: grid;\n place-items: center;\n font-size: 0.75em;\n color: white;\n background-color: #323232;\n cursor: pointer;\n }\n .price {\n background: transparent;\n cursor: auto;\n p {\n color: #5e5c5c;\n font-size: 0.685em;\n font-weight: 500;\n }\n }\n .add {\n background-color: #ebebeb;\n color: #323232;\n }\n"])));
|
|
1333
|
+
var DeleteBtn = styled.div(_templateObject6$2 || (_templateObject6$2 = _taggedTemplateLiteralLoose(["\n display: grid;\n place-items: center;\n cursor: pointer;\n border-radius: 50%;\n width: 20px;\n height: 20px;\n background: #eef1f4;\n color: #393f48;\n font-size: 0.75em;\n transition: 0.4s;\n &:hover {\n background: red;\n color: white;\n }\n"])));
|
|
1334
|
+
|
|
1335
|
+
var CardRow = function CardRow(_ref) {
|
|
1336
|
+
var _styles$Btn, _row$standardPrice, _row$subtotal;
|
|
1337
|
+
|
|
1338
|
+
var row = _ref.row,
|
|
1339
|
+
isItemSelected = _ref.isItemSelected,
|
|
1340
|
+
handleClick = _ref.handleClick,
|
|
1341
|
+
imgnotfoundUrl = _ref.imgnotfoundUrl,
|
|
1342
|
+
handleIncrementDecrement = _ref.handleIncrementDecrement,
|
|
1343
|
+
handleRemoveProduct = _ref.handleRemoveProduct,
|
|
1344
|
+
loading = _ref.loading,
|
|
1345
|
+
imgSize = _ref.imgSize,
|
|
1346
|
+
styles = _ref.styles;
|
|
1347
|
+
var imgnotfoundUrlcommon = '/images/imgnotfound.jpeg';
|
|
1348
|
+
if (imgnotfoundUrl && imgnotfoundUrl !== 'null') imgnotfoundUrlcommon = imgnotfoundUrl;
|
|
1349
|
+
return /*#__PURE__*/React__default.createElement(CartTableRow, {
|
|
1350
|
+
hover: true,
|
|
1351
|
+
onClick: function onClick(event) {
|
|
1352
|
+
return handleClick(event, row.productId);
|
|
261
1353
|
},
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
1354
|
+
role: "checkbox",
|
|
1355
|
+
"aria-checked": isItemSelected,
|
|
1356
|
+
tabIndex: -1,
|
|
1357
|
+
key: row.ProductId,
|
|
1358
|
+
selected: isItemSelected
|
|
1359
|
+
}, /*#__PURE__*/React__default.createElement(CartTableCell$1, {
|
|
1360
|
+
padding: "checkbox"
|
|
1361
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
1362
|
+
className: "borderLeft",
|
|
1363
|
+
style: {
|
|
1364
|
+
background: styles === null || styles === void 0 ? void 0 : (_styles$Btn = styles.Btn) === null || _styles$Btn === void 0 ? void 0 : _styles$Btn.background
|
|
269
1365
|
}
|
|
270
|
-
},
|
|
1366
|
+
}), /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
1367
|
+
color: "primary",
|
|
1368
|
+
checked: isItemSelected,
|
|
1369
|
+
inputProps: {
|
|
1370
|
+
'aria-labelledby': 'product'
|
|
1371
|
+
},
|
|
1372
|
+
className: "cartCheckBox"
|
|
1373
|
+
})), /*#__PURE__*/React__default.createElement(CartTableCell$1, {
|
|
1374
|
+
className: "CartnoPaddingSm"
|
|
1375
|
+
}, /*#__PURE__*/React__default.createElement(ProductImage, {
|
|
1376
|
+
src: row.imageUrl && row.imageUrl !== 'null' ? row.imageUrl : imgnotfoundUrlcommon,
|
|
1377
|
+
alt: 'no product image available',
|
|
1378
|
+
width: (imgSize === null || imgSize === void 0 ? void 0 : imgSize.width) || 50,
|
|
1379
|
+
height: (imgSize === null || imgSize === void 0 ? void 0 : imgSize.height) || 58
|
|
1380
|
+
})), /*#__PURE__*/React__default.createElement(CartTableCell$1, {
|
|
1381
|
+
component: "th",
|
|
1382
|
+
id: row === null || row === void 0 ? void 0 : row.labelId,
|
|
1383
|
+
scope: "row",
|
|
1384
|
+
padding: "none"
|
|
1385
|
+
}, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
1386
|
+
title: row === null || row === void 0 ? void 0 : row.productName,
|
|
1387
|
+
placement: "top",
|
|
1388
|
+
arrow: true
|
|
1389
|
+
}, /*#__PURE__*/React__default.createElement(ProductName, null, row.productName)), row.quantity > row.availableQuantity && /*#__PURE__*/React__default.createElement("p", {
|
|
1390
|
+
className: "outOfStock"
|
|
1391
|
+
}, "out of stock")), /*#__PURE__*/React__default.createElement(CartTableCell$1, {
|
|
1392
|
+
align: "center",
|
|
1393
|
+
className: "CartnoBelowSm"
|
|
1394
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
1395
|
+
className: "price"
|
|
1396
|
+
}, "$", row === null || row === void 0 ? void 0 : (_row$standardPrice = row.standardPrice) === null || _row$standardPrice === void 0 ? void 0 : _row$standardPrice.toFixed(2))), /*#__PURE__*/React__default.createElement(CartTableCell$1, {
|
|
1397
|
+
align: "center"
|
|
1398
|
+
}, /*#__PURE__*/React__default.createElement(QuantityBox, null, /*#__PURE__*/React__default.createElement("div", {
|
|
1399
|
+
onClick: function onClick(e) {
|
|
1400
|
+
e.stopPropagation();
|
|
1401
|
+
if (loading) return;
|
|
1402
|
+
handleIncrementDecrement('decrement', row);
|
|
1403
|
+
}
|
|
1404
|
+
}, "-"), /*#__PURE__*/React__default.createElement("div", {
|
|
1405
|
+
className: "price"
|
|
1406
|
+
}, /*#__PURE__*/React__default.createElement("p", null, row === null || row === void 0 ? void 0 : row.quantity)), /*#__PURE__*/React__default.createElement("div", {
|
|
1407
|
+
className: "add",
|
|
1408
|
+
onClick: function onClick(e) {
|
|
1409
|
+
e.stopPropagation();
|
|
1410
|
+
if (loading) return;
|
|
1411
|
+
handleIncrementDecrement('increment', row);
|
|
1412
|
+
}
|
|
1413
|
+
}, "+"))), /*#__PURE__*/React__default.createElement(CartTableCell$1, {
|
|
1414
|
+
alig: "center",
|
|
1415
|
+
className: "CartnoPaddingSm"
|
|
1416
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
1417
|
+
className: "price"
|
|
1418
|
+
}, "$", (_row$subtotal = row.subtotal) === null || _row$subtotal === void 0 ? void 0 : _row$subtotal.toFixed(2))), /*#__PURE__*/React__default.createElement(CartTableCell$1, {
|
|
1419
|
+
alig: "center",
|
|
1420
|
+
className: "CartnoBelowSm"
|
|
1421
|
+
}, /*#__PURE__*/React__default.createElement(DeleteBtn, {
|
|
1422
|
+
onClick: function onClick(e) {
|
|
1423
|
+
e.stopPropagation();
|
|
1424
|
+
if (loading) return;
|
|
1425
|
+
handleRemoveProduct(row);
|
|
1426
|
+
}
|
|
1427
|
+
}, "x")));
|
|
1428
|
+
};
|
|
1429
|
+
|
|
1430
|
+
var headCells = [{
|
|
1431
|
+
id: 'image',
|
|
1432
|
+
numeric: false,
|
|
1433
|
+
disablePadding: true,
|
|
1434
|
+
label: 'product',
|
|
1435
|
+
filter: false
|
|
1436
|
+
}, {
|
|
1437
|
+
id: 'name',
|
|
1438
|
+
numeric: false,
|
|
1439
|
+
disablePadding: true,
|
|
1440
|
+
label: 'description',
|
|
1441
|
+
filter: false
|
|
1442
|
+
}, {
|
|
1443
|
+
id: 'standardPrice',
|
|
1444
|
+
numeric: true,
|
|
1445
|
+
disablePadding: false,
|
|
1446
|
+
label: 'price',
|
|
1447
|
+
filter: true,
|
|
1448
|
+
noBelowSm: true
|
|
1449
|
+
}, {
|
|
1450
|
+
id: 'quantity',
|
|
1451
|
+
numeric: true,
|
|
1452
|
+
disablePadding: false,
|
|
1453
|
+
label: 'qty',
|
|
1454
|
+
filter: true
|
|
1455
|
+
}, {
|
|
1456
|
+
id: 'subtotal',
|
|
1457
|
+
numeric: true,
|
|
1458
|
+
disablePadding: false,
|
|
1459
|
+
label: 'subtotal',
|
|
1460
|
+
filter: true
|
|
1461
|
+
}, {
|
|
1462
|
+
id: 'delete',
|
|
1463
|
+
numeric: false,
|
|
1464
|
+
disablePadding: true,
|
|
1465
|
+
label: ' ',
|
|
1466
|
+
filter: false,
|
|
1467
|
+
noBelowSm: true
|
|
1468
|
+
}];
|
|
1469
|
+
|
|
1470
|
+
function EnhancedTableHead(props) {
|
|
1471
|
+
var onSelectAllClick = props.onSelectAllClick,
|
|
1472
|
+
order = props.order,
|
|
1473
|
+
orderBy = props.orderBy,
|
|
1474
|
+
numSelected = props.numSelected,
|
|
1475
|
+
rowCount = props.rowCount,
|
|
1476
|
+
onRequestSort = props.onRequestSort,
|
|
1477
|
+
styles = props.styles;
|
|
1478
|
+
|
|
1479
|
+
var createSortHandler = function createSortHandler(property) {
|
|
1480
|
+
return function (event) {
|
|
1481
|
+
onRequestSort(event, property);
|
|
1482
|
+
};
|
|
1483
|
+
};
|
|
1484
|
+
|
|
1485
|
+
return /*#__PURE__*/createElement(TableHead, {
|
|
1486
|
+
className: "CartnoBelowSm",
|
|
1487
|
+
sx: {
|
|
1488
|
+
zIndex: '2'
|
|
1489
|
+
}
|
|
1490
|
+
}, /*#__PURE__*/createElement(TableRow$1, null, /*#__PURE__*/createElement(CartTableCell, {
|
|
1491
|
+
padding: "checkbox",
|
|
1492
|
+
bg: styles.bg
|
|
1493
|
+
}, /*#__PURE__*/createElement(Checkbox, {
|
|
1494
|
+
color: "primary",
|
|
1495
|
+
indeterminate: numSelected > 0 && numSelected < rowCount,
|
|
1496
|
+
checked: rowCount > 0 && numSelected === rowCount,
|
|
1497
|
+
onChange: onSelectAllClick,
|
|
1498
|
+
inputProps: {
|
|
1499
|
+
'aria-label': 'select all products'
|
|
1500
|
+
}
|
|
1501
|
+
})), headCells.map(function (headCell) {
|
|
1502
|
+
return /*#__PURE__*/createElement(CartTableCell, {
|
|
1503
|
+
key: headCell.id,
|
|
1504
|
+
align: headCell.numeric ? 'center' : 'left',
|
|
1505
|
+
padding: headCell.disablePadding ? 'none' : 'normal',
|
|
1506
|
+
sortDirection: orderBy === headCell.id ? order : false,
|
|
1507
|
+
sx: {
|
|
1508
|
+
textTransform: 'uppercase'
|
|
1509
|
+
},
|
|
1510
|
+
className: (headCell === null || headCell === void 0 ? void 0 : headCell.noBelowSm) && 'CartnoBelowSm',
|
|
1511
|
+
bg: styles.bg
|
|
1512
|
+
}, headCell.filter ? /*#__PURE__*/createElement(TableSortLabel, {
|
|
1513
|
+
active: orderBy === headCell.id,
|
|
1514
|
+
direction: orderBy === headCell.id ? order : 'asc',
|
|
1515
|
+
onClick: createSortHandler(headCell.id)
|
|
1516
|
+
}, headCell.label) : headCell.label);
|
|
1517
|
+
})));
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
EnhancedTableHead.propTypes = {
|
|
1521
|
+
numSelected: propTypes.number.isRequired,
|
|
1522
|
+
onRequestSort: propTypes.func.isRequired,
|
|
1523
|
+
onSelectAllClick: propTypes.func.isRequired,
|
|
1524
|
+
order: propTypes.oneOf(['asc', 'desc']).isRequired,
|
|
1525
|
+
orderBy: propTypes.string.isRequired,
|
|
1526
|
+
rowCount: propTypes.number.isRequired
|
|
271
1527
|
};
|
|
1528
|
+
function EnhancedTable(_ref) {
|
|
1529
|
+
var _styles$scroll, _styles$scroll2;
|
|
1530
|
+
|
|
1531
|
+
var cartData = _ref.cartData,
|
|
1532
|
+
loading = _ref.loading,
|
|
1533
|
+
imgnotfoundUrl = _ref.imgnotfoundUrl,
|
|
1534
|
+
handleIncrementDecrement = _ref.handleIncrementDecrement,
|
|
1535
|
+
handleRemoveProduct = _ref.handleRemoveProduct,
|
|
1536
|
+
styles = _ref.styles;
|
|
1537
|
+
var cartList = cartData === null || cartData === void 0 ? void 0 : cartData.cartLineItemDtoList.map(function (li) {
|
|
1538
|
+
return _extends({}, li, {
|
|
1539
|
+
subtotal: li.standardPrice * li.quantity
|
|
1540
|
+
});
|
|
1541
|
+
});
|
|
1542
|
+
|
|
1543
|
+
var _React$useState = useState('asc'),
|
|
1544
|
+
order = _React$useState[0],
|
|
1545
|
+
setOrder = _React$useState[1];
|
|
1546
|
+
|
|
1547
|
+
var _React$useState2 = useState('calories'),
|
|
1548
|
+
orderBy = _React$useState2[0],
|
|
1549
|
+
setOrderBy = _React$useState2[1];
|
|
1550
|
+
|
|
1551
|
+
var _React$useState3 = useState([]),
|
|
1552
|
+
selected = _React$useState3[0],
|
|
1553
|
+
setSelected = _React$useState3[1];
|
|
1554
|
+
|
|
1555
|
+
var _React$useState4 = useState(cartList),
|
|
1556
|
+
cartArray = _React$useState4[0],
|
|
1557
|
+
setCartArray = _React$useState4[1];
|
|
1558
|
+
|
|
1559
|
+
var Sort = function Sort() {
|
|
1560
|
+
console.log(orderBy, order);
|
|
1561
|
+
var newArray = cartArray || [];
|
|
1562
|
+
var li = orderBy;
|
|
1563
|
+
|
|
1564
|
+
if (order === 'asc') {
|
|
1565
|
+
newArray.sort(function (a, b) {
|
|
1566
|
+
return a[li] - b[li];
|
|
1567
|
+
});
|
|
1568
|
+
return setCartArray(newArray);
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
newArray.sort(function (a, b) {
|
|
1572
|
+
return b[li] - a[li];
|
|
1573
|
+
});
|
|
1574
|
+
return setCartArray(newArray);
|
|
1575
|
+
};
|
|
1576
|
+
|
|
1577
|
+
useEffect(function () {
|
|
1578
|
+
Sort();
|
|
1579
|
+
}, [order, orderBy]);
|
|
1580
|
+
|
|
1581
|
+
var handleRequestSort = function handleRequestSort(event, property) {
|
|
1582
|
+
var isAsc = orderBy === property && order === 'asc';
|
|
1583
|
+
setOrder(isAsc ? 'desc' : 'asc');
|
|
1584
|
+
setOrderBy(property);
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
var handleSelectAllClick = function handleSelectAllClick(event) {
|
|
1588
|
+
console.log(event.target.checked, 'checked');
|
|
1589
|
+
|
|
1590
|
+
if (selected.length < (cartArray === null || cartArray === void 0 ? void 0 : cartArray.length)) {
|
|
1591
|
+
var newSelected = [];
|
|
1592
|
+
cartArray === null || cartArray === void 0 ? void 0 : cartArray.map(function (n) {
|
|
1593
|
+
return newSelected.push(n.productId);
|
|
1594
|
+
});
|
|
1595
|
+
console.log({
|
|
1596
|
+
newSelected: newSelected
|
|
1597
|
+
});
|
|
1598
|
+
setSelected(newSelected);
|
|
1599
|
+
return;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
setSelected([]);
|
|
1603
|
+
};
|
|
1604
|
+
|
|
1605
|
+
var handleClick = function handleClick(event, id) {
|
|
1606
|
+
console.log(id, 'id');
|
|
1607
|
+
var includes = selected.includes(id);
|
|
1608
|
+
|
|
1609
|
+
if (includes) {
|
|
1610
|
+
var removedId = selected.filter(function (product) {
|
|
1611
|
+
return product !== id;
|
|
1612
|
+
});
|
|
1613
|
+
console.log({
|
|
1614
|
+
removedId: removedId
|
|
1615
|
+
});
|
|
1616
|
+
setSelected(removedId);
|
|
1617
|
+
} else {
|
|
1618
|
+
setSelected([].concat(selected, [id]));
|
|
1619
|
+
}
|
|
1620
|
+
};
|
|
1621
|
+
|
|
1622
|
+
var isSelected = function isSelected(name) {
|
|
1623
|
+
return selected.includes(name);
|
|
1624
|
+
};
|
|
1625
|
+
|
|
1626
|
+
useEffect(function () {
|
|
1627
|
+
setCartArray(cartList);
|
|
1628
|
+
}, [cartData]);
|
|
1629
|
+
return /*#__PURE__*/createElement(CartPageBox, null, loading && /*#__PURE__*/createElement(Loader, null, /*#__PURE__*/createElement(BounceLoader, {
|
|
1630
|
+
size: 40,
|
|
1631
|
+
color: styles.Btn.background,
|
|
1632
|
+
loading: true
|
|
1633
|
+
})), /*#__PURE__*/createElement(Box, {
|
|
1634
|
+
sx: {
|
|
1635
|
+
width: '100%',
|
|
1636
|
+
mb: 2
|
|
1637
|
+
}
|
|
1638
|
+
}, /*#__PURE__*/createElement(CartTableContainer, {
|
|
1639
|
+
bg: styles === null || styles === void 0 ? void 0 : (_styles$scroll = styles.scroll) === null || _styles$scroll === void 0 ? void 0 : _styles$scroll.bg,
|
|
1640
|
+
color: styles === null || styles === void 0 ? void 0 : (_styles$scroll2 = styles.scroll) === null || _styles$scroll2 === void 0 ? void 0 : _styles$scroll2.background
|
|
1641
|
+
}, /*#__PURE__*/createElement(Table, {
|
|
1642
|
+
"aria-labelledby": "tableTitle",
|
|
1643
|
+
size: 'small',
|
|
1644
|
+
stickyHeader: true
|
|
1645
|
+
}, /*#__PURE__*/createElement(EnhancedTableHead, {
|
|
1646
|
+
numSelected: selected.length,
|
|
1647
|
+
order: order,
|
|
1648
|
+
orderBy: orderBy,
|
|
1649
|
+
onSelectAllClick: handleSelectAllClick,
|
|
1650
|
+
onRequestSort: handleRequestSort,
|
|
1651
|
+
rowCount: cartArray === null || cartArray === void 0 ? void 0 : cartArray.length,
|
|
1652
|
+
styles: styles
|
|
1653
|
+
}), /*#__PURE__*/createElement(TableBody, null, cartArray === null || cartArray === void 0 ? void 0 : cartArray.map(function (row, index) {
|
|
1654
|
+
var isItemSelected = isSelected(row.productId);
|
|
1655
|
+
return /*#__PURE__*/createElement(CardRow, {
|
|
1656
|
+
row: row,
|
|
1657
|
+
isItemSelected: isItemSelected,
|
|
1658
|
+
handleClick: handleClick,
|
|
1659
|
+
imgnotfoundUrl: imgnotfoundUrl,
|
|
1660
|
+
cartData: cartData,
|
|
1661
|
+
loading: loading,
|
|
1662
|
+
styles: styles,
|
|
1663
|
+
handleIncrementDecrement: handleIncrementDecrement,
|
|
1664
|
+
handleRemoveProduct: handleRemoveProduct
|
|
1665
|
+
});
|
|
1666
|
+
}))))), /*#__PURE__*/createElement(CartButtonsRow, null, /*#__PURE__*/createElement("button", null, "remove selected"), /*#__PURE__*/createElement("button", null, "updated cart")));
|
|
1667
|
+
}
|
|
272
1668
|
|
|
273
|
-
var _templateObject$
|
|
274
|
-
var CartPageCard = styled.div(_templateObject$
|
|
275
|
-
var CartPageImg = styled.img(_templateObject2$
|
|
1669
|
+
var _templateObject$4, _templateObject2$4, _templateObject3$4, _templateObject4$3, _templateObject5$3, _templateObject6$3, _templateObject7$2;
|
|
1670
|
+
var CartPageCard = styled.div(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n width: min(97%, 485px);\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n padding: 1rem;\n background: #ffffff;\n box-shadow: 0px 20px 35px rgba(0, 0, 0, 0.05);\n border-radius: 20px;\n position: relative;\n"])));
|
|
1671
|
+
var CartPageImg = styled.img(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteralLoose(["\n /* width: 95px; */\n width: ", ";\n height: ", ";\n position: relative;\n margin-right: 1em;\n"])), function (props) {
|
|
276
1672
|
return props.width || 'auto';
|
|
277
1673
|
}, function (props) {
|
|
278
1674
|
return props.height || '81px';
|
|
279
1675
|
});
|
|
280
|
-
var NameAndQtBox = styled.div(_templateObject3$
|
|
281
|
-
var CartPageCardName = styled.div(_templateObject4$
|
|
282
|
-
var QtAndPriceBox = styled.div(_templateObject5$
|
|
283
|
-
var CartPageQtBox = styled.div(_templateObject6$
|
|
284
|
-
var CloseBtn = styled.div(_templateObject7$
|
|
1676
|
+
var NameAndQtBox = styled.div(_templateObject3$4 || (_templateObject3$4 = _taggedTemplateLiteralLoose(["\n width: 90%;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n justify-content: space-between;\n position: relative;\n"])));
|
|
1677
|
+
var CartPageCardName = styled.div(_templateObject4$3 || (_templateObject4$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n justify-content: flex-start;\n align-items: flex-start;\n width: 90%;\n overflow: hidden;\n text-overflow: ellipsis;\n margin-bottom: 0.6em;\n h6 {\n color: #323232;\n font-size: 0.9em;\n margin-bottom: 0.6em;\n line-height: 1.3rem;\n max-height: 1.4rem;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n p {\n font-size: 1.1em;\n color: #c3c6c9;\n }\n"])));
|
|
1678
|
+
var QtAndPriceBox = styled.div(_templateObject5$3 || (_templateObject5$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n width: 100%;\n .subtotal {\n color: #323232;\n text-transform: capitalize;\n font-weight: bold;\n font-size: 0.85em;\n }\n"])));
|
|
1679
|
+
var CartPageQtBox = styled.div(_templateObject6$3 || (_templateObject6$3 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n max-width: 80px;\n min-width: 80px;\n height: 22px;\n .icon {\n width: 20.5px;\n height: 20.5px;\n display: grid;\n place-items: center;\n font-size: 10px;\n background: #eef1f4;\n cursor: pointer;\n }\n .qt {\n font-size: 18px;\n font-weight: 500;\n display: grid;\n place-items: center;\n color: #c3c6c9;\n }\n"])));
|
|
1680
|
+
var CloseBtn = styled.div(_templateObject7$2 || (_templateObject7$2 = _taggedTemplateLiteralLoose(["\n width: 25px;\n height: 25px;\n display: grid;\n place-items: center;\n position: absolute;\n top: 1em;\n right: 1em;\n cursor: pointer;\n border-radius: 50%;\n background: #eef1f4;\n font-size: 12px;\n"])));
|
|
285
1681
|
|
|
286
1682
|
var CartPageProductCard = function CartPageProductCard(_ref) {
|
|
287
1683
|
var _item$standardPrice;
|
|
@@ -294,58 +1690,204 @@ var CartPageProductCard = function CartPageProductCard(_ref) {
|
|
|
294
1690
|
imgSize = _ref.imgSize;
|
|
295
1691
|
var imgnotfoundUrlcommon = '/images/imgnotfound.jpeg';
|
|
296
1692
|
if (imgnotfoundUrl && imgnotfoundUrl !== 'null') imgnotfoundUrlcommon = imgnotfoundUrl;
|
|
297
|
-
return /*#__PURE__*/
|
|
1693
|
+
return /*#__PURE__*/React__default.createElement(CartPageCard, null, /*#__PURE__*/React__default.createElement(CartPageImg, {
|
|
298
1694
|
src: item.imageUrl && item.imageUrl !== 'null' ? item.imageUrl : imgnotfoundUrlcommon,
|
|
299
1695
|
alt: 'no product image available',
|
|
300
1696
|
width: imgSize === null || imgSize === void 0 ? void 0 : imgSize.width,
|
|
301
1697
|
height: imgSize === null || imgSize === void 0 ? void 0 : imgSize.height
|
|
302
|
-
}), /*#__PURE__*/
|
|
1698
|
+
}), /*#__PURE__*/React__default.createElement(NameAndQtBox, null, /*#__PURE__*/React__default.createElement(CartPageCardName, null, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
303
1699
|
title: item.productName,
|
|
304
1700
|
placement: "top",
|
|
305
1701
|
arrow: true
|
|
306
|
-
}, /*#__PURE__*/
|
|
1702
|
+
}, /*#__PURE__*/React__default.createElement("h6", null, item.productName)), /*#__PURE__*/React__default.createElement("p", null, "$", (_item$standardPrice = item.standardPrice) === null || _item$standardPrice === void 0 ? void 0 : _item$standardPrice.toFixed(2))), /*#__PURE__*/React__default.createElement(QtAndPriceBox, null, /*#__PURE__*/React__default.createElement(CartPageQtBox, null, /*#__PURE__*/React__default.createElement("span", {
|
|
307
1703
|
className: "icon",
|
|
308
1704
|
onClick: function onClick() {
|
|
309
1705
|
if (loading) return;
|
|
310
1706
|
handleIncrementDecrement('decrement', item);
|
|
311
1707
|
}
|
|
312
|
-
}, /*#__PURE__*/
|
|
1708
|
+
}, /*#__PURE__*/React__default.createElement(AiOutlineMinus, null)), /*#__PURE__*/React__default.createElement("span", {
|
|
313
1709
|
className: "qt"
|
|
314
|
-
}, item.quantity), /*#__PURE__*/
|
|
1710
|
+
}, item.quantity), /*#__PURE__*/React__default.createElement("span", {
|
|
315
1711
|
className: "icon",
|
|
316
1712
|
onClick: function onClick() {
|
|
317
1713
|
if (loading) return;
|
|
318
1714
|
handleIncrementDecrement('increment', item);
|
|
319
1715
|
}
|
|
320
|
-
}, /*#__PURE__*/
|
|
1716
|
+
}, /*#__PURE__*/React__default.createElement(AiOutlinePlus, null))), /*#__PURE__*/React__default.createElement("p", {
|
|
321
1717
|
className: "subtotal"
|
|
322
|
-
}, "subtotal: $", (item.standardPrice * item.quantity).toFixed(2)))), /*#__PURE__*/
|
|
1718
|
+
}, "subtotal: $", (item.standardPrice * item.quantity).toFixed(2)))), /*#__PURE__*/React__default.createElement(CloseBtn, {
|
|
323
1719
|
onClick: function onClick() {
|
|
324
1720
|
if (loading) return;
|
|
325
1721
|
handleRemoveProduct(item);
|
|
326
1722
|
}
|
|
327
|
-
}, /*#__PURE__*/
|
|
1723
|
+
}, /*#__PURE__*/React__default.createElement(AiOutlineClose, null)));
|
|
328
1724
|
};
|
|
329
1725
|
|
|
330
|
-
var
|
|
331
|
-
var
|
|
332
|
-
|
|
1726
|
+
var CartPageMainRetail = function CartPageMainRetail(_ref) {
|
|
1727
|
+
var _cartData$cartLineIte;
|
|
1728
|
+
|
|
1729
|
+
var retail = _ref.retail,
|
|
1730
|
+
cartData = _ref.cartData,
|
|
1731
|
+
loading = _ref.loading,
|
|
1732
|
+
imgnotfoundUrl = _ref.imgnotfoundUrl,
|
|
1733
|
+
handleIncrementDecrement = _ref.handleIncrementDecrement,
|
|
1734
|
+
handleRemoveProduct = _ref.handleRemoveProduct,
|
|
1735
|
+
styles = _ref.styles;
|
|
1736
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
1737
|
+
className: "scrollDiv"
|
|
1738
|
+
}, /*#__PURE__*/React__default.createElement(CardsBox, {
|
|
1739
|
+
retail: retail
|
|
1740
|
+
}, loading && /*#__PURE__*/React__default.createElement(Loader, null, /*#__PURE__*/React__default.createElement(BounceLoader, {
|
|
1741
|
+
size: 40,
|
|
1742
|
+
color: styles.Btn.background,
|
|
1743
|
+
loading: true
|
|
1744
|
+
})), cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.map(function (item) {
|
|
1745
|
+
return /*#__PURE__*/React__default.createElement(CartPageProductCard, {
|
|
1746
|
+
item: item,
|
|
1747
|
+
loading: loading,
|
|
1748
|
+
imgnotfoundUrl: imgnotfoundUrl,
|
|
1749
|
+
handleIncrementDecrement: handleIncrementDecrement,
|
|
1750
|
+
handleRemoveProduct: handleRemoveProduct,
|
|
1751
|
+
imgSize: styles === null || styles === void 0 ? void 0 : styles.imgSize
|
|
1752
|
+
});
|
|
1753
|
+
})));
|
|
1754
|
+
};
|
|
1755
|
+
|
|
1756
|
+
var _templateObject$5, _templateObject2$5, _templateObject3$5, _templateObject4$4, _templateObject5$4, _templateObject6$4;
|
|
1757
|
+
var CartSummaryContainer = styled.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n width: min(95%, 28.75em);\n max-width: ", ";\n display: flex;\n flex-direction: column;\n background: ", ";\n color: ", ";\n border-radius: 20px;\n padding: 2em 1em;\n align-items: center;\n margin-top: 3em;\n p {\n font-size: 0.89em;\n font-weight: 300;\n align-self: flex-start;\n color: inherit;\n margin: 0;\n padding: 0;\n }\n .continueShopping {\n font-size: 0.75em;\n color: inherit;\n text-transform: capitalize;\n height: 20px;\n border-bottom: 1px solid;\n border-color: ", ";\n font-weight: 300;\n cursor: pointer;\n }\n"])), function (props) {
|
|
1758
|
+
return props.maxWidth || '24.75em';
|
|
333
1759
|
}, function (props) {
|
|
334
|
-
return props.
|
|
1760
|
+
return props.background || '#667080';
|
|
335
1761
|
}, function (props) {
|
|
336
|
-
return props.
|
|
1762
|
+
return props.color || 'white';
|
|
337
1763
|
}, function (props) {
|
|
338
|
-
return props.
|
|
1764
|
+
return props.color || 'white';
|
|
1765
|
+
});
|
|
1766
|
+
var CartSummaryRow = styled.div(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n justify-content: ", ";\n align-items: center;\n color: inherit;\n h6,\n h5 {\n margin: 0;\n font-size: 1em;\n font-weight: 700;\n color: inherit;\n text-transform: capitalize;\n }\n h5 {\n font-size: ", ";\n }\n"])), function (props) {
|
|
1767
|
+
return props.justify || 'space-between';
|
|
339
1768
|
}, function (props) {
|
|
340
|
-
return props.
|
|
1769
|
+
return props.h5 || '1.31em';
|
|
341
1770
|
});
|
|
342
|
-
var
|
|
343
|
-
return props.
|
|
1771
|
+
var CartSummaryHr = styled.span(_templateObject3$5 || (_templateObject3$5 = _taggedTemplateLiteralLoose(["\n border: none;\n width: 100%;\n height: 1px;\n background-color: ", ";\n margin: 1em 0;\n"])), function (props) {
|
|
1772
|
+
return props.color || 'rgba(255, 255, 255, 0.5)';
|
|
1773
|
+
});
|
|
1774
|
+
var CartSummaryInputBox = styled.form(_templateObject4$4 || (_templateObject4$4 = _taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n padding-bottom: ", ";\n input {\n width: 10.81rem;\n height: 2.44rem;\n padding: 0.2em 0.8em;\n text-transform: capitalize;\n font-size: 0.89em;\n border-radius: ", ";\n margin-right: ", ";\n border: none;\n outline: none;\n background: ", ";\n color: ", ";\n &::placeholder {\n color: ", ";\n }\n }\n button {\n width: 7.75rem;\n height: 2.44rem;\n background: ", ";\n border-radius: ", ";\n display: grid;\n color: ", ";\n place-items: center;\n border: none;\n outline: none;\n text-transform: uppercase;\n cursor: pointer;\n font-size: 0.75em;\n transition: 0.3s;\n &:hover {\n letter-spacing: 1px;\n }\n }\n"])), function (props) {
|
|
1775
|
+
return props.paddingBottom ? '2em' : '0';
|
|
1776
|
+
}, function (props) {
|
|
1777
|
+
return props.retail ? '1.19rem' : '0';
|
|
1778
|
+
}, function (props) {
|
|
1779
|
+
return props.retail ? '1em' : '0';
|
|
1780
|
+
}, function (props) {
|
|
1781
|
+
return props.background || '#bfc3ca';
|
|
1782
|
+
}, function (props) {
|
|
1783
|
+
return props.color || '#667080';
|
|
1784
|
+
}, function (props) {
|
|
1785
|
+
return props.color || '#667080';
|
|
1786
|
+
}, function (props) {
|
|
1787
|
+
return props.btn || '#393f48';
|
|
1788
|
+
}, function (props) {
|
|
1789
|
+
return props.retail ? '1.19rem' : 0;
|
|
1790
|
+
}, function (props) {
|
|
1791
|
+
return props.Btncolor || 'inherit';
|
|
1792
|
+
});
|
|
1793
|
+
var CartSummaryCheckoutBtn = styled.button(_templateObject5$4 || (_templateObject5$4 = _taggedTemplateLiteralLoose(["\n font-size: 0.95em;\n font-weight: 700;\n background: ", ";\n color: ", ";\n cursor: pointer;\n text-transform: uppercase;\n border: none;\n outline: none;\n width: 16.81em;\n height: 3.75em;\n display: grid;\n place-items: center;\n font-size: 0.75em;\n border-radius: ", ";\n padding: 0;\n font-size: 0.94em;\n margin: 1em auto;\n transition: 0.3s;\n margin-top: 2em;\n &:hover {\n opacity: 0.8;\n }\n"])), function (props) {
|
|
1794
|
+
return props.background || '#393f48';
|
|
1795
|
+
}, function (props) {
|
|
1796
|
+
return props.color || 'inherit';
|
|
1797
|
+
}, function (props) {
|
|
1798
|
+
return props.retail ? '2.64em' : '';
|
|
1799
|
+
});
|
|
1800
|
+
var CartSummaryCheckBoxRow = styled(CartSummaryRow)(_templateObject6$4 || (_templateObject6$4 = _taggedTemplateLiteralLoose(["\n justify-content: flex-start;\n margin-left: 1em;\n margin-top: 1em;\n cursor: pointer;\n .checkBox {\n width: 0.63em;\n height: 0.63em;\n border: 1px solid;\n border-color: ", ";\n background: transparent;\n margin-right: 0.5em;\n border-radius: 50%;\n background: ", ";\n }\n p {\n font-size: 1em;\n font-weight: 6 400;\n span {\n font-weight: 600;\n margin: 0 0.1em;\n }\n .underline {\n font-weight: 400;\n text-decoration: underline;\n }\n }\n"])), function (props) {
|
|
1801
|
+
return props.background || 'white';
|
|
1802
|
+
}, function (props) {
|
|
1803
|
+
return props.selected ? props.background : 'transparent';
|
|
344
1804
|
});
|
|
345
1805
|
|
|
346
|
-
var
|
|
347
|
-
var
|
|
1806
|
+
var CartSummary = function CartSummary(_ref) {
|
|
1807
|
+
var _cartSummary$input, _cartSummary$input2, _ref2;
|
|
348
1808
|
|
|
1809
|
+
var _ref$retail = _ref.retail,
|
|
1810
|
+
retail = _ref$retail === void 0 ? true : _ref$retail,
|
|
1811
|
+
shippingData = _ref.shippingData,
|
|
1812
|
+
selectedShipping = _ref.selectedShipping,
|
|
1813
|
+
setShipping = _ref.setShipping,
|
|
1814
|
+
clickRedirect = _ref.clickRedirect,
|
|
1815
|
+
subtotal = _ref.subtotal,
|
|
1816
|
+
styles = _ref.styles,
|
|
1817
|
+
totalCartPrice = _ref.totalCartPrice;
|
|
1818
|
+
var cartSummary = styles.cartSummary,
|
|
1819
|
+
Btn = styles.Btn;
|
|
1820
|
+
return /*#__PURE__*/React__default.createElement(CartSummaryContainer, {
|
|
1821
|
+
background: cartSummary.bg,
|
|
1822
|
+
color: cartSummary.color
|
|
1823
|
+
}, /*#__PURE__*/React__default.createElement("p", null, "Cart summary"), /*#__PURE__*/React__default.createElement(CartSummaryHr, {
|
|
1824
|
+
color: cartSummary.hr
|
|
1825
|
+
}), /*#__PURE__*/React__default.createElement(CartSummaryRow, null, /*#__PURE__*/React__default.createElement("h6", null, "subtotal"), /*#__PURE__*/React__default.createElement("h5", null, "$", subtotal === null || subtotal === void 0 ? void 0 : subtotal.toFixed(2))), /*#__PURE__*/React__default.createElement(CartSummaryHr, {
|
|
1826
|
+
color: cartSummary.hr
|
|
1827
|
+
}), /*#__PURE__*/React__default.createElement(CartSummaryRow, null, /*#__PURE__*/React__default.createElement("h6", null, "Discount"), /*#__PURE__*/React__default.createElement("h5", null, "$0.00")), /*#__PURE__*/React__default.createElement(CartSummaryHr, {
|
|
1828
|
+
color: cartSummary.hr
|
|
1829
|
+
}), retail && /*#__PURE__*/React__default.createElement(Stack, {
|
|
1830
|
+
flexDirection: "column",
|
|
1831
|
+
justifyContent: "flexStart",
|
|
1832
|
+
sx: {
|
|
1833
|
+
width: '100%'
|
|
1834
|
+
}
|
|
1835
|
+
}, /*#__PURE__*/React__default.createElement(CartSummaryRow, {
|
|
1836
|
+
justify: "flex-start"
|
|
1837
|
+
}, /*#__PURE__*/React__default.createElement("h6", null, "shipping")), shippingData && shippingData.map(function (li, i) {
|
|
1838
|
+
var _li$amount;
|
|
1839
|
+
|
|
1840
|
+
return /*#__PURE__*/React__default.createElement(CartSummaryCheckBoxRow, {
|
|
1841
|
+
key: i,
|
|
1842
|
+
selected: li.id === selectedShipping.id,
|
|
1843
|
+
onClick: function onClick() {
|
|
1844
|
+
setShipping(li);
|
|
1845
|
+
},
|
|
1846
|
+
background: cartSummary.color
|
|
1847
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
1848
|
+
className: "checkBox"
|
|
1849
|
+
}), /*#__PURE__*/React__default.createElement("p", null, li.name, ' ', li.amount && li.amount > 0 && /*#__PURE__*/React__default.createElement("span", null, ": $", (_li$amount = li.amount) === null || _li$amount === void 0 ? void 0 : _li$amount.toFixed(2))));
|
|
1850
|
+
}), /*#__PURE__*/React__default.createElement(CartSummaryCheckBoxRow, null, /*#__PURE__*/React__default.createElement("p", null, "Shipping options will be updated during checkout.", /*#__PURE__*/React__default.createElement("br", null), /*#__PURE__*/React__default.createElement("span", {
|
|
1851
|
+
className: "underline"
|
|
1852
|
+
}, "Calculate shipping"))), /*#__PURE__*/React__default.createElement(CartSummaryHr, {
|
|
1853
|
+
color: cartSummary.hr
|
|
1854
|
+
})), /*#__PURE__*/React__default.createElement(CartSummaryInputBox, {
|
|
1855
|
+
paddingBottom: !retail,
|
|
1856
|
+
background: (_cartSummary$input = cartSummary.input) === null || _cartSummary$input === void 0 ? void 0 : _cartSummary$input.bg,
|
|
1857
|
+
color: (_cartSummary$input2 = cartSummary.input) === null || _cartSummary$input2 === void 0 ? void 0 : _cartSummary$input2.color,
|
|
1858
|
+
btn: Btn === null || Btn === void 0 ? void 0 : Btn.background,
|
|
1859
|
+
Btncolor: Btn === null || Btn === void 0 ? void 0 : Btn.color,
|
|
1860
|
+
retail: retail
|
|
1861
|
+
}, /*#__PURE__*/React__default.createElement("input", {
|
|
1862
|
+
placeholder: "Coupon code",
|
|
1863
|
+
type: "email",
|
|
1864
|
+
required: true
|
|
1865
|
+
}), /*#__PURE__*/React__default.createElement("button", null, "apply coupon")), /*#__PURE__*/React__default.createElement(CartSummaryHr, {
|
|
1866
|
+
color: cartSummary.hr
|
|
1867
|
+
}), /*#__PURE__*/React__default.createElement(CartSummaryRow, {
|
|
1868
|
+
h5: "1.64em"
|
|
1869
|
+
}, /*#__PURE__*/React__default.createElement("h6", null, "total"), retail ? /*#__PURE__*/React__default.createElement("h5", null, "$", (_ref2 = totalCartPrice + (selectedShipping === null || selectedShipping === void 0 ? void 0 : selectedShipping.amount)) === null || _ref2 === void 0 ? void 0 : _ref2.toFixed(2)) : /*#__PURE__*/React__default.createElement("h5", null, "$", totalCartPrice === null || totalCartPrice === void 0 ? void 0 : totalCartPrice.toFixed(2))), /*#__PURE__*/React__default.createElement(CartSummaryRow, {
|
|
1870
|
+
justify: "center"
|
|
1871
|
+
}, /*#__PURE__*/React__default.createElement(CartSummaryCheckoutBtn, {
|
|
1872
|
+
retail: retail,
|
|
1873
|
+
onClick: function onClick() {
|
|
1874
|
+
if (loading) return;
|
|
1875
|
+
clickRedirect('/checkout');
|
|
1876
|
+
},
|
|
1877
|
+
background: Btn.background,
|
|
1878
|
+
color: Btn.color
|
|
1879
|
+
}, "proceed to checkokut")), /*#__PURE__*/React__default.createElement(CartSummaryRow, {
|
|
1880
|
+
justify: "center"
|
|
1881
|
+
}, /*#__PURE__*/React__default.createElement("span", {
|
|
1882
|
+
className: "continueShopping",
|
|
1883
|
+
onClick: function onClick() {
|
|
1884
|
+
if (loading) return;
|
|
1885
|
+
clickRedirect('/');
|
|
1886
|
+
}
|
|
1887
|
+
}, "Continue to shopping")));
|
|
1888
|
+
};
|
|
1889
|
+
|
|
1890
|
+
var CartPageComponent = function CartPageComponent(_ref) {
|
|
349
1891
|
var retail = _ref.retail,
|
|
350
1892
|
shippingData = _ref.shippingData,
|
|
351
1893
|
selectedShipping = _ref.selectedShipping,
|
|
@@ -357,30 +1899,38 @@ var CartPageComponent = function CartPageComponent(_ref) {
|
|
|
357
1899
|
loading = _ref.loading,
|
|
358
1900
|
imgnotfoundUrl = _ref.imgnotfoundUrl,
|
|
359
1901
|
styles = _ref.styles;
|
|
360
|
-
return /*#__PURE__*/
|
|
361
|
-
|
|
362
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
363
|
-
className: "scrollDiv"
|
|
364
|
-
}, /*#__PURE__*/React.createElement(CardsBox, {
|
|
1902
|
+
return /*#__PURE__*/React__default.createElement(CartPageSection, {
|
|
1903
|
+
bg: styles.bg,
|
|
365
1904
|
retail: retail
|
|
366
|
-
},
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
1905
|
+
}, /*#__PURE__*/React__default.createElement(CartPageContainer, {
|
|
1906
|
+
retail: retail,
|
|
1907
|
+
loading: loading
|
|
1908
|
+
}, retail ? /*#__PURE__*/React__default.createElement(CartPageMainRetail, {
|
|
1909
|
+
retail: retail,
|
|
1910
|
+
cartData: cartData,
|
|
1911
|
+
loading: loading,
|
|
1912
|
+
imgnotfoundUrl: imgnotfoundUrl,
|
|
1913
|
+
styles: styles,
|
|
1914
|
+
handleIncrementDecrement: handleIncrementDecrement,
|
|
1915
|
+
handleRemoveProduct: handleRemoveProduct
|
|
1916
|
+
}) : /*#__PURE__*/React__default.createElement(EnhancedTable, {
|
|
1917
|
+
retail: retail,
|
|
1918
|
+
cartData: cartData,
|
|
1919
|
+
loading: loading,
|
|
1920
|
+
imgnotfoundUrl: imgnotfoundUrl,
|
|
1921
|
+
styles: styles,
|
|
1922
|
+
handleIncrementDecrement: handleIncrementDecrement,
|
|
1923
|
+
handleRemoveProduct: handleRemoveProduct
|
|
1924
|
+
}), /*#__PURE__*/React__default.createElement(CartSummary, {
|
|
376
1925
|
retail: retail,
|
|
377
1926
|
shippingData: shippingData,
|
|
378
1927
|
selectedShipping: selectedShipping,
|
|
379
1928
|
setShipping: setShipping,
|
|
380
1929
|
clickRedirect: clickRedirect,
|
|
381
1930
|
subtotal: cartData === null || cartData === void 0 ? void 0 : cartData.totalCartPrice,
|
|
382
|
-
|
|
383
|
-
|
|
1931
|
+
totalCartPrice: cartData === null || cartData === void 0 ? void 0 : cartData.totalCartPrice,
|
|
1932
|
+
styles: styles
|
|
1933
|
+
})));
|
|
384
1934
|
};
|
|
385
1935
|
|
|
386
1936
|
var Breakpoint = function Breakpoint() {};
|
|
@@ -488,5 +2038,5 @@ function useGridSize() {
|
|
|
488
2038
|
return layout;
|
|
489
2039
|
}
|
|
490
2040
|
|
|
491
|
-
export { Breakpoint, CartDrawer, CartPageComponent
|
|
2041
|
+
export { Breakpoint, CartDrawer, CartPageComponent, Variant, useGridSize, useWindowSize };
|
|
492
2042
|
//# sourceMappingURL=index.modern.js.map
|