@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.
@@ -15,6 +15,7 @@ import ShareIcon from '@mui/icons-material/Share';
15
15
  import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
16
16
  import MoreVertIcon from '@mui/icons-material/MoreVert';
17
17
  import { Stack } from '@mui/material';
18
+ import { PuffLoader } from 'react-spinners';
18
19
 
19
20
  function _extends() {
20
21
  _extends = Object.assign || function (target) {
@@ -2882,7 +2883,7 @@ function _templateObject6$1() {
2882
2883
  }
2883
2884
 
2884
2885
  function _templateObject5$2() {
2885
- 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"]);
2886
+ 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"]);
2886
2887
 
2887
2888
  _templateObject5$2 = function _templateObject5() {
2888
2889
  return data;
@@ -2892,7 +2893,7 @@ function _templateObject5$2() {
2892
2893
  }
2893
2894
 
2894
2895
  function _templateObject4$3() {
2895
- 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"]);
2896
+ 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"]);
2896
2897
 
2897
2898
  _templateObject4$3 = function _templateObject4() {
2898
2899
  return data;
@@ -2902,7 +2903,7 @@ function _templateObject4$3() {
2902
2903
  }
2903
2904
 
2904
2905
  function _templateObject3$3() {
2905
- 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"]);
2906
+ 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"]);
2906
2907
 
2907
2908
  _templateObject3$3 = function _templateObject3() {
2908
2909
  return data;
@@ -2922,7 +2923,7 @@ function _templateObject2$3() {
2922
2923
  }
2923
2924
 
2924
2925
  function _templateObject$7() {
2925
- 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"]);
2926
+ 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"]);
2926
2927
 
2927
2928
  _templateObject$7 = function _templateObject() {
2928
2929
  return data;
@@ -2936,7 +2937,9 @@ var CartDrawerContainer = styled.div(_templateObject$7(), function (props) {
2936
2937
  return props.fontFamily;
2937
2938
  });
2938
2939
  var CartDrawerBar = styled.div(_templateObject2$3());
2939
- var CartDrawerProductContainer = styled.div(_templateObject3$3());
2940
+ var CartDrawerProductContainer = styled.div(_templateObject3$3(), function (props) {
2941
+ return props.opacity;
2942
+ });
2940
2943
  var CartDrawerBottomSection = styled.div(_templateObject4$3());
2941
2944
  var CartDrawerOutlinedButton = styled.button(_templateObject5$2(), function (props) {
2942
2945
  return props.color || 'black';
@@ -2962,8 +2965,18 @@ function AiOutlineMinus (props) {
2962
2965
  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);
2963
2966
  }
2964
2967
 
2968
+ function _templateObject3$4() {
2969
+ var data = _taggedTemplateLiteralLoose(["\nposition:absolute;\ntop:30%;\nwidth:100px;\nheight:100px;\ndisplay:grid;\nplace-items:center;\n"]);
2970
+
2971
+ _templateObject3$4 = function _templateObject3() {
2972
+ return data;
2973
+ };
2974
+
2975
+ return data;
2976
+ }
2977
+
2965
2978
  function _templateObject2$4() {
2966
- 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"]);
2979
+ 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"]);
2967
2980
 
2968
2981
  _templateObject2$4 = function _templateObject2() {
2969
2982
  return data;
@@ -2973,7 +2986,7 @@ function _templateObject2$4() {
2973
2986
  }
2974
2987
 
2975
2988
  function _templateObject$8() {
2976
- 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"]);
2989
+ 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"]);
2977
2990
 
2978
2991
  _templateObject$8 = function _templateObject() {
2979
2992
  return data;
@@ -2985,9 +2998,10 @@ var CartDrawerProduct = styled.div(_templateObject$8(), function (props) {
2985
2998
  return props.color || 'grey';
2986
2999
  });
2987
3000
  var CartDrawerQtBox = styled.div(_templateObject2$4());
3001
+ var CartDrawerLoader = styled.div(_templateObject3$4());
2988
3002
 
2989
3003
  var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
2990
- var _product$standardPric, _product$standardPric2;
3004
+ var _product$cartStandard, _product$standardPric;
2991
3005
 
2992
3006
  var product = _ref.product,
2993
3007
  color = _ref.color,
@@ -2997,7 +3011,7 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
2997
3011
  return /*#__PURE__*/React__default.createElement(CartDrawerProduct, {
2998
3012
  color: color
2999
3013
  }, /*#__PURE__*/React__default.createElement("img", {
3000
- src: product.imageUrl && product.imageUrl !== 'null' ? product.imageUrl : '',
3014
+ src: product.imageUrl && product.imageUrl !== 'null' ? product.imageUrl : '/images/imgnotfound.jpeg',
3001
3015
  alt: 'no product image available'
3002
3016
  }), /*#__PURE__*/React__default.createElement(Stack, {
3003
3017
  flexDirection: "column",
@@ -3007,9 +3021,9 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
3007
3021
  }, /*#__PURE__*/React__default.createElement("h6", {
3008
3022
  className: "name",
3009
3023
  onClick: function onClick() {
3010
- return handleRedirect(product.aliase, product.productId);
3024
+ return handleRedirect(product);
3011
3025
  }
3012
- }, 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(Stack, {
3026
+ }, product === null || product === void 0 ? void 0 : product.productName), /*#__PURE__*/React__default.createElement("h6", null, (product === null || product === void 0 ? void 0 : product.standardPrice) === (product === null || product === void 0 ? void 0 : product.cartStandardPrice) ? "$" + (product === null || product === void 0 ? void 0 : product.standardPrice) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("span", null, "$", product === null || product === void 0 ? void 0 : (_product$cartStandard = product.cartStandardPrice) === null || _product$cartStandard === void 0 ? void 0 : _product$cartStandard.toFixed(2)), "$", product === null || product === void 0 ? void 0 : (_product$standardPric = product.standardPrice) === null || _product$standardPric === void 0 ? void 0 : _product$standardPric.toFixed(2)))), /*#__PURE__*/React__default.createElement(Stack, {
3013
3027
  flexDirection: "column",
3014
3028
  justifyContent: "space-between",
3015
3029
  alignItems: "flex-end",
@@ -3017,17 +3031,17 @@ var CartDrawerProductCard = function CartDrawerProductCard(_ref) {
3017
3031
  }, /*#__PURE__*/React__default.createElement(RiDeleteBin5Line, {
3018
3032
  className: "icon",
3019
3033
  onClick: function onClick() {
3020
- handleRemoveProduct(product.productId);
3034
+ handleRemoveProduct(product);
3021
3035
  }
3022
3036
  }), /*#__PURE__*/React__default.createElement(CartDrawerQtBox, null, /*#__PURE__*/React__default.createElement("span", {
3023
3037
  onClick: function onClick() {
3024
- handleIncrementDecrement('decrement', product.productId);
3038
+ handleIncrementDecrement('decrement', product);
3025
3039
  }
3026
3040
  }, ' ', /*#__PURE__*/React__default.createElement(AiOutlineMinus, null)), ' ', /*#__PURE__*/React__default.createElement("span", {
3027
3041
  className: 'qt'
3028
3042
  }, product === null || product === void 0 ? void 0 : product.quantity), /*#__PURE__*/React__default.createElement("span", {
3029
3043
  onClick: function onClick() {
3030
- handleIncrementDecrement('increment', product.productId);
3044
+ handleIncrementDecrement('increment', product);
3031
3045
  }
3032
3046
  }, /*#__PURE__*/React__default.createElement(AiOutlinePlus, null)))));
3033
3047
  };
@@ -3041,23 +3055,28 @@ var CartDrawer = function CartDrawer(_ref) {
3041
3055
  handleRedirect = _ref.handleRedirect,
3042
3056
  handleIncrementDecrement = _ref.handleIncrementDecrement,
3043
3057
  handleRemoveProduct = _ref.handleRemoveProduct,
3044
- handleClose = _ref.handleClose;
3045
- return /*#__PURE__*/React__default.createElement(Fragment, null, /*#__PURE__*/React__default.createElement(CartDrawerContainer, {
3058
+ handleClose = _ref.handleClose,
3059
+ loading = _ref.loading;
3060
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CartDrawerContainer, {
3046
3061
  maxWidth: maxWidth
3047
3062
  }, /*#__PURE__*/React__default.createElement(CartDrawerBar, null, /*#__PURE__*/React__default.createElement("h2", null, "Your Cart"), /*#__PURE__*/React__default.createElement(GrClose, {
3048
3063
  className: "icon",
3049
3064
  onClick: function onClick() {
3050
3065
  handleClose();
3051
3066
  }
3052
- })), 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) {
3053
- return /*#__PURE__*/React__default.createElement(CartDrawerProductCard, {
3067
+ })), cartData && (cartData === null || cartData === void 0 ? void 0 : cartData.totalCartQuantity) > 0 ? /*#__PURE__*/React__default.createElement(CartDrawerProductContainer, {
3068
+ opacity: loading ? '.4' : '1'
3069
+ }, cartData === null || cartData === void 0 ? void 0 : (_cartData$cartLineIte = cartData.cartLineItemDtoList) === null || _cartData$cartLineIte === void 0 ? void 0 : _cartData$cartLineIte.map(function (product, i) {
3070
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CartDrawerLoader, null, /*#__PURE__*/React__default.createElement(PuffLoader, {
3071
+ color: "black"
3072
+ })), /*#__PURE__*/React__default.createElement(CartDrawerProductCard, {
3054
3073
  product: product,
3055
3074
  handleRedirect: handleRedirect,
3056
3075
  handleIncrementDecrement: handleIncrementDecrement,
3057
3076
  handleRemoveProduct: handleRemoveProduct,
3058
3077
  color: color,
3059
3078
  key: i
3060
- });
3079
+ }));
3061
3080
  })) : /*#__PURE__*/React__default.createElement(CartDrawerEmptyCart, {
3062
3081
  color: color
3063
3082
  }, /*#__PURE__*/React__default.createElement(BsCartX, {