@ilamy/calendar 3.1.0 → 3.2.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.d.ts +83 -41
- package/dist/index.js +3 -3
- package/dist/plugins/agenda.d.ts +9 -2
- package/dist/plugins/agenda.js +1 -1
- package/dist/plugins/drag-to-create.d.ts +11 -4
- package/dist/plugins/drag-to-create.js +1 -1
- package/dist/plugins/recurrence.d.ts +17 -5
- package/dist/plugins/recurrence.js +2 -2
- package/dist/shared/chunk-89xfgjfh.js +2 -0
- package/dist/shared/chunk-bgegqhb4.js +2 -0
- package/dist/shared/{chunk-jge2sq3v.js → chunk-j4ngnkkv.js} +2 -2
- package/dist/shared/chunk-j4pfc0hb.js +2 -0
- package/dist/shared/chunk-nvtnncwx.js +2 -0
- package/dist/shared/chunk-pg39xa62.js +2 -0
- package/dist/testing/index.d.ts +52 -19
- package/dist/testing/index.js +1 -1
- package/package.json +2 -1
- package/dist/shared/chunk-5kjrv081.js +0 -2
- package/dist/shared/chunk-h5d5q285.js +0 -2
- package/dist/shared/chunk-kpzykmz4.js +0 -2
- package/dist/shared/chunk-m1q73v86.js +0 -2
- package/dist/shared/chunk-tvq5v791.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t}from"../shared/chunk-
|
|
1
|
+
import{t}from"../shared/chunk-nvtnncwx.js";import{useIlamyCalendarContext as V}from"@ilamy/calendar";import{useRef as J,useState as Q}from"react";import{createPortal as Z}from"react-dom";import{useEffect as U,useRef as H}from"react";var M=(n,e)=>{let o=Math.min(n.top,e.top),l=Math.min(n.left,e.left),i=Math.max(n.left+n.width,e.left+e.width),s=Math.max(n.top+n.height,e.top+e.height);return{top:o,left:l,width:i-l,height:s-o}},I=(n,e)=>{let o=Math.max(n.top,e.top),l=Math.max(n.left,e.left),i=Math.min(n.left+n.width,e.left+e.width),s=Math.min(n.top+n.height,e.top+e.height),u=i-l,m=s-o;if(u<=0||m<=0)return null;return{top:o,left:l,width:u,height:m}},A=(n,e,o)=>{let l=0,i=0;if(n.clientY<e.top+o.edge)i=-o.speed;else if(n.clientY>e.top+e.height-o.edge)i=o.speed;if(n.clientX<e.left+o.edge)l=-o.speed;else if(n.clientX>e.left+e.width-o.edge)l=o.speed;let s=o.axis??"both";return{x:s==="y"?0:l,y:s==="x"?0:i}};var O=new Set(["auto","scroll","overlay"]),j=(n)=>{let e=getComputedStyle(n),o=O.has(e.overflowY)&&n.scrollHeight>n.clientHeight,l=O.has(e.overflowX)&&n.scrollWidth>n.clientWidth;return o||l},X=(n)=>{let e=n instanceof HTMLElement?n:null;while(e){if(j(e))return e;e=e.parentElement}return null};var C=(n,e,o=2)=>Math.hypot(n,e)>=o,_=(n,e)=>{let o=n.allDay===e.allDay,l=n.resourceId===e.resourceId;return o&&l},k=(n,e)=>{let o=n.start.isAfter(e.start),l=o?e:n,i=o?n:e;return{start:l.start,end:i.end,allDay:l.allDay,resourceId:l.resourceId}};var z=400,W=10,q=40,K=5;function Y(n){let e=H(n);e.current=n;let o=H(null);U(()=>{let l=()=>{document.body.style.setProperty("user-select","none"),document.body.style.setProperty("-webkit-user-select","none")},i=()=>{document.body.style.removeProperty("user-select"),document.body.style.removeProperty("-webkit-user-select")},s=null,u=()=>{if(s!==null)clearTimeout(s),s=null},m=null,p=null,y=null,P=()=>{if(y!==null)cancelAnimationFrame(y),y=null},E=()=>{y=null;let r=o.current;if(!r?.active)return;if(!m||!p)return;let c=A(p,m.getBoundingClientRect(),{edge:q,speed:K,axis:e.current.scrollAxis});if(c.x===0&&c.y===0)return;m.scrollBy({left:c.x,top:c.y,behavior:"instant"}),e.current.onMove(p,r.payload),y=requestAnimationFrame(E)},R=()=>{if(y===null)y=requestAnimationFrame(E)},v=(r)=>{if(o.current?.active)r.preventDefault()},d=(r)=>{r.stopImmediatePropagation(),r.preventDefault(),window.removeEventListener("click",d,{capture:!0})},f=()=>{u(),P(),window.removeEventListener("touchmove",v),i(),m=null,p=null,o.current=null},a=()=>{let r=o.current!==null;if(f(),r)e.current.onCancel?.()},g=(r)=>{if(r.active=!0,u(),l(),window.getSelection()?.removeAllRanges(),r.pointerType==="touch")window.addEventListener("touchmove",v,{passive:!1});e.current.onStart?.(r.payload)},w=(r)=>{if(r.button!==0||!r.isPrimary)return;let c=e.current.resolvePress(r);if(c===null)return;u();let h={pointerId:r.pointerId,pointerType:r.pointerType,originX:r.clientX,originY:r.clientY,payload:c,active:!1};if(o.current=h,m=X(r.target),r.pointerType==="touch"){let T=e.current.longPressMs??z;s=setTimeout(()=>{if(o.current===h)g(h)},T)}},x=(r,c)=>{let h=c.clientX-r.originX,T=c.clientY-r.originY;if(r.pointerType==="touch"){let N=e.current.touchCancelSlopPx??W;if(C(h,T,N))a();return!1}if(!C(h,T,e.current.thresholdPx))return!1;return g(r),!0},S=(r)=>{let c=o.current;if(!c||r.pointerId!==c.pointerId)return;if(!c.active&&!x(c,r))return;p={clientX:r.clientX,clientY:r.clientY},e.current.onMove(p,c.payload),R()},b=(r)=>{let c=o.current;if(!c||r.pointerId!==c.pointerId)return;if(!c.active){f();return}window.addEventListener("click",d,{capture:!0});let{payload:h}=c;f(),e.current.onEnd(h)},L=(r)=>{if(r.key==="Escape")a()};return document.addEventListener("pointerdown",w),window.addEventListener("pointermove",S),window.addEventListener("pointerup",b),window.addEventListener("pointercancel",a),window.addEventListener("blur",a),window.addEventListener("keydown",L),()=>{document.removeEventListener("pointerdown",w),window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",a),window.removeEventListener("blur",a),window.removeEventListener("keydown",L),window.removeEventListener("click",d,{capture:!0}),window.removeEventListener("touchmove",v),u(),P(),i()}},[])}var D=(n,e)=>{let o=n?.closest("[data-start]");if(!o)return null;if(o.dataset.disabled==="true")return null;let l=o.dataset.start,i=o.dataset.end;if(!l||!i)return null;let s=(u)=>e?t.utc(u).tz(e):t.utc(u).local();return{start:s(l),end:s(i),resourceId:o.dataset.resourceId,allDay:o.dataset.allDay==="true",element:o}};import{jsx as B,jsxs as ne,Fragment as te}from"react/jsx-runtime";var G=(n,e)=>{let o=M(n.element.getBoundingClientRect(),e.element.getBoundingClientRect()),l=n.element.closest("[data-calendar-scroll-content]");if(l instanceof HTMLElement){let u=l.getBoundingClientRect();return{rect:{top:o.top-u.top,left:o.left-u.left,width:o.width,height:o.height},content:l}}let i=n.element.closest("[data-calendar-viewport]");if(!i)return{rect:o,content:null};let s=I(o,i.getBoundingClientRect());if(!s)return null;return{rect:s,content:null}};function ee({rect:n,content:e}){return Z(B("div",{"aria-hidden":"true",className:`pointer-events-none ${e?"absolute z-15":"fixed z-50"} rounded-sm border border-primary bg-primary/20`,style:{top:n.top,left:n.left,width:n.width,height:n.height}}),e??document.body)}function F({children:n,options:e}){let{openEventForm:o,resources:l,timezone:i,orientation:s}=V(),[u,m]=Q(null),p=J(null),E=l.length>0?s==="vertical"?"y":"x":"both",R=()=>{p.current=null,m(null)},v=(d,f)=>{let a=k(d,f),g=l.find((x)=>String(x.id)===a.resourceId),w={start:a.start,end:a.end,resource:g,allDay:a.allDay};if(e.onSelect)e.onSelect(w,o);else o({start:a.start,end:a.end,allDay:a.allDay,resourceId:a.resourceId})};return Y({scrollAxis:E,resolvePress:(d)=>D(d.target,i),onStart:(d)=>{p.current=d,m(G(d,d))},onMove:({clientX:d,clientY:f},a)=>{let g=D(document.elementFromPoint(d,f),i);if(g&&_(a,g))p.current=g;let w=p.current??a;m(G(a,w))},onEnd:(d)=>{let f=p.current??d;v(d,f),R()},onCancel:R}),ne(te,{children:[n,u&&B(ee,{...u})]})}import{jsx as re}from"react/jsx-runtime";var oe=(n={})=>({name:"drag-to-create",provider:({children:e})=>re(F,{options:n,children:e})});export{oe as dragToCreatePlugin};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { RRule, Weekday } from "rrule";
|
|
2
2
|
import { Options } from "rrule";
|
|
3
3
|
/**
|
|
4
|
+
* Scope options for recurring event operations (Google Calendar style)
|
|
5
|
+
* Determines how many events in a recurring series should be affected
|
|
6
|
+
*/
|
|
7
|
+
type RecurrenceEditScope = "this" | "following" | "all";
|
|
8
|
+
/**
|
|
4
9
|
* Re-rrule.js Options with practical TypeScript interface.
|
|
5
10
|
* Makes all properties optional except freq and dtstart (which are required by RFC 5545).
|
|
6
11
|
* This allows clean object creation without needing explicit null values.
|
|
@@ -96,8 +101,15 @@ type WeekDays = "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "fr
|
|
|
96
101
|
*/
|
|
97
102
|
interface BusinessHours {
|
|
98
103
|
/**
|
|
99
|
-
* Days of the week to apply business hours to.
|
|
100
|
-
*
|
|
104
|
+
* Days of the week to apply business hours to. Omitted, the hours apply to
|
|
105
|
+
* every day, weekends included, in both the object and the array form.
|
|
106
|
+
*
|
|
107
|
+
* This deviates from FullCalendar, which defaults an object to Monday-Friday
|
|
108
|
+
* and ignores an array entry without days
|
|
109
|
+
* (core/src/structs/business-hours.ts, v6.1.21). Kept until the next major
|
|
110
|
+
* (see the TODO in business-hours.ts); list the days explicitly to get
|
|
111
|
+
* weekdays only.
|
|
112
|
+
* @default every day
|
|
101
113
|
*/
|
|
102
114
|
daysOfWeek?: WeekDays[];
|
|
103
115
|
/**
|
|
@@ -362,8 +374,8 @@ interface IlamyPlugin {
|
|
|
362
374
|
children: ReactNode2;
|
|
363
375
|
}>;
|
|
364
376
|
}
|
|
365
|
-
import
|
|
366
|
-
type Dayjs3 =
|
|
377
|
+
import { Dayjs as DayjsInstance } from "dayjs";
|
|
378
|
+
type Dayjs3 = DayjsInstance;
|
|
367
379
|
/**
|
|
368
380
|
* Returns the recurrence-specific VEVENT property lines for an event: an
|
|
369
381
|
* `RRULE:` line when the event has an rrule, an `EXDATE:` line when it has
|
|
@@ -384,4 +396,4 @@ interface GenerateRecurringEventsProps {
|
|
|
384
396
|
}
|
|
385
397
|
declare const generateRecurringEvents: ({ event, currentEvents, startDate, endDate }: GenerateRecurringEventsProps) => CalendarEvent2[];
|
|
386
398
|
declare const isRecurringEvent: (event: CalendarEvent2) => boolean;
|
|
387
|
-
export { RRule, RRuleOptions, RecurrenceAugmentation, Weekday, generateRecurringEvents, isRecurringEvent, recurrenceICalProperties, recurrencePlugin };
|
|
399
|
+
export { RRule, RRuleOptions, RecurrenceAugmentation, RecurrenceEditScope, Weekday, generateRecurringEvents, isRecurringEvent, recurrenceICalProperties, recurrencePlugin };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t}from"../shared/chunk-
|
|
2
|
-
`).find((a)=>a.startsWith("RRULE:"))||""}catch{return""}},me=(r)=>{let n=[],a=r.rrule?tt(r.rrule):"";if(a)n.push(a);if(r.exdates?.length){let i=r.exdates.map((l)=>Se(t(l),r.allDay)).join(",");n.push(`EXDATE:${i}`)}if(r.recurrenceId){let i=Se(t(r.recurrenceId),r.allDay);n.push(`RECURRENCE-ID:${i}`)}return n};import"@ilamy/calendar";import{SLOT_EVENT_FORM as jt,SLOT_EVENT_MUTATION_SCOPE as Vt}from"@ilamy/calendar";import{useIlamyCalendarContext as rt}from"@ilamy/calendar";import{jsx as B,jsxs as oe}from"react/jsx-runtime";var nt=[{scope:"this",title:"thisEvent",editKey:"onlyChangeThis",deleteKey:"onlyDeleteThis"},{scope:"following",title:"thisAndFollowingEvents",editKey:"changeThisAndFuture",deleteKey:"deleteThisAndFuture"},{scope:"all",title:"allEvents",editKey:"changeEntireSeries",deleteKey:"deleteEntireSeries"}];function De({isOpen:r,onClose:n,onConfirm:a,operationType:i,eventTitle:l}){let{t:c}=rt(),u=(g)=>{a(g),n()},p=i==="edit",y=c("deleteRecurringEvent"),x=c("deleteRecurringEventQuestion");if(p)y=c("editRecurringEvent"),x=c("editRecurringEventQuestion");return B(R,{onOpenChange:(g)=>{if(!g)n()},open:r,children:oe(w,{className:"max-w-md",children:[oe(S,{children:[B(P,{children:y}),oe(_,{children:['"',l,'" ',x]})]}),B("div",{className:"space-y-3",children:nt.map(({scope:g,title:b,editKey:M,deleteKey:U})=>B(o,{className:"w-full justify-start h-auto p-4",onClick:()=>u(g),variant:"outline",children:oe("div",{className:"text-left",children:[B("div",{className:"font-medium",children:c(b)}),B("div",{className:"text-sm text-muted-foreground",children:c(p?M:U)})]})},g))}),B(F,{children:B(o,{onClick:n,variant:"outline",children:c("cancel")})})]})})}import{useIlamyCalendarContext as Tt}from"@ilamy/calendar";import{useState as kt}from"react";import{useIlamyCalendarContext as Pt}from"@ilamy/calendar";import{jsx as ae}from"react/jsx-runtime";function xe({className:r,...n}){return ae("div",{className:e("text-card-foreground flex flex-col gap-1 rounded-xl border shadow-sm",r),"data-slot":"card",...n})}function Oe({className:r,...n}){return ae("div",{className:e("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 p-4 pb-0 has-data-[slot=card-action]:grid-cols-[1fr_auto]",r),"data-slot":"card-header",...n})}function Pe({className:r,...n}){return ae("div",{className:e("leading-none font-semibold",r),"data-slot":"card-title",...n})}function we({className:r,...n}){return ae("div",{className:e("p-4 pt-0",r),"data-slot":"card-content",...n})}import{useEffect as wt,useState as Re}from"react";import{RRule as $e}from"rrule";import{createContext as ot,useContext as at}from"react";var Ie=ot(null),Te=Ie.Provider,L=()=>{let r=at(Ie);if(!r)throw Error("useRecurrenceEditor must be used within a RecurrenceEditor");return r};import{RRule as N}from"rrule";var st=[N.SU,N.MO,N.TU,N.WE,N.TH,N.FR,N.SA],it=[N.MO,N.TU,N.WE,N.TH,N.FR],lt=["first","second","third","fourth"],ke=(r)=>st.at(t(r).day())??N.SU,Me=(r)=>{let n=t(r);return n.add(7,"day").month()!==n.month()?-1:Math.ceil(n.date()/7)},ct={daily:()=>({freq:N.DAILY}),weekdays:()=>({freq:N.WEEKLY,byweekday:it}),weeklyOnDay:(r)=>({freq:N.WEEKLY,byweekday:[ke(r)]}),monthlyOnDay:(r)=>({freq:N.MONTHLY,bymonthday:t(r).date()}),monthlyOnWeekday:(r)=>({freq:N.MONTHLY,byweekday:[ke(r).nth(Me(r))]})},G=(r,n)=>{let a=ct[r];if(!a)return null;return{interval:1,dtstart:n,...a(n)}},be=(r)=>{if(r==null)return"";return(Array.isArray(r)?r:[r]).map((a)=>typeof a==="object"?`${a.weekday}:${a.n??""}`:`${a}:`).sort().join(",")},dt=(r,n)=>{if(!n)return!1;let a=r.freq===n.freq,i=be(r.byweekday)===be(n.byweekday),l=(r.bymonthday??null)===(n.bymonthday??null);return a&&i&&l},ut=["daily","weekdays","weeklyOnDay","monthlyOnDay","monthlyOnWeekday"],J=(r,n)=>{if(!r)return"once";if(Boolean(r.interval)&&r.interval!==1)return"customize";return ut.find((l)=>dt(r,G(l,n)))??"customize"},X=(r,n,a)=>{let i=t(n).format("dddd"),l=Me(n),c=l===-1?"last":lt.at(l-1)??"last",u=a(c);return{daily:a("daily"),weekdays:a("everyWeekday"),weeklyOnDay:`${a("weeklyOn")} ${i}`,monthlyOnDay:`${a("monthlyOnDay")} ${t(n).date()}`,monthlyOnWeekday:`${a("monthlyOnThe")} ${u} ${i}`}[r]??a("customRecurrence")},z=(r)=>{if(Array.isArray(r))return r;return r?[r]:[]};import{useIlamyCalendarContext as ft}from"@ilamy/calendar";import{jsx as pt}from"react/jsx-runtime";var mt="YYYY-MM-DD",Ne=({date:r,onChange:n,className:a})=>{let i=r?t(r).format(mt):"",l=(c)=>{let u=c.target.value;if(!u){n?.(void 0);return}let p=t(u);n?.(p.isValid()?p.toDate():void 0)};return pt("input",{className:e("flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none transition-shadow focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",a),onChange:l,type:"date",value:i})};import{jsx as j,jsxs as pe,Fragment as gt}from"react/jsx-runtime";var yt=[{type:"never",id:"never",labelKey:"never"},{type:"count",id:"after",labelKey:"after"},{type:"until",id:"on",labelKey:"on"}],Rt=(r)=>Math.max(1,Number.parseInt(r,10)||1),Ue=()=>{let{t:r}=ft(),{opts:n,update:a,setEndType:i,setUntil:l}=L(),c="never";if(n?.until)c="until";else if(n?.count)c="count";let u=n?.count||1,p=n?.until??void 0;return pe("div",{children:[j(s,{className:"text-xs",children:r("ends")}),j("div",{className:"space-y-2 mt-1",children:yt.map(({type:y,id:x,labelKey:g})=>{let b=y==="count"&&c==="count",M=y==="until"&&c==="until";return pe("div",{className:"flex items-center space-x-2",children:[j(v,{checked:c===y,id:x,onCheckedChange:()=>i(y)}),j(s,{className:"text-xs",htmlFor:x,children:r(g)}),b&&pe(gt,{children:[j(m,{className:"h-6 w-16 text-xs","data-testid":"count-input",min:"1",onChange:(U)=>a({count:Rt(U.target.value)}),type:"number",value:u}),j("span",{className:"text-xs",children:r("occurrences")})]}),M&&j(Ne,{className:"h-6",date:p,onChange:l})]},y)})})]})};import{useIlamyCalendarContext as Et}from"@ilamy/calendar";import{RRule as Z}from"rrule";import{jsx as V,jsxs as se}from"react/jsx-runtime";var fe={DAILY:Z.DAILY,WEEKLY:Z.WEEKLY,MONTHLY:Z.MONTHLY,YEARLY:Z.YEARLY},vt=Object.fromEntries(Object.entries(fe).map(([r,n])=>[n,r])),Ct=(r)=>Math.max(1,Number.parseInt(r,10)||1),Fe=()=>{let{t:r}=Et(),{opts:n,custom:a,update:i}=L();if(!a)return null;let l=vt[n?.freq??Z.DAILY]||"DAILY",c=n?.interval||1;return se("div",{className:"grid grid-cols-2 gap-4",children:[se("div",{children:[V(s,{className:"text-xs",htmlFor:"frequency",children:r("frequency")}),se(C,{onValueChange:(u)=>i({freq:fe[u]}),value:l,children:[V(h,{className:"h-8 w-full","data-testid":"frequency-select",id:"frequency",children:V(D,{})}),V(E,{children:Object.keys(fe).map((u)=>V(f,{value:u,children:r(u.toLowerCase())},u))})]})]}),se("div",{children:[V(s,{className:"text-xs",htmlFor:"interval",children:r("every")}),V(m,{className:"h-8",id:"interval",min:"1",onChange:(u)=>i({interval:Ct(u.target.value)}),type:"number",value:c})]})]})};import{useIlamyCalendarContext as ht}from"@ilamy/calendar";import{RRule as St}from"rrule";import{jsx as ee,jsxs as ye}from"react/jsx-runtime";var Le=()=>{let{t:r}=ht(),{opts:n,custom:a,reference:i,setMonthlyMode:l}=L();if(!a||n?.freq!==St.MONTHLY)return null;let u=z(n?.byweekday).some((p)=>typeof p==="object"&&p.n!=null)?"weekday":"day";return ye("div",{children:[ee(s,{className:"text-xs",htmlFor:"monthly-mode",children:r("repeatOn")}),ye(C,{onValueChange:(p)=>l(p),value:u,children:[ee(h,{className:"h-8 w-full","data-testid":"monthly-mode-select",id:"monthly-mode",children:ee(D,{})}),ye(E,{children:[ee(f,{value:"day",children:X("monthlyOnDay",i,r)}),ee(f,{value:"weekday",children:X("monthlyOnWeekday",i,r)})]})]})]})};import{useIlamyCalendarContext as Dt}from"@ilamy/calendar";import{jsx as te,jsxs as Ae}from"react/jsx-runtime";var xt=["daily","weekdays","weeklyOnDay","monthlyOnDay","monthlyOnWeekday","customize"],Ye=()=>{let{t:r}=Dt(),{opts:n,custom:a,reference:i,selectPreset:l}=L(),c=a?"customize":J(n,i);return Ae("div",{children:[te(s,{className:"text-xs",htmlFor:"recurrence-preset",children:r("repeats")}),Ae(C,{onValueChange:(u)=>l(u),value:c,children:[te(h,{className:"h-8 w-full","data-testid":"preset-select",id:"recurrence-preset",children:te(D,{})}),te(E,{children:xt.map((u)=>te(f,{value:u,children:X(u,i,r)},u))})]})]})};import{useIlamyCalendarContext as Ot}from"@ilamy/calendar";import{RRule as q}from"rrule";import{jsx as ie,jsxs as Be}from"react/jsx-runtime";var We=[q.SU,q.MO,q.TU,q.WE,q.TH,q.FR,q.SA],_e=()=>{let{t:r,firstDayOfWeek:n}=Ot(),{opts:a,custom:i,toggleDay:l}=L();if(!i||a?.freq!==q.WEEKLY)return null;let c=z(a?.byweekday),u=We.map((y,x)=>({value:y,label:t().day(x).format("ddd")})),p=We.map((y,x)=>u[(x+n)%7]);return Be("div",{children:[ie(s,{className:"text-xs",children:r("repeatOn")}),ie("div",{className:"flex flex-wrap gap-1 mt-1",children:p.map((y,x)=>Be("div",{className:"flex items-center space-x-1",children:[ie(v,{checked:c.includes(y.value),id:T("day",x),onCheckedChange:()=>l(y.value)}),ie(s,{className:"text-xs cursor-pointer",htmlFor:T("day",x),children:y.label})]},T("weekday",x)))})]})};import{jsx as Y,jsxs as le}from"react/jsx-runtime";var It=(r,n)=>{if(!r)return n("customRecurrence");try{let a=new $e(r).toText();if(!(Boolean(a)&&!a.toLowerCase().includes("error")))return n("customRecurrence");return a.charAt(0).toUpperCase()+a.slice(1)}catch{return n("customRecurrence")}},qe=({value:r,onChange:n,referenceDate:a})=>{let{t:i}=Pt(),l=(O)=>O?.dtstart??a??t().toDate(),[c,u]=Re(Boolean(r)),[p,y]=Re(()=>r||null),[x,g]=Re(()=>J(r??null,l(r??null))==="customize");wt(()=>{if(u(Boolean(r)),r){y(r);let O=r.dtstart??a??t().toDate();g(J(r,O)==="customize")}},[r,a]);let b=l(p),M=(O)=>{if(!p)return;let I={...p,...O};y(I),n(c?I:null)},U=(O)=>{if(u(O),!O){n(null);return}if(p){n(p);return}let I={freq:$e.DAILY,interval:1};y(I),g(!1),n(I)},ue={opts:p,custom:x,reference:b,update:M,selectPreset:(O)=>{if(O==="customize"){g(!0);return}g(!1);let I=G(O,b);if(!I)return;let K={...I,count:p?.count,until:p?.until};y(K),n(K)},toggleDay:(O)=>{let I=z(p?.byweekday),ne=I.includes(O)?I.filter((he)=>he!==O):[...I,O];M({byweekday:ne.length?ne:void 0})},setMonthlyMode:(O)=>{if(O==="weekday"){let K=G("monthlyOnWeekday",b);M({byweekday:K?.byweekday,bymonthday:void 0});return}let I=G("monthlyOnDay",b);M({bymonthday:I?.bymonthday,byweekday:void 0})},setEndType:(O)=>{let I={count:void 0,until:void 0};if(O==="count")I.count=p?.count||1;if(O==="until")I.until=p?.until||t().add(1,"month").endOf("day").toDate();M(I)},setUntil:(O)=>{let I=O?t(O).endOf("day").toDate():void 0;M({until:I})}},Ce=Boolean(c&&r);return Y(Te,{value:ue,children:le(xe,{"data-testid":"recurrence-editor",children:[le(Oe,{className:"pb-3",children:[le("div",{className:"flex items-center space-x-2",children:[Y(v,{checked:c,"data-testid":"toggle-recurrence",id:"recurring",onCheckedChange:U}),Y(Pe,{className:"text-sm",children:i("repeat")})]}),Ce&&Y("p",{className:"text-xs text-muted-foreground",children:It(r??null,i)})]}),c&&Y(we,{className:"pt-0",children:le("div",{className:"space-y-4",children:[Y(Ye,{}),Y(Fe,{}),Y(_e,{}),Y(Le,{}),Y(Ue,{})]})})]})})};import{jsx as bt}from"react/jsx-runtime";var He=({event:r,onChange:n})=>{let{rawEvents:a}=Tt(),i=r.uid,l;if(i)l=a.find((y)=>(y.uid||`${y.id}@ilamy.calendar`)===i&&Boolean(y.rrule));let[c,u]=kt(r.rrule??l?.rrule??null);return bt(qe,{onChange:(y)=>{if(!y){u(null),n({rrule:void 0});return}let x=y.dtstart??r.start?.toDate(),g=x?{...y,dtstart:x}:y;u(g),n({rrule:g})},referenceDate:r.start?.toDate(),value:c})};var ge=(r)=>Boolean(r.rrule||r.recurrenceId||r.uid),k=(r)=>r.uid||`${r.id}@ilamy.calendar`,ce=(r,n)=>{let a=k(n),i=r.findIndex((l)=>{let c=k(l)===a,u=Boolean(l.rrule)&&!l.recurrenceId;return c&&u});if(i===-1)throw Error("Base recurring event not found");return i},de=(r)=>r.start.subtract(1,"day").endOf("day").toDate(),Ee=(r)=>r.recurrenceId??r.start.toISOString(),Ke=(r,n)=>{let a=Ee(n),i=r.exdates||[],l=i.includes(a)?i:[...i,a];return{baseEvent:{...r,exdates:l},targetEventStartISO:a}};var Mt=({targetEvent:r,updatedEvents:n,baseEventIndex:a,baseEvent:i})=>{let l=Ee(r),c=k(i),{baseEvent:u}=Ke(i,r);n[a]=u;let p=(g)=>{let b=Boolean(g.recurrenceId),M=k(g)===c,U=g.recurrenceId===l;return b&&M&&U},y=n.find(p);return{events:n.filter((g)=>!p(g)),updated:y?[]:[u],added:[],deleted:y?[y]:[]}},Nt=({targetEvent:r,updatedEvents:n,baseEventIndex:a,baseEvent:i})=>{let l={...i,rrule:{...i.rrule,until:de(r)}};return n[a]=l,{events:n,updated:[l],added:[],deleted:[]}},Ut=({targetEvent:r,updatedEvents:n})=>{let a=k(r),i=n.filter((c)=>k(c)===a);return{events:n.filter((c)=>k(c)!==a),updated:[],added:[],deleted:i}},Ft={this:Mt,following:Nt,all:Ut},je=({targetEvent:r,currentEvents:n,scope:a})=>{let i=[...n],l=ce(i,r),c=i[l],u=Ft[a];if(!u)throw Error(`Invalid scope: ${a}. Must be 'this', 'following', or 'all'`);return u({targetEvent:r,updatedEvents:i,baseEventIndex:l,baseEvent:c})};import{RRule as Lt}from"rrule";var re=(r)=>new Date(Date.UTC(r.year(),r.month(),r.date(),r.hour(),r.minute(),r.second(),r.millisecond())),Ve=(r,n)=>n.year(r.getUTCFullYear()).month(r.getUTCMonth()).date(r.getUTCDate()).hour(r.getUTCHours()).minute(r.getUTCMinutes()).second(r.getUTCSeconds()).millisecond(r.getUTCMilliseconds());var ve=({event:r,currentEvents:n,startDate:a,endDate:i})=>{if(!r.rrule)return[];try{let l=re(r.start),c;if(r.rrule.until)c=re(t(r.rrule.until));let u={...r.rrule,dtstart:l,until:c},p=new Lt(u),y=k(r),x=n.filter((W)=>{let Q=Boolean(W.recurrenceId),H=k(W)===y;return Q&&H}),g=r.end.diff(r.start),b=re(a.subtract(g,"millisecond")),M=re(i);return p.between(b,M,!0).map((W,Q)=>{let H=Ve(W,r.start);if(x.some((Ze)=>A(Ze.recurrenceId)?.isSame(H)))return;let ue=H.toISOString();if(r.exdates?.includes(ue)??!1)return;let O=r.end.diff(r.start),I=H.add(O,"millisecond"),K=`${r.id}_${Q}`,ne=k(r);return{...r,id:K,start:H,end:I,uid:ne,rrule:void 0}}).filter((W)=>W!==void 0).filter((W)=>d(W,a,i))}catch(l){throw Error(`Invalid RRULE options: ${JSON.stringify(r.rrule)}. Error: ${l instanceof Error?l.message:"Unknown error"}`)}};var ze=(r,n)=>{let a=n.diff(n.startOf("day"),"millisecond");return r.startOf("day").add(a,"millisecond")},At=(r,n,a)=>{let i=r.end.diff(r.start),l=a.start||n.start,c=a.end||l.add(i),u=`${r.id}_following`,p=`${u}@ilamy.calendar`;return{...r,...a,rrule:{...r.rrule,...a.rrule,dtstart:l.toDate()},id:u,uid:p,start:l,end:c,recurrenceId:void 0}},Yt=(r,n)=>(a)=>{let i=Boolean(a.recurrenceId)&&!a.rrule,l=k(a)===r,c=Boolean(a.recurrenceId)&&t(a.recurrenceId).isAfter(n);return i&&l&&c},Wt=(r,n)=>{let a=r.start;if(n.start)a=ze(r.start,n.start);let i=r.end;if(n.start&&n.end)i=a.add(n.end.diff(n.start),"millisecond");else if(n.start)i=a.add(r.end.diff(r.start),"millisecond");else if(n.end)i=ze(r.end,n.end);let l=n.rrule??r.rrule,c;if(l)c={...l,dtstart:a.toDate()};return{start:a,end:i,rrule:c}},Bt=(r,n)=>{if(n&&r.recurrenceId)return r.recurrenceId;return r.start.toISOString()},_t=({updatedEvents:r,targetEvent:n,detachedOverride:a,updatedBaseEvent:i,baseChanged:l})=>{let c=r.findIndex((u)=>u.id===n.id);if(c===-1)throw Error("Detached override not found");return r[c]=a,{events:r,updated:l?[i,a]:[a],added:[],deleted:[]}},$t=({targetEvent:r,updates:n,updatedEvents:a,baseEventIndex:i,baseEvent:l})=>{let c=k(l),u=Boolean(r.recurrenceId&&!r.rrule),p=Bt(r,u),y=l.exdates||[],x=y.includes(p)?y:[...y,p],g=x!==y||l.uid!==c,b={...l,exdates:x,uid:c};a[i]=b;let M={...r,...n,recurrenceId:p,rrule:void 0,uid:c};if(u)return _t({updatedEvents:a,targetEvent:r,detachedOverride:M,updatedBaseEvent:b,baseChanged:g});let U={...M,id:`${l.id}_modified_${Date.now()}`};return a.push(U),{events:a,updated:[b],added:[U],deleted:[]}},qt=({targetEvent:r,updates:n,updatedEvents:a,baseEventIndex:i,baseEvent:l})=>{let c=de(r),u=k(l),p=Yt(u,c),y=(l.exdates??[]).filter((U)=>!t(U).isAfter(c)),x={...l,exdates:y,rrule:{...l.rrule,until:c}};a[i]=x;let g=At(l,r,n);a.push(g);let b=a.filter(p);return{events:a.filter((U)=>!p(U)),updated:[x],added:[g],deleted:b}},Ht=({updates:r,updatedEvents:n,baseEventIndex:a,baseEvent:i})=>{let l=k(i),c=Wt(i,r),u={...i,...r,start:c.start,end:c.end,rrule:c.rrule,exdates:void 0,uid:l};n[a]=u;let p=(g)=>{let b=Boolean(g.recurrenceId)&&!g.rrule,M=k(g)===l;return b&&M},y=n.filter((g)=>!p(g)),x=n.filter(p);return{events:y,updated:[u],added:[],deleted:x}},Kt={this:$t,following:qt,all:Ht},Qe=({targetEvent:r,updates:n,currentEvents:a,scope:i})=>{let l=[...a],c=ce(l,r),u=l[c],p=Kt[i];if(!p)throw Error(`Invalid scope: ${i}. Must be 'this', 'following', or 'all'`);return p({targetEvent:r,updates:n,updatedEvents:l,baseEventIndex:c,baseEvent:u})};import{jsx as Ge}from"react/jsx-runtime";var zt=()=>({name:"recurrence",transformEvents:(r,n)=>{let a=new Map;for(let i of r)if(i.rrule)a.set(k(i),i);return r.flatMap((i)=>{if(i.rrule)return ve({event:i,currentEvents:r,startDate:n.start,endDate:n.end});if(i.recurrenceId){let l=a.get(k(i));if(l)return[{...l,...i,rrule:void 0}]}return[i]})},managesEvent:(r)=>ge(r),applyEdit:({event:r,updates:n,currentEvents:a,scope:i})=>Qe({targetEvent:r,updates:n??{},currentEvents:a,scope:i}),applyDelete:({event:r,currentEvents:n,scope:a})=>je({targetEvent:r,currentEvents:n,scope:a}),contribute:(r,n)=>{if(r!=="ical:vevent-properties")return[];return me(n)},renderSlot:(r,n)=>{if(r===jt){let{event:a,onChange:i}=n;return Ge(He,{event:a,onChange:i})}if(r===Vt){let{event:a,operation:i,resolve:l,cancel:c}=n;return Ge(De,{eventTitle:a.title||"",isOpen:!0,onClose:c,onConfirm:(u)=>l(u),operationType:i})}return null}});export{Gn as RRule,Jn as Weekday,ve as generateRecurringEvents,ge as isRecurringEvent,me as recurrenceICalProperties,zt as recurrencePlugin};
|
|
1
|
+
import{t}from"../shared/chunk-nvtnncwx.js";import{e,V,d,T}from"../shared/chunk-89xfgjfh.js";import{o,v,m,s,C,D,E,h,f}from"../shared/chunk-j4ngnkkv.js";import{k,R,w,S,G,P,W}from"../shared/chunk-pg39xa62.js";import{RRule as ao,Weekday as so}from"rrule";import{RRule as nt}from"rrule";var Oe=(r,n=!1)=>{if(n)return r.format("YYYYMMDD");return r.utc().format("YYYYMMDD[T]HHmmss[Z]")},ot=(r)=>{try{return new nt(r).toString().split(`
|
|
2
|
+
`).find((a)=>a.startsWith("RRULE:"))||""}catch{return""}},ye=(r)=>{let n=[],a=r.rrule?ot(r.rrule):"";if(a)n.push(a);if(r.exdates?.length){let i=r.exdates.map((c)=>Oe(t(c),r.allDay)).join(",");n.push(`EXDATE:${i}`)}if(r.recurrenceId){let i=Oe(t(r.recurrenceId),r.allDay);n.push(`RECURRENCE-ID:${i}`)}return n};import"@ilamy/calendar";import{SLOT_EVENT_FORM as Zt,SLOT_EVENT_MUTATION_SCOPE as Xt}from"@ilamy/calendar";import{useIlamyCalendarContext as at}from"@ilamy/calendar";import{jsx as _,jsxs as ae}from"react/jsx-runtime";var st=[{scope:"this",title:"thisEvent",editKey:"onlyChangeThis",deleteKey:"onlyDeleteThis"},{scope:"following",title:"thisAndFollowingEvents",editKey:"changeThisAndFuture",deleteKey:"deleteThisAndFuture"},{scope:"all",title:"allEvents",editKey:"changeEntireSeries",deleteKey:"deleteEntireSeries"}];function we({isOpen:r,onClose:n,onConfirm:a,operationType:i,eventTitle:c}){let{t:l}=at(),u=(g)=>{a(g),n()},p=i==="edit",y=l("deleteRecurringEvent"),O=l("deleteRecurringEventQuestion");if(p)y=l("editRecurringEvent"),O=l("editRecurringEventQuestion");return _(R,{onOpenChange:(g)=>{if(!g)n()},open:r,children:ae(w,{className:"max-w-md",children:[ae(S,{children:[_(P,{children:y}),ae(W,{children:['"',c,'" ',O]})]}),_("div",{className:"space-y-3",children:st.map(({scope:g,title:M,editKey:N,deleteKey:F})=>_(o,{className:"w-full justify-start h-auto p-4",onClick:()=>u(g),variant:"outline",children:ae("div",{className:"text-left",children:[_("div",{className:"font-medium",children:l(M)}),_("div",{className:"text-sm text-muted-foreground",children:l(p?N:F)})]})},g))}),_(G,{children:_(o,{onClick:n,variant:"outline",children:l("cancel")})})]})})}import{useIlamyCalendarContext as Mt}from"@ilamy/calendar";import{useState as kt}from"react";import{useIlamyCalendarContext as Pt}from"@ilamy/calendar";import{jsx as se}from"react/jsx-runtime";function xe({className:r,...n}){return se("div",{className:e("text-card-foreground flex flex-col gap-1 rounded-xl border shadow-sm",r),"data-slot":"card",...n})}function Ie({className:r,...n}){return se("div",{className:e("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 p-4 pb-0 has-data-[slot=card-action]:grid-cols-[1fr_auto]",r),"data-slot":"card-header",...n})}function Pe({className:r,...n}){return se("div",{className:e("leading-none font-semibold",r),"data-slot":"card-title",...n})}function be({className:r,...n}){return se("div",{className:e("p-4 pt-0",r),"data-slot":"card-content",...n})}import{useEffect as bt,useState as ve}from"react";import{RRule as qe}from"rrule";import{createContext as it}from"react";var Te=it(void 0),Me=Te.Provider,A=()=>k(Te,"useRecurrenceEditor","RecurrenceEditor");import{RRule as U}from"rrule";var ct=[U.SU,U.MO,U.TU,U.WE,U.TH,U.FR,U.SA],lt=[U.MO,U.TU,U.WE,U.TH,U.FR],dt=["first","second","third","fourth"],ke=(r)=>ct.at(t(r).day())??U.SU,Ue=(r)=>{let n=t(r);return n.add(7,"day").month()!==n.month()?-1:Math.ceil(n.date()/7)},ut={daily:()=>({freq:U.DAILY}),weekdays:()=>({freq:U.WEEKLY,byweekday:lt}),weeklyOnDay:(r)=>({freq:U.WEEKLY,byweekday:[ke(r)]}),monthlyOnDay:(r)=>({freq:U.MONTHLY,bymonthday:t(r).date()}),monthlyOnWeekday:(r)=>({freq:U.MONTHLY,byweekday:[ke(r).nth(Ue(r))]})},Z=(r,n)=>{let a=ut[r];if(!a)return null;return{interval:1,dtstart:n,...a(n)}},Ne=(r)=>{if(r==null)return"";return(Array.isArray(r)?r:[r]).map((a)=>typeof a==="object"?`${a.weekday}:${a.n??""}`:`${a}:`).sort().join(",")},mt=(r,n)=>{if(!n)return!1;let a=r.freq===n.freq,i=Ne(r.byweekday)===Ne(n.byweekday),c=(r.bymonthday??null)===(n.bymonthday??null);return a&&i&&c},pt=["daily","weekdays","weeklyOnDay","monthlyOnDay","monthlyOnWeekday"],X=(r,n)=>{if(!r)return"once";if(Boolean(r.interval)&&r.interval!==1)return"customize";return pt.find((c)=>mt(r,Z(c,n)))??"customize"},J=(r,n,a)=>{let i=t(n).format("dddd"),c=Ue(n),l=c===-1?"last":dt.at(c-1)??"last",u=a(l);return{daily:a("daily"),weekdays:a("everyWeekday"),weeklyOnDay:`${a("weeklyOn")} ${i}`,monthlyOnDay:`${a("monthlyOnDay")} ${t(n).date()}`,monthlyOnWeekday:`${a("monthlyOnThe")} ${u} ${i}`}[r]??a("customRecurrence")},Q=(r)=>{if(Array.isArray(r))return r;return r?[r]:[]};import{useIlamyCalendarContext as Rt}from"@ilamy/calendar";import{jsx as yt}from"react/jsx-runtime";var ft="YYYY-MM-DD",Fe=({date:r,onChange:n,className:a})=>{let i=r?t(r).format(ft):"",c=(l)=>{let u=l.target.value;if(!u){n?.(void 0);return}let p=t(u);n?.(p.isValid()?p.toDate():void 0)};return yt("input",{className:e("flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none transition-shadow focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50",a),onChange:c,type:"date",value:i})};import{jsx as K,jsxs as Re,Fragment as vt}from"react/jsx-runtime";var gt=[{type:"never",id:"never",labelKey:"never"},{type:"count",id:"after",labelKey:"after"},{type:"until",id:"on",labelKey:"on"}],Et=(r)=>Math.max(1,Number.parseInt(r,10)||1),Le=()=>{let{t:r}=Rt(),{opts:n,update:a,setEndType:i,setUntil:c}=A(),l="never";if(n?.until)l="until";else if(n?.count)l="count";let u=n?.count||1,p=n?.until??void 0;return Re("div",{children:[K(s,{className:"text-xs",children:r("ends")}),K("div",{className:"space-y-2 mt-1",children:gt.map(({type:y,id:O,labelKey:g})=>{let M=y==="count"&&l==="count",N=y==="until"&&l==="until";return Re("div",{className:"flex items-center space-x-2",children:[K(v,{checked:l===y,id:O,onCheckedChange:()=>i(y)}),K(s,{className:"text-xs",htmlFor:O,children:r(g)}),M&&Re(vt,{children:[K(m,{className:"h-6 w-16 text-xs","data-testid":"count-input",min:"1",onChange:(F)=>a({count:Et(F.target.value)}),type:"number",value:u}),K("span",{className:"text-xs",children:r("occurrences")})]}),N&&K(Fe,{className:"h-6",date:p,onChange:c})]},y)})})]})};import{useIlamyCalendarContext as Ct}from"@ilamy/calendar";import{RRule as ee}from"rrule";import{jsx as z,jsxs as ie}from"react/jsx-runtime";var ge={DAILY:ee.DAILY,WEEKLY:ee.WEEKLY,MONTHLY:ee.MONTHLY,YEARLY:ee.YEARLY},St=Object.fromEntries(Object.entries(ge).map(([r,n])=>[n,r])),Dt=(r)=>Math.max(1,Number.parseInt(r,10)||1),Ae=()=>{let{t:r}=Ct(),{opts:n,custom:a,update:i}=A();if(!a)return null;let c=St[n?.freq??ee.DAILY]||"DAILY",l=n?.interval||1;return ie("div",{className:"grid grid-cols-2 gap-4",children:[ie("div",{children:[z(s,{className:"text-xs",htmlFor:"frequency",children:r("frequency")}),ie(C,{onValueChange:(u)=>i({freq:ge[u]}),value:c,children:[z(E,{className:"h-8 w-full","data-testid":"frequency-select",id:"frequency",children:z(D,{})}),z(h,{children:Object.keys(ge).map((u)=>z(f,{value:u,children:r(u.toLowerCase())},u))})]})]}),ie("div",{children:[z(s,{className:"text-xs",htmlFor:"interval",children:r("every")}),z(m,{className:"h-8",id:"interval",min:"1",onChange:(u)=>i({interval:Dt(u.target.value)}),type:"number",value:l})]})]})};import{useIlamyCalendarContext as ht}from"@ilamy/calendar";import{RRule as Ot}from"rrule";import{jsx as te,jsxs as Ee}from"react/jsx-runtime";var We=()=>{let{t:r}=ht(),{opts:n,custom:a,reference:i,setMonthlyMode:c}=A();if(!a||n?.freq!==Ot.MONTHLY)return null;let u=Q(n?.byweekday).some((p)=>typeof p==="object"&&p.n!=null)?"weekday":"day";return Ee("div",{children:[te(s,{className:"text-xs",htmlFor:"monthly-mode",children:r("repeatOn")}),Ee(C,{onValueChange:(p)=>c(p),value:u,children:[te(E,{className:"h-8 w-full","data-testid":"monthly-mode-select",id:"monthly-mode",children:te(D,{})}),Ee(h,{children:[te(f,{value:"day",children:J("monthlyOnDay",i,r)}),te(f,{value:"weekday",children:J("monthlyOnWeekday",i,r)})]})]})]})};import{useIlamyCalendarContext as wt}from"@ilamy/calendar";import{jsx as re,jsxs as Ye}from"react/jsx-runtime";var xt=["daily","weekdays","weeklyOnDay","monthlyOnDay","monthlyOnWeekday","customize"],Be=()=>{let{t:r}=wt(),{opts:n,custom:a,reference:i,selectPreset:c}=A(),l=a?"customize":X(n,i);return Ye("div",{children:[re(s,{className:"text-xs",htmlFor:"recurrence-preset",children:r("repeats")}),Ye(C,{onValueChange:(u)=>c(u),value:l,children:[re(E,{className:"h-8 w-full","data-testid":"preset-select",id:"recurrence-preset",children:re(D,{})}),re(h,{children:xt.map((u)=>re(f,{value:u,children:J(u,i,r)},u))})]})]})};import{useIlamyCalendarContext as It}from"@ilamy/calendar";import{RRule as j}from"rrule";import{jsx as ce,jsxs as $e}from"react/jsx-runtime";var _e=[j.SU,j.MO,j.TU,j.WE,j.TH,j.FR,j.SA],je=()=>{let{t:r,firstDayOfWeek:n}=It(),{opts:a,custom:i,toggleDay:c}=A();if(!i||a?.freq!==j.WEEKLY)return null;let l=Q(a?.byweekday),u=_e.map((y,O)=>({value:y,label:t().day(O).format("ddd")})),p=_e.map((y,O)=>u[(O+n)%7]);return $e("div",{children:[ce(s,{className:"text-xs",children:r("repeatOn")}),ce("div",{className:"flex flex-wrap gap-1 mt-1",children:p.map((y,O)=>$e("div",{className:"flex items-center space-x-1",children:[ce(v,{checked:l.includes(y.value),id:T("day",O),onCheckedChange:()=>c(y.value)}),ce(s,{className:"text-xs cursor-pointer",htmlFor:T("day",O),children:y.label})]},T("weekday",O)))})]})};import{jsx as Y,jsxs as le}from"react/jsx-runtime";var Tt=(r,n)=>{if(!r)return n("customRecurrence");try{let a=new qe(r).toText();if(!(Boolean(a)&&!a.toLowerCase().includes("error")))return n("customRecurrence");return a.charAt(0).toUpperCase()+a.slice(1)}catch{return n("customRecurrence")}},He=({value:r,onChange:n,referenceDate:a})=>{let{t:i}=Pt(),c=(x)=>x?.dtstart??a??t().toDate(),[l,u]=ve(Boolean(r)),[p,y]=ve(()=>r||null),[O,g]=ve(()=>X(r??null,c(r??null))==="customize");bt(()=>{if(u(Boolean(r)),r){y(r);let x=r.dtstart??a??t().toDate();g(X(r,x)==="customize")}},[r,a]);let M=c(p),N=(x)=>{if(!p)return;let I={...p,...x};y(I),n(l?I:null)},F=(x)=>{if(u(x),!x){n(null);return}if(p){n(p);return}let I={freq:qe.DAILY,interval:1};y(I),g(!1),n(I)},he={opts:p,custom:O,reference:M,update:N,selectPreset:(x)=>{if(x==="customize"){g(!0);return}g(!1);let I=Z(x,M);if(!I)return;let H={...I,count:p?.count,until:p?.until};y(H),n(H)},toggleDay:(x)=>{let I=Q(p?.byweekday),oe=I.includes(x)?I.filter((fe)=>fe!==x):[...I,x];N({byweekday:oe.length?oe:void 0})},setMonthlyMode:(x)=>{if(x==="weekday"){let H=Z("monthlyOnWeekday",M);N({byweekday:H?.byweekday,bymonthday:void 0});return}let I=Z("monthlyOnDay",M);N({bymonthday:I?.bymonthday,byweekday:void 0})},setEndType:(x)=>{let I={count:void 0,until:void 0};if(x==="count")I.count=p?.count||1;if(x==="until")I.until=p?.until||t().add(1,"month").endOf("day").toDate();N(I)},setUntil:(x)=>{let I=x?t(x).endOf("day").toDate():void 0;N({until:I})}},pe=Boolean(l&&r);return Y(Me,{value:he,children:le(xe,{"data-testid":"recurrence-editor",children:[le(Ie,{className:"pb-3",children:[le("div",{className:"flex items-center space-x-2",children:[Y(v,{checked:l,"data-testid":"toggle-recurrence",id:"recurring",onCheckedChange:F}),Y(Pe,{className:"text-sm",children:i("repeat")})]}),pe&&Y("p",{className:"text-xs text-muted-foreground",children:Tt(r??null,i)})]}),l&&Y(be,{className:"pt-0",children:le("div",{className:"space-y-4",children:[Y(Be,{}),Y(Ae,{}),Y(je,{}),Y(We,{}),Y(Le,{})]})})]})})};import{jsx as Nt}from"react/jsx-runtime";var Ke=({event:r,onChange:n})=>{let{rawEvents:a}=Mt(),i=r.uid,c;if(i)c=a.find((y)=>(y.uid||`${y.id}@ilamy.calendar`)===i&&Boolean(y.rrule));let[l,u]=kt(r.rrule??c?.rrule??null);return Nt(He,{onChange:(y)=>{if(!y){u(null),n({rrule:void 0});return}let O=y.dtstart??r.start?.toDate(),g=O?{...y,dtstart:O}:y;u(g),n({rrule:g})},referenceDate:r.start?.toDate(),value:l})};var Ce=(r)=>Boolean(r.rrule||r.recurrenceId||r.uid),b=(r)=>r.uid||`${r.id}@ilamy.calendar`,de=(r,n)=>{let a=b(n),i=r.findIndex((c)=>{let l=b(c)===a,u=Boolean(c.rrule)&&!c.recurrenceId;return l&&u});if(i===-1)throw Error("Base recurring event not found");return i},ue=(r)=>r.start.subtract(1,"day").endOf("day").toDate(),me=(r,n)=>(a)=>{let i=Boolean(a.recurrenceId)&&!a.rrule,c=b(a)===r,l=Boolean(a.recurrenceId)&&t(a.recurrenceId).isAfter(n);return i&&c&&l},Se=(r)=>r.recurrenceId??r.start.toISOString(),Ve=(r,n)=>{let a=Se(n),i=r.exdates||[],c=i.includes(a)?i:[...i,a];return{baseEvent:{...r,exdates:c},targetEventStartISO:a}};var Ut=({targetEvent:r,updatedEvents:n,baseEventIndex:a,baseEvent:i})=>{let c=Se(r),l=b(i),{baseEvent:u}=Ve(i,r);n[a]=u;let p=(g)=>{let M=Boolean(g.recurrenceId),N=b(g)===l,F=g.recurrenceId===c;return M&&N&&F},y=n.find(p);return{events:n.filter((g)=>!p(g)),updated:y?[]:[u],added:[],deleted:y?[y]:[]}},Ft=({targetEvent:r,updatedEvents:n,baseEventIndex:a,baseEvent:i})=>{let c=ue(r),l={...i,rrule:{...i.rrule,until:c}};n[a]=l;let u=b(i),p=me(u,c),y=n.filter(p);return{events:n.filter((g)=>!p(g)),updated:[l],added:[],deleted:y}},Lt=({targetEvent:r,updatedEvents:n})=>{let a=b(r),i=n.filter((l)=>b(l)===a);return{events:n.filter((l)=>b(l)!==a),updated:[],added:[],deleted:i}},At={this:Ut,following:Ft,all:Lt},ze=({targetEvent:r,currentEvents:n,scope:a})=>{let i=[...n],c=de(i,r),l=i[c],u=At[a];if(!u)throw Error(`Invalid scope: ${a}. Must be 'this', 'following', or 'all'`);return u({targetEvent:r,updatedEvents:i,baseEventIndex:c,baseEvent:l})};import{RRule as Wt}from"rrule";var ne=(r)=>new Date(Date.UTC(r.year(),r.month(),r.date(),r.hour(),r.minute(),r.second(),r.millisecond())),Qe=(r,n)=>{let a=r.toISOString().replace("Z","");return t(a).locale(n.locale())};var Ge=42,Yt=4096,Ze=new WeakMap,Bt=({event:r,rrule:n,ruleOptions:a,floatingUntil:i})=>{let c=i?.getTime(),l=Ze.get(r),u=l?.rruleOptions===n,p=l?.start===r.start,y=l?.floatingUntilMs===c;if(l&&u&&p&&y)return l;let O={rruleOptions:n,start:r.start,floatingUntilMs:c,rule:new Wt(a),windowStartMs:Number.POSITIVE_INFINITY,windowEndMs:Number.NEGATIVE_INFINITY,windowOccurrences:[],instants:new Map};return Ze.set(r,O),O},_t=(r,n,a)=>{let i=n.getTime(),c=a.getTime();if(Number.isNaN(i)||Number.isNaN(c))return r.rule.between(n,a,!0).map((g)=>g.getTime());let u=i>=r.windowStartMs,p=c<=r.windowEndMs;if(!(u&&p))r.windowStartMs=t.utc(i).subtract(Ge,"day").valueOf(),r.windowEndMs=t.utc(c).add(Ge,"day").valueOf(),r.windowOccurrences=r.rule.between(new Date(r.windowStartMs),new Date(r.windowEndMs),!0).map((g)=>g.getTime());let O=[];for(let g of r.windowOccurrences){if(g>c)break;if(g>=i)O.push(g)}return O},$t=(r,n,a)=>{let i=r.instants.get(n);if(i)return i;if(r.instants.size>=Yt)r.instants.clear();let c=Qe(new Date(n),a);return r.instants.set(n,c),c},De=({event:r,currentEvents:n,startDate:a,endDate:i})=>{if(!r.rrule)return[];try{let c=ne(r.start),l;if(r.rrule.until)l=ne(t(r.rrule.until));let u={...r.rrule,dtstart:c,until:l},p=Bt({event:r,rrule:r.rrule,ruleOptions:u,floatingUntil:l}),y=b(r),O=n.filter((L)=>{let B=Boolean(L.recurrenceId),q=b(L)===y;return B&&q}),g=new Set;for(let L of O){let B=V(L.recurrenceId);if(B)g.add(B.valueOf())}let M=r.end.diff(r.start),N=ne(a.subtract(M,"millisecond")),F=ne(i);return _t(p,N,F).map((L,B)=>{let q=$t(p,L,r.start);if(g.has(q.valueOf()))return;let pe=q.toISOString();if(r.exdates?.includes(pe)??!1)return;let I=r.end.diff(r.start),H=q.add(I,"millisecond"),oe=`${r.id}_${B}`,fe=b(r);return{...r,id:oe,start:q,end:H,uid:fe,rrule:void 0}}).filter((L)=>L!==void 0).filter((L)=>d(L,a,i))}catch(c){throw Error(`Invalid RRULE options: ${JSON.stringify(r.rrule)}. Error: ${c instanceof Error?c.message:"Unknown error"}`)}};var Xe=(r,n)=>{let a=r.format("YYYY-MM-DD"),i=n.format("HH:mm:ss.SSS"),c=`${a}T${i}`;return t(c)},jt=(r,n,a)=>{let i=r.end.diff(r.start),c=a.start||n.start,l=a.end||c.add(i),u=`${r.id}_following`,p=`${u}@ilamy.calendar`;return{...r,...a,rrule:{...r.rrule,...a.rrule,dtstart:c.toDate()},id:u,uid:p,start:c,end:l,recurrenceId:void 0}},qt=(r,n)=>{let a=r.start;if(n.start)a=Xe(r.start,n.start);let i=r.end;if(n.start&&n.end)i=a.add(n.end.diff(n.start),"millisecond");else if(n.start)i=a.add(r.end.diff(r.start),"millisecond");else if(n.end)i=Xe(r.end,n.end);let c=n.rrule??r.rrule,l;if(c)l={...c,dtstart:a.toDate()};return{start:a,end:i,rrule:l}},Ht=(r,n)=>{if(n&&r.recurrenceId)return r.recurrenceId;return r.start.toISOString()},Kt=({updatedEvents:r,targetEvent:n,detachedOverride:a,updatedBaseEvent:i,baseChanged:c})=>{let l=r.findIndex((u)=>u.id===n.id);if(l===-1)throw Error("Detached override not found");return r[l]=a,{events:r,updated:c?[i,a]:[a],added:[],deleted:[]}},Vt=({targetEvent:r,updates:n,updatedEvents:a,baseEventIndex:i,baseEvent:c})=>{let l=b(c),u=Boolean(r.recurrenceId&&!r.rrule),p=Ht(r,u),y=c.exdates||[],O=y.includes(p)?y:[...y,p],g=O!==y||c.uid!==l,M={...c,exdates:O,uid:l};a[i]=M;let N={...r,...n,recurrenceId:p,rrule:void 0,uid:l};if(u)return Kt({updatedEvents:a,targetEvent:r,detachedOverride:N,updatedBaseEvent:M,baseChanged:g});let F={...N,id:`${c.id}_modified_${Date.now()}`};return a.push(F),{events:a,updated:[M],added:[F],deleted:[]}},zt=({targetEvent:r,updates:n,updatedEvents:a,baseEventIndex:i,baseEvent:c})=>{let l=ue(r),u=b(c),p=me(u,l),y=(c.exdates??[]).filter((F)=>!t(F).isAfter(l)),O={...c,exdates:y,rrule:{...c.rrule,until:l}};a[i]=O;let g=jt(c,r,n);a.push(g);let M=a.filter(p);return{events:a.filter((F)=>!p(F)),updated:[O],added:[g],deleted:M}},Qt=({updates:r,updatedEvents:n,baseEventIndex:a,baseEvent:i})=>{let c=b(i),l=qt(i,r),u={...i,...r,start:l.start,end:l.end,rrule:l.rrule,exdates:void 0,uid:c};n[a]=u;let p=(g)=>{let M=Boolean(g.recurrenceId)&&!g.rrule,N=b(g)===c;return M&&N},y=n.filter((g)=>!p(g)),O=n.filter(p);return{events:y,updated:[u],added:[],deleted:O}},Gt={this:Vt,following:zt,all:Qt},Je=({targetEvent:r,updates:n,currentEvents:a,scope:i})=>{let c=[...a],l=de(c,r),u=c[l],p=Gt[i];if(!p)throw Error(`Invalid scope: ${i}. Must be 'this', 'following', or 'all'`);return p({targetEvent:r,updates:n,updatedEvents:c,baseEventIndex:l,baseEvent:u})};import{jsx as et}from"react/jsx-runtime";var Jt=()=>({name:"recurrence",transformEvents:(r,n)=>{let a=new Map;for(let i of r)if(i.rrule)a.set(b(i),i);return r.flatMap((i)=>{if(i.rrule)return De({event:i,currentEvents:r,startDate:n.start,endDate:n.end});if(i.recurrenceId){let c=a.get(b(i));if(c)return[{...c,...i,rrule:void 0}]}return[i]})},managesEvent:(r)=>Ce(r),applyEdit:({event:r,updates:n,currentEvents:a,scope:i})=>Je({targetEvent:r,updates:n??{},currentEvents:a,scope:i}),applyDelete:({event:r,currentEvents:n,scope:a})=>ze({targetEvent:r,currentEvents:n,scope:a}),contribute:(r,n)=>{if(r!=="ical:vevent-properties")return[];return ye(n)},renderSlot:(r,n)=>{if(r===Zt){let{event:a,onChange:i}=n;return et(Ke,{event:a,onChange:i})}if(r===Xt){let{event:a,operation:i,resolve:c,cancel:l}=n;return et(we,{eventTitle:a.title||"",isOpen:!0,onClose:l,onConfirm:(u)=>c(u),operationType:i})}return null}});export{ao as RRule,so as Weekday,De as generateRecurringEvents,Ce as isRecurringEvent,ye as recurrenceICalProperties,Jt as recurrencePlugin};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t}from"./chunk-nvtnncwx.js";function V(s){if(s===void 0)return;if(t.isDayjs(s))return s;let n=t(s);return n.isValid()?n:void 0}var c=(s)=>s.format("YYYY-MM-DD"),U=(s,n)=>c(s)===c(n);function d(s,n,r){let o=s.start.isSameOrAfter(n)&&s.start.isSameOrBefore(r),a=s.end.isAfter(n)&&s.end.isSameOrBefore(r),f=s.start.isBefore(n)&&s.end.isAfter(r);return o||a||f}var u=(s)=>{let n=s.utcOffset();return s.utc().add(n,"minute")},N=(s,n,r)=>{let o=u(s),a=u(n);return o.diff(a,r,!0)},T=(...s)=>s.join("-");function pe(s){let n=s.replace("#",""),r=n.length===3?n.split("").map((i)=>i+i).join(""):n;if(!/^[0-9a-fA-F]{6}$/.test(r))return"#000000";let o=Number.parseInt(r.slice(0,2),16),a=Number.parseInt(r.slice(2,4),16),f=Number.parseInt(r.slice(4,6),16);return(o*299+a*587+f*114)/1000>=128?"#000000":"#ffffff"}import{clsx as l}from"clsx";import{twMerge as y}from"tailwind-merge";function e(...s){return y(l(s))}
|
|
2
|
+
export{e,V,c,U,d,N,T,pe};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-89xfgjfh.js";import*as f from"@radix-ui/react-scroll-area";import{jsx as S,jsxs as k}from"react/jsx-runtime";function u({className:t,children:r,viewPortProps:o,...n}){return k(f.Root,{className:e("relative",t),"data-slot":"scroll-area",...n,children:[S(f.Viewport,{...o,className:e("focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",o?.className),"data-slot":"scroll-area-viewport",children:r}),S(y,{}),S(f.Corner,{})]})}function y({className:t,orientation:r="vertical",...o}){return S(f.ScrollAreaScrollbar,{className:e("flex touch-none p-px transition-colors select-none",r==="vertical"&&"h-full w-2.5 border-l border-l-transparent",r==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",t),"data-slot":"scroll-area-scrollbar",orientation:r,...o,children:S(f.ScrollAreaThumb,{className:"bg-border relative flex-1 rounded-full","data-slot":"scroll-area-thumb"})})}import{jsx as T,jsxs as B}from"react/jsx-runtime";var b=({today:t,dayNumber:r,weekday:o,className:n,"data-testid":i})=>B("div",{className:e("flex flex-col items-center",n),"data-testid":i,"data-today":t?"true":void 0,children:[o!=null&&T("div",{className:e("w-full truncate text-center text-xs text-muted-foreground",t&&"text-primary"),children:o}),T("div",{className:e("flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-xs font-medium",t&&"bg-primary text-primary-foreground"),children:r})]});import l from"dayjs";import V from"dayjs/plugin/isSameOrAfter.js";import F from"dayjs/plugin/isSameOrBefore.js";import L from"dayjs/plugin/localeData.js";import W from"dayjs/plugin/localizedFormat.js";import K from"dayjs/plugin/minMax.js";import U from"dayjs/plugin/timezone.js";import Z from"dayjs/plugin/utc.js";import q from"dayjs/plugin/weekday.js";import E from"dayjs/plugin/weekOfYear.js";var h,G=(t,r,o)=>{let n=r.prototype,i=o.tz.setDefault;o.tz.setDefault=(s)=>(h=s,i(s));let{startOf:a,endOf:p}=n;function d(s,c){let m=s.$x?.$timezone||h;if(!m)return c;let x=o.tz(c.format("YYYY-MM-DDTHH:mm:ss"),m).utcOffset();if(c.utcOffset()!==x)return c.tz(m,!0);return c}function v(s,c,m,x){let N=s.locale(),re="YYYY-MM-DDTHH:mm:ss.SSS",H=s.format("YYYY-MM-DDTHH:mm:ss.SSS"),g=o.utc(H).locale(N),O=a.call(g,m,x),R=O.format("YYYY-MM-DDTHH:mm:ss.SSS"),I=g.diff(O),z=o(s.valueOf()-I).tz(c).locale(N);if(z.format("YYYY-MM-DDTHH:mm:ss.SSS")===R)return z;return o.tz(R,c).locale(N)}n.startOf=function(s,c){let m=this.$x?.$timezone;if(m)return v(this,m,s,c);let x=a.call(this,s,c);return d(this,x)},n.endOf=p},J=(t,r)=>{let o=r.prototype,n={isBefore:(i,a)=>i<a,isAfter:(i,a)=>i>a,isSame:(i,a)=>i===a,isSameOrBefore:(i,a)=>i<=a,isSameOrAfter:(i,a)=>i>=a};for(let[i,a]of Object.entries(n)){let p=o[i];o[i]=function(d,v){if(v===void 0&&l.isDayjs(d))return a(this.valueOf(),d.valueOf());return p.call(this,d,v)}}};l.extend(q);l.extend(E);l.extend(V);l.extend(F);l.extend(K);l.extend(U);l.extend(Z);l.extend(L);l.extend(W);l.extend(G);l.extend(J);var Q=/(?:Z|[+-]\d{2}:?\d{2})$/i,X=(t)=>{let r=t.split(/[Tt\s]/).at(1);if(!r)return!1;return Q.test(r)},j=(t)=>typeof t==="string"&&!X(t),w=(t)=>{let r=l(t);if(!r.isValid())return r;if(j(t))return l.tz(t);if(!h)return r;return r.tz(h)};Object.assign(w,l);var A=w;var C=(t)=>{let r=t.utcOffset();return t.utc().add(r,"minute")},P=(t,r,o)=>{let n=C(t),i=C(r);return n.diff(i,o,!0)};import{memo as _}from"react";import{jsx as D,jsxs as M,Fragment as te}from"react/jsx-runtime";var ee=({rangeStart:t,rangeEnd:r,now:o,axis:n="vertical",render:i,withDot:a=!0})=>{let p=o??A(),d=p.valueOf();if(!(d>=t.valueOf()&&d<r.valueOf()))return null;let s=P(r,t,"minute"),m=P(p,t,"minute")/s*100;if(i)return D(te,{children:i({currentTime:p,rangeStart:t,rangeEnd:r,progress:m,axis:n})});if(n==="horizontal")return M("div",{className:"absolute top-0 bottom-0 z-50 flex -translate-x-1/2 flex-col items-center pointer-events-none","data-testid":"current-time-indicator",style:{left:`${m}%`},children:[a&&D("div",{className:"size-2 shrink-0 rounded-full bg-red-500","data-testid":"current-time-dot"}),D("div",{className:"w-0.5 flex-1 bg-red-500"})]});return M("div",{className:"absolute right-0 left-0 z-50 flex -translate-y-1/2 items-center pointer-events-none","data-testid":"current-time-indicator",style:{top:`${m}%`},children:[a&&D("div",{className:"size-2 shrink-0 rounded-full bg-red-500","data-testid":"current-time-dot"}),D("div",{className:"h-0.5 flex-1 bg-red-500"})]})},Y=_(ee);
|
|
2
|
+
export{u,y,b,Y};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{e}from"./chunk-
|
|
2
|
-
export{o,v,m,s,C,D,h,
|
|
1
|
+
import{e}from"./chunk-89xfgjfh.js";import{Slot as x}from"@radix-ui/react-slot";import{cva as P}from"class-variance-authority";import{jsx as S}from"react/jsx-runtime";var y=P("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function o({className:i,variant:r,size:n,asChild:l=!1,...d}){return S(l?x:"button",{className:e(y({variant:r,size:n,className:i})),"data-slot":"button",...d})}import*as c from"@radix-ui/react-checkbox";import{CheckIcon as k}from"lucide-react";import{jsx as p}from"react/jsx-runtime";function v({className:i,...r}){return p(c.Root,{className:e("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",i),"data-slot":"checkbox",...r,children:p(c.Indicator,{className:"flex items-center justify-center text-current transition-none","data-slot":"checkbox-indicator",children:p(k,{className:"size-3.5"})})})}import{jsx as w}from"react/jsx-runtime";function m({className:i,type:r,...n}){return w("input",{className:e("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i),"data-slot":"input",type:r,...n})}import*as g from"@radix-ui/react-label";import{jsx as R}from"react/jsx-runtime";function s({className:i,...r}){return R(g.Root,{className:e("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",i),"data-slot":"label",...r})}import*as t from"@radix-ui/react-select";import{CheckIcon as z,ChevronDownIcon as b,ChevronUpIcon as I}from"lucide-react";import{jsx as a,jsxs as u}from"react/jsx-runtime";function C({...i}){return a(t.Root,{"data-slot":"select",...i})}function D({...i}){return a(t.Value,{"data-slot":"select-value",...i})}function E({className:i,size:r="default",children:n,...l}){return u(t.Trigger,{className:e("cursor-pointer border-input data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",i),"data-size":r,"data-slot":"select-trigger",...l,children:[n,a(t.Icon,{asChild:!0,children:a(b,{className:"size-4 opacity-50"})})]})}function h({className:i,children:r,position:n="popper",align:l="center",...d}){return a(t.Portal,{children:u(t.Content,{align:l,className:e("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",i),"data-slot":"select-content",position:n,...d,children:[a(N,{}),a(t.Viewport,{className:e("p-1",n==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"),children:r}),a(_,{})]})})}function f({className:i,children:r,...n}){return u(t.Item,{className:e("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",i),"data-slot":"select-item",...n,children:[a("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a(t.ItemIndicator,{children:a(z,{className:"size-4"})})}),a(t.ItemText,{children:r})]})}function N({className:i,...r}){return a(t.ScrollUpButton,{className:e("flex cursor-default items-center justify-center py-1",i),"data-slot":"select-scroll-up-button",...r,children:a(I,{className:"size-4"})})}function _({className:i,...r}){return a(t.ScrollDownButton,{className:e("flex cursor-default items-center justify-center py-1",i),"data-slot":"select-scroll-down-button",...r,children:a(b,{className:"size-4"})})}
|
|
2
|
+
export{o,v,m,s,C,D,E,h,f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{k,R,w,S,P}from"./chunk-pg39xa62.js";import{le,t}from"./chunk-nvtnncwx.js";import{e,V,c,U,d,N}from"./chunk-89xfgjfh.js";import{u,y,b,Y}from"./chunk-bgegqhb4.js";var se={today:"Today",create:"Create",new:"New",update:"Update",delete:"Delete",cancel:"Cancel",export:"Export",previous:"Previous",next:"Next",event:"Event",events:"Events",newEvent:"New Event",title:"Title",description:"Description",location:"Location",allDay:"All day",startDate:"Start Date",endDate:"End Date",startTime:"Start Time",searchTime:"Search time...",endTime:"End Time",color:"Color",createEvent:"Create Event",editEvent:"Edit Event",addNewEvent:"Add a new event to your calendar",editEventDetails:"Edit your event details",eventTitlePlaceholder:"Event title",eventDescriptionPlaceholder:"Event description (optional)",eventLocationPlaceholder:"Event location (optional)",repeat:"Repeat",repeats:"Repeats",customRecurrence:"Custom recurrence",frequency:"Frequency",everyWeekday:"Every weekday",weeklyOn:"Weekly on",monthlyOnDay:"Monthly on day",monthlyOnThe:"Monthly on the",first:"first",second:"second",third:"third",fourth:"fourth",last:"last",daily:"Daily",weekly:"Weekly",monthly:"Monthly",yearly:"Yearly",interval:"Interval",repeatOn:"Repeat on",never:"Never",count:"Count",every:"Every",ends:"Ends",after:"After",occurrences:"occurrences",on:"On",editRecurringEvent:"Edit recurring event",deleteRecurringEvent:"Delete recurring event",editRecurringEventQuestion:"is a recurring event. How would you like to edit it?",deleteRecurringEventQuestion:"is a recurring event. How would you like to delete it?",thisEvent:"This event",thisEventDescription:"Only change this specific occurrence",thisAndFollowingEvents:"This and following events",thisAndFollowingEventsDescription:"Edit this and all future occurrences",allEvents:"All events",allEventsDescription:"Edit the entire recurring series",onlyChangeThis:"Only change this specific occurrence",changeThisAndFuture:"Change this and all future occurrences",changeEntireSeries:"Change the entire recurring series",onlyDeleteThis:"Only delete this specific occurrence",deleteThisAndFuture:"Delete this and all future occurrences",deleteEntireSeries:"Delete the entire recurring series",month:"Month",week:"Week",day:"Day",year:"Year",agenda:"Agenda",agendaNoEvents:"No upcoming events",more:"more",resources:"Resources",resource:"Resource",selectResource:"Select a resource",time:"Time",date:"Date",noResourcesVisible:"No resources visible",addResourcesOrShowExisting:"Add resources or show existing ones"};import{createContext as kn}from"react";var vt=kn(void 0);var Hn=[];function r(o){let s=k(vt,"useSmartCalendarContext","CalendarProvider");return o?o(s):s}function fe(){let o=r();return{currentDate:o.currentDate,currentRange:o.currentRange,view:o.view,events:o.events,rawEvents:o.rawEvents,isEventFormOpen:o.isEventFormOpen,selectedEvent:o.selectedEvent,selectedDate:o.selectedDate,firstDayOfWeek:o.firstDayOfWeek,resources:o.resources??Hn,orientation:o.orientation,setCurrentDate:o.setCurrentDate,selectDate:o.selectDate,setView:o.setView,nextPeriod:o.nextPeriod,prevPeriod:o.prevPeriod,today:o.today,addEvent:o.addEvent,updateEvent:o.updateEvent,deleteEvent:o.deleteEvent,openEventForm:o.openEventForm,closeEventForm:o.closeEventForm,onEventClick:o.onEventClick,renderCurrentTimeIndicator:o.renderCurrentTimeIndicator,getEventsForResource:o.getEventsForResource,businessHours:o.businessHours,t:o.t,timeFormat:o.timeFormat,timezone:o.timezone,currentLocale:o.currentLocale,getEventsForDateRange:o.getEventsForDateRange,applyScopedEdit:o.applyScopedEdit,applyScopedDelete:o.applyScopedDelete,getEventManager:o.getEventManager,renderSlot:o.renderSlot,collect:o.collect,getViews:o.getViews}}import{useMemo as Fa}from"react";var Z=1,ar=24,Q=24,sr=4,ir="bg-[color-mix(in_oklch,var(--background),var(--foreground)_3%)] text-muted-foreground pointer-events-none",H={sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6},gt="h-12",Ct="bg-blue-50 text-blue-600 font-medium",ue="h-24";import{useEffect as yn,useMemo as fn,useRef as vn,useState as Pa}from"react";import{useMemo as On}from"react";import{useCallback as Lt}from"react";var it=(o,s)=>({...o,added:o.action==="add"?[s]:[],updated:o.action==="update"?[s]:[],deleted:o.action==="delete"?[s]:[]}),zt=(o,s,m)=>{if(!Array.isArray(o))return o;let{added:v,updated:C,deleted:E}=it(s,m);return{events:o,added:v,updated:C,deleted:E}},_t=(o,s,{onEventUpdate:m,onEventAdd:f,onEventDelete:v,onEventsChange:C,setCurrentEvents:E})=>{for(let D of o.updated)m?.(D);for(let D of o.added)f?.(D);for(let D of o.deleted)v?.(D);E(o.events),C?.({...s,added:o.added,updated:o.updated,deleted:o.deleted})};var lr=({currentEvents:o,setCurrentEvents:s,onEventAdd:m,onEventUpdate:f,onEventDelete:v,onEventsChange:C})=>{let E=Lt((h)=>{s((W)=>[...W,h]),m?.(h),C?.(it({action:"add",event:h},h))},[s,m,C]),D=Lt((h,W)=>{let ye=o.find((ve)=>ve.id===h);if(!ye)return;let ge={...ye,...W};s((ve)=>ve.map((pe)=>pe.id===h?ge:pe)),f?.(ge),C?.(it({action:"update",event:ye},ge))},[o,s,f,C]),G=Lt((h)=>{let W=o.find((ge)=>ge.id===h);if(!W)return;s((ge)=>ge.filter((T)=>T.id!==h)),v?.(W),C?.(it({action:"delete",event:W},W))},[o,s,v,C]);return{addEvent:E,updateEvent:D,deleteEvent:G}};import{useCallback as Nn,useEffect as Tn,useMemo as Pn,useRef as In,useState as jn}from"react";var dr=({events:o,pluginRuntime:s,getCurrentViewRange:m})=>{let[f,v]=jn(o),C=In(o);Tn(()=>{if(o!==C.current)v(o),C.current=o},[o]);let E=Nn((G,h)=>s.transformEvents(f,{start:G,end:h}),[f,s]),D=Pn(()=>{let{start:G,end:h}=m();return E(G,h)},[E,m]);return{currentEvents:f,setCurrentEvents:v,getEventsForDateRange:E,processedEvents:D}};import{useCallback as cr,useMemo as Mn}from"react";var ur=({currentEvents:o,pluginRuntime:s,setCurrentEvents:m,onEventAdd:f,onEventUpdate:v,onEventDelete:C,onEventsChange:E})=>{let D=Mn(()=>({setCurrentEvents:m,onEventAdd:f,onEventUpdate:v,onEventDelete:C,onEventsChange:E}),[m,f,v,C,E]),G=cr((W,ye,ge)=>{let T=s.getEventManager(W);if(!T?.applyEdit)return;let ve=T.applyEdit({event:W,updates:ye,currentEvents:o,scope:ge}),pe={action:"update",event:W,scope:ge},Ce={...W,...ye},Ee=zt(ve,pe,Ce);_t(Ee,pe,D)},[o,s,D]),h=cr((W,ye)=>{let ge=s.getEventManager(W);if(!ge?.applyDelete)return;let T=ge.applyDelete({event:W,currentEvents:o,scope:ye}),ve={action:"delete",event:W,scope:ye},pe=zt(T,ve,W);_t(pe,ve,D)},[o,s,D]);return{applyScopedEdit:G,applyScopedDelete:h}};import{useCallback as Gt}from"react";var lt=(o)=>{if(o.resourceIds)return o.resourceIds;if(o.resourceId!==void 0)return[o.resourceId];return[]};function x(o,s){if(s===void 0)return o;return o.filter((m)=>lt(m).includes(s))}var An=(o)=>(o.resourceIds?.length??0)>1,mr=(o,s)=>{let m=Gt((C)=>x(o,C),[o]),f=Gt((C)=>o.filter((E)=>lt(E).some((D)=>C.includes(D))),[o]),v=Gt((C)=>{if(C===void 0)return;return s.find((E)=>E.id===C)},[s]);return{getEventsForResource:m,getEventsForResources:f,getResourceById:v,isEventCrossResource:An}};var pr=({events:o,pluginRuntime:s,getCurrentViewRange:m,resources:f,onEventAdd:v,onEventUpdate:C,onEventDelete:E,onEventsChange:D})=>{let G=dr({events:o,pluginRuntime:s,getCurrentViewRange:m}),{currentEvents:h,setCurrentEvents:W,getEventsForDateRange:ye,processedEvents:ge}=G,T={setCurrentEvents:W,onEventAdd:v,onEventUpdate:C,onEventDelete:E,onEventsChange:D},{addEvent:ve,updateEvent:pe,deleteEvent:Ce}=lr({currentEvents:h,...T}),{applyScopedEdit:Ee,applyScopedDelete:he}=ur({currentEvents:h,pluginRuntime:s,...T}),{getEventsForResource:Re,getEventsForResources:be,getResourceById:De,isEventCrossResource:we}=mr(ge,f);return On(()=>({events:ge,rawEvents:h,setCurrentEvents:W,getEventsForDateRange:ye,addEvent:ve,updateEvent:pe,deleteEvent:Ce,applyScopedEdit:Ee,applyScopedDelete:he,getEventsForResource:Re,getEventsForResources:be,getResourceById:De,isEventCrossResource:we}),[ge,h,W,ye,ve,pe,Ce,Ee,he,Re,be,De,we])};import{useMemo as yr,useState as Vn}from"react";var fr=({firstDayOfWeek:o,dayMaxEvents:s=sr,businessHours:m,locale:f,translations:v,translator:C,resources:E,orientation:D="horizontal",weekViewGranularity:G="hourly"})=>{let[h,W]=Vn(f||"en"),ye=yr(()=>{if(C)return C;let ge=v||se;return(T)=>ge[T]||T},[v,C]);return yr(()=>({firstDayOfWeek:o,dayMaxEvents:s,businessHours:m,currentLocale:h,setCurrentLocale:W,t:ye,resources:E,orientation:D,weekViewGranularity:G}),[o,s,m,h,ye,E,D,G])};import{useCallback as dt,useMemo as Bn,useState as Wt}from"react";var Fn=(o)=>o,vr=({currentDate:o,t:s,disableEventClick:m,disableCellClick:f,onEventClick:v,onCellClick:C})=>{let[E,D]=Wt(!1),[G,h]=Wt(null),[W,ye]=Wt(null),ge=dt((Ee={})=>{let{start:he,end:Re,resourceId:be,resource:De,allDay:we}=Ee;if(he)ye(he);let ke=(he??o).second(0).millisecond(0);h(Fn({title:s("newEvent"),start:ke,end:Re??ke.add(1,"hour"),resourceId:be??De?.id,description:"",allDay:we??!1})),D(!0)},[o,s]),T=dt(()=>{ye(null),h(null),D(!1)},[]),ve=dt((Ee)=>{h(Ee),D(!0)},[]),pe=dt((Ee)=>{if(m)return;if(v)v(Ee);else ve(Ee)},[m,v,ve]),Ce=dt((Ee)=>{if(f)return;if(C)C(Ee);else ge(Ee)},[C,f,ge]);return Bn(()=>({isEventFormOpen:E,selectedEvent:G,selectedDate:W,setIsEventFormOpen:D,setSelectedEvent:h,setSelectedDate:ye,openEventForm:ge,closeEventForm:T,handleEventClick:pe,handleDateClick:Ce}),[E,G,W,ge,T,pe,Ce])};import{useCallback as je,useMemo as wa,useRef as Ra,useState as xa}from"react";import{Square as Jo}from"lucide-react";import{jsx as zn}from"react/jsx-runtime";var l=({children:o,transitionKey:s,delay:m=0,className:f,direction:v="vertical","data-testid":C,ref:E,style:D,...G})=>zn("div",{className:e("inline-block w-full animate-in fade-in fill-mode-backwards duration-500 ease-in-out",v==="horizontal"?"slide-in-from-right-2.5":"slide-in-from-top-2.5",f),"data-testid":C,ref:E,style:{animationDelay:`${m}s`,...D},...G,children:o},s);l.displayName="AnimatedSection";import{jsx as Cr,Fragment as gr}from"react/jsx-runtime";var Et=({date:o})=>{let{renderHour:s,timeFormat:m}=r();if(s)return Cr(gr,{children:s(o)});return Cr(gr,{children:o.format(m==="12-hour"?"h A":"H")})};function a(o){return U(o,t())}function i(o,s){let m=o.startOf("week").day(s).startOf("day"),f=o.isBefore(m)?m.subtract(1,"week"):m;return Array.from({length:7},(v,C)=>f.add(C,"day"))}function L(o,s){let m=o.startOf("month"),v=i(m,s).at(0)??m;return Array.from({length:6},(C,E)=>{let D=v.add(E,"week").startOf("day");return i(D,s)})}function Dt(o){let s=o.daysInMonth(),m=o.startOf("month");return Array.from({length:s},(f,v)=>m.add(v,"day"))}function Er({referenceDate:o=t(),length:s=24}={}){let m=o.startOf("day");return Array.from({length:s},(f,v)=>m.hour(v).minute(0).second(0).millisecond(0))}var bt=(o,s)=>{let m=L(o,s),f=m.at(0)?.at(0)??o,v=m.at(-1)?.at(-1)??o;return{start:f.startOf("day"),end:v.endOf("day")}},q=(o)=>o==="12-hour"?"h:mma":"HH:mm";var Je=(o)=>String(o).padStart(2,"0"),_n=(o)=>typeof o==="number"?Je(o):o,n={col:{time:"time-col",date:"date-col",day:(o,s)=>{let m=`day-col-${c(o)}`;return s!=null?`${m}-resource-${s}`:m},resource:(o,s)=>`${o}-col-resource-${s}`,allDay:(o,s)=>`all-day-col-${c(o)}-${s}`,events:(o)=>`col-events-${o.toISOString()}`},cell:{day:(o,s,m=0)=>{let f=c(o);return s!=null?`day-cell-${f}-${Je(s)}-${Je(m)}`:`day-cell-${f}`},verticalTime:(o)=>`vertical-time-${Je(o)}`,vertical:(o,s,m,f)=>{let v=`vertical-cell-${c(o)}-${Je(s)}-${Je(m)}`;return f!=null?`${v}-resource-${f}`:v}},container:{vertical:{col:(o)=>`vertical-col-${o}`},horizontal:{row:(o)=>`horizontal-row-${o}`,rowLabel:(o)=>`horizontal-row-label-${o}`,event:(o)=>`horizontal-event-${o}`},verticalEvent:(o)=>`vertical-event-${o}`,eventsLayer:(o,s)=>`${o}-events-${s}`},header:{resource:{weekDay:"resource-week-day-header",columnsHeader:"resource-columns-header",monthDay:(o)=>`resource-month-header-${o.toISOString()}`,timeLabel:(o,s)=>`resource-${o}-time-label-${_n(s)}`},weekday:(o,s)=>`${o}-header-weekday-${s.toLowerCase()}`,week:{day:(o)=>`week-header-day-${o.toISOString()}`,hour:(o,s)=>`week-header-hour-${o.toISOString()}-${s}`,resource:(o)=>`week-header-resource-${o}`},year:{month:(o,s)=>s?`year-month-${s}-${o}`:`year-month-${o}`,day:(o,s)=>`year-day-${o}-${s}`}},allDayRow:(o)=>`allday-row-${o??"main"}`,listKey:(...o)=>o.join("-"),dayNumber:(o)=>a(o)?"day-number-today":`day-number-${o.format("D")}`,stickyInsets:(o,s,m,f)=>`sticky-insets-${o}-${c(s)}-${m?"sticky":"static"}-${f}`,dragPreview:(o)=>`event-drag-preview-${o}`,timePicker:(o)=>`time-picker-${o??""}`};import{jsx as Dr}from"react/jsx-runtime";var qe="w-16 min-w-16 max-w-16",br="w-[calc(100%-4rem)]",j="w-10 sm:w-16 min-w-10 sm:min-w-16 max-w-10 sm:max-w-16",Ae="shadow-[1px_0_0_0_color-mix(in_oklch,var(--background),var(--foreground)_10%)]",Fe=({days:o,gridType:s,renderLabel:m,widthClassName:f=qe,showsToday:v=!1})=>{let C=s==="hour";return{id:C?n.col.time:n.col.date,day:void 0,days:o,className:e("shrink-0",f,"sticky left-0 bg-background z-20",Ae),"data-sticky-inset":"left",gridType:s,noEvents:!0,renderCell:(E)=>{let D=t().hour(),G=E.hour()===D,h=C&&v&&G,W=h?Ct:"text-muted-foreground",ye=h?"time":void 0,ge=m?m(E):Dr(Et,{date:E});return Dr("div",{"aria-current":ye,className:e("h-full p-2 text-right text-[10px] sm:text-xs flex flex-col items-center",W),children:ge})}}};var B=(o,s)=>{if(!s)return!0;let m=!1;return ht(s,{date:o,onMatch:()=>{m=!0}}),m},Ln=/^(\d{1,2}):(\d{2})$/,Ut=(o,s)=>{if(typeof o==="number")return Math.round(o)*60;if(typeof o==="string"){let m=o.match(Ln);if(m){let f=Number(m[1]),v=Number(m[2]),C=f*60+v<=1440;if(v<=59&&C)return f*60+v}}return s*60},hr=(o,s)=>{let m=Ut(o,s);return m===0?1440:m},wr=({date:o,hour:s,minute:m=0,durationMinutes:f,businessHours:v})=>{if(!v)return!0;if(s===void 0)return B(o,v);let C=!1,E=s*60+m;return ht(v,{date:o,onMatch:(D)=>{let G=Ut(D.startTime,9),h=hr(D.endTime,17),W=E>=G,ye=f?E+f<=h:E<h;if(W&&ye)C=!0}}),C},ht=(o,s)=>{let{date:m,onMatch:f}=s;if(!o)return;let v=Array.isArray(o)?o:[o];for(let C of v)if(m&&C.daysOfWeek){let E=m.day();if(C.daysOfWeek.some((D)=>H[D]===E))f(C)}else f(C)},J=(o)=>{let{allDates:s,businessHours:m,resourceBusinessHours:f=[],hideNonBusinessHours:v}=o,C=24,E=0,D=!1,G=(W)=>{D=!0,C=Math.min(C,Ut(W.startTime,9)/60),E=Math.max(E,hr(W.endTime,17)/60)},h=(W)=>{ht(m,{date:W,onMatch:G});for(let ye of f)ht(ye,{date:W,onMatch:G})};for(let W of s)h(W);if(!D&&v){if(h(),!D)C=9,E=17,D=!0}return{minStart:C,maxEnd:E,hasBusinessHours:D}};function wt(o){return o.flatMap((s)=>s.businessHours?[s.businessHours]:[])}function Rt({referenceDate:o,businessHours:s,hideNonBusinessHours:m,allDates:f=[o],resourceBusinessHours:v=[]}){let C=Er({referenceDate:o}),E=Boolean(s)||v.length>0;if(!(m&&E))return C;let{minStart:G,maxEnd:h,hasBusinessHours:W}=J({allDates:f,businessHours:s,resourceBusinessHours:v,hideNonBusinessHours:m});if(!W)return C;if(G>=h)return[];let ye=Math.floor(G),ge=Math.ceil(h);return C.filter((T)=>{let ve=T.hour();return ve>=ye&&ve<ge})}import{memo as Gn}from"react";import{jsx as Rr}from"react/jsx-runtime";var Wn=({className:o})=>{let{t:s}=r();return Rr("div",{className:e("w-16 shrink-0 sticky left-0 bg-background z-20 flex items-center justify-center px-1 text-xs text-muted-foreground",Ae,o),"data-sticky-inset":"left",children:Rr("span",{className:"truncate",children:s("allDay")})})},xt=Gn(Wn);import{memo as Xo}from"react";import{memo as Yr,useMemo as $o}from"react";import{useMemo as $t}from"react";var Un=(o,s)=>{let m=(D)=>D.end.subtract(1,"millisecond").startOf(s).isAfter(D.start.startOf(s)),f=o.filter(m),v=o.filter((D)=>!m(D)),C=[...f].sort((D,G)=>{let h=D.start.diff(G.start);if(h!==0)return h;return G.end.diff(G.start)-D.end.diff(D.start)}),E=[...v].sort((D,G)=>D.start.diff(G.start));return{sortedMultiUnit:C,sortedSingleUnit:E}},xr=(o,{firstUnit:s,lastUnit:m,unitCount:f,gridType:v})=>{let C=t.max(o.start.startOf(v),s),E=o.end.subtract(1,"millisecond"),D=t.min(E.startOf(v),m),G=Math.trunc(N(C,s,v)),h=Math.trunc(N(D,s,v));return{startCol:Math.max(0,G),endCol:Math.min(f-1,h),isTruncatedStart:o.start.startOf(v).isBefore(s),isTruncatedEnd:E.startOf(v).isAfter(m)}},Kn=(o,s,m,{columns:f,gridType:v})=>{let C={start:s,end:m+1},E=f.at(s),D=f.at(m);if(v==="day"||!E||!D)return C;let h=o.start.diff(E,"hour",!0),W=o.end.diff(D,"hour",!0),ye=Math.min(Math.max(h,0),1),ge=Math.min(Math.max(W,0),1),T=s+ye,ve=m+ge;return ve>T?{start:T,end:ve}:C},Kt=(o,s,m)=>{for(let f=0;f<o.length;f++){let v=!0;for(let C=s;C<=m;C++)if(o[f][C]){v=!1;break}if(v)return f}return-1},St=({days:o,events:s,dayMaxEvents:m,gridType:f="day"})=>{let v=o.at(0),C=o.at(-1);if(!v||!C)return[];let E={firstUnit:f==="hour"?v.startOf("hour"):v.startOf("day"),lastUnit:f==="hour"?C.endOf("hour"):C.endOf("day"),unitCount:o.length,gridType:f},{sortedMultiUnit:D,sortedSingleUnit:G}=Un(s,f),h=Array.from({length:m},()=>Array.from({length:E.unitCount},()=>!1)),W=[],ye=({row:ge,startCol:T,endCol:ve,event:pe,isTruncatedStart:Ce,isTruncatedEnd:Ee})=>{for(let be=T;be<=ve;be++)h[ge][be]=!0;let he=Kn(pe,T,ve,{columns:o,gridType:f}),Re=he.end-he.start;W.push({kind:"horizontal",event:pe,left:he.start/E.unitCount*100,width:Re/E.unitCount*100,row:ge,isTruncatedStart:Ce,isTruncatedEnd:Ee})};for(let ge of D){let T=xr(ge,E),ve=Kt(h,T.startCol,T.endCol);if(ve!==-1){ye({row:ve,event:ge,...T});continue}for(let pe=T.startCol+1;pe<=T.endCol;pe++){let Ce=Kt(h,pe,T.endCol);if(Ce!==-1){ye({row:Ce,startCol:pe,endCol:T.endCol,event:ge,isTruncatedStart:!0,isTruncatedEnd:T.isTruncatedEnd});break}}}for(let ge of G){let ve=xr(ge,E).startCol,pe=Kt(h,ve,ve);if(pe!==-1)ye({row:pe,startCol:ve,endCol:ve,event:ge,isTruncatedStart:!1,isTruncatedEnd:!1})}return W};var Yt=({days:o,allDay:s,resourceId:m,gridType:f})=>{let{getEventsForDateRange:v,dayMaxEvents:C}=r(),E=o.at(0),D=o.at(-1),G=E?.startOf("day"),h=D?.endOf("day"),W=$t(()=>{if(!G||!h)return[];let T=v(G,h),ve=x(T,m);if(s)ve=ve.filter((pe)=>Boolean(pe.allDay));return ve},[v,G,h,m,s]),ye=$t(()=>{let T=new Map,ve=f??"day",pe=W.length===0;for(let Ce of o){if(pe){T.set(n.col.events(Ce),[]);continue}let Ee=Ce.startOf(ve),he=Ce.endOf(ve),Re=W.filter((be)=>d(be,Ee,he));T.set(n.col.events(Ce),Re)}return T},[o,W,f]);return{positionedEvents:$t(()=>St({days:o,events:W,dayMaxEvents:C,gridType:f}),[o,C,W,f]),columnEventsMap:ye}};import{memo as No,useRef as To}from"react";import{useMemo as qn}from"react";import{createContext as $n}from"react";var kt=$n(void 0);var Ge=()=>k(kt,"useCalendarCellContext","CalendarProvider");import{useMemo as Yn}from"react";var X=(o)=>{let{businessHours:s,getResourceById:m}=Ge();return Yn(()=>{if(o!=null){let f=m(o);if(f?.businessHours)return f.businessHours}return s},[o,m,s])};var Sr=({day:o,gridType:s,slotDurationMinutes:m,resourceId:f})=>{let{currentDate:v,view:C}=Ge(),E=X(f),D=C==="month",G=o.month()!==v.month(),h=D&&G;return!qn(()=>{if(s==="hour")return wr({date:o,hour:o.hour(),minute:o.minute(),durationMinutes:m,businessHours:E});return B(o,E)},[s,o,m,E])||h};import{useDroppable as Zn}from"@dnd-kit/core";import{useId as Jn}from"react";import{createContext as Xn,useContext as Qn}from"react";var ie=Xn(null),p=()=>Qn(ie);var qt=(o,{rangeStart:s,rangeEnd:m,resourceId:f,allDay:v})=>{if(!o||!s||!m)return!1;if(Boolean(v)&&!o.allDay)return!1;let E=o.resourceId!==void 0,D=f!==void 0,G=o.resourceId!==f;if(E&&D&&G)return!1;let ye={start:o.start,end:o.end};return d(ye,s,m)},kr=(o,s)=>{if(!o||!qt(o,s))return null;return{...o.event,start:o.start,end:o.end,allDay:o.allDay}},ce=(o)=>o?.isDropAllowed===!1?"not-allowed":void 0;import{jsx as Nr,jsxs as io}from"react/jsx-runtime";function eo(o,s,m,f){let v=o.hour(s??0).minute(m??0);if(s!==void 0&&m!==void 0)return{start:v,end:v.add(f,"minute")};if(s!==void 0)return{start:v,end:v.hour(s+1).minute(0)};return{start:v,end:v.add(1,"day").startOf("day")}}var to="rgba(188, 232, 241, 0.3)",ro=()=>Nr("div",{"aria-hidden":"true",className:"absolute inset-0 pointer-events-none",style:{backgroundColor:to}}),no=(o,s,m)=>{let f=p();return qt(f,{rangeStart:o.start,rangeEnd:o.end.subtract(1,"millisecond"),resourceId:s,allDay:m})},oo=({data:o,cellRange:s,disableDragAndDrop:m})=>{let{isOver:f,setNodeRef:v}=Zn({id:Jn(),data:o,disabled:m}),C=no(s,o.resourceId,o.allDay);return{setNodeRef:v,showDropHighlight:(f||C)&&!m}},ao=({allDay:o,cellDisabled:s,showDropHighlight:m,isSubDivider:f,range:v,resourceId:C,dataTestId:E,view:D})=>({"data-all-day":o?"true":void 0,"data-disabled":s.toString(),"data-drop-target":m?"true":void 0,"data-end":v.end.toISOString(),"data-resource-id":C,"data-slot-divider":f?"true":void 0,"data-start":v.start.toISOString(),"data-testid":E,"data-view":D}),so=({className:o,customClassName:s,disabledClass:m,clickBlocked:f,cellDisabled:v})=>e("droppable-cell relative",o,s,f?"cursor-default":"cursor-pointer",v&&m);function Hr({type:o,date:s,hour:m,minute:f,slotDurationMinutes:v,resourceId:C,allDay:E,children:D,className:G,style:h,"data-testid":W,disabled:ye=!1,isSubDivider:ge=!1}){let{onCellClick:T,isCellDisabled:ve,getCellClassName:pe,getResourceById:Ce,disableDragAndDrop:Ee,disableCellClick:he,classesOverride:Re,view:be}=Ge(),{start:De,end:we}=eo(s,m,f,v),ke=Ce?.(C),Se={start:De,end:we,resource:ke,allDay:E},He=ye||Boolean(ve?.(Se)),xe=he||He,{setNodeRef:_e,showDropHighlight:Pe}=oo({data:{type:o,date:s,hour:m,minute:f,resourceId:C,allDay:E,disabled:He},cellRange:{start:De,end:we},disableDragAndDrop:Boolean(Ee)}),Ie=(Le)=>{if(Le.stopPropagation(),xe)return;T(Se)};return io("div",{className:so({className:G,customClassName:pe?.(Se),disabledClass:Re?.disabledCell||ir,clickBlocked:xe,cellDisabled:He}),...ao({allDay:E,cellDisabled:He,showDropHighlight:Pe,isSubDivider:ge,range:{start:De,end:we},resourceId:C,dataTestId:W,view:be}),onClick:Ie,ref:_e,style:h,children:[Pe&&Nr(ro,{}),D]})}import{useImperativeHandle as bo,useState as jr}from"react";import{useDraggable as mo}from"@dnd-kit/core";import{memo as po,useRef as yo}from"react";import{createContext as lo,useContext as co}from"react";var F=lo("horizontal"),Tr=()=>co(F);var O=(o)=>e(o.backgroundColor||"bg-blue-500",o.color||"text-white"),I=(o)=>({backgroundColor:o.backgroundColor,color:o.color}),Ht=({axis:o,isTruncatedStart:s,isTruncatedEnd:m})=>{if(o==="vertical")return"rounded-md";if(s&&m)return"rounded-none";if(s)return"rounded-r-md rounded-l-none";if(m)return"rounded-l-md rounded-r-none";return"rounded-md"},M={horizontal:"sticky left-[calc(var(--ilamy-sticky-left)+--spacing(1))] inline-block max-w-full align-top",vertical:"sticky top-[calc(var(--ilamy-sticky-top)+--spacing(0.5))]"};import{jsx as Xt,jsxs as uo}from"react/jsx-runtime";function Pr({event:o,isTruncatedStart:s,isTruncatedEnd:m}){let f=Tr(),v=f==="horizontal",C=v&&s,E=v&&m;return uo("div",{className:e(O(o),"h-full w-full px-1 border-[1.5px] border-card text-left overflow-clip relative",Ht({axis:f,isTruncatedStart:s,isTruncatedEnd:m})),style:I(o),children:[C&&Xt("div",{className:"absolute left-0 top-0 bottom-0 w-0.5 bg-foreground/25"}),Xt("p",{className:e("text-[10px] font-semibold sm:text-xs mt-0.5",M[f],C&&"pl-1",E&&"pr-1"),children:o.title}),E&&Xt("div",{className:"absolute right-0 top-0 bottom-0 w-0.5 bg-foreground/25"})]})}import{jsx as Ir}from"react/jsx-runtime";var fo=({isDragDisabled:o,disableEventClick:s,isSourceOfDrag:m})=>({cursorClass:o?s?"cursor-default":"cursor-pointer":"cursor-grab",draggingClass:m&&!o&&"cursor-grabbing opacity-50 select-none"}),vo=({renderEvent:o,event:s,segment:m,isTruncatedStart:f,isTruncatedEnd:v})=>{if(o)return o(s,m);return Ir(Pr,{event:s,isTruncatedEnd:v,isTruncatedStart:f})};function go({elementId:o,event:s,className:m,style:f,disableDrag:v=!1,isTruncatedStart:C=!1,isTruncatedEnd:E=!1,sourceResourceId:D,dragSegment:G,isBeingDragged:h=!1}){let{onEventClick:W,renderEvent:ye,disableEventClick:ge,disableDragAndDrop:T}=r(),ve=yo(null),{attributes:pe,listeners:Ce,setNodeRef:Ee,isDragging:he}=mo({id:o,data:{event:s,type:"calendar-event",sourceResourceId:D,dragSegment:G,getBarRect:()=>ve.current?.getBoundingClientRect()},disabled:v||T}),Re=(Se)=>{ve.current=Se,Ee(Se)},{cursorClass:be,draggingClass:De}=fo({isDragDisabled:Boolean(v||T),disableEventClick:Boolean(ge),isSourceOfDrag:he||h}),ke=vo({renderEvent:ye,event:s,segment:{isStart:!C,isEnd:!E},isTruncatedStart:C,isTruncatedEnd:E});return Ir(l,{className:e("overflow-clip text-ellipsis whitespace-nowrap h-full w-full",be,De,m),onClick:(Se)=>{Se.stopPropagation(),W(s)},ref:Re,style:f,transitionKey:o,...pe,...Ce,children:ke})}var Co=(o,s)=>{if(!o||!s)return o===s;return o.start.isSame(s.start)&&o.end.isSame(s.end)&&o.axis===s.axis},Eo=(o,s)=>{if(!o||!s)return o===s;return[...new Set([...Object.keys(o),...Object.keys(s)])].every((f)=>o[f]===s[f])},Do=["elementId","disableDrag","className","event","isTruncatedStart","isTruncatedEnd","isBeingDragged"],A=po(go,(o,s)=>{let m=Do.every((C)=>o[C]===s[C]),f=Co(o.dragSegment,s.dragSegment),v=Eo(o.style,s.style);return m&&f&&v});import{jsx as ct,jsxs as ho}from"react/jsx-runtime";var Mr=({ref:o})=>{let[s,m]=jr(!1),[f,v]=jr(null),{eventHeight:C}=r();return bo(o,()=>({open:()=>m(!0),close:()=>m(!1),setSelectedDayEvents:(E)=>v(E)})),ct(R,{onOpenChange:m,open:s,children:ho(w,{className:"max-h-[80vh] max-w-md overflow-y-auto",children:[ct(S,{children:ct(P,{children:f?.day.format("MMMM D, YYYY")})}),ct("div",{className:"mt-4 space-y-3",children:f?.events.map((E)=>ct(A,{className:"relative my-1",elementId:`all-events-dialog-event-${E.id}`,event:E,style:{height:`${C}px`}},E.id))})]})})};import{jsx as wo,jsxs as Ro}from"react/jsx-runtime";var Ar=({day:o,showDayNumber:s,children:m})=>{let{eventSpacing:f}=Ge();return Ro("div",{className:"flex flex-col h-full w-full","data-testid":"grid-cell-content",style:{gap:`${f}px`},children:[s&&wo(b,{className:"items-start","data-testid":n.dayNumber(o),dayNumber:o.format("D"),today:a(o)}),m]})};import{useMemo as So}from"react";import{jsxs as xo}from"react/jsx-runtime";var Or=({hiddenCount:o,label:s,onOpen:m})=>xo("div",{className:"text-muted-foreground hover:text-foreground cursor-pointer text-[10px] whitespace-nowrap sm:text-xs shrink-0 mt-1",onClick:(f)=>{f.stopPropagation(),m()},onKeyDown:(f)=>{let v=f.key==="Enter",C=f.key===" ";if(v||C)f.preventDefault(),f.stopPropagation(),m()},role:"button",tabIndex:0,children:["+",o," ",s]});import{jsx as Vr,jsxs as Ho,Fragment as ko}from"react/jsx-runtime";var Br=({allEventsDialogRef:o,day:s,gridType:m,allDay:f,resourceId:v,precomputedEvents:C})=>{let{dayMaxEvents:E=0,getEventsForDateRange:D,t:G,eventHeight:h,onMoreEventsClick:W}=r(),ye=So(()=>{if(C)return C;let Ce=D(s.startOf(m),s.endOf(m));if(f)Ce=Ce.filter((Ee)=>Ee.allDay);return x(Ce,v)},[C,s,v,D,m,f]),ge=()=>{if(W){W(s,ye);return}o.current?.setSelectedDayEvents({day:s,events:ye}),o.current?.open()},T=ye.length-E,ve=T>0,pe=ye.slice(0,E);return Ho(ko,{children:[pe.map((Ce,Ee)=>Vr("div",{className:"w-full shrink-0","data-testid":Ce?.title,style:{height:`${h}px`}},n.listKey("empty",Ee,Ce.id))),ve&&Vr(Or,{hiddenCount:T,label:G("more"),onOpen:ge})]})};import{jsx as Qt,jsxs as Fr,Fragment as jo}from"react/jsx-runtime";var Po=(o,s,m)=>{if(m)return m;if(s==="hour")return n.cell.day(o,o.format("HH"),o.format("mm"));return n.cell.day(o)},Io=({day:o,hour:s,minute:m,slotDurationMinutes:f=60,className:v="",resourceId:C,gridType:E="day",shouldRenderEvents:D=!0,allDay:G=!1,precomputedEvents:h,"data-testid":W,showDayNumber:ye=!1,isSubDivider:ge=!1,children:T})=>{let ve=To(null),pe=Sr({day:o,gridType:E,slotDurationMinutes:f,resourceId:C}),Ce=Po(o,E,W);return Fr(jo,{children:[Qt(Hr,{allDay:G,className:e("cursor-pointer overflow-clip p-1 bg-background not-in-data-dragging:hover:bg-accent min-h-[60px] relative min-w-0",v),"data-testid":Ce,date:o,disabled:pe,hour:s,isSubDivider:ge,minute:m,resourceId:C,slotDurationMinutes:f,type:"day-cell",children:Fr(Ar,{day:o,showDayNumber:ye,children:[D&&Qt(Br,{allDay:G,allEventsDialogRef:ve,day:o,gridType:E,precomputedEvents:h,resourceId:C}),T]})}),D&&Qt(Mr,{ref:ve})]})},z=No(Io);import{jsx as zr}from"react/jsx-runtime";var et=({resource:o,className:s,children:m,"data-testid":f,"data-sticky-inset":v})=>{let{renderResource:C}=r();return zr("div",{className:e("flex items-center justify-center p-2",s),"data-sticky-inset":v,"data-testid":f,style:{color:o.color,backgroundColor:o.backgroundColor},children:C?C(o):m??zr("div",{className:"text-sm font-medium truncate",children:o.title})})};import{memo as Lo,useMemo as Go}from"react";import{memo as Mo}from"react";import{jsx as Oo}from"react/jsx-runtime";var Ao=({rangeStart:o,rangeEnd:s,now:m,resource:f,axis:v="vertical",withDot:C})=>{let{renderCurrentTimeIndicator:E,view:D}=r((h)=>({renderCurrentTimeIndicator:h.renderCurrentTimeIndicator,view:h.view})),G;if(E)G=(h)=>E({...h,resource:f,view:D});return Oo(Y,{axis:v,now:m,rangeEnd:s,rangeStart:o,render:G,withDot:C})},ee=Mo(Ao);import{useMemo as _r}from"react";var te=({days:o,gridType:s,resourceId:m,allDay:f})=>{let v=p(),C=_r(()=>({rangeStart:o.at(0),rangeEnd:o.at(-1)?.add(1,s).subtract(1,"millisecond")}),[o,s]);return _r(()=>kr(v,{...C,resourceId:m,allDay:f}),[v,C,m,f])};import{jsx as Lr}from"react/jsx-runtime";function re({orientation:o,event:s,style:m,isTruncatedStart:f,isTruncatedEnd:v,contentClassName:C,children:E}){return Lr("div",{className:e("absolute z-20 pointer-events-none transition-none overflow-clip","shadow-xl inset-ring-2 inset-ring-foreground border-[1.5px] border-card",Ht({axis:o,isTruncatedStart:f,isTruncatedEnd:v}),O(s)),"data-testid":n.dragPreview(o),style:{...m,...I(s)},children:Lr("div",{className:e("h-full w-full text-left overflow-clip",C),children:E})})}var Nt=(o,s,m)=>({left:`calc(${o.left}% + var(--spacing) * 0.25)`,width:`calc(${o.width}% - var(--spacing) * 1)`,minWidth:"calc(var(--spacing) * 8)",top:`${s}px`,height:`${m}px`}),ne=(o)=>({left:`${o.left}%`,width:`calc(${o.width}% - var(--spacing) * 2)`,top:`${o.top}%`,height:`${o.height}%`});import{jsx as Gr,jsxs as Vo}from"react/jsx-runtime";function Wr({previewPositioned:o,top:s}){let{timeFormat:m,eventHeight:f}=r((D)=>({timeFormat:D.timeFormat,eventHeight:D.eventHeight})),{event:v,isTruncatedStart:C,isTruncatedEnd:E}=o;return Vo(re,{contentClassName:"px-1.5 flex items-center gap-1",event:v,isTruncatedEnd:E,isTruncatedStart:C,orientation:"horizontal",style:Nt(o,s,f),children:[!v.allDay&&Gr("span",{className:"text-[10px] font-semibold sm:text-xs",children:v.start.format(q(m))}),Gr("span",{className:e("text-[10px] font-bold sm:text-xs truncate",M.horizontal),children:v.title})]})}var g={minutes:0,days:0},K=(o,s,m)=>{if(!s.start||!s.end)return;let f=o.start.isBefore(s.start)?s.start:o.start,v=o.end.isAfter(s.end)?s.end:o.end;return{start:f,end:v,axis:m}},Bo=(o,s,m)=>{let f=Math.max(0,o-s);return Math.min(1,f/m)},de=({activeEvent:o,initialRect:s,activatorEvent:m,segment:f,slotDurationMinutes:v})=>{let{clientX:C,clientY:E}=m,D=f.axis==="vertical",G=D?E:C,h=D?s?.top:s?.left,W=D?s?.height:s?.width;if(G===void 0||h===void 0)return g;if(W===void 0||W<=0)return g;let ye=Bo(G,h,W),ge=f.end.diff(f.start,"minute"),T=f.start.add(ye*ge,"minute"),ve=Fo(f,ye),pe=D?T:ve;return{minutes:zo(o,T,v),days:_o(o,pe)}},Fo=(o,s)=>{let m=o.start.startOf("day"),v=o.end.subtract(1,"millisecond").startOf("day").diff(m,"day")+1,C=Math.floor(s*v),E=Math.min(Math.max(0,C),v-1);return m.add(E,"day")},zo=(o,s,m)=>{let f=o.end.diff(o.start,"minute"),v=Math.max(0,f-m),C=s.diff(o.start,"minute"),E=Math.floor(C/m)*m;return Math.min(Math.max(0,E),v)},_o=(o,s)=>{let m=o.start.startOf("day"),f=o.end.subtract(1,"millisecond").startOf("day"),v=Math.max(0,f.diff(m,"day")),C=s.startOf("day").diff(m,"day");return Math.min(Math.max(0,C),v)};import{jsx as Ur}from"react/jsx-runtime";var Kr=(o,s,m)=>`${o.event.id}-${o.row}-${s?.toISOString()}-${m??"no-resource"}`;function $r({positioned:o,elementId:s,top:m,eventHeight:f,range:v,resourceId:C,draggedEventId:E}){let{event:D,left:G,width:h}=o;return Ur("div",{className:"absolute z-10 pointer-events-auto overflow-clip","data-left":G,"data-testid":n.container.horizontal.event(D.id),"data-top":m,"data-width":h,style:Nt(o,m,f),children:Ur(A,{className:"h-full w-full shadow",dragSegment:K(D,v,"horizontal"),elementId:s,event:D,isBeingDragged:E===D.id,isTruncatedEnd:o.isTruncatedEnd,isTruncatedStart:o.isTruncatedStart,sourceResourceId:C})})}import{jsx as Tt,jsxs as Ko}from"react/jsx-runtime";var Wo=1,Uo=({gridType:o="day",days:s,resourceId:m,resource:f,"data-testid":v,positionedEvents:C,dayNumberHeight:E=ar,allDay:D})=>{let{eventHeight:G,eventSpacing:h,resources:W}=r(),ye=p(),ge=s.at(0)?.startOf("day"),ve=m===void 0||W?.at(0)?.id===m,pe=s.at(0),Ce=s.at(-1)?.add(1,o),Ee=o==="hour"&&Boolean(pe&&Ce),he=(De)=>E+h+De*(G+h),Re=te({days:s,gridType:o,resourceId:m,allDay:D}),be=Go(()=>{if(!Re)return null;return St({days:s,gridType:o,events:[Re],dayMaxEvents:Wo}).at(0)??null},[Re,s,o]);return Tt(F.Provider,{value:"horizontal",children:Ko("div",{className:"absolute inset-0 pointer-events-none z-10 overflow-clip","data-testid":v,children:[Ee&&pe&&Ce&&Tt(ee,{axis:"horizontal",rangeEnd:Ce,rangeStart:pe,resource:f,withDot:ve}),C.map((De)=>{let we=Kr(De,ge,m);return Tt($r,{draggedEventId:ye?.event.id,elementId:we,eventHeight:G,positioned:De,range:{start:pe,end:Ce},resourceId:m,top:he(De.row)},n.listKey(we,"wrapper"))}),be&&Tt(Wr,{previewPositioned:be,top:he(be.row)})]})})},Zt=Lo(Uo);import{jsx as Oe,jsxs as Jt}from"react/jsx-runtime";var Yo=({id:o,resource:s,gridType:m="day",variant:f="resource",dayNumberHeight:v,className:C,columns:E=[],allDay:D,showDayNumber:G=!1})=>{let{renderResource:h}=r(),W=f==="resource",ye=E.some((pe)=>pe.days),ge=$o(()=>{if(ye)return[];return E.map((pe)=>pe.day).filter((pe)=>Boolean(pe))},[E,ye]),{positionedEvents:T,columnEventsMap:ve}=Yt({days:ge,gridType:m,resourceId:s?.id,allDay:D});return Jt("div",{className:e("flex flex-1 relative min-w-0",C),"data-testid":n.container.horizontal.row(o),children:[W&&s&&Oe(et,{className:"w-20 sm:w-40 border-r sticky left-0 bg-background z-20 h-full","data-sticky-inset":"left","data-testid":n.container.horizontal.rowLabel(s.id),resource:s,children:h?h(s):Oe("div",{className:"wrap-break-word text-sm",children:s.title})}),Jt("div",{className:"relative flex-1 flex min-w-0",children:[Oe("div",{className:"flex w-full min-w-0 gap-px bg-border",children:E.map((pe,Ce)=>{let Ee=n.listKey("col",Ce);if(pe.days)return Oe(qo,{allDay:D,col:pe,dayNumberHeight:v,gridType:m,id:o,resource:s,resourceId:s?.id,showDayNumber:G},Ee);return pe.day?Oe(z,{allDay:D,className:e("flex-1 w-20",pe.className),day:pe.day,gridType:m,hour:m==="hour"?pe.day.hour():void 0,precomputedEvents:ve.get(n.col.events(pe.day)),resourceId:s?.id,showDayNumber:G},Ee):null})}),!ye&&Oe("div",{className:"absolute inset-0 z-10 pointer-events-none",children:Oe(Zt,{allDay:D,"data-testid":n.container.eventsLayer("horizontal",o),dayNumberHeight:v,days:ge,gridType:m,positionedEvents:T,resource:s,resourceId:s?.id})})]})]})},qo=Yr(({col:o,gridType:s="day",allDay:m,resource:f,resourceId:v,dayNumberHeight:C,showDayNumber:E,id:D})=>{let G=o.days??[],{positionedEvents:h}=Yt({days:G,gridType:s,resourceId:v,allDay:m});return Jt("div",{className:"flex relative w-full",children:[Oe("div",{className:"flex w-full gap-px bg-border",children:G.map((W,ye)=>Oe(z,{allDay:m,className:e("flex-1 w-20",o.className),day:W,gridType:s,hour:s==="hour"?W.hour():void 0,resourceId:v,showDayNumber:E},n.listKey("day",ye)))}),Oe("div",{className:"absolute inset-0 z-10 pointer-events-none",children:Oe(Zt,{allDay:m,"data-testid":n.container.eventsLayer("horizontal",D),dayNumberHeight:C,days:G,gridType:s,positionedEvents:h,resource:f,resourceId:v})})]})}),oe=Yr(Yo);import{jsx as qr,jsxs as Zo}from"react/jsx-runtime";var Qo=({days:o,classes:s,resource:m,showSpacer:f=!0})=>{let v=o.map((C,E)=>({id:n.col.allDay(C,E),day:C,gridType:"day",className:e("h-full min-h-12 bg-background",s?.cell)}));return Zo("div",{className:e("flex w-full gap-px bg-border",s?.row),"data-testid":"all-day-row",children:[f&&qr(xt,{className:s?.spacer}),qr(oe,{allDay:!0,className:"flex-1 min-h-fit",columns:v,dayNumberHeight:0,gridType:"day",id:n.allDayRow(m?.id),resource:m,variant:"regular"})]})},ae=Xo(Qo);import{jsx as tt,jsxs as Xr}from"react/jsx-runtime";var Ne="min-w-20 flex-1",Xe=({resources:o,days:s,gridType:m,cellClassName:f})=>{let v=s.map((C)=>{let E=Array.isArray(C),D=E?C.at(0):C;return{id:D?n.col.day(D):"day-col-unknown",day:E?void 0:C,days:E?C:void 0,className:f,gridType:m}});return o.map((C)=>({id:String(C.id),resource:C,columns:v}))},Qe=({resources:o,gutter:s,columnsFor:m})=>[s,...o.flatMap((f)=>{let v=m(f);return(Array.isArray(v)?v:[v]).map((E)=>({...E,resource:f}))})],Pt=({resources:o})=>Xr("div",{className:"flex gap-px bg-border h-12 flex-1","data-testid":n.header.resource.columnsHeader,children:[tt("div",{className:e("shrink-0 sticky top-0 left-0 bg-background z-20",qe,Ae)}),o.map((s)=>tt(et,{className:e(Ne,"bg-background"),resource:s},n.listKey("resource-cell",s.id)))]}),rt=()=>{let{t:o}=r((s)=>({t:s.t}));return tt("div",{className:"w-20 sm:w-40 border-b border-r shrink-0 flex justify-center items-center sticky top-0 left-0 bg-background z-20",children:tt("div",{className:"text-sm truncate px-1 min-w-0",children:o("resources")})})},me=({columns:o})=>{let s=[],m=new Map;for(let f of o){if(!f.resource||f.noEvents||!f.day)continue;let v=m.get(f.resource.id);if(!v)v={resource:f.resource,days:[],seenDayKeys:new Set},m.set(f.resource.id,v),s.push(v);let C=c(f.day);if(!v.seenDayKeys.has(C))v.seenDayKeys.add(C),v.days.push(f.day)}return Xr("div",{className:"flex w-full gap-px bg-border",children:[tt(xt,{}),s.map(({resource:f,days:v})=>tt(ae,{classes:{cell:e("min-w-20",v.length>1&&"flex-1")},days:v,resource:f,showSpacer:!1},n.allDayRow(f.id)))]})};import{jsx as It}from"react/jsx-runtime";var jt=({hours:o,view:s})=>It("div",{className:e("flex gap-px bg-border border-b",gt),children:o.map((m,f)=>{let v=m.isSame(t(),"hour"),C=v?"time":void 0,E=m.format("HH"),D=n.listKey("time-header-hour",E,f);return It("div",{"aria-current":C,className:e(Ne,"bg-background flex items-center justify-center text-xs shrink-0",v&&Ct),"data-hour":E,"data-testid":n.header.resource.timeLabel(s,E),children:It(l,{className:"text-center",transitionKey:D,children:It(Et,{date:m})})},D)})});import{jsx as We,jsxs as Jr,Fragment as na}from"react/jsx-runtime";var ea=({date:o})=>{let{t:s}=r((f)=>({t:f.t})),m=a(o);return We("div",{className:"flex flex-1 justify-center items-center min-h-12","data-testid":"day-view-header",children:Jr(l,{className:e("flex justify-center items-center text-center text-sm font-semibold sm:text-xl",m&&"text-primary"),transitionKey:c(o),children:[o.format("dddd, LL"),m&&We("span",{className:"bg-primary text-primary-foreground ml-2 rounded-full px-1 py-0.5 text-xs sm:px-2 sm:text-sm",children:s("today")})]})})},Qr=(o,s)=>Rt({referenceDate:o,businessHours:s.businessHours,hideNonBusinessHours:s.hideNonBusinessHours,allDates:[o],resourceBusinessHours:wt(s.resources??[])}),ta=({date:o,config:s})=>{let m=Qr(o,s);return Jr(na,{children:[We(rt,{}),We("div",{className:"flex-1 flex flex-col",children:We(jt,{hours:m,view:"day"})})]})},ra=(o,s)=>{let m=s.resources??[],f=Qr(o,s),v=a(o);if(!m.length)return[Fe({days:f,gridType:"hour",showsToday:v}),{id:n.col.day(o),day:o,days:f,className:e(br,"flex-1"),gridType:"hour"}];if(s.orientation==="vertical")return Qe({resources:m,gutter:Fe({days:f,gridType:"hour",showsToday:v}),columnsFor:(C)=>({id:n.col.day(o,C.id),days:f,day:o,gridType:"hour"})});return Xe({resources:m,days:f,gridType:"hour",cellClassName:Ne})},Zr={name:"day",label:"day",icon:Jo,navigationUnit:"day",layout:"vertical",supportsResources:!0,range:(o)=>({start:o.startOf("day"),end:o.endOf("day")}),columns:ra,renderHeader:({date:o,config:s})=>{let m=s.resources??[];if(!m.length)return We(ea,{date:o});if(s.orientation==="vertical")return We(Pt,{resources:m});return We(ta,{config:s,date:o})}};import{Grid3x3 as oa}from"lucide-react";import{jsx as er}from"react/jsx-runtime";var ze=({today:o,dayNumber:s,weekday:m,className:f})=>er(b,{className:f,dayNumber:er(l,{className:"w-auto",transitionKey:s,children:s}),today:o,weekday:m==null?void 0:er(l,{transitionKey:m,children:m})});import{jsx as Mt}from"react/jsx-runtime";var en=({className:o})=>{let{firstDayOfWeek:s,stickyViewHeader:m,viewHeaderClassName:f,currentDate:v}=r(),C=i(v,s);return Mt("div",{className:e("flex w-full gap-px bg-border border-b",m&&"sticky top-0 z-20",f,o),"data-testid":"month-header",children:C.map((E)=>{let D=E.format("ddd");return Mt("div",{className:"py-2 text-center font-medium bg-background flex-1 min-w-0 flex items-center justify-center","data-testid":n.header.weekday("month",D),children:Mt(l,{transitionKey:D,children:Mt("span",{className:"text-sm capitalize truncate w-full block",children:D})})},D)})})};import{jsx as Ue,jsxs as da,Fragment as la}from"react/jsx-runtime";var aa=(o,s)=>{let m=Dt(o);return Qe({resources:s,gutter:Fe({days:m,gridType:"day",renderLabel:(f)=>Ue(ze,{className:"flex-col-reverse",dayNumber:f.format("D"),today:a(f),weekday:f.format("ddd")})}),columnsFor:(f)=>({id:n.col.resource("month",f.id),day:void 0,days:m,gridType:"day"})})},sa=({date:o})=>{let s=Dt(o);return da(la,{children:[Ue(rt,{}),Ue("div",{className:"flex flex-1 gap-px bg-border border-b",children:s.map((m,f)=>{let v=n.listKey("resource-month-day",f),C=a(m);return Ue("div",{className:"flex-1 w-20 bg-background shrink-0 flex items-center justify-center flex-col",children:Ue(ze,{className:"flex-col-reverse",dayNumber:m.format("D"),today:C,weekday:m.format("ddd")})},v)})})]})},ia=(o,s)=>{let m=s.resources??[];if(m.length){if(s.orientation==="vertical")return aa(o,m);return Xe({resources:m,days:Dt(o),gridType:"day"})}return L(o,s.firstDayOfWeek).map((f,v)=>({id:n.listKey("week",v),columns:f.map((C)=>({id:n.col.day(C),day:C,className:"w-auto",gridType:"day"})),className:"flex-1",showDayNumber:!0}))},tn={name:"month",label:"month",icon:oa,navigationUnit:"month",layout:"horizontal",supportsResources:!0,range:(o,s)=>bt(o,s.firstDayOfWeek),columns:ia,renderHeader:({date:o,config:s})=>{let m=s.resources??[];if(!m.length)return Ue(en,{className:"h-12"});if(s.orientation==="vertical")return Ue(Pt,{resources:m});return Ue(sa,{date:o})}};import{Columns3 as ua}from"lucide-react";import{jsx as tr}from"react/jsx-runtime";var rn=({days:o})=>{let{weekViewGranularity:s}=r(),m=s==="hourly";return tr("div",{className:e("flex gap-px bg-border border-b",gt),children:o.map((f,v)=>{let C=a(f),E=n.listKey("resource-week-day",v);return tr("div",{className:e("shrink-0 bg-background flex-1 flex items-center text-center font-medium min-w-20"),"data-testid":n.header.resource.weekDay,children:tr(ze,{className:e(m?"sticky left-1/2 px-2":"w-full text-center"),dayNumber:f.format("D"),today:C,weekday:f.format("ddd")})},E)})})};import{jsx as At,jsxs as ca}from"react/jsx-runtime";var nn=({columns:o})=>{let{currentDate:s}=r();return ca("div",{className:"flex h-12 gap-px bg-border",children:[At("div",{className:e("shrink-0 z-20 bg-background sticky left-0",qe,Ae),children:At("span",{className:"px-2 h-full w-full flex justify-center items-start font-medium",children:s.week()})}),o.map((m,f)=>{let v=m.day;if(!v)return null;let C=a(v),E=n.listKey("resource-week-day",m.resourceId??"",f);return At("div",{className:e(Ne,"flex flex-col items-center justify-center text-xs shrink-0 bg-background"),"data-testid":n.header.resource.timeLabel("week",v.format("HH")),children:At(ze,{dayNumber:v.format("D"),today:C,weekday:v.format("ddd")})},E)})]})};import{jsx as ut,jsxs as on}from"react/jsx-runtime";var an=({resources:o})=>{let{weekViewGranularity:s,t:m,currentDate:f}=r(),v=s==="hourly";return on("div",{className:"flex h-12 gap-px bg-border",children:[ut("div",{className:e("shrink-0 z-20 bg-background sticky left-0",qe,Ae),children:on("span",{className:e("px-2 h-full w-full flex flex-col justify-center text-xs text-muted-foreground text-center min-w-0",v?"justify-end":"justify-center"),children:[ut("span",{className:"truncate w-full",children:m("week")}),!v&&ut("span",{className:"font-medium text-foreground truncate w-full",children:f.week()})]})}),o.map((C)=>ut(et,{className:e(Ne,"bg-background border-b"),resource:C,children:ut("div",{className:e("sticky text-sm font-medium truncate",v?"left-1/4":"left-1"),children:C.title})},n.listKey("resource-cell",C.id)))]})};import{jsx as Te,jsxs as mt,Fragment as Ca}from"react/jsx-runtime";var Ot=(o,s)=>{let m=i(o,s.firstDayOfWeek),{hiddenDays:f}=s;if(!f)return m;return m.filter((v)=>!f.has(v.day()))},Vt=(o)=>(o.weekViewGranularity??"hourly")==="hourly",ma=({date:o,config:s})=>{let{t:m,selectDate:f,openEventForm:v}=r((D)=>({t:D.t,selectDate:D.selectDate,openEventForm:D.openEventForm})),C=Ot(o,s),E=String(o.week());return mt("div",{className:"flex h-18 flex-1 gap-px bg-border","data-testid":"week-view-header",children:[Te("div",{className:e(j,"h-full shrink-0 items-center justify-center bg-background p-2 flex",Ae),children:mt("div",{className:"flex flex-col items-center justify-center min-w-0 w-full",children:[Te("span",{className:"text-muted-foreground text-xs truncate w-full text-center",children:m("week")}),Te(l,{className:"font-medium truncate w-full text-center",transitionKey:E,children:E})]})}),C.map((D,G)=>{let h=a(D),W=n.listKey("week-header-day",G);return Te("div",{className:e("hover:bg-accent bg-background flex-1 min-w-0 flex flex-col justify-center cursor-pointer p-1 text-center sm:p-2 w-20 h-full"),"data-testid":n.header.weekday("week",D.format("dddd")),onClick:()=>{f(D),v({start:D})},children:Te(ze,{dayNumber:D.format("D"),today:h,weekday:D.format("ddd")})},W)})]})},nt=(o,s,m)=>Rt({referenceDate:o,businessHours:s.businessHours,hideNonBusinessHours:s.hideNonBusinessHours,allDates:m,resourceBusinessHours:wt(s.resources??[])}),pa=(o,s,m)=>{let f=i(o,s.firstDayOfWeek);if(Vt(s)){let v=Ot(o,s),C=v.some((E)=>a(E));return Qe({resources:m,gutter:Fe({days:nt(o,s,f),gridType:"hour",showsToday:C}),columnsFor:(E)=>v.map((D)=>({id:n.col.day(D,E.id),className:Ne,day:D,days:nt(D,s,f),gridType:"hour"}))})}return Qe({resources:m,gutter:Fe({days:f,gridType:"day",renderLabel:(v)=>Te(b,{dayNumber:v.format("D"),today:a(v),weekday:v.format("ddd")})}),columnsFor:(v)=>({id:n.col.resource("week",v.id),className:Ne,day:void 0,days:f,gridType:"day"})})},ya=(o,s,m)=>{let f=i(o,s.firstDayOfWeek);if(Vt(s)){let v=f.map((C)=>nt(C,s));return Xe({resources:m,days:v,gridType:"hour",cellClassName:Ne})}return Xe({resources:m,days:f,gridType:"day",cellClassName:Ne})},fa=({date:o,config:s,resources:m})=>{let f=Ot(o,s),v=Vt(s),C=v?m.flatMap((E)=>f.map((D)=>({day:D,resourceId:E.id}))):[];return mt("div",{className:"flex-1 flex flex-col",children:[Te(an,{resources:m}),v&&Te(nn,{columns:C})]})},va=({date:o,config:s})=>{let m=i(o,s.firstDayOfWeek),f=Vt(s),v=f?m.flatMap((C)=>nt(C,s)):[];return mt(Ca,{children:[Te(rt,{}),mt("div",{className:"flex-1 flex flex-col",children:[Te(rn,{days:m}),f&&Te(jt,{hours:v,view:"week"})]})]})},ga=(o,s)=>{let m=s.resources??[];if(m.length){if(s.orientation==="vertical")return pa(o,s,m);return ya(o,s,m)}let f=i(o,s.firstDayOfWeek),v=Ot(o,s),C=v.some((E)=>a(E));return[Fe({days:nt(o,s,f),gridType:"hour",widthClassName:j,showsToday:C}),...v.map((E)=>({id:n.col.day(E),day:E,days:nt(E,s,f),className:"flex-1 min-w-0",gridType:"hour"}))]},sn={name:"week",label:"week",icon:ua,navigationUnit:"week",layout:"vertical",supportsResources:!0,range:(o,s)=>{let m=i(o,s.firstDayOfWeek),f=m.at(0)??o,v=m.at(-1)??o;return{start:f.startOf("day"),end:v.endOf("day")}},columns:ga,renderHeader:({date:o,config:s})=>{let m=s.resources??[];if(!m.length)return Te(ma,{config:s,date:o});if(s.orientation==="vertical")return Te(fa,{config:s,date:o,resources:m});return Te(va,{config:s,date:o,resources:m})}};import{Grid2x2 as ha}from"lucide-react";import{useMemo as Ea}from"react";import{jsx as Ke,jsxs as pt}from"react/jsx-runtime";var Da=["bg-primary","bg-blue-500","bg-green-500"],ba=42,ln=()=>{let{currentDate:o,setView:s,getEventsForDateRange:m,t:f,firstDayOfWeek:v}=r(),C=o.year(),E=i(t(),v).map((T)=>({id:T.day().toString(),label:T.format("dd")})),D=Ea(()=>{let T=c(t()),ve=c(o),pe=Array.from({length:12},(be,De)=>t().year(C).month(De).startOf("month")),Ce=pe.map((be)=>{let we=i(be,v).at(0)??be;return Array.from({length:ba},(ke,Se)=>we.add(Se,"day"))}),Ee=Ce.at(0)?.at(0),he=Ce.at(-1)?.at(-1),Re=[];if(Ee&&he)Re=m(Ee.startOf("day"),he.endOf("day"));return pe.map((be,De)=>{let ke=(Ce.at(De)??[]).map((xe)=>{let _e=xe.startOf("day"),Pe=xe.endOf("day"),Ie=c(xe),Le=Re.filter((Ze)=>d(Ze,_e,Pe));return{date:xe,dayKey:Ie,isInCurrentMonth:xe.month()===be.month(),isToday:Ie===T,isSelected:Ie===ve,eventCount:Le.length}}),Se=be.endOf("month"),He=Re.filter((xe)=>d(xe,be,Se));return{date:be,name:be.format("MMMM"),eventCount:He.length,monthKey:be.format("MM"),days:ke}})},[C,o,v,m]),G=(T,ve,pe)=>{pe?.stopPropagation(),s(ve,T)},h=(T)=>{let ve=T===1?f("event"):f("events");return`${T} ${ve}`},W=(T)=>{let pe=T.isInCurrentMonth?"":"text-muted-foreground opacity-50",Ce=T.isToday?"bg-primary text-primary-foreground rounded-full":"",Ee=T.isSelected&&!T.isToday?"bg-muted rounded-full font-bold":"",he=T.eventCount>0&&!T.isToday&&!T.isSelected?"font-medium":"";return e("relative flex aspect-square w-full cursor-pointer flex-col items-center justify-center hover:bg-accent rounded-sm transition-colors duration-200",pe,Ce,Ee,he)},ye=(T,ve)=>e("h-[3px] w-[3px] rounded-full",ve?"bg-primary-foreground":T),ge=(T)=>{if(T===0)return"";return h(T)};return pt(u,{className:"h-full","data-testid":"year-view",children:[Ke("div",{className:"grid auto-rows-fr grid-cols-1 gap-4 p-4 sm:grid-cols-2 lg:grid-cols-3","data-testid":"year-grid",children:D.map((T)=>{let ve=T.days;return pt("div",{className:"hover:border-primary flex flex-col rounded-lg border p-3 text-left transition-all duration-200 hover:shadow-md","data-testid":n.header.year.month(T.monthKey),children:[pt(l,{className:"mb-2 flex items-center justify-between",transitionKey:n.listKey("month",T.monthKey),children:[Ke("button",{className:"text-lg font-medium hover:underline cursor-pointer","data-testid":n.header.year.month(T.monthKey,"title"),onClick:()=>G(T.date,"month"),type:"button",children:T.name}),T.eventCount>0&&Ke("span",{className:"bg-primary text-primary-foreground rounded-full px-2 py-1 text-xs","data-testid":n.header.year.month(T.monthKey,"count"),children:h(T.eventCount)})]},n.listKey("month",T.monthKey)),pt("div",{className:"grid grid-cols-7 gap-px text-[0.6rem]","data-testid":n.header.year.month(T.monthKey,"mini"),children:[E.map((pe)=>Ke("div",{className:"text-muted-foreground h-3 text-center",children:pe.label},n.listKey("header",T.monthKey,pe.id))),ve.map((pe)=>{let Ce=n.header.year.day(T.date.format("YYYY-MM"),pe.dayKey),Ee=pe.eventCount>0,he=Math.min(pe.eventCount,3),Re=Da.slice(0,he);return pt("button",{className:W(pe),"data-testid":Ce,onClick:(be)=>G(pe.date,"day",be),title:ge(pe.eventCount),type:"button",children:[Ke("span",{className:"text-center leading-none",children:pe.date.date()}),Ee&&Ke("div",{className:e("absolute bottom-0 flex w-full justify-center space-x-px",pe.isToday&&"bottom-px"),children:Re.map((be)=>Ke("span",{className:ye(be,pe.isToday)},be))})]},pe.dayKey)})]})]},T.monthKey)})}),Ke(y,{className:"z-30"})]})};var dn={name:"year",label:"year",icon:ha,navigationUnit:"year",supportsResources:!1,range:(o)=>({start:o.startOf("year"),end:o.endOf("year")}),component:ln};var cn=[Zr,sn,tn,dn];var un=(o,s,m)=>s?.range?.(o,{firstDayOfWeek:m})??bt(o,m),mn=({initialDate:o,initialView:s,firstDayOfWeek:m,onDateChange:f,onViewChange:v,pluginRuntime:C})=>{let[E,D]=xa(()=>({date:t(o),view:s})),G=Ra(E),h=je((De)=>{let we={...G.current,...De};return G.current=we,D(we),we},[]),W=je(()=>[...cn,...C.getViews()],[C]),ye=je((De)=>W().find((we)=>we.name===De),[W]),ge=je(()=>un(E.date,ye(E.view),m),[E,m,ye]),T=je((De)=>{let we=un(De.date,ye(De.view),m);f?.(De.date,we)},[f,m,ye]),ve=je((De)=>{T(h({date:De}))},[h,T]),pe=je((De)=>{let{date:we,view:ke}=G.current,Se=ye(ke),He=Se?.navigationStep??{amount:1,unit:Se?.navigationUnit??"day"},xe=we.add(De*He.amount,He.unit);T(h({date:xe}))},[h,T,ye]),Ce=je(()=>pe(1),[pe]),Ee=je(()=>pe(-1),[pe]),he=je(()=>T(h({date:t()})),[h,T]),Re=je((De,we)=>{let ke=h(we?{view:De,date:we}:{view:De});v?.(De),T(ke)},[h,v,T]),be=je((De)=>{let we=typeof De==="function"?De(G.current.date):De;h({date:we})},[h]);return wa(()=>({currentDate:E.date,setCurrentDate:be,view:E.view,setView:Re,selectDate:ve,nextPeriod:Ce,prevPeriod:Ee,today:he,getCurrentViewRange:ge,getAllViews:W}),[E,be,Re,ve,Ce,Ee,he,ge,W])};import{useCallback as Sa,useInsertionEffect as ka,useRef as Ha}from"react";var Ve=(o)=>{let s=Ha(o);ka(()=>{s.current=o});let m=Sa((...v)=>s.current?.(...v),[]);return o!==void 0?m:void 0};import{createElement as Na,Fragment as Ta}from"react";var pn=(o)=>({transformEvents:(s,m)=>o.reduce((v,C)=>C.transformEvents?C.transformEvents(v,m):v,s).filter((v)=>d(v,m.start,m.end)),getEventManager:(s)=>o.find((m)=>m.managesEvent?.(s)),collect:(s,m)=>o.flatMap((f)=>f.contribute?.(s,m)??[]),renderSlot:(s,m)=>{let f=[];for(let v of o){let C=v.renderSlot?.(s,m);if(C!==null&&C!==void 0)f.push(Na(Ta,{key:v.name},C))}return f},getViews:()=>o.flatMap((s)=>s.views??[]),getProviders:()=>o.map((s)=>s.provider).filter((s)=>Boolean(s))});var Ia=[],ja=[],Ma=(o,s)=>{if(!s)return V(o)??t();if(!o)return t().tz(s);if(le(o))return t.tz(o,s);return(V(o)??t()).tz(s)},Aa=(o)=>({onEventAdd:Ve(o.onEventAdd),onEventUpdate:Ve(o.onEventUpdate),onEventDelete:Ve(o.onEventDelete),onEventsChange:Ve(o.onEventsChange),onDateChange:Ve(o.onDateChange),onViewChange:Ve(o.onViewChange),onEventClick:Ve(o.onEventClick),onCellClick:Ve(o.onCellClick)}),gn=(o)=>{let{events:s,firstDayOfWeek:m=0,initialView:f="month",initialDate:v,dayMaxEvents:C,businessHours:E,locale:D,timezone:G,translations:h,translator:W,disableEventClick:ye,disableCellClick:ge,resources:T,orientation:ve,weekViewGranularity:pe}=o,{onEventAdd:Ce,onEventUpdate:Ee,onEventDelete:he,onEventsChange:Re,onDateChange:be,onViewChange:De,onEventClick:we,onCellClick:ke}=Aa(o),{plugins:Se=ja}=o,He=fr({firstDayOfWeek:m,dayMaxEvents:C,businessHours:E,locale:D,translations:h,translator:W,resources:T,orientation:ve,weekViewGranularity:pe}),xe=fn(()=>pn(Se),[Se]),[_e]=Pa(()=>Ma(v,G)),Pe=mn({initialDate:_e,initialView:f,firstDayOfWeek:m,onDateChange:be,onViewChange:De,pluginRuntime:xe}),Ie=pr({events:s,pluginRuntime:xe,getCurrentViewRange:Pe.getCurrentViewRange,resources:He.resources??Ia,onEventAdd:Ce,onEventUpdate:Ee,onEventDelete:he,onEventsChange:Re}),Le=vr({currentDate:Pe.currentDate,t:He.t,disableEventClick:ye,disableCellClick:ge,onEventClick:we,onCellClick:ke}),{setCurrentLocale:Ze}=He,{setCurrentDate:$e}=Pe,{setCurrentEvents:ot}=Ie,at=vn(void 0);yn(()=>{if(D&&D!==at.current)Ze(D),t.locale(D),$e((Be)=>Be.locale(D)),at.current=D},[D,Ze,$e]);let st=vn(void 0);return yn(()=>{if(G!==st.current){t.tz.setDefault(G);let Be=(Me)=>G?Me.tz(G):Me.local();$e((Me)=>Be(Me)),ot((Me)=>Me.map((Ye)=>({...Ye,start:Be(Ye.start),end:Be(Ye.end)}))),st.current=G}},[G,$e,ot]),fn(()=>{let{setCurrentLocale:Be,...Me}=He,{getCurrentViewRange:Ye,getAllViews:yt,...ft}=Pe,{setCurrentEvents:Bt,...Ft}=Ie;return{...Me,...ft,...Ft,...Le,getViews:yt,getEventManager:xe.getEventManager,renderSlot:xe.renderSlot,collect:xe.collect,getProviders:xe.getProviders,getEventResourceIds:lt,currentRange:Pe.getCurrentViewRange()}},[He,Pe,Ie,Le,xe])};import{jsx as Oa}from"react/jsx-runtime";var Cn=(o,s)=>o.reduceRight((m,f,v)=>Oa(f,{children:m},v),s);import{useMemo as Va}from"react";import{jsx as Ba}from"react/jsx-runtime";var En=({children:o})=>{let{currentDate:s,view:m,eventSpacing:f,businessHours:v,getResourceById:C,onCellClick:E,isCellDisabled:D,getCellClassName:G,disableDragAndDrop:h,disableCellClick:W,classesOverride:ye}=r(),ge=Va(()=>({currentDate:s,view:m,eventSpacing:f,businessHours:v,getResourceById:C,onCellClick:E,isCellDisabled:D,getCellClassName:G,disableDragAndDrop:h,disableCellClick:W,classesOverride:ye}),[s,m,f,v,C,E,D,G,h,W,ye]);return Ba(kt.Provider,{value:ge,children:o})};import{jsx as Dn}from"react/jsx-runtime";var za=[],_a=(o)=>{let{events:s=za,firstDayOfWeek:m=0,initialView:f="month",initialDate:v,renderEvent:C,onEventClick:E,onCellClick:D,isCellDisabled:G,getCellClassName:h,onViewChange:W,onEventAdd:ye,onEventUpdate:ge,onEventDelete:T,onEventsChange:ve,onDateChange:pe,locale:Ce,timezone:Ee,disableCellClick:he,disableEventClick:Re,disableDragAndDrop:be,dayMaxEvents:De,eventSpacing:we=Z,eventHeight:ke=Q,stickyViewHeader:Se=!0,viewHeaderClassName:He="",headerComponent:xe,headerClassName:_e,businessHours:Pe,renderEventForm:Ie,translations:Le,translator:Ze,timeFormat:$e="12-hour",classesOverride:ot,renderCurrentTimeIndicator:at,renderHour:st,hideNonBusinessHours:Be=!1,hideExportButton:Me=!1,hiddenDays:Ye,slotDuration:yt=60,scrollTime:ft,scrollToNow:Bt,plugins:Ft,resources:bn,renderResource:rr,orientation:hn,weekViewGranularity:wn}=o,nr=Ve(o.onMoreEventsClick),or=gn({events:s,firstDayOfWeek:m,initialView:f,initialDate:v,dayMaxEvents:De,businessHours:Pe,onEventAdd:ye,onEventUpdate:ge,onEventDelete:T,onEventsChange:ve,onDateChange:pe,onViewChange:W,locale:Ce,timezone:Ee,translations:Le,translator:Ze,plugins:Ft,onEventClick:E,onCellClick:D,disableEventClick:Re,disableCellClick:he,resources:bn,orientation:hn,weekViewGranularity:wn});return Fa(()=>{let{handleEventClick:Rn,handleDateClick:xn,...Sn}=or;return{...Sn,renderEvent:C,onEventClick:Rn,onCellClick:xn,isCellDisabled:G,getCellClassName:h,locale:Ce,timezone:Ee,disableCellClick:he,disableEventClick:Re,disableDragAndDrop:be,eventSpacing:we,eventHeight:ke,stickyViewHeader:Se,viewHeaderClassName:He,headerComponent:xe,headerClassName:_e,renderEventForm:Ie,onMoreEventsClick:nr,timeFormat:$e,classesOverride:ot,renderCurrentTimeIndicator:at,renderHour:st,hideNonBusinessHours:Be,hideExportButton:Me,hiddenDays:Ye,slotDuration:yt,scrollTime:ft,scrollToNow:Bt,renderResource:rr}},[or,C,rr,G,h,Ce,Ee,he,Re,be,we,ke,Se,He,xe,_e,Ie,nr,$e,ot,at,st,Be,Me,Ye,yt,ft,Bt])},_=({children:o,...s})=>{let m=_a(s),f=Cn(m.getProviders(),o);return Dn(vt.Provider,{value:m,children:Dn(En,{children:f})})};
|
|
2
|
+
export{se,r,fe,l,g,K,de,ce,ie,p,O,I,M,a,i,L,q,n,X,Z,Q,H,ue,B,J,x,F,A,z,ee,te,re,ne,oe,j,ae,me,_};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e from"dayjs";import I from"dayjs/plugin/isSameOrAfter.js";import S from"dayjs/plugin/isSameOrBefore.js";import C from"dayjs/plugin/localeData.js";import M from"dayjs/plugin/localizedFormat.js";import k from"dayjs/plugin/minMax.js";import h from"dayjs/plugin/timezone.js";import Y from"dayjs/plugin/utc.js";import R from"dayjs/plugin/weekday.js";import U from"dayjs/plugin/weekOfYear.js";var u,F=(i,a,f)=>{let d=a.prototype,n=f.tz.setDefault;f.tz.setDefault=(s)=>(u=s,n(s));let{startOf:o,endOf:l}=d;function y(s,r){let m=s.$x?.$timezone||u;if(!m)return r;let c=f.tz(r.format("YYYY-MM-DDTHH:mm:ss"),m).utcOffset();if(r.utcOffset()!==c)return r.tz(m,!0);return r}function p(s,r,m,c){let j=s.locale(),A="YYYY-MM-DDTHH:mm:ss.SSS",b=s.format("YYYY-MM-DDTHH:mm:ss.SSS"),D=f.utc(b).locale(j),g=o.call(D,m,c),O=g.format("YYYY-MM-DDTHH:mm:ss.SSS"),z=D.diff(g),T=f(s.valueOf()-z).tz(r).locale(j);if(T.format("YYYY-MM-DDTHH:mm:ss.SSS")===O)return T;return f.tz(O,r).locale(j)}d.startOf=function(s,r){let m=this.$x?.$timezone;if(m)return p(this,m,s,r);let c=o.call(this,s,r);return y(this,c)},d.endOf=l},v=(i,a)=>{let f=a.prototype,d={isBefore:(n,o)=>n<o,isAfter:(n,o)=>n>o,isSame:(n,o)=>n===o,isSameOrBefore:(n,o)=>n<=o,isSameOrAfter:(n,o)=>n>=o};for(let[n,o]of Object.entries(d)){let l=f[n];f[n]=function(y,p){if(p===void 0&&e.isDayjs(y))return o(this.valueOf(),y.valueOf());return l.call(this,y,p)}}};e.extend(R);e.extend(U);e.extend(I);e.extend(S);e.extend(k);e.extend(h);e.extend(Y);e.extend(C);e.extend(M);e.extend(F);e.extend(v);var w=/(?:Z|[+-]\d{2}:?\d{2})$/i,P=(i)=>{let a=i.split(/[Tt\s]/).at(1);if(!a)return!1;return w.test(a)},le=(i)=>typeof i==="string"&&!P(i),x=(i)=>{let a=e(i);if(!a.isValid())return a;if(le(i))return e.tz(i);if(!u)return a;return a.tz(u)};Object.assign(x,e);var t=x;
|
|
2
|
+
export{le,t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e}from"./chunk-89xfgjfh.js";import{useContext as s}from"react";var k=(t,a,n)=>{let l=s(t);if(l===void 0)throw Error(`${a} must be used within a ${n}`);return l};import*as o from"@radix-ui/react-dialog";import{XIcon as d}from"lucide-react";import{jsx as i,jsxs as r}from"react/jsx-runtime";function R({...t}){return i(o.Root,{"data-slot":"dialog",...t})}function g({...t}){return i(o.Portal,{"data-slot":"dialog-portal",...t})}function m({className:t,...a}){return i(o.Overlay,{className:e("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),"data-slot":"dialog-overlay",...a})}function w({className:t,children:a,...n}){return r(g,{"data-slot":"dialog-portal",children:[i(m,{}),r(o.Content,{className:e("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg max-h-[90%]",t),"data-slot":"dialog-content",...n,children:[a,r(o.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[i(d,{}),i("span",{className:"sr-only",children:"Close"})]})]})]})}function S({className:t,...a}){return i("div",{className:e("flex flex-col gap-2 text-center sm:text-left",t),"data-slot":"dialog-header",...a})}function G({className:t,...a}){return i("div",{className:e("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),"data-slot":"dialog-footer",...a})}function P({className:t,...a}){return i(o.Title,{className:e("text-lg leading-none font-semibold",t),"data-slot":"dialog-title",...a})}function W({className:t,...a}){return i(o.Description,{className:e("text-muted-foreground text-sm",t),"data-slot":"dialog-description",...a})}
|
|
2
|
+
export{k,R,w,S,G,P,W};
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode as ReactNode4 } from "react";
|
|
2
|
-
import { ComponentType, ReactNode
|
|
2
|
+
import { ComponentType, ReactNode } from "react";
|
|
3
3
|
import { Dayjs as Dayjs2, ManipulateType as ManipulateType2 } from "dayjs";
|
|
4
4
|
/**
|
|
5
5
|
* Core calendar event interface representing a single calendar event.
|
|
@@ -60,8 +60,15 @@ type WeekDays = "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "fr
|
|
|
60
60
|
*/
|
|
61
61
|
interface BusinessHours {
|
|
62
62
|
/**
|
|
63
|
-
* Days of the week to apply business hours to.
|
|
64
|
-
*
|
|
63
|
+
* Days of the week to apply business hours to. Omitted, the hours apply to
|
|
64
|
+
* every day, weekends included, in both the object and the array form.
|
|
65
|
+
*
|
|
66
|
+
* This deviates from FullCalendar, which defaults an object to Monday-Friday
|
|
67
|
+
* and ignores an array entry without days
|
|
68
|
+
* (core/src/structs/business-hours.ts, v6.1.21). Kept until the next major
|
|
69
|
+
* (see the TODO in business-hours.ts); list the days explicitly to get
|
|
70
|
+
* weekdays only.
|
|
71
|
+
* @default every day
|
|
65
72
|
*/
|
|
66
73
|
daysOfWeek?: WeekDays[];
|
|
67
74
|
/**
|
|
@@ -130,6 +137,32 @@ interface PluginMutationResult {
|
|
|
130
137
|
deleted: CalendarEvent[];
|
|
131
138
|
}
|
|
132
139
|
/**
|
|
140
|
+
* One user action and every stored row it touched, reported once through
|
|
141
|
+
* `onEventsChange` (#309). A recurring edit touches several rows (the series,
|
|
142
|
+
* an override, deleted overrides) that the per-row callbacks report one by
|
|
143
|
+
* one; this reports them together so they can be saved, or refused, as a unit.
|
|
144
|
+
* FullCalendar reports an action once the same way (`eventChange` with
|
|
145
|
+
* `relatedEvents`).
|
|
146
|
+
*/
|
|
147
|
+
interface EventsChange {
|
|
148
|
+
/** What the user did. */
|
|
149
|
+
action: "add" | "update" | "delete";
|
|
150
|
+
/** The event the user acted on, as it was shown (an occurrence, for a series). */
|
|
151
|
+
event: CalendarEvent;
|
|
152
|
+
/**
|
|
153
|
+
* The scope chosen in the plugin's scope dialog, when a plugin manages the
|
|
154
|
+
* event; otherwise undefined. The recurrence plugin passes its
|
|
155
|
+
* `RecurrenceEditScope` (`'this' | 'following' | 'all'`).
|
|
156
|
+
*/
|
|
157
|
+
scope?: unknown;
|
|
158
|
+
/** New rows, the same ones passed to `onEventAdd`. */
|
|
159
|
+
added: CalendarEvent[];
|
|
160
|
+
/** Changed rows, the same ones passed to `onEventUpdate`. */
|
|
161
|
+
updated: CalendarEvent[];
|
|
162
|
+
/** Removed rows, the same ones passed to `onEventDelete`. */
|
|
163
|
+
deleted: CalendarEvent[];
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
133
166
|
* Calendar configuration handed to a view's `columns()`/`renderHeader()`.
|
|
134
167
|
* Carries the resource axis (`resources`, `orientation`) so a resource-capable
|
|
135
168
|
* view can compose both arrangements. `range()` receives only the
|
|
@@ -168,7 +201,7 @@ interface VerticalColumnSpec {
|
|
|
168
201
|
className?: string;
|
|
169
202
|
/** Label-only column (e.g. the time gutter): renders no events. */
|
|
170
203
|
noEvents?: boolean;
|
|
171
|
-
renderCell?: (date: Dayjs2) =>
|
|
204
|
+
renderCell?: (date: Dayjs2) => ReactNode;
|
|
172
205
|
/**
|
|
173
206
|
* Resource-axis identity when the column belongs to one resource. The
|
|
174
207
|
* single carrier: consumers derive the id from `resource.id`.
|
|
@@ -269,7 +302,7 @@ interface PluginView {
|
|
|
269
302
|
*/
|
|
270
303
|
layout?: "vertical" | "horizontal";
|
|
271
304
|
/** Header row content rendered above the grid by the shared renderer. */
|
|
272
|
-
renderHeader?: (ctx: ViewHeaderContext) =>
|
|
305
|
+
renderHeader?: (ctx: ViewHeaderContext) => ReactNode;
|
|
273
306
|
/**
|
|
274
307
|
* Whether `columns()` composes the resource axis when `config.resources`
|
|
275
308
|
* is set. Defaults to false; the view switcher hides resource-incapable
|
|
@@ -305,7 +338,7 @@ interface IlamyPlugin {
|
|
|
305
338
|
managesEvent?: (event: CalendarEvent) => boolean;
|
|
306
339
|
applyEdit?: (args: PluginMutationArgs) => CalendarEvent[] | PluginMutationResult;
|
|
307
340
|
applyDelete?: (args: PluginMutationArgs) => CalendarEvent[] | PluginMutationResult;
|
|
308
|
-
renderSlot?: (slotName: string, context: unknown) =>
|
|
341
|
+
renderSlot?: (slotName: string, context: unknown) => ReactNode;
|
|
309
342
|
/**
|
|
310
343
|
* Contributes arbitrary data to a named point. Additive: all plugins may
|
|
311
344
|
* contribute to the same point; the runtime aggregates all results via
|
|
@@ -323,21 +356,12 @@ interface IlamyPlugin {
|
|
|
323
356
|
* among all plugin providers.
|
|
324
357
|
*/
|
|
325
358
|
provider?: ComponentType<{
|
|
326
|
-
children:
|
|
359
|
+
children: ReactNode;
|
|
327
360
|
}>;
|
|
328
361
|
}
|
|
329
|
-
import
|
|
330
|
-
type Dayjs3 =
|
|
331
|
-
import React3 from "react";
|
|
362
|
+
import { Dayjs as DayjsInstance } from "dayjs";
|
|
363
|
+
type Dayjs3 = DayjsInstance;
|
|
332
364
|
import { ReactNode as ReactNode3 } from "react";
|
|
333
|
-
interface EventFormProps {
|
|
334
|
-
open?: boolean;
|
|
335
|
-
selectedEvent?: CalendarEvent | null;
|
|
336
|
-
onAdd?: (event: CalendarEvent) => void;
|
|
337
|
-
onUpdate?: (event: CalendarEvent) => void;
|
|
338
|
-
onDelete?: (event: CalendarEvent) => void;
|
|
339
|
-
onClose: () => void;
|
|
340
|
-
}
|
|
341
365
|
declare const defaultTranslations: {
|
|
342
366
|
today: string;
|
|
343
367
|
create: string;
|
|
@@ -429,6 +453,14 @@ declare const defaultTranslations: {
|
|
|
429
453
|
type Translations = Record<keyof typeof defaultTranslations, string>;
|
|
430
454
|
type TranslationKey = keyof Translations;
|
|
431
455
|
type TranslatorFunction = (key: TranslationKey | string) => string;
|
|
456
|
+
interface EventFormProps {
|
|
457
|
+
open?: boolean;
|
|
458
|
+
selectedEvent?: CalendarEvent | null;
|
|
459
|
+
onAdd?: (event: CalendarEvent) => void;
|
|
460
|
+
onUpdate?: (event: CalendarEvent) => void;
|
|
461
|
+
onDelete?: (event: CalendarEvent) => void;
|
|
462
|
+
onClose: () => void;
|
|
463
|
+
}
|
|
432
464
|
/**
|
|
433
465
|
* Available calendar view types. The built-in views (day, week, month, year)
|
|
434
466
|
* are `PluginView` specs in `features/calendar/components/views`; plugins may
|
|
@@ -545,6 +577,7 @@ interface CalendarProviderProps {
|
|
|
545
577
|
onEventAdd?: (event: CalendarEvent) => void;
|
|
546
578
|
onEventUpdate?: (event: CalendarEvent) => void;
|
|
547
579
|
onEventDelete?: (event: CalendarEvent) => void;
|
|
580
|
+
onEventsChange?: (change: EventsChange) => void;
|
|
548
581
|
onDateChange?: (date: Dayjs3, range: DateRange) => void;
|
|
549
582
|
locale?: string;
|
|
550
583
|
timezone?: string;
|
|
@@ -578,7 +611,7 @@ interface CalendarProviderProps {
|
|
|
578
611
|
/** The resource axis. Absent/empty → a regular calendar (no filtering, no resource columns). */
|
|
579
612
|
resources?: Resource[];
|
|
580
613
|
/** Custom render for resource header cells. */
|
|
581
|
-
renderResource?: (resource: Resource) =>
|
|
614
|
+
renderResource?: (resource: Resource) => ReactNode3;
|
|
582
615
|
/** Resource arrangement preference. Only applies when `resources` is set. @default 'horizontal' */
|
|
583
616
|
orientation?: "horizontal" | "vertical";
|
|
584
617
|
/** Week-view granularity for resource weeks. @default 'hourly' */
|
package/dist/testing/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../shared/chunk-
|
|
1
|
+
import"../shared/chunk-nvtnncwx.js";import{_}from"../shared/chunk-j4pfc0hb.js";import"../shared/chunk-89xfgjfh.js";import"../shared/chunk-pg39xa62.js";import"../shared/chunk-bgegqhb4.js";import{jsx as a}from"react/jsx-runtime";var d=({children:r,...e})=>a(_,{dayMaxEvents:5,...e,children:r});export{d as CalendarTestProvider};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ilamy/calendar",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "A full-featured React calendar component library built with Shadcn-Ui, Tailwind CSS, and TypeScript.",
|
|
5
5
|
"author": "Sujeet Kc",
|
|
6
6
|
"license": "MIT",
|
|
@@ -62,6 +62,7 @@
|
|
|
62
62
|
"test": "bun test",
|
|
63
63
|
"test:coverage": "bun test --coverage",
|
|
64
64
|
"type-check": "bunx tsc --noEmit",
|
|
65
|
+
"check:dist-types": "bunx tsc -p tsconfig.dist.json",
|
|
65
66
|
"lint": "bunx biome lint . --diagnostic-level=error",
|
|
66
67
|
"check": "bunx biome check . --diagnostic-level=error",
|
|
67
68
|
"check:fix": "bunx biome check --write .",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{e}from"./chunk-h5d5q285.js";import*as o from"@radix-ui/react-dialog";import{XIcon as l}from"lucide-react";import{jsx as i,jsxs as n}from"react/jsx-runtime";function R({...t}){return i(o.Root,{"data-slot":"dialog",...t})}function s({...t}){return i(o.Portal,{"data-slot":"dialog-portal",...t})}function g({className:t,...a}){return i(o.Overlay,{className:e("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",t),"data-slot":"dialog-overlay",...a})}function w({className:t,children:a,...r}){return n(s,{"data-slot":"dialog-portal",children:[i(g,{}),n(o.Content,{className:e("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg max-h-[90%]",t),"data-slot":"dialog-content",...r,children:[a,n(o.Close,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[i(l,{}),i("span",{className:"sr-only",children:"Close"})]})]})]})}function S({className:t,...a}){return i("div",{className:e("flex flex-col gap-2 text-center sm:text-left",t),"data-slot":"dialog-header",...a})}function F({className:t,...a}){return i("div",{className:e("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",t),"data-slot":"dialog-footer",...a})}function P({className:t,...a}){return i(o.Title,{className:e("text-lg leading-none font-semibold",t),"data-slot":"dialog-title",...a})}function _({className:t,...a}){return i(o.Description,{className:e("text-muted-foreground text-sm",t),"data-slot":"dialog-description",...a})}
|
|
2
|
-
export{R,w,S,F,P,_};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t}from"./chunk-kpzykmz4.js";function A(s){if(s===void 0)return;if(t.isDayjs(s))return s;let n=t(s);return n.isValid()?n:void 0}var c=(s)=>s.format("YYYY-MM-DD"),W=(s,n)=>c(s)===c(n);function d(s,n,r){let a=s.start.isSameOrAfter(n)&&s.start.isSameOrBefore(r),o=s.end.isAfter(n)&&s.end.isSameOrBefore(r),f=s.start.isBefore(n)&&s.end.isAfter(r);return a||o||f}var T=(...s)=>s.join("-");function ue(s){let n=s.replace("#",""),r=n.length===3?n.split("").map((i)=>i+i).join(""):n;if(!/^[0-9a-fA-F]{6}$/.test(r))return"#000000";let a=Number.parseInt(r.slice(0,2),16),o=Number.parseInt(r.slice(2,4),16),f=Number.parseInt(r.slice(4,6),16);return(a*299+o*587+f*114)/1000>=128?"#000000":"#ffffff"}import{clsx as u}from"clsx";import{twMerge as p}from"tailwind-merge";function e(...s){return p(u(s))}
|
|
2
|
-
export{e,A,c,W,d,T,ue};
|