zaman-backoffice 1.2.5 → 1.2.6

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/index.cjs.js CHANGED
@@ -59,10 +59,10 @@
59
59
  flex-direction: column;
60
60
  width: ${$}px;
61
61
  gap: 4px;
62
- `,I=n.div`
62
+ `,H=n.div`
63
63
  display: flex;
64
64
  gap: 4px;
65
- `,H=n.div`
65
+ `,I=n.div`
66
66
  display: flex;
67
67
  justify-content: center;
68
68
  align-items: center;
@@ -237,7 +237,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
237
237
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
238
238
  PERFORMANCE OF THIS SOFTWARE.
239
239
  ***************************************************************************** */
240
- function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["ref"]);const{locale:o}=B,{defaultValue:a,weekends:i,controlledValue:s,range:l=!1}=r,c=void 0===a?new Date:a,[u,d]=e.useState("days"),[m,f]=e.useState(void 0!==a?new Date(a):void 0),h=e.useMemo((()=>he(m)),[m]),[p,y]=e.useState([h]),g=e.useRef([]),v=(({daysElementRefs:t,days:n,setDays:r})=>{const o=e.useRef(!1),a=n[0].middleOfMonth,i=e=>requestAnimationFrame((()=>{o.current=!0;const[n,a]=t.current;n.style.transform=`translateX(${pe()}px)`,a.style.transform=`translateX(${pe()}px)`,requestAnimationFrame((()=>{a.style.transition=`transform 250ms ${M}`,a.style.transform="translateX(0px)",n.style.transition=`transform 250ms ${M}`,n.style.transform="translateX(0px)",setTimeout((()=>{r((t=>t.filter((t=>t.id===e.id)))),n.style.transition=null,n.style.transform=null,o.current=!1}),300)}))})),s=e=>{requestAnimationFrame((()=>{o.current=!0;const[n,a]=t.current;n.style.transition=`transform 250ms ${M}`,n.style.transform=`translateX(${pe()}px)`,a.style.transition=`transform 250ms ${M}`,a.style.transform=`translateX(${pe()}px)`,setTimeout((()=>{r((t=>t.filter((t=>t.id===e.id)))),a.style.transition=null,a.style.transform=null,o.current=!1}),300)}))};return{slideToTheNextMonth:()=>{if(o.current)return;const e=J(a).add(1,"month"),t=he(e.toDate());r([...n,t]),s(t)},slideToPrevMonth:()=>{if(o.current)return;const e=J(a).subtract(1,"month"),t=he(e.toDate());r([t,...n]),i(t)},slideToCurrentMonth:()=>{if(o.current)return;const e=ne(new Date);console.log(e);const t=J(new Date).subtract(e-1,"days").add(15,"days");console.log("middle of the month",t.toDate());const l=he(t.toDate());r([...n,l]),J(a).isAfter(t)&&(console.log("we re animating right "),i(l)),J(a.getMonth()).isBefore(t.get("month"))&&(console.log("we re animating left"),s(l))}}})({daysElementRefs:g,days:p,setDays:y}),{from:b,to:x,handlers:$}=ke(r);e.useImperativeHandle(n,(()=>({todayTransitionHandler:()=>v.slideToCurrentMonth()})),[v]),console.log("ref assigned",n);return e.useEffect((()=>{s!==m&&void 0!==s&&f(s)}),[s]),e.createElement(T,{className:null!==r.className?r.className:""},e.createElement(X,{monthName:p[0].monthName,onNextClick:()=>{if("days"===u)return v.slideToTheNextMonth()},onPrevClick:()=>{if("days"===u)return v.slideToPrevMonth()},onClickOnTitle:()=>{d("month"!==u&&"year"!==u?"year":"days")}}),"year"===u?e.createElement(Me,{value:c,onYearSelect:e=>{const t=((e,t)=>{const n=t-parseInt(oe(e,"latn"),10);return n>0?J(e).add(n,"years").toDate():J(e).subtract(Math.abs(n),"years").toDate()})(c,e);y([he(t)]),d("month")}}):null,"month"===u?e.createElement(xe,{value:c,onMonthSelect:e=>{const t=((e,t)=>{const n=t-parseInt(ae(e,"latn"),10);return n>0?J(e).add(n,"months").toDate():J(e).subtract(Math.abs(n),"months").toDate()})(p[0].middleOfMonth,e);y([he(t)]),d("days")}}):null,"days"===u?e.createElement(e.Fragment,null,e.createElement(H,null,ve[o].shortWeekDays.map((t=>e.createElement(V,{key:t.key},t.name)))),e.createElement(L,null,p.map(((t,n)=>e.createElement(N,{key:t.id,className:"item",ref:e=>{g.current[n]=e},role:"rowgroup"},t.weeks.map(((t,n)=>e.createElement(I,{key:n,role:"row","aria-rowindex":n+1},t.map(((t,n)=>e.createElement(ge,Object.assign({key:t.date.getTime(),className:"zm-DaysButton","data-value":t.date,"data-disabled":t.disabled,"data-range":r.range,"data-selected":!l&&ce(m,t.date),"data-start-range":null!=b&&ce(b,t.date),"data-in-range":ue(t.date,b,x),"data-end-range":null!=x&&ce(x,t.date),"data-weekend":null==i?void 0:i.some((e=>e===n)),type:"button",role:"gridcell","aria-colindex":n+1,tabIndex:0,"aria-selected":!l&&ce(c,t.date)},$),e.createElement(ye,{className:"cl-text"},fe(t.date,"DD"))))))))))))):null)};function Ee(t,n){e.useEffect((()=>{function e({target:e}){null==t.current||t.current.contains(e)||n()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[t,n])}De.displayName="Calendar";const Se=(e,t,n)=>`hsl(${e}deg ${t}% ${n}%)`,Ye=e=>{const{h:t,s:n,l:r}=function(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(null==t)throw new Error("Could not parse Hex Color");const n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,o=parseInt(t[3],16)/255,a=Math.max(n,r,o),i=Math.min(n,r,o);let s=(a+i)/2,l=s,c=s;if(a===i)return{h:0,s:0,l:c};const u=a-i;switch(l=c>.5?u/(2-a-i):u/(a+i),a){case n:s=(r-o)/u+(r<o?6:0);break;case r:s=(o-n)/u+2;break;case o:s=(n-r)/u+4}return s/=6,l*=100,l=Math.round(l),c*=100,c=Math.round(c),s=Math.round(360*s),{h:s,s:l,l:c}}(e),o={};return o[40]=Se(t,n,r-10),o[50]=Se(t,n,r),o[85]=Se(t,n,85),o[90]=Se(t,n,90),o[95]=Se(t,n,95),o},_e={0:"#FFFFFF",20:"#F5F5F5",30:"#EBEBEB",40:"#DEDEDE",50:"#BFBFBF",60:"#B0B0B0",70:"#575757",80:"#666666",600:"#2E2E2E"},Ce=t=>{const{accentColor:n=w,locale:o,round:a="thin",direction:i="rtl"}=t;e.useMemo((()=>B.setLocale(o)),[o]);const s={colors:{primary:e.useMemo((()=>Ye(n)),[]),gray:_e},round:a,direction:i};return e.createElement(r.ThemeProvider,{theme:s},t.children)},Oe=n.div`
240
+ function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["ref"]);const{locale:o}=B,{defaultValue:a,weekends:i,controlledValue:s,range:l=!1}=r,c=void 0===a?new Date:a,[u,d]=e.useState("days"),[m,f]=e.useState(void 0!==a?new Date(a):void 0),h=e.useMemo((()=>he(m)),[m]),[p,y]=e.useState([h]),g=e.useRef([]),v=(({daysElementRefs:t,days:n,setDays:r})=>{const o=e.useRef(!1),a=n[0].middleOfMonth,i=e=>requestAnimationFrame((()=>{o.current=!0;const[n,a]=t.current;n.style.transform=`translateX(${pe()}px)`,a.style.transform=`translateX(${pe()}px)`,requestAnimationFrame((()=>{a.style.transition=`transform 250ms ${M}`,a.style.transform="translateX(0px)",n.style.transition=`transform 250ms ${M}`,n.style.transform="translateX(0px)",setTimeout((()=>{r((t=>t.filter((t=>t.id===e.id)))),n.style.transition=null,n.style.transform=null,o.current=!1}),300)}))})),s=e=>{requestAnimationFrame((()=>{o.current=!0;const[n,a]=t.current;n.style.transition=`transform 250ms ${M}`,n.style.transform=`translateX(${pe()}px)`,a.style.transition=`transform 250ms ${M}`,a.style.transform=`translateX(${pe()}px)`,setTimeout((()=>{r((t=>t.filter((t=>t.id===e.id)))),a.style.transition=null,a.style.transform=null,o.current=!1}),300)}))};return{slideToTheNextMonth:()=>{if(o.current)return;const e=J(a).add(1,"month"),t=he(e.toDate());r([...n,t]),s(t)},slideToPrevMonth:()=>{if(o.current)return;const e=J(a).subtract(1,"month"),t=he(e.toDate());r([t,...n]),i(t)},slideToCurrentMonth:()=>{if(o.current)return;const e=ne(new Date);console.log(e);const t=J(new Date).subtract(e-1,"days").add(15,"days");console.log("middle of the month",t.toDate());const l=he(t.toDate());r([...n,l]),J(a).isAfter(t)&&(console.log("we re animating right "),i(l)),J(a.getMonth()).isBefore(t.get("month"))&&(console.log("we re animating left"),s(l))}}})({daysElementRefs:g,days:p,setDays:y}),{from:b,to:x,handlers:$}=ke(r);e.useImperativeHandle(n,(()=>({todayTransitionHandler:()=>v.slideToCurrentMonth()})),[v]),e.useEffect((()=>{null!=n&&(n.current={todayTransitionHandler:()=>v.slideToCurrentMonth()})}),[v,n]),console.log("ref assigned",n);return e.useEffect((()=>{s!==m&&void 0!==s&&f(s)}),[s]),e.createElement(T,{className:null!==r.className?r.className:""},e.createElement(X,{monthName:p[0].monthName,onNextClick:()=>{if("days"===u)return v.slideToTheNextMonth()},onPrevClick:()=>{if("days"===u)return v.slideToPrevMonth()},onClickOnTitle:()=>{d("month"!==u&&"year"!==u?"year":"days")}}),"year"===u?e.createElement(Me,{value:c,onYearSelect:e=>{const t=((e,t)=>{const n=t-parseInt(oe(e,"latn"),10);return n>0?J(e).add(n,"years").toDate():J(e).subtract(Math.abs(n),"years").toDate()})(c,e);y([he(t)]),d("month")}}):null,"month"===u?e.createElement(xe,{value:c,onMonthSelect:e=>{const t=((e,t)=>{const n=t-parseInt(ae(e,"latn"),10);return n>0?J(e).add(n,"months").toDate():J(e).subtract(Math.abs(n),"months").toDate()})(p[0].middleOfMonth,e);y([he(t)]),d("days")}}):null,"days"===u?e.createElement(e.Fragment,null,e.createElement(I,null,ve[o].shortWeekDays.map((t=>e.createElement(V,{key:t.key},t.name)))),e.createElement(L,null,p.map(((t,n)=>e.createElement(N,{key:t.id,className:"item",ref:e=>{g.current[n]=e},role:"rowgroup"},t.weeks.map(((t,n)=>e.createElement(H,{key:n,role:"row","aria-rowindex":n+1},t.map(((t,n)=>e.createElement(ge,Object.assign({key:t.date.getTime(),className:"zm-DaysButton","data-value":t.date,"data-disabled":t.disabled,"data-range":r.range,"data-selected":!l&&ce(m,t.date),"data-start-range":null!=b&&ce(b,t.date),"data-in-range":ue(t.date,b,x),"data-end-range":null!=x&&ce(x,t.date),"data-weekend":null==i?void 0:i.some((e=>e===n)),type:"button",role:"gridcell","aria-colindex":n+1,tabIndex:0,"aria-selected":!l&&ce(c,t.date)},$),e.createElement(ye,{className:"cl-text"},fe(t.date,"DD"))))))))))))):null)};function Ee(t,n){e.useEffect((()=>{function e({target:e}){null==t.current||t.current.contains(e)||n()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[t,n])}De.displayName="Calendar";const Se=(e,t,n)=>`hsl(${e}deg ${t}% ${n}%)`,Ye=e=>{const{h:t,s:n,l:r}=function(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(null==t)throw new Error("Could not parse Hex Color");const n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,o=parseInt(t[3],16)/255,a=Math.max(n,r,o),i=Math.min(n,r,o);let s=(a+i)/2,l=s,c=s;if(a===i)return{h:0,s:0,l:c};const u=a-i;switch(l=c>.5?u/(2-a-i):u/(a+i),a){case n:s=(r-o)/u+(r<o?6:0);break;case r:s=(o-n)/u+2;break;case o:s=(n-r)/u+4}return s/=6,l*=100,l=Math.round(l),c*=100,c=Math.round(c),s=Math.round(360*s),{h:s,s:l,l:c}}(e),o={};return o[40]=Se(t,n,r-10),o[50]=Se(t,n,r),o[85]=Se(t,n,85),o[90]=Se(t,n,90),o[95]=Se(t,n,95),o},_e={0:"#FFFFFF",20:"#F5F5F5",30:"#EBEBEB",40:"#DEDEDE",50:"#BFBFBF",60:"#B0B0B0",70:"#575757",80:"#666666",600:"#2E2E2E"},Ce=t=>{const{accentColor:n=w,locale:o,round:a="thin",direction:i="rtl"}=t;e.useMemo((()=>B.setLocale(o)),[o]);const s={colors:{primary:e.useMemo((()=>Ye(n)),[]),gray:_e},round:a,direction:i};return e.createElement(r.ThemeProvider,{theme:s},t.children)},Oe=n.div`
241
241
  width: 260px;
242
242
  height: 260px;
243
243
  position: relative;
@@ -271,11 +271,11 @@ function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&
271
271
  display: flex;
272
272
  align-items: center;
273
273
  gap: 8px;
274
- `,Ie=n.div`
274
+ `,He=n.div`
275
275
  padding: 4px 8px;
276
276
  border-radius: ${e=>O[e.theme.round].calendarItem}px;
277
277
  background-color: ${e=>e.theme.colors.gray[20]};
278
- `,He=n.div`
278
+ `,Ie=n.div`
279
279
  display: flex;
280
280
  gap: 4px;
281
281
  `,je=n.div`
@@ -315,4 +315,4 @@ function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&
315
315
  border: 1px solid ${e=>e.theme.colors.gray[40]};
316
316
  background-color: #fff;
317
317
  border-radius: ${e=>O[e.theme.round].wrapper}px;
318
- `;exports.Calendar=De,exports.CalendarProvider=Ce,exports.DatePicker=t=>{const{defaultValue:n,locale:r="fa",weekends:o=[],direction:a="rtl",accentColor:i,controlledValue:s}=t;e.useMemo((()=>B.setLocale(r)),[r]);const l=e.useRef(null),c=e.useRef(null),[u,d]=e.useState(void 0!==n?new Date(n):void 0),[m,f]=e.useState(!0===t.range&&void 0!==t.from?new Date(t.from):void 0),[h,p]=e.useState(!0===t.range&&void 0!==t.to?new Date(t.to):void 0),[y,g]=e.useState(!1);e.useEffect((()=>{s&&s!==u&&d(s)}),[s]),Ee(c,(()=>g(!1)));const v=()=>{g(!y)},b=e.useMemo((()=>{var e;const n=null!==(e=null==t?void 0:t.customShowDateFormat)&&void 0!==e?e:ve[r].format;return void 0===t.range&&void 0!==u?fe(u,n):(console.log("from >>",m),void 0!==m&&void 0!==h?`\n ${fe(m,n)}\n -\n ${fe(h,n)}\n `:"")}),[u,m,h]);return e.createElement(Ce,{accentColor:i,round:t.round,direction:a},e.createElement("input",Object.assign({ref:l},null==t?void 0:t.inputAttributes,{onClick:v,type:"text",value:b,className:null!==t.inputClass?t.inputClass:"",readOnly:!0})),e.createElement(C,{toggleOpen:v,showCalendar:y,destinationRef:l,position:t.position},e.createElement(De,{defaultValue:u,ref:c,className:t.className,weekends:o,onChange:e=>{if(!0===t.range&&"function"==typeof t.onChange){const n="from"in e?e.from:new Date,r="to"in e?e.to:new Date;f(n),p(r),t.onChange({from:n,to:r})}else if((!1===t.range||void 0===t.range)&&"function"==typeof t.onChange){const n="value"in e?e.value:new Date;d(n),t.onChange({value:n})}},range:t.range,from:!0===t.range?t.from:void 0,to:!0===t.range?t.to:void 0})))},exports.TimePicker=t=>{const{defaultValue:n,onChange:r,round:o="x2",locale:a="fa",clockTime:i=24}=t;e.useMemo((()=>B.setLocale(a)),[a]);const s=e.useRef(null),l=e.useRef(null),[c,u]=e.useState(!1),[d,m]=e.useState("am");Ee(l,(()=>u(!1)));const f=()=>{u(!c)},{hour:h,minute:p,isInsideHour:y,selectingHour:g,handleMouseMove:v,handleMouseUp:b,handleSelecting:x}=(({defaultValue:t,clockTime:n,timeConvention:r,onChange:o})=>{const a=void 0!==t?J(t):J().startOf("date"),[i,s]=e.useState(!1),[l,c]=e.useState(!1),[u,d]=e.useState(!1),m=24===n?"HH":"h",[f,h]=e.useState(parseInt(a.format(m),10)),[p,y]=e.useState(parseInt(a.format("mm"),10)),g=e=>{const{value:t}=Pe(e,6);y(t)},v=e=>{const{value:t,delta:r}=Pe(e);24!==n?h(t):Math.round(r)<85?(h(t),d(!0)):(h(t+12),d(!1))};return{hour:f,minute:p,isInsideHour:u,selectingHour:l,handleMouseMove:e=>{if(e.preventDefault(),i)return l?v(e):g(e)},handleMouseUp:()=>{if(l)return"function"==typeof o&&o(Object.assign({hour:f,minute:p},12===n&&{timeConvention:r})),s(!1),c(!1),void d(!1);s(!1),c(!0)},handleSelecting:e=>(s(!0),l?v(e):g(e))}})({defaultValue:n,clockTime:i,timeConvention:d,onChange:r}),$=e.useMemo((()=>`${h}:${p}`),[h,p]);return e.createElement(Ce,{accentColor:t.accentColor,round:o},e.createElement("input",Object.assign({ref:s},null==t?void 0:t.inputAttributes,{onClick:f,type:"text",value:$,className:null!==t.inputClass?t.inputClass:"",readOnly:!0})),e.createElement(C,{toggleOpen:f,showCalendar:c,destinationRef:s},e.createElement(qe,{ref:l},e.createElement(Ne,null,12===i?e.createElement(He,null,e.createElement(je,{className:"am"===d?"cl_selected":"",onClick:()=>m("am")},ve[a].am),e.createElement(je,{className:"pm"===d?"cl_selected":"",onClick:()=>m("pm")},ve[a].pm)):null,e.createElement(Ie,null,P(h),":",P(p))),e.createElement(Oe,{onMouseMove:v,onMouseUp:b,onMouseDown:x,onTouchMove:x,onTouchEnd:b},e.createElement(Te,{value:g?h:p,hour:h,minute:p,isSelectingHour:g,isInsideHour:y},e.createElement(Le,{isSelectingHour:g})),e.createElement(Xe,{insideHour:y,hourSelecting:g,clockTime:i})))))};
318
+ `;exports.Calendar=De,exports.CalendarProvider=Ce,exports.DatePicker=t=>{const{defaultValue:n,locale:r="fa",weekends:o=[],direction:a="rtl",accentColor:i,controlledValue:s}=t;e.useMemo((()=>B.setLocale(r)),[r]);const l=e.useRef(null),c=e.useRef(null),[u,d]=e.useState(void 0!==n?new Date(n):void 0),[m,f]=e.useState(!0===t.range&&void 0!==t.from?new Date(t.from):void 0),[h,p]=e.useState(!0===t.range&&void 0!==t.to?new Date(t.to):void 0),[y,g]=e.useState(!1);e.useEffect((()=>{s&&s!==u&&d(s)}),[s]),Ee(c,(()=>g(!1)));const v=()=>{g(!y)},b=e.useMemo((()=>{var e;const n=null!==(e=null==t?void 0:t.customShowDateFormat)&&void 0!==e?e:ve[r].format;return void 0===t.range&&void 0!==u?fe(u,n):(console.log("from >>",m),void 0!==m&&void 0!==h?`\n ${fe(m,n)}\n -\n ${fe(h,n)}\n `:"")}),[u,m,h]);return e.createElement(Ce,{accentColor:i,round:t.round,direction:a},e.createElement("input",Object.assign({ref:l},null==t?void 0:t.inputAttributes,{onClick:v,type:"text",value:b,className:null!==t.inputClass?t.inputClass:"",readOnly:!0})),e.createElement(C,{toggleOpen:v,showCalendar:y,destinationRef:l,position:t.position},e.createElement(De,{defaultValue:u,ref:c,className:t.className,weekends:o,onChange:e=>{if(!0===t.range&&"function"==typeof t.onChange){const n="from"in e?e.from:new Date,r="to"in e?e.to:new Date;f(n),p(r),t.onChange({from:n,to:r})}else if((!1===t.range||void 0===t.range)&&"function"==typeof t.onChange){const n="value"in e?e.value:new Date;d(n),t.onChange({value:n})}},range:t.range,from:!0===t.range?t.from:void 0,to:!0===t.range?t.to:void 0})))},exports.TimePicker=t=>{const{defaultValue:n,onChange:r,round:o="x2",locale:a="fa",clockTime:i=24}=t;e.useMemo((()=>B.setLocale(a)),[a]);const s=e.useRef(null),l=e.useRef(null),[c,u]=e.useState(!1),[d,m]=e.useState("am");Ee(l,(()=>u(!1)));const f=()=>{u(!c)},{hour:h,minute:p,isInsideHour:y,selectingHour:g,handleMouseMove:v,handleMouseUp:b,handleSelecting:x}=(({defaultValue:t,clockTime:n,timeConvention:r,onChange:o})=>{const a=void 0!==t?J(t):J().startOf("date"),[i,s]=e.useState(!1),[l,c]=e.useState(!1),[u,d]=e.useState(!1),m=24===n?"HH":"h",[f,h]=e.useState(parseInt(a.format(m),10)),[p,y]=e.useState(parseInt(a.format("mm"),10)),g=e=>{const{value:t}=Pe(e,6);y(t)},v=e=>{const{value:t,delta:r}=Pe(e);24!==n?h(t):Math.round(r)<85?(h(t),d(!0)):(h(t+12),d(!1))};return{hour:f,minute:p,isInsideHour:u,selectingHour:l,handleMouseMove:e=>{if(e.preventDefault(),i)return l?v(e):g(e)},handleMouseUp:()=>{if(l)return"function"==typeof o&&o(Object.assign({hour:f,minute:p},12===n&&{timeConvention:r})),s(!1),c(!1),void d(!1);s(!1),c(!0)},handleSelecting:e=>(s(!0),l?v(e):g(e))}})({defaultValue:n,clockTime:i,timeConvention:d,onChange:r}),$=e.useMemo((()=>`${h}:${p}`),[h,p]);return e.createElement(Ce,{accentColor:t.accentColor,round:o},e.createElement("input",Object.assign({ref:s},null==t?void 0:t.inputAttributes,{onClick:f,type:"text",value:$,className:null!==t.inputClass?t.inputClass:"",readOnly:!0})),e.createElement(C,{toggleOpen:f,showCalendar:c,destinationRef:s},e.createElement(qe,{ref:l},e.createElement(Ne,null,12===i?e.createElement(Ie,null,e.createElement(je,{className:"am"===d?"cl_selected":"",onClick:()=>m("am")},ve[a].am),e.createElement(je,{className:"pm"===d?"cl_selected":"",onClick:()=>m("pm")},ve[a].pm)):null,e.createElement(He,null,P(h),":",P(p))),e.createElement(Oe,{onMouseMove:v,onMouseUp:b,onMouseDown:x,onTouchMove:x,onTouchEnd:b},e.createElement(Te,{value:g?h:p,hour:h,minute:p,isSelectingHour:g,isInsideHour:y},e.createElement(Le,{isSelectingHour:g})),e.createElement(Xe,{insideHour:y,hourSelecting:g,clockTime:i})))))};
package/dist/index.js CHANGED
@@ -39,7 +39,7 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,useImperativeHan
39
39
  z-index: -10;
40
40
  background-color: rgba(86, 86, 86, 0.4);
41
41
  }
42
- `,I=t=>{const{open:n,toggleOpen:r,children:o}=t;return!1===n?null:e.createElement(e.Fragment,null,i(e.createElement(N,{className:"rdp__modal"},o,e.createElement("div",{"data-testid":"overlay",className:"rdp__overlay",onClick:r})),document.body))},H=t=>{const{position:n="right"}=t;if(!t.showCalendar)return null;const{matches:r}=window.matchMedia("(min-width: 640px)");return r?e.createElement(L,{destinationRef:t.destinationRef,position:n},t.children):e.createElement(I,{toggleOpen:t.toggleOpen,open:t.showCalendar},t.children)};const j={thin:{wrapper:0,calendarItem:0},x1:{wrapper:8,calendarItem:4},x2:{wrapper:16,calendarItem:8},x3:{wrapper:24,calendarItem:16},x4:{wrapper:24,calendarItem:20}},B=s.div`
42
+ `,H=t=>{const{open:n,toggleOpen:r,children:o}=t;return!1===n?null:e.createElement(e.Fragment,null,i(e.createElement(N,{className:"rdp__modal"},o,e.createElement("div",{"data-testid":"overlay",className:"rdp__overlay",onClick:r})),document.body))},I=t=>{const{position:n="right"}=t;if(!t.showCalendar)return null;const{matches:r}=window.matchMedia("(min-width: 640px)");return r?e.createElement(L,{destinationRef:t.destinationRef,position:n},t.children):e.createElement(H,{toggleOpen:t.toggleOpen,open:t.showCalendar},t.children)};const j={thin:{wrapper:0,calendarItem:0},x1:{wrapper:8,calendarItem:4},x2:{wrapper:16,calendarItem:8},x3:{wrapper:24,calendarItem:16},x4:{wrapper:24,calendarItem:20}},B=s.div`
43
43
  overflow: hidden;
44
44
  position: relative;
45
45
  width: ${Y}px;
@@ -237,7 +237,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
237
237
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
238
238
  PERFORMANCE OF THIS SOFTWARE.
239
239
  ***************************************************************************** */
240
- function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(i,["ref"]);const{locale:c}=R,{defaultValue:u,weekends:d,controlledValue:m,range:f=!1}=l,h=void 0===u?new Date:u,[p,y]=o("days"),[g,v]=o(void 0!==u?new Date(u):void 0),b=r((()=>xe(g)),[g]),[x,$]=o([b]),w=t([]),M=(({daysElementRefs:e,days:n,setDays:r})=>{const o=t(!1),a=n[0].middleOfMonth,i=t=>requestAnimationFrame((()=>{o.current=!0;const[n,a]=e.current;n.style.transform=`translateX(${$e()}px)`,a.style.transform=`translateX(${$e()}px)`,requestAnimationFrame((()=>{a.style.transition=`transform 250ms ${_}`,a.style.transform="translateX(0px)",n.style.transition=`transform 250ms ${_}`,n.style.transform="translateX(0px)",setTimeout((()=>{r((e=>e.filter((e=>e.id===t.id)))),n.style.transition=null,n.style.transform=null,o.current=!1}),300)}))})),s=t=>{requestAnimationFrame((()=>{o.current=!0;const[n,a]=e.current;n.style.transition=`transform 250ms ${_}`,n.style.transform=`translateX(${$e()}px)`,a.style.transition=`transform 250ms ${_}`,a.style.transform=`translateX(${$e()}px)`,setTimeout((()=>{r((e=>e.filter((e=>e.id===t.id)))),a.style.transition=null,a.style.transform=null,o.current=!1}),300)}))};return{slideToTheNextMonth:()=>{if(o.current)return;const e=te(a).add(1,"month"),t=xe(e.toDate());r([...n,t]),s(t)},slideToPrevMonth:()=>{if(o.current)return;const e=te(a).subtract(1,"month"),t=xe(e.toDate());r([t,...n]),i(t)},slideToCurrentMonth:()=>{if(o.current)return;const e=le(new Date);console.log(e);const t=te(new Date).subtract(e-1,"days").add(15,"days");console.log("middle of the month",t.toDate());const l=xe(t.toDate());r([...n,l]),te(a).isAfter(t)&&(console.log("we re animating right "),i(l)),te(a.getMonth()).isBefore(t.get("month"))&&(console.log("we re animating left"),s(l))}}})({daysElementRefs:w,days:x,setDays:$}),{from:k,to:D,handlers:E}=Se(l);a(s,(()=>({todayTransitionHandler:()=>M.slideToCurrentMonth()})),[M]),console.log("ref assigned",s);return n((()=>{m!==g&&void 0!==m&&v(m)}),[m]),e.createElement(B,{className:null!==l.className?l.className:""},e.createElement(Q,{monthName:x[0].monthName,onNextClick:()=>{if("days"===p)return M.slideToTheNextMonth()},onPrevClick:()=>{if("days"===p)return M.slideToPrevMonth()},onClickOnTitle:()=>{y("month"!==p&&"year"!==p?"year":"days")}}),"year"===p?e.createElement(_e,{value:h,onYearSelect:e=>{const t=((e,t)=>{const n=t-parseInt(ue(e,"latn"),10);return n>0?te(e).add(n,"years").toDate():te(e).subtract(Math.abs(n),"years").toDate()})(h,e);$([xe(t)]),y("month")}}):null,"month"===p?e.createElement(Ee,{value:h,onMonthSelect:e=>{const t=((e,t)=>{const n=t-parseInt(de(e,"latn"),10);return n>0?te(e).add(n,"months").toDate():te(e).subtract(Math.abs(n),"months").toDate()})(x[0].middleOfMonth,e);$([xe(t)]),y("days")}}):null,"days"===p?e.createElement(e.Fragment,null,e.createElement(z,null,ke[c].shortWeekDays.map((t=>e.createElement(G,{key:t.key},t.name)))),e.createElement(F,null,x.map(((t,n)=>e.createElement(A,{key:t.id,className:"item",ref:e=>{w.current[n]=e},role:"rowgroup"},t.weeks.map(((t,n)=>e.createElement(W,{key:n,role:"row","aria-rowindex":n+1},t.map(((t,n)=>e.createElement(Me,Object.assign({key:t.date.getTime(),className:"zm-DaysButton","data-value":t.date,"data-disabled":t.disabled,"data-range":l.range,"data-selected":!f&&pe(g,t.date),"data-start-range":null!=k&&pe(k,t.date),"data-in-range":ye(t.date,k,D),"data-end-range":null!=D&&pe(D,t.date),"data-weekend":null==d?void 0:d.some((e=>e===n)),type:"button",role:"gridcell","aria-colindex":n+1,tabIndex:0,"aria-selected":!f&&pe(h,t.date)},E),e.createElement(we,{className:"cl-text"},be(t.date,"DD"))))))))))))):null)};function Te(e,t){n((()=>{function n({target:n}){null==e.current||e.current.contains(n)||t()}return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}}),[e,t])}Oe.displayName="Calendar";const Le=(e,t,n)=>`hsl(${e}deg ${t}% ${n}%)`,Ne=e=>{const{h:t,s:n,l:r}=function(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(null==t)throw new Error("Could not parse Hex Color");const n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,o=parseInt(t[3],16)/255,a=Math.max(n,r,o),i=Math.min(n,r,o);let s=(a+i)/2,l=s,c=s;if(a===i)return{h:0,s:0,l:c};const u=a-i;switch(l=c>.5?u/(2-a-i):u/(a+i),a){case n:s=(r-o)/u+(r<o?6:0);break;case r:s=(o-n)/u+2;break;case o:s=(n-r)/u+4}return s/=6,l*=100,l=Math.round(l),c*=100,c=Math.round(c),s=Math.round(360*s),{h:s,s:l,l:c}}(e),o={};return o[40]=Le(t,n,r-10),o[50]=Le(t,n,r),o[85]=Le(t,n,85),o[90]=Le(t,n,90),o[95]=Le(t,n,95),o},Ie={0:"#FFFFFF",20:"#F5F5F5",30:"#EBEBEB",40:"#DEDEDE",50:"#BFBFBF",60:"#B0B0B0",70:"#575757",80:"#666666",600:"#2E2E2E"},He=t=>{const{accentColor:n=C,locale:o,round:a="thin",direction:i="rtl"}=t;r((()=>R.setLocale(o)),[o]);const s={colors:{primary:r((()=>Ne(n)),[]),gray:Ie},round:a,direction:i};return e.createElement(c,{theme:s},t.children)},je=a=>{const{defaultValue:i,locale:s="fa",weekends:l=[],direction:c="rtl",accentColor:u,controlledValue:d}=a;r((()=>R.setLocale(s)),[s]);const m=t(null),f=t(null),[h,p]=o(void 0!==i?new Date(i):void 0),[y,g]=o(!0===a.range&&void 0!==a.from?new Date(a.from):void 0),[v,b]=o(!0===a.range&&void 0!==a.to?new Date(a.to):void 0),[x,$]=o(!1);n((()=>{d&&d!==h&&p(d)}),[d]),Te(f,(()=>$(!1)));const w=()=>{$(!x)},M=r((()=>{var e;const t=null!==(e=null==a?void 0:a.customShowDateFormat)&&void 0!==e?e:ke[s].format;return void 0===a.range&&void 0!==h?be(h,t):(console.log("from >>",y),void 0!==y&&void 0!==v?`\n ${be(y,t)}\n -\n ${be(v,t)}\n `:"")}),[h,y,v]);return e.createElement(He,{accentColor:u,round:a.round,direction:c},e.createElement("input",Object.assign({ref:m},null==a?void 0:a.inputAttributes,{onClick:w,type:"text",value:M,className:null!==a.inputClass?a.inputClass:"",readOnly:!0})),e.createElement(H,{toggleOpen:w,showCalendar:x,destinationRef:m,position:a.position},e.createElement(Oe,{defaultValue:h,ref:f,className:a.className,weekends:l,onChange:e=>{if(!0===a.range&&"function"==typeof a.onChange){const t="from"in e?e.from:new Date,n="to"in e?e.to:new Date;g(t),b(n),a.onChange({from:t,to:n})}else if((!1===a.range||void 0===a.range)&&"function"==typeof a.onChange){const t="value"in e?e.value:new Date;p(t),a.onChange({value:t})}},range:a.range,from:!0===a.range?a.from:void 0,to:!0===a.range?a.to:void 0})))},Be=s.div`
240
+ function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(i,["ref"]);const{locale:c}=R,{defaultValue:u,weekends:d,controlledValue:m,range:f=!1}=l,h=void 0===u?new Date:u,[p,y]=o("days"),[g,v]=o(void 0!==u?new Date(u):void 0),b=r((()=>xe(g)),[g]),[x,$]=o([b]),w=t([]),M=(({daysElementRefs:e,days:n,setDays:r})=>{const o=t(!1),a=n[0].middleOfMonth,i=t=>requestAnimationFrame((()=>{o.current=!0;const[n,a]=e.current;n.style.transform=`translateX(${$e()}px)`,a.style.transform=`translateX(${$e()}px)`,requestAnimationFrame((()=>{a.style.transition=`transform 250ms ${_}`,a.style.transform="translateX(0px)",n.style.transition=`transform 250ms ${_}`,n.style.transform="translateX(0px)",setTimeout((()=>{r((e=>e.filter((e=>e.id===t.id)))),n.style.transition=null,n.style.transform=null,o.current=!1}),300)}))})),s=t=>{requestAnimationFrame((()=>{o.current=!0;const[n,a]=e.current;n.style.transition=`transform 250ms ${_}`,n.style.transform=`translateX(${$e()}px)`,a.style.transition=`transform 250ms ${_}`,a.style.transform=`translateX(${$e()}px)`,setTimeout((()=>{r((e=>e.filter((e=>e.id===t.id)))),a.style.transition=null,a.style.transform=null,o.current=!1}),300)}))};return{slideToTheNextMonth:()=>{if(o.current)return;const e=te(a).add(1,"month"),t=xe(e.toDate());r([...n,t]),s(t)},slideToPrevMonth:()=>{if(o.current)return;const e=te(a).subtract(1,"month"),t=xe(e.toDate());r([t,...n]),i(t)},slideToCurrentMonth:()=>{if(o.current)return;const e=le(new Date);console.log(e);const t=te(new Date).subtract(e-1,"days").add(15,"days");console.log("middle of the month",t.toDate());const l=xe(t.toDate());r([...n,l]),te(a).isAfter(t)&&(console.log("we re animating right "),i(l)),te(a.getMonth()).isBefore(t.get("month"))&&(console.log("we re animating left"),s(l))}}})({daysElementRefs:w,days:x,setDays:$}),{from:k,to:D,handlers:E}=Se(l);a(s,(()=>({todayTransitionHandler:()=>M.slideToCurrentMonth()})),[M]),n((()=>{null!=s&&(s.current={todayTransitionHandler:()=>M.slideToCurrentMonth()})}),[M,s]),console.log("ref assigned",s);return n((()=>{m!==g&&void 0!==m&&v(m)}),[m]),e.createElement(B,{className:null!==l.className?l.className:""},e.createElement(Q,{monthName:x[0].monthName,onNextClick:()=>{if("days"===p)return M.slideToTheNextMonth()},onPrevClick:()=>{if("days"===p)return M.slideToPrevMonth()},onClickOnTitle:()=>{y("month"!==p&&"year"!==p?"year":"days")}}),"year"===p?e.createElement(_e,{value:h,onYearSelect:e=>{const t=((e,t)=>{const n=t-parseInt(ue(e,"latn"),10);return n>0?te(e).add(n,"years").toDate():te(e).subtract(Math.abs(n),"years").toDate()})(h,e);$([xe(t)]),y("month")}}):null,"month"===p?e.createElement(Ee,{value:h,onMonthSelect:e=>{const t=((e,t)=>{const n=t-parseInt(de(e,"latn"),10);return n>0?te(e).add(n,"months").toDate():te(e).subtract(Math.abs(n),"months").toDate()})(x[0].middleOfMonth,e);$([xe(t)]),y("days")}}):null,"days"===p?e.createElement(e.Fragment,null,e.createElement(z,null,ke[c].shortWeekDays.map((t=>e.createElement(G,{key:t.key},t.name)))),e.createElement(F,null,x.map(((t,n)=>e.createElement(A,{key:t.id,className:"item",ref:e=>{w.current[n]=e},role:"rowgroup"},t.weeks.map(((t,n)=>e.createElement(W,{key:n,role:"row","aria-rowindex":n+1},t.map(((t,n)=>e.createElement(Me,Object.assign({key:t.date.getTime(),className:"zm-DaysButton","data-value":t.date,"data-disabled":t.disabled,"data-range":l.range,"data-selected":!f&&pe(g,t.date),"data-start-range":null!=k&&pe(k,t.date),"data-in-range":ye(t.date,k,D),"data-end-range":null!=D&&pe(D,t.date),"data-weekend":null==d?void 0:d.some((e=>e===n)),type:"button",role:"gridcell","aria-colindex":n+1,tabIndex:0,"aria-selected":!f&&pe(h,t.date)},E),e.createElement(we,{className:"cl-text"},be(t.date,"DD"))))))))))))):null)};function Te(e,t){n((()=>{function n({target:n}){null==e.current||e.current.contains(n)||t()}return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}}),[e,t])}Oe.displayName="Calendar";const Le=(e,t,n)=>`hsl(${e}deg ${t}% ${n}%)`,Ne=e=>{const{h:t,s:n,l:r}=function(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(null==t)throw new Error("Could not parse Hex Color");const n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,o=parseInt(t[3],16)/255,a=Math.max(n,r,o),i=Math.min(n,r,o);let s=(a+i)/2,l=s,c=s;if(a===i)return{h:0,s:0,l:c};const u=a-i;switch(l=c>.5?u/(2-a-i):u/(a+i),a){case n:s=(r-o)/u+(r<o?6:0);break;case r:s=(o-n)/u+2;break;case o:s=(n-r)/u+4}return s/=6,l*=100,l=Math.round(l),c*=100,c=Math.round(c),s=Math.round(360*s),{h:s,s:l,l:c}}(e),o={};return o[40]=Le(t,n,r-10),o[50]=Le(t,n,r),o[85]=Le(t,n,85),o[90]=Le(t,n,90),o[95]=Le(t,n,95),o},He={0:"#FFFFFF",20:"#F5F5F5",30:"#EBEBEB",40:"#DEDEDE",50:"#BFBFBF",60:"#B0B0B0",70:"#575757",80:"#666666",600:"#2E2E2E"},Ie=t=>{const{accentColor:n=C,locale:o,round:a="thin",direction:i="rtl"}=t;r((()=>R.setLocale(o)),[o]);const s={colors:{primary:r((()=>Ne(n)),[]),gray:He},round:a,direction:i};return e.createElement(c,{theme:s},t.children)},je=a=>{const{defaultValue:i,locale:s="fa",weekends:l=[],direction:c="rtl",accentColor:u,controlledValue:d}=a;r((()=>R.setLocale(s)),[s]);const m=t(null),f=t(null),[h,p]=o(void 0!==i?new Date(i):void 0),[y,g]=o(!0===a.range&&void 0!==a.from?new Date(a.from):void 0),[v,b]=o(!0===a.range&&void 0!==a.to?new Date(a.to):void 0),[x,$]=o(!1);n((()=>{d&&d!==h&&p(d)}),[d]),Te(f,(()=>$(!1)));const w=()=>{$(!x)},M=r((()=>{var e;const t=null!==(e=null==a?void 0:a.customShowDateFormat)&&void 0!==e?e:ke[s].format;return void 0===a.range&&void 0!==h?be(h,t):(console.log("from >>",y),void 0!==y&&void 0!==v?`\n ${be(y,t)}\n -\n ${be(v,t)}\n `:"")}),[h,y,v]);return e.createElement(Ie,{accentColor:u,round:a.round,direction:c},e.createElement("input",Object.assign({ref:m},null==a?void 0:a.inputAttributes,{onClick:w,type:"text",value:M,className:null!==a.inputClass?a.inputClass:"",readOnly:!0})),e.createElement(I,{toggleOpen:w,showCalendar:x,destinationRef:m,position:a.position},e.createElement(Oe,{defaultValue:h,ref:f,className:a.className,weekends:l,onChange:e=>{if(!0===a.range&&"function"==typeof a.onChange){const t="from"in e?e.from:new Date,n="to"in e?e.to:new Date;g(t),b(n),a.onChange({from:t,to:n})}else if((!1===a.range||void 0===a.range)&&"function"==typeof a.onChange){const t="value"in e?e.value:new Date;p(t),a.onChange({value:t})}},range:a.range,from:!0===a.range?a.from:void 0,to:!0===a.range?a.to:void 0})))},Be=s.div`
241
241
  width: 260px;
242
242
  height: 260px;
243
243
  position: relative;
@@ -315,4 +315,4 @@ function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&
315
315
  border: 1px solid ${e=>e.theme.colors.gray[40]};
316
316
  background-color: #fff;
317
317
  border-radius: ${e=>j[e.theme.round].wrapper}px;
318
- `,tt=n=>{const{defaultValue:a,onChange:i,round:s="x2",locale:l="fa",clockTime:c=24}=n;r((()=>R.setLocale(l)),[l]);const u=t(null),d=t(null),[m,f]=o(!1),[h,p]=o("am");Te(d,(()=>f(!1)));const y=()=>{f(!m)},{hour:g,minute:v,isInsideHour:b,selectingHour:x,handleMouseMove:$,handleMouseUp:w,handleSelecting:M}=(({defaultValue:e,clockTime:t,timeConvention:n,onChange:r})=>{const a=void 0!==e?te(e):te().startOf("date"),[i,s]=o(!1),[l,c]=o(!1),[u,d]=o(!1),m=24===t?"HH":"h",[f,h]=o(parseInt(a.format(m),10)),[p,y]=o(parseInt(a.format("mm"),10)),g=e=>{const{value:t}=Ue(e,6);y(t)},v=e=>{const{value:n,delta:r}=Ue(e);24!==t?h(n):Math.round(r)<85?(h(n),d(!0)):(h(n+12),d(!1))};return{hour:f,minute:p,isInsideHour:u,selectingHour:l,handleMouseMove:e=>{if(e.preventDefault(),i)return l?v(e):g(e)},handleMouseUp:()=>{if(l)return"function"==typeof r&&r(Object.assign({hour:f,minute:p},12===t&&{timeConvention:n})),s(!1),c(!1),void d(!1);s(!1),c(!0)},handleSelecting:e=>(s(!0),l?v(e):g(e))}})({defaultValue:a,clockTime:c,timeConvention:h,onChange:i}),k=r((()=>`${g}:${v}`),[g,v]);return e.createElement(He,{accentColor:n.accentColor,round:s},e.createElement("input",Object.assign({ref:u},null==n?void 0:n.inputAttributes,{onClick:y,type:"text",value:k,className:null!==n.inputClass?n.inputClass:"",readOnly:!0})),e.createElement(H,{toggleOpen:y,showCalendar:m,destinationRef:u},e.createElement(et,{ref:d},e.createElement(We,null,12===c?e.createElement(Pe,null,e.createElement(Re,{className:"am"===h?"cl_selected":"",onClick:()=>p("am")},ke[l].am),e.createElement(Re,{className:"pm"===h?"cl_selected":"",onClick:()=>p("pm")},ke[l].pm)):null,e.createElement(ze,null,X(g),":",X(v))),e.createElement(Be,{onMouseMove:$,onMouseUp:w,onMouseDown:M,onTouchMove:M,onTouchEnd:w},e.createElement(Fe,{value:x?g:v,hour:g,minute:v,isSelectingHour:x,isInsideHour:b},e.createElement(Ae,{isSelectingHour:x})),e.createElement(Ke,{insideHour:b,hourSelecting:x,clockTime:c})))))};export{Oe as Calendar,He as CalendarProvider,je as DatePicker,tt as TimePicker};
318
+ `,tt=n=>{const{defaultValue:a,onChange:i,round:s="x2",locale:l="fa",clockTime:c=24}=n;r((()=>R.setLocale(l)),[l]);const u=t(null),d=t(null),[m,f]=o(!1),[h,p]=o("am");Te(d,(()=>f(!1)));const y=()=>{f(!m)},{hour:g,minute:v,isInsideHour:b,selectingHour:x,handleMouseMove:$,handleMouseUp:w,handleSelecting:M}=(({defaultValue:e,clockTime:t,timeConvention:n,onChange:r})=>{const a=void 0!==e?te(e):te().startOf("date"),[i,s]=o(!1),[l,c]=o(!1),[u,d]=o(!1),m=24===t?"HH":"h",[f,h]=o(parseInt(a.format(m),10)),[p,y]=o(parseInt(a.format("mm"),10)),g=e=>{const{value:t}=Ue(e,6);y(t)},v=e=>{const{value:n,delta:r}=Ue(e);24!==t?h(n):Math.round(r)<85?(h(n),d(!0)):(h(n+12),d(!1))};return{hour:f,minute:p,isInsideHour:u,selectingHour:l,handleMouseMove:e=>{if(e.preventDefault(),i)return l?v(e):g(e)},handleMouseUp:()=>{if(l)return"function"==typeof r&&r(Object.assign({hour:f,minute:p},12===t&&{timeConvention:n})),s(!1),c(!1),void d(!1);s(!1),c(!0)},handleSelecting:e=>(s(!0),l?v(e):g(e))}})({defaultValue:a,clockTime:c,timeConvention:h,onChange:i}),k=r((()=>`${g}:${v}`),[g,v]);return e.createElement(Ie,{accentColor:n.accentColor,round:s},e.createElement("input",Object.assign({ref:u},null==n?void 0:n.inputAttributes,{onClick:y,type:"text",value:k,className:null!==n.inputClass?n.inputClass:"",readOnly:!0})),e.createElement(I,{toggleOpen:y,showCalendar:m,destinationRef:u},e.createElement(et,{ref:d},e.createElement(We,null,12===c?e.createElement(Pe,null,e.createElement(Re,{className:"am"===h?"cl_selected":"",onClick:()=>p("am")},ke[l].am),e.createElement(Re,{className:"pm"===h?"cl_selected":"",onClick:()=>p("pm")},ke[l].pm)):null,e.createElement(ze,null,X(g),":",X(v))),e.createElement(Be,{onMouseMove:$,onMouseUp:w,onMouseDown:M,onTouchMove:M,onTouchEnd:w},e.createElement(Fe,{value:x?g:v,hour:g,minute:v,isSelectingHour:x,isInsideHour:b},e.createElement(Ae,{isSelectingHour:x})),e.createElement(Ke,{insideHour:b,hourSelecting:x,clockTime:c})))))};export{Oe as Calendar,Ie as CalendarProvider,je as DatePicker,tt as TimePicker};
@@ -2,7 +2,7 @@ import React, { type ForwardedRef } from 'react';
2
2
  import type { CalendarProps } from './Calendar.types';
3
3
  declare const Calendar: {
4
4
  ({ ref, ...props }: CalendarProps & {
5
- ref: ForwardedRef<{
5
+ ref?: ForwardedRef<{
6
6
  todayTransitionHandler: () => void;
7
7
  }>;
8
8
  }): React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zaman-backoffice",
3
- "version": "1.2.5",
3
+ "version": "1.2.6",
4
4
  "description": "thanks to the zaman team. just needed to add the ability to have a controlled input value",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {