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