infinite-scroll-calendar 0.1.0 → 0.1.1
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 +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +596 -560
- package/dist/index.js.map +1 -1
- package/dist/stories/Calendar.stories.d.ts +28 -0
- package/dist/style.css +1 -1
- package/dist/types.d.ts +3 -1
- package/package.json +14 -2
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react"),Y=require("date-fns");var H={exports:{}},V={};var
|
|
2
|
-
`+
|
|
3
|
-
`),S=
|
|
4
|
-
`),
|
|
5
|
-
`+
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react"),Y=require("date-fns");var H={exports:{}},V={};var De;function _r(){if(De)return V;De=1;var t=P,o=Symbol.for("react.element"),l=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function s(v,m,i){var b,g={},E=null,T=null;i!==void 0&&(E=""+i),m.key!==void 0&&(E=""+m.key),m.ref!==void 0&&(T=m.ref);for(b in m)c.call(m,b)&&!d.hasOwnProperty(b)&&(g[b]=m[b]);if(v&&v.defaultProps)for(b in m=v.defaultProps,m)g[b]===void 0&&(g[b]=m[b]);return{$$typeof:o,type:v,key:E,ref:T,props:g,_owner:a.current}}return V.Fragment=l,V.jsx=s,V.jsxs=s,V}var $={};var Me;function gr(){return Me||(Me=1,process.env.NODE_ENV!=="production"&&(function(){var t=P,o=Symbol.for("react.element"),l=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),v=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),i=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),g=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),T=Symbol.for("react.offscreen"),w=Symbol.iterator,k="@@iterator";function G(e){if(e===null||typeof e!="object")return null;var r=w&&e[w]||e[k];return typeof r=="function"?r:null}var C=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(e){{for(var r=arguments.length,n=new Array(r>1?r-1:0),u=1;u<r;u++)n[u-1]=arguments[u];B("error",e,n)}}function B(e,r,n){{var u=C.ReactDebugCurrentFrame,h=u.getStackAddendum();h!==""&&(r+="%s",n=n.concat([h]));var _=n.map(function(y){return String(y)});_.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,_)}}var We=!1,Ve=!1,$e=!1,Ye=!1,Be=!1,le;le=Symbol.for("react.module.reference");function qe(e){return!!(typeof e=="string"||typeof e=="function"||e===c||e===d||Be||e===a||e===i||e===b||Ye||e===T||We||Ve||$e||typeof e=="object"&&e!==null&&(e.$$typeof===E||e.$$typeof===g||e.$$typeof===s||e.$$typeof===v||e.$$typeof===m||e.$$typeof===le||e.getModuleId!==void 0))}function Ue(e,r,n){var u=e.displayName;if(u)return u;var h=r.displayName||r.name||"";return h!==""?n+"("+h+")":n}function ce(e){return e.displayName||"Context"}function D(e){if(e==null)return null;if(typeof e.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case c:return"Fragment";case l:return"Portal";case d:return"Profiler";case a:return"StrictMode";case i:return"Suspense";case b:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case v:var r=e;return ce(r)+".Consumer";case s:var n=e;return ce(n._context)+".Provider";case m:return Ue(e,e.render,"ForwardRef");case g:var u=e.displayName||null;return u!==null?u:D(e.type)||"Memo";case E:{var h=e,_=h._payload,y=h._init;try{return D(y(_))}catch{return null}}}return null}var M=Object.assign,A=0,ue,de,fe,ve,me,pe,ye;function he(){}he.__reactDisabledLog=!0;function Ke(){{if(A===0){ue=console.log,de=console.info,fe=console.warn,ve=console.error,me=console.group,pe=console.groupCollapsed,ye=console.groupEnd;var e={configurable:!0,enumerable:!0,value:he,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}A++}}function Je(){{if(A--,A===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},e,{value:ue}),info:M({},e,{value:de}),warn:M({},e,{value:fe}),error:M({},e,{value:ve}),group:M({},e,{value:me}),groupCollapsed:M({},e,{value:pe}),groupEnd:M({},e,{value:ye})})}A<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var X=C.ReactCurrentDispatcher,Z;function q(e,r,n){{if(Z===void 0)try{throw Error()}catch(h){var u=h.stack.trim().match(/\n( *(at )?)/);Z=u&&u[1]||""}return`
|
|
2
|
+
`+Z+e}}var z=!1,U;{var He=typeof WeakMap=="function"?WeakMap:Map;U=new He}function be(e,r){if(!e||z)return"";{var n=U.get(e);if(n!==void 0)return n}var u;z=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var _;_=X.current,X.current=null,Ke();try{if(r){var y=function(){throw Error()};if(Object.defineProperty(y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(y,[])}catch(N){u=N}Reflect.construct(e,[],y)}else{try{y.call()}catch(N){u=N}e.call(y.prototype)}}else{try{throw Error()}catch(N){u=N}e()}}catch(N){if(N&&u&&typeof N.stack=="string"){for(var p=N.stack.split(`
|
|
3
|
+
`),S=u.stack.split(`
|
|
4
|
+
`),x=p.length-1,R=S.length-1;x>=1&&R>=0&&p[x]!==S[R];)R--;for(;x>=1&&R>=0;x--,R--)if(p[x]!==S[R]){if(x!==1||R!==1)do if(x--,R--,R<0||p[x]!==S[R]){var O=`
|
|
5
|
+
`+p[x].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&U.set(e,O),O}while(x>=1&&R>=0);break}}}finally{z=!1,X.current=_,Je(),Error.prepareStackTrace=h}var I=e?e.displayName||e.name:"",L=I?q(I):"";return typeof e=="function"&&U.set(e,L),L}function Ge(e,r,n){return be(e,!1)}function Xe(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function K(e,r,n){if(e==null)return"";if(typeof e=="function")return be(e,Xe(e));if(typeof e=="string")return q(e);switch(e){case i:return q("Suspense");case b:return q("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case m:return Ge(e.render);case g:return K(e.type,r,n);case E:{var u=e,h=u._payload,_=u._init;try{return K(_(h),r,n)}catch{}}}return""}var W=Object.prototype.hasOwnProperty,_e={},ge=C.ReactDebugCurrentFrame;function J(e){if(e){var r=e._owner,n=K(e.type,e._source,r?r.type:null);ge.setExtraStackFrame(n)}else ge.setExtraStackFrame(null)}function Ze(e,r,n,u,h){{var _=Function.call.bind(W);for(var y in e)if(_(e,y)){var p=void 0;try{if(typeof e[y]!="function"){var S=Error((u||"React class")+": "+n+" type `"+y+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[y]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw S.name="Invariant Violation",S}p=e[y](r,y,u,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(x){p=x}p&&!(p instanceof Error)&&(J(h),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",u||"React class",n,y,typeof p),J(null)),p instanceof Error&&!(p.message in _e)&&(_e[p.message]=!0,J(h),j("Failed %s type: %s",n,p.message),J(null))}}}var ze=Array.isArray;function Q(e){return ze(e)}function Qe(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,n=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function er(e){try{return ke(e),!1}catch{return!0}}function ke(e){return""+e}function xe(e){if(er(e))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Qe(e)),ke(e)}var Re=C.ReactCurrentOwner,rr={key:!0,ref:!0,__self:!0,__source:!0},Ee,je;function tr(e){if(W.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function nr(e){if(W.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function ar(e,r){typeof e.ref=="string"&&Re.current}function or(e,r){{var n=function(){Ee||(Ee=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function sr(e,r){{var n=function(){je||(je=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var ir=function(e,r,n,u,h,_,y){var p={$$typeof:o,type:e,key:r,ref:n,props:y,_owner:_};return p._store={},Object.defineProperty(p._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(p,"_self",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.defineProperty(p,"_source",{configurable:!1,enumerable:!1,writable:!1,value:h}),Object.freeze&&(Object.freeze(p.props),Object.freeze(p)),p};function lr(e,r,n,u,h){{var _,y={},p=null,S=null;n!==void 0&&(xe(n),p=""+n),nr(r)&&(xe(r.key),p=""+r.key),tr(r)&&(S=r.ref,ar(r,h));for(_ in r)W.call(r,_)&&!rr.hasOwnProperty(_)&&(y[_]=r[_]);if(e&&e.defaultProps){var x=e.defaultProps;for(_ in x)y[_]===void 0&&(y[_]=x[_])}if(p||S){var R=typeof e=="function"?e.displayName||e.name||"Unknown":e;p&&or(y,R),S&&sr(y,R)}return ir(e,p,S,h,u,Re.current,y)}}var ee=C.ReactCurrentOwner,we=C.ReactDebugCurrentFrame;function F(e){if(e){var r=e._owner,n=K(e.type,e._source,r?r.type:null);we.setExtraStackFrame(n)}else we.setExtraStackFrame(null)}var re;re=!1;function te(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function Se(){{if(ee.current){var e=D(ee.current.type);if(e)return`
|
|
6
6
|
|
|
7
|
-
Check the render method of \``+e+"`."}return""}}function cr(e){return""}var
|
|
7
|
+
Check the render method of \``+e+"`."}return""}}function cr(e){return""}var Ne={};function ur(e){{var r=Se();if(!r){var n=typeof e=="string"?e:e.displayName||e.name;n&&(r=`
|
|
8
8
|
|
|
9
|
-
Check the top-level render call using <`+
|
|
9
|
+
Check the top-level render call using <`+n+">.")}return r}}function Te(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=ur(r);if(Ne[n])return;Ne[n]=!0;var u="";e&&e._owner&&e._owner!==ee.current&&(u=" It was passed a child from "+D(e._owner.type)+"."),F(e),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,u),F(null)}}function Ce(e,r){{if(typeof e!="object")return;if(Q(e))for(var n=0;n<e.length;n++){var u=e[n];te(u)&&Te(u,r)}else if(te(e))e._store&&(e._store.validated=!0);else if(e){var h=G(e);if(typeof h=="function"&&h!==e.entries)for(var _=h.call(e),y;!(y=_.next()).done;)te(y.value)&&Te(y.value,r)}}}function dr(e){{var r=e.type;if(r==null||typeof r=="string")return;var n;if(typeof r=="function")n=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===m||r.$$typeof===g))n=r.propTypes;else return;if(n){var u=D(r);Ze(n,e.props,"prop",u,e)}else if(r.PropTypes!==void 0&&!re){re=!0;var h=D(r);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",h||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function fr(e){{for(var r=Object.keys(e.props),n=0;n<r.length;n++){var u=r[n];if(u!=="children"&&u!=="key"){F(e),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",u),F(null);break}}e.ref!==null&&(F(e),j("Invalid attribute `ref` supplied to `React.Fragment`."),F(null))}}var Oe={};function Pe(e,r,n,u,h,_){{var y=qe(e);if(!y){var p="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(p+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var S=cr();S?p+=S:p+=Se();var x;e===null?x="null":Q(e)?x="array":e!==void 0&&e.$$typeof===o?(x="<"+(D(e.type)||"Unknown")+" />",p=" Did you accidentally export a JSX literal instead of a component?"):x=typeof e,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",x,p)}var R=lr(e,r,n,h,_);if(R==null)return R;if(y){var O=r.children;if(O!==void 0)if(u)if(Q(O)){for(var I=0;I<O.length;I++)Ce(O[I],e);Object.freeze&&Object.freeze(O)}else j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ce(O,e)}if(W.call(r,"key")){var L=D(e),N=Object.keys(r).filter(function(br){return br!=="key"}),ne=N.length>0?"{key: someKey, "+N.join(": ..., ")+": ...}":"{key: someKey}";if(!Oe[L+ne]){var hr=N.length>0?"{"+N.join(": ..., ")+": ...}":"{}";j(`A props object containing a "key" prop is being spread into JSX:
|
|
10
10
|
let props = %s;
|
|
11
11
|
<%s {...props} />
|
|
12
12
|
React keys must be passed directly to JSX without using spread:
|
|
13
13
|
let props = %s;
|
|
14
|
-
<%s key={someKey} {...props} />`,
|
|
14
|
+
<%s key={someKey} {...props} />`,ne,L,hr,L),Oe[L+ne]=!0}}return e===c?fr(R):dr(R),R}}function vr(e,r,n){return Pe(e,r,n,!0)}function mr(e,r,n){return Pe(e,r,n,!1)}var pr=mr,yr=vr;$.Fragment=c,$.jsx=pr,$.jsxs=yr})()),$}var Le;function kr(){return Le||(Le=1,process.env.NODE_ENV==="production"?H.exports=_r():H.exports=gr()),H.exports}var f=kr();function xr(t){return!t||!t.hasContent?!1:t.hasUncompletedTodo?"primary":"secondary"}function Fe(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()}function se(t){const{key:o,value:l,selectionEnabled:c=!0,metadata:a,outside:d=!1,date:s}=t,v=c&&l.key===o,m=!!s&&Y.isToday(s),i=!!s&&!d&&!m&&Fe(s)<Fe(new Date);return{indicator:d?!1:xr(a?.[o]),selected:v,today:m,past:i}}function Rr(t,o){if(t.length===0)return{beforeRows:[],activeRows:[],afterRows:[]};if(o.kind==="month"){const c=t.findIndex(d=>d.some(s=>s.kind==="day"&&s.today)),a=c>=0?c:0;return{beforeRows:t.slice(0,a),activeRows:[t[a]],afterRows:t.slice(a+1)}}const l=t.findIndex(c=>c.some(a=>a.value===o.key));return l<0?{beforeRows:[],activeRows:t,afterRows:[]}:{beforeRows:t.slice(0,l),activeRows:[t[l]],afterRows:t.slice(l+1)}}function Er(t){return typeof t.month=="number"?Y.format(new Date(t.year,t.month-1,1),"LLLL"):t.weekKey??t.id}function jr(t,o,l=!0,c){return t.items.map(a=>{if(a.kind==="marker"){const v=se({key:a.meta?.weekKey??a.id,value:o,selectionEnabled:l,metadata:c});return{kind:"week",key:a.id,label:a.meta?.weekNumber??0,value:a.meta?.weekKey??a.id,weekNumber:a.meta?.weekNumber??0,selected:v.selected,indicator:v.indicator}}const d=a,s=se({key:d.dayKey,value:o,selectionEnabled:l,metadata:c,outside:!d.inMonth,date:d.date});return{kind:"day",key:d.dayKey,label:d.date.getDate(),value:d.dayKey,date:d.date,today:s.today,past:s.past,selected:s.selected,outside:!d.inMonth,indicator:s.indicator}})}function wr(t){const{data:o,value:l,selectionEnabled:c=!0,metadata:a,expanded:d}=t;return{expanded:d,sections:o.map(s=>{const v=s.rows.map(g=>jr(g,l,c,a)),m=Rr(v,l),i=s.monthKey??s.id,b=se({key:i,value:l,selectionEnabled:c,metadata:a}).indicator;return{key:s.id,monthLabel:Er(s),monthValue:i,year:s.year,month:s.month,selected:l.kind==="month"&&l.key===i,indicator:b,...m}})}}function Sr(t){if(t){if(t.kind==="month")return t.key;if(t.kind==="day")return t.key.slice(0,7);if(t.kind==="week")return Y.format(Y.startOfISOWeek(Y.parseISO(t.key)),"yyyy-MM")}}function Nr(t){const{value:o,defaultValue:l,onValueChange:c,expanded:a,defaultExpanded:d=!1,onExpandedChange:s}=t,[v,m]=P.useState(l??{kind:"month",key:""}),[i,b]=P.useState(d),g=o??v,E=a??i,T=P.useCallback(k=>{o===void 0&&m(k),c?.(k)},[o,c]),w=P.useCallback(k=>{a===void 0&&b(k),s?.(k)},[a,s]);return P.useMemo(()=>({value:g,setValue:T,expanded:E,setExpanded:w}),[E,w,T,g])}const Tr="_root_tqemw_1",Ie="_toggle_tqemw_54",Cr="_root_1ho1n_1",Or="_section_1ho1n_7",Pr="_row_1ho1n_20",Dr="_root_1cwda_1",Mr="_inner_1cwda_12";function ae(t){const{expanded:o,className:l,children:c}=t;return f.jsx("div",{className:[Dr,l].filter(Boolean).join(" "),"data-expanded":o,"aria-hidden":!o,children:f.jsx("div",{className:Mr,children:c})})}const Lr="_cell_1dky2_1",Fr="_marker_1dky2_19",Ir="_label_1dky2_34",Ar="_indicator_1dky2_74";function Wr(t){const{label:o,className:l,selected:c,today:a,past:d,outside:s,indicator:v,onSelect:m}=t,i=s?void 0:m;return f.jsx("button",{type:"button",className:[Lr,l].filter(Boolean).join(" "),"data-selected":c,"data-today":a,"data-outside":s,"data-past":d,"aria-disabled":s||void 0,tabIndex:s?-1:void 0,onClick:i,children:f.jsxs("span",{className:Fr,"data-selected":c,"data-today":a,"data-past":d,children:[f.jsx("span",{className:Ir,children:o}),v&&f.jsx("span",{className:Ar,"data-indicator":v})]})})}const Vr="_root_1q0yp_1",$r="_chevron_1q0yp_22",Yr="_title_1q0yp_37",Br="_indicator_1q0yp_55";function qr(t){const{label:o,className:l,selected:c,isActive:a,indicator:d,onSelect:s}=t;return f.jsxs("button",{type:"button",className:[Vr,l].filter(Boolean).join(" "),"data-kind":"month","data-selected":c,"data-active":a,onClick:s,children:[f.jsx("span",{className:Yr,children:o}),f.jsx("svg",{className:$r,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:f.jsx("path",{d:"M6 4l4 4-4 4"})}),d&&f.jsx("span",{className:Br,"data-indicator":d})]})}const Ur="_root_1c4iq_1",Kr="_content_1c4iq_38",Jr="_label_1c4iq_48",Hr="_indicator_1c4iq_65";function Gr(t){const{label:o,className:l,selected:c,indicator:a,onSelect:d}=t;return f.jsx("button",{type:"button",className:[Ur,l].filter(Boolean).join(" "),"data-selected":c,onClick:d,children:f.jsxs("span",{className:Kr,children:[f.jsx("span",{className:Jr,children:o}),a&&f.jsx("span",{className:Hr,"data-indicator":a})]})})}const Xr="_root_1ckvi_1",Zr="_weekNumberMarker_1ckvi_22",zr="_border_1ckvi_33",Qr="_root_1ocjv_1";function et({label:t,className:o}){return f.jsx("span",{className:[Qr,o].filter(Boolean).join(" "),children:t})}const rt=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function tt(t){const{labels:o=rt,scrolled:l,className:c,dayNameClassName:a}=t;return f.jsxs("div",{className:[Xr,c].filter(Boolean).join(" "),children:[f.jsx("span",{className:Zr,children:"#"}),o.map((d,s)=>f.jsx(et,{label:d,className:a},`weekday-${s}`)),f.jsx("div",{className:zr,"data-visible":!!l})]})}const nt=["Mon","Tue","Wed","Thu","Fri","Sat","Sun"];function ie(...t){return t.filter(Boolean).join(" ")||void 0}function at(t,o,l,c){if(t.kind==="week"){const v=t,m=o?.formatters?.weekLabel?.(v)??v.label,i=o?.slots?.week;return i?f.jsx(i,{item:v,label:m,className:o?.classNames?.week,onSelect:()=>c?.(v.value)},v.key):f.jsx(Gr,{label:m,className:o?.classNames?.week,selected:v.selected,indicator:v.indicator,onSelect:()=>c?.(v.value)},v.key)}const a=t,d=o?.formatters?.dayLabel?.(a)??a.label,s=o?.slots?.day;return s?f.jsx(s,{item:a,label:d,className:o?.classNames?.day,onSelect:()=>l?.(a.value)},a.key):f.jsx(Wr,{label:d,className:o?.classNames?.day,selected:a.selected,today:a.today,past:a.past,outside:a.outside,indicator:a.indicator,onSelect:()=>l?.(a.value)},a.key)}function oe(t,o,l,c){return t.map((a,d)=>f.jsx("div",{className:ie(Pr,o?.classNames?.row),children:a.map(s=>at(s,o,l,c))},`row-${d}`))}function ot(t){const{sections:o,expanded:l,monthSelected:c,activeMonthKey:a,scrolled:d,onDaySelect:s,onWeekSelect:v,onMonthSelect:m,customization:i}=t,b=i?.weekdayLabels?.length?i.weekdayLabels:nt,g=i?.slots?.weekdayHeader,E=i?.slots?.dayName,T=i?.slots?.month,w=i?.classNames?.dayName;return f.jsx("div",{className:ie(Cr,i?.classNames?.grid),children:o.map((k,G)=>{const C=k.monthValue===a;return f.jsx(ae,{expanded:l||C,className:i?.classNames?.expandableZone,children:f.jsxs("section",{className:ie(Or,i?.classNames?.section),children:[T?f.jsx(T,{section:k,label:i?.formatters?.monthLabel?.(k)??k.monthLabel,isActive:C,className:i?.classNames?.month,onSelect:()=>m?.(k.monthValue)}):f.jsx(qr,{label:i?.formatters?.monthLabel?.(k)??k.monthLabel,className:i?.classNames?.month,selected:k.selected,isActive:C,indicator:k.indicator,onSelect:()=>m?.(k.monthValue)}),(!l||G===0)&&(g?f.jsx(g,{labels:b.map((j,B)=>E?f.jsx(E,{index:B,label:j,className:w},`weekday-${B}`):j),scrolled:d,className:i?.classNames?.weekdayHeader,dayNameClassName:w}):f.jsx(tt,{labels:b,scrolled:d,className:i?.classNames?.weekdayHeader,dayNameClassName:w})),f.jsx(ae,{expanded:l||C&&!!c,className:i?.classNames?.expandableZone,children:oe(k.beforeRows,i,s,v)}),oe(k.activeRows,i,s,v),f.jsx(ae,{expanded:l||C&&!!c,className:i?.classNames?.expandableZone,children:oe(k.afterRows,i,s,v)})]})},k.key)})})}function st(t){const{model:o,activeMonthKey:l,monthSelected:c,scrolled:a,onDaySelect:d,onWeekSelect:s,onMonthSelect:v,onExpandedChange:m,customization:i,style:b}=t,g=i?.slots?.toggle,E=i?.formatters?.toggleLabel?.(!!o.expanded)??f.jsx("svg",{viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:f.jsx("path",{d:o.expanded?"M4 10l4-4 4 4":"M4 6l4 4 4-4"})});return f.jsxs("div",{className:[Tr,i?.classNames?.root].filter(Boolean).join(" "),style:b,children:[f.jsx(ot,{sections:o.sections,expanded:!!o.expanded,monthSelected:c,activeMonthKey:l,scrolled:a,onDaySelect:d,onWeekSelect:s,onMonthSelect:v,customization:i}),m&&(g?f.jsx(g,{expanded:!!o.expanded,label:E,className:[Ie,i?.classNames?.toggle].filter(Boolean).join(" "),onToggle:()=>m(!o.expanded)}):f.jsx("button",{type:"button",className:[Ie,i?.classNames?.toggle].filter(Boolean).join(" "),onClick:()=>m(!o.expanded),children:E}))]})}function Ae(t){return f.jsx(st,{...t})}function it(t){const o=Nr(t),{customization:l,data:c,metadata:a,scrolled:d,selectionEnabled:s=!0,style:v}=t,{expanded:m,setExpanded:i,setValue:b,value:g}=o,E=P.useMemo(()=>wr({data:c,value:g,selectionEnabled:s,metadata:a,expanded:m}),[l,c,m,a,s,g]),T=P.useMemo(()=>Sr(g),[g]);return f.jsx(Ae,{model:E,activeMonthKey:T,monthSelected:g.kind==="month",scrolled:d,onDaySelect:w=>b({kind:"day",key:w}),onWeekSelect:w=>b({kind:"week",key:w}),onMonthSelect:w=>b({kind:"month",key:w}),onExpandedChange:i,customization:l,style:v})}exports.Calendar=it;exports.CalendarPure=Ae;
|
|
15
15
|
//# sourceMappingURL=index.cjs.map
|