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