react-schedule-meeting
Advanced tools
Comparing version 4.2.1 to 4.2.2
import { Locale } from 'date-fns'; | ||
import React from 'react'; | ||
import { AvailableTimeslot } from './ScheduleMeeting'; | ||
import { StartTimeEvent } from './ScheduleMeeting'; | ||
type CalendarProps = { | ||
availableTimeslots: Array<AvailableTimeslot>; | ||
startTimeEventsList: StartTimeEvent[]; | ||
onDaySelected: (day: Date) => void; | ||
@@ -7,0 +7,0 @@ selectedDay: Date; |
@@ -1,2 +0,2 @@ | ||
import{isValid as e,eachDayOfInterval as t,startOfMonth as r,format as a,differenceInMinutes as o,addMinutes as n,isSameDay as i,isSameMinute as l,isPast as c,isAfter as d,isToday as s,subMonths as m,addMonths as g,subDays as b,addDays as u,isBefore as p,isEqual as x}from"date-fns";import*as v from"react";import T,{useState as f,useEffect as y}from"react";import h from"color";import _ from"react-calendar";import{setup as w,styled as k}from"goober";import{shouldForwardProp as E}from"goober/should-forward-prop";const S=({direction:e})=>v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"26",height:"26",viewBox:"0 0 512 512"},v.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"back"===e?"M328 112L184 256l144 144":"M184.001 400L328.001 256L184.001 112"}));w(T.createElement,void 0,void 0,E((e=>"$"!==e[0])));const C=k(_)` | ||
import{isValid as e,startOfMonth as t,format as r,differenceInMinutes as a,addMinutes as o,isSameDay as n,isSameMinute as i,isPast as l,isAfter as c,isToday as d,subMonths as s,addMonths as m,subDays as g,addDays as b,isBefore as u,isEqual as p}from"date-fns";import*as x from"react";import v,{useState as T,useEffect as f}from"react";import y from"color";import h from"react-calendar";import{setup as _,styled as w}from"goober";import{shouldForwardProp as k}from"goober/should-forward-prop";const E=({direction:e})=>x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"26",height:"26",viewBox:"0 0 512 512"},x.createElement("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"48",d:"back"===e?"M328 112L184 256l144 144":"M184.001 400L328.001 256L184.001 112"}));_(v.createElement,void 0,void 0,k((e=>"$"!==e[0])));const S=w(h)` | ||
&.react-calendar, | ||
@@ -183,3 +183,3 @@ &.react-calendar *, | ||
} | ||
`,D=(e,t)=>a(e,"MM/dd/yyyy",{locale:t}),N=({availableTimeslots:a,onDaySelected:o,selectedDay:n,locale:i})=>{const[l,c]=f([]);y((()=>{const r=[];a.map((a=>{if(!e(new Date(a.startTime)))throw new Error(`Invalid date for start time on slot ${a.id}`);if(!e(new Date(a.endTime)))throw new Error(`Invalid date for end time on slot ${a.id}`);return t({start:new Date(a.startTime),end:new Date(a.endTime)}).map((e=>{r.push(D(e,i))})),null})),c([...new Set(r)])}),[a]);return T.createElement(C,{defaultView:"month",onClickDay:e=>{o(e)},showNavigation:!1,tileDisabled:e=>"month"===e.view&&!l.some((t=>t===D(e.date,i))),tileClassName:e=>l.some((t=>t===D(e.date,i)))?["day-tile","active-day-tile"]:"month"===e.view?"day-tile":null,value:n,activeStartDate:r(n)})},B=k("button")` | ||
`,C=(e,t)=>r(e,"MM/dd/yyyy",{locale:t}),D=({startTimeEventsList:r,onDaySelected:a,selectedDay:o,locale:n})=>{const[i,l]=T([]);f((()=>{const t=[];r.map((r=>{if(!e(new Date(r.startTime)))throw new Error(`Invalid date for start time on slot ${r.availableTimeslot.id}`);const a=C(r.startTime,n);return-1===t.indexOf(a)&&t.push(a),null})),l(t)}),[r]);return v.createElement(S,{defaultView:"month",onClickDay:e=>{a(e)},showNavigation:!1,tileDisabled:e=>"month"===e.view&&!i.some((t=>t===C(e.date,n))),tileClassName:e=>i.some((t=>t===C(e.date,n)))?["day-tile","active-day-tile"]:"month"===e.view?"day-tile":null,value:o,activeStartDate:t(o)})},N=w("button")` | ||
padding: 16px; | ||
@@ -199,3 +199,3 @@ border: none; | ||
} | ||
`,$=k("button")` | ||
`,B=w("button")` | ||
padding: 12px 16px; | ||
@@ -217,7 +217,7 @@ margin: 4px; | ||
} | ||
`,L=k("div")` | ||
`,L=w("div")` | ||
display: flex; | ||
width: 100%; | ||
align-items: center; | ||
`,F=k("button")` | ||
`,$=w("button")` | ||
padding: 8px 24px; | ||
@@ -239,3 +239,3 @@ border: none; | ||
} | ||
`,z=({confirmState:e,onStartTimeSelect:t,startTimeEvent:r,selected:o,onCancelClicked:n,format_startTimeFormatString:i,lang_confirmButtonText:l,lang_cancelButtonText:c,lang_selectedButtonText:d,locale:s})=>T.createElement(L,{className:"rsm-start-time-item"},T.createElement(B,{type:"button",className:"rsm-confirm-button",selected:Boolean(o||e),onClick:t},e&&!o&&`${l} `,o&&`${d} `,a(r.startTime,i,{locale:s})),(e||o)&&T.createElement(F,{type:"button",className:"rsm-cancel-button",onClick:n},c)),j=k("div")` | ||
`,F=({confirmState:e,onStartTimeSelect:t,startTimeEvent:a,selected:o,onCancelClicked:n,format_startTimeFormatString:i,lang_confirmButtonText:l,lang_cancelButtonText:c,lang_selectedButtonText:d,locale:s})=>v.createElement(L,{className:"rsm-start-time-item"},v.createElement(N,{type:"button",className:"rsm-confirm-button",selected:Boolean(o||e),onClick:t},e&&!o&&`${l} `,o&&`${d} `,r(a.startTime,i,{locale:s})),(e||o)&&v.createElement($,{type:"button",className:"rsm-cancel-button",onClick:n},c)),z=w("div")` | ||
position: relative; | ||
@@ -247,3 +247,3 @@ display: flex; | ||
padding-top: 16px; | ||
`,R=k("div")` | ||
`,j=w("div")` | ||
position: relative; | ||
@@ -260,3 +260,3 @@ display: flex; | ||
} | ||
`,G=k("div")` | ||
`,R=w("div")` | ||
position: absolute; | ||
@@ -277,3 +277,3 @@ width: 100%; | ||
} | ||
`,A=k("div")` | ||
`,G=w("div")` | ||
flex-shrink: 0; | ||
@@ -285,3 +285,3 @@ flex: 1; | ||
background: ${({makeTransparent:e})=>e?"transparent":"rgba(var(--background-color-contrast-rgb), 0.05)"}; | ||
`,I=k("p")` | ||
`,A=w("p")` | ||
margin: 0; | ||
@@ -292,3 +292,3 @@ opacity: 0.5; | ||
color: rgba(var(--text-color-rgb), 1); | ||
`,M=k("div")` | ||
`,M=w("div")` | ||
height: 100%; | ||
@@ -301,3 +301,3 @@ flex: 1; | ||
flex-direction: column; | ||
`,O=k(B)` | ||
`,I=w(N)` | ||
border: none; | ||
@@ -322,3 +322,3 @@ padding: 6px 18px; | ||
} | ||
`,U=k(I)` | ||
`,O=w(A)` | ||
font-size: 90%; | ||
@@ -329,3 +329,3 @@ font-weight: 700; | ||
border: 1px solid rgba(var(--background-color-contrast-rgb), 0.5); | ||
`,H=({skipConfirmCheck:e,selectedDay:t,selectedStartTime:r,startTimeListItems:o=[],onStartTimeSelect:n,emptyListContentEl:i,lang_emptyListText:l,format_startTimeFormatString:c,lang_confirmButtonText:d,lang_cancelButtonText:s,lang_goToNextAvailableDayText:m,lang_noFutureTimesText:g,lang_selectedButtonText:b,onGoToNextAvailableDayClick:u,nextFutureStartTimeAvailable:p,format_nextFutureStartTimeAvailableFormatString:x,startTimeListStyle:v,setSelectedStartTime:h,locale:_})=>{const[w,k]=f(-1);y((()=>{k(-1)}),[t]);const E=T.createElement(M,null,T.createElement(T.Fragment,null,i||T.createElement(I,{className:"rsm-empty-list-text"},l),p?T.createElement(O,{type:"button",selected:!0,className:"rsm-next-available-date-button",onClick:u},T.createElement("p",null,T.createElement("small",null,m),T.createElement("br",null),a(p,x,{locale:_})),T.createElement(S,{direction:"forward"})):T.createElement(U,{className:"rsm-no-future-times-text"},g)));return T.createElement(T.Fragment,null,0===o.length?E:"scroll-list"===v?T.createElement(T.Fragment,null,T.createElement(G,{className:"top"}),T.createElement(G,{className:"bottom"}),T.createElement(j,null,o.map(((t,a)=>T.createElement(T.Fragment,{key:a},T.createElement(z,{locale:_,lang_selectedButtonText:b,lang_confirmButtonText:d,lang_cancelButtonText:s,format_startTimeFormatString:c,onCancelClicked:()=>(e=>{k(-1),r&&e.startTime.getTime()===r&&h(void 0)})(t),selected:Boolean(r&&r===t.startTime.getTime()),confirmState:a===w,startTimeEvent:t,onStartTimeSelect:()=>((t,r)=>{e||w===r?(n(t),k(-1)):k(r)})(t,a)}),a!==o.length-1&&T.createElement(A,{makeTransparent:w===a||w===a+1})))))):T.createElement(R,{className:r?"has-selection":""},o.map(((e,t)=>T.createElement($,{key:t,type:"button",className:r&&r===e.startTime.getTime()?"is-selected":"",onClick:()=>n(e)},a(e.startTime,c,{locale:_}))))))},V=k("div")` | ||
`,U=({skipConfirmCheck:e,selectedDay:t,selectedStartTime:a,startTimeListItems:o=[],onStartTimeSelect:n,emptyListContentEl:i,lang_emptyListText:l,format_startTimeFormatString:c,lang_confirmButtonText:d,lang_cancelButtonText:s,lang_goToNextAvailableDayText:m,lang_noFutureTimesText:g,lang_selectedButtonText:b,onGoToNextAvailableDayClick:u,nextFutureStartTimeAvailable:p,format_nextFutureStartTimeAvailableFormatString:x,startTimeListStyle:y,setSelectedStartTime:h,locale:_})=>{const[w,k]=T(-1);f((()=>{k(-1)}),[t]);const S=v.createElement(M,null,v.createElement(v.Fragment,null,i||v.createElement(A,{className:"rsm-empty-list-text"},l),p?v.createElement(I,{type:"button",selected:!0,className:"rsm-next-available-date-button",onClick:u},v.createElement("p",null,v.createElement("small",null,m),v.createElement("br",null),r(p,x,{locale:_})),v.createElement(E,{direction:"forward"})):v.createElement(O,{className:"rsm-no-future-times-text"},g)));return v.createElement(v.Fragment,null,0===o.length?S:"scroll-list"===y?v.createElement(v.Fragment,null,v.createElement(R,{className:"top"}),v.createElement(R,{className:"bottom"}),v.createElement(z,null,o.map(((t,r)=>v.createElement(v.Fragment,{key:r},v.createElement(F,{locale:_,lang_selectedButtonText:b,lang_confirmButtonText:d,lang_cancelButtonText:s,format_startTimeFormatString:c,onCancelClicked:()=>(e=>{k(-1),a&&e.startTime.getTime()===a&&h(void 0)})(t),selected:Boolean(a&&a===t.startTime.getTime()),confirmState:r===w,startTimeEvent:t,onStartTimeSelect:()=>((t,r)=>{e||w===r?(n(t),k(-1)):k(r)})(t,r)}),r!==o.length-1&&v.createElement(G,{makeTransparent:w===r||w===r+1})))))):v.createElement(j,{className:a?"has-selection":""},o.map(((e,t)=>v.createElement(B,{key:t,type:"button",className:a&&a===e.startTime.getTime()?"is-selected":"",onClick:()=>n(e)},r(e.startTime,c,{locale:_}))))))},H=w("div")` | ||
width: 100%; | ||
@@ -343,3 +343,3 @@ display: flex; | ||
--border-radius: ${({$borderRadius:e})=>e}px; | ||
`,W=k("div")` | ||
`,V=w("div")` | ||
display: flex; | ||
@@ -359,3 +359,3 @@ border-radius: var(--border-radius); | ||
} | ||
`,q=k("div")` | ||
`,W=w("div")` | ||
width: 1px; | ||
@@ -368,5 +368,5 @@ background: rgba(0, 0, 0, 0.1); | ||
} | ||
`,J=k("div")` | ||
`,q=w("div")` | ||
flex: 1; | ||
`,K=k("div")` | ||
`,J=w("div")` | ||
flex: 1; | ||
@@ -378,3 +378,3 @@ overflow: hidden; | ||
} | ||
`,P=k("div")` | ||
`,K=w("div")` | ||
position: absolute; | ||
@@ -385,3 +385,3 @@ width: 100%; | ||
flex-direction: column; | ||
`,Q=k("h3")` | ||
`,P=w("h3")` | ||
margin: 0; | ||
@@ -392,3 +392,3 @@ padding: 0; | ||
color: rgba(var(--text-color-rgb), 1); | ||
`,X=k("div")` | ||
`,Q=w("div")` | ||
width: 100%; | ||
@@ -399,3 +399,3 @@ display: flex; | ||
margin-bottom: 6px; | ||
`,Y=k("button")` | ||
`,X=w("button")` | ||
outline: none; | ||
@@ -417,2 +417,2 @@ background: none; | ||
} | ||
`,Z=({availableTimeslots:e=[],backgroundColor:t="#ffffff",borderRadius:r=0,className:p,defaultDate:x,emptyListContentEl:v,eventDurationInMinutes:_=30,eventStartTimeSpreadInMinutes:w=0,format_nextFutureStartTimeAvailableFormatString:k="cccc, LLLL do",format_selectedDateDayTitleFormatString:E="cccc, LLLL do",format_selectedDateMonthTitleFormatString:C="LLLL yyyy",format_startTimeFormatString:D="h:mm a",lang_cancelButtonText:B="Cancel",lang_confirmButtonText:$="Confirm",lang_emptyListText:L="No times available",lang_goToNextAvailableDayText:F="Next Available",lang_noFutureTimesText:z="No future times available",lang_selectedButtonText:j="Selected:",locale:R,onNoFutureTimesAvailable:G,onSelectedDayChange:A,onStartTimeSelect:I,primaryColor:M="#3f5b85",scheduleMeetingStyles:O,selectedStartTime:U,skipConfirmCheck:Z=!1,startTimeListStyle:ee="grid",textColor:te})=>{const re=h(M).rgb().array().join(","),ae=h(t).rgb().array().join(","),oe=h(t).isDark(),ne=te||(oe?"255, 255, 255":"34, 34, 34"),ie=h(M).isDark()?"255, 255, 255":"34, 34, 34",le=oe?"255, 255, 255":"34, 34, 34",ce=oe?h(M).lighten(.5).rgb().array().join(","):h(M).darken(.5).rgb().array().join(","),[de,se]=f(U?U.getTime():void 0),[me,ge]=f(new Date),[be,ue]=f([]),[pe,xe]=f([]),[ve,Te]=f(),[fe,ye]=f([]);y((()=>{se(U?U.getTime():void 0)}),[U]),y((()=>{const t=[...e];t.sort(((e,t)=>new Date(e.startTime).getTime()-new Date(t.startTime).getTime())),ye(t)}),[e]);y((()=>{const e=[];for(const t of fe){const r=o(new Date(t.endTime),new Date(t.startTime));let a=Math.floor(r/(_+w))-1;for(;a>=0;){const r={availableTimeslot:t,startTime:n(new Date(t.startTime),a*(_+w))};e.push(r),a--}}x&&ge(x),ue(e)}),[fe,_,w,x]),y((()=>{var e;const t=[];for(const e of be)i(e.startTime,me)&&0===t.filter((t=>l(t.startTime,e.startTime))).length&&(c(e.startTime)||t.push(e));const r=t.sort(((e,t)=>e.startTime.getTime()-t.startTime.getTime())),a=null===(e=be.find((e=>d(e.startTime,me)&&!s(e.startTime))))||void 0===e?void 0:e.startTime;be.length>0&&G&&!a&&0===r.length&&G(me),Te(a),xe(r)}),[me,be]);return T.createElement(V,{className:p,$primaryColorRGB:re,$borderRadius:r,style:O,$backgroundColorContrastRGB:le,$textColorRGB:ne,$backgroundColorRGB:ae,$primaryColorContrastRGB:ie,$calendarColoredTextRGB:ce},T.createElement(W,null,T.createElement(J,null,T.createElement(X,null,T.createElement(Y,{type:"button",className:"rsm-arrow-button",onClick:()=>{ge(m(me,1))}},T.createElement(S,{direction:"back"})),T.createElement(Q,{className:"rsm-date-title"},a(me,C,{locale:R})),T.createElement(Y,{type:"button",className:"rsm-arrow-button",onClick:()=>{ge(g(me,1))}},T.createElement(S,{direction:"forward"}))),T.createElement(N,{locale:R,selectedDay:me,availableTimeslots:fe,onDaySelected:e=>{ge(e),A&&A(e)}})),T.createElement(q,null),T.createElement(K,null,T.createElement(P,null,T.createElement(X,null,T.createElement(Y,{type:"button",className:"rsm-arrow-button",onClick:()=>{ge(b(me,1))}},T.createElement(S,{direction:"back"})),T.createElement(Q,{className:"rsm-date-title"},a(me,E,{locale:R})),T.createElement(Y,{type:"button",className:"rsm-arrow-button",onClick:()=>{ge(u(me,1))}},T.createElement(S,{direction:"forward"}))),T.createElement(H,{skipConfirmCheck:Z,selectedDay:me,selectedStartTime:de,locale:R,format_nextFutureStartTimeAvailableFormatString:k,nextFutureStartTimeAvailable:ve,lang_goToNextAvailableDayText:F,lang_noFutureTimesText:z,onGoToNextAvailableDayClick:()=>{ve&&ge(ve)},lang_confirmButtonText:$,lang_cancelButtonText:B,lang_emptyListText:L,lang_selectedButtonText:j,emptyListContentEl:v,onStartTimeSelect:e=>{const t=(e=>{const t=[null,null],r=o(e.startTime,new Date(e.availableTimeslot.startTime));if(0!==r){const a={oldId:e.availableTimeslot.id,startTime:e.availableTimeslot.startTime,endTime:n(new Date(e.availableTimeslot.startTime),r)};t[0]=a}const a=n(new Date(e.availableTimeslot.startTime),r+_);if(0!==o(a,new Date(e.availableTimeslot.endTime))){const r={oldId:e.availableTimeslot.id,startTime:a,endTime:e.availableTimeslot.endTime};t[1]=r}return t})(e),r=Object.assign(Object.assign({},e),{splitTimeslot:t,resetDate:()=>ge(x||new Date),resetSelectedTimeState:()=>se(void 0)});se(e.startTime.getTime()),I&&I(r)},startTimeListItems:pe,format_startTimeFormatString:D,startTimeListStyle:ee,setSelectedStartTime:se})))))};function ee(e,t){if(!e||!t)return[];const r=[...e],a=[...t];r.sort(((e,t)=>new Date(e.startTime).getTime()-new Date(t.startTime).getTime()));let o=0;for(;o<r.length;){const e=r[o];try{const t=new Date(e.startTime),n=new Date(e.endTime);"string"==typeof e.startTime&&(e.startTime=t),"string"==typeof e.endTime&&(e.endTime=n);for(const i of a)try{const a=new Date(i.startTime),l=new Date(i.endTime);if("string"==typeof i.startTime&&(i.startTime=a),"string"==typeof i.endTime&&(i.endTime=l),p(a,t)||x(a,t))p(t,l)&&(p(l,n)?e.startTime=l:(r.splice(o,1),o--));else if(p(a,n))if(p(l,n)){const t=Object.assign(Object.assign({},e),{startTime:l});e.endTime=a,r.splice(o+1,0,t),o--}else e.endTime=a}catch(e){throw console.error("Invalid Date for unavailable slot: ",i),e}}catch(t){throw console.error("Invalid Date for available slot: ",e),t}o++}return r}export{Z as ScheduleMeeting,ee as timeSlotDifference}; | ||
`,Y=({availableTimeslots:e=[],backgroundColor:t="#ffffff",borderRadius:u=0,className:p,defaultDate:x,emptyListContentEl:h,eventDurationInMinutes:_=30,eventStartTimeSpreadInMinutes:w=0,format_nextFutureStartTimeAvailableFormatString:k="cccc, LLLL do",format_selectedDateDayTitleFormatString:S="cccc, LLLL do",format_selectedDateMonthTitleFormatString:C="LLLL yyyy",format_startTimeFormatString:N="h:mm a",lang_cancelButtonText:B="Cancel",lang_confirmButtonText:L="Confirm",lang_emptyListText:$="No times available",lang_goToNextAvailableDayText:F="Next Available",lang_noFutureTimesText:z="No future times available",lang_selectedButtonText:j="Selected:",locale:R,onNoFutureTimesAvailable:G,onSelectedDayChange:A,onStartTimeSelect:M,primaryColor:I="#3f5b85",scheduleMeetingStyles:O,selectedStartTime:Y,skipConfirmCheck:Z=!1,startTimeListStyle:ee="grid",textColor:te})=>{const re=y(I).rgb().array().join(","),ae=y(t).rgb().array().join(","),oe=y(t).isDark(),ne=te||(oe?"255, 255, 255":"34, 34, 34"),ie=y(I).isDark()?"255, 255, 255":"34, 34, 34",le=oe?"255, 255, 255":"34, 34, 34",ce=oe?y(I).lighten(.5).rgb().array().join(","):y(I).darken(.5).rgb().array().join(","),[de,se]=T(Y?Y.getTime():void 0),[me,ge]=T(new Date),[be,ue]=T([]),[pe,xe]=T([]),[ve,Te]=T(),[fe,ye]=T([]);f((()=>{se(Y?Y.getTime():void 0)}),[Y]),f((()=>{const t=[...e];t.sort(((e,t)=>new Date(e.startTime).getTime()-new Date(t.startTime).getTime())),ye(t)}),[e]);f((()=>{const e=[];for(const t of fe){const r=a(new Date(t.endTime),new Date(t.startTime));let n=Math.floor(r/(_+w))-1;for(;n>=0;){const r={availableTimeslot:t,startTime:o(new Date(t.startTime),n*(_+w))};e.push(r),n--}}x&&ge(x),ue(e)}),[fe,_,w,x]),f((()=>{var e;const t=[];for(const e of be)n(e.startTime,me)&&0===t.filter((t=>i(t.startTime,e.startTime))).length&&(l(e.startTime)||t.push(e));const r=t.sort(((e,t)=>e.startTime.getTime()-t.startTime.getTime())),a=null===(e=be.find((e=>c(e.startTime,me)&&!d(e.startTime))))||void 0===e?void 0:e.startTime;be.length>0&&G&&!a&&0===r.length&&G(me),Te(a),xe(r)}),[me,be]);return v.createElement(H,{className:p,$primaryColorRGB:re,$borderRadius:u,style:O,$backgroundColorContrastRGB:le,$textColorRGB:ne,$backgroundColorRGB:ae,$primaryColorContrastRGB:ie,$calendarColoredTextRGB:ce},v.createElement(V,null,v.createElement(q,null,v.createElement(Q,null,v.createElement(X,{type:"button",className:"rsm-arrow-button",onClick:()=>{ge(s(me,1))}},v.createElement(E,{direction:"back"})),v.createElement(P,{className:"rsm-date-title"},r(me,C,{locale:R})),v.createElement(X,{type:"button",className:"rsm-arrow-button",onClick:()=>{ge(m(me,1))}},v.createElement(E,{direction:"forward"}))),v.createElement(D,{locale:R,selectedDay:me,startTimeEventsList:be,onDaySelected:e=>{ge(e),A&&A(e)}})),v.createElement(W,null),v.createElement(J,null,v.createElement(K,null,v.createElement(Q,null,v.createElement(X,{type:"button",className:"rsm-arrow-button",onClick:()=>{ge(g(me,1))}},v.createElement(E,{direction:"back"})),v.createElement(P,{className:"rsm-date-title"},r(me,S,{locale:R})),v.createElement(X,{type:"button",className:"rsm-arrow-button",onClick:()=>{ge(b(me,1))}},v.createElement(E,{direction:"forward"}))),v.createElement(U,{skipConfirmCheck:Z,selectedDay:me,selectedStartTime:de,locale:R,format_nextFutureStartTimeAvailableFormatString:k,nextFutureStartTimeAvailable:ve,lang_goToNextAvailableDayText:F,lang_noFutureTimesText:z,onGoToNextAvailableDayClick:()=>{ve&&ge(ve)},lang_confirmButtonText:L,lang_cancelButtonText:B,lang_emptyListText:$,lang_selectedButtonText:j,emptyListContentEl:h,onStartTimeSelect:e=>{const t=(e=>{const t=[null,null],r=a(e.startTime,new Date(e.availableTimeslot.startTime));if(0!==r){const a={oldId:e.availableTimeslot.id,startTime:e.availableTimeslot.startTime,endTime:o(new Date(e.availableTimeslot.startTime),r)};t[0]=a}const n=o(new Date(e.availableTimeslot.startTime),r+_);if(0!==a(n,new Date(e.availableTimeslot.endTime))){const r={oldId:e.availableTimeslot.id,startTime:n,endTime:e.availableTimeslot.endTime};t[1]=r}return t})(e),r=Object.assign(Object.assign({},e),{splitTimeslot:t,resetDate:()=>ge(x||new Date),resetSelectedTimeState:()=>se(void 0)});se(e.startTime.getTime()),M&&M(r)},startTimeListItems:pe,format_startTimeFormatString:N,startTimeListStyle:ee,setSelectedStartTime:se})))))};function Z(e,t){if(!e||!t)return[];const r=[...e],a=[...t];r.sort(((e,t)=>new Date(e.startTime).getTime()-new Date(t.startTime).getTime()));let o=0;for(;o<r.length;){const e=r[o];try{const t=new Date(e.startTime),n=new Date(e.endTime);"string"==typeof e.startTime&&(e.startTime=t),"string"==typeof e.endTime&&(e.endTime=n);for(const i of a)try{const a=new Date(i.startTime),l=new Date(i.endTime);if("string"==typeof i.startTime&&(i.startTime=a),"string"==typeof i.endTime&&(i.endTime=l),u(a,t)||p(a,t))u(t,l)&&(u(l,n)?e.startTime=l:(r.splice(o,1),o--));else if(u(a,n))if(u(l,n)){const t=Object.assign(Object.assign({},e),{startTime:l});e.endTime=a,r.splice(o+1,0,t),o--}else e.endTime=a}catch(e){throw console.error("Invalid Date for unavailable slot: ",i),e}}catch(t){throw console.error("Invalid Date for available slot: ",e),t}o++}return r}export{Y as ScheduleMeeting,Z as timeSlotDifference}; |
{ | ||
"name": "react-schedule-meeting", | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"main": "dist/index.cjs.js", | ||
@@ -5,0 +5,0 @@ "module": "dist/index.esm.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28398