@licklist/design 0.58.3-dev.1 → 0.58.3-dev.3
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/dist/styles/iframe-page/PageBody.scss +1 -1
- package/package.json +1 -1
- package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +22 -1
- package/src/iframe/order-process/components/CategoryProduct/components/ProductQuantityInput/ProductQuantityInput.tsx +8 -12
- package/src/styles/iframe-page/PageBody.scss +1 -1
|
@@ -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,2FAiGvB,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,i=e.value,l=e.onChange,d=e.onArrowDown,c=e.onArrowUp,m=e.min,b=e.max,p=e.placeholder,s=e.defaultValue,
|
|
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,i=e.value,l=e.onChange,d=e.onArrowDown,c=e.onArrowUp,m=e.min,b=e.max,p=e.placeholder,s=e.defaultValue,v=e.disabled,f=!i,y=void 0!==b&&i===b,N=r("payment-number-input",o);return n.createElement("div",{className:N},n.createElement("button",{type:"button",onClick:function(){m>0&&(i||0)-1<m?d(0):(void 0!==m&&i>m&&d(i-1),void 0===m&&c(i-1))},className:"payment-number-input__btn-down ".concat(f&&"disabled-number-input-button"),disabled:v},"−"),n.createElement(a.FormControl,{type:"number",onChange:function(e){return t=Number(e.target.value),void l(void 0!==b&&t>b?b:m>0&&t&&t<m?m:t);var t},value:i,min:m,max:b,defaultValue:s,placeholder:p,height:"5rem",disabled:v,ref:t}),n.createElement("button",{type:"button",onClick:function(){m>0&&(i||0)<m?c(m):(void 0!==b&&(i||0)<b&&c(i+1),void 0===b&&c(i+1))},className:"payment-number-input__btn-up ".concat(y&&"disabled-number-input-button"),disabled:v},"+"))}));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
|
@@ -34,7 +34,24 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
|
|
|
34
34
|
const minusButtonGreyedOut = !value;
|
|
35
35
|
const plusButtonGreyedOut = max !== undefined && value === max;
|
|
36
36
|
|
|
37
|
+
const handleChangeValue = (val: number) => {
|
|
38
|
+
if (max !== undefined && 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
|
+
};
|
|
49
|
+
|
|
37
50
|
const handleArrowUpClick = () => {
|
|
51
|
+
if (min > 0 && (value || 0) < min) {
|
|
52
|
+
onArrowUp(min);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
38
55
|
if (max !== undefined && (value || 0) < max) {
|
|
39
56
|
onArrowUp(value + 1);
|
|
40
57
|
}
|
|
@@ -44,6 +61,10 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
|
|
|
44
61
|
};
|
|
45
62
|
|
|
46
63
|
const handleArrowDownClick = () => {
|
|
64
|
+
if (min > 0 && (value || 0) - 1 < min) {
|
|
65
|
+
onArrowDown(0);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
47
68
|
if (min !== undefined && value > min) {
|
|
48
69
|
onArrowDown(value - 1);
|
|
49
70
|
}
|
|
@@ -68,7 +89,7 @@ export const NumberInput = forwardRef<HTMLInputElement, NumberInputProps>(
|
|
|
68
89
|
</button>
|
|
69
90
|
<FormControl
|
|
70
91
|
type="number"
|
|
71
|
-
onChange={(e) =>
|
|
92
|
+
onChange={(e) => handleChangeValue(Number(e.target.value))}
|
|
72
93
|
value={value}
|
|
73
94
|
min={min}
|
|
74
95
|
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}
|