@licklist/design 0.58.4 → 0.58.5
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/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.js +1 -1
- package/package.json +1 -1
- package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +30 -10
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +8 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAI1C,UAAU,gBAAgB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAI1C,UAAU,gBAAgB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,2FAgGvB,CAAC"}
|
package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js
CHANGED
|
@@ -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"),n=e(t),a=require("react-bootstrap"),r=e(require("clsx")),u=t.forwardRef((function(e,t){var u=e.className,o=void 0===u?"":u,
|
|
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"),n=e(t),a=require("react-bootstrap"),r=e(require("clsx")),u=t.forwardRef((function(e,t){var u=e.className,o=void 0===u?"":u,l=e.value,i=e.onChange,c=e.onArrowDown,m=e.onArrowUp,b=e.min,d=e.max,p=e.placeholder,s=e.defaultValue,f=e.disabled,v=!l,y=d>0&&l===d,N=r("payment-number-input",o);return n.createElement("div",{className:N},n.createElement("button",{type:"button",onClick:function(){l&&(b>0&&(l||0)===b?c(0):m(l-1))},className:"payment-number-input__btn-down ".concat(v&&"disabled-number-input-button"),disabled:f},"−"),n.createElement(a.FormControl,{type:"number",onChange:function(e){return t=Number(e.target.value),void i(d>0&&t>d?d:b>0&&t&&t<b?b:t);var t},value:l,min:b,max:d,defaultValue:s,placeholder:p,height:"5rem",disabled:f,ref:t}),n.createElement("button",{type:"button",onClick:function(){d>0&&l===d||m(b>0&&(l||0)<b?b:(l||0)+1)},className:"payment-number-input__btn-up ".concat(y&&"disabled-number-input-button"),disabled:f},"+"))}));u.displayName="NumberInput",exports.NumberInput=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductQuantityInput.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAC9E,OAAO,EACL,OAAO,EACP,eAAe,EAChB,MAAM,qDAAqD,CAAC;AAG7D,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,UAAU,yBAAyB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,aAAa,CAAC;CAC5B;AAED,eAAO,MAAM,oBAAoB,gGAQ9B,yBAAyB,
|
|
1
|
+
{"version":3,"file":"ProductQuantityInput.d.ts","sourceRoot":"","sources":["../../../../../../src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,wDAAwD,CAAC;AAC9E,OAAO,EACL,OAAO,EACP,eAAe,EAChB,MAAM,qDAAqD,CAAC;AAG7D,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,UAAU,yBAAyB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,aAAa,CAAC;CAC5B;AAED,eAAO,MAAM,oBAAoB,gGAQ9B,yBAAyB,gBAkE3B,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=e(require("react")),n=require("react-i18next"),o=require("react-bootstrap"),i=e(require("clsx")),
|
|
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=e(require("react")),n=require("react-i18next"),o=require("react-bootstrap"),i=e(require("clsx")),r=require("../NumberInput/NumberInput.js");exports.ProductQuantityInput=function(e){var u=e.product,a=e.category,l=e.onChange,c=e.clearErrors,d=e.refCallback,s=e.productInfo,p=e.invalid,m=n.useTranslation("Design").t,v=function(e){var t;l({id:u.id,name:u.name,deposit:null==u?void 0:u.deposit,hasDeposit:a.allowDeposits&&(null==u?void 0:u.deposit)<u.price,price:u.price,productCategoryId:a.id,zoneId:null===(t=a.zone)||void 0===t?void 0:t.id,quantity:e,capacity:null==u?void 0:u.capacity})};return u.isSoldOut?t.createElement("div",{className:"iframe-event__sold-out-wrapper"},m("Design:soldOut")):1===(null==u?void 0:u.maxAmount)?t.createElement(o.Button,{ref:d,disabled:u.isSoldOut,className:i("iframe-event__".concat((null==s?void 0:s.quantity)?"unselect-product":"select-product"),p&&"error"),onClick:function(){return v((null==s?void 0:s.quantity)?0:1)}},m("Design:".concat((null==s?void 0:s.quantity)?"unselect":"select"))):t.createElement(r.NumberInput,{ref:d,onChange:function(e){v(e),c("".concat(u.id))},onArrowDown:function(e){v(e||0),c("".concat(u.id))},onArrowUp:function(e){v(e||0),c("".concat(u.id))},min:(null==u?void 0:u.minAmount)?Number(u.minAmount):0,max:(null==u?void 0:u.maxAmount)?Number(u.maxAmount):void 0,placeholder:"0",disabled:u.isSoldOut,value:null==s?void 0:s.quantity,className:i(p&&"error")})};
|
package/package.json
CHANGED
package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx
CHANGED
|
@@ -32,24 +32,44 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
|
|
|
32
32
|
ref
|
|
33
33
|
) => {
|
|
34
34
|
const minusButtonGreyedOut = !value;
|
|
35
|
-
const plusButtonGreyedOut = max
|
|
35
|
+
const plusButtonGreyedOut = max > 0 && value === max;
|
|
36
|
+
|
|
37
|
+
const handleChangeValue = (val: number) => {
|
|
38
|
+
if (max > 0 && val > max) {
|
|
39
|
+
onChange(max);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (min > 0 && val && val < min) {
|
|
44
|
+
onChange(min);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
onChange(val);
|
|
48
|
+
};
|
|
36
49
|
|
|
37
50
|
const handleArrowUpClick = () => {
|
|
38
|
-
if (max
|
|
39
|
-
|
|
51
|
+
if (max > 0 && value === max) {
|
|
52
|
+
return;
|
|
40
53
|
}
|
|
41
|
-
|
|
42
|
-
|
|
54
|
+
|
|
55
|
+
if (min > 0 && (value || 0) < min) {
|
|
56
|
+
onArrowUp(min);
|
|
57
|
+
return;
|
|
43
58
|
}
|
|
59
|
+
|
|
60
|
+
onArrowUp((value || 0) + 1);
|
|
44
61
|
};
|
|
45
62
|
|
|
46
63
|
const handleArrowDownClick = () => {
|
|
47
|
-
if (
|
|
48
|
-
|
|
64
|
+
if (!value) {
|
|
65
|
+
return;
|
|
49
66
|
}
|
|
50
|
-
if (min ===
|
|
51
|
-
|
|
67
|
+
if (min > 0 && (value || 0) === min) {
|
|
68
|
+
onArrowDown(0);
|
|
69
|
+
return;
|
|
52
70
|
}
|
|
71
|
+
|
|
72
|
+
onArrowUp(value - 1);
|
|
53
73
|
};
|
|
54
74
|
|
|
55
75
|
const inputWrapperClasses = clsx("payment-number-input", className);
|
|
@@ -68,7 +88,7 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
|
|
|
68
88
|
</button>
|
|
69
89
|
<FormControl
|
|
70
90
|
type="number"
|
|
71
|
-
onChange={(e) =>
|
|
91
|
+
onChange={(e) => handleChangeValue(Number(e.target.value))}
|
|
72
92
|
value={value}
|
|
73
93
|
min={min}
|
|
74
94
|
max={max}
|
|
@@ -45,10 +45,6 @@ export const ProductQuantityInput = ({
|
|
|
45
45
|
const { t } = useTranslation("Design");
|
|
46
46
|
|
|
47
47
|
const onChange = (quantity: number | null) => {
|
|
48
|
-
let productQuantity = quantity;
|
|
49
|
-
if (product?.maxAmount && quantity > product?.maxAmount) {
|
|
50
|
-
productQuantity = product?.maxAmount;
|
|
51
|
-
}
|
|
52
48
|
_onChange({
|
|
53
49
|
id: product.id,
|
|
54
50
|
name: product.name,
|
|
@@ -57,7 +53,7 @@ export const ProductQuantityInput = ({
|
|
|
57
53
|
price: product.price,
|
|
58
54
|
productCategoryId: category.id,
|
|
59
55
|
zoneId: category.zone?.id,
|
|
60
|
-
quantity
|
|
56
|
+
quantity,
|
|
61
57
|
capacity: product?.capacity,
|
|
62
58
|
});
|
|
63
59
|
};
|
|
@@ -92,19 +88,19 @@ export const ProductQuantityInput = ({
|
|
|
92
88
|
<NumberInput
|
|
93
89
|
ref={refCallback}
|
|
94
90
|
onChange={(val) => {
|
|
95
|
-
onChange(val
|
|
91
|
+
onChange(val);
|
|
96
92
|
clearErrors(`${product.id}` as const);
|
|
97
93
|
}}
|
|
98
|
-
onArrowDown={() => {
|
|
99
|
-
onChange(
|
|
94
|
+
onArrowDown={(val) => {
|
|
95
|
+
onChange(val || 0);
|
|
100
96
|
clearErrors(`${product.id}` as const);
|
|
101
97
|
}}
|
|
102
|
-
onArrowUp={() => {
|
|
103
|
-
onChange(
|
|
98
|
+
onArrowUp={(val) => {
|
|
99
|
+
onChange(val || 0);
|
|
104
100
|
clearErrors(`${product.id}` as const);
|
|
105
101
|
}}
|
|
106
|
-
min={0}
|
|
107
|
-
max={product?.maxAmount ? Number(product
|
|
102
|
+
min={product?.minAmount ? Number(product.minAmount) : 0}
|
|
103
|
+
max={product?.maxAmount ? Number(product.maxAmount) : undefined}
|
|
108
104
|
placeholder="0"
|
|
109
105
|
disabled={product.isSoldOut}
|
|
110
106
|
value={productInfo?.quantity}
|