ape-calendar 0.3.0 → 0.6.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 +90 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +305 -9
- package/dist/index.d.ts +305 -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' | 'cancelled';
|
|
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,11 +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. */
|
|
79
167
|
moreLink?: string | ((count: number) => string);
|
|
80
168
|
allDayText?: string;
|
|
81
169
|
todayHeaderAria?: string;
|
|
170
|
+
/** Empty-state text shown by the list view when there are no events in range. */
|
|
171
|
+
noEvents?: string;
|
|
82
172
|
}
|
|
83
173
|
interface MacroCalendarProps<Status extends string, E extends BaseCalendarEvent<Status>> {
|
|
84
174
|
events: E[];
|
|
@@ -102,12 +192,20 @@ interface MacroCalendarProps<Status extends string, E extends BaseCalendarEvent<
|
|
|
102
192
|
fullCalendarLocale?: LocaleInput;
|
|
103
193
|
/** First day of the week (0=Sunday, 1=Monday, etc.). Default: 1. */
|
|
104
194
|
firstDay?: number;
|
|
195
|
+
/** Availability ("horario de atención") band painted as a subtle time-grid background. */
|
|
196
|
+
availability?: AvailabilitySchedule;
|
|
105
197
|
statusLabels?: Partial<Record<Status, string>>;
|
|
106
198
|
renderEventMeta?: (event: E) => ReactNode;
|
|
107
199
|
/** Custom render for a day-column header. Falls back to the built-in header when omitted. */
|
|
108
200
|
renderDayHeader?: (date: Date, info: {
|
|
109
201
|
isToday: boolean;
|
|
110
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;
|
|
111
209
|
messages?: MacroCalendarMessages;
|
|
112
210
|
/** Status values that cannot be dragged. Default: `['archived']`. */
|
|
113
211
|
immutableStatuses?: Status[];
|
|
@@ -117,9 +215,16 @@ interface MacroCalendarProps<Status extends string, E extends BaseCalendarEvent<
|
|
|
117
215
|
height?: number | string;
|
|
118
216
|
/** Duration of the just-created/moved highlight flash, in ms. Default: `650`. */
|
|
119
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;
|
|
120
225
|
className?: string;
|
|
121
226
|
}
|
|
122
|
-
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, renderDayHeader, messages, immutableStatuses, eventAllow, height, highlightDurationMs, 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;
|
|
123
228
|
|
|
124
229
|
interface MiniMonthCalendarMessages {
|
|
125
230
|
previousMonth?: string;
|
|
@@ -143,23 +248,55 @@ interface MiniMonthCalendarProps<Status extends string = string> {
|
|
|
143
248
|
messages?: MiniMonthCalendarMessages;
|
|
144
249
|
/** Optional map of status → CSS color override. Falls back to CSS vars. */
|
|
145
250
|
statusColors?: Partial<Record<Status, string>>;
|
|
251
|
+
/**
|
|
252
|
+
* Visual variant. `'card'` (default) renders each day as a boxed cell on a
|
|
253
|
+
* subtle surface — the original look. `'flat'` renders plain days on a white
|
|
254
|
+
* surface (agenda sidebar design). Opt-in: existing consumers are unaffected.
|
|
255
|
+
*/
|
|
256
|
+
variant?: 'card' | 'flat';
|
|
257
|
+
/**
|
|
258
|
+
* When set, the week row containing this date is highlighted with a rounded
|
|
259
|
+
* band (typically the consumer's `selectedDate`). Off when omitted.
|
|
260
|
+
*/
|
|
261
|
+
highlightWeekOf?: Date;
|
|
262
|
+
/** First day of the week for the highlighted band (0=Sunday … 6=Saturday). Default: `1`. */
|
|
263
|
+
firstDay?: number;
|
|
264
|
+
/** Show the leading/trailing days of adjacent months. Default: `false`. */
|
|
265
|
+
showOutsideDays?: boolean;
|
|
146
266
|
className?: string;
|
|
147
267
|
}
|
|
148
|
-
declare const MiniMonthCalendar: <Status extends string = string>({ selectedDate, visibleMonth, eventDayStatuses, onSelectDate, onMonthChange, locale, pickerLocale, messages, statusColors, className, }: MiniMonthCalendarProps<Status>) => react_jsx_runtime.JSX.Element;
|
|
268
|
+
declare const MiniMonthCalendar: <Status extends string = string>({ selectedDate, visibleMonth, eventDayStatuses, onSelectDate, onMonthChange, locale, pickerLocale, messages, statusColors, variant, highlightWeekOf, firstDay, showOutsideDays, className, }: MiniMonthCalendarProps<Status>) => react_jsx_runtime.JSX.Element;
|
|
149
269
|
|
|
150
270
|
interface CalendarToolbarMessages {
|
|
151
271
|
groupAriaLabel?: string;
|
|
152
272
|
newEvent?: string;
|
|
273
|
+
today?: string;
|
|
274
|
+
previous?: string;
|
|
275
|
+
next?: string;
|
|
153
276
|
views?: Partial<Record<CalendarView, string>>;
|
|
154
277
|
}
|
|
155
278
|
interface CalendarToolbarProps {
|
|
156
279
|
activeView: CalendarView;
|
|
157
280
|
onChangeView: (view: CalendarView) => void;
|
|
281
|
+
/**
|
|
282
|
+
* View buttons to show, in order. Default: `['month', 'week', 'list']`. The
|
|
283
|
+
* `week` button represents the day/week time grid (it stays active in `day`
|
|
284
|
+
* view too); `day` itself is reached via the "Hoy" control, not a button.
|
|
285
|
+
*/
|
|
286
|
+
views?: CalendarView[];
|
|
287
|
+
/** Emits a navigation intent. Wire with `shiftDate(selectedDate, activeView, dir)`. */
|
|
288
|
+
onNavigate?: (direction: CalendarNavDirection) => void;
|
|
289
|
+
/** Highlights the "Hoy" button as active (e.g. day view focused on today). */
|
|
290
|
+
todayActive?: boolean;
|
|
291
|
+
/** Current period label (e.g. "Mayo 2026") rendered next to the nav controls. */
|
|
292
|
+
periodLabel?: ReactNode;
|
|
293
|
+
/** Slot for consumer-owned filters (status, regional…). Rendered between nav and views. */
|
|
294
|
+
filtersSlot?: ReactNode;
|
|
158
295
|
onNewEvent?: () => void;
|
|
159
296
|
messages?: CalendarToolbarMessages;
|
|
160
297
|
className?: string;
|
|
161
298
|
}
|
|
162
|
-
declare const CalendarToolbar: ({ activeView, onChangeView, onNewEvent, messages, className, }: CalendarToolbarProps) => react_jsx_runtime.JSX.Element;
|
|
299
|
+
declare const CalendarToolbar: ({ activeView, onChangeView, views, onNavigate, todayActive, periodLabel, filtersSlot, onNewEvent, messages, className, }: CalendarToolbarProps) => react_jsx_runtime.JSX.Element;
|
|
163
300
|
|
|
164
301
|
interface EventChipPopoverMessages {
|
|
165
302
|
edit?: string;
|
|
@@ -212,6 +349,53 @@ interface EventBlockContentProps<Status extends string, E extends BaseCalendarEv
|
|
|
212
349
|
}
|
|
213
350
|
declare const EventBlockContent: <Status extends string, E extends BaseCalendarEvent<Status>>({ event, onEdit, onDelete, locale, statusLabels, messages, }: EventBlockContentProps<Status, E>) => react_jsx_runtime.JSX.Element;
|
|
214
351
|
|
|
352
|
+
interface EventTypeFilterItem {
|
|
353
|
+
id: string;
|
|
354
|
+
label: string;
|
|
355
|
+
/** Optional leading icon. When omitted, a colored dot is shown. */
|
|
356
|
+
icon?: ReactNode;
|
|
357
|
+
/** Optional dot color (any CSS color). Used when `icon` is absent. */
|
|
358
|
+
color?: string;
|
|
359
|
+
/** Optional count shown on the right (e.g. number of events of this type). */
|
|
360
|
+
count?: number;
|
|
361
|
+
}
|
|
362
|
+
interface EventTypeFilterListProps {
|
|
363
|
+
items: EventTypeFilterItem[];
|
|
364
|
+
/** Currently selected item ids. An empty array means "all". */
|
|
365
|
+
selectedIds: string[];
|
|
366
|
+
onToggle: (id: string) => void;
|
|
367
|
+
className?: string;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Sidebar list to filter events by type, with optional counts (as in the
|
|
371
|
+
* agenda designs). A building block — not a layout wrapper. The consumer owns
|
|
372
|
+
* the actual filtering and the surrounding sidebar.
|
|
373
|
+
*/
|
|
374
|
+
declare const EventTypeFilterList: ({ items, selectedIds, onToggle, className, }: EventTypeFilterListProps) => react_jsx_runtime.JSX.Element;
|
|
375
|
+
|
|
376
|
+
interface StatusFilterOption<Status extends string> {
|
|
377
|
+
status: Status;
|
|
378
|
+
label: string;
|
|
379
|
+
/** Optional dot color (any CSS color). */
|
|
380
|
+
color?: string;
|
|
381
|
+
}
|
|
382
|
+
interface StatusFilterSelectProps<Status extends string> {
|
|
383
|
+
options: StatusFilterOption<Status>[];
|
|
384
|
+
/** Currently selected statuses. An empty array means "all". */
|
|
385
|
+
selected: Status[];
|
|
386
|
+
onToggle: (status: Status) => void;
|
|
387
|
+
/** Always-visible trigger label. Default: `"Estado del evento"`. */
|
|
388
|
+
placeholder?: string;
|
|
389
|
+
className?: string;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Multi-select dropdown to filter events by status (the "Estado del evento"
|
|
393
|
+
* control in the toolbar). The placeholder stays visible at all times; a count
|
|
394
|
+
* badge reflects how many statuses are active. Generic over the consumer's
|
|
395
|
+
* status union — emits toggle intents, the consumer owns the filtering.
|
|
396
|
+
*/
|
|
397
|
+
declare const StatusFilterSelect: <Status extends string>({ options, selected, onToggle, placeholder, className, }: StatusFilterSelectProps<Status>) => react_jsx_runtime.JSX.Element;
|
|
398
|
+
|
|
215
399
|
interface MoreEventsPopoverMessages {
|
|
216
400
|
header?: (count: number) => string;
|
|
217
401
|
editAria?: (title: string) => string;
|
|
@@ -280,9 +464,13 @@ declare const EventStatusBadge: <Status extends string = string>({ status, label
|
|
|
280
464
|
interface EventTypeChipProps {
|
|
281
465
|
label: string;
|
|
282
466
|
icon?: ReactNode;
|
|
467
|
+
/** When provided, renders a ✕ button that fires this callback (e.g. clear the filter). */
|
|
468
|
+
onRemove?: () => void;
|
|
469
|
+
/** Accessible label for the remove button. Default: `"Remove"`. */
|
|
470
|
+
removeLabel?: string;
|
|
283
471
|
className?: string;
|
|
284
472
|
}
|
|
285
|
-
declare const EventTypeChip: ({ label, icon, className }: EventTypeChipProps) => react_jsx_runtime.JSX.Element;
|
|
473
|
+
declare const EventTypeChip: ({ label, icon, onRemove, removeLabel, className, }: EventTypeChipProps) => react_jsx_runtime.JSX.Element;
|
|
286
474
|
|
|
287
475
|
interface EmptyEventsStateProps {
|
|
288
476
|
title?: string;
|
|
@@ -299,7 +487,7 @@ declare const PopoverPortal: react.FC<PopoverPrimitive.PopoverPortalProps>;
|
|
|
299
487
|
declare const PopoverClose: react.ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & react.RefAttributes<HTMLButtonElement>>;
|
|
300
488
|
declare const PopoverContent: react.ForwardRefExoticComponent<Omit<PopoverPrimitive.PopoverContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
301
489
|
|
|
302
|
-
type ButtonVariant = 'primary' | 'secondary' | 'ghost';
|
|
490
|
+
type ButtonVariant = 'primary' | 'secondary' | 'outline' | 'ghost';
|
|
303
491
|
type ButtonSize = 'sm' | 'md' | 'lg';
|
|
304
492
|
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
305
493
|
variant?: ButtonVariant;
|
|
@@ -310,8 +498,86 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
310
498
|
}
|
|
311
499
|
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
312
500
|
|
|
501
|
+
interface SelectOption<T extends string> {
|
|
502
|
+
value: T;
|
|
503
|
+
label: string;
|
|
504
|
+
/** Optional dot color (any CSS color). Used when `icon` is absent. */
|
|
505
|
+
color?: string;
|
|
506
|
+
/** Optional leading icon. Takes precedence over `color`. */
|
|
507
|
+
icon?: ReactNode;
|
|
508
|
+
}
|
|
509
|
+
interface SelectBaseProps<T extends string> {
|
|
510
|
+
/** Always-visible label on the trigger (never replaced by the selection). */
|
|
511
|
+
placeholder: string;
|
|
512
|
+
options: SelectOption<T>[];
|
|
513
|
+
align?: 'start' | 'center' | 'end';
|
|
514
|
+
className?: string;
|
|
515
|
+
'aria-label'?: string;
|
|
516
|
+
}
|
|
517
|
+
interface SelectSingleProps<T extends string> extends SelectBaseProps<T> {
|
|
518
|
+
multiple?: false;
|
|
519
|
+
value: T | null;
|
|
520
|
+
onChange: (value: T | null) => void;
|
|
521
|
+
/** Re-clicking the active option clears it. Default: `true`. */
|
|
522
|
+
clearable?: boolean;
|
|
523
|
+
}
|
|
524
|
+
interface SelectMultipleProps<T extends string> extends SelectBaseProps<T> {
|
|
525
|
+
multiple: true;
|
|
526
|
+
/** Selected values. Empty means "all" — the consumer owns the filtering. */
|
|
527
|
+
value: T[];
|
|
528
|
+
onToggle: (value: T) => void;
|
|
529
|
+
}
|
|
530
|
+
type SelectProps<T extends string> = SelectSingleProps<T> | SelectMultipleProps<T>;
|
|
531
|
+
/**
|
|
532
|
+
* Popover-backed listbox dropdown. The trigger keeps `placeholder` visible at
|
|
533
|
+
* all times; multi mode shows a count badge, single mode appends the chosen
|
|
534
|
+
* label. Built on the {@link Popover} primitive (no extra Radix deps). Generic
|
|
535
|
+
* over the consumer's value union — emits intents, never owns selection state.
|
|
536
|
+
*/
|
|
537
|
+
declare const Select: <T extends string>(props: SelectProps<T>) => react_jsx_runtime.JSX.Element;
|
|
538
|
+
|
|
313
539
|
declare const APE_CALENDAR_ROOT_CLASS = "ape-calendar";
|
|
314
540
|
|
|
541
|
+
interface UseCalendarControllerOptions {
|
|
542
|
+
/** View the calendar starts on. Default: `'week'`. */
|
|
543
|
+
initialView?: CalendarView;
|
|
544
|
+
/** Date the calendar starts on. Default: now. */
|
|
545
|
+
initialDate?: Date;
|
|
546
|
+
/** First day of the week (0=Sunday … 6=Saturday). Default: `1`. */
|
|
547
|
+
firstDay?: number;
|
|
548
|
+
/** BCP-47 locale used to build {@link CalendarController.periodLabel}. Default: `'es-CO'`. */
|
|
549
|
+
locale?: string;
|
|
550
|
+
}
|
|
551
|
+
interface CalendarController {
|
|
552
|
+
activeView: CalendarView;
|
|
553
|
+
selectedDate: Date;
|
|
554
|
+
/** Last range reported by the calendar (kept in sync via `onVisibleRangeChange`). */
|
|
555
|
+
visibleRange: CalendarVisibleRange;
|
|
556
|
+
/** Localized label for the current period — spread onto `CalendarToolbar.periodLabel`. */
|
|
557
|
+
periodLabel: string;
|
|
558
|
+
/** True when the "Hoy" control is the active state (day view on today). */
|
|
559
|
+
todayActive: boolean;
|
|
560
|
+
onChangeView: (view: CalendarView) => void;
|
|
561
|
+
onNavigate: (direction: CalendarNavDirection) => void;
|
|
562
|
+
onSelectDate: (date: Date) => void;
|
|
563
|
+
onVisibleRangeChange: (start: Date, end: Date) => void;
|
|
564
|
+
onToday: () => void;
|
|
565
|
+
setActiveView: (view: CalendarView) => void;
|
|
566
|
+
setSelectedDate: (date: Date) => void;
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Encapsulates the calendar's view/date state and the opinionated navigation
|
|
570
|
+
* behavior so every portal behaves identically:
|
|
571
|
+
*
|
|
572
|
+
* - "Hoy" jumps to today in day view (re-pressing it falls back to week).
|
|
573
|
+
* - Picking a day from the month or list view opens that day's week.
|
|
574
|
+
* - prev/next step by the current view (via {@link shiftDate}).
|
|
575
|
+
*
|
|
576
|
+
* The calendar stays fully controlled — this hook owns the consumer-side state
|
|
577
|
+
* and returns handlers to spread onto `CalendarToolbar` and `MacroCalendar`.
|
|
578
|
+
*/
|
|
579
|
+
declare const useCalendarController: ({ initialView, initialDate, firstDay, locale, }?: UseCalendarControllerOptions) => CalendarController;
|
|
580
|
+
|
|
315
581
|
declare const toDayKey: (date: Date) => DayKey;
|
|
316
582
|
declare const isSameDay: (left: Date, right: Date) => boolean;
|
|
317
583
|
/**
|
|
@@ -337,5 +603,35 @@ declare const formatDurationLabel: (durationMinutes: number, messages?: {
|
|
|
337
603
|
min?: string;
|
|
338
604
|
h?: string;
|
|
339
605
|
}) => string;
|
|
606
|
+
/**
|
|
607
|
+
* Maps an {@link AvailabilitySchedule} to FullCalendar's `businessHours` input.
|
|
608
|
+
* Useful when a consumer wants to constrain selection/dragging to the available
|
|
609
|
+
* window. Note: FullCalendar shades the NON-business area when this is set —
|
|
610
|
+
* for the colored "horario de atención" band use {@link mapAvailabilityToBackgroundEvents}.
|
|
611
|
+
*/
|
|
612
|
+
declare const mapAvailabilityToBusinessHours: (schedule: AvailabilitySchedule) => BusinessHoursInput;
|
|
613
|
+
/**
|
|
614
|
+
* Maps an {@link AvailabilitySchedule} to recurring FullCalendar background
|
|
615
|
+
* events, used to paint the colored availability band in time-grid views. The
|
|
616
|
+
* band color is driven by the `cal-availability-band` class (CSS var
|
|
617
|
+
* `--cal-availability-bg`) so it stays themeable.
|
|
618
|
+
*/
|
|
619
|
+
declare const mapAvailabilityToBackgroundEvents: (schedule: AvailabilitySchedule) => EventInput[];
|
|
620
|
+
/**
|
|
621
|
+
* Returns the half-open `[start, end)` range of the week that contains `date`.
|
|
622
|
+
* `firstDay` follows the same convention as FullCalendar (0=Sunday … 6=Saturday).
|
|
623
|
+
* Start is set to midnight of the week's first day; end is midnight 7 days later.
|
|
624
|
+
* Used by the agenda list to derive its visible window from `selectedDate`.
|
|
625
|
+
*/
|
|
626
|
+
declare const getWeekRange: (date: Date, firstDay?: number) => {
|
|
627
|
+
start: Date;
|
|
628
|
+
end: Date;
|
|
629
|
+
};
|
|
630
|
+
/**
|
|
631
|
+
* Returns the date a calendar should jump to when the user navigates one step
|
|
632
|
+
* in the given view. `today` always resolves to now. Used by the toolbar's
|
|
633
|
+
* prev/next/today controls (the calendar is date-controlled by the consumer).
|
|
634
|
+
*/
|
|
635
|
+
declare const shiftDate: (date: Date, view: CalendarView, direction: CalendarNavDirection) => Date;
|
|
340
636
|
|
|
341
|
-
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 };
|
|
637
|
+
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 };
|