@sonygrg/nepali-datepicker 1.0.2 → 1.0.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.
|
@@ -3,4 +3,4 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=(e,t)=>
|
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),x=e(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=y():t.exports=b()}))(),S=[`Baisakh`,`Jestha`,`Asar`,`Shrawan`,`Bhadra`,`Aswin`,`Kartik`,`Mangsir`,`Poush`,`Magh`,`Falgun`,`Chaitra`];function C({onSelectDate:e,selectDate:n}){let[o,s]=(0,r.useState)(()=>n?.year??2083),[c,l]=(0,r.useState)(()=>n?.month??1);(0,r.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>{s(n.year),l(n.month)},0);return()=>clearTimeout(e)},[n]);let u=Object.keys(i).map(Number),d=i[String(o)]?.[S[c-1]]??30,p=f(o,c),m=()=>{c===1?(l(12),s(e=>e-1)):l(e=>e-1)},g=()=>{c===12?(l(1),s(e=>e+1)):l(e=>e+1)},_=o===2e3&&c===1,v=o===2090&&c===12,y=[...Array(p).fill(null),...Array.from({length:d},(e,t)=>t+1)];return(0,x.jsxs)(t.Card,{sx:{p:`20px`,display:`flex`,flexDirection:`column`,gap:`10px`},children:[(0,x.jsxs)(t.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`4px`,mb:`8px`},children:[(0,x.jsx)(t.IconButton,{onClick:m,disabled:_,children:`‹`}),(0,x.jsx)(t.Select,{value:o,onChange:e=>{s(Number(e.target.value))},size:`small`,MenuProps:{slotProps:{paper:{sx:{maxHeight:250}}}},sx:{minWidth:90},children:u.map(e=>(0,x.jsx)(t.MenuItem,{value:e,children:h(e)},e))}),(0,x.jsx)(t.Select,{value:c,onChange:e=>l(Number(e.target.value)),MenuProps:{slotProps:{paper:{sx:{maxHeight:250}}}},sx:{minWidth:90},size:`small`,children:a.month.long.map((e,n)=>(0,x.jsx)(t.MenuItem,{value:n+1,children:e},e))}),(0,x.jsx)(t.IconButton,{onClick:g,disabled:v,children:`›`})]}),(0,x.jsxs)(t.Box,{sx:{display:`grid`,gridTemplateColumns:`repeat(7, 1fr)`,textAlign:`center`,gap:2},children:[a.day.short.map(e=>(0,x.jsx)(t.Box,{children:(0,x.jsx)(t.Typography,{variant:`caption`,sx:{fontSize:`14px`},children:e})},e)),y.map((r,i)=>{let a=n&&n.day===r&&n.month===c&&n.year===o;return(0,x.jsx)(t.Box,{children:r&&(0,x.jsx)(t.Box,{onClick:()=>{e({year:o,month:c,day:r})},sx:{cursor:`pointer`,bgcolor:a?`primary.main`:`transparent`,color:a?`#fff`:`text.primary`,borderRadius:`50%`,height:`32px`,width:`32px`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:h(r)})},i)})]})]})}var w=[`Baisakh`,`Jestha`,`Asar`,`Shrawan`,`Bhadra`,`Aswin`,`Kartik`,`Mangsir`,`Poush`,`Magh`,`Falgun`,`Chaitra`];function T(e){let t=_(e).split(`/`);if(t.length!==3||t[0].length!==4)return null;let n=parseInt(t[0],10),r=parseInt(t[1],10),a=parseInt(t[2],10);if(isNaN(n)||isNaN(r)||isNaN(a))return null;let o=i[String(n)]?.[w[r-1]];return!o||r<1||r>12||a<1||a>o?null:{year:n,month:r,day:a}}function E(){let[e,i]=(0,r.useState)(null),[a,o]=(0,r.useState)(null),[s,c]=(0,r.useState)(``),l=(0,r.useRef)(null),u=(0,r.useRef)(null),d=(0,r.useRef)(null),f=()=>{let e=T(s);e?(o(e),console.log(`Selected Date:`,g(e))):s&&o(null),c(``)};return(0,r.useLayoutEffect)(()=>{u.current&&d.current!==null&&u.current.setSelectionRange(d.current,d.current)},[s]),(0,x.jsx)(`div`,{children:(0,x.jsxs)(t.Box,{sx:{m:`0px`},children:[(0,x.jsx)(t.Box,{ref:l,children:(0,x.jsx)(t.TextField,{label:a?``:`मिति छान्नुहोस् `,size:`small`,value:s?v(s):a?g(a):``,placeholder:` YYYY/MM/DD`,onChange:e=>{let t=e.target,n=t.selectionStart??0,r=_(t.value);r=r.split(``).filter(e=>e>=`0`&&e<=`9`||e===`/`).join(``);let i=r.length;(r.length===4&&!r.includes(`/`)||r.length===7&&r.split(`/`).length===2)&&(r+=`/`),r.length>i&&n===i&&(n+=1),d.current=n,c(r.slice(0,10))},onFocus:()=>{if(a&&!s){let e=a.year;c(`${e}/${String(a.month).padStart(2,`0`)}/${String(a.day).padStart(2,`0`)}`)}},onBlur:f,onKeyDown:e=>{e.key===`Enter`&&f()},slotProps:{input:{inputRef:u,sx:{pl:`8px`,fontSize:`18px`},endAdornment:(0,x.jsx)(t.InputAdornment,{position:`end`,children:(0,x.jsx)(t.IconButton,{onClick:()=>i(l.current),children:(0,x.jsx)(n.CalendarIcon,{})})})}}})}),(0,x.jsx)(t.Popover,{open:!!e,anchorEl:e,onClose:()=>i(null),anchorOrigin:{vertical:`bottom`,horizontal:`left`},children:(0,x.jsx)(C,{selectDate:a,onSelectDate:e=>{o(e),c(``),i(null),console.log(`Selected Date:`,g(e))}})})]})})}exports.InputCalendar=E;
|
|
6
|
+
<%s key={someKey} {...props} />`,o,p,m,p),L[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===E&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=require("react"),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.client.reference`),k=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,A=Object.prototype.hasOwnProperty,j=Array.isArray,M=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var N,P={},F=m.react_stack_bottom_frame.bind(m,o)(),I=M(i(o)),L={};e.Fragment=_,e.jsx=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)},e.jsxs=function(e,t,n){var r=1e4>k.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):F,r?M(i(e)):I)}})()})),x=e(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=y():t.exports=b()}))(),S=[`Baisakh`,`Jestha`,`Asar`,`Shrawan`,`Bhadra`,`Aswin`,`Kartik`,`Mangsir`,`Poush`,`Magh`,`Falgun`,`Chaitra`];function C({onSelectDate:e,selectDate:n}){let[o,s]=(0,r.useState)(()=>n?.year??2083),[c,l]=(0,r.useState)(()=>n?.month??1);(0,r.useEffect)(()=>{if(!n)return;let e=setTimeout(()=>{s(n.year),l(n.month)},0);return()=>clearTimeout(e)},[n]);let u=Object.keys(i).map(Number),d=i[String(o)]?.[S[c-1]]??30,p=f(o,c),m=()=>{c===1?(l(12),s(e=>e-1)):l(e=>e-1)},g=()=>{c===12?(l(1),s(e=>e+1)):l(e=>e+1)},_=o===2e3&&c===1,v=o===2090&&c===12,y=[...Array(p).fill(null),...Array.from({length:d},(e,t)=>t+1)];return(0,x.jsxs)(t.Card,{sx:{p:`20px`,display:`flex`,flexDirection:`column`,gap:`10px`},children:[(0,x.jsxs)(t.Box,{sx:{display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`4px`,mb:`8px`},children:[(0,x.jsx)(t.IconButton,{onClick:m,disabled:_,children:`‹`}),(0,x.jsx)(t.Select,{value:o,onChange:e=>{s(Number(e.target.value))},size:`small`,MenuProps:{slotProps:{paper:{sx:{maxHeight:250}}}},sx:{minWidth:90},children:u.map(e=>(0,x.jsx)(t.MenuItem,{value:e,children:h(e)},e))}),(0,x.jsx)(t.Select,{value:c,onChange:e=>l(Number(e.target.value)),MenuProps:{slotProps:{paper:{sx:{maxHeight:250}}}},sx:{minWidth:90},size:`small`,children:a.month.long.map((e,n)=>(0,x.jsx)(t.MenuItem,{value:n+1,children:e},e))}),(0,x.jsx)(t.IconButton,{onClick:g,disabled:v,children:`›`})]}),(0,x.jsxs)(t.Box,{sx:{display:`grid`,gridTemplateColumns:`repeat(7, 1fr)`,textAlign:`center`,gap:2},children:[a.day.short.map(e=>(0,x.jsx)(t.Box,{children:(0,x.jsx)(t.Typography,{variant:`caption`,sx:{fontSize:`14px`},children:e})},e)),y.map((r,i)=>{let a=n&&n.day===r&&n.month===c&&n.year===o;return(0,x.jsx)(t.Box,{children:r&&(0,x.jsx)(t.Box,{onClick:()=>{e({year:o,month:c,day:r})},sx:{cursor:`pointer`,bgcolor:a?`primary.main`:`transparent`,color:a?`#fff`:`text.primary`,borderRadius:`50%`,height:`32px`,width:`32px`,display:`flex`,justifyContent:`center`,alignItems:`center`},children:h(r)})},i)})]})]})}var w=[`Baisakh`,`Jestha`,`Asar`,`Shrawan`,`Bhadra`,`Aswin`,`Kartik`,`Mangsir`,`Poush`,`Magh`,`Falgun`,`Chaitra`];function T(e){let t=_(e).split(`/`);if(t.length!==3||t[0].length!==4)return null;let n=parseInt(t[0],10),r=parseInt(t[1],10),a=parseInt(t[2],10);if(isNaN(n)||isNaN(r)||isNaN(a))return null;let o=i[String(n)]?.[w[r-1]];return!o||r<1||r>12||a<1||a>o?null:{year:n,month:r,day:a}}function E(){let[e,i]=(0,r.useState)(null),[a,o]=(0,r.useState)(null),[s,c]=(0,r.useState)(``),l=(0,r.useRef)(null),u=(0,r.useRef)(null),d=(0,r.useRef)(null),f=()=>{let e=T(s);e?(o(e),console.log(`Selected Date:`,g(e))):s&&o(null),c(``)};return(0,r.useLayoutEffect)(()=>{u.current&&d.current!==null&&u.current.setSelectionRange(d.current,d.current)},[s]),(0,x.jsx)(`div`,{children:(0,x.jsxs)(t.Box,{sx:{m:`0px`},children:[(0,x.jsx)(t.Box,{ref:l,children:(0,x.jsx)(t.TextField,{label:a?``:`मिति छान्नुहोस् `,size:`small`,sx:{" .MuiInputBase-input":{height:`20px`},maxWidth:`250px`},value:s?v(s):a?g(a):``,placeholder:` YYYY/MM/DD`,onChange:e=>{let t=e.target,n=t.selectionStart??0,r=_(t.value);r=r.split(``).filter(e=>e>=`0`&&e<=`9`||e===`/`).join(``);let i=r.length;(r.length===4&&!r.includes(`/`)||r.length===7&&r.split(`/`).length===2)&&(r+=`/`),r.length>i&&n===i&&(n+=1),d.current=n,c(r.slice(0,10))},onFocus:()=>{if(a&&!s){let e=a.year;c(`${e}/${String(a.month).padStart(2,`0`)}/${String(a.day).padStart(2,`0`)}`)}},onBlur:f,onKeyDown:e=>{e.key===`Enter`&&f()},slotProps:{input:{inputRef:u,sx:{pl:`8px`,fontSize:`18px`},endAdornment:(0,x.jsx)(t.InputAdornment,{position:`end`,children:(0,x.jsx)(t.IconButton,{onClick:()=>i(l.current),children:(0,x.jsx)(n.CalendarIcon,{})})})}}})}),(0,x.jsx)(t.Popover,{open:!!e,anchorEl:e,onClose:()=>i(null),anchorOrigin:{vertical:`bottom`,horizontal:`left`},children:(0,x.jsx)(C,{selectDate:a,onSelectDate:e=>{o(e),c(``),i(null),console.log(`Selected Date:`,g(e))}})})]})})}exports.InputCalendar=E;
|
|
@@ -1759,6 +1759,10 @@ function z() {
|
|
|
1759
1759
|
children: /* @__PURE__ */ (0, P.jsx)(s, {
|
|
1760
1760
|
label: o ? "" : "मिति छान्नुहोस् ",
|
|
1761
1761
|
size: "small",
|
|
1762
|
+
sx: {
|
|
1763
|
+
" .MuiInputBase-input": { height: "20px" },
|
|
1764
|
+
maxWidth: "250px"
|
|
1765
|
+
},
|
|
1762
1766
|
value: u ? A(u) : o ? O(o) : "",
|
|
1763
1767
|
placeholder: " YYYY/MM/DD",
|
|
1764
1768
|
onChange: (e) => {
|