@licklist/design 0.44.485-dev.68 → 0.44.485-dev.70
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/product-set/product/quantity/ProductQuantityRechargingControl.d.ts.map +1 -1
- package/dist/product-set/product/quantity/ProductQuantityRechargingControl.js +1 -1
- package/dist/provider/provider-details-input/ProviderDetailsInput.d.ts.map +1 -1
- package/dist/provider/provider-details-input/ProviderDetailsInput.js +1 -1
- package/dist/typeahead/Typeahead.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/product-set/product/quantity/ProductQuantityRechargingControl.tsx +3 -1
- package/src/provider/provider-details-input/ProviderDetailsInput.tsx +0 -8
- package/src/typeahead/Typeahead.tsx +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProductQuantityRechargingControl.d.ts","sourceRoot":"","sources":["../../../../src/product-set/product/quantity/ProductQuantityRechargingControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAStE,MAAM,WAAW,sCAAuC,SAAQ,UAAU;IACxE,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qCAAqC,CAAC,CAAC,CACtD,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,UAAU,EACnE,KAAK,EAAE,qCAAqC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"ProductQuantityRechargingControl.d.ts","sourceRoot":"","sources":["../../../../src/product-set/product/quantity/ProductQuantityRechargingControl.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,mBAAmB,EACnB,UAAU,EACX,MAAM,8DAA8D,CAAC;AAStE,MAAM,WAAW,sCAAuC,SAAQ,UAAU;IACxE,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qCAAqC,CAAC,CAAC,CACtD,SAAQ,mBAAmB,CAAC,CAAC,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,cAAc,KAAK,IAAI,CAAC;CAC7C;AAED,wBAAgB,gCAAgC,CAAC,CAAC,SAAS,UAAU,EACnE,KAAK,EAAE,qCAAqC,CAAC,CAAC,CAAC,eAkGhD"}
|
|
@@ -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"),a=e(r),n=require("react-i18next"),
|
|
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"),a=e(r),n=require("react-i18next"),i=require("react-bootstrap"),o=require("react-hook-form"),l=e(require("@licklist/plugins/dist/services/Form/HookFormService")),u=require("@react-aria/utils"),c=require("../../../assets/dashboard/increment.svg.js"),s=e(require("react-bootstrap/InputGroup"));exports.ProductQuantityRechargingControl=function(e){var m=e.isLoading,d=void 0!==m&&m,f=e.fieldNamePrefix,b=e.disabled,p=void 0!==b&&b,v=e.onFocus,y=o.useFormContext(),g=y.control,E=y.trigger,F=y.watch,Q=y.register,q=y.formState.errors,x=n.useTranslation("Design").t,C=u.useId(),h=F("".concat(f,".maxQuantity")),N=F("".concat(f,".isUnlimited"));return r.useEffect((function(){E("".concat(f,".totalQuantity"))}),[h,N]),a.createElement(a.Fragment,null,a.createElement(i.Form.Group,{controlId:C},a.createElement(i.Form.Label,null,x("totalQuantity")),a.createElement(s,{hasValidation:!0},a.createElement(s.Prepend,null,a.createElement(s.Text,{className:"py-0 px-3"},a.createElement(c.ReactComponent,null))),a.createElement(o.Controller,{render:function(e){var r=e.field,n=r.value,o=r.onChange,u=r.ref;return a.createElement(i.Form.Control,t.__assign({ref:u,type:"number",min:0,step:1},Q("".concat(f,".totalQuantity"),{validate:function(e){if(N)return!0;var t=Number(h),r=Number(e);return r<1?x("Validation:fieldMinNumber",{attribute:x("totalQuantity"),min:1}):!(r<t)||x("Validation:fieldTotalNumber",{attribute:x("totalQuantity"),max:x("maxOrderQuantity")})}}),{value:n,onFocus:v,onChange:o,isInvalid:l.isInvalid("".concat(f,".totalQuantity"),q),disabled:d||p}))},control:g,name:"".concat(f,".totalQuantity"),rules:p?{required:!1,min:0}:{}}),a.createElement(i.Form.Control.Feedback,{type:"invalid"},l.getErrors("".concat(f,".totalQuantity"),q)))))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProviderDetailsInput.d.ts","sourceRoot":"","sources":["../../../src/provider/provider-details-input/ProviderDetailsInput.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ProviderDetailsInput.d.ts","sourceRoot":"","sources":["../../../src/provider/provider-details-input/ProviderDetailsInput.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,KAAK,EAAE,MAAM,sDAAsD,CAAC;AAE7E,OAAO,EAAa,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EAEL,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;CACxB,GAAG,wBAAwB,CAAC;AAE7B,MAAM,MAAM,yBAAyB,GAAG;IACtC,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACtC,SAAS,CAAC,EAAE,uBAAuB,CAAC,WAAW,CAAC,CAAC;CAClD,CAAC;AAEF,wBAAgB,oBAAoB,CAAC,EACnC,gBAAqB,EACrB,SAAc,GACf,EAAE,yBAAyB,eAwJ3B"}
|
|
@@ -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 r=require("tslib"),t=require("react"),i=e(t),n=require("react-i18next"),a=
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("tslib"),t=require("react"),i=e(t),n=require("react-i18next"),a=require("react-bootstrap"),o=require("react-hook-form"),l=e(require("@licklist/plugins/dist/services/Form/HookFormService")),s=require("@react-aria/utils"),d=require("../../typeahead/Typeahead.js"),m=require("../constants.js"),u=require("../provider-links-input/ProviderLinksInput.js");exports.ProviderDetailsInput=function(e){var c,p,E,v,g,F,b=e.companiesOptions,I=void 0===b?[]:b,h=e.linkTypes,C=void 0===h?[]:h,_=o.useFormContext(),q=_.register,y=_.watch,f=_.trigger,D=_.formState.errors,T=n.useTranslation(["App","Design","Validation"]).t,k=s.useId(),A=s.useId(),R=s.useId(),S=s.useId(),L=s.useId(),M=s.useId(),w=y("description");return t.useEffect((function(){m.MAX_DESCRIPTION_CHARACTERS_LENGTH>w.length||f("description")}),[w.length]),i.createElement(i.Fragment,null,i.createElement(a.Form.Group,{controlId:k},i.createElement(a.Form.Label,null,T("Design:name")),i.createElement(a.Form.Control,r.__assign({},q("name",{required:T("Validation:fieldRequired",{attribute:T("Design:name")})}),{name:"name",required:!0,isInvalid:Boolean(D.name)})),i.createElement(a.Form.Control.Feedback,{type:"invalid"},l.hasError(D.name,"required")&&(null===(c=D.name)||void 0===c?void 0:c.message))),i.createElement(a.Form.Group,{controlId:A},i.createElement(a.Form.Label,null,T("Design:description")),i.createElement(a.Form.Control,r.__assign({},q("description",{validate:function(e){return!(e.length>m.MAX_DESCRIPTION_CHARACTERS_LENGTH)||T("Validation:descriptionTooManyCharactersMessage",{max:m.MAX_DESCRIPTION_CHARACTERS_LENGTH})}}),{as:"textarea",name:"description",rows:6,isInvalid:Boolean(D.description)})),i.createElement(a.Form.Control.Feedback,{type:"invalid"},l.hasError(D.description,"validate")&&(null===(p=D.description)||void 0===p?void 0:p.message))),i.createElement(a.Form.Group,{controlId:R},i.createElement(a.Form.Label,null,T("Design:email")),i.createElement(a.Form.Control,r.__assign({},q("email",{required:T("Validation:fieldRequired",{attribute:T("Design:email")}),pattern:{value:/^\S+@\S+$/,message:T("Validation:fieldValidEmail",{attribute:T("Design:email")})}}),{name:"email",type:"email",inputMode:"email",isInvalid:Boolean(D.email)})),i.createElement(a.Form.Control.Feedback,{type:"invalid"},l.hasError(D.email,"required")&&(null===(E=D.email)||void 0===E?void 0:E.message),l.hasError(D.email,"pattern")&&(null===(v=D.email)||void 0===v?void 0:v.message))),i.createElement(a.Form.Group,{controlId:S},i.createElement(a.Form.Label,null,T("Design:phone")),i.createElement(a.Form.Control,r.__assign({},q("phone",{required:T("Validation:fieldRequired",{attribute:T("Design:phone")})}),{name:"phone",type:"tel",inputMode:"tel",isInvalid:Boolean(D.phone)})),i.createElement(a.Form.Control.Feedback,{type:"invalid"},l.hasError(D.phone,"required")&&(null===(g=D.phone)||void 0===g?void 0:g.message))),i.createElement(a.Form.Group,{controlId:L},i.createElement(a.Form.Label,null,T("Design:website")),i.createElement(a.Form.Control,r.__assign({},q("website",{pattern:{value:/\S+\.\S+/,message:T("Validation:fieldInvalid",{attribute:T("Design:website")})}}),{name:"website",type:"url",inputMode:"url",isInvalid:Boolean(D.website)})),i.createElement(a.Form.Control.Feedback,{type:"invalid"},l.hasError(D.website,"pattern")&&(null===(F=D.website)||void 0===F?void 0:F.message))),I.length>1&&i.createElement(a.Form.Group,{controlId:M},i.createElement(a.Form.Label,null,T("Design:company")),i.createElement(d.Typeahead,{name:"company",options:I,placeholder:T("App:select"),noOptionsMessage:T("App:noMatchesFound")})),C.length>0&&i.createElement(u.ProviderLinksInput,{linkTypes:C}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typeahead.d.ts","sourceRoot":"","sources":["../../src/typeahead/Typeahead.tsx"],"names":[],"mappings":";AAIA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,iBAAS,SAAS,CAAC,EACjB,OAAO,EACP,WAAW,EACX,UAAkB,EAClB,gBAAgB,EAChB,IAAS,EACT,gBAAqB,EACrB,SAAS,GACV,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"Typeahead.d.ts","sourceRoot":"","sources":["../../src/typeahead/Typeahead.tsx"],"names":[],"mappings":";AAIA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,iBAAS,SAAS,CAAC,EACjB,OAAO,EACP,WAAW,EACX,UAAkB,EAClB,gBAAgB,EAChB,IAAS,EACT,gBAAqB,EACrB,SAAS,GACV,EAAE,cAAc,eAiChB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -43,11 +43,12 @@ export function ProductQuantityRechargingControl<T extends FormValues>(
|
|
|
43
43
|
const totalQuantityId = useId();
|
|
44
44
|
|
|
45
45
|
const maxQuantityValue = watch(`${fieldNamePrefix}.maxQuantity` as Path<T>);
|
|
46
|
+
const unlimited = watch(`${fieldNamePrefix}.isUnlimited` as Path<T>);
|
|
46
47
|
|
|
47
48
|
useEffect(() => {
|
|
48
49
|
trigger(`${fieldNamePrefix}.totalQuantity` as Path<T>);
|
|
49
50
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
|
-
}, [maxQuantityValue]);
|
|
51
|
+
}, [maxQuantityValue, unlimited]);
|
|
51
52
|
|
|
52
53
|
return (
|
|
53
54
|
<>
|
|
@@ -70,6 +71,7 @@ export function ProductQuantityRechargingControl<T extends FormValues>(
|
|
|
70
71
|
step={1}
|
|
71
72
|
{...register(`${fieldNamePrefix}.totalQuantity` as Path<T>, {
|
|
72
73
|
validate: (value) => {
|
|
74
|
+
if (unlimited) return true;
|
|
73
75
|
const min = 1;
|
|
74
76
|
const maxQuantity = Number(maxQuantityValue);
|
|
75
77
|
const totalQuantity = Number(value);
|
|
@@ -3,7 +3,6 @@ import { Form } from "react-bootstrap";
|
|
|
3
3
|
import { useFormContext } from "react-hook-form";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import { useId } from "@react-aria/utils";
|
|
6
|
-
import useNotification from "@licklist/plugins/dist/context/app/hooks/useNotification";
|
|
7
6
|
import { Image } from "@licklist/core/dist/DataMapper/Media/ImageDataMapper";
|
|
8
7
|
import HookFormService from "@licklist/plugins/dist/services/Form/HookFormService";
|
|
9
8
|
import { Typeahead, TypeaheadOptions } from "../../typeahead";
|
|
@@ -40,7 +39,6 @@ export function ProviderDetailsInput({
|
|
|
40
39
|
formState: { errors },
|
|
41
40
|
} = useFormContext<ProviderDetailsInputValues>();
|
|
42
41
|
const { t } = useTranslation(["App", "Design", "Validation"]);
|
|
43
|
-
const notification = useNotification();
|
|
44
42
|
|
|
45
43
|
const nameId = useId();
|
|
46
44
|
const descriptionId = useId();
|
|
@@ -54,12 +52,6 @@ export function ProviderDetailsInput({
|
|
|
54
52
|
useEffect(() => {
|
|
55
53
|
if (MAX_DESCRIPTION_CHARACTERS_LENGTH > description.length) return;
|
|
56
54
|
trigger("description");
|
|
57
|
-
notification.danger({
|
|
58
|
-
title: t("App:warning"),
|
|
59
|
-
message: t("Validation:descriptionTooManyCharactersMessage", {
|
|
60
|
-
max: MAX_DESCRIPTION_CHARACTERS_LENGTH,
|
|
61
|
-
}) as string,
|
|
62
|
-
});
|
|
63
55
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
56
|
}, [description.length]);
|
|
65
57
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import Select from "react-select";
|
|
2
|
+
import Select, { CSSObjectWithLabel } from "react-select";
|
|
3
3
|
import { Controller, useFormContext } from "react-hook-form";
|
|
4
4
|
|
|
5
5
|
export type TypeaheadOptions = {
|
|
@@ -29,7 +29,8 @@ function Typeahead({
|
|
|
29
29
|
}: TypeaheadProps) {
|
|
30
30
|
const { control } = useFormContext();
|
|
31
31
|
|
|
32
|
-
const getErrorStyle = ()
|
|
32
|
+
const getErrorStyle = (): CSSObjectWithLabel =>
|
|
33
|
+
isInvalid ? { borderColor: "red" } : {};
|
|
33
34
|
|
|
34
35
|
return (
|
|
35
36
|
<>
|