calendar-events 0.1.0

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/README.md ADDED
@@ -0,0 +1,220 @@
1
+ # calendar-events
2
+
3
+ A lightweight, customizable React calendar component with event support. Built with TypeScript and Tailwind CSS, featuring generic typed events, render props for full control over event display, a loading state with an animated SVG icon, and seamless dark mode via CSS variables (shadcn/ui compatible).
4
+
5
+ ## Features
6
+
7
+ - **Generic typed events** — attach any custom data shape to your events via `CalendarEvent<TData>`
8
+ - **Render props** — fully control how each event is rendered inside a day cell
9
+ - **Loading state** — built-in animated calendar icon overlay while fetching data
10
+ - **Dark mode** — works out of the box with a `.dark` class using CSS custom properties
11
+ - **shadcn/ui compatible** — uses the same CSS variable conventions, so it slots into any shadcn/ui project with no extra configuration
12
+ - **Modular** — all sub-components are exported individually so you can compose your own layout
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install calendar-events
18
+ ```
19
+
20
+ **Peer dependencies** (install if not already present):
21
+
22
+ ```bash
23
+ npm install react react-dom
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ ### 1. Import the styles
29
+
30
+ Import the CSS once at the root of your app (e.g. `main.tsx` or `layout.tsx`):
31
+
32
+ ```tsx
33
+ import 'calendar-events/style.css'
34
+ ```
35
+
36
+ > **Already using shadcn/ui?** Skip this import — your existing CSS variables are already compatible.
37
+
38
+ ### 2. Use the component
39
+
40
+ ```tsx
41
+ import { CalendarEvents } from 'calendar-events'
42
+
43
+ export default function Page() {
44
+ return <CalendarEvents />
45
+ }
46
+ ```
47
+
48
+ ### 3. Pass your own events
49
+
50
+ ```tsx
51
+ import { CalendarEvents } from 'calendar-events'
52
+ import type { CalendarEvent } from 'calendar-events'
53
+
54
+ const events: CalendarEvent[] = [
55
+ {
56
+ id: 1,
57
+ title: 'Team meeting',
58
+ date: new Date(2025, 5, 10),
59
+ description: 'Weekly sync',
60
+ },
61
+ {
62
+ id: 2,
63
+ title: 'Project deadline',
64
+ date: new Date(2025, 5, 20),
65
+ },
66
+ ]
67
+
68
+ export default function Page() {
69
+ return (
70
+ <CalendarEvents
71
+ events={events}
72
+ onClickEvent={(event) => console.log(event)}
73
+ />
74
+ )
75
+ }
76
+ ```
77
+
78
+ ## Generic typed events
79
+
80
+ Attach any custom data to an event using the generic parameter:
81
+
82
+ ```tsx
83
+ type Task = {
84
+ priority: 'low' | 'medium' | 'high'
85
+ assignee: string
86
+ }
87
+
88
+ const events: CalendarEvent<Task>[] = [
89
+ {
90
+ id: 1,
91
+ title: 'Deploy release',
92
+ date: new Date(2025, 5, 15),
93
+ data: { priority: 'high', assignee: 'Ana' },
94
+ },
95
+ ]
96
+
97
+ <CalendarEvents<Task>
98
+ events={events}
99
+ onClickEvent={(event) => {
100
+ // event.data is fully typed as Task
101
+ console.log(event.data.priority)
102
+ }}
103
+ />
104
+ ```
105
+
106
+ ## Custom event rendering
107
+
108
+ Use the `renderEvent` prop to replace the default event pill with anything you want:
109
+
110
+ ```tsx
111
+ <CalendarEvents
112
+ events={events}
113
+ renderEvent={(event) => (
114
+ <span
115
+ className="block rounded px-2 py-0.5 text-xs text-white truncate"
116
+ style={{ backgroundColor: event.data?.color }}
117
+ >
118
+ {event.title}
119
+ </span>
120
+ )}
121
+ />
122
+ ```
123
+
124
+ ## Loading state
125
+
126
+ Pass `loading={true}` while fetching events from an API. An animated calendar overlay is shown over the grid:
127
+
128
+ ```tsx
129
+ const { data, isLoading } = useQuery(...)
130
+
131
+ <CalendarEvents
132
+ events={data ?? []}
133
+ loading={isLoading}
134
+ />
135
+ ```
136
+
137
+ ## Props — `CalendarEvents`
138
+
139
+ | Prop | Type | Default | Description |
140
+ |---|---|---|---|
141
+ | `initialDate` | `Date` | `new Date()` | Month shown on first render |
142
+ | `events` | `CalendarEvent<TData>[]` | Sample events | List of events to display |
143
+ | `loading` | `boolean` | `false` | Shows an animated loading overlay |
144
+ | `className` | `string` | — | Extra classes for the root element |
145
+ | `onClickEvent` | `(event: CalendarEvent<TData>) => void` | — | Fired when the user clicks an event |
146
+ | `renderEvent` | `(event: CalendarEvent<TData>) => ReactNode` | — | Custom renderer for each event pill |
147
+
148
+ ## Type — `CalendarEvent<TData>`
149
+
150
+ ```ts
151
+ type CalendarEvent<TData = unknown> = {
152
+ id: number
153
+ title: string
154
+ date: Date
155
+ description?: string
156
+ data?: TData // any custom payload
157
+ }
158
+ ```
159
+
160
+ ## CSS variables
161
+
162
+ The library styles are built on CSS custom properties. If you imported `calendar-events/style.css`, these defaults are already set. Override any of them in your own CSS to customise the look:
163
+
164
+ ```css
165
+ :root {
166
+ --primary: 222.2 47.4% 11.2%;
167
+ --primary-foreground: 210 40% 98%;
168
+ --secondary: 210 40% 96.1%;
169
+ --muted-foreground: 215.4 16.3% 46.9%;
170
+ --accent: 210 40% 96.1%;
171
+ --border: 214.3 31.8% 91.4%;
172
+ --background: 0 0% 100%;
173
+ --radius: 0.5rem;
174
+ }
175
+ ```
176
+
177
+ Values follow the `H S% L%` HSL format (no `hsl()` wrapper) so Tailwind's opacity modifier syntax works correctly.
178
+
179
+ ## Dark mode
180
+
181
+ Add the `.dark` class to `<html>` (or any ancestor element) to switch to the dark theme:
182
+
183
+ ```html
184
+ <html class="dark">
185
+ ```
186
+
187
+ ## Exported components
188
+
189
+ All sub-components are exported individually for advanced composition:
190
+
191
+ ```ts
192
+ import {
193
+ CalendarEvents, // main component
194
+ CalendarHeader, // month/year nav bar
195
+ CalendarWeekHeader, // row of day names
196
+ CalendarWeekHeaderItem, // single day name cell
197
+ CalendarDay, // single day cell
198
+ CalendarEventItem, // default event pill
199
+ CalendarAnimatedIcon, // animated SVG calendar icon
200
+ } from 'calendar-events'
201
+ ```
202
+
203
+ ## Development
204
+
205
+ ```bash
206
+ # clone and install
207
+ git clone <repo-url>
208
+ cd calendar-events
209
+ npm install
210
+
211
+ # start dev server with live demo
212
+ npm run dev
213
+
214
+ # production build (JS + types + CSS)
215
+ npm run build
216
+ ```
217
+
218
+ ## License
219
+
220
+ MIT
@@ -0,0 +1,48 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),S=require("react");function be(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const me=be(S);/**
2
+ * @license lucide-react v0.468.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const fe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),re=(...e)=>e.filter((t,r,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===r).join(" ").trim();/**
7
+ * @license lucide-react v0.468.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */var he={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
12
+ * @license lucide-react v0.468.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const xe=S.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:l="",children:s,iconNode:n,...a},u)=>S.createElement("svg",{ref:u,...he,width:t,height:t,stroke:e,strokeWidth:o?Number(r)*24/Number(t):r,className:re("lucide",l),...a},[...n.map(([m,f])=>S.createElement(m,f)),...Array.isArray(s)?s:[s]]));/**
17
+ * @license lucide-react v0.468.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const B=(e,t)=>{const r=S.forwardRef(({className:o,...l},s)=>S.createElement(xe,{ref:s,iconNode:t,className:re(`lucide-${fe(e)}`,o),...l}));return r.displayName=`${e}`,r};/**
22
+ * @license lucide-react v0.468.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const ye=B("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
27
+ * @license lucide-react v0.468.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const we=B("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
32
+ * @license lucide-react v0.468.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const ve=B("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);function oe({date:e,onPreviousMonth:t,onNextMonth:r}){return d.jsxs("div",{className:"flex items-end py-1 justify-between",children:[d.jsxs("div",{className:"flex items-center gap-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("button",{onClick:t,className:"rounded-full h-10 w-10 hover:scale-110 hover:bg-accent flex items-center justify-center transition-all","aria-label":"Mes anterior",children:d.jsx(we,{className:"h-7 w-7 text-muted-foreground"})}),d.jsx("button",{onClick:r,className:"rounded-full h-10 w-10 hover:scale-110 hover:bg-accent flex items-center justify-center transition-all","aria-label":"Mes siguiente",children:d.jsx(ve,{className:"h-7 w-7 text-muted-foreground"})})]}),d.jsxs("p",{className:"capitalize font-medium text-xl flex items-center gap-2",children:[d.jsx(ye,{className:"text-primary size-7"}),e.toLocaleDateString("es-CL",{month:"long",year:"numeric"})]})]}),d.jsxs("div",{className:"border rounded-lg flex",children:[d.jsx("button",{onClick:t,className:"px-2 text-lg font-normal border-r rounded-l-lg hover:bg-accent transition-colors",children:"Mes"}),d.jsx("button",{onClick:r,className:"px-2 text-lg font-normal rounded-r-lg hover:bg-accent transition-colors",children:"Agenda"})]})]})}function ne({label:e}){return d.jsx("div",{className:"text-muted-foreground px-3 text-xs lg:text-md xl:text-lg truncate",children:e})}const Ce=["LUNES","MARTES","MIÉRCOLES","JUEVES","VIERNES","SÁBADO","DOMINGO"];function se(){return d.jsx("div",{className:"grid grid-cols-7 bg-primary/20 rounded h-13 text-lg items-center mt-4 mb-1",children:Ce.map(e=>d.jsx(ne,{label:e},e))})}function ae({event:e,onClickEvent:t}){return d.jsx("button",{className:"text-xs p-2 bg-secondary/20 font-normal w-full justify-start line-clamp-2 overflow-ellipsis text-start rounded-lg italic cursor-pointer hover:bg-secondary/50 hover:scale-101 transition-all",onClick:()=>t==null?void 0:t(e),children:e.title})}function L({day:e,events:t,isToday:r,isOutsideMonth:o=!1,onClickEvent:l,renderEvent:s}){return o?d.jsx("div",{className:"text-muted-foreground p-2 hover:bg-accent/50 h-20 lg:h-27 text-xs",children:e.getDate()}):d.jsxs("div",{className:`p-2 rounded border h-20 lg:h-27 flex flex-col hover:bg-accent/50 ${r?"bg-accent/50 border-primary/50":"border-transparent"}`,children:[d.jsx("div",{className:"font-medium text-xs",children:e.getDate()}),d.jsx("div",{className:"mt-1 flex-1 overflow-y-auto space-y-1 p-1",children:t.map(n=>s?d.jsx("div",{children:s(n)},n.id):d.jsx(ae,{event:n,onClickEvent:l},n.id))})]})}const ke=[{cx:7,cy:13.5},{cx:12,cy:13.5},{cx:17,cy:13.5},{cx:7,cy:17.5},{cx:12,cy:17.5},{cx:17,cy:17.5}],je=.28,Me=2.4;function le({size:e=24,color:t="currentColor",strokeWidth:r=2,className:o,style:l,...s}){const n=me.useId().replace(/:/g,"");return d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:t,strokeWidth:r,strokeLinecap:"round",strokeLinejoin:"round",className:o,style:l,"aria-hidden":"true",...s,children:[d.jsx("style",{children:`
37
+ @keyframes ${n}-pulse {
38
+ 0%, 100% { opacity: 0.12; transform: scale(1); }
39
+ 30% { opacity: 1; transform: scale(1.5); }
40
+ 55% { opacity: 0.12; transform: scale(1); }
41
+ }
42
+ .${n}-dot {
43
+ animation: ${n}-pulse ${Me}s ease-in-out infinite;
44
+ transform-box: fill-box;
45
+ transform-origin: center;
46
+ }
47
+ `}),d.jsx("rect",{x:"3",y:"4",width:"18",height:"17",rx:"2"}),d.jsx("path",{d:"M3 10h18"}),d.jsx("path",{d:"M8 2v4M16 2v4"}),ke.map((a,u)=>d.jsx("circle",{cx:a.cx,cy:a.cy,r:1.3,fill:t,stroke:"none",className:`${n}-dot`,style:{animationDelay:`${u*je}s`,opacity:.12}},u))]})}function ie(e){var t,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(r=ie(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function Se(){for(var e,t,r=0,o="",l=arguments.length;r<l;r++)(e=arguments[r])&&(t=ie(e))&&(o&&(o+=" "),o+=t);return o}const U="-",Ne=e=>{const t=ze(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:n=>{const a=n.split(U);return a[0]===""&&a.length!==1&&a.shift(),ce(a,t)||De(n)},getConflictingClassGroupIds:(n,a)=>{const u=r[n]||[];return a&&o[n]?[...u,...o[n]]:u}}},ce=(e,t)=>{var n;if(e.length===0)return t.classGroupId;const r=e[0],o=t.nextPart.get(r),l=o?ce(e.slice(1),o):void 0;if(l)return l;if(t.validators.length===0)return;const s=e.join(U);return(n=t.validators.find(({validator:a})=>a(s)))==null?void 0:n.classGroupId},ee=/^\[(.+)\]$/,De=e=>{if(ee.test(e)){const t=ee.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},ze=e=>{const{theme:t,prefix:r}=e,o={nextPart:new Map,validators:[]};return Ie(Object.entries(e.classGroups),r).forEach(([s,n])=>{V(n,o,s,t)}),o},V=(e,t,r,o)=>{e.forEach(l=>{if(typeof l=="string"){const s=l===""?t:te(t,l);s.classGroupId=r;return}if(typeof l=="function"){if(Ae(l)){V(l(o),t,r,o);return}t.validators.push({validator:l,classGroupId:r});return}Object.entries(l).forEach(([s,n])=>{V(n,te(t,s),r,o)})})},te=(e,t)=>{let r=e;return t.split(U).forEach(o=>{r.nextPart.has(o)||r.nextPart.set(o,{nextPart:new Map,validators:[]}),r=r.nextPart.get(o)}),r},Ae=e=>e.isThemeGetter,Ie=(e,t)=>t?e.map(([r,o])=>{const l=o.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([n,a])=>[t+n,a])):s);return[r,l]}):e,Re=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,o=new Map;const l=(s,n)=>{r.set(s,n),t++,t>e&&(t=0,o=r,r=new Map)};return{get(s){let n=r.get(s);if(n!==void 0)return n;if((n=o.get(s))!==void 0)return l(s,n),n},set(s,n){r.has(s)?r.set(s,n):l(s,n)}}},de="!",Ee=e=>{const{separator:t,experimentalParseClassName:r}=e,o=t.length===1,l=t[0],s=t.length,n=a=>{const u=[];let m=0,f=0,w;for(let i=0;i<a.length;i++){let p=a[i];if(m===0){if(p===l&&(o||a.slice(i,i+s)===t)){u.push(a.slice(f,i)),f=i+s;continue}if(p==="/"){w=i;continue}}p==="["?m++:p==="]"&&m--}const v=u.length===0?a:a.substring(f),M=v.startsWith(de),C=M?v.substring(1):v,h=w&&w>f?w-f:void 0;return{modifiers:u,hasImportantModifier:M,baseClassName:C,maybePostfixModifierPosition:h}};return r?a=>r({className:a,parseClassName:n}):n},Oe=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(o=>{o[0]==="["?(t.push(...r.sort(),o),r=[]):r.push(o)}),t.push(...r.sort()),t},Pe=e=>({cache:Re(e.cacheSize),parseClassName:Ee(e),...Ne(e)}),Te=/\s+/,Ge=(e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:l}=t,s=[],n=e.trim().split(Te);let a="";for(let u=n.length-1;u>=0;u-=1){const m=n[u],{modifiers:f,hasImportantModifier:w,baseClassName:v,maybePostfixModifierPosition:M}=r(m);let C=!!M,h=o(C?v.substring(0,M):v);if(!h){if(!C){a=m+(a.length>0?" "+a:a);continue}if(h=o(v),!h){a=m+(a.length>0?" "+a:a);continue}C=!1}const i=Oe(f).join(":"),p=w?i+de:i,x=p+h;if(s.includes(x))continue;s.push(x);const k=l(h,C);for(let y=0;y<k.length;++y){const j=k[y];s.push(p+j)}a=m+(a.length>0?" "+a:a)}return a};function Le(){let e=0,t,r,o="";for(;e<arguments.length;)(t=arguments[e++])&&(r=ue(t))&&(o&&(o+=" "),o+=r);return o}const ue=e=>{if(typeof e=="string")return e;let t,r="";for(let o=0;o<e.length;o++)e[o]&&(t=ue(e[o]))&&(r&&(r+=" "),r+=t);return r};function $e(e,...t){let r,o,l,s=n;function n(u){const m=t.reduce((f,w)=>w(f),e());return r=Pe(m),o=r.cache.get,l=r.cache.set,s=a,a(u)}function a(u){const m=o(u);if(m)return m;const f=Ge(u,r);return l(u,f),f}return function(){return s(Le.apply(null,arguments))}}const g=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},pe=/^\[(?:([a-z-]+):)?(.+)\]$/i,Fe=/^\d+\/\d+$/,We=new Set(["px","full","screen"]),_e=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ye=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Ve=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Be=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ue=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,D=e=>I(e)||We.has(e)||Fe.test(e),z=e=>R(e,"length",et),I=e=>!!e&&!Number.isNaN(Number(e)),Y=e=>R(e,"number",I),O=e=>!!e&&Number.isInteger(Number(e)),qe=e=>e.endsWith("%")&&I(e.slice(0,-1)),c=e=>pe.test(e),A=e=>_e.test(e),He=new Set(["length","size","percentage"]),Je=e=>R(e,He,ge),Ke=e=>R(e,"position",ge),Xe=new Set(["image","url"]),Ze=e=>R(e,Xe,rt),Qe=e=>R(e,"",tt),P=()=>!0,R=(e,t,r)=>{const o=pe.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):r(o[2]):!1},et=e=>Ye.test(e)&&!Ve.test(e),ge=()=>!1,tt=e=>Be.test(e),rt=e=>Ue.test(e),ot=()=>{const e=g("colors"),t=g("spacing"),r=g("blur"),o=g("brightness"),l=g("borderColor"),s=g("borderRadius"),n=g("borderSpacing"),a=g("borderWidth"),u=g("contrast"),m=g("grayscale"),f=g("hueRotate"),w=g("invert"),v=g("gap"),M=g("gradientColorStops"),C=g("gradientColorStopPositions"),h=g("inset"),i=g("margin"),p=g("opacity"),x=g("padding"),k=g("saturate"),y=g("scale"),j=g("sepia"),q=g("skew"),H=g("space"),J=g("translate"),$=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],W=()=>["auto",c,t],b=()=>[c,t],K=()=>["",D,z],T=()=>["auto",I,c],X=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],G=()=>["solid","dashed","dotted","double","none"],Z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],_=()=>["start","end","center","between","around","evenly","stretch"],E=()=>["","0",c],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>[I,c];return{cacheSize:500,separator:":",theme:{colors:[P],spacing:[D,z],blur:["none","",A,c],brightness:N(),borderColor:[e],borderRadius:["none","","full",A,c],borderSpacing:b(),borderWidth:K(),contrast:N(),grayscale:E(),hueRotate:N(),invert:E(),gap:b(),gradientColorStops:[e],gradientColorStopPositions:[qe,z],inset:W(),margin:W(),opacity:N(),padding:b(),saturate:N(),scale:N(),sepia:E(),skew:N(),space:b(),translate:b()},classGroups:{aspect:[{aspect:["auto","square","video",c]}],container:["container"],columns:[{columns:[A]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...X(),c]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",O,c]}],basis:[{basis:W()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",c]}],grow:[{grow:E()}],shrink:[{shrink:E()}],order:[{order:["first","last","none",O,c]}],"grid-cols":[{"grid-cols":[P]}],"col-start-end":[{col:["auto",{span:["full",O,c]},c]}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":[P]}],"row-start-end":[{row:["auto",{span:[O,c]},c]}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",c]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",c]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",..._()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",..._(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[..._(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[i]}],mx:[{mx:[i]}],my:[{my:[i]}],ms:[{ms:[i]}],me:[{me:[i]}],mt:[{mt:[i]}],mr:[{mr:[i]}],mb:[{mb:[i]}],ml:[{ml:[i]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",c,t]}],"min-w":[{"min-w":[c,t,"min","max","fit"]}],"max-w":[{"max-w":[c,t,"none","full","min","max","fit","prose",{screen:[A]},A]}],h:[{h:[c,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[c,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[c,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[c,t,"auto","min","max","fit"]}],"font-size":[{text:["base",A,z]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Y]}],"font-family":[{font:[P]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",c]}],"line-clamp":[{"line-clamp":["none",I,Y]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",D,c]}],"list-image":[{"list-image":["none",c]}],"list-style-type":[{list:["none","disc","decimal",c]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[p]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[p]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",D,z]}],"underline-offset":[{"underline-offset":["auto",D,c]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:b()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",c]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",c]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[p]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...X(),Ke]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Je]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Ze]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[M]}],"gradient-via":[{via:[M]}],"gradient-to":[{to:[M]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[p]}],"border-style":[{border:[...G(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[p]}],"divide-style":[{divide:G()}],"border-color":[{border:[l]}],"border-color-x":[{"border-x":[l]}],"border-color-y":[{"border-y":[l]}],"border-color-s":[{"border-s":[l]}],"border-color-e":[{"border-e":[l]}],"border-color-t":[{"border-t":[l]}],"border-color-r":[{"border-r":[l]}],"border-color-b":[{"border-b":[l]}],"border-color-l":[{"border-l":[l]}],"divide-color":[{divide:[l]}],"outline-style":[{outline:["",...G()]}],"outline-offset":[{"outline-offset":[D,c]}],"outline-w":[{outline:[D,z]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[p]}],"ring-offset-w":[{"ring-offset":[D,z]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",A,Qe]}],"shadow-color":[{shadow:[P]}],opacity:[{opacity:[p]}],"mix-blend":[{"mix-blend":[...Z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Z()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[o]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",A,c]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[w]}],saturate:[{saturate:[k]}],sepia:[{sepia:[j]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[p]}],"backdrop-saturate":[{"backdrop-saturate":[k]}],"backdrop-sepia":[{"backdrop-sepia":[j]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[n]}],"border-spacing-x":[{"border-spacing-x":[n]}],"border-spacing-y":[{"border-spacing-y":[n]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",c]}],duration:[{duration:N()}],ease:[{ease:["linear","in","out","in-out",c]}],delay:[{delay:N()}],animate:[{animate:["none","spin","ping","pulse","bounce",c]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[y]}],"scale-x":[{"scale-x":[y]}],"scale-y":[{"scale-y":[y]}],rotate:[{rotate:[O,c]}],"translate-x":[{"translate-x":[J]}],"translate-y":[{"translate-y":[J]}],"skew-x":[{"skew-x":[q]}],"skew-y":[{"skew-y":[q]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",c]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",c]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":b()}],"scroll-mx":[{"scroll-mx":b()}],"scroll-my":[{"scroll-my":b()}],"scroll-ms":[{"scroll-ms":b()}],"scroll-me":[{"scroll-me":b()}],"scroll-mt":[{"scroll-mt":b()}],"scroll-mr":[{"scroll-mr":b()}],"scroll-mb":[{"scroll-mb":b()}],"scroll-ml":[{"scroll-ml":b()}],"scroll-p":[{"scroll-p":b()}],"scroll-px":[{"scroll-px":b()}],"scroll-py":[{"scroll-py":b()}],"scroll-ps":[{"scroll-ps":b()}],"scroll-pe":[{"scroll-pe":b()}],"scroll-pt":[{"scroll-pt":b()}],"scroll-pr":[{"scroll-pr":b()}],"scroll-pb":[{"scroll-pb":b()}],"scroll-pl":[{"scroll-pl":b()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",c]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[D,z,Y]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},nt=$e(ot);function st(...e){return nt(Se(e))}const at=new Map([["lunes",0],["martes",1],["miércoles",2],["miercoles",2],["jueves",3],["viernes",4],["sábado",5],["sabado",5],["domingo",6]]),lt=[{id:1,title:"Reunión de equipo",date:new Date(new Date().getFullYear(),new Date().getMonth(),5),description:"Reunión semanal del equipo"},{id:2,title:"Entrega proyecto",date:new Date(new Date().getFullYear(),new Date().getMonth(),10),description:"Fecha límite de entrega"},{id:3,title:"Capacitación",date:new Date(new Date().getFullYear(),new Date().getMonth(),15),description:"Capacitación en nuevas tecnologías"},{id:4,title:"Revisión código",date:new Date(new Date().getFullYear(),new Date().getMonth(),20),description:"Code review del sprint"},{id:5,title:"Demo cliente",date:new Date(new Date().getFullYear(),new Date().getMonth(),25),description:"Presentación al cliente"}];function it({initialDate:e=new Date,events:t=lt,className:r,loading:o=!1,onClickEvent:l,renderEvent:s}){const[n,a]=S.useState(e),u=S.useMemo(()=>{const i=n.getFullYear(),p=n.getMonth(),x=new Date(i,p+1,0).getDate(),k=[];for(let y=1;y<=x;y++)k.push(new Date(i,p,y));return k},[n]),m=()=>{const i=u[0].toLocaleDateString("es-CL",{weekday:"long"});return at.get(i)??0},f=S.useMemo(()=>{const i=m();if(i===0)return[];const p=n.getFullYear(),x=n.getMonth(),k=new Date(p,x,0).getDate(),y=[];for(let j=i-1;j>=0;j--)y.push(new Date(p,x-1,k-j));return y},[n,u]),w=S.useMemo(()=>{const p=42-m()-u.length;if(p<=0)return[];const x=n.getFullYear(),k=n.getMonth(),y=[];for(let j=1;j<=p;j++)y.push(new Date(x,k+1,j));return y},[n,u]),v=()=>{a(new Date(n.getFullYear(),n.getMonth()-1,1))},M=()=>{a(new Date(n.getFullYear(),n.getMonth()+1,1))},C=i=>i.toDateString()===new Date().toDateString(),h=i=>t.filter(p=>i.toDateString()===p.date.toDateString());return d.jsxs("div",{className:st("p-2 border rounded-lg w-full",r),children:[d.jsx(oe,{date:n,onPreviousMonth:v,onNextMonth:M}),d.jsx(se,{}),d.jsxs("div",{className:"relative",children:[o&&d.jsxs("div",{className:"absolute inset-0 z-10 flex items-center justify-center rounded-lg bg-background/90 flex-col gap-2",children:[d.jsx(le,{size:90,className:"text-primary"}),d.jsx("p",{className:"text-lg italic text-muted-foreground",children:"Cargando Eventos del Calendario..."})]}),d.jsxs("div",{className:"grid grid-cols-7 gap-1",children:[f.map(i=>d.jsx(L,{day:i,events:[],isToday:!1,isOutsideMonth:!0},i.toISOString())),u.map(i=>d.jsx(L,{day:i,events:h(i),isToday:C(i),onClickEvent:l,renderEvent:s},i.toISOString())),w.map(i=>d.jsx(L,{day:i,events:[],isToday:!1,isOutsideMonth:!0},i.toISOString()))]})]})]})}exports.CalendarAnimatedIcon=le;exports.CalendarDay=L;exports.CalendarEventItem=ae;exports.CalendarEvents=it;exports.CalendarHeader=oe;exports.CalendarWeekHeader=se;exports.CalendarWeekHeaderItem=ne;
48
+ //# sourceMappingURL=calendar-events.cjs.map