@licklist/design 0.44.462 → 0.44.463

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.
@@ -1 +1 @@
1
- {"version":3,"file":"CategoryProduct.d.ts","sourceRoot":"","sources":["../../../../src/sales/manual-booking/category-product/CategoryProduct.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,6DAA6D,CAAC;AAE3F,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,UAAU,oBAAoB;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,SAAS,MAAM,sBAAsB,MAAM,aAAa,MAAM,EAAE,CAAC;IAC7E,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC;AAED,eAAO,MAAM,eAAe,8GAQzB,oBAAoB,gBA0PtB,CAAC"}
1
+ {"version":3,"file":"CategoryProduct.d.ts","sourceRoot":"","sources":["../../../../src/sales/manual-booking/category-product/CategoryProduct.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,4BAA4B,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,6DAA6D,CAAC;AAE3F,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,UAAU,oBAAoB;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,SAAS,MAAM,sBAAsB,MAAM,aAAa,MAAM,EAAE,CAAC;IAC7E,kBAAkB,CAAC,EAAE,4BAA4B,CAAC,UAAU,CAAC,CAAC;IAC9D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC;AAED,eAAO,MAAM,eAAe,8GAQzB,oBAAoB,gBA6PtB,CAAC"}
@@ -1 +1 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),n=e(r),i=require("react-i18next"),a=require("react-bootstrap"),o=require("react-hook-form"),l=e(require("@licklist/plugins/dist/services/Form/HookFormService")),c=e(require("clsx")),u=require("../../../tiptap-editor/TipTapEditor.js"),s=e(require("@licklist/plugins/dist/services/Media/MediaService")),d=require("../number-input-horizontal/NumberInputHorizontal.js");exports.CategoryProduct=function(e){var m=e.product,v=e.fieldIndex,f=e.productsWithErrors,p=e.isLoading,E=void 0!==p&&p,g=e.isEditMode,b=void 0!==g&&g,N=e.isProductSetAvailable,C=void 0!==N&&N,q=e.orderProducts,x=i.useTranslation(["Design","Validation"]).t,y=o.useFormContext(),S=y.control,h=y.clearErrors,k=y.setError,M=t.__read(r.useState(!1),2),_=M[0],I=M[1],T=m.images?s.getImageSrc(m.images):null,w=r.useMemo((function(){if(q){var e=q.find((function(e){return e.productId===m.id}));if(e)return e.quantity}}),[q,m.id]),O=function(){!b&&m.isSoldOut||E||I(!0)},z=r.useMemo((function(){if(f){var e=f.find((function(e){return e.product_id===m.id}));return null==e?void 0:e.message}}),[f,m.id]);r.useEffect((function(){z&&k("".concat(v,".quantity"),{message:z,type:"validate"})}),[z]);var F=function(e){var t=e.ref,r=e.onChange,i=e.value,a=e.invalid;return n.createElement(d.NumberInputHorizontal,{ref:t,onChange:function(e){r(e),h("".concat(v,".price"))},onMinusClick:function(){r(i-1||0),h("".concat(v,".price"))},onPlusClick:function(){r((null!=i?i:0)+1),h("".concat(v,".price"))},min:0,disabled:E||!b&&m.isSoldOut||!_,value:Number(i||0),className:c(a&&"error")})};return n.createElement(n.Fragment,null,n.createElement(o.Controller,{name:"".concat(v,".price"),control:S,render:function(e){var t=e.field,r=t.onChange,i=t.value,o=t.ref,c=e.fieldState,s=c.invalid,d=c.error;return n.createElement(n.Fragment,null,n.createElement("div",{className:"medium-accordition-description-container"},n.createElement(u.TipTapEditor,{viewMode:!0,disabled:!0,content:m.description,editorStyle:{backgroundColor:"transparent"}}),m.isSoldOut?n.createElement(F,{ref:o,onChange:r,value:i,invalid:s}):n.createElement(a.OverlayTrigger,{key:"status-tooltip",placement:"top",overlay:n.createElement(a.Tooltip,{id:"tooltip-right"},n.createElement("span",null,x("Sale:clickToEdit")))},n.createElement("div",{role:"button",tabIndex:0,onClick:O,onKeyDown:O},n.createElement(F,{ref:o,onChange:r,value:i,invalid:s})))),s&&n.createElement("div",{className:"d-flex mt-3 w-100"},n.createElement("p",{className:"iframe-event__message-error"},d&&l.hasError(d,"validate")&&(null==d?void 0:d.message))))}}),n.createElement(o.Controller,{control:S,name:"".concat(v,".quantity"),rules:{validate:function(e){if(!e)return!0;var t=m.maxAmount,r=void 0===t?0:t,n=m.isUnlimited,i=void 0!==n&&n;return void 0!==w&&b&&!C&&e>w?x("Validation:quantityMaxNumber",{max:w}):!!i||(!(e>r)||x("Validation:quantityMaxNumber",{max:m.maxAmount}))}},render:function(e){var t=e.field,r=t.onChange,i=t.value,a=t.ref,o=e.fieldState,u=o.invalid,s=o.error;return n.createElement("div",{className:"mb-8"},n.createElement("div",{className:"quantity-container"},n.createElement("div",{className:"number-input-horizontal-wrapper"},n.createElement(d.NumberInputHorizontal,{ref:a,size:"big",onChange:function(e){r(e)},onMinusClick:function(){r(i-1||0)},onPlusClick:function(){r((null!=i?i:0)+1)},min:0,disabled:E||!b&&!C||m.isSoldOut&&!b||b&&void 0===w&&!C,value:i||0,className:c(u&&"error")})),T&&n.createElement("div",{className:["image-wrapper",m.isSoldOut&&"opacity-50"].join(" ")},n.createElement("img",{src:T,alt:m.name}))),u&&n.createElement("div",{className:"d-flex mt-3 w-100"},n.createElement("p",{className:"iframe-event__message-error"},s&&l.hasError(s,"validate")&&(null==s?void 0:s.message))),!E&&!C&&n.createElement("div",{className:"d-flex mt-3 w-100"},n.createElement("p",{className:"iframe-event__message-error"},x("Design:productIsNotAvailableForSelectedDate"))))}}))};
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("tslib"),r=require("react"),i=e(r),n=require("react-i18next"),a=require("react-bootstrap"),o=require("react-hook-form"),l=e(require("@licklist/plugins/dist/services/Form/HookFormService")),c=e(require("clsx")),u=require("../../../tiptap-editor/TipTapEditor.js"),s=e(require("@licklist/plugins/dist/services/Media/MediaService")),d=require("../number-input-horizontal/NumberInputHorizontal.js");exports.CategoryProduct=function(e){var m=e.product,v=e.fieldIndex,f=e.productsWithErrors,p=e.isLoading,g=void 0!==p&&p,E=e.isEditMode,b=void 0!==E&&E,N=e.isProductSetAvailable,C=void 0!==N&&N,q=e.orderProducts,x=n.useTranslation(["Design","Validation"]).t,y=o.useFormContext(),S=y.control,h=y.clearErrors,k=y.setError,M=t.__read(r.useState(!1),2),_=M[0],I=M[1],T=m.images?s.getImageSrc(m.images):null,w=r.useMemo((function(){if(q){var e=q.find((function(e){return e.productId===m.id}));if(e)return e.quantity}}),[q,m.id]),O=function(){!b&&m.isSoldOut||g||I(!0)},z=r.useMemo((function(){if(f){var e=f.find((function(e){return e.product_id===m.id}));return null==e?void 0:e.message}}),[f,m.id]);r.useEffect((function(){z&&k("".concat(v,".quantity"),{message:z,type:"validate"})}),[z]);var F=function(e){var t=e.ref,r=e.onChange,n=e.value,a=e.invalid;return i.createElement(d.NumberInputHorizontal,{ref:t,onChange:function(e){r(e),h("".concat(v,".price"))},onMinusClick:function(){r(n-1||0),h("".concat(v,".price"))},onPlusClick:function(){r((null!=n?n:0)+1),h("".concat(v,".price"))},min:0,disabled:g||!b&&m.isSoldOut||!_,value:Number(n||0),className:c(a&&"error"),isLoading:g})};return i.createElement(i.Fragment,null,i.createElement(o.Controller,{name:"".concat(v,".price"),control:S,render:function(e){var t=e.field,r=t.onChange,n=t.value,o=t.ref,c=e.fieldState,s=c.invalid,d=c.error;return i.createElement(i.Fragment,null,i.createElement("div",{className:"medium-accordition-description-container"},i.createElement(u.TipTapEditor,{viewMode:!0,disabled:!0,content:m.description,editorStyle:{backgroundColor:"transparent"}}),m.isSoldOut?i.createElement(F,{ref:o,onChange:r,value:n,invalid:s}):i.createElement(a.OverlayTrigger,{key:"status-tooltip",placement:"top",overlay:i.createElement(a.Tooltip,{id:"tooltip-right"},i.createElement("span",null,x("Sale:clickToEdit")))},i.createElement("div",{role:"button",tabIndex:0,onClick:O,onKeyDown:O},i.createElement(F,{ref:o,onChange:r,value:n,invalid:s})))),s&&i.createElement("div",{className:"d-flex mt-3 w-100"},i.createElement("p",{className:"iframe-event__message-error"},d&&l.hasError(d,"validate")&&(null==d?void 0:d.message))))}}),i.createElement(o.Controller,{control:S,name:"".concat(v,".quantity"),rules:{validate:function(e){if(!e)return!0;var t=m.maxAmount,r=void 0===t?0:t,i=m.isUnlimited,n=void 0!==i&&i;if(void 0!==w&&b){if(n&&C)return!0;if(!C&&e>w)return x("Validation:quantityMaxNumber",{max:w})}return!!n||(!(e>r)||x("Validation:quantityMaxNumber",{max:m.maxAmount}))}},render:function(e){var t=e.field,r=t.onChange,n=t.value,a=t.ref,o=e.fieldState,u=o.invalid,s=o.error;return i.createElement("div",{className:"mb-8"},i.createElement("div",{className:"quantity-container"},i.createElement("div",{className:"number-input-horizontal-wrapper"},i.createElement(d.NumberInputHorizontal,{ref:a,size:"big",onChange:function(e){r(e)},onMinusClick:function(){r(n-1||0)},onPlusClick:function(){r((null!=n?n:0)+1)},min:0,disabled:g||!b&&!C||m.isSoldOut&&!b||b&&void 0===w&&!C,value:n||0,className:c(u&&"error"),isLoading:g})),T&&i.createElement("div",{className:["image-wrapper",m.isSoldOut&&"opacity-50"].join(" ")},i.createElement("img",{src:T,alt:m.name}))),u&&i.createElement("div",{className:"d-flex mt-3 w-100"},i.createElement("p",{className:"iframe-event__message-error"},s&&l.hasError(s,"validate")&&(null==s?void 0:s.message))),!g&&!C&&i.createElement("div",{className:"d-flex mt-3 w-100"},i.createElement("p",{className:"iframe-event__message-error"},x("Design:productIsNotAvailableForSelectedDate"))))}}))};
@@ -11,6 +11,7 @@ interface NumberInputHorizontalProps {
11
11
  max?: number;
12
12
  size?: Sizes;
13
13
  defaultValue?: number;
14
+ isLoading?: boolean;
14
15
  }
15
16
  export declare const NumberInputHorizontal: React.ForwardRefExoticComponent<NumberInputHorizontalProps & React.RefAttributes<HTMLInputElement>>;
16
17
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInputHorizontal.d.ts","sourceRoot":"","sources":["../../../../src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,aAAK,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC;AAE7B,UAAU,0BAA0B;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,qBAAqB,qGAqGjC,CAAC"}
1
+ {"version":3,"file":"NumberInputHorizontal.d.ts","sourceRoot":"","sources":["../../../../src/sales/manual-booking/number-input-horizontal/NumberInputHorizontal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,aAAK,KAAK,GAAG,KAAK,GAAG,OAAO,CAAC;AAE7B,UAAU,0BAA0B;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,qBAAqB,qGAsGjC,CAAC"}
@@ -1 +1 @@
1
- "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),i=e(t),n=require("react-i18next"),a=require("react-bootstrap"),l=require("../../../static/Icon.js"),s=e(require("clsx"));require("../../../static/index.js");var r=t.forwardRef((function(e,t){var r=e.disabled,o=void 0!==r&&r,u=e.className,c=void 0===u?"":u,m=e.value,d=e.size,b=void 0===d?"small":d,p=e.onChange,f=e.onPlusClick,v=e.onMinusClick,N=e.min,z=e.max,g=e.defaultValue,_=(0,n.useTranslation(["Sale"]).t)("Sale:soldOut"),x="big"===b,y=s(c,"licklist-number-input-horizontal");return i.createElement("div",{className:y},i.createElement("button",{type:"button",onClick:function(){void 0!==N&&m>N&&v(m-1),void 0===N&&v(m-1)},className:["licklist-number-input-horizontal__btn-minus",x?"big-sizes-btn":"small-sizes-btn"].join(" "),disabled:o},i.createElement(l.default,{type:"minus",className:x?"big_icon":"small_icon"})),i.createElement("div",{className:["position-relative d-flex",o&&x&&"w-100"].join(" ")},"small"===b&&i.createElement("div",{className:"currency"},"£"),i.createElement(a.FormControl,{ref:t,onClick:function(e){return e.target.select()},type:o&&x?"text":"number",className:x?"big-sizes-input":"small-sizes-input",onChange:function(e){return p(Number(e.target.value))},value:o&&x?_:m,min:N,max:z,defaultValue:g,disabled:o})),i.createElement("button",{type:"button",onClick:function(){void 0!==z&&m<z&&f(m+1),void 0===z&&f(m+1)},className:["licklist-number-input-horizontal__btn-plus",x?"big-sizes-btn":"small-sizes-btn"].join(" "),disabled:o},i.createElement(l.default,{type:"plus",className:x?"big_icon":"small_icon"})))}));r.displayName="NumberInputHorizontal",exports.NumberInputHorizontal=r;
1
+ "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),i=e(t),n=require("react-i18next"),a=require("react-bootstrap"),l=require("../../../static/Icon.js"),s=e(require("clsx"));require("../../../static/index.js");var r=t.forwardRef((function(e,t){var r=e.disabled,o=void 0!==r&&r,u=e.className,c=void 0===u?"":u,m=e.value,d=e.size,b=void 0===d?"small":d,p=e.onChange,v=e.onPlusClick,f=e.onMinusClick,N=e.min,z=e.max,g=e.defaultValue,_=e.isLoading,x=void 0!==_&&_,y=(0,n.useTranslation(["Sale"]).t)("Sale:soldOut"),k="big"===b,C=s(c,"licklist-number-input-horizontal");return i.createElement("div",{className:C},i.createElement("button",{type:"button",onClick:function(){void 0!==N&&m>N&&f(m-1),void 0===N&&f(m-1)},className:["licklist-number-input-horizontal__btn-minus",k?"big-sizes-btn":"small-sizes-btn"].join(" "),disabled:o},i.createElement(l.default,{type:"minus",className:k?"big_icon":"small_icon"})),i.createElement("div",{className:["position-relative d-flex",o&&k&&"w-100"].join(" ")},"small"===b&&i.createElement("div",{className:"currency"},"£"),i.createElement(a.FormControl,{ref:t,onClick:function(e){return e.target.select()},type:o&&k?"text":"number",className:k?"big-sizes-input":"small-sizes-input",onChange:function(e){return p(Number(e.target.value))},value:o&&k&&!x?y:m,min:N,max:z,defaultValue:g,disabled:o})),i.createElement("button",{type:"button",onClick:function(){void 0!==z&&m<z&&v(m+1),void 0===z&&v(m+1)},className:["licklist-number-input-horizontal__btn-plus",k?"big-sizes-btn":"small-sizes-btn"].join(" "),disabled:o},i.createElement(l.default,{type:"plus",className:k?"big_icon":"small_icon"})))}));r.displayName="NumberInputHorizontal",exports.NumberInputHorizontal=r;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.44.462",
3
+ "version": "0.44.463",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -105,6 +105,7 @@ export const CategoryProduct = ({
105
105
  }
106
106
  value={Number(value || 0)}
107
107
  className={clsx(invalid && "error")}
108
+ isLoading={isLoading}
108
109
  />
109
110
  );
110
111
 
@@ -187,15 +188,16 @@ export const CategoryProduct = ({
187
188
  // available by current date we should check on
188
189
  // max amount which equals orderProduct.quantity
189
190
  // We should check this before all next validations
190
- if (
191
- currentProductMaxValue !== undefined &&
192
- isEditMode &&
193
- !isProductSetAvailable &&
194
- value > currentProductMaxValue
195
- ) {
196
- return t("Validation:quantityMaxNumber", {
197
- max: currentProductMaxValue,
198
- }) as string;
191
+ if (currentProductMaxValue !== undefined && isEditMode) {
192
+ if (isUnlimited && isProductSetAvailable) {
193
+ return true;
194
+ }
195
+
196
+ if (!isProductSetAvailable && value > currentProductMaxValue) {
197
+ return t("Validation:quantityMaxNumber", {
198
+ max: currentProductMaxValue,
199
+ }) as string;
200
+ }
199
201
  }
200
202
 
201
203
  if (isUnlimited) {
@@ -242,6 +244,7 @@ export const CategoryProduct = ({
242
244
  }
243
245
  value={value || 0}
244
246
  className={clsx(invalid && "error")}
247
+ isLoading={isLoading}
245
248
  />
246
249
  </div>
247
250
  {imageSrc && (
@@ -17,6 +17,7 @@ interface NumberInputHorizontalProps {
17
17
  max?: number;
18
18
  size?: Sizes;
19
19
  defaultValue?: number;
20
+ isLoading?: boolean;
20
21
  }
21
22
 
22
23
  export const NumberInputHorizontal = forwardRef<
@@ -35,6 +36,7 @@ export const NumberInputHorizontal = forwardRef<
35
36
  min,
36
37
  max,
37
38
  defaultValue,
39
+ isLoading = false,
38
40
  },
39
41
  ref
40
42
  ) => {
@@ -96,7 +98,7 @@ export const NumberInputHorizontal = forwardRef<
96
98
  type={disabled && hasBigSize ? "text" : "number"}
97
99
  className={hasBigSize ? "big-sizes-input" : "small-sizes-input"}
98
100
  onChange={(e) => onChange(Number(e.target.value))}
99
- value={disabled && hasBigSize ? soldOut : value}
101
+ value={disabled && hasBigSize && !isLoading ? soldOut : value}
100
102
  min={min}
101
103
  max={max}
102
104
  defaultValue={defaultValue}