@salesgenterp/ui-components 0.1.3 → 0.1.8

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 CHANGED
@@ -19,6 +19,7 @@ var ShareIcon = _interopDefault(require('@mui/icons-material/Share'));
19
19
  var ExpandMoreIcon = _interopDefault(require('@mui/icons-material/ExpandMore'));
20
20
  var MoreVertIcon = _interopDefault(require('@mui/icons-material/MoreVert'));
21
21
  var material = require('@mui/material');
22
+ var reactSpinners = require('react-spinners');
22
23
 
23
24
  function _extends() {
24
25
  _extends = Object.assign || function (target) {
@@ -2886,7 +2887,7 @@ function _templateObject6$1() {
2886
2887
  }
2887
2888
 
2888
2889
  function _templateObject5$2() {
2889
- var data = _taggedTemplateLiteralLoose(["\n width: 90%;\n height: 3.55rem;\n border: 2px solid;\n border-radius: 1rem;\n display: grid;\n place-items: center;\n font-weight: 500;\n font-size: 1rem;\n transition: 0.5s;\n outline: none;\n text-transform: capitalize;\n border-color: ", ";\n color: ", ";\n text-transform: capitalize;\n margin: 0.6rem 0;\n cursor: pointer;\n background: white;\n &:hover,\n &:focus {\n opacity: 0.8;\n letter-spacing: 1px;\n outline: none;\n }\n @media only screen and (max-width: 640px) {\n height: 3rem;\n }\n"]);
2890
+ var data = _taggedTemplateLiteralLoose(["\n width: 90%;\n height: 3.55rem;\n border: 2px solid;\n border-radius: 1rem;\n display: grid;\n place-items: center;\n font-weight: 500;\n font-size: 1rem;\n transition: 0.5s;\n outline: none;\n text-transform: capitalize;\n border-color: ", ";\n color: ", ";\n text-transform: capitalize;\n margin: 0.6rem 0;\n cursor: pointer;\n background: white;\n &:hover,\n &:focus {\n opacity: 0.8;\n letter-spacing: 1px;\n outline: none;\n }\n @media only screen and (max-width: 640px) {\n height: 2.9rem;\n }\n @media only screen and (max-width: 340px) {\n height: 2.2rem;\n margin: 0.3rem 0;\n }\n"]);
2890
2891
 
2891
2892
  _templateObject5$2 = function _templateObject5() {
2892
2893
  return data;
@@ -2896,7 +2897,7 @@ function _templateObject5$2() {
2896
2897
  }
2897
2898
 
2898
2899
  function _templateObject4$3() {
2899
- var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n /* height: 8rem; */\n background-color: white;\n box-shadow: 3px -2px 10px #b1b1b1;\n display: flex;\n flex-direction: column;\n min-height: 7rem;\n position: sticky;\n bottom: 0;\n /* left: 0; */\n align-items: center;\n .row {\n width: 90%;\n margin: 0rem auto;\n margin-top: 0.3rem;\n h5 {\n font-weight: bold;\n font-size: 1.1rem;\n span {\n font-weight: 400;\n margin-left: 0.5rem;\n }\n }\n }\n"]);
2900
+ var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n /* height: 8rem; */\n background-color: white;\n box-shadow: 3px -2px 10px #b1b1b1;\n display: flex;\n flex-direction: column;\n min-height: 7rem;\n position: sticky;\n bottom: 0;\n /* padding-bottom: 0.5rem; */\n\n /* left: 0; */\n align-items: center;\n .row {\n width: 90%;\n margin: 0rem auto;\n margin-top: 0.3rem;\n h5 {\n font-weight: bold;\n font-size: 1.1rem;\n span {\n font-weight: 400;\n margin-left: 0.5rem;\n }\n }\n }\n @media only screen and (max-width: 340px) {\n min-height: 6rem;\n .row h5 {\n font-size: 0.8rem;\n }\n }\n"]);
2900
2901
 
2901
2902
  _templateObject4$3 = function _templateObject4() {
2902
2903
  return data;
@@ -2906,7 +2907,7 @@ function _templateObject4$3() {
2906
2907
  }
2907
2908
 
2908
2909
  function _templateObject3$3() {
2909
- var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: max-content;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n /* height: 900px; */\n padding: 1rem;\n min-height: 73vh;\n /* background-color: red; */\n"]);
2910
+ var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n height: max-content;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: flex-start;\n position: relative;\n /* height: 900px; */\n padding: 1rem;\n min-height: 74vh;\n opacity: ", ";\n @media only screen and (max-width: 748px) {\n min-height: 75vh;\n }\n /* background-color: red; */\n"]);
2910
2911
 
2911
2912
  _templateObject3$3 = function _templateObject3() {
2912
2913
  return data;
@@ -2926,7 +2927,7 @@ function _templateObject2$3() {
2926
2927
  }
2927
2928
 
2928
2929
  function _templateObject$7() {
2929
- var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n max-width: ", ";\n height: 100%;\n font-family: ", ";\n /* padding: 1em;\n padding-top: 0rem; */\n position: relative;\n /* min-width: 100%; */\n min-height: 100vh;\n max-height: 100vh;\n overflow-y: auto;\n /* background-color: grey; */\n border: 1px solid;\n"]);
2930
+ var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n max-width: ", ";\n height: 100%;\n font-family: ", ";\n /* padding: 1em;\n padding-top: 0rem; */\n position: relative;\n /* min-width: 100%; */\n min-height: 100vh;\n max-height: 100vh;\n overflow-y: auto;\n /* background-color: grey; */\n /* border: 1px solid; */\n"]);
2930
2931
 
2931
2932
  _templateObject$7 = function _templateObject() {
2932
2933
  return data;
@@ -2940,7 +2941,9 @@ var CartDrawerContainer = styled__default.div(_templateObject$7(), function (pro
2940
2941
  return props.fontFamily;
2941
2942
  });
2942
2943
  var CartDrawerBar = styled__default.div(_templateObject2$3());
2943
- var CartDrawerProductContainer = styled__default.div(_templateObject3$3());
2944
+ var CartDrawerProductContainer = styled__default.div(_templateObject3$3(), function (props) {
2945
+ return props.opacity;
2946
+ });
2944
2947
  var CartDrawerBottomSection = styled__default.div(_templateObject4$3());
2945
2948
  var CartDrawerOutlinedButton = styled__default.button(_templateObject5$2(), function (props) {
2946
2949
  return props.color || 'black';
@@ -2966,8 +2969,18 @@ function AiOutlineMinus (props) {
2966
2969
  return GenIcon({"tag":"svg","attr":{"t":"1551322312294","style":"","viewBox":"0 0 1024 1024","version":"1.1"},"child":[{"tag":"defs","attr":{},"child":[]},{"tag":"path","attr":{"d":"M474 152m8 0l60 0q8 0 8 8l0 704q0 8-8 8l-60 0q-8 0-8-8l0-704q0-8 8-8Z"}},{"tag":"path","attr":{"d":"M168 474m8 0l672 0q8 0 8 8l0 60q0 8-8 8l-672 0q-8 0-8-8l0-60q0-8 8-8Z"}}]})(props);
2967
2970
  }
2968
2971
 
2972
+ function _templateObject3$4() {
2973
+ var data = _taggedTemplateLiteralLoose(["\nposition:absolute;\ntop:30%;\nwidth:100px;\nheight:100px;\ndisplay:grid;\nplace-items:center;\n"]);
2974
+
2975
+ _templateObject3$4 = function _templateObject3() {
2976
+ return data;
2977
+ };
2978
+
2979
+ return data;
2980
+ }
2981
+
2969
2982
  function _templateObject2$4() {
2970
- var data = _taggedTemplateLiteralLoose(["\n height: 34px;\n width: 82px;\n border: 1px solid rgb(211, 210, 210);\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 13.5px;\n color: #333;\n padding: 0 0.5rem;\n border-radius: 5px;\n max-width: 100%;\n\n span {\n cursor: pointer;\n height: 100%;\n display: grid;\n place-items: center;\n }\n .qt {\n font-size: 12px;\n color: black;\n font-weight: 500;\n cursor: copy;\n }\n @media only screen and (max-width: 640px) {\n min-width: 55px;\n aspect-ratio: 1/2;\n /* min-height: 28px; */\n font-size: 10px;\n }\n @media only screen and (max-width: 340px) {\n min-width: 50px;\n aspect-ratio: 1/2;\n height: 22px;\n font-size: 8px;\n }\n"]);
2983
+ var data = _taggedTemplateLiteralLoose(["\n height: 34px;\n width: 82px;\n border: 1px solid rgb(211, 210, 210);\n display: flex;\n align-items: center;\n justify-content: space-between;\n font-size: 13.5px;\n color: #333;\n padding: 0 0.5rem;\n border-radius: 5px;\n max-width: 100%;\n\n span {\n cursor: pointer;\n height: 100%;\n display: grid;\n place-items: center;\n }\n .qt {\n font-size: 12px;\n color: black;\n font-weight: 500;\n cursor: auto;\n }\n @media only screen and (max-width: 640px) {\n min-width: 55px;\n aspect-ratio: 1/2;\n /* min-height: 28px; */\n font-size: 10px;\n }\n @media only screen and (max-width: 340px) {\n min-width: 50px;\n aspect-ratio: 1/2;\n height: 22px;\n font-size: 8px;\n }\n"]);
2971
2984
 
2972
2985
  _templateObject2$4 = function _templateObject2() {
2973
2986
  return data;
@@ -2977,7 +2990,7 @@ function _templateObject2$4() {
2977
2990
  }
2978
2991
 
2979
2992
  function _templateObject$8() {
2980
- var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n height: 100px;\n justify-content: space-around;\n align-items: center;\n overflow: hidden;\n margin-bottom: 2rem;\n img {\n width: 20%;\n /* aspect-ratio: 1; */\n object-fit: cover;\n }\n .middleSection {\n width: 60%;\n padding-left: 0.8rem;\n height: 100%;\n h6 {\n font-size: 1.1rem;\n font-weight: bold;\n margin: 0;\n\n span {\n font-size: 0.8rem;\n color: grey;\n text-decoration: line-through;\n margin-right: 0.5rem;\n }\n }\n .name {\n font-size: 0.9rem;\n max-height: 50px;\n width: 100%;\n word-wrap: break-word;\n overflow: hidden;\n text-overflow: ellipsis;\n transition: 0.3s;\n cursor: pointer;\n &:hover {\n color: ", ";\n }\n }\n }\n .endSection {\n width: 20%;\n height: 100%;\n .icon {\n cursor: pointer;\n transition: 0.4s;\n &:hover {\n opacity: 0.7;\n }\n }\n }\n @media only screen and (max-width: 340px) {\n height: 80px;\n .middleSection {\n h6 {\n font-size: 0.9rem;\n }\n .name {\n font-size: 0.7rem;\n height: 2rem;\n }\n }\n }\n"]);
2993
+ var data = _taggedTemplateLiteralLoose(["\n width: 100%;\n display: flex;\n flex-direction: row;\n height: 100px;\n justify-content: space-around;\n align-items: center;\n overflow: hidden;\n margin-bottom: 2rem;\n img {\n width: 20%;\n /* aspect-ratio: 1; */\n object-fit: cover;\n }\n .middleSection {\n width: 60%;\n padding-left: 0.8rem;\n height: 100%;\n h6 {\n font-size: 1.1rem;\n font-weight: bold;\n margin: 0;\n\n span {\n font-size: 0.8rem;\n color: grey;\n text-decoration: line-through;\n margin-right: 0.5rem;\n }\n }\n .name {\n font-size: 0.9rem;\n line-height: 1.2rem;\n max-height: 2.45rem;\n width: 100%;\n word-wrap: break-word;\n overflow: hidden;\n text-overflow: ellipsis;\n transition: 0.3s;\n cursor: pointer;\n &:hover {\n color: ", ";\n }\n }\n }\n .endSection {\n width: 20%;\n height: 100%;\n .icon {\n cursor: pointer;\n transition: 0.4s;\n &:hover {\n opacity: 0.7;\n }\n }\n }\n @media only screen and (max-width: 340px) {\n height: 80px;\n .middleSection {\n h6 {\n font-size: 0.9rem;\n }\n .name {\n font-size: 0.7rem;\n height: 1.45rem;\n }\n }\n }\n"]);
2981
2994
 
2982
2995
  _templateObject$8 = function _templateObject() {
2983
2996
  return data;
@@ -2989,9 +3002,10 @@ var CartDrawerProduct = styled__default.div(_templateObject$8(), function (props
2989
3002
  return props.color || 'grey';
2990
3003
  });
2991
3004
  var CartDrawerQtBox = styled__default.div(_templateObject2$4());
3005
+ var CartDrawerLoader = styled__default.div(_templateObject3$4());
2992
3006
 
2993
3007
  var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
2994
- var _product$standardPric, _product$standardPric2;
3008
+ var _product$cartStandard, _product$standardPric;
2995
3009
 
2996
3010
  var product = _ref.product,
2997
3011
  color = _ref.color,
@@ -3001,7 +3015,7 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
3001
3015
  return /*#__PURE__*/React__default.createElement(CartDrawerProduct, {
3002
3016
  color: color
3003
3017
  }, /*#__PURE__*/React__default.createElement("img", {
3004
- src: product.imageUrl && product.imageUrl !== 'null' ? product.imageUrl : '',
3018
+ src: product.imageUrl && product.imageUrl !== 'null' ? product.imageUrl : '/images/imgnotfound.jpeg',
3005
3019
  alt: 'no product image available'
3006
3020
  }), /*#__PURE__*/React__default.createElement(material.Stack, {
3007
3021
  flexDirection: "column",
@@ -3011,9 +3025,9 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
3011
3025
  }, /*#__PURE__*/React__default.createElement("h6", {
3012
3026
  className: "name",
3013
3027
  onClick: function onClick() {
3014
- return handleRedirect(product.aliase, product.productId);
3028
+ return handleRedirect(product);
3015
3029
  }
3016
- }, product === null || product === void 0 ? void 0 : product.productName), /*#__PURE__*/React__default.createElement("h6", null, (product === null || product === void 0 ? void 0 : product.standardPrice) === (product === null || product === void 0 ? void 0 : product.standardPriceWithoutDiscount) ? "$" + (product === null || product === void 0 ? void 0 : product.standardPrice) : /*#__PURE__*/React__default.createElement(Fragment, null, /*#__PURE__*/React__default.createElement("span", null, "$", product === null || product === void 0 ? void 0 : (_product$standardPric = product.standardPriceWithoutDiscount) === null || _product$standardPric === void 0 ? void 0 : _product$standardPric.toFixed(2)), "$", product === null || product === void 0 ? void 0 : (_product$standardPric2 = product.standardPrice) === null || _product$standardPric2 === void 0 ? void 0 : _product$standardPric2.toFixed(2)))), /*#__PURE__*/React__default.createElement(material.Stack, {
3030
+ }, product === null || product === void 0 ? void 0 : product.productName), /*#__PURE__*/React__default.createElement("h6", null, (product === null || product === void 0 ? void 0 : product.standardPrice) === (product === null || product === void 0 ? void 0 : product.cartStandardPrice) ? "$" + (product === null || product === void 0 ? void 0 : product.standardPrice) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", null, "$", product === null || product === void 0 ? void 0 : (_product$cartStandard = product.cartStandardPrice) === null || _product$cartStandard === void 0 ? void 0 : _product$cartStandard.toFixed(2)), "$", product === null || product === void 0 ? void 0 : (_product$standardPric = product.standardPrice) === null || _product$standardPric === void 0 ? void 0 : _product$standardPric.toFixed(2)))), /*#__PURE__*/React__default.createElement(material.Stack, {
3017
3031
  flexDirection: "column",
3018
3032
  justifyContent: "space-between",
3019
3033
  alignItems: "flex-end",
@@ -3021,17 +3035,17 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
3021
3035
  }, /*#__PURE__*/React__default.createElement(RiDeleteBin5Line, {
3022
3036
  className: "icon",
3023
3037
  onClick: function onClick() {
3024
- handleRemoveProduct(product.productId);
3038
+ handleRemoveProduct(product);
3025
3039
  }
3026
3040
  }), /*#__PURE__*/React__default.createElement(CartDrawerQtBox, null, /*#__PURE__*/React__default.createElement("span", {
3027
3041
  onClick: function onClick() {
3028
- handleIncrementDecrement('decrement', product.productId);
3042
+ handleIncrementDecrement('decrement', product);
3029
3043
  }
3030
3044
  }, ' ', /*#__PURE__*/React__default.createElement(AiOutlineMinus, null)), ' ', /*#__PURE__*/React__default.createElement("span", {
3031
3045
  className: 'qt'
3032
3046
  }, product === null || product === void 0 ? void 0 : product.quantity), /*#__PURE__*/React__default.createElement("span", {
3033
3047
  onClick: function onClick() {
3034
- handleIncrementDecrement('increment', product.productId);
3048
+ handleIncrementDecrement('increment', product);
3035
3049
  }
3036
3050
  }, /*#__PURE__*/React__default.createElement(AiOutlinePlus, null)))));
3037
3051
  };
@@ -3045,23 +3059,28 @@ var CartDrawer = function CartDrawer(_ref) {
3045
3059
  handleRedirect = _ref.handleRedirect,
3046
3060
  handleIncrementDecrement = _ref.handleIncrementDecrement,
3047
3061
  handleRemoveProduct = _ref.handleRemoveProduct,
3048
- handleClose = _ref.handleClose;
3049
- return /*#__PURE__*/React__default.createElement(Fragment, null, /*#__PURE__*/React__default.createElement(CartDrawerContainer, {
3062
+ handleClose = _ref.handleClose,
3063
+ loading = _ref.loading;
3064
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CartDrawerContainer, {
3050
3065
  maxWidth: maxWidth
3051
3066
  }, /*#__PURE__*/React__default.createElement(CartDrawerBar, null, /*#__PURE__*/React__default.createElement("h2", null, "Your Cart"), /*#__PURE__*/React__default.createElement(GrClose, {
3052
3067
  className: "icon",
3053
3068
  onClick: function onClick() {
3054
3069
  handleClose();
3055
3070
  }
3056
- })), cartData && (cartData === null || cartData === void 0 ? void 0 : cartData.totalCartQuantity) > 0 ? /*#__PURE__*/React__default.createElement(CartDrawerProductContainer, null, cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItems) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.map(function (product, i) {
3057
- return /*#__PURE__*/React__default.createElement(CartDrawerProductCard, {
3071
+ })), cartData && (cartData === null || cartData === void 0 ? void 0 : cartData.totalCartQuantity) > 0 ? /*#__PURE__*/React__default.createElement(CartDrawerProductContainer, {
3072
+ opacity: loading ? '.4' : '1'
3073
+ }, cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.map(function (product, i) {
3074
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CartDrawerLoader, null, /*#__PURE__*/React__default.createElement(reactSpinners.PuffLoader, {
3075
+ color: "black"
3076
+ })), /*#__PURE__*/React__default.createElement(CartDrawerProductCard, {
3058
3077
  product: product,
3059
3078
  handleRedirect: handleRedirect,
3060
3079
  handleIncrementDecrement: handleIncrementDecrement,
3061
3080
  handleRemoveProduct: handleRemoveProduct,
3062
3081
  color: color,
3063
3082
  key: i
3064
- });
3083
+ }));
3065
3084
  })) : /*#__PURE__*/React__default.createElement(CartDrawerEmptyCart, {
3066
3085
  color: color
3067
3086
  }, /*#__PURE__*/React__default.createElement(BsCartX, {