@ladder-ui/full-calendar 0.10.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/LICENSE +21 -0
- package/dist/_all-day.css +1 -0
- package/dist/_day.css +1 -0
- package/dist/_month.css +1 -0
- package/dist/_schedule.css +1 -0
- package/dist/_week.css +1 -0
- package/dist/_year.css +1 -0
- package/dist/context.d.ts +20 -0
- package/dist/events.d.ts +29 -0
- package/dist/full-calendar.css +1 -0
- package/dist/full-calendar.d.ts +42 -0
- package/dist/full-calendar.vars.css +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/dist/types.d.ts +12 -0
- package/dist/utils/date.d.ts +29 -0
- package/dist/utils/events.d.ts +27 -0
- package/dist/utils/format.d.ts +16 -0
- package/dist/views/day-view.d.ts +4 -0
- package/dist/views/month-view.d.ts +4 -0
- package/dist/views/schedule-view.d.ts +4 -0
- package/dist/views/time-grid.d.ts +8 -0
- package/dist/views/week-view.d.ts +4 -0
- package/dist/views/year-view.d.ts +4 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Ivan Avila
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer components{.lui-fcal__all-day{align-items:stretch;border-bottom:1px solid var(--lui-fcal-border);display:flex;flex-shrink:0;min-height:2rem}.lui-fcal__all-day-gutter{align-items:center;border-inline-end:1px solid var(--lui-fcal-border);color:var(--lui-text-secondary);display:flex;flex-shrink:0;font-size:.625rem;font-weight:500;justify-content:flex-end;padding-inline-end:.5rem;width:var(--lui-fcal-time-col-width)}.lui-fcal__all-day-cells{display:grid;flex:1;min-width:0}.lui-fcal__all-day-cell{border-inline-end:1px solid var(--lui-fcal-border);display:flex;flex-direction:column;gap:.125rem;padding:.25rem .125rem}.lui-fcal__all-day-event{background-color:var(--lui-fcal-event-default-bg);border-inline-start:2px solid var(--lui-fcal-event-default-border);border-radius:var(--lui-fcal-event-radius);color:var(--lui-fcal-event-default-text);cursor:pointer;display:block;font-size:.6875rem;font-weight:500;overflow:hidden;padding:.125rem .375rem;text-overflow:ellipsis;transition:filter var(--lui-transition);white-space:nowrap}.lui-fcal__all-day-event:hover{filter:brightness(.94)}.lui-fcal__all-day-event:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal__all-day-event--success{background-color:var(--lui-fcal-event-success-bg);border-color:var(--lui-fcal-event-success-border);color:var(--lui-fcal-event-success-text)}.lui-fcal__all-day-event--warning{background-color:var(--lui-fcal-event-warning-bg);border-color:var(--lui-fcal-event-warning-border);color:var(--lui-fcal-event-warning-text)}.lui-fcal__all-day-event--error{background-color:var(--lui-fcal-event-error-bg);border-color:var(--lui-fcal-event-error-border);color:var(--lui-fcal-event-error-text)}.lui-fcal__all-day-event--info{background-color:var(--lui-fcal-event-info-bg);border-color:var(--lui-fcal-event-info-border);color:var(--lui-fcal-event-info-text)}.lui-fcal__all-day-event--purple{background-color:var(--lui-fcal-event-purple-bg);border-color:var(--lui-fcal-event-purple-border);color:var(--lui-fcal-event-purple-text)}.lui-fcal__all-day-event--rose{background-color:var(--lui-fcal-event-rose-bg);border-color:var(--lui-fcal-event-rose-border);color:var(--lui-fcal-event-rose-text)}}
|
package/dist/_day.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer components{.lui-fcal-day{display:flex;flex:1;flex-direction:column;min-height:0}.lui-fcal-day__header{border-bottom:1px solid var(--lui-fcal-border);display:grid;flex-shrink:0;grid-template-columns:var(--lui-fcal-time-col-width) 1fr}.lui-fcal-day__grid{display:grid;flex:1;grid-template-columns:1fr;min-width:0;position:relative}.lui-fcal-day__column{position:relative}.lui-fcal-day__column--today{background-color:var(--lui-fcal-today-col-bg)}}
|
package/dist/_month.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer components{.lui-fcal-month{display:flex;flex:1;flex-direction:column;min-height:0;overflow-y:auto}.lui-fcal-month__weekday-header{border-bottom:1px solid var(--lui-fcal-border);display:grid;flex-shrink:0;grid-template-columns:repeat(7,1fr)}.lui-fcal-month__weekday-cell{color:var(--lui-text-secondary);font-size:.6875rem;font-weight:600;letter-spacing:.08em;padding:.5rem;text-align:center;text-transform:uppercase}.lui-fcal-month__grid{display:grid;flex:1;grid-template-columns:repeat(7,1fr)}.lui-fcal-month__cell{border-bottom:1px solid var(--lui-fcal-slot-border);border-inline-end:1px solid var(--lui-fcal-slot-border);cursor:pointer;min-height:var(--lui-fcal-month-cell-min-h);padding:.25rem;transition:background-color var(--lui-transition)}.lui-fcal-month__cell:hover{background-color:var(--lui-fcal-slot-hover-bg)}.lui-fcal-month__cell--outside{opacity:var(--lui-fcal-month-outside-opacity)}.lui-fcal-month__cell--today{background-color:var(--lui-fcal-today-col-bg)}.lui-fcal-month__day-number{align-items:center;background:transparent;border:none;border-radius:50%;color:var(--lui-text-primary);cursor:pointer;display:inline-flex;font-family:var(--lui-fcal-font);font-size:.75rem;font-weight:500;height:1.625rem;justify-content:center;line-height:1;padding:0;transition:background-color var(--lui-transition);width:1.625rem}.lui-fcal-month__day-number:hover{background-color:var(--lui-fcal-slot-hover-bg)}.lui-fcal-month__day-number:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal-month__day-number--today{background-color:var(--lui-fcal-today-dot-bg);color:var(--lui-fcal-today-dot-text);font-weight:700}.lui-fcal-month__events{display:flex;flex-direction:column;gap:.0625rem;margin-top:.125rem}.lui-fcal-month__event-chip{align-items:center;background-color:var(--lui-fcal-event-default-bg);border-radius:var(--lui-fcal-event-radius);color:var(--lui-fcal-event-default-text);cursor:pointer;display:flex;font-size:.6875rem;font-weight:500;gap:.25rem;overflow:hidden;padding:.0625rem .25rem;text-overflow:ellipsis;transition:filter var(--lui-transition);white-space:nowrap}.lui-fcal-month__event-chip:hover{filter:brightness(.94)}.lui-fcal-month__event-chip:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal-month__event-chip--success{background-color:var(--lui-fcal-event-success-bg);color:var(--lui-fcal-event-success-text)}.lui-fcal-month__event-chip--warning{background-color:var(--lui-fcal-event-warning-bg);color:var(--lui-fcal-event-warning-text)}.lui-fcal-month__event-chip--error{background-color:var(--lui-fcal-event-error-bg);color:var(--lui-fcal-event-error-text)}.lui-fcal-month__event-chip--info{background-color:var(--lui-fcal-event-info-bg);color:var(--lui-fcal-event-info-text)}.lui-fcal-month__event-chip--purple{background-color:var(--lui-fcal-event-purple-bg);color:var(--lui-fcal-event-purple-text)}.lui-fcal-month__event-chip--rose{background-color:var(--lui-fcal-event-rose-bg);color:var(--lui-fcal-event-rose-text)}.lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-default-border);border-radius:50%;flex-shrink:0;height:6px;width:6px}.lui-fcal-month__event-chip--success .lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-success-border)}.lui-fcal-month__event-chip--warning .lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-warning-border)}.lui-fcal-month__event-chip--error .lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-error-border)}.lui-fcal-month__event-chip--info .lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-info-border)}.lui-fcal-month__event-chip--purple .lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-purple-border)}.lui-fcal-month__event-chip--rose .lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-rose-border)}.lui-fcal-month__more{background:transparent;border:none;color:var(--lui-text-secondary);cursor:pointer;font-family:var(--lui-fcal-font);font-size:.625rem;font-weight:500;padding:.0625rem .25rem}.lui-fcal-month__more:hover{color:var(--lui-text-primary)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer components{.lui-fcal-schedule{display:flex;flex:1;flex-direction:column;overflow-y:auto}.lui-fcal-schedule__empty{align-items:center;color:var(--lui-text-secondary);display:flex;font-size:.875rem;justify-content:center;padding:3rem 1rem}.lui-fcal-schedule__day-group{border-bottom:1px solid var(--lui-fcal-slot-border)}.lui-fcal-schedule__day-header{align-items:baseline;background-color:var(--lui-fcal-bg);display:flex;gap:.5rem;padding:var(--lui-fcal-schedule-row-padding);position:sticky;top:0;z-index:var(--lui-z-base)}.lui-fcal-schedule__day-number{color:var(--lui-text-primary);font-size:1.5rem;font-weight:300;line-height:1}.lui-fcal-schedule__day-number--today{align-items:center;background-color:var(--lui-fcal-today-dot-bg);border-radius:50%;color:var(--lui-fcal-today-dot-text);display:inline-flex;font-size:1rem;font-weight:700;height:2.25rem;justify-content:center;width:2.25rem}.lui-fcal-schedule__day-label{color:var(--lui-text-secondary);font-size:.6875rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase}.lui-fcal-schedule__event-row{align-items:center;cursor:pointer;display:flex;gap:.75rem;padding:var(--lui-fcal-schedule-row-padding);padding-inline-start:4rem;transition:background-color var(--lui-transition)}.lui-fcal-schedule__event-row:hover{background-color:var(--lui-fcal-slot-hover-bg)}.lui-fcal-schedule__event-row:focus-visible{box-shadow:inset 0 0 0 2px var(--lui-bg-interactive);outline:none}.lui-fcal-schedule__event-dot{background-color:var(--lui-fcal-event-default-border);border-radius:50%;flex-shrink:0;height:8px;width:8px}.lui-fcal-schedule__event-dot--success{background-color:var(--lui-fcal-event-success-border)}.lui-fcal-schedule__event-dot--warning{background-color:var(--lui-fcal-event-warning-border)}.lui-fcal-schedule__event-dot--error{background-color:var(--lui-fcal-event-error-border)}.lui-fcal-schedule__event-dot--info{background-color:var(--lui-fcal-event-info-border)}.lui-fcal-schedule__event-dot--purple{background-color:var(--lui-fcal-event-purple-border)}.lui-fcal-schedule__event-dot--rose{background-color:var(--lui-fcal-event-rose-border)}.lui-fcal-schedule__event-time{color:var(--lui-text-secondary);flex-shrink:0;font-size:.75rem;font-weight:500;min-width:5.5rem}.lui-fcal-schedule__event-title{color:var(--lui-text-primary);flex:1;font-size:.8125rem;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lui-fcal-schedule__event-location{color:var(--lui-text-secondary);flex-shrink:0;font-size:.75rem;max-width:12rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lui-fcal-schedule__now-indicator{align-items:center;display:flex;gap:.5rem;padding:.25rem 1rem}.lui-fcal-schedule__now-line{background-color:var(--lui-fcal-now-color);flex:1;height:1px}.lui-fcal-schedule__now-label{color:var(--lui-fcal-now-color);font-size:.625rem;font-weight:600;text-transform:uppercase}}
|
package/dist/_week.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer components{.lui-fcal-week{display:flex;flex:1;flex-direction:column;min-height:0}.lui-fcal-week__header{grid-template-columns:var(--lui-fcal-time-col-width) repeat(7,1fr)}.lui-fcal-week__header--no-weekends{grid-template-columns:var(--lui-fcal-time-col-width) repeat(5,1fr)}.lui-fcal-week__grid{display:grid;flex:1;grid-template-columns:repeat(7,1fr);min-width:0;position:relative}.lui-fcal-week__grid--no-weekends{grid-template-columns:repeat(5,1fr)}.lui-fcal-week__column{border-inline-end:1px solid var(--lui-fcal-border);position:relative}.lui-fcal-week__column--today{background-color:var(--lui-fcal-today-col-bg)}}
|
package/dist/_year.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer components{.lui-fcal-year{display:flex;flex:1;flex-direction:column;overflow-y:auto;padding:1rem}.lui-fcal-year__grid{display:grid;gap:1.5rem;grid-template-columns:repeat(4,1fr)}.lui-fcal-year__mini-month{display:flex;flex-direction:column}.lui-fcal-year__month-title{background:transparent;border:none;color:var(--lui-text-primary);cursor:pointer;font-family:var(--lui-fcal-font);font-size:.8125rem;font-weight:600;padding:.25rem 0;text-align:start}.lui-fcal-year__month-title:hover{color:var(--lui-bg-interactive)}.lui-fcal-year__month-title:focus-visible{border-radius:var(--lui-radius-sm);box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal-year__weekday-row{display:grid;grid-template-columns:repeat(7,1fr);margin-bottom:.125rem}.lui-fcal-year__weekday-label{color:var(--lui-text-secondary);font-size:.5625rem;font-weight:500;padding:.125rem 0;text-align:center}.lui-fcal-year__days-grid{display:grid;grid-template-columns:repeat(7,1fr)}.lui-fcal-year__day{align-items:center;background:transparent;border:none;color:var(--lui-text-primary);cursor:pointer;display:flex;flex-direction:column;font-family:var(--lui-fcal-font);font-size:.6875rem;justify-content:center;line-height:1.6;padding:.125rem 0;position:relative}.lui-fcal-year__day:hover{background-color:var(--lui-fcal-slot-hover-bg);border-radius:var(--lui-radius-sm)}.lui-fcal-year__day--outside{opacity:var(--lui-fcal-month-outside-opacity)}.lui-fcal-year__day--today{background-color:var(--lui-fcal-today-dot-bg);border-radius:50%;color:var(--lui-fcal-today-dot-text);font-weight:700;height:1.375rem;margin:0 auto;width:1.375rem}.lui-fcal-year__day:focus-visible{border-radius:var(--lui-radius-sm);box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal-year__event-dot{background-color:var(--lui-bg-interactive);border-radius:50%;height:var(--lui-fcal-year-dot-size);margin-top:1px;width:var(--lui-fcal-year-dot-size)}}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CalEvent, CalendarView } from "./types";
|
|
2
|
+
export interface CalendarContextValue {
|
|
3
|
+
view: CalendarView;
|
|
4
|
+
anchorDate: Date;
|
|
5
|
+
today: Date;
|
|
6
|
+
events: CalEvent[];
|
|
7
|
+
navigate: (date: Date) => void;
|
|
8
|
+
setView: (view: CalendarView) => void;
|
|
9
|
+
locale: string;
|
|
10
|
+
timezone: string;
|
|
11
|
+
weekStartsOn: 0 | 1;
|
|
12
|
+
startHour: number;
|
|
13
|
+
endHour: number;
|
|
14
|
+
slotDuration: 15 | 30 | 60;
|
|
15
|
+
showWeekends: boolean;
|
|
16
|
+
views: CalendarView[];
|
|
17
|
+
onEventClick?: (event: CalEvent, element: HTMLElement) => void;
|
|
18
|
+
onSlotClick?: (date: Date, view: CalendarView) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare const CalendarContext: import("react").Context<CalendarContextValue | null>;
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ComponentManifest } from "@ladder-ui/core/eventBus";
|
|
2
|
+
import type { CalEvent, CalendarView } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Events emitted by FullCalendar.
|
|
5
|
+
* Extend LadderEventMap via module augmentation below.
|
|
6
|
+
*/
|
|
7
|
+
export interface FullCalendarEvents {
|
|
8
|
+
"calendar:view-change": {
|
|
9
|
+
view: CalendarView;
|
|
10
|
+
previous: CalendarView;
|
|
11
|
+
};
|
|
12
|
+
"calendar:navigate": {
|
|
13
|
+
date: Date;
|
|
14
|
+
view: CalendarView;
|
|
15
|
+
};
|
|
16
|
+
"calendar:event-click": {
|
|
17
|
+
event: CalEvent;
|
|
18
|
+
element: HTMLElement;
|
|
19
|
+
};
|
|
20
|
+
"calendar:slot-click": {
|
|
21
|
+
date: Date;
|
|
22
|
+
view: CalendarView;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
declare module "@ladder-ui/core/eventBus" {
|
|
26
|
+
interface LadderEventMap extends FullCalendarEvents {
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export declare const fullCalendarManifest: ComponentManifest;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer components{.lui-fcal__all-day{align-items:stretch;border-bottom:1px solid var(--lui-fcal-border);display:flex;flex-shrink:0;min-height:2rem}.lui-fcal__all-day-gutter{align-items:center;border-inline-end:1px solid var(--lui-fcal-border);color:var(--lui-text-secondary);display:flex;flex-shrink:0;font-size:.625rem;font-weight:500;justify-content:flex-end;padding-inline-end:.5rem;width:var(--lui-fcal-time-col-width)}.lui-fcal__all-day-cells{display:grid;flex:1;min-width:0}.lui-fcal__all-day-cell{border-inline-end:1px solid var(--lui-fcal-border);display:flex;flex-direction:column;gap:.125rem;padding:.25rem .125rem}.lui-fcal__all-day-event{background-color:var(--lui-fcal-event-default-bg);border-inline-start:2px solid var(--lui-fcal-event-default-border);border-radius:var(--lui-fcal-event-radius);color:var(--lui-fcal-event-default-text);cursor:pointer;display:block;font-size:.6875rem;font-weight:500;overflow:hidden;padding:.125rem .375rem;text-overflow:ellipsis;transition:filter var(--lui-transition);white-space:nowrap}.lui-fcal__all-day-event:hover{filter:brightness(.94)}.lui-fcal__all-day-event:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal__all-day-event--success{background-color:var(--lui-fcal-event-success-bg);border-color:var(--lui-fcal-event-success-border);color:var(--lui-fcal-event-success-text)}.lui-fcal__all-day-event--warning{background-color:var(--lui-fcal-event-warning-bg);border-color:var(--lui-fcal-event-warning-border);color:var(--lui-fcal-event-warning-text)}.lui-fcal__all-day-event--error{background-color:var(--lui-fcal-event-error-bg);border-color:var(--lui-fcal-event-error-border);color:var(--lui-fcal-event-error-text)}.lui-fcal__all-day-event--info{background-color:var(--lui-fcal-event-info-bg);border-color:var(--lui-fcal-event-info-border);color:var(--lui-fcal-event-info-text)}.lui-fcal__all-day-event--purple{background-color:var(--lui-fcal-event-purple-bg);border-color:var(--lui-fcal-event-purple-border);color:var(--lui-fcal-event-purple-text)}.lui-fcal__all-day-event--rose{background-color:var(--lui-fcal-event-rose-bg);border-color:var(--lui-fcal-event-rose-border);color:var(--lui-fcal-event-rose-text)}.lui-fcal-day{display:flex;flex:1;flex-direction:column;min-height:0}.lui-fcal-day__header{border-bottom:1px solid var(--lui-fcal-border);display:grid;flex-shrink:0;grid-template-columns:var(--lui-fcal-time-col-width) 1fr}.lui-fcal-day__grid{display:grid;flex:1;grid-template-columns:1fr;min-width:0;position:relative}.lui-fcal-day__column{position:relative}.lui-fcal-day__column--today{background-color:var(--lui-fcal-today-col-bg)}.lui-fcal-week{display:flex;flex:1;flex-direction:column;min-height:0}.lui-fcal-week__header{grid-template-columns:var(--lui-fcal-time-col-width) repeat(7,1fr)}.lui-fcal-week__header--no-weekends{grid-template-columns:var(--lui-fcal-time-col-width) repeat(5,1fr)}.lui-fcal-week__grid{display:grid;flex:1;grid-template-columns:repeat(7,1fr);min-width:0;position:relative}.lui-fcal-week__grid--no-weekends{grid-template-columns:repeat(5,1fr)}.lui-fcal-week__column{border-inline-end:1px solid var(--lui-fcal-border);position:relative}.lui-fcal-week__column--today{background-color:var(--lui-fcal-today-col-bg)}.lui-fcal-month{display:flex;flex:1;flex-direction:column;min-height:0;overflow-y:auto}.lui-fcal-month__weekday-header{border-bottom:1px solid var(--lui-fcal-border);display:grid;flex-shrink:0;grid-template-columns:repeat(7,1fr)}.lui-fcal-month__weekday-cell{color:var(--lui-text-secondary);font-size:.6875rem;font-weight:600;letter-spacing:.08em;padding:.5rem;text-align:center;text-transform:uppercase}.lui-fcal-month__grid{display:grid;flex:1;grid-template-columns:repeat(7,1fr)}.lui-fcal-month__cell{border-bottom:1px solid var(--lui-fcal-slot-border);border-inline-end:1px solid var(--lui-fcal-slot-border);cursor:pointer;min-height:var(--lui-fcal-month-cell-min-h);padding:.25rem;transition:background-color var(--lui-transition)}.lui-fcal-month__cell:hover{background-color:var(--lui-fcal-slot-hover-bg)}.lui-fcal-month__cell--outside{opacity:var(--lui-fcal-month-outside-opacity)}.lui-fcal-month__cell--today{background-color:var(--lui-fcal-today-col-bg)}.lui-fcal-month__day-number{align-items:center;background:transparent;border:none;border-radius:50%;color:var(--lui-text-primary);cursor:pointer;display:inline-flex;font-family:var(--lui-fcal-font);font-size:.75rem;font-weight:500;height:1.625rem;justify-content:center;line-height:1;padding:0;transition:background-color var(--lui-transition);width:1.625rem}.lui-fcal-month__day-number:hover{background-color:var(--lui-fcal-slot-hover-bg)}}@layer components{.lui-fcal-month__day-number:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal-month__day-number--today{background-color:var(--lui-fcal-today-dot-bg);color:var(--lui-fcal-today-dot-text);font-weight:700}.lui-fcal-month__events{display:flex;flex-direction:column;gap:.0625rem;margin-top:.125rem}.lui-fcal-month__event-chip{align-items:center;background-color:var(--lui-fcal-event-default-bg);border-radius:var(--lui-fcal-event-radius);color:var(--lui-fcal-event-default-text);cursor:pointer;display:flex;font-size:.6875rem;font-weight:500;gap:.25rem;overflow:hidden;padding:.0625rem .25rem;text-overflow:ellipsis;transition:filter var(--lui-transition);white-space:nowrap}.lui-fcal-month__event-chip:hover{filter:brightness(.94)}.lui-fcal-month__event-chip:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal-month__event-chip--success{background-color:var(--lui-fcal-event-success-bg);color:var(--lui-fcal-event-success-text)}.lui-fcal-month__event-chip--warning{background-color:var(--lui-fcal-event-warning-bg);color:var(--lui-fcal-event-warning-text)}.lui-fcal-month__event-chip--error{background-color:var(--lui-fcal-event-error-bg);color:var(--lui-fcal-event-error-text)}.lui-fcal-month__event-chip--info{background-color:var(--lui-fcal-event-info-bg);color:var(--lui-fcal-event-info-text)}.lui-fcal-month__event-chip--purple{background-color:var(--lui-fcal-event-purple-bg);color:var(--lui-fcal-event-purple-text)}.lui-fcal-month__event-chip--rose{background-color:var(--lui-fcal-event-rose-bg);color:var(--lui-fcal-event-rose-text)}.lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-default-border);border-radius:50%;flex-shrink:0;height:6px;width:6px}.lui-fcal-month__event-chip--success .lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-success-border)}.lui-fcal-month__event-chip--warning .lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-warning-border)}.lui-fcal-month__event-chip--error .lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-error-border)}.lui-fcal-month__event-chip--info .lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-info-border)}.lui-fcal-month__event-chip--purple .lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-purple-border)}.lui-fcal-month__event-chip--rose .lui-fcal-month__event-dot{background-color:var(--lui-fcal-event-rose-border)}.lui-fcal-month__more{background:transparent;border:none;color:var(--lui-text-secondary);cursor:pointer;font-family:var(--lui-fcal-font);font-size:.625rem;font-weight:500;padding:.0625rem .25rem}.lui-fcal-month__more:hover{color:var(--lui-text-primary)}.lui-fcal-year{display:flex;flex:1;flex-direction:column;overflow-y:auto;padding:1rem}.lui-fcal-year__grid{display:grid;gap:1.5rem;grid-template-columns:repeat(4,1fr)}.lui-fcal-year__mini-month{display:flex;flex-direction:column}.lui-fcal-year__month-title{background:transparent;border:none;color:var(--lui-text-primary);cursor:pointer;font-family:var(--lui-fcal-font);font-size:.8125rem;font-weight:600;padding:.25rem 0;text-align:start}.lui-fcal-year__month-title:hover{color:var(--lui-bg-interactive)}}@layer components{.lui-fcal-year__month-title:focus-visible{border-radius:var(--lui-radius-sm);box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal-year__weekday-row{display:grid;grid-template-columns:repeat(7,1fr);margin-bottom:.125rem}.lui-fcal-year__weekday-label{color:var(--lui-text-secondary);font-size:.5625rem;font-weight:500;padding:.125rem 0;text-align:center}.lui-fcal-year__days-grid{display:grid;grid-template-columns:repeat(7,1fr)}.lui-fcal-year__day{align-items:center;background:transparent;border:none;color:var(--lui-text-primary);cursor:pointer;display:flex;flex-direction:column;font-family:var(--lui-fcal-font);font-size:.6875rem;justify-content:center;line-height:1.6;padding:.125rem 0;position:relative}.lui-fcal-year__day:hover{background-color:var(--lui-fcal-slot-hover-bg);border-radius:var(--lui-radius-sm)}.lui-fcal-year__day--outside{opacity:var(--lui-fcal-month-outside-opacity)}.lui-fcal-year__day--today{background-color:var(--lui-fcal-today-dot-bg);border-radius:50%;color:var(--lui-fcal-today-dot-text);font-weight:700;height:1.375rem;margin:0 auto;width:1.375rem}.lui-fcal-year__day:focus-visible{border-radius:var(--lui-radius-sm);box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal-year__event-dot{background-color:var(--lui-bg-interactive);border-radius:50%;height:var(--lui-fcal-year-dot-size);margin-top:1px;width:var(--lui-fcal-year-dot-size)}.lui-fcal-schedule{display:flex;flex:1;flex-direction:column;overflow-y:auto}.lui-fcal-schedule__empty{align-items:center;color:var(--lui-text-secondary);display:flex;font-size:.875rem;justify-content:center;padding:3rem 1rem}.lui-fcal-schedule__day-group{border-bottom:1px solid var(--lui-fcal-slot-border)}.lui-fcal-schedule__day-header{align-items:baseline;background-color:var(--lui-fcal-bg);display:flex;gap:.5rem;padding:var(--lui-fcal-schedule-row-padding);position:sticky;top:0;z-index:var(--lui-z-base)}.lui-fcal-schedule__day-number{color:var(--lui-text-primary);font-size:1.5rem;font-weight:300;line-height:1}.lui-fcal-schedule__day-number--today{align-items:center;background-color:var(--lui-fcal-today-dot-bg);border-radius:50%;color:var(--lui-fcal-today-dot-text);display:inline-flex;font-size:1rem;font-weight:700;height:2.25rem;justify-content:center;width:2.25rem}.lui-fcal-schedule__day-label{color:var(--lui-text-secondary);font-size:.6875rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase}.lui-fcal-schedule__event-row{align-items:center;cursor:pointer;display:flex;gap:.75rem;padding:var(--lui-fcal-schedule-row-padding);padding-inline-start:4rem;transition:background-color var(--lui-transition)}.lui-fcal-schedule__event-row:hover{background-color:var(--lui-fcal-slot-hover-bg)}}@layer components{.lui-fcal-schedule__event-row:focus-visible{box-shadow:inset 0 0 0 2px var(--lui-bg-interactive);outline:none}.lui-fcal-schedule__event-dot{background-color:var(--lui-fcal-event-default-border);border-radius:50%;flex-shrink:0;height:8px;width:8px}.lui-fcal-schedule__event-dot--success{background-color:var(--lui-fcal-event-success-border)}.lui-fcal-schedule__event-dot--warning{background-color:var(--lui-fcal-event-warning-border)}.lui-fcal-schedule__event-dot--error{background-color:var(--lui-fcal-event-error-border)}.lui-fcal-schedule__event-dot--info{background-color:var(--lui-fcal-event-info-border)}.lui-fcal-schedule__event-dot--purple{background-color:var(--lui-fcal-event-purple-border)}.lui-fcal-schedule__event-dot--rose{background-color:var(--lui-fcal-event-rose-border)}.lui-fcal-schedule__event-time{color:var(--lui-text-secondary);flex-shrink:0;font-size:.75rem;font-weight:500;min-width:5.5rem}.lui-fcal-schedule__event-title{color:var(--lui-text-primary);flex:1;font-size:.8125rem;font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lui-fcal-schedule__event-location{color:var(--lui-text-secondary);flex-shrink:0;font-size:.75rem;max-width:12rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lui-fcal-schedule__now-indicator{align-items:center;display:flex;gap:.5rem;padding:.25rem 1rem}.lui-fcal-schedule__now-line{background-color:var(--lui-fcal-now-color);flex:1;height:1px}.lui-fcal-schedule__now-label{color:var(--lui-fcal-now-color);font-size:.625rem;font-weight:600;text-transform:uppercase}.lui-fcal{background-color:var(--lui-fcal-bg);border:1px solid var(--lui-fcal-border);border-radius:var(--lui-fcal-radius);display:flex;flex-direction:column;font-family:var(--lui-fcal-font);height:var(--lui-fcal-height);overflow:hidden}.lui-fcal__nav{align-items:center;border-bottom:1px solid var(--lui-fcal-border);display:flex;flex-shrink:0;gap:.375rem;min-height:var(--lui-fcal-nav-height);padding:.625rem 1rem}.lui-fcal__nav-title{color:var(--lui-text-primary);flex:1;font-size:.9375rem;font-weight:600;margin-inline-start:.5rem}.lui-fcal__nav-btn{align-items:center;background:transparent;border:1px solid var(--lui-border-default);border-radius:var(--lui-radius-sm);color:var(--lui-text-secondary);cursor:pointer;display:inline-flex;font-size:1rem;height:2rem;justify-content:center;padding:0;transition:var(--lui-transition);width:2rem}.lui-fcal__nav-btn:hover:not(:disabled){background-color:var(--lui-bg-surface-raised);color:var(--lui-text-primary)}}@layer components{.lui-fcal__nav-btn:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal__today-btn{align-items:center;background:transparent;border:1px solid var(--lui-border-default);border-radius:var(--lui-radius-sm);color:var(--lui-text-secondary);cursor:pointer;display:inline-flex;font-family:var(--lui-fcal-font);font-size:.8125rem;font-weight:500;height:2rem;justify-content:center;padding-inline:.75rem;transition:var(--lui-transition)}.lui-fcal__today-btn:hover{background-color:var(--lui-bg-surface-raised);color:var(--lui-text-primary)}.lui-fcal__today-btn:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal__view-switcher{position:relative}.lui-fcal__view-btn{align-items:center;background:transparent;border:1px solid var(--lui-border-default);border-radius:var(--lui-radius-sm);color:var(--lui-text-secondary);cursor:pointer;display:inline-flex;font-family:var(--lui-fcal-font);font-size:.8125rem;font-weight:500;gap:.375rem;height:2rem;padding-inline:.75rem;transition:var(--lui-transition)}.lui-fcal__view-btn:hover{background-color:var(--lui-bg-surface-raised);color:var(--lui-text-primary)}.lui-fcal__view-btn:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal__view-btn-arrow{font-size:.625rem;transition:transform var(--lui-transition)}.lui-fcal__view-btn-arrow--open{transform:rotate(180deg)}.lui-fcal__view-dropdown{background-color:var(--lui-bg-surface);border:1px solid var(--lui-fcal-border);border-radius:var(--lui-radius-sm);box-shadow:0 4px 12px rgba(0,0,0,.08);inset-inline-end:0;min-width:8rem;padding:.25rem;position:absolute;top:calc(100% + 4px);z-index:var(--lui-z-dropdown)}.lui-fcal__view-option{align-items:center;background:transparent;border:none;border-radius:var(--lui-radius-sm);color:var(--lui-text-primary);cursor:pointer;display:flex;font-family:var(--lui-fcal-font);font-size:.8125rem;padding:.375rem .625rem;text-align:start;transition:background-color var(--lui-transition);width:100%}.lui-fcal__view-option:hover{background-color:var(--lui-bg-surface-raised)}.lui-fcal__view-option--active{background-color:color-mix(in srgb,var(--lui-bg-interactive) 10%,transparent);color:var(--lui-bg-interactive);font-weight:600}.lui-fcal__view-option:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal__tz-picker{position:relative}.lui-fcal__tz-btn{align-items:center;background:transparent;border:1px solid var(--lui-border-default);border-radius:var(--lui-radius-sm);color:var(--lui-text-secondary);cursor:pointer;display:inline-flex;font-family:var(--lui-fcal-font);font-size:.8125rem;font-weight:500;gap:.25rem;height:2rem;padding-inline:.625rem;transition:var(--lui-transition)}.lui-fcal__tz-btn:hover{background-color:var(--lui-bg-surface-raised);color:var(--lui-text-primary)}.lui-fcal__tz-btn:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal__tz-btn-label{font-variant-numeric:tabular-nums}.lui-fcal__tz-dropdown{background-color:var(--lui-bg-surface);border:1px solid var(--lui-fcal-border);border-radius:var(--lui-radius-sm);box-shadow:0 4px 16px rgba(0,0,0,.1);display:flex;flex-direction:column;inset-inline-end:0;overflow:hidden;position:absolute;top:calc(100% + 4px);width:18rem;z-index:var(--lui-z-dropdown)}.lui-fcal__tz-search-wrapper{border-bottom:1px solid var(--lui-fcal-border);flex-shrink:0;padding:.375rem}.lui-fcal__tz-search{background-color:var(--lui-bg-surface);border:1px solid var(--lui-border-default);border-radius:var(--lui-radius-sm);box-sizing:border-box;color:var(--lui-text-primary);display:block;font-family:var(--lui-fcal-font);font-size:.8125rem;height:2rem;outline:none;padding-inline:.625rem;width:100%}.lui-fcal__tz-search::placeholder{color:var(--lui-text-secondary)}.lui-fcal__tz-search:focus{border-color:var(--lui-border-focus);box-shadow:0 0 0 2px color-mix(in srgb,var(--lui-bg-interactive) 20%,transparent)}.lui-fcal__tz-list{max-height:14rem;overflow-y:auto;padding:.25rem}.lui-fcal__tz-option{align-items:center;background:transparent;border:none;border-radius:var(--lui-radius-sm);color:var(--lui-text-primary);cursor:pointer;display:flex;font-family:var(--lui-fcal-font);font-size:.8125rem;overflow:hidden;padding:.3125rem .625rem;text-align:start;text-overflow:ellipsis;transition:background-color var(--lui-transition);white-space:nowrap;width:100%}.lui-fcal__tz-option:hover{background-color:var(--lui-bg-surface-raised)}.lui-fcal__tz-option--active{background-color:color-mix(in srgb,var(--lui-bg-interactive) 10%,transparent);color:var(--lui-bg-interactive);font-weight:600}.lui-fcal__tz-option:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal__tz-empty{color:var(--lui-text-secondary);font-size:.8125rem;padding:.75rem .625rem;text-align:center}.lui-fcal__header{border-bottom:1px solid var(--lui-fcal-border);display:grid;flex-shrink:0}.lui-fcal__gutter-header{align-items:flex-end;border-inline-end:1px solid var(--lui-fcal-border);display:flex;justify-content:flex-end;padding:0 .375rem .375rem}.lui-fcal__tz-label{color:var(--lui-text-secondary);font-size:.5625rem;font-weight:500;letter-spacing:.04em;line-height:1}.lui-fcal__day-header{align-items:center;border-inline-end:1px solid var(--lui-fcal-border);display:flex;flex-direction:column;gap:.25rem;justify-content:center;padding:.625rem 0}.lui-fcal__day-header--today{background-color:var(--lui-fcal-today-col-bg)}.lui-fcal__day-weekday{color:var(--lui-text-secondary);font-size:.625rem;font-weight:600;letter-spacing:.08em;text-transform:uppercase}.lui-fcal__day-number{color:var(--lui-text-primary);font-size:1.375rem;font-weight:300;line-height:1}.lui-fcal__day-number--today{align-items:center;background-color:var(--lui-fcal-today-dot-bg);border-radius:50%;color:var(--lui-fcal-today-dot-text);display:inline-flex;font-weight:700;height:2.25rem;justify-content:center;width:2.25rem}.lui-fcal__scroll{display:flex;flex:1;min-height:0;overflow-y:auto}.lui-fcal__time-gutter{border-inline-end:1px solid var(--lui-fcal-border);flex-shrink:0;width:var(--lui-fcal-time-col-width)}.lui-fcal__time-label{align-items:flex-start;color:var(--lui-text-secondary);display:flex;font-size:.625rem;font-weight:500;height:var(--lui-fcal-hour-height);justify-content:flex-end;letter-spacing:.04em;padding-inline-end:.5rem;padding-top:.25rem}.lui-fcal__time-label:first-child{color:transparent}.lui-fcal__time-label:last-child{height:0;overflow:visible}.lui-fcal__slot{border-bottom:1px solid var(--lui-fcal-slot-border);cursor:pointer;height:var(--lui-fcal-hour-height);position:relative;transition:background-color var(--lui-transition)}.lui-fcal__slot:after{background:var(--lui-fcal-slot-half-border);content:"";height:1px;inset-inline-end:0;inset-inline-start:0;position:absolute;top:50%}.lui-fcal__slot:hover{background-color:var(--lui-fcal-slot-hover-bg)}.lui-fcal__event{background-color:var(--lui-fcal-event-default-bg);border:none;border-radius:var(--lui-fcal-event-radius);color:var(--lui-fcal-event-default-text);cursor:pointer;font-family:var(--lui-fcal-font);min-height:var(--lui-fcal-event-min-h);overflow:hidden;padding:.1875rem .375rem;position:absolute;transition:filter var(--lui-transition);z-index:var(--lui-z-base)}.lui-fcal__event:hover{filter:brightness(.94)}.lui-fcal__event:focus-visible{box-shadow:0 0 0 2px var(--lui-bg-surface),0 0 0 4px var(--lui-bg-interactive);outline:none}.lui-fcal__event--success{background-color:var(--lui-fcal-event-success-bg);color:var(--lui-fcal-event-success-text)}.lui-fcal__event--warning{background-color:var(--lui-fcal-event-warning-bg);color:var(--lui-fcal-event-warning-text)}.lui-fcal__event--error{background-color:var(--lui-fcal-event-error-bg);color:var(--lui-fcal-event-error-text)}.lui-fcal__event--info{background-color:var(--lui-fcal-event-info-bg);color:var(--lui-fcal-event-info-text)}.lui-fcal__event--purple{background-color:var(--lui-fcal-event-purple-bg);color:var(--lui-fcal-event-purple-text)}.lui-fcal__event--rose{background-color:var(--lui-fcal-event-rose-bg);color:var(--lui-fcal-event-rose-text)}.lui-fcal__event-title{display:block;font-size:.71875rem;font-weight:600;line-height:1.35;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lui-fcal__event-time{font-weight:500;margin-top:.0625rem;opacity:.75}.lui-fcal__event-subtitle,.lui-fcal__event-time{display:block;font-size:.625rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lui-fcal__event-subtitle{opacity:.7}.lui-fcal__now-line{height:2px;inset-inline-end:0;inset-inline-start:0;pointer-events:none;z-index:calc(var(--lui-z-base) + 1)}.lui-fcal__now-line,.lui-fcal__now-line:before{background-color:var(--lui-fcal-now-color);position:absolute}.lui-fcal__now-line:before{border-radius:50%;content:"";height:10px;inset-inline-start:-5px;top:50%;transform:translateY(-50%);width:10px}@media (prefers-reduced-motion:reduce){.lui-fcal__event,.lui-fcal__nav-btn,.lui-fcal__slot,.lui-fcal__today-btn,.lui-fcal__view-btn{transition:none}}}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
import type { Ref } from "react";
|
|
3
|
+
import type { CalEvent, CalendarView } from "./types";
|
|
4
|
+
export interface FullCalendarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
5
|
+
ref?: Ref<HTMLDivElement>;
|
|
6
|
+
/** Events to display */
|
|
7
|
+
events?: CalEvent[];
|
|
8
|
+
/** Controlled view */
|
|
9
|
+
view?: CalendarView;
|
|
10
|
+
/** Default view (uncontrolled) */
|
|
11
|
+
defaultView?: CalendarView;
|
|
12
|
+
/** Callback when view changes */
|
|
13
|
+
onViewChange?: (view: CalendarView, previous: CalendarView) => void;
|
|
14
|
+
/** Subset of views to show in the switcher */
|
|
15
|
+
views?: CalendarView[];
|
|
16
|
+
/** Controlled anchor date */
|
|
17
|
+
date?: Date;
|
|
18
|
+
/** Default anchor date (uncontrolled) */
|
|
19
|
+
defaultDate?: Date;
|
|
20
|
+
/** Callback when navigating */
|
|
21
|
+
onNavigate?: (date: Date, view: CalendarView) => void;
|
|
22
|
+
/** Event callbacks */
|
|
23
|
+
onEventClick?: (event: CalEvent, element: HTMLElement) => void;
|
|
24
|
+
onSlotClick?: (date: Date, view: CalendarView) => void;
|
|
25
|
+
/** Time grid options */
|
|
26
|
+
startHour?: number;
|
|
27
|
+
endHour?: number;
|
|
28
|
+
slotDuration?: 15 | 30 | 60;
|
|
29
|
+
/** Display options */
|
|
30
|
+
weekStartsOn?: 0 | 1;
|
|
31
|
+
showWeekends?: boolean;
|
|
32
|
+
locale?: string;
|
|
33
|
+
/** IANA timezone string, e.g. "America/New_York". Defaults to the browser's local timezone. */
|
|
34
|
+
timezone?: string;
|
|
35
|
+
/** Callback fired when the user changes the timezone via the picker */
|
|
36
|
+
onTimezoneChange?: (timezone: string) => void;
|
|
37
|
+
today?: Date;
|
|
38
|
+
}
|
|
39
|
+
export declare function FullCalendar({ ref, className, events, view: controlledView, defaultView, onViewChange, views, date: controlledDate, defaultDate, onNavigate, onEventClick, onSlotClick, startHour, endHour, slotDuration, weekStartsOn, showWeekends, locale, timezone: timezoneProp, onTimezoneChange, today: todayOverride, children, ...props }: FullCalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare namespace FullCalendar {
|
|
41
|
+
var displayName: string;
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--lui-fcal-bg:var(--lui-bg-surface);--lui-fcal-border:var(--lui-border-default);--lui-fcal-radius:var(--lui-radius-md);--lui-fcal-height:100%;--lui-fcal-font:var(--lui-font-family);--lui-fcal-hour-height:4rem;--lui-fcal-time-col-width:3.5rem;--lui-fcal-today-col-bg:color-mix(in srgb,var(--lui-bg-interactive) 5%,transparent);--lui-fcal-today-dot-bg:var(--lui-bg-interactive);--lui-fcal-today-dot-text:var(--lui-text-inverse);--lui-fcal-slot-border:color-mix(in srgb,var(--lui-border-default) 60%,transparent);--lui-fcal-slot-half-border:color-mix(in srgb,var(--lui-border-default) 30%,transparent);--lui-fcal-slot-hover-bg:color-mix(in srgb,var(--lui-bg-interactive) 6%,transparent);--lui-fcal-now-color:var(--lui-error);--lui-fcal-event-radius:var(--lui-radius-sm);--lui-fcal-event-min-h:1.25rem;--lui-fcal-event-default-bg:color-mix(in srgb,var(--lui-bg-interactive) 15%,var(--lui-bg-surface));--lui-fcal-event-default-text:var(--lui-text-primary);--lui-fcal-event-success-bg:color-mix(in srgb,var(--lui-success) 15%,var(--lui-bg-surface));--lui-fcal-event-success-text:var(--lui-success-soft-text,#15803d);--lui-fcal-event-warning-bg:color-mix(in srgb,var(--lui-warning) 15%,var(--lui-bg-surface));--lui-fcal-event-warning-text:var(--lui-warning-soft-text,#b45309);--lui-fcal-event-error-bg:color-mix(in srgb,var(--lui-error) 15%,var(--lui-bg-surface));--lui-fcal-event-error-text:var(--lui-error-soft-text,#b91c1c);--lui-fcal-event-info-bg:color-mix(in srgb,var(--lui-info) 15%,var(--lui-bg-surface));--lui-fcal-event-info-text:var(--lui-info-soft-text,#1d4ed8);--lui-fcal-event-purple-bg:color-mix(in srgb,#7c3aed 15%,var(--lui-bg-surface));--lui-fcal-event-purple-text:#5b21b6;--lui-fcal-event-rose-bg:color-mix(in srgb,#e11d48 15%,var(--lui-bg-surface));--lui-fcal-event-rose-text:#be123c;--lui-fcal-month-cell-min-h:6rem;--lui-fcal-month-outside-opacity:0.4;--lui-fcal-year-dot-size:5px;--lui-fcal-schedule-row-padding:0.625rem 1rem;--lui-fcal-nav-height:3rem}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { FullCalendar, type FullCalendarProps } from "./full-calendar";
|
|
2
|
+
export { FullCalendar as default } from "./full-calendar";
|
|
3
|
+
export type { CalEvent, CalEventColor, CalendarView } from "./types";
|
|
4
|
+
export { fullCalendarManifest, type FullCalendarEvents } from "./events";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("@ladder-ui/core/concatClassNames");const n=t.createContext(null);function l(e,t){const a=new Date(e);a.setHours(0,0,0,0);const n=a.getDay(),l=1===t?0===n?-6:1-n:-n;return a.setDate(a.getDate()+l),a}function r(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function s(e,t){const a=new Date(e);return a.setDate(a.getDate()+t),a}function i(e,t){const a=new Date(e);return a.setMonth(a.getMonth()+t),a}function o(e,t){const a=new Date(e);return a.setFullYear(a.getFullYear()+t),a}function c(e){return 60*e.getHours()+e.getMinutes()}function u(e,t,a){const n=new Intl.DateTimeFormat("en-CA",{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit"});return n.format(e)===n.format(t)}function d(e,t,a){const n=new Intl.DateTimeFormat("en-CA",{timeZone:a,year:"numeric",month:"2-digit"});return n.format(e)===n.format(t)}function m(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function h(e,t){const a=function(e){const t=new Date(e);return t.setDate(1),t.setHours(0,0,0,0),t}(e),n=l(a,t),r=[];let s=new Date(n);for(let e=0;e<6;e++){const e=[];for(let t=0;t<7;t++)e.push(new Date(s)),s.setDate(s.getDate()+1);r.push(e)}return r}function f(e,t){const a=new Date(2e3,0,1,e);return new Intl.DateTimeFormat(t,{hour:"numeric",hour12:!0}).format(a)}function _(e,t,a){return new Intl.DateTimeFormat(t,{timeZone:a,hour:"numeric",minute:"2-digit",hour12:!0}).format(e)}function y(e,t,a){return new Intl.DateTimeFormat(t,{timeZone:a,weekday:"long",month:"long",day:"numeric"}).format(e)}function v(e,t,a="short"){return new Intl.DateTimeFormat(t,{weekday:a}).format(e)}function w(e,t,a="short"){return new Intl.DateTimeFormat(t,{month:a}).format(e)}function p(e,t=new Date){const a=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"short"}).formatToParts(t);return a.find(e=>"timeZoneName"===e.type)?.value??""}function x({days:l,gridClass:s,columnClass:i,headerClass:o}){const c=t.use(n),{today:d,events:m,locale:h,timezone:_,startHour:v,endHour:w,onEventClick:x,onSlotClick:k,view:N}=c,j=Array.from({length:w-v+1},(e,t)=>v+t),b=j.slice(0,-1),[D,C]=t.useState(()=>new Date);t.useEffect(()=>{const e=1e3*(60-D.getSeconds())-D.getMilliseconds(),t=setTimeout(()=>{C(new Date);const e=setInterval(()=>C(new Date),6e4);return()=>clearInterval(e)},e);return()=>clearTimeout(t)},[]);const S=function(e,t){const a=new Intl.DateTimeFormat("en-US",{timeZone:t,hour:"numeric",minute:"2-digit",hour12:!1}).formatToParts(e);return parseInt(a.find(e=>"hour"===e.type)?.value??"0")%24*60+parseInt(a.find(e=>"minute"===e.type)?.value??"0")}(D,_),T=60*v,I=S>=T&&S<=60*w,F=(S-T)/60*64,z=p(_,d);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:a("lui-fcal__header",o),role:"presentation","aria-label":"Days of the week",children:[e.jsx("div",{className:"lui-fcal__gutter-header","aria-hidden":"true",children:e.jsx("span",{className:"lui-fcal__tz-label",children:z})}),l.map(t=>{const n=u(t,d,_);return e.jsxs("div",{className:a("lui-fcal__day-header",n&&"lui-fcal__day-header--today"),role:"heading","aria-level":3,"aria-label":y(t,h,_),children:[e.jsx("span",{className:"lui-fcal__day-weekday","aria-hidden":"true",children:new Intl.DateTimeFormat(h,{timeZone:_,weekday:"short"}).format(t).toUpperCase()}),e.jsx("span",{className:a("lui-fcal__day-number",n&&"lui-fcal__day-number--today"),"aria-hidden":"true",children:new Intl.DateTimeFormat(h,{timeZone:_,day:"numeric"}).format(t)})]},t.toISOString())})]}),e.jsxs("div",{className:"lui-fcal__scroll",children:[e.jsx("div",{className:"lui-fcal__time-gutter","aria-hidden":"true",children:j.map(t=>e.jsx("div",{className:"lui-fcal__time-label",children:f(t,h)},t))}),e.jsx("div",{className:s,role:"presentation",children:l.map(t=>{const n=u(t,d,_),l=function(e,t,a,n){const l=new Date(t);l.setHours(a,0,0,0);const s=new Date(t);return s.setHours(n,0,0,0),e.filter(e=>!e.allDay&&!(!r(e.start,t)&&!r(e.end,t))&&e.start<s&&e.end>l)}(m,t,v,w),s=function(e){if(0===e.length)return[];const t=[...e].sort((e,t)=>e.start.getTime()-t.start.getTime()),a=[];let n=0;for(;n<t.length;){let e=t[n].end,l=n+1;for(;l<t.length&&t[l].start<e;)t[l].end>e&&(e=t[l].end),l++;const r=t.slice(n,l),s=[],i=[];for(const e of r){let t=s.findIndex(t=>t<=e.start);-1===t&&(t=s.length),s[t]=e.end,i.push({event:e,lane:t})}const o=s.length;for(const{event:e,lane:t}of i)a.push({event:e,lane:t,totalLanes:o});n=l}return a}(l);return e.jsxs("div",{className:a(i,n&&`${i}--today`),role:"presentation","aria-label":y(t,h,_),children:[b.map(a=>{const n=new Date(t);return n.setHours(a,0,0,0),e.jsx("div",{className:"lui-fcal__slot",role:"button",tabIndex:0,"aria-label":`${y(t,h,_)}, ${f(a,h)}`,onClick:()=>k?.(n,N),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),k?.(n,N))}},a)}),n&&I&&e.jsx("div",{className:"lui-fcal__now-line",style:{top:F},"aria-hidden":"true"}),s.map(({event:t,lane:a,totalLanes:n})=>e.jsx(g,{event:t,lane:a,totalLanes:n,startHour:v,endHour:w,locale:h,timezone:_,onEventClick:x},t.id))]},t.toISOString())})})]})]})}function g({event:t,lane:n,totalLanes:l,startHour:r,endHour:s,locale:i,timezone:o,onEventClick:u}){const{top:d,height:m}=function(e,t,a){const n=60*t,l=60*a,r=Math.max(c(e.start),n),s=Math.min(c(e.end),l);return{top:(r-n)/60*64,height:Math.max((s-r)/60*64,20)}}(t,r,s),h=100/l,f=n*h,y=t.color&&"default"!==t.color?`lui-fcal__event--${t.color}`:"",v=`${_(t.start,i,o)} – ${_(t.end,i,o)}`;return e.jsxs("div",{className:a("lui-fcal__event",y),style:{top:d,height:m,insetInlineStart:`${f}%`,width:`calc(${h}% - 2px)`},role:"button",tabIndex:0,"aria-label":`${t.title}, ${v}`,onClick:e=>u?.(t,e.currentTarget),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),u?.(t,e.currentTarget))},children:[e.jsx("span",{className:"lui-fcal__event-title",children:t.title}),m>=40&&e.jsx("span",{className:"lui-fcal__event-time",children:v}),t.subtitle&&m>=56&&e.jsx("span",{className:"lui-fcal__event-subtitle",children:t.subtitle})]})}function k(){const a=[t.use(n).anchorDate];return e.jsx("div",{className:"lui-fcal-day",children:e.jsx(x,{days:a,gridClass:"lui-fcal-day__grid",columnClass:"lui-fcal-day__column",headerClass:"lui-fcal-day__header"})})}function N(){const r=t.use(n),{anchorDate:s,weekStartsOn:i,showWeekends:o}=r;let c=(u=l(s,i),Array.from({length:7},(e,t)=>{const a=new Date(u);return a.setDate(u.getDate()+t),a}));var u;o||(c=c.filter(e=>0!==e.getDay()&&6!==e.getDay()));const d=a("lui-fcal-week__header",!o&&"lui-fcal-week__header--no-weekends"),m=a("lui-fcal-week__grid",!o&&"lui-fcal-week__grid--no-weekends");return e.jsx("div",{className:"lui-fcal-week",children:e.jsx(x,{days:c,gridClass:m,columnClass:"lui-fcal-week__column",headerClass:d})})}function j(){const r=t.use(n),{anchorDate:s,today:i,events:o,locale:c,timezone:m,weekStartsOn:f,onEventClick:_,onSlotClick:w,view:p}=r,x=h(s,f);l(x[0][0],f);const g=x[0];return e.jsxs("div",{className:"lui-fcal-month",children:[e.jsx("div",{className:"lui-fcal-month__weekday-header",children:g.map(t=>e.jsx("div",{className:"lui-fcal-month__weekday-cell",children:v(t,c)},t.getDay()))}),e.jsx("div",{className:"lui-fcal-month__grid",children:x.flat().map(t=>{const n=u(t,i,m),l=!d(t,s,m),r=o.filter(e=>u(e.start,t,m)||e.allDay&&e.start<=t&&e.end>=t),h=r.slice(0,3),f=r.length-3;return e.jsxs("div",{className:a("lui-fcal-month__cell",l&&"lui-fcal-month__cell--outside",n&&"lui-fcal-month__cell--today"),"aria-label":y(t,c,m),children:[e.jsx("button",{type:"button",className:a("lui-fcal-month__day-number",n&&"lui-fcal-month__day-number--today"),"aria-label":y(t,c,m),onClick:()=>w?.(t,p),children:new Intl.DateTimeFormat(c,{timeZone:m,day:"numeric"}).format(t)}),h.length>0&&e.jsxs("div",{className:"lui-fcal-month__events",children:[h.map(t=>e.jsx(b,{event:t,locale:c,timezone:m,onEventClick:_},t.id)),f>0&&e.jsxs("button",{type:"button",className:"lui-fcal-month__more",onClick:e=>{e.stopPropagation(),w?.(t,p)},children:["+",f," more"]})]})]},t.toISOString())})})]})}function b({event:t,locale:n,timezone:l,onEventClick:r}){const s=t.color&&"default"!==t.color?`lui-fcal-month__event-chip--${t.color}`:"",i=t.allDay?"All day":_(t.start,n,l);return e.jsxs("div",{className:a("lui-fcal-month__event-chip",s),role:"button",tabIndex:0,"aria-label":`${t.title}, ${i}`,onClick:e=>{e.stopPropagation(),r?.(t,e.currentTarget)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),r?.(t,e.currentTarget))},children:[e.jsx("span",{className:"lui-fcal-month__event-dot","aria-hidden":"true"}),e.jsx("span",{children:t.title})]})}function D(){const a=t.use(n),{anchorDate:l,today:r,events:s,locale:i,timezone:o,weekStartsOn:c,navigate:u,setView:d}=a,m=(h=l.getFullYear(),Array.from({length:12},(e,t)=>new Date(h,t,1)));var h;function f(e){u(e),d("day")}function _(e){u(e),d("month")}return e.jsx("div",{className:"lui-fcal-year",children:e.jsx("div",{className:"lui-fcal-year__grid",children:m.map(t=>e.jsx(C,{month:t,today:r,events:s,locale:i,timezone:o,weekStartsOn:c,onDayClick:f,onMonthClick:_},t.getMonth()))})})}function C({month:t,today:n,events:l,locale:s,timezone:i,weekStartsOn:o,onDayClick:c,onMonthClick:f}){const _=h(t,o),p=_[0];return e.jsxs("div",{className:"lui-fcal-year__mini-month",children:[e.jsx("button",{type:"button",className:"lui-fcal-year__month-title",onClick:()=>f(t),"aria-label":`Go to ${w(t,s,"long")}`,children:w(t,s,"long")}),e.jsx("div",{className:"lui-fcal-year__weekday-row",children:p.map(t=>e.jsx("span",{className:"lui-fcal-year__weekday-label",children:v(t,s,"narrow")},t.getDay()))}),e.jsx("div",{className:"lui-fcal-year__days-grid",children:_.flat().map(o=>{const h=u(o,n,i),f=!d(o,t,i),_=!f&&function(e,t){return e.some(e=>{const a=m(e.start),n=(e.allDay,m(e.end)),l=m(t);return e.allDay?l>=a&&l<=n:r(e.start,t)})}(l,o);return e.jsxs("button",{type:"button",className:a("lui-fcal-year__day",f&&"lui-fcal-year__day--outside",h&&"lui-fcal-year__day--today"),"aria-label":y(o,s,i),onClick:()=>c(o),tabIndex:f?-1:0,children:[o.getDate(),_&&e.jsx("span",{className:"lui-fcal-year__event-dot","aria-hidden":"true"})]},o.toISOString())})})]})}function S(){const l=t.use(n),{anchorDate:r,today:o,events:c,locale:d,timezone:h,onEventClick:f}=l,_=i(r,3),y=function(e){const t=function(e){return[...e].sort((e,t)=>e.start.getTime()-t.start.getTime())}(e),a=new Map;for(const e of t)if(e.allDay){let t=m(e.start);const n=m(e.end);for(;t<=n;){const n=t.toDateString();a.has(n)||a.set(n,[]),a.get(n).push(e),t=s(t,1)}}else{const t=m(e.start).toDateString();a.has(t)||a.set(t,[]),a.get(t).push(e)}return a}(c.filter(e=>e.end>=r&&e.start<=_));if(0===y.size)return e.jsx("div",{className:"lui-fcal-schedule",children:e.jsx("div",{className:"lui-fcal-schedule__empty",children:"No upcoming events"})});const v=Array.from(y.entries());let w=!1;return e.jsx("div",{className:"lui-fcal-schedule",children:v.map(([t,n])=>{const l=new Date(t),r=u(l,o,h),s=m(l)<m(o),{dayNum:i,weekday:c,monthLabel:_}=function(e,t,a){return{dayNum:new Intl.DateTimeFormat(t,{timeZone:a,day:"numeric"}).format(e),weekday:new Intl.DateTimeFormat(t,{timeZone:a,weekday:"short"}).format(e).toUpperCase(),monthLabel:new Intl.DateTimeFormat(t,{timeZone:a,month:"short"}).format(e).toUpperCase()}}(l,d,h);let y=!1;return w||s||(w=!0,r||(y=!0)),e.jsxs("div",{children:[y&&e.jsxs("div",{className:"lui-fcal-schedule__now-indicator",children:[e.jsx("span",{className:"lui-fcal-schedule__now-label",children:"Now"}),e.jsx("div",{className:"lui-fcal-schedule__now-line"})]}),e.jsxs("div",{className:"lui-fcal-schedule__day-group",children:[e.jsxs("div",{className:"lui-fcal-schedule__day-header",children:[e.jsx("span",{className:a("lui-fcal-schedule__day-number",r&&"lui-fcal-schedule__day-number--today"),children:i}),e.jsxs("span",{className:"lui-fcal-schedule__day-label",children:[_,", ",c]})]}),n.map(t=>e.jsx(T,{event:t,locale:d,timezone:h,onEventClick:f},t.id))]})]},t)})})}function T({event:t,locale:n,timezone:l,onEventClick:r}){const s=t.color&&"default"!==t.color?`lui-fcal-schedule__event-dot--${t.color}`:"",i=t.allDay?"All day":`${_(t.start,n,l)} – ${_(t.end,n,l)}`;return e.jsxs("div",{className:"lui-fcal-schedule__event-row",role:"button",tabIndex:0,"aria-label":`${t.title}, ${i}${t.location?`, ${t.location}`:""}`,onClick:e=>r?.(t,e.currentTarget),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r?.(t,e.currentTarget))},children:[e.jsx("span",{className:a("lui-fcal-schedule__event-dot",s),"aria-hidden":"true"}),e.jsx("span",{className:"lui-fcal-schedule__event-time",children:i}),e.jsx("span",{className:"lui-fcal-schedule__event-title",children:t.title}),t.location&&e.jsx("span",{className:"lui-fcal-schedule__event-location",children:t.location})]})}k.displayName="DayView",N.displayName="WeekView",j.displayName="MonthView",D.displayName="YearView",S.displayName="ScheduleView";const I=["day","week","month","year","schedule"],F={day:"Day",week:"Week",month:"Month",year:"Year",schedule:"Schedule"},z=(()=>{try{return Intl.supportedValuesOf?.("timeZone")??["UTC"]}catch{return["UTC"]}})();function $(e){const[t,...a]=e.split("/");return a.length?`${t} / ${a.join(" / ").replace(/_/g," ")}`:e}function E({ref:r,className:c,events:u=[],view:d,defaultView:m="week",onViewChange:h,views:f=I,date:_,defaultDate:y,onNavigate:v,onEventClick:w,onSlotClick:x,startHour:g=0,endHour:b=24,slotDuration:C=60,weekStartsOn:T=1,showWeekends:E=!0,locale:Z="en-US",timezone:M=Intl.DateTimeFormat().resolvedOptions().timeZone,onTimezoneChange:H,today:O,children:V,...L}){const P=O??new Date,[U,Y]=t.useState(m),A=d??U;function q(e){const t=A;d||Y(e),e!==t&&h?.(e,t)}const[K,W]=t.useState(()=>y??P),R=_??K;function G(e){_||W(e),v?.(e,A)}const[B,J]=t.useState(()=>M),Q="week"===A?s(l(R,T),6):void 0,X=function(e,t,a,n,l){switch(t){case"day":return new Intl.DateTimeFormat(a,{timeZone:n,weekday:"long",month:"long",day:"numeric",year:"numeric"}).format(e);case"week":{const t=l??e;return e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()?new Intl.DateTimeFormat(a,{timeZone:n,month:"long",year:"numeric"}).format(e):`${new Intl.DateTimeFormat(a,{timeZone:n,month:"short"}).format(e)} – ${new Intl.DateTimeFormat(a,{timeZone:n,month:"short",year:"numeric"}).format(t)}`}case"month":case"schedule":return new Intl.DateTimeFormat(a,{timeZone:n,month:"long",year:"numeric"}).format(e);case"year":return String(e.getFullYear());default:return""}}(R,A,Z,B,Q),[ee,te]=t.useState(!1),ae=t.useRef(null);t.useEffect(()=>{if(ee)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){ae.current&&!ae.current.contains(e.target)&&te(!1)}},[ee]);const[ne,le]=t.useState(!1),[re,se]=t.useState(""),ie=t.useRef(null),oe=t.useRef(null);t.useEffect(()=>{if(ne)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){ie.current&&!ie.current.contains(e.target)&&(le(!1),se(""))}},[ne]),t.useEffect(()=>{ne&&(oe.current?.focus(),requestAnimationFrame(()=>{ie.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})}))},[ne]);const ce=re.trim()?z.filter(e=>$(e).toLowerCase().includes(re.toLowerCase())):z,ue=p(B,P),de={view:A,anchorDate:R,today:P,events:u,navigate:G,setView:q,locale:Z,timezone:B,weekStartsOn:T,startHour:g,endHour:b,slotDuration:C,showWeekends:E,views:f,onEventClick:w,onSlotClick:x},me="day"===A?"Previous day":"week"===A?"Previous week":"month"===A?"Previous month":"year"===A?"Previous year":"Previous period",he="day"===A?"Next day":"week"===A?"Next week":"month"===A?"Next month":"year"===A?"Next year":"Next period";return e.jsx(n,{value:de,children:e.jsxs("div",{ref:r,className:a("lui-fcal",c),"aria-label":X,...L,children:[e.jsxs("div",{className:"lui-fcal__nav","data-slot":"fcal-nav",children:[e.jsx("button",{type:"button",className:"lui-fcal__today-btn",onClick:function(){G(P)},"aria-label":"Go to today",children:"Today"}),e.jsx("button",{type:"button",className:"lui-fcal__nav-btn",onClick:function(){switch(A){case"day":G(s(R,-1));break;case"week":G(s(R,-7));break;case"month":case"schedule":G(i(R,-1));break;case"year":G(o(R,-1))}},"aria-label":me,children:"‹"}),e.jsx("button",{type:"button",className:"lui-fcal__nav-btn",onClick:function(){switch(A){case"day":G(s(R,1));break;case"week":G(s(R,7));break;case"month":case"schedule":G(i(R,1));break;case"year":G(o(R,1))}},"aria-label":he,children:"›"}),e.jsx("span",{className:"lui-fcal__nav-title","aria-live":"polite",children:X}),e.jsxs("div",{className:"lui-fcal__tz-picker",ref:ie,children:[e.jsxs("button",{type:"button",className:"lui-fcal__tz-btn",onClick:()=>{le(!ne),te(!1)},"aria-expanded":ne,"aria-haspopup":"listbox","aria-label":`Timezone: ${B}`,children:[e.jsx("span",{className:"lui-fcal__tz-btn-label",children:ue}),e.jsx("span",{className:a("lui-fcal__view-btn-arrow",ne&&"lui-fcal__view-btn-arrow--open"),"aria-hidden":"true",children:"▾"})]}),ne&&e.jsxs("div",{className:"lui-fcal__tz-dropdown",role:"listbox","aria-label":"Select timezone",children:[e.jsx("div",{className:"lui-fcal__tz-search-wrapper",children:e.jsx("input",{ref:oe,type:"text",className:"lui-fcal__tz-search",placeholder:"Search timezone…",value:re,onChange:e=>se(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(le(!1),se(""))},"aria-label":"Search timezones",autoComplete:"off"})}),e.jsxs("div",{className:"lui-fcal__tz-list",children:[ce.map(t=>e.jsx("button",{type:"button",role:"option","aria-selected":t===B,className:a("lui-fcal__tz-option",t===B&&"lui-fcal__tz-option--active"),onClick:()=>function(e){J(e),H?.(e),le(!1),se("")}(t),children:$(t)},t)),0===ce.length&&e.jsx("div",{className:"lui-fcal__tz-empty",children:"No timezones found"})]})]})]}),f.length>1&&e.jsxs("div",{className:"lui-fcal__view-switcher",ref:ae,children:[e.jsxs("button",{type:"button",className:"lui-fcal__view-btn",onClick:()=>{te(!ee),le(!1)},"aria-expanded":ee,"aria-haspopup":"listbox","aria-label":`View: ${F[A]}`,children:[F[A],e.jsx("span",{className:a("lui-fcal__view-btn-arrow",ee&&"lui-fcal__view-btn-arrow--open"),"aria-hidden":"true",children:"▾"})]}),ee&&e.jsx("div",{className:"lui-fcal__view-dropdown",role:"listbox",children:f.map(t=>e.jsx("button",{type:"button",role:"option","aria-selected":t===A,className:a("lui-fcal__view-option",t===A&&"lui-fcal__view-option--active"),onClick:()=>{q(t),te(!1)},children:F[t]},t))})]})]}),function(){switch(A){case"day":return e.jsx(k,{});case"week":return e.jsx(N,{});case"month":return e.jsx(j,{});case"year":return e.jsx(D,{});case"schedule":return e.jsx(S,{})}}()]})})}E.displayName="FullCalendar",exports.FullCalendar=E,exports.default=E,exports.fullCalendarManifest={namespace:"calendar",emits:[{event:"calendar:view-change",description:"View switched by user"},{event:"calendar:navigate",description:"Date navigation (prev/next/today)"},{event:"calendar:event-click",description:"User clicked an event block"},{event:"calendar:slot-click",description:"User clicked an empty time slot"}],listens:[]};
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as e,Fragment as t,jsx as a}from"react/jsx-runtime";import{createContext as n,use as l,useState as r,useEffect as i,useRef as o}from"react";import c from"@ladder-ui/core/concatClassNames";const s=n(null);function u(e,t){const a=new Date(e);a.setHours(0,0,0,0);const n=a.getDay(),l=1===t?0===n?-6:1-n:-n;return a.setDate(a.getDate()+l),a}function d(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function m(e,t){const a=new Date(e);return a.setDate(a.getDate()+t),a}function h(e,t){const a=new Date(e);return a.setMonth(a.getMonth()+t),a}function f(e,t){const a=new Date(e);return a.setFullYear(a.getFullYear()+t),a}function _(e){return 60*e.getHours()+e.getMinutes()}function y(e,t,a){const n=new Intl.DateTimeFormat("en-CA",{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit"});return n.format(e)===n.format(t)}function v(e,t,a){const n=new Intl.DateTimeFormat("en-CA",{timeZone:a,year:"numeric",month:"2-digit"});return n.format(e)===n.format(t)}function w(e){const t=new Date(e);return t.setHours(0,0,0,0),t}function p(e,t){const a=function(e){const t=new Date(e);return t.setDate(1),t.setHours(0,0,0,0),t}(e),n=u(a,t),l=[];let r=new Date(n);for(let e=0;e<6;e++){const e=[];for(let t=0;t<7;t++)e.push(new Date(r)),r.setDate(r.getDate()+1);l.push(e)}return l}function g(e,t){const a=new Date(2e3,0,1,e);return new Intl.DateTimeFormat(t,{hour:"numeric",hour12:!0}).format(a)}function k(e,t,a){return new Intl.DateTimeFormat(t,{timeZone:a,hour:"numeric",minute:"2-digit",hour12:!0}).format(e)}function N(e,t,a){return new Intl.DateTimeFormat(t,{timeZone:a,weekday:"long",month:"long",day:"numeric"}).format(e)}function D(e,t,a="short"){return new Intl.DateTimeFormat(t,{weekday:a}).format(e)}function b(e,t,a="short"){return new Intl.DateTimeFormat(t,{month:a}).format(e)}function C(e,t=new Date){const a=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"short"}).formatToParts(t);return a.find(e=>"timeZoneName"===e.type)?.value??""}function T({days:n,gridClass:o,columnClass:u,headerClass:m}){const h=l(s),{today:f,events:_,locale:v,timezone:w,startHour:p,endHour:k,onEventClick:D,onSlotClick:b,view:T}=h,S=Array.from({length:k-p+1},(e,t)=>p+t),z=S.slice(0,-1),[F,$]=r(()=>new Date);i(()=>{const e=1e3*(60-F.getSeconds())-F.getMilliseconds(),t=setTimeout(()=>{$(new Date);const e=setInterval(()=>$(new Date),6e4);return()=>clearInterval(e)},e);return()=>clearTimeout(t)},[]);const x=function(e,t){const a=new Intl.DateTimeFormat("en-US",{timeZone:t,hour:"numeric",minute:"2-digit",hour12:!1}).formatToParts(e);return parseInt(a.find(e=>"hour"===e.type)?.value??"0")%24*60+parseInt(a.find(e=>"minute"===e.type)?.value??"0")}(F,w),Z=60*p,E=x>=Z&&x<=60*k,H=(x-Z)/60*64,M=C(w,f);return e(t,{children:[e("div",{className:c("lui-fcal__header",m),role:"presentation","aria-label":"Days of the week",children:[a("div",{className:"lui-fcal__gutter-header","aria-hidden":"true",children:a("span",{className:"lui-fcal__tz-label",children:M})}),n.map(t=>{const n=y(t,f,w);return e("div",{className:c("lui-fcal__day-header",n&&"lui-fcal__day-header--today"),role:"heading","aria-level":3,"aria-label":N(t,v,w),children:[a("span",{className:"lui-fcal__day-weekday","aria-hidden":"true",children:new Intl.DateTimeFormat(v,{timeZone:w,weekday:"short"}).format(t).toUpperCase()}),a("span",{className:c("lui-fcal__day-number",n&&"lui-fcal__day-number--today"),"aria-hidden":"true",children:new Intl.DateTimeFormat(v,{timeZone:w,day:"numeric"}).format(t)})]},t.toISOString())})]}),e("div",{className:"lui-fcal__scroll",children:[a("div",{className:"lui-fcal__time-gutter","aria-hidden":"true",children:S.map(e=>a("div",{className:"lui-fcal__time-label",children:g(e,v)},e))}),a("div",{className:o,role:"presentation",children:n.map(t=>{const n=y(t,f,w),l=function(e,t,a,n){const l=new Date(t);l.setHours(a,0,0,0);const r=new Date(t);return r.setHours(n,0,0,0),e.filter(e=>!e.allDay&&!(!d(e.start,t)&&!d(e.end,t))&&e.start<r&&e.end>l)}(_,t,p,k),r=function(e){if(0===e.length)return[];const t=[...e].sort((e,t)=>e.start.getTime()-t.start.getTime()),a=[];let n=0;for(;n<t.length;){let e=t[n].end,l=n+1;for(;l<t.length&&t[l].start<e;)t[l].end>e&&(e=t[l].end),l++;const r=t.slice(n,l),i=[],o=[];for(const e of r){let t=i.findIndex(t=>t<=e.start);-1===t&&(t=i.length),i[t]=e.end,o.push({event:e,lane:t})}const c=i.length;for(const{event:e,lane:t}of o)a.push({event:e,lane:t,totalLanes:c});n=l}return a}(l);return e("div",{className:c(u,n&&`${u}--today`),role:"presentation","aria-label":N(t,v,w),children:[z.map(e=>{const n=new Date(t);return n.setHours(e,0,0,0),a("div",{className:"lui-fcal__slot",role:"button",tabIndex:0,"aria-label":`${N(t,v,w)}, ${g(e,v)}`,onClick:()=>b?.(n,T),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),b?.(n,T))}},e)}),n&&E&&a("div",{className:"lui-fcal__now-line",style:{top:H},"aria-hidden":"true"}),r.map(({event:e,lane:t,totalLanes:n})=>a(I,{event:e,lane:t,totalLanes:n,startHour:p,endHour:k,locale:v,timezone:w,onEventClick:D},e.id))]},t.toISOString())})})]})]})}function I({event:t,lane:n,totalLanes:l,startHour:r,endHour:i,locale:o,timezone:s,onEventClick:u}){const{top:d,height:m}=function(e,t,a){const n=60*t,l=60*a,r=Math.max(_(e.start),n),i=Math.min(_(e.end),l);return{top:(r-n)/60*64,height:Math.max((i-r)/60*64,20)}}(t,r,i),h=100/l,f=n*h,y=t.color&&"default"!==t.color?`lui-fcal__event--${t.color}`:"",v=`${k(t.start,o,s)} – ${k(t.end,o,s)}`;return e("div",{className:c("lui-fcal__event",y),style:{top:d,height:m,insetInlineStart:`${f}%`,width:`calc(${h}% - 2px)`},role:"button",tabIndex:0,"aria-label":`${t.title}, ${v}`,onClick:e=>u?.(t,e.currentTarget),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),u?.(t,e.currentTarget))},children:[a("span",{className:"lui-fcal__event-title",children:t.title}),m>=40&&a("span",{className:"lui-fcal__event-time",children:v}),t.subtitle&&m>=56&&a("span",{className:"lui-fcal__event-subtitle",children:t.subtitle})]})}function S(){const e=[l(s).anchorDate];return a("div",{className:"lui-fcal-day",children:a(T,{days:e,gridClass:"lui-fcal-day__grid",columnClass:"lui-fcal-day__column",headerClass:"lui-fcal-day__header"})})}function z(){const e=l(s),{anchorDate:t,weekStartsOn:n,showWeekends:r}=e;let i=(o=u(t,n),Array.from({length:7},(e,t)=>{const a=new Date(o);return a.setDate(o.getDate()+t),a}));var o;r||(i=i.filter(e=>0!==e.getDay()&&6!==e.getDay()));const d=c("lui-fcal-week__header",!r&&"lui-fcal-week__header--no-weekends"),m=c("lui-fcal-week__grid",!r&&"lui-fcal-week__grid--no-weekends");return a("div",{className:"lui-fcal-week",children:a(T,{days:i,gridClass:m,columnClass:"lui-fcal-week__column",headerClass:d})})}function F(){const t=l(s),{anchorDate:n,today:r,events:i,locale:o,timezone:d,weekStartsOn:m,onEventClick:h,onSlotClick:f,view:_}=t,w=p(n,m);u(w[0][0],m);const g=w[0];return e("div",{className:"lui-fcal-month",children:[a("div",{className:"lui-fcal-month__weekday-header",children:g.map(e=>a("div",{className:"lui-fcal-month__weekday-cell",children:D(e,o)},e.getDay()))}),a("div",{className:"lui-fcal-month__grid",children:w.flat().map(t=>{const l=y(t,r,d),s=!v(t,n,d),u=i.filter(e=>y(e.start,t,d)||e.allDay&&e.start<=t&&e.end>=t),m=u.slice(0,3),w=u.length-3;return e("div",{className:c("lui-fcal-month__cell",s&&"lui-fcal-month__cell--outside",l&&"lui-fcal-month__cell--today"),"aria-label":N(t,o,d),children:[a("button",{type:"button",className:c("lui-fcal-month__day-number",l&&"lui-fcal-month__day-number--today"),"aria-label":N(t,o,d),onClick:()=>f?.(t,_),children:new Intl.DateTimeFormat(o,{timeZone:d,day:"numeric"}).format(t)}),m.length>0&&e("div",{className:"lui-fcal-month__events",children:[m.map(e=>a($,{event:e,locale:o,timezone:d,onEventClick:h},e.id)),w>0&&e("button",{type:"button",className:"lui-fcal-month__more",onClick:e=>{e.stopPropagation(),f?.(t,_)},children:["+",w," more"]})]})]},t.toISOString())})})]})}function $({event:t,locale:n,timezone:l,onEventClick:r}){const i=t.color&&"default"!==t.color?`lui-fcal-month__event-chip--${t.color}`:"",o=t.allDay?"All day":k(t.start,n,l);return e("div",{className:c("lui-fcal-month__event-chip",i),role:"button",tabIndex:0,"aria-label":`${t.title}, ${o}`,onClick:e=>{e.stopPropagation(),r?.(t,e.currentTarget)},onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),r?.(t,e.currentTarget))},children:[a("span",{className:"lui-fcal-month__event-dot","aria-hidden":"true"}),a("span",{children:t.title})]})}function x(){const e=l(s),{anchorDate:t,today:n,events:r,locale:i,timezone:o,weekStartsOn:c,navigate:u,setView:d}=e,m=(h=t.getFullYear(),Array.from({length:12},(e,t)=>new Date(h,t,1)));var h;function f(e){u(e),d("day")}function _(e){u(e),d("month")}return a("div",{className:"lui-fcal-year",children:a("div",{className:"lui-fcal-year__grid",children:m.map(e=>a(Z,{month:e,today:n,events:r,locale:i,timezone:o,weekStartsOn:c,onDayClick:f,onMonthClick:_},e.getMonth()))})})}function Z({month:t,today:n,events:l,locale:r,timezone:i,weekStartsOn:o,onDayClick:s,onMonthClick:u}){const m=p(t,o),h=m[0];return e("div",{className:"lui-fcal-year__mini-month",children:[a("button",{type:"button",className:"lui-fcal-year__month-title",onClick:()=>u(t),"aria-label":`Go to ${b(t,r,"long")}`,children:b(t,r,"long")}),a("div",{className:"lui-fcal-year__weekday-row",children:h.map(e=>a("span",{className:"lui-fcal-year__weekday-label",children:D(e,r,"narrow")},e.getDay()))}),a("div",{className:"lui-fcal-year__days-grid",children:m.flat().map(o=>{const u=y(o,n,i),m=!v(o,t,i),h=!m&&function(e,t){return e.some(e=>{const a=w(e.start),n=(e.allDay,w(e.end)),l=w(t);return e.allDay?l>=a&&l<=n:d(e.start,t)})}(l,o);return e("button",{type:"button",className:c("lui-fcal-year__day",m&&"lui-fcal-year__day--outside",u&&"lui-fcal-year__day--today"),"aria-label":N(o,r,i),onClick:()=>s(o),tabIndex:m?-1:0,children:[o.getDate(),h&&a("span",{className:"lui-fcal-year__event-dot","aria-hidden":"true"})]},o.toISOString())})})]})}function E(){const t=l(s),{anchorDate:n,today:r,events:i,locale:o,timezone:u,onEventClick:d}=t,f=h(n,3),_=function(e){const t=function(e){return[...e].sort((e,t)=>e.start.getTime()-t.start.getTime())}(e),a=new Map;for(const e of t)if(e.allDay){let t=w(e.start);const n=w(e.end);for(;t<=n;){const n=t.toDateString();a.has(n)||a.set(n,[]),a.get(n).push(e),t=m(t,1)}}else{const t=w(e.start).toDateString();a.has(t)||a.set(t,[]),a.get(t).push(e)}return a}(i.filter(e=>e.end>=n&&e.start<=f));if(0===_.size)return a("div",{className:"lui-fcal-schedule",children:a("div",{className:"lui-fcal-schedule__empty",children:"No upcoming events"})});const v=Array.from(_.entries());let p=!1;return a("div",{className:"lui-fcal-schedule",children:v.map(([t,n])=>{const l=new Date(t),i=y(l,r,u),s=w(l)<w(r),{dayNum:m,weekday:h,monthLabel:f}=function(e,t,a){return{dayNum:new Intl.DateTimeFormat(t,{timeZone:a,day:"numeric"}).format(e),weekday:new Intl.DateTimeFormat(t,{timeZone:a,weekday:"short"}).format(e).toUpperCase(),monthLabel:new Intl.DateTimeFormat(t,{timeZone:a,month:"short"}).format(e).toUpperCase()}}(l,o,u);let _=!1;return p||s||(p=!0,i||(_=!0)),e("div",{children:[_&&e("div",{className:"lui-fcal-schedule__now-indicator",children:[a("span",{className:"lui-fcal-schedule__now-label",children:"Now"}),a("div",{className:"lui-fcal-schedule__now-line"})]}),e("div",{className:"lui-fcal-schedule__day-group",children:[e("div",{className:"lui-fcal-schedule__day-header",children:[a("span",{className:c("lui-fcal-schedule__day-number",i&&"lui-fcal-schedule__day-number--today"),children:m}),e("span",{className:"lui-fcal-schedule__day-label",children:[f,", ",h]})]}),n.map(e=>a(H,{event:e,locale:o,timezone:u,onEventClick:d},e.id))]})]},t)})})}function H({event:t,locale:n,timezone:l,onEventClick:r}){const i=t.color&&"default"!==t.color?`lui-fcal-schedule__event-dot--${t.color}`:"",o=t.allDay?"All day":`${k(t.start,n,l)} – ${k(t.end,n,l)}`;return e("div",{className:"lui-fcal-schedule__event-row",role:"button",tabIndex:0,"aria-label":`${t.title}, ${o}${t.location?`, ${t.location}`:""}`,onClick:e=>r?.(t,e.currentTarget),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),r?.(t,e.currentTarget))},children:[a("span",{className:c("lui-fcal-schedule__event-dot",i),"aria-hidden":"true"}),a("span",{className:"lui-fcal-schedule__event-time",children:o}),a("span",{className:"lui-fcal-schedule__event-title",children:t.title}),t.location&&a("span",{className:"lui-fcal-schedule__event-location",children:t.location})]})}S.displayName="DayView",z.displayName="WeekView",F.displayName="MonthView",x.displayName="YearView",E.displayName="ScheduleView";const M=["day","week","month","year","schedule"],O={day:"Day",week:"Week",month:"Month",year:"Year",schedule:"Schedule"},V=(()=>{try{return Intl.supportedValuesOf?.("timeZone")??["UTC"]}catch{return["UTC"]}})();function L(e){const[t,...a]=e.split("/");return a.length?`${t} / ${a.join(" / ").replace(/_/g," ")}`:e}function P({ref:t,className:n,events:l=[],view:d,defaultView:_="week",onViewChange:y,views:v=M,date:w,defaultDate:p,onNavigate:g,onEventClick:k,onSlotClick:N,startHour:D=0,endHour:b=24,slotDuration:T=60,weekStartsOn:I=1,showWeekends:$=!0,locale:Z="en-US",timezone:H=Intl.DateTimeFormat().resolvedOptions().timeZone,onTimezoneChange:P,today:U,children:Y,...A}){const K=U??new Date,[W,j]=r(_),q=d??W;function G(e){const t=q;d||j(e),e!==t&&y?.(e,t)}const[B,J]=r(()=>p??K),Q=w??B;function R(e){w||J(e),g?.(e,q)}const[X,ee]=r(()=>H),te="week"===q?m(u(Q,I),6):void 0,ae=function(e,t,a,n,l){switch(t){case"day":return new Intl.DateTimeFormat(a,{timeZone:n,weekday:"long",month:"long",day:"numeric",year:"numeric"}).format(e);case"week":{const t=l??e;return e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear()?new Intl.DateTimeFormat(a,{timeZone:n,month:"long",year:"numeric"}).format(e):`${new Intl.DateTimeFormat(a,{timeZone:n,month:"short"}).format(e)} – ${new Intl.DateTimeFormat(a,{timeZone:n,month:"short",year:"numeric"}).format(t)}`}case"month":case"schedule":return new Intl.DateTimeFormat(a,{timeZone:n,month:"long",year:"numeric"}).format(e);case"year":return String(e.getFullYear());default:return""}}(Q,q,Z,X,te),[ne,le]=r(!1),re=o(null);i(()=>{if(ne)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){re.current&&!re.current.contains(e.target)&&le(!1)}},[ne]);const[ie,oe]=r(!1),[ce,se]=r(""),ue=o(null),de=o(null);i(()=>{if(ie)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e);function e(e){ue.current&&!ue.current.contains(e.target)&&(oe(!1),se(""))}},[ie]),i(()=>{ie&&(de.current?.focus(),requestAnimationFrame(()=>{ue.current?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})}))},[ie]);const me=ce.trim()?V.filter(e=>L(e).toLowerCase().includes(ce.toLowerCase())):V,he=C(X,K),fe="day"===q?"Previous day":"week"===q?"Previous week":"month"===q?"Previous month":"year"===q?"Previous year":"Previous period",_e="day"===q?"Next day":"week"===q?"Next week":"month"===q?"Next month":"year"===q?"Next year":"Next period";return a(s,{value:{view:q,anchorDate:Q,today:K,events:l,navigate:R,setView:G,locale:Z,timezone:X,weekStartsOn:I,startHour:D,endHour:b,slotDuration:T,showWeekends:$,views:v,onEventClick:k,onSlotClick:N},children:e("div",{ref:t,className:c("lui-fcal",n),"aria-label":ae,...A,children:[e("div",{className:"lui-fcal__nav","data-slot":"fcal-nav",children:[a("button",{type:"button",className:"lui-fcal__today-btn",onClick:function(){R(K)},"aria-label":"Go to today",children:"Today"}),a("button",{type:"button",className:"lui-fcal__nav-btn",onClick:function(){switch(q){case"day":R(m(Q,-1));break;case"week":R(m(Q,-7));break;case"month":case"schedule":R(h(Q,-1));break;case"year":R(f(Q,-1))}},"aria-label":fe,children:"‹"}),a("button",{type:"button",className:"lui-fcal__nav-btn",onClick:function(){switch(q){case"day":R(m(Q,1));break;case"week":R(m(Q,7));break;case"month":case"schedule":R(h(Q,1));break;case"year":R(f(Q,1))}},"aria-label":_e,children:"›"}),a("span",{className:"lui-fcal__nav-title","aria-live":"polite",children:ae}),e("div",{className:"lui-fcal__tz-picker",ref:ue,children:[e("button",{type:"button",className:"lui-fcal__tz-btn",onClick:()=>{oe(!ie),le(!1)},"aria-expanded":ie,"aria-haspopup":"listbox","aria-label":`Timezone: ${X}`,children:[a("span",{className:"lui-fcal__tz-btn-label",children:he}),a("span",{className:c("lui-fcal__view-btn-arrow",ie&&"lui-fcal__view-btn-arrow--open"),"aria-hidden":"true",children:"▾"})]}),ie&&e("div",{className:"lui-fcal__tz-dropdown",role:"listbox","aria-label":"Select timezone",children:[a("div",{className:"lui-fcal__tz-search-wrapper",children:a("input",{ref:de,type:"text",className:"lui-fcal__tz-search",placeholder:"Search timezone…",value:ce,onChange:e=>se(e.target.value),onKeyDown:e=>{"Escape"===e.key&&(oe(!1),se(""))},"aria-label":"Search timezones",autoComplete:"off"})}),e("div",{className:"lui-fcal__tz-list",children:[me.map(e=>a("button",{type:"button",role:"option","aria-selected":e===X,className:c("lui-fcal__tz-option",e===X&&"lui-fcal__tz-option--active"),onClick:()=>function(e){ee(e),P?.(e),oe(!1),se("")}(e),children:L(e)},e)),0===me.length&&a("div",{className:"lui-fcal__tz-empty",children:"No timezones found"})]})]})]}),v.length>1&&e("div",{className:"lui-fcal__view-switcher",ref:re,children:[e("button",{type:"button",className:"lui-fcal__view-btn",onClick:()=>{le(!ne),oe(!1)},"aria-expanded":ne,"aria-haspopup":"listbox","aria-label":`View: ${O[q]}`,children:[O[q],a("span",{className:c("lui-fcal__view-btn-arrow",ne&&"lui-fcal__view-btn-arrow--open"),"aria-hidden":"true",children:"▾"})]}),ne&&a("div",{className:"lui-fcal__view-dropdown",role:"listbox",children:v.map(e=>a("button",{type:"button",role:"option","aria-selected":e===q,className:c("lui-fcal__view-option",e===q&&"lui-fcal__view-option--active"),onClick:()=>{G(e),le(!1)},children:O[e]},e))})]})]}),function(){switch(q){case"day":return a(S,{});case"week":return a(z,{});case"month":return a(F,{});case"year":return a(x,{});case"schedule":return a(E,{})}}()]})})}P.displayName="FullCalendar";const U={namespace:"calendar",emits:[{event:"calendar:view-change",description:"View switched by user"},{event:"calendar:navigate",description:"Date navigation (prev/next/today)"},{event:"calendar:event-click",description:"User clicked an event block"},{event:"calendar:slot-click",description:"User clicked an empty time slot"}],listens:[]};export{P as FullCalendar,P as default,U as fullCalendarManifest};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type CalendarView = "day" | "week" | "month" | "year" | "schedule";
|
|
2
|
+
export type CalEventColor = "default" | "success" | "warning" | "error" | "info" | "purple" | "rose";
|
|
3
|
+
export interface CalEvent {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
start: Date;
|
|
7
|
+
end: Date;
|
|
8
|
+
allDay?: boolean;
|
|
9
|
+
color?: CalEventColor;
|
|
10
|
+
subtitle?: string;
|
|
11
|
+
location?: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare function getWeekStart(date: Date, weekStartsOn: 0 | 1): Date;
|
|
2
|
+
export declare function getWeekDays(weekStart: Date): Date[];
|
|
3
|
+
export declare function isSameDay(a: Date, b: Date): boolean;
|
|
4
|
+
export declare function isSameMonth(a: Date, b: Date): boolean;
|
|
5
|
+
export declare function addDays(date: Date, n: number): Date;
|
|
6
|
+
export declare function addMonths(date: Date, n: number): Date;
|
|
7
|
+
export declare function addYears(date: Date, n: number): Date;
|
|
8
|
+
export declare function minutesFromMidnight(d: Date): number;
|
|
9
|
+
/** Extracts hours+minutes in the given IANA timezone (for now-line positioning) */
|
|
10
|
+
export declare function minutesFromMidnightInTz(date: Date, timezone: string): number;
|
|
11
|
+
/** Compare two dates by calendar day in the given IANA timezone */
|
|
12
|
+
export declare function isSameDayInTz(a: Date, b: Date, timezone: string): boolean;
|
|
13
|
+
/** Compare two dates by calendar month+year in the given IANA timezone */
|
|
14
|
+
export declare function isSameMonthInTz(a: Date, b: Date, timezone: string): boolean;
|
|
15
|
+
export declare function startOfDay(date: Date): Date;
|
|
16
|
+
export declare function startOfMonth(date: Date): Date;
|
|
17
|
+
export declare function endOfMonth(date: Date): Date;
|
|
18
|
+
export declare function startOfYear(date: Date): Date;
|
|
19
|
+
export declare function getDaysInMonth(date: Date): number;
|
|
20
|
+
/**
|
|
21
|
+
* Returns a 6-row x 7-col grid of Date objects for the month view.
|
|
22
|
+
* Includes leading/trailing days from adjacent months.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCalendarGrid(date: Date, weekStartsOn: 0 | 1): Date[][];
|
|
25
|
+
/**
|
|
26
|
+
* Returns all 12 months for a year view.
|
|
27
|
+
* Each entry is the 1st of that month.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getYearMonths(year: number): Date[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { CalEvent } from "../types";
|
|
2
|
+
export interface LanedEvent {
|
|
3
|
+
event: CalEvent;
|
|
4
|
+
lane: number;
|
|
5
|
+
totalLanes: number;
|
|
6
|
+
}
|
|
7
|
+
/** Filter events visible in a single day column within startHour-endHour range */
|
|
8
|
+
export declare function eventsForDay(events: CalEvent[], day: Date, startHour: number, endHour: number): CalEvent[];
|
|
9
|
+
/** Filter all-day events for a specific day */
|
|
10
|
+
export declare function allDayEventsForDay(events: CalEvent[], day: Date): CalEvent[];
|
|
11
|
+
/** Filter events within a date range (inclusive) */
|
|
12
|
+
export declare function eventsForRange(events: CalEvent[], start: Date, end: Date): CalEvent[];
|
|
13
|
+
/** Greedy lane assignment for overlapping timed events.
|
|
14
|
+
* Events are grouped into overlap clusters first — each cluster gets its own
|
|
15
|
+
* totalLanes count, so a solo event (no siblings) always occupies full width. */
|
|
16
|
+
export declare function layoutDayEvents(events: CalEvent[]): LanedEvent[];
|
|
17
|
+
/** Calculate pixel position for a timed event in a time grid */
|
|
18
|
+
export declare function getEventPosition(event: CalEvent, startHour: number, endHour: number): {
|
|
19
|
+
top: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
/** Sort events chronologically */
|
|
23
|
+
export declare function sortEventsByDate(events: CalEvent[]): CalEvent[];
|
|
24
|
+
/** Group events by day, returning only days that have events. Sorted chronologically. */
|
|
25
|
+
export declare function groupEventsByDate(events: CalEvent[]): Map<string, CalEvent[]>;
|
|
26
|
+
/** Check if a day has any events */
|
|
27
|
+
export declare function dayHasEvents(events: CalEvent[], day: Date): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CalendarView } from "../types";
|
|
2
|
+
export declare function formatHour(hour: number, locale: string): string;
|
|
3
|
+
export declare function formatEventTime(date: Date, locale: string, timezone: string): string;
|
|
4
|
+
/** Navigation title varies by view */
|
|
5
|
+
export declare function formatNavTitle(date: Date, view: CalendarView, locale: string, timezone: string, weekEnd?: Date): string;
|
|
6
|
+
export declare function formatDayLabel(day: Date, locale: string, timezone: string): string;
|
|
7
|
+
export declare function formatMonthYear(date: Date, locale: string, timezone: string): string;
|
|
8
|
+
export declare function formatWeekday(date: Date, locale: string, style?: "short" | "narrow" | "long"): string;
|
|
9
|
+
export declare function formatMonth(date: Date, locale: string, style?: "short" | "long"): string;
|
|
10
|
+
export declare function formatScheduleDate(date: Date, locale: string, timezone: string): {
|
|
11
|
+
dayNum: string;
|
|
12
|
+
weekday: string;
|
|
13
|
+
monthLabel: string;
|
|
14
|
+
};
|
|
15
|
+
/** Returns the short timezone name, e.g. "GMT-5", "EST", "CST" */
|
|
16
|
+
export declare function getTimezoneAbbr(timezone: string, date?: Date): string;
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ladder-ui/full-calendar",
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./*.css": "./dist/*.css",
|
|
15
|
+
"./styles/*.css": "./dist/*.css"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"nodejs",
|
|
22
|
+
"react",
|
|
23
|
+
"ui",
|
|
24
|
+
"components",
|
|
25
|
+
"library"
|
|
26
|
+
],
|
|
27
|
+
"author": "Ivan Avila <ivelaval@gmail.com> - https://www.vennet.dev",
|
|
28
|
+
"license": "ISC",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/ivelaval/ladder-ui.git",
|
|
32
|
+
"directory": "packages/full-calendar"
|
|
33
|
+
},
|
|
34
|
+
"bugs": {
|
|
35
|
+
"url": "https://github.com/ivelaval/ladder-ui/issues"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/ivelaval/ladder-ui#readme",
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
43
|
+
"@types/react": "^19.0.0",
|
|
44
|
+
"rollup": "^4.9.6",
|
|
45
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
46
|
+
"sass": "^1.90.0",
|
|
47
|
+
"typescript": "^5.3.3",
|
|
48
|
+
"tslib": "^2.6.2",
|
|
49
|
+
"@ladder-ui/core": "0.10.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"@ladder-ui/core": ">=0.0.1",
|
|
53
|
+
"react": ">=18.0.0"
|
|
54
|
+
},
|
|
55
|
+
"sideEffects": [
|
|
56
|
+
"**/*.css"
|
|
57
|
+
],
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "pnpm clean && rollup -c",
|
|
60
|
+
"dev": "rollup -c -w",
|
|
61
|
+
"test": "vitest run",
|
|
62
|
+
"test:watch": "vitest",
|
|
63
|
+
"type-check": "tsc --noEmit",
|
|
64
|
+
"clean": "rm -rf dist"
|
|
65
|
+
}
|
|
66
|
+
}
|