@licklist/design 0.44.486-dev.20 → 0.44.486-dev.21

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":"RecurrenceIntervalAndFrequencyInput.d.ts","sourceRoot":"","sources":["../../src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,eAAe,EAAkB,MAAM,iBAAiB,CAAC;AAIlE,UAAU,wCAAwC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,IAAI,CACnB,eAAe,EACf,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CACpD,CAAC;IACF,YAAY,CAAC,EAAE,IAAI,CACjB,eAAe,EACf,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CACpD,CAAC;CACH;AAED,iBAAS,mCAAmC,CAAC,EAC3C,QAAgB,EAChB,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,GACb,EAAE,wCAAwC,eA0J1C;AAED,eAAe,mCAAmC,CAAC"}
1
+ {"version":3,"file":"RecurrenceIntervalAndFrequencyInput.d.ts","sourceRoot":"","sources":["../../src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,eAAe,EAAkB,MAAM,iBAAiB,CAAC;AAIlE,UAAU,wCAAwC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,IAAI,CACnB,eAAe,EACf,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CACpD,CAAC;IACF,YAAY,CAAC,EAAE,IAAI,CACjB,eAAe,EACf,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CACpD,CAAC;CACH;AAED,iBAAS,mCAAmC,CAAC,EAC3C,QAAgB,EAChB,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,GACb,EAAE,wCAAwC,eAmJ1C;AAED,eAAe,mCAAmC,CAAC"}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),a=require("react"),l=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,n=require("@licklist/core/dist/Config"),r=require("react-i18next"),i=require("react-bootstrap"),o=require("react-hook-form"),m=require("luxon");exports.default=function(e){var s,d,u,c,f=e.disabled,v=void 0!==f&&f,D=e.minDate,g=e.startDateLabel,E=e.startTimeLabel,F=e.endDateLabel,T=e.endTimeLabel,b=e.startTimeRules,p=e.endTimeRules,C=r.useTranslation(["Design","Notification","App"]).t,_=o.useFormContext(),h=_.getValues,y=_.formState.errors,q=_.register,L=_.trigger,V=_.setValue,x=h("startDate"),S=h("endDate"),k=h("startTime"),I=h("endTime");return a.useEffect((function(){x&&S&&L("endDate")}),[x]),a.useEffect((function(){k&&I&&L("endTime")}),[k]),l.createElement(l.Fragment,null,l.createElement(i.Row,null,l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=g?g:C("Design:fromDate")),l.createElement(i.Form.Control,t.__assign({type:"date"},q("startDate",{required:!0}),{defaultValue:x,className:x&&"date-input-with-value",disabled:v,min:D,isInvalid:Boolean(y.startDate)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(s=y.startDate)||void 0===s?void 0:s.message))),l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=F?F:C("Design:toDate")),l.createElement(i.Form.Control,t.__assign({type:"date"},q("endDate",{required:!0,validate:function(e){if(!x||!e)return!0;var t=m.DateTime.fromFormat(x,n.DATE_FORMAT);return m.DateTime.fromFormat(e,n.DATE_FORMAT).diff(t,["days"]).days>=0||"".concat(C("Validation:fieldLaterDate",{attribute:C("Design:endDateSmall"),min:C("Design:startDateSmall")}))}}),{defaultValue:S,className:S&&"date-input-with-value",disabled:v,min:x||void 0,isInvalid:Boolean(y.endDate)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(d=y.endDate)||void 0===d?void 0:d.message)))),l.createElement(i.Row,null,l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=E?E:C("Design:availableFrom")),l.createElement(i.Form.Control,t.__assign({type:"time"},q("startTime",t.__assign({required:!1},b)),{onChange:function(e){var t=e.target.value;V("startTime","".concat(t,":00"),{shouldValidate:!0})},placeholder:"hh:mm",defaultValue:k,disabled:v,isInvalid:Boolean(y.startTime)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(u=y.startTime)||void 0===u?void 0:u.message))),l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=T?T:C("Design:availableTo")),l.createElement(i.Form.Control,t.__assign({type:"time"},q("endTime",t.__assign({required:!1,validate:function(e){var t;if(!k||!e)return!0;var a=m.DateTime.fromISO(k),l=m.DateTime.fromISO(e);return(null===(t=null==l?void 0:l.diff(a,["seconds"]))||void 0===t?void 0:t.seconds)>0||"".concat(C("Validation:fieldLaterDate",{attribute:C("Design:endTimeSmall"),min:C("Design:startTimeSmall")}))}},p)),{onChange:function(e){var t=e.target.value;V("endTime","".concat(t,":59"),{shouldValidate:!0})},placeholder:"hh:mm",defaultValue:I,disabled:v,isInvalid:Boolean(y.endTime)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(c=y.endTime)||void 0===c?void 0:c.message)))))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("tslib"),a=require("react"),l=(e=a)&&"object"==typeof e&&"default"in e?e.default:e,r=require("@licklist/core/dist/Config"),n=require("react-i18next"),i=require("react-bootstrap"),o=require("react-hook-form"),m=require("luxon");exports.default=function(e){var s,d,u,c,f=e.disabled,v=void 0!==f&&f,D=e.minDate,E=e.startDateLabel,F=e.startTimeLabel,b=e.endDateLabel,g=e.endTimeLabel,T=e.startTimeRules,p=e.endTimeRules,_=n.useTranslation(["Design","Notification","App"]).t,C=o.useFormContext(),y=C.getValues,q=C.formState.errors,L=C.register,h=C.trigger,x=y("startDate"),S=y("endDate"),V=y("startTime"),k=y("endTime");return a.useEffect((function(){x&&S&&h("endDate")}),[x]),a.useEffect((function(){V&&k&&h("endTime")}),[V]),l.createElement(l.Fragment,null,l.createElement(i.Row,null,l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=E?E:_("Design:fromDate")),l.createElement(i.Form.Control,t.__assign({type:"date"},L("startDate",{required:!0}),{defaultValue:x,className:x&&"date-input-with-value",disabled:v,min:D,isInvalid:Boolean(q.startDate)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(s=q.startDate)||void 0===s?void 0:s.message))),l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=b?b:_("Design:toDate")),l.createElement(i.Form.Control,t.__assign({type:"date"},L("endDate",{required:!0,validate:function(e){if(!x||!e)return!0;var t=m.DateTime.fromFormat(x,r.DATE_FORMAT);return m.DateTime.fromFormat(e,r.DATE_FORMAT).diff(t,["days"]).days>=0||"".concat(_("Validation:fieldLaterDate",{attribute:_("Design:endDateSmall"),min:_("Design:startDateSmall")}))}}),{defaultValue:S,className:S&&"date-input-with-value",disabled:v,min:x||void 0,isInvalid:Boolean(q.endDate)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(d=q.endDate)||void 0===d?void 0:d.message)))),l.createElement(i.Row,null,l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=F?F:_("Design:availableFrom")),l.createElement(i.Form.Control,t.__assign({type:"time"},L("startTime",t.__assign({required:!1},T)),{placeholder:"hh:mm",defaultValue:V,disabled:v,isInvalid:Boolean(q.startTime)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(u=q.startTime)||void 0===u?void 0:u.message))),l.createElement(i.Col,{xs:12,sm:6},l.createElement(i.Form.Group,null,l.createElement(i.Form.Label,null,null!=g?g:_("Design:availableTo")),l.createElement(i.Form.Control,t.__assign({type:"time"},L("endTime",t.__assign({required:!1,validate:function(e){var t;if(!V||!e)return!0;var a=m.DateTime.fromISO(V),l=m.DateTime.fromISO(e);return(null===(t=null==l?void 0:l.diff(a,["minutes"]))||void 0===t?void 0:t.minutes)>=0||"".concat(_("Validation:fieldLaterDate",{attribute:_("Design:endTimeSmall"),min:_("Design:startTimeSmall")}))}},p)),{placeholder:"hh:mm",defaultValue:k,disabled:v,isInvalid:Boolean(q.endTime)})),l.createElement(i.Form.Control.Feedback,{type:"invalid"},null===(c=q.endTime)||void 0===c?void 0:c.message)))))};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@licklist/design",
3
- "version": "0.44.486-dev.20",
3
+ "version": "0.44.486-dev.21",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+ssh://git@bitbucket.org/artelogicsoft/licklist_design.git"
@@ -40,7 +40,6 @@ function RecurrenceIntervalAndFrequencyInput({
40
40
  formState: { errors },
41
41
  register,
42
42
  trigger,
43
- setValue,
44
43
  } = useFormContext<RecurringDatePickerInputValues>();
45
44
 
46
45
  const startDate = getValues("startDate");
@@ -132,9 +131,6 @@ function RecurrenceIntervalAndFrequencyInput({
132
131
  <Form.Control
133
132
  type="time"
134
133
  {...register("startTime", { required: false, ...startTimeRules })}
135
- onChange={({ target: { value } }) => {
136
- setValue("startTime", `${value}:00`, { shouldValidate: true });
137
- }}
138
134
  placeholder="hh:mm"
139
135
  defaultValue={startTime}
140
136
  disabled={disabled}
@@ -160,8 +156,8 @@ function RecurrenceIntervalAndFrequencyInput({
160
156
  const currentStartTime = DateTime.fromISO(startTime);
161
157
  const currentEndTime = DateTime.fromISO(time);
162
158
 
163
- return currentEndTime?.diff(currentStartTime, ["seconds"])
164
- ?.seconds > 0
159
+ return currentEndTime?.diff(currentStartTime, ["minutes"])
160
+ ?.minutes >= 0
165
161
  ? true
166
162
  : `${t(`Validation:fieldLaterDate`, {
167
163
  attribute: t("Design:endTimeSmall"),
@@ -170,9 +166,6 @@ function RecurrenceIntervalAndFrequencyInput({
170
166
  },
171
167
  ...endTimeRules,
172
168
  })}
173
- onChange={({ target: { value } }) => {
174
- setValue("endTime", `${value}:59`, { shouldValidate: true });
175
- }}
176
169
  placeholder="hh:mm"
177
170
  defaultValue={endTime}
178
171
  disabled={disabled}