ape-calendar 0.2.0 → 0.5.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 +181 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +301 -9
- package/dist/index.d.ts +301 -9
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ReactNode, ButtonHTMLAttributes } from 'react';
|
|
4
|
-
import { LocaleInput, EventInput } from '@fullcalendar/core';
|
|
4
|
+
import { LocaleInput, EventInput, BusinessHoursInput } from '@fullcalendar/core';
|
|
5
5
|
import { Locale } from 'react-day-picker';
|
|
6
6
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
7
7
|
|
|
@@ -9,7 +9,7 @@ import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
|
9
9
|
* Default event status union. Consumers can pass their own string union as a
|
|
10
10
|
* generic parameter to override.
|
|
11
11
|
*/
|
|
12
|
-
type DefaultEventStatus = 'draft' | 'published' | 'scheduled' | 'archived';
|
|
12
|
+
type DefaultEventStatus = 'draft' | 'published' | 'scheduled' | 'archived' | 'cancelled' | 'finalizado';
|
|
13
13
|
/**
|
|
14
14
|
* Minimum shape a calendar event must satisfy. Consumers extend this interface
|
|
15
15
|
* with their own domain fields (eventType, modalities, audience, etc.) and pass
|
|
@@ -41,11 +41,36 @@ interface BaseCalendarEvent<Status extends string = DefaultEventStatus> {
|
|
|
41
41
|
durationMinutes?: number;
|
|
42
42
|
isAllDay?: boolean;
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Calendar views. Designs prioritise `list` / `week` / `month`; `day` is kept
|
|
46
|
+
* for consumers that still rely on the single-day time grid.
|
|
47
|
+
*/
|
|
48
|
+
type CalendarView = 'list' | 'day' | 'week' | 'month';
|
|
45
49
|
interface CalendarVisibleRange {
|
|
46
50
|
start: Date;
|
|
47
51
|
end: Date;
|
|
48
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Direction to move the visible range by one step in the current view.
|
|
55
|
+
*/
|
|
56
|
+
type CalendarNavDirection = 'prev' | 'next' | 'today';
|
|
57
|
+
/**
|
|
58
|
+
* Availability ("horario de atención") band rendered as a subtle background in
|
|
59
|
+
* the time-grid views. Shape matches FullCalendar's `businessHours` input so it
|
|
60
|
+
* can be fed straight through `mapAvailabilityToBusinessHours`.
|
|
61
|
+
*
|
|
62
|
+
* Mirror this shape in `ape-calendar-form` (AvailabilityScheduleDialog emits it)
|
|
63
|
+
* — the two packages intentionally do not depend on each other.
|
|
64
|
+
*/
|
|
65
|
+
interface AvailabilitySlot {
|
|
66
|
+
/** Days of week the slot applies to. 0=Sunday … 6=Saturday. */
|
|
67
|
+
daysOfWeek: number[];
|
|
68
|
+
/** Start of the slot, `HH:mm` (24h). */
|
|
69
|
+
startTime: string;
|
|
70
|
+
/** End of the slot, `HH:mm` (24h). */
|
|
71
|
+
endTime: string;
|
|
72
|
+
}
|
|
73
|
+
type AvailabilitySchedule = AvailabilitySlot[];
|
|
49
74
|
type CalendarUpdateSource = 'mini' | 'macro' | 'system';
|
|
50
75
|
interface SlotActionState {
|
|
51
76
|
isOpen: boolean;
|
|
@@ -74,10 +99,76 @@ interface EventTimeChangePayload<E> {
|
|
|
74
99
|
revert: () => void;
|
|
75
100
|
}
|
|
76
101
|
|
|
102
|
+
interface EventListRowMessages {
|
|
103
|
+
edit?: (title: string) => string;
|
|
104
|
+
delete?: (title: string) => string;
|
|
105
|
+
}
|
|
106
|
+
interface EventListRowProps<Status extends string, E extends BaseCalendarEvent<Status>> {
|
|
107
|
+
event: E;
|
|
108
|
+
onEdit: (event: E) => void;
|
|
109
|
+
onDelete: (event: E) => void;
|
|
110
|
+
locale?: string;
|
|
111
|
+
/** Map of status → label override for the EventStatusBadge. */
|
|
112
|
+
statusLabels?: Partial<Record<Status, string>>;
|
|
113
|
+
/** Domain-specific meta (event type, modality…). Same contract as MacroCalendar. */
|
|
114
|
+
renderEventMeta?: (event: E) => ReactNode;
|
|
115
|
+
messages?: EventListRowMessages;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Single row of the agenda/list view: time chip on the left, title + meta in
|
|
119
|
+
* the middle, status badge + actions on the right — matching the Figma agenda
|
|
120
|
+
* layout. Rendered by `EventAgendaList`; usable standalone.
|
|
121
|
+
*/
|
|
122
|
+
declare const EventListRow: <Status extends string, E extends BaseCalendarEvent<Status>>({ event, onEdit, onDelete, locale, statusLabels, renderEventMeta, messages, }: EventListRowProps<Status, E>) => react_jsx_runtime.JSX.Element;
|
|
123
|
+
|
|
124
|
+
interface EventAgendaListMessages extends EventListRowMessages {
|
|
125
|
+
/** Empty placeholder per day when there are events elsewhere in the range. */
|
|
126
|
+
noEventsForDay?: string;
|
|
127
|
+
/** Global empty state when no events in the entire range. */
|
|
128
|
+
noEvents?: string;
|
|
129
|
+
}
|
|
130
|
+
interface EventAgendaListDayInfo<E> {
|
|
131
|
+
hasEvents: boolean;
|
|
132
|
+
events: E[];
|
|
133
|
+
}
|
|
134
|
+
interface EventAgendaListProps<Status extends string, E extends BaseCalendarEvent<Status>> {
|
|
135
|
+
events: E[];
|
|
136
|
+
/** Half-open `[start, end)` window — all days in between are rendered. */
|
|
137
|
+
range: {
|
|
138
|
+
start: Date;
|
|
139
|
+
end: Date;
|
|
140
|
+
};
|
|
141
|
+
/** BCP-47 locale string. Default: `'es-CO'`. */
|
|
142
|
+
locale?: string;
|
|
143
|
+
statusLabels?: Partial<Record<Status, string>>;
|
|
144
|
+
renderEventMeta?: (event: E) => ReactNode;
|
|
145
|
+
/**
|
|
146
|
+
* Slot rendered between the day anchor and the event list — used by portals
|
|
147
|
+
* to inject availability pills ("Horario de atención" / "No tenemos atención")
|
|
148
|
+
* or any other per-day header. The library does NOT derive this from the
|
|
149
|
+
* `availability` prop; the portal decides.
|
|
150
|
+
*/
|
|
151
|
+
renderDayHeader?: (date: Date, info: EventAgendaListDayInfo<E>) => ReactNode;
|
|
152
|
+
onEditEvent: (event: E) => void;
|
|
153
|
+
onDeleteEvent: (event: E) => void;
|
|
154
|
+
messages?: EventAgendaListMessages;
|
|
155
|
+
className?: string;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Day-grouped agenda list — the calendar's "list" view. Each day renders a
|
|
159
|
+
* left anchor (number + short month + weekday) and a stack of {@link EventListRow}s.
|
|
160
|
+
* Empty days still render so the consumer can show a "no attention" pill via
|
|
161
|
+
* the `renderDayHeader` slot.
|
|
162
|
+
*/
|
|
163
|
+
declare const EventAgendaList: <Status extends string, E extends BaseCalendarEvent<Status>>({ events, range, locale, statusLabels, renderEventMeta, renderDayHeader, onEditEvent, onDeleteEvent, messages, className, }: EventAgendaListProps<Status, E>) => react_jsx_runtime.JSX.Element;
|
|
164
|
+
|
|
77
165
|
interface MacroCalendarMessages {
|
|
78
|
-
|
|
166
|
+
/** `+N more` link. String form interpolates `{count}`; function form receives the count. */
|
|
167
|
+
moreLink?: string | ((count: number) => string);
|
|
79
168
|
allDayText?: string;
|
|
80
169
|
todayHeaderAria?: string;
|
|
170
|
+
/** Empty-state text shown by the list view when there are no events in range. */
|
|
171
|
+
noEvents?: string;
|
|
81
172
|
}
|
|
82
173
|
interface MacroCalendarProps<Status extends string, E extends BaseCalendarEvent<Status>> {
|
|
83
174
|
events: E[];
|
|
@@ -101,14 +192,39 @@ interface MacroCalendarProps<Status extends string, E extends BaseCalendarEvent<
|
|
|
101
192
|
fullCalendarLocale?: LocaleInput;
|
|
102
193
|
/** First day of the week (0=Sunday, 1=Monday, etc.). Default: 1. */
|
|
103
194
|
firstDay?: number;
|
|
195
|
+
/** Availability ("horario de atención") band painted as a subtle time-grid background. */
|
|
196
|
+
availability?: AvailabilitySchedule;
|
|
104
197
|
statusLabels?: Partial<Record<Status, string>>;
|
|
105
198
|
renderEventMeta?: (event: E) => ReactNode;
|
|
199
|
+
/** Custom render for a day-column header. Falls back to the built-in header when omitted. */
|
|
200
|
+
renderDayHeader?: (date: Date, info: {
|
|
201
|
+
isToday: boolean;
|
|
202
|
+
}) => ReactNode;
|
|
203
|
+
/**
|
|
204
|
+
* Per-day header slot for the agenda/list view (e.g. "Horario de atención"
|
|
205
|
+
* pill, "No tenemos atención"…). The library does not derive this from the
|
|
206
|
+
* `availability` prop — the portal decides.
|
|
207
|
+
*/
|
|
208
|
+
renderAgendaDayHeader?: (date: Date, info: EventAgendaListDayInfo<E>) => ReactNode;
|
|
106
209
|
messages?: MacroCalendarMessages;
|
|
107
210
|
/** Status values that cannot be dragged. Default: `['archived']`. */
|
|
108
211
|
immutableStatuses?: Status[];
|
|
212
|
+
/** Extra guard for moving/resizing an event. Composed (AND) with `immutableStatuses`. */
|
|
213
|
+
eventAllow?: (event: E, startAt: string, endAt: string) => boolean;
|
|
214
|
+
/** Height passed to FullCalendar. Default: `'100%'` (requires a sized parent). */
|
|
215
|
+
height?: number | string;
|
|
216
|
+
/** Duration of the just-created/moved highlight flash, in ms. Default: `650`. */
|
|
217
|
+
highlightDurationMs?: number;
|
|
218
|
+
/** Time-grid row height as `HH:mm:ss`. Default: `'00:30:00'`. */
|
|
219
|
+
slotDuration?: string;
|
|
220
|
+
/**
|
|
221
|
+
* Drag/resize granularity as `HH:mm:ss`. Default: `'00:15:00'`. Values below
|
|
222
|
+
* 5 min may feel nervous when dragging.
|
|
223
|
+
*/
|
|
224
|
+
snapDuration?: string;
|
|
109
225
|
className?: string;
|
|
110
226
|
}
|
|
111
|
-
declare const MacroCalendar: <Status extends string, E extends BaseCalendarEvent<Status>>({ events, activeView, selectedDate, highlightEventIds, onDeleteEvent, onEditEvent, onEventTimeChange, onDateClick, onDateSelected, onVisibleRangeChange, onSwitchToDay, locale, fullCalendarLocale, firstDay, statusLabels, renderEventMeta, messages, immutableStatuses, className, }: MacroCalendarProps<Status, E>) => react_jsx_runtime.JSX.Element;
|
|
227
|
+
declare const MacroCalendar: <Status extends string, E extends BaseCalendarEvent<Status>>({ events, activeView, selectedDate, highlightEventIds, onDeleteEvent, onEditEvent, onEventTimeChange, onDateClick, onDateSelected, onVisibleRangeChange, onSwitchToDay, locale, fullCalendarLocale, firstDay, availability, statusLabels, renderEventMeta, renderDayHeader, renderAgendaDayHeader, messages, immutableStatuses, eventAllow, height, highlightDurationMs, slotDuration, snapDuration, className, }: MacroCalendarProps<Status, E>) => react_jsx_runtime.JSX.Element;
|
|
112
228
|
|
|
113
229
|
interface MiniMonthCalendarMessages {
|
|
114
230
|
previousMonth?: string;
|
|
@@ -139,16 +255,33 @@ declare const MiniMonthCalendar: <Status extends string = string>({ selectedDate
|
|
|
139
255
|
interface CalendarToolbarMessages {
|
|
140
256
|
groupAriaLabel?: string;
|
|
141
257
|
newEvent?: string;
|
|
258
|
+
today?: string;
|
|
259
|
+
previous?: string;
|
|
260
|
+
next?: string;
|
|
142
261
|
views?: Partial<Record<CalendarView, string>>;
|
|
143
262
|
}
|
|
144
263
|
interface CalendarToolbarProps {
|
|
145
264
|
activeView: CalendarView;
|
|
146
265
|
onChangeView: (view: CalendarView) => void;
|
|
266
|
+
/**
|
|
267
|
+
* View buttons to show, in order. Default: `['month', 'week', 'list']`. The
|
|
268
|
+
* `week` button represents the day/week time grid (it stays active in `day`
|
|
269
|
+
* view too); `day` itself is reached via the "Hoy" control, not a button.
|
|
270
|
+
*/
|
|
271
|
+
views?: CalendarView[];
|
|
272
|
+
/** Emits a navigation intent. Wire with `shiftDate(selectedDate, activeView, dir)`. */
|
|
273
|
+
onNavigate?: (direction: CalendarNavDirection) => void;
|
|
274
|
+
/** Highlights the "Hoy" button as active (e.g. day view focused on today). */
|
|
275
|
+
todayActive?: boolean;
|
|
276
|
+
/** Current period label (e.g. "Mayo 2026") rendered next to the nav controls. */
|
|
277
|
+
periodLabel?: ReactNode;
|
|
278
|
+
/** Slot for consumer-owned filters (status, regional…). Rendered between nav and views. */
|
|
279
|
+
filtersSlot?: ReactNode;
|
|
147
280
|
onNewEvent?: () => void;
|
|
148
281
|
messages?: CalendarToolbarMessages;
|
|
149
282
|
className?: string;
|
|
150
283
|
}
|
|
151
|
-
declare const CalendarToolbar: ({ activeView, onChangeView, onNewEvent, messages, className, }: CalendarToolbarProps) => react_jsx_runtime.JSX.Element;
|
|
284
|
+
declare const CalendarToolbar: ({ activeView, onChangeView, views, onNavigate, todayActive, periodLabel, filtersSlot, onNewEvent, messages, className, }: CalendarToolbarProps) => react_jsx_runtime.JSX.Element;
|
|
152
285
|
|
|
153
286
|
interface EventChipPopoverMessages {
|
|
154
287
|
edit?: string;
|
|
@@ -201,6 +334,53 @@ interface EventBlockContentProps<Status extends string, E extends BaseCalendarEv
|
|
|
201
334
|
}
|
|
202
335
|
declare const EventBlockContent: <Status extends string, E extends BaseCalendarEvent<Status>>({ event, onEdit, onDelete, locale, statusLabels, messages, }: EventBlockContentProps<Status, E>) => react_jsx_runtime.JSX.Element;
|
|
203
336
|
|
|
337
|
+
interface EventTypeFilterItem {
|
|
338
|
+
id: string;
|
|
339
|
+
label: string;
|
|
340
|
+
/** Optional leading icon. When omitted, a colored dot is shown. */
|
|
341
|
+
icon?: ReactNode;
|
|
342
|
+
/** Optional dot color (any CSS color). Used when `icon` is absent. */
|
|
343
|
+
color?: string;
|
|
344
|
+
/** Optional count shown on the right (e.g. number of events of this type). */
|
|
345
|
+
count?: number;
|
|
346
|
+
}
|
|
347
|
+
interface EventTypeFilterListProps {
|
|
348
|
+
items: EventTypeFilterItem[];
|
|
349
|
+
/** Currently selected item ids. An empty array means "all". */
|
|
350
|
+
selectedIds: string[];
|
|
351
|
+
onToggle: (id: string) => void;
|
|
352
|
+
className?: string;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Sidebar list to filter events by type, with optional counts (as in the
|
|
356
|
+
* agenda designs). A building block — not a layout wrapper. The consumer owns
|
|
357
|
+
* the actual filtering and the surrounding sidebar.
|
|
358
|
+
*/
|
|
359
|
+
declare const EventTypeFilterList: ({ items, selectedIds, onToggle, className, }: EventTypeFilterListProps) => react_jsx_runtime.JSX.Element;
|
|
360
|
+
|
|
361
|
+
interface StatusFilterOption<Status extends string> {
|
|
362
|
+
status: Status;
|
|
363
|
+
label: string;
|
|
364
|
+
/** Optional dot color (any CSS color). */
|
|
365
|
+
color?: string;
|
|
366
|
+
}
|
|
367
|
+
interface StatusFilterSelectProps<Status extends string> {
|
|
368
|
+
options: StatusFilterOption<Status>[];
|
|
369
|
+
/** Currently selected statuses. An empty array means "all". */
|
|
370
|
+
selected: Status[];
|
|
371
|
+
onToggle: (status: Status) => void;
|
|
372
|
+
/** Always-visible trigger label. Default: `"Estado del evento"`. */
|
|
373
|
+
placeholder?: string;
|
|
374
|
+
className?: string;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Multi-select dropdown to filter events by status (the "Estado del evento"
|
|
378
|
+
* control in the toolbar). The placeholder stays visible at all times; a count
|
|
379
|
+
* badge reflects how many statuses are active. Generic over the consumer's
|
|
380
|
+
* status union — emits toggle intents, the consumer owns the filtering.
|
|
381
|
+
*/
|
|
382
|
+
declare const StatusFilterSelect: <Status extends string>({ options, selected, onToggle, placeholder, className, }: StatusFilterSelectProps<Status>) => react_jsx_runtime.JSX.Element;
|
|
383
|
+
|
|
204
384
|
interface MoreEventsPopoverMessages {
|
|
205
385
|
header?: (count: number) => string;
|
|
206
386
|
editAria?: (title: string) => string;
|
|
@@ -269,9 +449,13 @@ declare const EventStatusBadge: <Status extends string = string>({ status, label
|
|
|
269
449
|
interface EventTypeChipProps {
|
|
270
450
|
label: string;
|
|
271
451
|
icon?: ReactNode;
|
|
452
|
+
/** When provided, renders a ✕ button that fires this callback (e.g. clear the filter). */
|
|
453
|
+
onRemove?: () => void;
|
|
454
|
+
/** Accessible label for the remove button. Default: `"Remove"`. */
|
|
455
|
+
removeLabel?: string;
|
|
272
456
|
className?: string;
|
|
273
457
|
}
|
|
274
|
-
declare const EventTypeChip: ({ label, icon, className }: EventTypeChipProps) => react_jsx_runtime.JSX.Element;
|
|
458
|
+
declare const EventTypeChip: ({ label, icon, onRemove, removeLabel, className, }: EventTypeChipProps) => react_jsx_runtime.JSX.Element;
|
|
275
459
|
|
|
276
460
|
interface EmptyEventsStateProps {
|
|
277
461
|
title?: string;
|
|
@@ -288,7 +472,7 @@ declare const PopoverPortal: react.FC<PopoverPrimitive.PopoverPortalProps>;
|
|
|
288
472
|
declare const PopoverClose: react.ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & react.RefAttributes<HTMLButtonElement>>;
|
|
289
473
|
declare const PopoverContent: react.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
290
474
|
|
|
291
|
-
type ButtonVariant = 'primary' | 'secondary' | 'ghost';
|
|
475
|
+
type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost';
|
|
292
476
|
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
293
477
|
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
294
478
|
variant?: ButtonVariant;
|
|
@@ -299,8 +483,86 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
299
483
|
}
|
|
300
484
|
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
301
485
|
|
|
486
|
+
interface SelectOption<T extends string> {
|
|
487
|
+
value: T;
|
|
488
|
+
label: string;
|
|
489
|
+
/** Optional dot color (any CSS color). Used when `icon` is absent. */
|
|
490
|
+
color?: string;
|
|
491
|
+
/** Optional leading icon. Takes precedence over `color`. */
|
|
492
|
+
icon?: ReactNode;
|
|
493
|
+
}
|
|
494
|
+
interface SelectBaseProps<T extends string> {
|
|
495
|
+
/** Always-visible label on the trigger (never replaced by the selection). */
|
|
496
|
+
placeholder: string;
|
|
497
|
+
options: SelectOption<T>[];
|
|
498
|
+
align?: 'start' | 'center' | 'end';
|
|
499
|
+
className?: string;
|
|
500
|
+
'aria-label'?: string;
|
|
501
|
+
}
|
|
502
|
+
interface SelectSingleProps<T extends string> extends SelectBaseProps<T> {
|
|
503
|
+
multiple?: false;
|
|
504
|
+
value: T | null;
|
|
505
|
+
onChange: (value: T | null) => void;
|
|
506
|
+
/** Re-clicking the active option clears it. Default: `true`. */
|
|
507
|
+
clearable?: boolean;
|
|
508
|
+
}
|
|
509
|
+
interface SelectMultipleProps<T extends string> extends SelectBaseProps<T> {
|
|
510
|
+
multiple: true;
|
|
511
|
+
/** Selected values. Empty means "all" — the consumer owns the filtering. */
|
|
512
|
+
value: T[];
|
|
513
|
+
onToggle: (value: T) => void;
|
|
514
|
+
}
|
|
515
|
+
type SelectProps<T extends string> = SelectSingleProps<T> | SelectMultipleProps<T>;
|
|
516
|
+
/**
|
|
517
|
+
* Popover-backed listbox dropdown. The trigger keeps `placeholder` visible at
|
|
518
|
+
* all times; multi mode shows a count badge, single mode appends the chosen
|
|
519
|
+
* label. Built on the {@link Popover} primitive (no extra Radix deps). Generic
|
|
520
|
+
* over the consumer's value union — emits intents, never owns selection state.
|
|
521
|
+
*/
|
|
522
|
+
declare const Select: <T extends string>(props: SelectProps<T>) => react_jsx_runtime.JSX.Element;
|
|
523
|
+
|
|
302
524
|
declare const APE_CALENDAR_ROOT_CLASS = "ape-calendar";
|
|
303
525
|
|
|
526
|
+
interface UseCalendarControllerOptions {
|
|
527
|
+
/** View the calendar starts on. Default: `'week'`. */
|
|
528
|
+
initialView?: CalendarView;
|
|
529
|
+
/** Date the calendar starts on. Default: now. */
|
|
530
|
+
initialDate?: Date;
|
|
531
|
+
/** First day of the week (0=Sunday … 6=Saturday). Default: `1`. */
|
|
532
|
+
firstDay?: number;
|
|
533
|
+
/** BCP-47 locale used to build {@link CalendarController.periodLabel}. Default: `'es-CO'`. */
|
|
534
|
+
locale?: string;
|
|
535
|
+
}
|
|
536
|
+
interface CalendarController {
|
|
537
|
+
activeView: CalendarView;
|
|
538
|
+
selectedDate: Date;
|
|
539
|
+
/** Last range reported by the calendar (kept in sync via `onVisibleRangeChange`). */
|
|
540
|
+
visibleRange: CalendarVisibleRange;
|
|
541
|
+
/** Localized label for the current period — spread onto `CalendarToolbar.periodLabel`. */
|
|
542
|
+
periodLabel: string;
|
|
543
|
+
/** True when the "Hoy" control is the active state (day view on today). */
|
|
544
|
+
todayActive: boolean;
|
|
545
|
+
onChangeView: (view: CalendarView) => void;
|
|
546
|
+
onNavigate: (direction: CalendarNavDirection) => void;
|
|
547
|
+
onSelectDate: (date: Date) => void;
|
|
548
|
+
onVisibleRangeChange: (start: Date, end: Date) => void;
|
|
549
|
+
onToday: () => void;
|
|
550
|
+
setActiveView: (view: CalendarView) => void;
|
|
551
|
+
setSelectedDate: (date: Date) => void;
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* Encapsulates the calendar's view/date state and the opinionated navigation
|
|
555
|
+
* behavior so every portal behaves identically:
|
|
556
|
+
*
|
|
557
|
+
* - "Hoy" jumps to today in day view (re-pressing it falls back to week).
|
|
558
|
+
* - Picking a day from the month or list view opens that day's week.
|
|
559
|
+
* - prev/next step by the current view (via {@link shiftDate}).
|
|
560
|
+
*
|
|
561
|
+
* The calendar stays fully controlled — this hook owns the consumer-side state
|
|
562
|
+
* and returns handlers to spread onto `CalendarToolbar` and `MacroCalendar`.
|
|
563
|
+
*/
|
|
564
|
+
declare const useCalendarController: ({ initialView, initialDate, firstDay, locale, }?: UseCalendarControllerOptions) => CalendarController;
|
|
565
|
+
|
|
304
566
|
declare const toDayKey: (date: Date) => DayKey;
|
|
305
567
|
declare const isSameDay: (left: Date, right: Date) => boolean;
|
|
306
568
|
/**
|
|
@@ -326,5 +588,35 @@ declare const formatDurationLabel: (durationMinutes: number, messages?: {
|
|
|
326
588
|
min?: string;
|
|
327
589
|
h?: string;
|
|
328
590
|
}) => string;
|
|
591
|
+
/**
|
|
592
|
+
* Maps an {@link AvailabilitySchedule} to FullCalendar's `businessHours` input.
|
|
593
|
+
* Useful when a consumer wants to constrain selection/dragging to the available
|
|
594
|
+
* window. Note: FullCalendar shades the NON-business area when this is set —
|
|
595
|
+
* for the colored "horario de atención" band use {@link mapAvailabilityToBackgroundEvents}.
|
|
596
|
+
*/
|
|
597
|
+
declare const mapAvailabilityToBusinessHours: (schedule: AvailabilitySchedule) => BusinessHoursInput;
|
|
598
|
+
/**
|
|
599
|
+
* Maps an {@link AvailabilitySchedule} to recurring FullCalendar background
|
|
600
|
+
* events, used to paint the colored availability band in time-grid views. The
|
|
601
|
+
* band color is driven by the `cal-availability-band` class (CSS var
|
|
602
|
+
* `--cal-availability-bg`) so it stays themeable.
|
|
603
|
+
*/
|
|
604
|
+
declare const mapAvailabilityToBackgroundEvents: (schedule: AvailabilitySchedule) => EventInput[];
|
|
605
|
+
/**
|
|
606
|
+
* Returns the half-open `[start, end)` range of the week that contains `date`.
|
|
607
|
+
* `firstDay` follows the same convention as FullCalendar (0=Sunday … 6=Saturday).
|
|
608
|
+
* Start is set to midnight of the week's first day; end is midnight 7 days later.
|
|
609
|
+
* Used by the agenda list to derive its visible window from `selectedDate`.
|
|
610
|
+
*/
|
|
611
|
+
declare const getWeekRange: (date: Date, firstDay?: number) => {
|
|
612
|
+
start: Date;
|
|
613
|
+
end: Date;
|
|
614
|
+
};
|
|
615
|
+
/**
|
|
616
|
+
* Returns the date a calendar should jump to when the user navigates one step
|
|
617
|
+
* in the given view. `today` always resolves to now. Used by the toolbar's
|
|
618
|
+
* prev/next/today controls (the calendar is date-controlled by the consumer).
|
|
619
|
+
*/
|
|
620
|
+
declare const shiftDate: (date: Date, view: CalendarView, direction: CalendarNavDirection) => Date;
|
|
329
621
|
|
|
330
|
-
export { APE_CALENDAR_ROOT_CLASS, type BaseCalendarEvent, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CalendarToolbar, type CalendarToolbarMessages, type CalendarToolbarProps, type CalendarUpdateSource, type CalendarView, type CalendarVisibleRange, DayEventDot, type DayEventDotProps, type DayKey, type DefaultEventStatus, EmptyEventsState, type EmptyEventsStateProps, EventBlockContent, type EventBlockContentMessages, type EventBlockContentProps, EventChipMonth, type EventChipMonthProps, EventChipPopover, type EventChipPopoverMessages, type EventChipPopoverProps, EventStatusBadge, type EventStatusBadgeProps, type EventTimeChangePayload, EventTypeChip, type EventTypeChipProps, MacroCalendar, type MacroCalendarMessages, type MacroCalendarProps, MiniMonthCalendar, type MiniMonthCalendarMessages, type MiniMonthCalendarProps, MoreEventsPopover, type MoreEventsPopoverMessages, type MoreEventsPopoverProps, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, type SlotAction, type SlotActionPayload, type SlotActionState, SlotContextActions, type SlotContextActionsMessages, type SlotContextActionsProps, formatDurationLabel, formatHourLabel, getEventDayKeys, getEventDayStatuses, isSameDay, mapEventToCalendarInput, toDayKey };
|
|
622
|
+
export { APE_CALENDAR_ROOT_CLASS, type AvailabilitySchedule, type AvailabilitySlot, type BaseCalendarEvent, Button, type ButtonProps, type ButtonSize, type ButtonVariant, type CalendarController, type CalendarNavDirection, CalendarToolbar, type CalendarToolbarMessages, type CalendarToolbarProps, type CalendarUpdateSource, type CalendarView, type CalendarVisibleRange, DayEventDot, type DayEventDotProps, type DayKey, type DefaultEventStatus, EmptyEventsState, type EmptyEventsStateProps, EventAgendaList, type EventAgendaListDayInfo, type EventAgendaListMessages, type EventAgendaListProps, EventBlockContent, type EventBlockContentMessages, type EventBlockContentProps, EventChipMonth, type EventChipMonthProps, EventChipPopover, type EventChipPopoverMessages, type EventChipPopoverProps, EventListRow, type EventListRowMessages, type EventListRowProps, EventStatusBadge, type EventStatusBadgeProps, type EventTimeChangePayload, EventTypeChip, type EventTypeChipProps, type EventTypeFilterItem, EventTypeFilterList, type EventTypeFilterListProps, MacroCalendar, type MacroCalendarMessages, type MacroCalendarProps, MiniMonthCalendar, type MiniMonthCalendarMessages, type MiniMonthCalendarProps, MoreEventsPopover, type MoreEventsPopoverMessages, type MoreEventsPopoverProps, Popover, PopoverAnchor, PopoverClose, PopoverContent, PopoverPortal, PopoverTrigger, Select, type SelectMultipleProps, type SelectOption, type SelectProps, type SelectSingleProps, type SlotAction, type SlotActionPayload, type SlotActionState, SlotContextActions, type SlotContextActionsMessages, type SlotContextActionsProps, type StatusFilterOption, StatusFilterSelect, type StatusFilterSelectProps, type UseCalendarControllerOptions, formatDurationLabel, formatHourLabel, getEventDayKeys, getEventDayStatuses, getWeekRange, isSameDay, mapAvailabilityToBackgroundEvents, mapAvailabilityToBusinessHours, mapEventToCalendarInput, shiftDate, toDayKey, useCalendarController };
|