react-weekview
Version:
Week view component and hook for React
34 lines (30 loc) • 21.8 kB
JavaScript
(function(C,N){typeof exports=="object"&&typeof module<"u"?N(exports,require("react"),require("date-fns")):typeof define=="function"&&define.amd?define(["exports","react","date-fns"],N):(C=typeof globalThis<"u"?globalThis:C||self,N(C["react-weekview"]={},C.React,C.dateFns))})(this,function(C,N,a){"use strict";function ae({initialDate:x,minuteStep:g=30,weekStartsOn:y=1,locale:s,disabledCell:m,disabledDay:p,disabledWeek:h}={}){const[l,d]=N.useState(a.startOfWeek(a.startOfDay(x||new Date),{weekStartsOn:y})),j=()=>{const b=a.addDays(l,7);h&&h(b)||d(b)},_=()=>{const b=a.addDays(l,-7);h&&h(b)||d(b)},T=()=>{d(a.startOfWeek(a.startOfDay(new Date),{weekStartsOn:y}))},v=a.eachDayOfInterval({start:l,end:a.addDays(l,6)}).map(b=>({date:b,isToday:a.isToday(b),name:a.format(b,"EEEE",{locale:s}),shortName:a.format(b,"EEE",{locale:s}),dayOfMonth:a.format(b,"d",{locale:s}),dayOfMonthWithZero:a.format(b,"dd",{locale:s}),dayOfMonthWithSuffix:a.format(b,"do",{locale:s}),disabled:p?p(b):!1,cells:a.eachMinuteOfInterval({start:a.startOfDay(b),end:a.endOfDay(b)},{step:g}).map(R=>({date:R,hour:a.format(R,"HH",{locale:s}),minute:a.format(R,"mm",{locale:s}),hourAndMinute:a.format(R,"HH:mm",{locale:s}),disabled:m?m(R):!1}))})),k=a.isSameYear(v[0].date,v[v.length-1].date),A=a.isSameMonth(v[0].date,v[v.length-1].date);let M="";A?M=a.format(v[0].date,"MMMM yyyy",{locale:s}):k?M=`${a.format(v[0].date,"MMM",{locale:s})} - ${a.format(v[v.length-1].date,"MMM",{locale:s})} ${a.format(v[0].date,"yyyy",{locale:s})}`:M=`${a.format(v[0].date,"MMM yyyy",{locale:s})} - ${a.format(v[v.length-1].date,"MMM yyyy",{locale:s})}`;const Z=a.format(v[0].date,"w",{locale:s});return{nextWeek:j,previousWeek:_,goToToday:T,days:v,weekNumber:Z,viewTitle:M}}var z={exports:{}},L={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var ie;function Ne(){if(ie)return L;ie=1;var x=N,g=Symbol.for("react.element"),y=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,m=x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};function h(l,d,j){var _,T={},v=null,k=null;j!==void 0&&(v=""+j),d.key!==void 0&&(v=""+d.key),d.ref!==void 0&&(k=d.ref);for(_ in d)s.call(d,_)&&!p.hasOwnProperty(_)&&(T[_]=d[_]);if(l&&l.defaultProps)for(_ in d=l.defaultProps,d)T[_]===void 0&&(T[_]=d[_]);return{$$typeof:g,type:l,key:v,ref:k,props:T,_owner:m.current}}return L.Fragment=y,L.jsx=h,L.jsxs=h,L}var Y={};/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var oe;function We(){return oe||(oe=1,process.env.NODE_ENV!=="production"&&function(){var x=N,g=Symbol.for("react.element"),y=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),m=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),l=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),k=Symbol.for("react.offscreen"),A=Symbol.iterator,M="@@iterator";function Z(e){if(e===null||typeof e!="object")return null;var r=A&&e[A]||e[M];return typeof r=="function"?r:null}var b=x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];Ie("error",e,t)}}function Ie(e,r,t){{var n=b.ReactDebugCurrentFrame,f=n.getStackAddendum();f!==""&&(r+="%s",t=t.concat([f]));var c=t.map(function(u){return String(u)});c.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,c)}}var Le=!1,Ye=!1,Ve=!1,Ue=!1,Be=!1,fe;fe=Symbol.for("react.module.reference");function Ge(e){return!!(typeof e=="string"||typeof e=="function"||e===s||e===p||Be||e===m||e===j||e===_||Ue||e===k||Le||Ye||Ve||typeof e=="object"&&e!==null&&(e.$$typeof===v||e.$$typeof===T||e.$$typeof===h||e.$$typeof===l||e.$$typeof===d||e.$$typeof===fe||e.getModuleId!==void 0))}function He(e,r,t){var n=e.displayName;if(n)return n;var f=r.displayName||r.name||"";return f!==""?t+"("+f+")":t}function ce(e){return e.displayName||"Context"}function D(e){if(e==null)return null;if(typeof e.tag=="number"&&R("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 s:return"Fragment";case y:return"Portal";case p:return"Profiler";case m:return"StrictMode";case j:return"Suspense";case _:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case l:var r=e;return ce(r)+".Consumer";case h:var t=e;return ce(t._context)+".Provider";case d:return He(e,e.render,"ForwardRef");case T:var n=e.displayName||null;return n!==null?n:D(e.type)||"Memo";case v:{var f=e,c=f._payload,u=f._init;try{return D(u(c))}catch{return null}}}return null}var W=Object.assign,V=0,de,ve,me,pe,he,ge,be;function xe(){}xe.__reactDisabledLog=!0;function qe(){{if(V===0){de=console.log,ve=console.info,me=console.warn,pe=console.error,he=console.group,ge=console.groupCollapsed,be=console.groupEnd;var e={configurable:!0,enumerable:!0,value:xe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}V++}}function Je(){{if(V--,V===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:W({},e,{value:de}),info:W({},e,{value:ve}),warn:W({},e,{value:me}),error:W({},e,{value:pe}),group:W({},e,{value:he}),groupCollapsed:W({},e,{value:ge}),groupEnd:W({},e,{value:be})})}V<0&&R("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=b.ReactCurrentDispatcher,X;function B(e,r,t){{if(X===void 0)try{throw Error()}catch(f){var n=f.stack.trim().match(/\n( *(at )?)/);X=n&&n[1]||""}return`
`+X+e}}var Q=!1,G;{var ze=typeof WeakMap=="function"?WeakMap:Map;G=new ze}function ye(e,r){if(!e||Q)return"";{var t=G.get(e);if(t!==void 0)return t}var n;Q=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var c;c=K.current,K.current=null,qe();try{if(r){var u=function(){throw Error()};if(Object.defineProperty(u.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(u,[])}catch(P){n=P}Reflect.construct(e,[],u)}else{try{u.call()}catch(P){n=P}e.call(u.prototype)}}else{try{throw Error()}catch(P){n=P}e()}}catch(P){if(P&&n&&typeof P.stack=="string"){for(var o=P.stack.split(`
`),O=n.stack.split(`
`),E=o.length-1,w=O.length-1;E>=1&&w>=0&&o[E]!==O[w];)w--;for(;E>=1&&w>=0;E--,w--)if(o[E]!==O[w]){if(E!==1||w!==1)do if(E--,w--,w<0||o[E]!==O[w]){var S=`
`+o[E].replace(" at new "," at ");return e.displayName&&S.includes("<anonymous>")&&(S=S.replace("<anonymous>",e.displayName)),typeof e=="function"&&G.set(e,S),S}while(E>=1&&w>=0);break}}}finally{Q=!1,K.current=c,Je(),Error.prepareStackTrace=f}var I=e?e.displayName||e.name:"",Me=I?B(I):"";return typeof e=="function"&&G.set(e,Me),Me}function Ze(e,r,t){return ye(e,!1)}function Ke(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function H(e,r,t){if(e==null)return"";if(typeof e=="function")return ye(e,Ke(e));if(typeof e=="string")return B(e);switch(e){case j:return B("Suspense");case _:return B("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return Ze(e.render);case T:return H(e.type,r,t);case v:{var n=e,f=n._payload,c=n._init;try{return H(c(f),r,t)}catch{}}}return""}var q=Object.prototype.hasOwnProperty,Re={},Ee=b.ReactDebugCurrentFrame;function J(e){if(e){var r=e._owner,t=H(e.type,e._source,r?r.type:null);Ee.setExtraStackFrame(t)}else Ee.setExtraStackFrame(null)}function Xe(e,r,t,n,f){{var c=Function.call.bind(q);for(var u in e)if(c(e,u)){var o=void 0;try{if(typeof e[u]!="function"){var O=Error((n||"React class")+": "+t+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw O.name="Invariant Violation",O}o=e[u](r,u,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(E){o=E}o&&!(o instanceof Error)&&(J(f),R("%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).",n||"React class",t,u,typeof o),J(null)),o instanceof Error&&!(o.message in Re)&&(Re[o.message]=!0,J(f),R("Failed %s type: %s",t,o.message),J(null))}}}var Qe=Array.isArray;function F(e){return Qe(e)}function Fe(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function er(e){try{return we(e),!1}catch{return!0}}function we(e){return""+e}function _e(e){if(er(e))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Fe(e)),we(e)}var U=b.ReactCurrentOwner,rr={key:!0,ref:!0,__self:!0,__source:!0},Te,je,ee;ee={};function tr(e){if(q.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(q.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){if(typeof e.ref=="string"&&U.current&&r&&U.current.stateNode!==r){var t=D(U.current.type);ee[t]||(R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',D(U.current.type),e.ref),ee[t]=!0)}}function ir(e,r){{var t=function(){Te||(Te=!0,R("%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))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function or(e,r){{var t=function(){je||(je=!0,R("%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))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var sr=function(e,r,t,n,f,c,u){var o={$$typeof:g,type:e,key:r,ref:t,props:u,_owner:c};return o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:f}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function lr(e,r,t,n,f){{var c,u={},o=null,O=null;t!==void 0&&(_e(t),o=""+t),nr(r)&&(_e(r.key),o=""+r.key),tr(r)&&(O=r.ref,ar(r,f));for(c in r)q.call(r,c)&&!rr.hasOwnProperty(c)&&(u[c]=r[c]);if(e&&e.defaultProps){var E=e.defaultProps;for(c in E)u[c]===void 0&&(u[c]=E[c])}if(o||O){var w=typeof e=="function"?e.displayName||e.name||"Unknown":e;o&&ir(u,w),O&&or(u,w)}return sr(e,o,O,f,n,U.current,u)}}var re=b.ReactCurrentOwner,Oe=b.ReactDebugCurrentFrame;function $(e){if(e){var r=e._owner,t=H(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}var te;te=!1;function ne(e){return typeof e=="object"&&e!==null&&e.$$typeof===g}function Ce(){{if(re.current){var e=D(re.current.type);if(e)return`
Check the render method of \``+e+"`."}return""}}function ur(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
Check your code at `+r+":"+t+"."}return""}}var Se={};function fr(e){{var r=Ce();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
Check the top-level render call using <`+t+">.")}return r}}function De(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=fr(r);if(Se[t])return;Se[t]=!0;var n="";e&&e._owner&&e._owner!==re.current&&(n=" It was passed a child from "+D(e._owner.type)+"."),$(e),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),$(null)}}function Pe(e,r){{if(typeof e!="object")return;if(F(e))for(var t=0;t<e.length;t++){var n=e[t];ne(n)&&De(n,r)}else if(ne(e))e._store&&(e._store.validated=!0);else if(e){var f=Z(e);if(typeof f=="function"&&f!==e.entries)for(var c=f.call(e),u;!(u=c.next()).done;)ne(u.value)&&De(u.value,r)}}}function cr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===d||r.$$typeof===T))t=r.propTypes;else return;if(t){var n=D(r);Xe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!te){te=!0;var f=D(r);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",f||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function dr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){$(e),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),$(null);break}}e.ref!==null&&($(e),R("Invalid attribute `ref` supplied to `React.Fragment`."),$(null))}}function ke(e,r,t,n,f,c){{var u=Ge(e);if(!u){var o="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(o+=" 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 O=ur(f);O?o+=O:o+=Ce();var E;e===null?E="null":F(e)?E="array":e!==void 0&&e.$$typeof===g?(E="<"+(D(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",E,o)}var w=lr(e,r,t,f,c);if(w==null)return w;if(u){var S=r.children;if(S!==void 0)if(n)if(F(S)){for(var I=0;I<S.length;I++)Pe(S[I],e);Object.freeze&&Object.freeze(S)}else R("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 Pe(S,e)}return e===s?dr(w):cr(w),w}}function vr(e,r,t){return ke(e,r,t,!0)}function mr(e,r,t){return ke(e,r,t,!1)}var pr=mr,hr=vr;Y.Fragment=s,Y.jsx=pr,Y.jsxs=hr}()),Y}process.env.NODE_ENV==="production"?z.exports=Ne():z.exports=We();var i=z.exports;function se({title:x,showTodayButton:g=!0,todayButton:y,onToday:s,showPrevButton:m=!0,prevButton:p,onPrev:h,showNextButton:l=!0,nextButton:d,onNext:j}){return i.jsxs("header",{className:"flex items-center justify-between bg-slate-50 border-b px-6 py-4 h-16",children:[i.jsxs("h1",{className:"flex items-center gap-3 text-base font-semibold text-slate-600",children:[x,g&&(y?y({onToday:s}):i.jsx("button",{className:"inline-flex items-center justify-center text-xs transition-colors font-normal border border-slate-200 bg-white hover:bg-slate-50 h-8 rounded-md px-3",onClick:s,children:"Today"}))]}),i.jsx("div",{className:"flex items-center space-x-5",children:i.jsxs("div",{className:"flex space-x-1",children:[m&&(p?p({onPrev:h}):i.jsx("button",{className:"inline-flex items-center justify-center text-xs transition-colors font-normal border border-slate-200 bg-white hover:bg-slate-50 h-8 w-8 rounded-md",onClick:h,children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M8.84182 3.13514C9.04327 3.32401 9.05348 3.64042 8.86462 3.84188L5.43521 7.49991L8.86462 11.1579C9.05348 11.3594 9.04327 11.6758 8.84182 11.8647C8.64036 12.0535 8.32394 12.0433 8.13508 11.8419L4.38508 7.84188C4.20477 7.64955 4.20477 7.35027 4.38508 7.15794L8.13508 3.15794C8.32394 2.95648 8.64036 2.94628 8.84182 3.13514Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})})),l&&(d?d({onNext:j}):i.jsx("button",{className:"inline-flex items-center justify-center text-xs transition-colors font-normal border border-slate-200 bg-white hover:bg-slate-50 h-8 w-8 rounded-md",onClick:j,children:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:i.jsx("path",{d:"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}))]})})]})}function le({days:x}){return i.jsx("div",{className:"sticky top-0 z-30 flex-none bg-white shadow",children:i.jsx("div",{className:"grid grid-cols-7 text-sm leading-6 text-slate-500",children:x.map((g,y)=>i.jsx("div",{className:`
flex items-center justify-center h-14 border-l border-gray-100
${y===0&&"border-l-0"}
`,children:i.jsxs("span",{className:g.isToday?"flex items-center":"",children:[g.shortName," ",i.jsx("span",{className:`
font-semibold text-slate-900
${g.isToday&&"flex items-center justify-center rounded-full w-8 h-8 ml-1.5 text-white bg-indigo-600"}
`,children:g.dayOfMonthWithZero})]})},a.getUnixTime(g.date)))})})}function ue({days:x,rowHeight:g,CellContent:y,onCellClick:s}){return i.jsxs("div",{style:{display:"grid",gridTemplateColumns:`repeat(${x.length}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${x[0].cells.length}, minmax(${g}px, 1fr))`},children:[x.map((m,p)=>m.cells.map((h,l)=>i.jsx("button",{className:"relative border-t border-l border-gray-100 transition-colors cursor-pointer hover:bg-slate-100 disabled:bg-slate-50",style:{gridRowStart:l+1,gridRowEnd:l+2,gridColumnStart:p+1,gridColumnEnd:p+2},disabled:h.disabled,onClick:()=>s==null?void 0:s(h),children:y&&y(h)},a.getUnixTime(h.date)))),i.jsx("div",{className:"sticky left-0 grid pointer-events-none",style:{display:"grid",gridRowStart:1,gridRowEnd:-1,gridColumnStart:1,gridTemplateRows:`repeat(${x[0].cells.length}, minmax(${g}px, 1fr))`},children:x[0].cells.map((m,p)=>a.getMinutes(m.date)===0&&i.jsx("div",{className:"relative flex items-center justify-center border-t border-gray-100",style:{gridRowStart:p+1,gridRowEnd:p+2},children:i.jsx("span",{className:"absolute top-0 left-0 text-xs text-slate-400 px-1",children:m.hourAndMinute})},a.getUnixTime(m.date)))})]})}function Ae({days:x,events:g,weekStartsOn:y,locale:s,minuteStep:m,rowHeight:p,onEventClick:h}){return i.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${x.length}, minmax(0, 1fr))`,gridTemplateRows:`repeat(${x[0].cells.length}, minmax(${p}px, 1fr))`},children:(g||[]).filter(l=>a.isSameWeek(x[0].date,l.startDate)).map(l=>{const d=a.getHours(l.startDate)*2+1+Math.floor(a.getMinutes(l.startDate)/m),j=a.getHours(l.endDate)*2+1+Math.ceil(a.getMinutes(l.endDate)/m),_=a.getMinutes(l.startDate)%m/m*p,T=(p-a.getMinutes(l.endDate)%m/m*p)%p;return i.jsx("div",{className:"relative flex mt-[1px] transition-all",style:{gridRowStart:d,gridRowEnd:j,gridColumnStart:a.getDay(l.startDate)-y+1,gridColumnEnd:"span 1"},children:i.jsxs("span",{className:"absolute inset-1 flex flex-col overflow-y-auto rounded-md p-2 text-xs leading-5 bg-blue-50 border border-transparent border-dashed hover:bg-blue-100 transition cursor-pointer",style:{top:_+4,bottom:T+4},onClick:()=>h==null?void 0:h(l),children:[i.jsxs("p",{className:"text-blue-500 leading-4",children:[a.format(new Date(l.startDate),"H:mm",{weekStartsOn:y,locale:s}),"-",a.format(new Date(l.endDate),"H:mm",{weekStartsOn:y,locale:s})]}),i.jsx("p",{className:"font-semibold text-blue-700",children:l.title})]})},l.id)})})}function $e({initialDate:x,minuteStep:g=30,weekStartsOn:y=1,locale:s,rowHeight:m=56,disabledCell:p,disabledDay:h,disabledWeek:l,events:d,onCellClick:j,onEventClick:_}){const{days:T,nextWeek:v,previousWeek:k,goToToday:A,viewTitle:M}=ae({initialDate:x,minuteStep:g,weekStartsOn:y,locale:s,disabledCell:p,disabledDay:h,disabledWeek:l});return i.jsxs("div",{className:"flex flex-col h-full overflow-hidden",children:[i.jsx(se,{title:M,onNext:v,onPrev:k,onToday:A,showTodayButton:!a.isSameWeek(T[0].date,new Date)}),i.jsx("div",{className:"flex flex-col flex-1 overflow-hidden select-none",children:i.jsx("div",{className:"flex flex-col flex-1 isolate overflow-auto",children:i.jsxs("div",{className:"flex flex-col flex-none min-w-[700px]",children:[i.jsx(le,{days:T}),i.jsxs("div",{className:"grid grid-cols-1 grid-rows-1",children:[i.jsx("div",{className:"row-start-1 col-start-1",children:i.jsx(ue,{days:T,rowHeight:m,onCellClick:j})}),i.jsx("div",{className:"row-start-1 col-start-1",children:i.jsx(Ae,{days:T,events:d,weekStartsOn:y,locale:s,minuteStep:g,rowHeight:m,onEventClick:_})})]})]})})})]})}C.WeekView=$e,C.WeekViewDaysHeader=le,C.WeekViewGrid=ue,C.WeekViewHeader=se,C.useWeekView=ae,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});