@burdenoff/microfe-calendar 2026.1123.3 → 2026.1124.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AgendaView.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +785 -0
- package/dist/generated/wspace-operations.js +250 -84
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +1243 -10
- package/dist/hooks/useSafePermissions.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/providers/CalendarProvider.d.ts +3 -1
- package/dist/providers/CalendarProvider.js +12 -10
- package/dist/providers/CalendarProvider.js.map +1 -1
- package/dist/translations/en.d.ts +351 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/v2/CalendarPageV2.js +92 -14
- package/dist/v2/CalendarPageV2.js.map +1 -1
- package/dist/v2/colors.d.ts +23 -0
- package/dist/v2/colors.js +92 -0
- package/dist/v2/colors.js.map +1 -0
- package/dist/v2/data/enums.d.ts +6 -0
- package/dist/v2/data/enums.js +10 -0
- package/dist/v2/data/enums.js.map +1 -0
- package/dist/v2/data/errors.d.ts +4 -0
- package/dist/v2/data/errors.js +17 -0
- package/dist/v2/data/errors.js.map +1 -0
- package/dist/v2/data/invalidation.js +19 -0
- package/dist/v2/data/invalidation.js.map +1 -0
- package/dist/v2/data/normalize.js +181 -16
- package/dist/v2/data/normalize.js.map +1 -1
- package/dist/v2/data/serialWrites.d.ts +17 -0
- package/dist/v2/data/serialWrites.js +21 -0
- package/dist/v2/data/serialWrites.js.map +1 -0
- package/dist/v2/data/useCalendarsV2.d.ts +10 -1
- package/dist/v2/data/useCalendarsV2.js +68 -16
- package/dist/v2/data/useCalendarsV2.js.map +1 -1
- package/dist/v2/data/useEventActions.d.ts +49 -0
- package/dist/v2/data/useEventActions.js +399 -0
- package/dist/v2/data/useEventActions.js.map +1 -0
- package/dist/v2/data/useEventForPeek.d.ts +17 -0
- package/dist/v2/data/useEventForPeek.js +29 -0
- package/dist/v2/data/useEventForPeek.js.map +1 -0
- package/dist/v2/data/useEventSearchV2.d.ts +15 -0
- package/dist/v2/data/useEventSearchV2.js +80 -0
- package/dist/v2/data/useEventSearchV2.js.map +1 -0
- package/dist/v2/data/useEventsInRangeV2.js +78 -0
- package/dist/v2/data/useEventsInRangeV2.js.map +1 -0
- package/dist/v2/data/useFreeBusy.d.ts +5 -0
- package/dist/v2/data/useFreeBusy.js +83 -0
- package/dist/v2/data/useFreeBusy.js.map +1 -0
- package/dist/v2/data/useKeyedLoad.js +47 -0
- package/dist/v2/data/useKeyedLoad.js.map +1 -0
- package/dist/v2/data/useRoomsV2.d.ts +28 -0
- package/dist/v2/data/useRoomsV2.js +45 -0
- package/dist/v2/data/useRoomsV2.js.map +1 -0
- package/dist/v2/day/DayPanel.d.ts +6 -0
- package/dist/v2/day/DayPanel.js +215 -0
- package/dist/v2/day/DayPanel.js.map +1 -0
- package/dist/v2/day/daySummary.d.ts +37 -0
- package/dist/v2/day/daySummary.js +37 -0
- package/dist/v2/day/daySummary.js.map +1 -0
- package/dist/v2/dialogs/CalendarDialogsV2.d.ts +1 -0
- package/dist/v2/dialogs/CalendarDialogsV2.js +17 -0
- package/dist/v2/dialogs/CalendarDialogsV2.js.map +1 -0
- package/dist/v2/dialogs/ShortcutsDialog.d.ts +4 -0
- package/dist/v2/dialogs/ShortcutsDialog.js +42 -0
- package/dist/v2/dialogs/ShortcutsDialog.js.map +1 -0
- package/dist/v2/events/eventLook.d.ts +46 -0
- package/dist/v2/events/eventLook.js +35 -0
- package/dist/v2/events/eventLook.js.map +1 -0
- package/dist/v2/events/eventModel.d.ts +92 -0
- package/dist/v2/events/eventModel.js +116 -0
- package/dist/v2/events/eventModel.js.map +1 -0
- package/dist/v2/events/localChanges.d.ts +4 -0
- package/dist/v2/events/localChanges.js +23 -0
- package/dist/v2/events/localChanges.js.map +1 -0
- package/dist/v2/format.d.ts +67 -0
- package/dist/v2/format.js +112 -0
- package/dist/v2/format.js.map +1 -0
- package/dist/v2/grid/AllDayRow.d.ts +20 -0
- package/dist/v2/grid/AllDayRow.js +94 -0
- package/dist/v2/grid/AllDayRow.js.map +1 -0
- package/dist/v2/grid/EventBlock.d.ts +21 -0
- package/dist/v2/grid/EventBlock.js +112 -0
- package/dist/v2/grid/EventBlock.js.map +1 -0
- package/dist/v2/grid/GridParts.d.ts +40 -0
- package/dist/v2/grid/GridParts.js +210 -0
- package/dist/v2/grid/GridParts.js.map +1 -0
- package/dist/v2/grid/QuickCreate.d.ts +1 -0
- package/dist/v2/grid/QuickCreate.js +175 -0
- package/dist/v2/grid/QuickCreate.js.map +1 -0
- package/dist/v2/grid/TimeGrid.d.ts +1 -0
- package/dist/v2/grid/TimeGrid.js +188 -0
- package/dist/v2/grid/TimeGrid.js.map +1 -0
- package/dist/v2/grid/geometry.d.ts +72 -0
- package/dist/v2/grid/geometry.js +85 -0
- package/dist/v2/grid/geometry.js.map +1 -0
- package/dist/v2/grid/layout.d.ts +24 -0
- package/dist/v2/grid/layout.js +77 -0
- package/dist/v2/grid/layout.js.map +1 -0
- package/dist/v2/grid/useGridDrag.d.ts +42 -0
- package/dist/v2/grid/useGridDrag.js +181 -0
- package/dist/v2/grid/useGridDrag.js.map +1 -0
- package/dist/v2/grid/useSlotCursor.d.ts +32 -0
- package/dist/v2/grid/useSlotCursor.js +57 -0
- package/dist/v2/grid/useSlotCursor.js.map +1 -0
- package/dist/v2/grid/workingHours.d.ts +21 -0
- package/dist/v2/grid/workingHours.js +101 -0
- package/dist/v2/grid/workingHours.js.map +1 -0
- package/dist/v2/hooks/useAvailableHeight.d.ts +2 -0
- package/dist/v2/hooks/useAvailableHeight.js +25 -0
- package/dist/v2/hooks/useAvailableHeight.js.map +1 -0
- package/dist/v2/hooks/useCalendarShortcuts.d.ts +9 -0
- package/dist/v2/hooks/useCalendarShortcuts.js +60 -0
- package/dist/v2/hooks/useCalendarShortcuts.js.map +1 -0
- package/dist/v2/hooks/useDebouncedValue.d.ts +1 -0
- package/dist/v2/hooks/useDebouncedValue.js +12 -0
- package/dist/v2/hooks/useDebouncedValue.js.map +1 -0
- package/dist/v2/hooks/useMediaQuery.d.ts +5 -0
- package/dist/v2/hooks/useMediaQuery.js +17 -0
- package/dist/v2/hooks/useMediaQuery.js.map +1 -0
- package/dist/v2/hooks/useNow.d.ts +2 -0
- package/dist/v2/hooks/useNow.js +31 -0
- package/dist/v2/hooks/useNow.js.map +1 -0
- package/dist/v2/limits.d.ts +6 -0
- package/dist/v2/limits.js +5 -0
- package/dist/v2/limits.js.map +1 -0
- package/dist/v2/list/EventListRow.d.ts +10 -0
- package/dist/v2/list/EventListRow.js +109 -0
- package/dist/v2/list/EventListRow.js.map +1 -0
- package/dist/v2/list/ListViewV2.d.ts +16 -0
- package/dist/v2/list/ListViewV2.js +96 -0
- package/dist/v2/list/ListViewV2.js.map +1 -0
- package/dist/v2/month/MonthView.d.ts +1 -0
- package/dist/v2/month/MonthView.js +328 -0
- package/dist/v2/month/MonthView.js.map +1 -0
- package/dist/v2/month/monthLayout.d.ts +39 -0
- package/dist/v2/month/monthLayout.js +29 -0
- package/dist/v2/month/monthLayout.js.map +1 -0
- package/dist/v2/page/CalendarChrome.d.ts +2 -0
- package/dist/v2/page/CalendarChrome.js +295 -0
- package/dist/v2/page/CalendarChrome.js.map +1 -0
- package/dist/v2/page/CalendarPageContext.d.ts +92 -0
- package/dist/v2/page/CalendarPageContext.js +11 -0
- package/dist/v2/page/CalendarPageContext.js.map +1 -0
- package/dist/v2/page/pageHelpers.d.ts +19 -0
- package/dist/v2/page/pageHelpers.js +39 -0
- package/dist/v2/page/pageHelpers.js.map +1 -0
- package/dist/v2/page/useCalendarPageModel.d.ts +2 -0
- package/dist/v2/page/useCalendarPageModel.js +198 -0
- package/dist/v2/page/useCalendarPageModel.js.map +1 -0
- package/dist/v2/page/viewState.d.ts +70 -0
- package/dist/v2/page/viewState.js +47 -0
- package/dist/v2/page/viewState.js.map +1 -0
- package/dist/v2/peek/EventPeek.d.ts +2 -0
- package/dist/v2/peek/EventPeek.js +92 -0
- package/dist/v2/peek/EventPeek.js.map +1 -0
- package/dist/v2/peek/PeekEvent.d.ts +4 -0
- package/dist/v2/peek/PeekEvent.js +443 -0
- package/dist/v2/peek/PeekEvent.js.map +1 -0
- package/dist/v2/peek/PeekParts.d.ts +14 -0
- package/dist/v2/peek/PeekParts.js +75 -0
- package/dist/v2/peek/PeekParts.js.map +1 -0
- package/dist/v2/prefs/calendarPrefs.d.ts +2 -2
- package/dist/v2/prefs/calendarPrefs.js +35 -34
- package/dist/v2/prefs/calendarPrefs.js.map +1 -1
- package/dist/v2/rail/CalendarRail.d.ts +3 -0
- package/dist/v2/rail/CalendarRail.js +258 -0
- package/dist/v2/rail/CalendarRail.js.map +1 -0
- package/dist/v2/rail/railStatus.d.ts +54 -0
- package/dist/v2/rail/railStatus.js +84 -0
- package/dist/v2/rail/railStatus.js.map +1 -0
- package/dist/v2/rail/syncWords.d.ts +10 -0
- package/dist/v2/rail/syncWords.js +75 -0
- package/dist/v2/rail/syncWords.js.map +1 -0
- package/dist/v2/rail/useMonthEventDates.d.ts +4 -0
- package/dist/v2/rail/useMonthEventDates.js +30 -0
- package/dist/v2/rail/useMonthEventDates.js.map +1 -0
- package/dist/v2/routes.js +4 -1
- package/dist/v2/routes.js.map +1 -1
- package/dist/v2/runs/RunPeek.d.ts +2 -0
- package/dist/v2/runs/RunPeek.js +382 -0
- package/dist/v2/runs/RunPeek.js.map +1 -0
- package/dist/v2/runs/RunPills.d.ts +28 -0
- package/dist/v2/runs/RunPills.js +179 -0
- package/dist/v2/runs/RunPills.js.map +1 -0
- package/dist/v2/runs/RunRows.d.ts +21 -0
- package/dist/v2/runs/RunRows.js +140 -0
- package/dist/v2/runs/RunRows.js.map +1 -0
- package/dist/v2/runs/RunsNotices.d.ts +1 -0
- package/dist/v2/runs/RunsNotices.js +37 -0
- package/dist/v2/runs/RunsNotices.js.map +1 -0
- package/dist/v2/runs/RunsSwitch.d.ts +1 -0
- package/dist/v2/runs/RunsSwitch.js +54 -0
- package/dist/v2/runs/RunsSwitch.js.map +1 -0
- package/dist/v2/runs/WorkflowRunsLayer.d.ts +4 -0
- package/dist/v2/runs/WorkflowRunsLayer.js +82 -0
- package/dist/v2/runs/WorkflowRunsLayer.js.map +1 -0
- package/dist/v2/runs/runAccess.d.ts +37 -0
- package/dist/v2/runs/runAccess.js +14 -0
- package/dist/v2/runs/runAccess.js.map +1 -0
- package/dist/v2/runs/runLayout.d.ts +76 -0
- package/dist/v2/runs/runLayout.js +129 -0
- package/dist/v2/runs/runLayout.js.map +1 -0
- package/dist/v2/runs/runLinks.d.ts +32 -0
- package/dist/v2/runs/runLinks.js +50 -0
- package/dist/v2/runs/runLinks.js.map +1 -0
- package/dist/v2/runs/runModel.d.ts +97 -0
- package/dist/v2/runs/runModel.js +132 -0
- package/dist/v2/runs/runModel.js.map +1 -0
- package/dist/v2/runs/runPeekState.d.ts +53 -0
- package/dist/v2/runs/runPeekState.js +62 -0
- package/dist/v2/runs/runPeekState.js.map +1 -0
- package/dist/v2/runs/runTypes.d.ts +60 -0
- package/dist/v2/runs/runWords.d.ts +23 -0
- package/dist/v2/runs/runWords.js +83 -0
- package/dist/v2/runs/runWords.js.map +1 -0
- package/dist/v2/runs/runsLayerContext.d.ts +26 -0
- package/dist/v2/runs/runsLayerContext.js +33 -0
- package/dist/v2/runs/runsLayerContext.js.map +1 -0
- package/dist/v2/runs/useRunHrefs.d.ts +10 -0
- package/dist/v2/runs/useRunHrefs.js +60 -0
- package/dist/v2/runs/useRunHrefs.js.map +1 -0
- package/dist/v2/runs/useRunLabels.d.ts +6 -0
- package/dist/v2/runs/useRunLabels.js +27 -0
- package/dist/v2/runs/useRunLabels.js.map +1 -0
- package/dist/v2/runs/useRunsAccess.d.ts +2 -0
- package/dist/v2/runs/useRunsAccess.js +14 -0
- package/dist/v2/runs/useRunsAccess.js.map +1 -0
- package/dist/v2/runs/useWorkflowRuns.d.ts +61 -0
- package/dist/v2/runs/useWorkflowRuns.js +119 -0
- package/dist/v2/runs/useWorkflowRuns.js.map +1 -0
- package/dist/v2/search/SearchResults.d.ts +1 -0
- package/dist/v2/search/SearchResults.js +88 -0
- package/dist/v2/search/SearchResults.js.map +1 -0
- package/dist/v2/search/searchModel.d.ts +20 -0
- package/dist/v2/search/searchModel.js +22 -0
- package/dist/v2/search/searchModel.js.map +1 -0
- package/dist/v2/state/calendarV2Store.d.ts +4 -1
- package/dist/v2/state/calendarV2Store.js +3 -1
- package/dist/v2/state/calendarV2Store.js.map +1 -1
- package/dist/v2/state/useCalendarV2Navigation.d.ts +1 -0
- package/dist/v2/state/useCalendarV2Navigation.js +4 -1
- package/dist/v2/state/useCalendarV2Navigation.js.map +1 -1
- package/dist/v2/states/CalendarStates.d.ts +18 -0
- package/dist/v2/states/CalendarStates.js +122 -0
- package/dist/v2/states/CalendarStates.js.map +1 -0
- package/dist/v2/styles.d.ts +32 -0
- package/dist/v2/styles.js +10 -0
- package/dist/v2/styles.js.map +1 -0
- package/dist/v2/time/calendarTime.js +121 -35
- package/dist/v2/time/calendarTime.js.map +1 -1
- package/dist/v2/types.d.ts +22 -2
- package/package.json +1 -1
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { DateValue } from '@burdenoff/fe-libs/ui';
|
|
2
|
+
import { CalendarEventV2, CalendarV2, EventBookingV2, TimedSegment } from '../types';
|
|
3
|
+
/** The person's part in an event. */
|
|
4
|
+
export type MyPart = 'organizer' | 'invited' | 'going' | 'maybe' | 'declined' | 'none';
|
|
5
|
+
export declare function isOrganizer(event: CalendarEventV2, me: string | null): boolean;
|
|
6
|
+
export declare function myPart(event: CalendarEventV2, me: string | null): MyPart;
|
|
7
|
+
/**
|
|
8
|
+
* A private or confidential event of someone else's that the person is not invited to: the
|
|
9
|
+
* views show only that the time is taken ("Busy"), never its title, place or guests.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isBusyOnly(event: CalendarEventV2, calendar: CalendarV2 | undefined, me: string | null): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The person may move, resize, edit and delete it: they organise it, its calendar takes
|
|
14
|
+
* changes (not a calendar followed by link), and it is not someone else's private time.
|
|
15
|
+
*/
|
|
16
|
+
export declare function canEditEvent(event: CalendarEventV2, calendar: CalendarV2 | undefined, me: string | null): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Drag and keyboard moves, which keep an event inside one day of the grid. Not for:
|
|
19
|
+
* - a repeating event: it shows only its first occurrence until the series is expanded on the
|
|
20
|
+
* server (B7), so moving it would move the whole series; the event dialog asks which events
|
|
21
|
+
* to change;
|
|
22
|
+
* - one that runs past midnight on the calendar's clock (23:00–01:00): kept inside one day it
|
|
23
|
+
* would lose its times, so it changes in the event dialog;
|
|
24
|
+
* - one that starts or ends in the second pass of an hour the clocks repeat (01:30 GMT on 25
|
|
25
|
+
* October 2026 in London): the grid reads a clock time as its first pass, so a move would
|
|
26
|
+
* shift it by the hour.
|
|
27
|
+
*/
|
|
28
|
+
export declare function canMoveOnGrid(event: CalendarEventV2, calendar: CalendarV2 | undefined, me: string | null, timeZone: string): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether an instant's clock time on `timeZone` stands for that instant again (to the minute):
|
|
31
|
+
* false in the second pass of a repeated hour, which the clock time reads as the first.
|
|
32
|
+
*/
|
|
33
|
+
export declare function readsBackOnClock(instant: Date, timeZone: string): boolean;
|
|
34
|
+
/** Shown in the all-day row: an all-day event, or one that lasts a day or more. */
|
|
35
|
+
export declare function isAllDayRow(event: CalendarEventV2): boolean;
|
|
36
|
+
/** The event has ended (an all-day event: its last day is before today). */
|
|
37
|
+
export declare function isPastEvent(event: CalendarEventV2, now: Date, timeZone: string): boolean;
|
|
38
|
+
export declare function isHappeningNow(event: CalendarEventV2, now: Date): boolean;
|
|
39
|
+
export interface ShownEventsOptions {
|
|
40
|
+
hiddenCalendarIds: ReadonlySet<string>;
|
|
41
|
+
showDeclined: boolean;
|
|
42
|
+
me: string | null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The events the views show: on a shown calendar, not cancelled, and not declined unless the
|
|
46
|
+
* person asked to see those.
|
|
47
|
+
*/
|
|
48
|
+
export declare function shownEvents(events: readonly CalendarEventV2[], options: ShownEventsOptions): CalendarEventV2[];
|
|
49
|
+
/** Invitations still waiting for the person's answer that haven't ended, soonest first. */
|
|
50
|
+
export declare function waitingInvitations(events: readonly CalendarEventV2[], now: Date, me: string | null): CalendarEventV2[];
|
|
51
|
+
/**
|
|
52
|
+
* The room an event is in: its first room booking that wasn't cancelled or turned down, else a
|
|
53
|
+
* turned-down one to warn about. Other resources (equipment) never stand in for the room, so a
|
|
54
|
+
* refused room still shows next to approved equipment.
|
|
55
|
+
*/
|
|
56
|
+
export declare function eventRoom(event: CalendarEventV2): EventBookingV2 | null;
|
|
57
|
+
/** A web address that is safe to open: http or https only. */
|
|
58
|
+
export declare function safeWebUrl(raw: string | null | undefined): string | null;
|
|
59
|
+
/** The video call to join: the meeting link, else a location that is a web address. */
|
|
60
|
+
export declare function joinUrl(event: CalendarEventV2): string | null;
|
|
61
|
+
/** A timed event's piece on one day. */
|
|
62
|
+
export interface DaySegment<T = CalendarEventV2> extends TimedSegment {
|
|
63
|
+
event: T;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Timed events' pieces on each of `days`, on the clock of `timeZone`. Events shown in the
|
|
67
|
+
* all-day row (`isAllDayRow`) are left out, as the grid draws them there; `includeLong` keeps
|
|
68
|
+
* the timed ones of a day or more, for what is busy (all-day events never are).
|
|
69
|
+
*/
|
|
70
|
+
export declare function timedSegmentsByDay(events: readonly CalendarEventV2[], days: readonly DateValue[], timeZone: string, options?: {
|
|
71
|
+
includeLong?: boolean;
|
|
72
|
+
}): Map<DateValue, DaySegment[]>;
|
|
73
|
+
/** An event in the all-day row, from its first to its last day. */
|
|
74
|
+
export interface AllDayItem<T = CalendarEventV2> {
|
|
75
|
+
event: T;
|
|
76
|
+
first: DateValue;
|
|
77
|
+
last: DateValue;
|
|
78
|
+
}
|
|
79
|
+
/** The all-day row's events that touch `first`..`last`. */
|
|
80
|
+
export declare function allDayItems(events: readonly CalendarEventV2[], first: DateValue, last: DateValue, timeZone: string): AllDayItem[];
|
|
81
|
+
/**
|
|
82
|
+
* The events on one day, for a day's list (Month's "+N more", phones' Month, the List view):
|
|
83
|
+
* every event that touches the day (one over midnight on both its days, as the grid shows
|
|
84
|
+
* it), all-day ones first, then by start.
|
|
85
|
+
*/
|
|
86
|
+
export declare function eventsOnDay(events: readonly CalendarEventV2[], day: DateValue, timeZone: string): CalendarEventV2[];
|
|
87
|
+
/** Which of an all-day item's days `day` is: 1 for its first. */
|
|
88
|
+
export declare function dayOfSpan(item: {
|
|
89
|
+
first: DateValue;
|
|
90
|
+
}, day: DateValue): number;
|
|
91
|
+
/** Whether an event falls on any of `days` (sorted), on the clock of `timeZone`. */
|
|
92
|
+
export declare function touchesDays(event: CalendarEventV2, days: ReadonlySet<DateValue>, first: DateValue, last: DateValue, timeZone: string): boolean;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { dayDifference as e, eventDays as t, instantToZoned as n, timedSegments as r, zonedTimeToInstant as i } from "../time/calendarTime.js";
|
|
2
|
+
// src/v2/events/eventModel.ts
|
|
3
|
+
var a = 864e5;
|
|
4
|
+
function o(e, t) {
|
|
5
|
+
return t ? e.organizerId === t || e.guests.some((e) => e.organizer && e.userId === t) : !1;
|
|
6
|
+
}
|
|
7
|
+
function s(e, t) {
|
|
8
|
+
if (o(e, t)) return "organizer";
|
|
9
|
+
switch (e.myResponse) {
|
|
10
|
+
case "NO_RESPONSE": return "invited";
|
|
11
|
+
case "ACCEPTED": return "going";
|
|
12
|
+
case "TENTATIVE": return "maybe";
|
|
13
|
+
case "DECLINED": return "declined";
|
|
14
|
+
default: return "none";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function c(e, t) {
|
|
18
|
+
return !e || !t || e.kind !== "PERSONAL" ? !1 : (e.ownerUserId ?? e.createdBy) === t;
|
|
19
|
+
}
|
|
20
|
+
function l(e, t, n) {
|
|
21
|
+
return e.visibility !== "PUBLIC" && s(e, n) === "none" && !c(t, n);
|
|
22
|
+
}
|
|
23
|
+
function u(e, t, n) {
|
|
24
|
+
return !t || t.isReadOnly || e.status === "CANCELLED" ? !1 : o(e, n);
|
|
25
|
+
}
|
|
26
|
+
function d(e, n, r, i) {
|
|
27
|
+
if (!u(e, n, r) || e.isRecurring || p(e)) return !1;
|
|
28
|
+
let a = t(e, i);
|
|
29
|
+
return a.start === a.end && f(e.start, i) && f(e.end, i);
|
|
30
|
+
}
|
|
31
|
+
function f(e, t) {
|
|
32
|
+
let r = n(e, t), a = Math.floor(e.getTime() / 6e4) * 6e4;
|
|
33
|
+
return i(r.date, r.minutes, t).getTime() === a;
|
|
34
|
+
}
|
|
35
|
+
function p(e) {
|
|
36
|
+
return e.allDay || e.end.getTime() - e.start.getTime() >= a;
|
|
37
|
+
}
|
|
38
|
+
function m(e, r, i) {
|
|
39
|
+
if (e.allDay) {
|
|
40
|
+
let a = n(r, i).date;
|
|
41
|
+
return t(e, i).end < a;
|
|
42
|
+
}
|
|
43
|
+
return e.end.getTime() <= r.getTime();
|
|
44
|
+
}
|
|
45
|
+
function h(e, t) {
|
|
46
|
+
if (e.allDay) return !1;
|
|
47
|
+
let n = t.getTime();
|
|
48
|
+
return e.start.getTime() <= n && e.end.getTime() > n;
|
|
49
|
+
}
|
|
50
|
+
function g(e, t) {
|
|
51
|
+
return e.filter((e) => !t.hiddenCalendarIds.has(e.calendarId) && e.status !== "CANCELLED" && (t.showDeclined || s(e, t.me) !== "declined"));
|
|
52
|
+
}
|
|
53
|
+
function _(e, t, n) {
|
|
54
|
+
return e.filter((e) => s(e, n) === "invited" && e.end.getTime() > t.getTime()).sort((e, t) => e.start.getTime() - t.start.getTime());
|
|
55
|
+
}
|
|
56
|
+
function v(e) {
|
|
57
|
+
return e.resourceType === "ROOM" || e.resourceType === null;
|
|
58
|
+
}
|
|
59
|
+
function y(e) {
|
|
60
|
+
let t = e.bookings.filter(v);
|
|
61
|
+
return t.find((e) => e.status === "PENDING" || e.status === "APPROVED") ?? t.find((e) => e.status === "COMPLETED") ?? t.find((e) => e.status === "REJECTED") ?? null;
|
|
62
|
+
}
|
|
63
|
+
function b(e) {
|
|
64
|
+
let t = e?.trim();
|
|
65
|
+
if (!t) return null;
|
|
66
|
+
let n = /^[a-z][a-z0-9+.-]*:/i.test(t) ? t : `https://${t}`;
|
|
67
|
+
try {
|
|
68
|
+
let e = new URL(n);
|
|
69
|
+
return e.protocol === "https:" || e.protocol === "http:" ? e.toString() : null;
|
|
70
|
+
} catch {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function x(e) {
|
|
75
|
+
return b(e.meeting?.url) ?? (e.locationType === "ONLINE" ? b(e.locationUrl) : null);
|
|
76
|
+
}
|
|
77
|
+
function S(e, t, n, i = {}) {
|
|
78
|
+
let a = new Map(t.map((e) => [e, []])), o = t[0], s = t[t.length - 1];
|
|
79
|
+
if (!o || !s) return a;
|
|
80
|
+
for (let t of e) if (!(t.allDay || !i.includeLong && p(t))) for (let e of r(t.start, t.end, n, o, s)) a.get(e.date)?.push({
|
|
81
|
+
...e,
|
|
82
|
+
event: t
|
|
83
|
+
});
|
|
84
|
+
return a;
|
|
85
|
+
}
|
|
86
|
+
function C(e, n, r, i) {
|
|
87
|
+
let a = [];
|
|
88
|
+
for (let o of e) {
|
|
89
|
+
if (!p(o)) continue;
|
|
90
|
+
let e = t(o, i);
|
|
91
|
+
e.end < n || e.start > r || a.push({
|
|
92
|
+
event: o,
|
|
93
|
+
first: e.start,
|
|
94
|
+
last: e.end
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return a;
|
|
98
|
+
}
|
|
99
|
+
function w(e, n, r) {
|
|
100
|
+
return e.filter((e) => {
|
|
101
|
+
let i = t(e, r);
|
|
102
|
+
return i.start <= n && i.end >= n;
|
|
103
|
+
}).sort((e, t) => Number(p(t)) - Number(p(e)) || e.start.getTime() - t.start.getTime() || e.title.localeCompare(t.title));
|
|
104
|
+
}
|
|
105
|
+
function T(t, n) {
|
|
106
|
+
return e(t.first, n) + 1;
|
|
107
|
+
}
|
|
108
|
+
function E(e, n, r, i, a) {
|
|
109
|
+
let o = t(e, a);
|
|
110
|
+
if (o.end < r || o.start > i) return !1;
|
|
111
|
+
for (let e of n) if (e >= o.start && e <= o.end) return !0;
|
|
112
|
+
return !1;
|
|
113
|
+
}
|
|
114
|
+
export { C as allDayItems, u as canEditEvent, d as canMoveOnGrid, T as dayOfSpan, y as eventRoom, w as eventsOnDay, p as isAllDayRow, l as isBusyOnly, h as isHappeningNow, o as isOrganizer, m as isPastEvent, x as joinUrl, s as myPart, f as readsBackOnClock, b as safeWebUrl, g as shownEvents, S as timedSegmentsByDay, E as touchesDays, _ as waitingInvitations };
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=eventModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventModel.js","names":["DAY_MS","isOrganizer","me","event","guest","myPart","isOwnCalendar","calendar","isBusyOnly","canEditEvent","canMoveOnGrid","isAllDayRow","days","eventDays","timeZone","readsBackOnClock","zoned","instantToZoned","instant","minute","zonedTimeToInstant","isPastEvent","today","now","isHappeningNow","at","shownEvents","events","options","waitingInvitations","a","b","isRoomBooking","booking","eventRoom","rooms","safeWebUrl","value","raw","withScheme","url","joinUrl","timedSegmentsByDay","byDay","day","first","last","segment","timedSegments","allDayItems","items","span","eventsOnDay","dayOfSpan","dayDifference","item","touchesDays"],"sources":["../../../src/v2/events/eventModel.ts"],"sourcesContent":["/**\n * What an event is to the person looking at it (BOFF-15698 A1): whose it is, their answer,\n * whether they may change it, whether only \"Busy\" may be shown, and which views and days it\n * belongs to. Pure, so the views and their tests share one reading.\n */\nimport type { DateValue } from '@burdenoff/fe-libs/ui';\nimport {\n dayDifference,\n eventDays,\n instantToZoned,\n timedSegments,\n zonedTimeToInstant,\n} from '../time/calendarTime';\nimport type { CalendarEventV2, CalendarV2, EventBookingV2, TimedSegment } from '../types';\n\nconst DAY_MS = 86_400_000;\n\n/** The person's part in an event. */\nexport type MyPart = 'organizer' | 'invited' | 'going' | 'maybe' | 'declined' | 'none';\n\nexport function isOrganizer(event: CalendarEventV2, me: string | null): boolean {\n if (!me) return false;\n return (\n event.organizerId === me || event.guests.some((guest) => guest.organizer && guest.userId === me)\n );\n}\n\nexport function myPart(event: CalendarEventV2, me: string | null): MyPart {\n if (isOrganizer(event, me)) return 'organizer';\n switch (event.myResponse) {\n case 'NO_RESPONSE':\n return 'invited';\n case 'ACCEPTED':\n return 'going';\n case 'TENTATIVE':\n return 'maybe';\n case 'DECLINED':\n return 'declined';\n default:\n return 'none';\n }\n}\n\n/** The person's own calendar: one only they hold. */\nfunction isOwnCalendar(calendar: CalendarV2 | undefined, me: string | null): boolean {\n if (!calendar || !me || calendar.kind !== 'PERSONAL') return false;\n return (calendar.ownerUserId ?? calendar.createdBy) === me;\n}\n\n/**\n * A private or confidential event of someone else's that the person is not invited to: the\n * views show only that the time is taken (\"Busy\"), never its title, place or guests.\n */\nexport function isBusyOnly(\n event: CalendarEventV2,\n calendar: CalendarV2 | undefined,\n me: string | null\n): boolean {\n if (event.visibility === 'PUBLIC') return false;\n return myPart(event, me) === 'none' && !isOwnCalendar(calendar, me);\n}\n\n/**\n * The person may move, resize, edit and delete it: they organise it, its calendar takes\n * changes (not a calendar followed by link), and it is not someone else's private time.\n */\nexport function canEditEvent(\n event: CalendarEventV2,\n calendar: CalendarV2 | undefined,\n me: string | null\n): boolean {\n if (!calendar || calendar.isReadOnly) return false;\n if (event.status === 'CANCELLED') return false;\n return isOrganizer(event, me);\n}\n\n/**\n * Drag and keyboard moves, which keep an event inside one day of the grid. Not for:\n * - a repeating event: it shows only its first occurrence until the series is expanded on the\n * server (B7), so moving it would move the whole series; the event dialog asks which events\n * to change;\n * - one that runs past midnight on the calendar's clock (23:00–01:00): kept inside one day it\n * would lose its times, so it changes in the event dialog;\n * - one that starts or ends in the second pass of an hour the clocks repeat (01:30 GMT on 25\n * October 2026 in London): the grid reads a clock time as its first pass, so a move would\n * shift it by the hour.\n */\nexport function canMoveOnGrid(\n event: CalendarEventV2,\n calendar: CalendarV2 | undefined,\n me: string | null,\n timeZone: string\n): boolean {\n if (!canEditEvent(event, calendar, me) || event.isRecurring || isAllDayRow(event)) return false;\n const days = eventDays(event, timeZone);\n if (days.start !== days.end) return false;\n return readsBackOnClock(event.start, timeZone) && readsBackOnClock(event.end, timeZone);\n}\n\n/**\n * Whether an instant's clock time on `timeZone` stands for that instant again (to the minute):\n * false in the second pass of a repeated hour, which the clock time reads as the first.\n */\nexport function readsBackOnClock(instant: Date, timeZone: string): boolean {\n const zoned = instantToZoned(instant, timeZone);\n const minute = Math.floor(instant.getTime() / 60_000) * 60_000;\n return zonedTimeToInstant(zoned.date, zoned.minutes, timeZone).getTime() === minute;\n}\n\n/** Shown in the all-day row: an all-day event, or one that lasts a day or more. */\nexport function isAllDayRow(event: CalendarEventV2): boolean {\n return event.allDay || event.end.getTime() - event.start.getTime() >= DAY_MS;\n}\n\n/** The event has ended (an all-day event: its last day is before today). */\nexport function isPastEvent(event: CalendarEventV2, now: Date, timeZone: string): boolean {\n if (event.allDay) {\n const today = instantToZoned(now, timeZone).date;\n return eventDays(event, timeZone).end < today;\n }\n return event.end.getTime() <= now.getTime();\n}\n\nexport function isHappeningNow(event: CalendarEventV2, now: Date): boolean {\n if (event.allDay) return false;\n const at = now.getTime();\n return event.start.getTime() <= at && event.end.getTime() > at;\n}\n\nexport interface ShownEventsOptions {\n hiddenCalendarIds: ReadonlySet<string>;\n showDeclined: boolean;\n me: string | null;\n}\n\n/**\n * The events the views show: on a shown calendar, not cancelled, and not declined unless the\n * person asked to see those.\n */\nexport function shownEvents(\n events: readonly CalendarEventV2[],\n options: ShownEventsOptions\n): CalendarEventV2[] {\n return events.filter(\n (event) =>\n !options.hiddenCalendarIds.has(event.calendarId) &&\n event.status !== 'CANCELLED' &&\n (options.showDeclined || myPart(event, options.me) !== 'declined')\n );\n}\n\n/** Invitations still waiting for the person's answer that haven't ended, soonest first. */\nexport function waitingInvitations(\n events: readonly CalendarEventV2[],\n now: Date,\n me: string | null\n): CalendarEventV2[] {\n return events\n .filter((event) => myPart(event, me) === 'invited' && event.end.getTime() > now.getTime())\n .sort((a, b) => a.start.getTime() - b.start.getTime());\n}\n\n/** A room booking: a room, or a resource of unknown type (rooms are what events book most). */\nfunction isRoomBooking(booking: EventBookingV2): boolean {\n return booking.resourceType === 'ROOM' || booking.resourceType === null;\n}\n\n/**\n * The room an event is in: its first room booking that wasn't cancelled or turned down, else a\n * turned-down one to warn about. Other resources (equipment) never stand in for the room, so a\n * refused room still shows next to approved equipment.\n */\nexport function eventRoom(event: CalendarEventV2): EventBookingV2 | null {\n const rooms = event.bookings.filter(isRoomBooking);\n return (\n rooms.find((booking) => booking.status === 'PENDING' || booking.status === 'APPROVED') ??\n rooms.find((booking) => booking.status === 'COMPLETED') ??\n rooms.find((booking) => booking.status === 'REJECTED') ??\n null\n );\n}\n\n/** A web address that is safe to open: http or https only. */\nexport function safeWebUrl(raw: string | null | undefined): string | null {\n const value = raw?.trim();\n if (!value) return null;\n const withScheme = /^[a-z][a-z0-9+.-]*:/i.test(value) ? value : `https://${value}`;\n try {\n const url = new URL(withScheme);\n return url.protocol === 'https:' || url.protocol === 'http:' ? url.toString() : null;\n } catch {\n return null;\n }\n}\n\n/** The video call to join: the meeting link, else a location that is a web address. */\nexport function joinUrl(event: CalendarEventV2): string | null {\n return (\n safeWebUrl(event.meeting?.url) ??\n (event.locationType === 'ONLINE' ? safeWebUrl(event.locationUrl) : null)\n );\n}\n\n/** A timed event's piece on one day. */\nexport interface DaySegment<T = CalendarEventV2> extends TimedSegment {\n event: T;\n}\n\n/**\n * Timed events' pieces on each of `days`, on the clock of `timeZone`. Events shown in the\n * all-day row (`isAllDayRow`) are left out, as the grid draws them there; `includeLong` keeps\n * the timed ones of a day or more, for what is busy (all-day events never are).\n */\nexport function timedSegmentsByDay(\n events: readonly CalendarEventV2[],\n days: readonly DateValue[],\n timeZone: string,\n options: { includeLong?: boolean } = {}\n): Map<DateValue, DaySegment[]> {\n const byDay = new Map<DateValue, DaySegment[]>(days.map((day) => [day, []]));\n const first = days[0];\n const last = days[days.length - 1];\n if (!first || !last) return byDay;\n for (const event of events) {\n if (event.allDay || (!options.includeLong && isAllDayRow(event))) continue;\n for (const segment of timedSegments(event.start, event.end, timeZone, first, last)) {\n byDay.get(segment.date)?.push({ ...segment, event });\n }\n }\n return byDay;\n}\n\n/** An event in the all-day row, from its first to its last day. */\nexport interface AllDayItem<T = CalendarEventV2> {\n event: T;\n first: DateValue;\n last: DateValue;\n}\n\n/** The all-day row's events that touch `first`..`last`. */\nexport function allDayItems(\n events: readonly CalendarEventV2[],\n first: DateValue,\n last: DateValue,\n timeZone: string\n): AllDayItem[] {\n const items: AllDayItem[] = [];\n for (const event of events) {\n if (!isAllDayRow(event)) continue;\n const span = eventDays(event, timeZone);\n if (span.end < first || span.start > last) continue;\n items.push({ event, first: span.start, last: span.end });\n }\n return items;\n}\n\n/**\n * The events on one day, for a day's list (Month's \"+N more\", phones' Month, the List view):\n * every event that touches the day (one over midnight on both its days, as the grid shows\n * it), all-day ones first, then by start.\n */\nexport function eventsOnDay(\n events: readonly CalendarEventV2[],\n day: DateValue,\n timeZone: string\n): CalendarEventV2[] {\n return events\n .filter((event) => {\n const span = eventDays(event, timeZone);\n return span.start <= day && span.end >= day;\n })\n .sort(\n (a, b) =>\n Number(isAllDayRow(b)) - Number(isAllDayRow(a)) ||\n a.start.getTime() - b.start.getTime() ||\n a.title.localeCompare(b.title)\n );\n}\n\n/** Which of an all-day item's days `day` is: 1 for its first. */\nexport function dayOfSpan(item: { first: DateValue }, day: DateValue): number {\n return dayDifference(item.first, day) + 1;\n}\n\n/** Whether an event falls on any of `days` (sorted), on the clock of `timeZone`. */\nexport function touchesDays(\n event: CalendarEventV2,\n days: ReadonlySet<DateValue>,\n first: DateValue,\n last: DateValue,\n timeZone: string\n): boolean {\n const span = eventDays(event, timeZone);\n if (span.end < first || span.start > last) return false;\n for (const day of days) if (day >= span.start && day <= span.end) return true;\n return false;\n}\n"],"mappings":";;AAeA,IAAMA,IAAS;AAKf,SAAgBC,EAAY,GAAwB,GAA4B;CAE9E,OADKC,IAEHC,EAAM,gBAAgBD,KAAMC,EAAM,OAAO,MAAM,MAAUC,EAAM,aAAaA,EAAM,WAAWF,CAAE,IAFjF;AAIlB;AAEA,SAAgBG,EAAO,GAAwB,GAA2B;CACxE,IAAIJ,EAAYE,GAAOD,CAAE,GAAG,OAAO;CACnC,QAAQC,EAAM,YAAd;EACE,KAAK,eACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAGA,SAASG,EAAc,GAAkC,GAA4B;CAEnF,OADI,CAACC,KAAY,CAACL,KAAMK,EAAS,SAAS,aAAmB,MACrDA,EAAS,eAAeA,EAAS,eAAeL;AAC1D;AAMA,SAAgBM,EACd,GACA,GACA,GACS;CAET,OADIL,EAAM,eAAe,YAClBE,EAAOF,GAAOD,CAAE,MAAM,UAAU,CAACI,EAAcC,GAAUL,CAAE;AACpE;AAMA,SAAgBO,EACd,GACA,GACA,GACS;CAGT,OAFI,CAACF,KAAYA,EAAS,cACtBJ,EAAM,WAAW,cAAoB,KAClCF,EAAYE,GAAOD,CAAE;AAC9B;AAaA,SAAgBQ,EACd,GACA,GACA,GACA,GACS;CACT,IAAI,CAACD,EAAaN,GAAOI,GAAUL,CAAE,KAAKC,EAAM,eAAeQ,EAAYR,CAAK,GAAG,OAAO;CAC1F,IAAMS,IAAOC,EAAUV,GAAOW,CAAQ;CAEtC,OADIF,EAAK,UAAUA,EAAK,OACjBG,EAAiBZ,EAAM,OAAOW,CAAQ,KAAKC,EAAiBZ,EAAM,KAAKW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E,KAAK;EAAE,GAAGA;EAAS;CAAM,CAAC;CAGvD,OAAOJ;AACT;AAUA,SAAgBM,EACd,GACA,GACA,GACA,GACc;CACd,IAAMC,IAAsB,CAAC;CAC7B,KAAK,IAAM/C,KAASwB,GAAQ;EAC1B,IAAI,CAAChB,EAAYR,CAAK,GAAG;EACzB,IAAMgD,IAAOtC,EAAUV,GAAOW,CAAQ;EACtC,AAAIqC,EAAK,MAAMN,KAASM,EAAK,QAAQL,KACrCI,EAAM,KAAK;GAAE;GAAO,OAAOC,EAAK;GAAO,MAAMA,EAAK;EAAI,CAAC;CACzD;CACA,OAAOD;AACT;AAOA,SAAgBE,EACd,GACA,GACA,GACmB;CACnB,OAAOzB,EACJ,QAAQ,MAAU;EACjB,IAAMwB,IAAOtC,EAAUV,GAAOW,CAAQ;EACtC,OAAOqC,EAAK,SAASP,KAAOO,EAAK,OAAOP;CAC1C,CAAC,CAAC,CACD,MACE,GAAG,MACF,OAAOjC,EAAYoB,CAAC,CAAC,IAAI,OAAOpB,EAAYmB,CAAC,CAAC,KAC9CA,EAAE,MAAM,QAAQ,IAAIC,EAAE,MAAM,QAAQ,KACpCD,EAAE,MAAM,cAAcC,EAAE,KAAK,CACjC;AACJ;AAGA,SAAgBsB,EAAU,GAA4B,GAAwB;CAC5E,OAAOC,EAAcC,EAAK,OAAOX,CAAG,IAAI;AAC1C;AAGA,SAAgBY,EACd,GACA,GACA,GACA,GACA,GACS;CACT,IAAML,IAAOtC,EAAUV,GAAOW,CAAQ;CACtC,IAAIqC,EAAK,MAAMN,KAASM,EAAK,QAAQL,GAAM,OAAO;CAClD,KAAK,IAAMF,KAAOhC,GAAM,IAAIgC,KAAOO,EAAK,SAASP,KAAOO,EAAK,KAAK,OAAO;CACzE,OAAO;AACT"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { EventActions } from '../data/useEventActions';
|
|
2
|
+
import { CalendarEventV2 } from '../types';
|
|
3
|
+
/** Events with the changes made here laid over them: moved, answered, or deleted. */
|
|
4
|
+
export declare function withLocalChanges(events: readonly CalendarEventV2[], actions: Pick<EventActions, 'overrides' | 'removedIds' | 'answers'>, me: string | null): CalendarEventV2[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/v2/events/localChanges.ts
|
|
2
|
+
function e(e, t, n) {
|
|
3
|
+
return t.overrides.size === 0 && t.removedIds.size === 0 && t.answers.size === 0 ? [...e] : e.filter((e) => !t.removedIds.has(e.id)).map((e) => {
|
|
4
|
+
let r = t.overrides.get(e.id), i = t.answers.get(e.id);
|
|
5
|
+
return !r && !i ? e : {
|
|
6
|
+
...e,
|
|
7
|
+
...r ? {
|
|
8
|
+
start: r.start,
|
|
9
|
+
end: r.end
|
|
10
|
+
} : {},
|
|
11
|
+
...i ? {
|
|
12
|
+
myResponse: i,
|
|
13
|
+
guests: e.guests.map((e) => e.userId === n ? {
|
|
14
|
+
...e,
|
|
15
|
+
response: i
|
|
16
|
+
} : e)
|
|
17
|
+
} : {}
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export { e as withLocalChanges };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=localChanges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localChanges.js","names":["withLocalChanges","actions","events","event","times","answer","guest","me"],"sources":["../../../src/v2/events/localChanges.ts"],"sourcesContent":["/**\n * The changes made on this page that the service hasn't sent back yet (BOFF-15698 A1): moved\n * events show at their new times, answers as given, deleted events not at all. The views and\n * search lay them over what they loaded, so both agree until the next reload.\n */\nimport type { EventActions } from '../data/useEventActions';\nimport type { CalendarEventV2 } from '../types';\n\n/** Events with the changes made here laid over them: moved, answered, or deleted. */\nexport function withLocalChanges(\n events: readonly CalendarEventV2[],\n actions: Pick<EventActions, 'overrides' | 'removedIds' | 'answers'>,\n me: string | null\n): CalendarEventV2[] {\n if (actions.overrides.size === 0 && actions.removedIds.size === 0 && actions.answers.size === 0) {\n return [...events];\n }\n return events\n .filter((event) => !actions.removedIds.has(event.id))\n .map((event) => {\n const times = actions.overrides.get(event.id);\n const answer = actions.answers.get(event.id);\n if (!times && !answer) return event;\n return {\n ...event,\n ...(times ? { start: times.start, end: times.end } : {}),\n ...(answer\n ? {\n myResponse: answer,\n guests: event.guests.map((guest) =>\n guest.userId === me ? { ...guest, response: answer } : guest\n ),\n }\n : {}),\n };\n });\n}\n"],"mappings":";AASA,SAAgBA,EACd,GACA,GACA,GACmB;CAInB,OAHIC,EAAQ,UAAU,SAAS,KAAKA,EAAQ,WAAW,SAAS,KAAKA,EAAQ,QAAQ,SAAS,IACrF,CAAC,GAAGC,CAAM,IAEZA,EACJ,QAAQ,MAAU,CAACD,EAAQ,WAAW,IAAIE,EAAM,EAAE,CAAC,CAAC,CACpD,KAAK,MAAU;EACd,IAAMC,IAAQH,EAAQ,UAAU,IAAIE,EAAM,EAAE,GACtCE,IAASJ,EAAQ,QAAQ,IAAIE,EAAM,EAAE;EAE3C,OADI,CAACC,KAAS,CAACC,IAAeF,IACvB;GACL,GAAGA;GACH,GAAIC,IAAQ;IAAE,OAAOA,EAAM;IAAO,KAAKA,EAAM;GAAI,IAAI,CAAC;GACtD,GAAIC,IACA;IACE,YAAYA;IACZ,QAAQF,EAAM,OAAO,KAAK,MACxBG,EAAM,WAAWC,IAAK;KAAE,GAAGD;KAAO,UAAUD;IAAO,IAAIC,CACzD;GACF,IACA,CAAC;EACP;CACF,CAAC;AACL"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { DateValue, HourCycle } from '@burdenoff/fe-libs/ui';
|
|
2
|
+
export interface CalendarFormat {
|
|
3
|
+
/** A BCP 47 tag ("en-GB"), or undefined for the runtime's. */
|
|
4
|
+
locale: string | undefined;
|
|
5
|
+
hourCycle: HourCycle;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The locale the calendar writes in: the first of the device's languages that is the app's
|
|
9
|
+
* language (so its region decides the order of day and month), else the app's language.
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveCalendarLocale(appLocale: string | undefined, deviceLanguages: readonly string[]): string | undefined;
|
|
12
|
+
/** The UTC midnight of a day, for `Intl` with `timeZone: 'UTC'`. */
|
|
13
|
+
export declare function utcMidnight(date: DateValue): Date;
|
|
14
|
+
export type DayStyle =
|
|
15
|
+
/** "Fri 20 Nov" */
|
|
16
|
+
'short'
|
|
17
|
+
/** "Friday 20 Nov" */
|
|
18
|
+
| 'mid'
|
|
19
|
+
/** "Friday 20 November" */
|
|
20
|
+
| 'long'
|
|
21
|
+
/** "Friday 20 November 2026" */
|
|
22
|
+
| 'full'
|
|
23
|
+
/** "20 Nov 2026" */
|
|
24
|
+
| 'date'
|
|
25
|
+
/** "Fri" */
|
|
26
|
+
| 'weekday'
|
|
27
|
+
/** "Friday" */
|
|
28
|
+
| 'weekdayLong'
|
|
29
|
+
/** "20" */
|
|
30
|
+
| 'dayNumber'
|
|
31
|
+
/** "Nov" */
|
|
32
|
+
| 'monthShort'
|
|
33
|
+
/** "November 2026" */
|
|
34
|
+
| 'monthYear'
|
|
35
|
+
/** "Nov 2026" */
|
|
36
|
+
| 'monthYearShort';
|
|
37
|
+
/** A day in the locale; commas the locale puts between weekday and day are kept. */
|
|
38
|
+
export declare function formatDay(date: DateValue, format: CalendarFormat, style: DayStyle): string;
|
|
39
|
+
/**
|
|
40
|
+
* Two days as the locale writes a range: "16–22 Nov 2026", "30 Nov – 6 Dec 2026",
|
|
41
|
+
* "28 Dec 2026 – 3 Jan 2027". `withYear: false` leaves the year out (phones).
|
|
42
|
+
*/
|
|
43
|
+
export declare function formatDaySpan(first: DateValue, last: DateValue, format: CalendarFormat, withYear?: boolean): string;
|
|
44
|
+
/** A time of day, `minutes` after midnight (1440 reads as midnight). */
|
|
45
|
+
export declare function formatMinutes(minutes: number, format: CalendarFormat): string;
|
|
46
|
+
/** "10:15 – 11:15". */
|
|
47
|
+
export declare function formatMinuteRange(start: number, end: number, format: CalendarFormat): string;
|
|
48
|
+
/** The time an instant shows on the clock of `timeZone`. */
|
|
49
|
+
export declare function formatInstantTime(instant: Date, timeZone: string, format: CalendarFormat): string;
|
|
50
|
+
/** "10:15 – 11:15", both ends on the clock of `timeZone`. */
|
|
51
|
+
export declare function formatInstantRange(start: Date, end: Date, timeZone: string, format: CalendarFormat): string;
|
|
52
|
+
/**
|
|
53
|
+
* A timed span over more than one day, with its days: "Mon 16 Nov, 10:00 – Tue 17 Nov, 10:00",
|
|
54
|
+
* both ends on the clock of `timeZone`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function formatDayTimeSpan(start: Date, end: Date, timeZone: string, format: CalendarFormat): string;
|
|
57
|
+
/** The words of a length of time, already translated by the caller. */
|
|
58
|
+
export interface DurationWords {
|
|
59
|
+
/** "{{minutes}} min" */
|
|
60
|
+
minutes: string;
|
|
61
|
+
/** "{{hours}} h" */
|
|
62
|
+
hours: string;
|
|
63
|
+
/** "{{hours}} h {{minutes}} min" */
|
|
64
|
+
hoursMinutes: string;
|
|
65
|
+
}
|
|
66
|
+
/** "45 min", "1 h", "2 h 30 min". */
|
|
67
|
+
export declare function formatDuration(totalMinutes: number, words: DurationWords): string;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { instantToZoned as e } from "./time/calendarTime.js";
|
|
2
|
+
import { formatTimeOfDay as t, parseDateValue as n } from "@burdenoff/fe-libs/ui";
|
|
3
|
+
// src/v2/format.ts
|
|
4
|
+
function r(e, t) {
|
|
5
|
+
if (!e) return t[0];
|
|
6
|
+
let n = e.toLowerCase().split(/[-_]/)[0];
|
|
7
|
+
return t.find((e) => e.toLowerCase().split(/[-_]/)[0] === n && e.includes("-")) ?? e;
|
|
8
|
+
}
|
|
9
|
+
var i = /* @__PURE__ */ new Map();
|
|
10
|
+
function a(e, t) {
|
|
11
|
+
let n = `${e ?? ""}|${JSON.stringify(t)}`, r = i.get(n);
|
|
12
|
+
if (!r) {
|
|
13
|
+
try {
|
|
14
|
+
r = new Intl.DateTimeFormat(e, {
|
|
15
|
+
...t,
|
|
16
|
+
timeZone: "UTC"
|
|
17
|
+
});
|
|
18
|
+
} catch {
|
|
19
|
+
r = new Intl.DateTimeFormat(void 0, {
|
|
20
|
+
...t,
|
|
21
|
+
timeZone: "UTC"
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
i.set(n, r);
|
|
25
|
+
}
|
|
26
|
+
return r;
|
|
27
|
+
}
|
|
28
|
+
function o(e) {
|
|
29
|
+
let t = n(e);
|
|
30
|
+
return t ? new Date(Date.UTC(t.year, t.month - 1, t.day)) : /* @__PURE__ */ new Date(NaN);
|
|
31
|
+
}
|
|
32
|
+
var s = {
|
|
33
|
+
short: {
|
|
34
|
+
weekday: "short",
|
|
35
|
+
day: "numeric",
|
|
36
|
+
month: "short"
|
|
37
|
+
},
|
|
38
|
+
mid: {
|
|
39
|
+
weekday: "long",
|
|
40
|
+
day: "numeric",
|
|
41
|
+
month: "short"
|
|
42
|
+
},
|
|
43
|
+
long: {
|
|
44
|
+
weekday: "long",
|
|
45
|
+
day: "numeric",
|
|
46
|
+
month: "long"
|
|
47
|
+
},
|
|
48
|
+
full: {
|
|
49
|
+
weekday: "long",
|
|
50
|
+
day: "numeric",
|
|
51
|
+
month: "long",
|
|
52
|
+
year: "numeric"
|
|
53
|
+
},
|
|
54
|
+
date: {
|
|
55
|
+
day: "numeric",
|
|
56
|
+
month: "short",
|
|
57
|
+
year: "numeric"
|
|
58
|
+
},
|
|
59
|
+
weekday: { weekday: "short" },
|
|
60
|
+
weekdayLong: { weekday: "long" },
|
|
61
|
+
dayNumber: { day: "numeric" },
|
|
62
|
+
monthShort: { month: "short" },
|
|
63
|
+
monthYear: {
|
|
64
|
+
month: "long",
|
|
65
|
+
year: "numeric"
|
|
66
|
+
},
|
|
67
|
+
monthYearShort: {
|
|
68
|
+
month: "short",
|
|
69
|
+
year: "numeric"
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
function c(e, t, n) {
|
|
73
|
+
return a(t.locale, s[n]).format(o(e));
|
|
74
|
+
}
|
|
75
|
+
function l(e, t, n, r = !0) {
|
|
76
|
+
let i = r ? {
|
|
77
|
+
day: "numeric",
|
|
78
|
+
month: "short",
|
|
79
|
+
year: "numeric"
|
|
80
|
+
} : {
|
|
81
|
+
day: "numeric",
|
|
82
|
+
month: "short"
|
|
83
|
+
}, s = a(n.locale, i);
|
|
84
|
+
return e === t ? s.format(o(e)) : s.formatRange(o(e), o(t));
|
|
85
|
+
}
|
|
86
|
+
function u(e, n) {
|
|
87
|
+
let r = (Math.round(e) % 1440 + 1440) % 1440;
|
|
88
|
+
return t(r, n.locale, n.hourCycle);
|
|
89
|
+
}
|
|
90
|
+
function d(e, t, n) {
|
|
91
|
+
return `${u(e, n)} – ${u(t, n)}`;
|
|
92
|
+
}
|
|
93
|
+
function f(t, n, r) {
|
|
94
|
+
return u(e(t, n).minutes, r);
|
|
95
|
+
}
|
|
96
|
+
function p(e, t, n, r) {
|
|
97
|
+
return `${f(e, n, r)} – ${f(t, n, r)}`;
|
|
98
|
+
}
|
|
99
|
+
function m(t, n, r, i) {
|
|
100
|
+
let a = (t) => {
|
|
101
|
+
let n = e(t, r);
|
|
102
|
+
return `${c(n.date, i, "short")}, ${u(n.minutes, i)}`;
|
|
103
|
+
};
|
|
104
|
+
return `${a(t)} – ${a(n)}`;
|
|
105
|
+
}
|
|
106
|
+
function h(e, t) {
|
|
107
|
+
let n = Math.max(0, Math.round(e)), r = Math.floor(n / 60), i = n % 60;
|
|
108
|
+
return ((e) => e.replace("{{hours}}", String(r)).replace("{{minutes}}", String(i)))(r === 0 ? t.minutes : i === 0 ? t.hours : t.hoursMinutes);
|
|
109
|
+
}
|
|
110
|
+
export { c as formatDay, l as formatDaySpan, m as formatDayTimeSpan, h as formatDuration, p as formatInstantRange, f as formatInstantTime, d as formatMinuteRange, u as formatMinutes, r as resolveCalendarLocale, o as utcMidnight };
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","names":["resolveCalendarLocale","appLocale","deviceLanguages","language","tag","formats","dayFormat","key","locale","options","format","utcMidnight","parts","parseDateValue","date","DAY_STYLES","formatDay","style","formatDaySpan","withYear","formatter","first","last","formatMinutes","wrapped","minutes","formatTimeOfDay","formatMinuteRange","start","end","formatInstantTime","instantToZoned","instant","timeZone","formatInstantRange","formatDayTimeSpan","at","zoned","formatDuration","rounded","totalMinutes","hours","template","words"],"sources":["../../src/v2/format.ts"],"sourcesContent":["/**\n * How the redesigned calendar writes days and times (BOFF-15698 A1): in the person's locale,\n * on their clock (24-hour unless they pick 12-hour in Calendar settings).\n *\n * - The locale is the app's language with this device's region when the device speaks that\n * language (\"en\" in a British browser writes \"Fri 20 Nov\", in an American one \"Fri, Nov 20\").\n * - A day is a floating `YYYY-MM-DD`, written at its UTC midnight with `timeZone: 'UTC'`, so it\n * never reads as the day before or after.\n * - A time is minutes after midnight on the calendar's clock (`instantToZoned`), written with\n * fe-libs' `formatTimeOfDay`.\n */\nimport {\n formatTimeOfDay,\n parseDateValue,\n type DateValue,\n type HourCycle,\n} from '@burdenoff/fe-libs/ui';\nimport { instantToZoned } from './time/calendarTime';\n\nexport interface CalendarFormat {\n /** A BCP 47 tag (\"en-GB\"), or undefined for the runtime's. */\n locale: string | undefined;\n hourCycle: HourCycle;\n}\n\n/**\n * The locale the calendar writes in: the first of the device's languages that is the app's\n * language (so its region decides the order of day and month), else the app's language.\n */\nexport function resolveCalendarLocale(\n appLocale: string | undefined,\n deviceLanguages: readonly string[]\n): string | undefined {\n if (!appLocale) return deviceLanguages[0];\n const language = appLocale.toLowerCase().split(/[-_]/)[0];\n const regional = deviceLanguages.find(\n (tag) => tag.toLowerCase().split(/[-_]/)[0] === language && tag.includes('-')\n );\n return regional ?? appLocale;\n}\n\nconst formats = new Map<string, Intl.DateTimeFormat>();\n\nfunction dayFormat(\n locale: string | undefined,\n options: Intl.DateTimeFormatOptions\n): Intl.DateTimeFormat {\n const key = `${locale ?? ''}|${JSON.stringify(options)}`;\n let format = formats.get(key);\n if (!format) {\n try {\n format = new Intl.DateTimeFormat(locale, { ...options, timeZone: 'UTC' });\n } catch {\n format = new Intl.DateTimeFormat(undefined, { ...options, timeZone: 'UTC' });\n }\n formats.set(key, format);\n }\n return format;\n}\n\n/** The UTC midnight of a day, for `Intl` with `timeZone: 'UTC'`. */\nexport function utcMidnight(date: DateValue): Date {\n const parts = parseDateValue(date);\n if (!parts) return new Date(Number.NaN);\n return new Date(Date.UTC(parts.year, parts.month - 1, parts.day));\n}\n\nexport type DayStyle =\n /** \"Fri 20 Nov\" */\n | 'short'\n /** \"Friday 20 Nov\" */\n | 'mid'\n /** \"Friday 20 November\" */\n | 'long'\n /** \"Friday 20 November 2026\" */\n | 'full'\n /** \"20 Nov 2026\" */\n | 'date'\n /** \"Fri\" */\n | 'weekday'\n /** \"Friday\" */\n | 'weekdayLong'\n /** \"20\" */\n | 'dayNumber'\n /** \"Nov\" */\n | 'monthShort'\n /** \"November 2026\" */\n | 'monthYear'\n /** \"Nov 2026\" */\n | 'monthYearShort';\n\nconst DAY_STYLES: Readonly<Record<DayStyle, Intl.DateTimeFormatOptions>> = {\n short: { weekday: 'short', day: 'numeric', month: 'short' },\n mid: { weekday: 'long', day: 'numeric', month: 'short' },\n long: { weekday: 'long', day: 'numeric', month: 'long' },\n full: { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric' },\n date: { day: 'numeric', month: 'short', year: 'numeric' },\n weekday: { weekday: 'short' },\n weekdayLong: { weekday: 'long' },\n dayNumber: { day: 'numeric' },\n monthShort: { month: 'short' },\n monthYear: { month: 'long', year: 'numeric' },\n monthYearShort: { month: 'short', year: 'numeric' },\n};\n\n/** A day in the locale; commas the locale puts between weekday and day are kept. */\nexport function formatDay(date: DateValue, format: CalendarFormat, style: DayStyle): string {\n return dayFormat(format.locale, DAY_STYLES[style]).format(utcMidnight(date));\n}\n\n/**\n * Two days as the locale writes a range: \"16–22 Nov 2026\", \"30 Nov – 6 Dec 2026\",\n * \"28 Dec 2026 – 3 Jan 2027\". `withYear: false` leaves the year out (phones).\n */\nexport function formatDaySpan(\n first: DateValue,\n last: DateValue,\n format: CalendarFormat,\n withYear = true\n): string {\n const options: Intl.DateTimeFormatOptions = withYear\n ? { day: 'numeric', month: 'short', year: 'numeric' }\n : { day: 'numeric', month: 'short' };\n const formatter = dayFormat(format.locale, options);\n if (first === last) return formatter.format(utcMidnight(first));\n return formatter.formatRange(utcMidnight(first), utcMidnight(last));\n}\n\n/** A time of day, `minutes` after midnight (1440 reads as midnight). */\nexport function formatMinutes(minutes: number, format: CalendarFormat): string {\n const wrapped = ((Math.round(minutes) % 1440) + 1440) % 1440;\n return formatTimeOfDay(wrapped, format.locale, format.hourCycle);\n}\n\n/** \"10:15 – 11:15\". */\nexport function formatMinuteRange(start: number, end: number, format: CalendarFormat): string {\n return `${formatMinutes(start, format)} – ${formatMinutes(end, format)}`;\n}\n\n/** The time an instant shows on the clock of `timeZone`. */\nexport function formatInstantTime(instant: Date, timeZone: string, format: CalendarFormat): string {\n return formatMinutes(instantToZoned(instant, timeZone).minutes, format);\n}\n\n/** \"10:15 – 11:15\", both ends on the clock of `timeZone`. */\nexport function formatInstantRange(\n start: Date,\n end: Date,\n timeZone: string,\n format: CalendarFormat\n): string {\n return `${formatInstantTime(start, timeZone, format)} – ${formatInstantTime(end, timeZone, format)}`;\n}\n\n/**\n * A timed span over more than one day, with its days: \"Mon 16 Nov, 10:00 – Tue 17 Nov, 10:00\",\n * both ends on the clock of `timeZone`.\n */\nexport function formatDayTimeSpan(\n start: Date,\n end: Date,\n timeZone: string,\n format: CalendarFormat\n): string {\n const at = (instant: Date) => {\n const zoned = instantToZoned(instant, timeZone);\n return `${formatDay(zoned.date, format, 'short')}, ${formatMinutes(zoned.minutes, format)}`;\n };\n return `${at(start)} – ${at(end)}`;\n}\n\n/** The words of a length of time, already translated by the caller. */\nexport interface DurationWords {\n /** \"{{minutes}} min\" */\n minutes: string;\n /** \"{{hours}} h\" */\n hours: string;\n /** \"{{hours}} h {{minutes}} min\" */\n hoursMinutes: string;\n}\n\n/** \"45 min\", \"1 h\", \"2 h 30 min\". */\nexport function formatDuration(totalMinutes: number, words: DurationWords): string {\n const rounded = Math.max(0, Math.round(totalMinutes));\n const hours = Math.floor(rounded / 60);\n const minutes = rounded % 60;\n const fill = (template: string) =>\n template.replace('{{hours}}', String(hours)).replace('{{minutes}}', String(minutes));\n if (hours === 0) return fill(words.minutes);\n return minutes === 0 ? fill(words.hours) : fill(words.hoursMinutes);\n}\n"],"mappings":";;;AA6BA,SAAgBA,EACd,GACA,GACoB;CACpB,IAAI,CAACC,GAAW,OAAOC,EAAgB;CACvC,IAAMC,IAAWF,EAAU,YAAY,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC;CAIvD,OAHiBC,EAAgB,MAC9B,MAAQE,EAAI,YAAY,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,OAAOD,KAAYC,EAAI,SAAS,GAAG,CAEvE,KAAYH;AACrB;AAEA,IAAMI,oBAAU,IAAI,IAAiC;AAErD,SAASC,EACP,GACA,GACqB;CACrB,IAAMC,IAAM,GAAGC,KAAU,GAAG,GAAG,KAAK,UAAUC,CAAO,KACjDC,IAASL,EAAQ,IAAIE,CAAG;CAC5B,IAAI,CAACG,GAAQ;EACX,IAAI;GACF,IAAS,IAAI,KAAK,eAAeF,GAAQ;IAAE,GAAGC;IAAS,UAAU;GAAM,CAAC;EAC1E,QAAQ;GACN,IAAS,IAAI,KAAK,eAAe,KAAA,GAAW;IAAE,GAAGA;IAAS,UAAU;GAAM,CAAC;EAC7E;EACA,EAAQ,IAAIF,GAAKG,CAAM;CACzB;CACA,OAAOA;AACT;AAGA,SAAgBC,EAAY,GAAuB;CACjD,IAAMC,IAAQC,EAAeC,CAAI;CAEjC,OADKF,IACE,IAAI,KAAK,KAAK,IAAIA,EAAM,MAAMA,EAAM,QAAQ,GAAGA,EAAM,GAAG,CAAC,o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GJ,EAAcK,GAAOlB,CAAM,EAAE,KAAKa,EAAcM,GAAKnB,CAAM;AACvE;AAGA,SAAgBoB,EAAkB,GAAe,GAAkB,GAAgC;CACjG,OAAOP,EAAcQ,EAAeC,GAASC,CAAQ,CAAC,CAAC,SAASvB,CAAM;AACxE;AAGA,SAAgBwB,EACd,GACA,GACA,GACA,GACQ;CACR,OAAO,GAAGJ,EAAkBF,GAAOK,GAAUvB,CAAM,EAAE,KAAKoB,EAAkBD,GAAKI,GAAUvB,CAAM;AACnG;AAMA,SAAgByB,EACd,GACA,GACA,GACA,GACQ;CACR,IAAMC,KAAM,MAAkB;EAC5B,IAAMC,IAAQN,EAAeC,GAASC,CAAQ;EAC9C,OAAO,GAAGjB,EAAUqB,EAAM,MAAM3B,GAAQ,OAAO,EAAE,IAAIa,EAAcc,EAAM,SAAS3B,CAAM;CAC1F;CACA,OAAO,GAAG0B,EAAGR,CAAK,EAAE,KAAKQ,EAAGP,CAAG;AACjC;AAaA,SAAgBS,EAAe,GAAsB,GAA8B;CACjF,IAAMC,IAAU,KAAK,IAAI,GAAG,KAAK,MAAMC,CAAY,CAAC,GAC9CC,IAAQ,KAAK,MAAMF,IAAU,EAAE,GAC/Bd,IAAUc,IAAU;CAI1B,SAHc,MACZG,EAAS,QAAQ,aAAa,OAAOD,CAAK,CAAC,CAAC,CAAC,QAAQ,eAAe,OAAOhB,CAAO,CAAC,EAC7D,CAApBgB,MAAU,IAAeE,EAAM,UAC5BlB,MAAY,IAASkB,EAAM,QAAcA,EAAM,YADZ;AAE5C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
|
+
import { DateValue } from '@burdenoff/fe-libs/ui';
|
|
3
|
+
import { AllDayLanes, CalendarEventV2 } from '../types';
|
|
4
|
+
/** A lane's height and the bar in it. */
|
|
5
|
+
export declare const ALL_DAY_LANE_PX = 24;
|
|
6
|
+
/** All lanes show up to this many; past it, one fewer and "+N more". */
|
|
7
|
+
export declare const ALL_DAY_MAX_LANES = 3;
|
|
8
|
+
export interface AllDayRowProps {
|
|
9
|
+
days: readonly DateValue[];
|
|
10
|
+
lanes: AllDayLanes<CalendarEventV2> & {
|
|
11
|
+
totalLanes: number;
|
|
12
|
+
};
|
|
13
|
+
expanded: boolean;
|
|
14
|
+
onToggle: () => void;
|
|
15
|
+
gutter: number;
|
|
16
|
+
selectedId: string | null;
|
|
17
|
+
onOpen: (event: CalendarEventV2, element: HTMLElement) => void;
|
|
18
|
+
onKeyDown: (event: KeyboardEvent<HTMLButtonElement>, calendarEvent: CalendarEventV2) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function AllDayRow({ days, lanes, expanded, onToggle, gutter, selectedId, onOpen, onKeyDown, }: AllDayRowProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { calendarHueStyle as e } from "../colors.js";
|
|
2
|
+
import { formatDay as t } from "../format.js";
|
|
3
|
+
import { useCalendarPage as n } from "../page/CalendarPageContext.js";
|
|
4
|
+
import { eventDays as r, isWeekendDay as i } from "../time/calendarTime.js";
|
|
5
|
+
import { FOCUS_RING as a, blockFill as o } from "../styles.js";
|
|
6
|
+
import { ChevronDown as s, ChevronLeft as c, ChevronRight as l, ChevronUp as u } from "lucide-react";
|
|
7
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
8
|
+
import { cn as p } from "@burdenoff/fe-libs/utils";
|
|
9
|
+
var m = 21;
|
|
10
|
+
function h({ days: h, lanes: g, expanded: _, onToggle: v, gutter: y, selectedId: b, onOpen: x, onKeyDown: S }) {
|
|
11
|
+
let C = n(), { tr: w, format: T, timeZone: E } = C, D = h.length, O = g.hiddenPerDay.some((e) => e > 0), k = Math.max(1, g.laneCount + +!!O), A = g.totalLanes > 3, j = w("calendar.v2.allDay", "All day");
|
|
12
|
+
return /* @__PURE__ */ f("div", {
|
|
13
|
+
className: "grid border-b border-border-default",
|
|
14
|
+
style: { gridTemplateColumns: `${y}px minmax(0, 1fr)` },
|
|
15
|
+
children: [/* @__PURE__ */ d("div", {
|
|
16
|
+
className: "flex items-start justify-end pe-1.5 pt-[7px] text-[10.5px] whitespace-nowrap text-text-muted",
|
|
17
|
+
children: A ? /* @__PURE__ */ f("button", {
|
|
18
|
+
type: "button",
|
|
19
|
+
onClick: v,
|
|
20
|
+
"aria-expanded": _,
|
|
21
|
+
className: p("inline-flex items-center gap-0.5 rounded-sm hover:text-text-primary", a),
|
|
22
|
+
children: [j, d(_ ? u : s, {
|
|
23
|
+
className: "size-3",
|
|
24
|
+
"aria-hidden": "true"
|
|
25
|
+
})]
|
|
26
|
+
}) : /* @__PURE__ */ d("span", { children: j })
|
|
27
|
+
}), /* @__PURE__ */ f("div", {
|
|
28
|
+
className: "relative grid",
|
|
29
|
+
style: {
|
|
30
|
+
gridTemplateColumns: `repeat(${D}, minmax(0, 1fr))`,
|
|
31
|
+
height: k * 24 + 8
|
|
32
|
+
},
|
|
33
|
+
children: [
|
|
34
|
+
h.map((e) => /* @__PURE__ */ d("div", { className: p("border-s border-border-subtle", i(e) && "bg-bg-sunken/60") }, e)),
|
|
35
|
+
g.bars.map((n) => {
|
|
36
|
+
let i = n.event, s = C.lookOf(i), u = r(i, E), h = u.start !== u.end, g = {
|
|
37
|
+
...e(C.hueOf(i.calendarId)),
|
|
38
|
+
top: 4 + n.lane * 24,
|
|
39
|
+
height: m,
|
|
40
|
+
insetInlineStart: `calc(${n.firstIndex / D * 100}% + 3px)`,
|
|
41
|
+
width: `calc(${(n.lastIndex - n.firstIndex + 1) / D * 100}% - 6px)`
|
|
42
|
+
};
|
|
43
|
+
return /* @__PURE__ */ f("button", {
|
|
44
|
+
type: "button",
|
|
45
|
+
"data-event-id": i.id,
|
|
46
|
+
"data-all-day": !0,
|
|
47
|
+
"aria-haspopup": "dialog",
|
|
48
|
+
"aria-label": `${C.labelOf(i)}, ${h ? w("calendar.v2.fromTo", "{{from}} to {{to}}", {
|
|
49
|
+
from: t(u.start, T, "short"),
|
|
50
|
+
to: t(u.end, T, "short")
|
|
51
|
+
}) : t(u.start, T, "short")}`,
|
|
52
|
+
style: g,
|
|
53
|
+
onClick: (e) => x(i, e.currentTarget),
|
|
54
|
+
onKeyDown: (e) => S(e, i),
|
|
55
|
+
className: p("absolute z-[1] flex min-w-0 items-center gap-1.5 rounded-md px-2 text-start text-xs font-semibold", "hover:shadow-[0_0_0_2px_var(--cal-hue)]", a, o(s), s.faded && "opacity-[0.56]", n.continuesBefore && "rounded-s-none", n.continuesAfter && "rounded-e-none", b === i.id && "outline-2 outline-offset-1 outline-[var(--color-focus-ring)]"),
|
|
56
|
+
children: [
|
|
57
|
+
n.continuesBefore ? /* @__PURE__ */ d(c, {
|
|
58
|
+
className: "size-3 shrink-0 rtl:rotate-180",
|
|
59
|
+
"aria-hidden": "true"
|
|
60
|
+
}) : null,
|
|
61
|
+
/* @__PURE__ */ d("span", {
|
|
62
|
+
className: p("min-w-0 truncate", s.declined && "line-through"),
|
|
63
|
+
children: s.title
|
|
64
|
+
}),
|
|
65
|
+
h && !n.continuesBefore ? /* @__PURE__ */ d("span", {
|
|
66
|
+
className: "ms-auto shrink-0 text-[11px] font-medium whitespace-nowrap text-text-secondary",
|
|
67
|
+
children: w("calendar.v2.until", "until {{day}}", { day: t(u.end, T, "short") })
|
|
68
|
+
}) : null,
|
|
69
|
+
n.continuesAfter ? /* @__PURE__ */ d(l, {
|
|
70
|
+
className: "size-3 shrink-0 rtl:rotate-180",
|
|
71
|
+
"aria-hidden": "true"
|
|
72
|
+
}) : null
|
|
73
|
+
]
|
|
74
|
+
}, i.id);
|
|
75
|
+
}),
|
|
76
|
+
g.hiddenPerDay.map((e, t) => e > 0 ? /* @__PURE__ */ d("button", {
|
|
77
|
+
type: "button",
|
|
78
|
+
onClick: v,
|
|
79
|
+
"aria-expanded": !1,
|
|
80
|
+
className: p("absolute z-[1] rounded-sm px-1.5 text-start text-[11px] font-semibold text-text-link hover:underline", a),
|
|
81
|
+
style: {
|
|
82
|
+
top: 4 + g.laneCount * 24,
|
|
83
|
+
height: m,
|
|
84
|
+
insetInlineStart: `calc(${t / D * 100}% + 3px)`
|
|
85
|
+
},
|
|
86
|
+
children: w("calendar.v2.moreCount", "+{{count}} more", { count: e })
|
|
87
|
+
}, h[t]) : null)
|
|
88
|
+
]
|
|
89
|
+
})]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export { h as AllDayRow };
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=AllDayRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AllDayRow.js","names":["ALL_DAY_BAR_PX","AllDayRow","page","useCalendarPage","count","days","hasMore","lanes","hidden","rows","expandable","label","tr","gutter","onToggle","expanded","cn","FOCUS_RING","jsx","ChevronUp","ChevronDown","isWeekendDay","day","event","bar","look","span","eventDays","timeZone","multiDay","style","calendarHueStyle","formatDay","format","onOpen","clickEvent","onKeyDown","keyEvent","blockFill","selectedId","ChevronLeft","ChevronRight","index"],"sources":["../../../src/v2/grid/AllDayRow.tsx"],"sourcesContent":["/**\n * The time grid's all-day row (BOFF-15698 A1): all-day and many-day events as bars across the\n * days they cover, in lanes. Past three lanes, two show and each day says \"+N more\"; the\n * \"All day\" toggle opens every lane.\n */\nimport type { CSSProperties, KeyboardEvent } from 'react';\nimport { ChevronDown, ChevronLeft, ChevronRight, ChevronUp } from 'lucide-react';\nimport type { DateValue } from '@burdenoff/fe-libs/ui';\nimport { cn } from '@burdenoff/fe-libs/utils';\nimport { calendarHueStyle } from '../colors';\nimport { formatDay } from '../format';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport { isWeekendDay } from '../time/calendarTime';\nimport { eventDays } from '../time/calendarTime';\nimport { blockFill, EVENT_PAST, EVENT_SELECTED, FOCUS_RING } from '../styles';\nimport type { AllDayLanes, CalendarEventV2 } from '../types';\n\n/** A lane's height and the bar in it. */\nexport const ALL_DAY_LANE_PX = 24;\nconst ALL_DAY_BAR_PX = 21;\n/** All lanes show up to this many; past it, one fewer and \"+N more\". */\nexport const ALL_DAY_MAX_LANES = 3;\n\nexport interface AllDayRowProps {\n days: readonly DateValue[];\n lanes: AllDayLanes<CalendarEventV2> & { totalLanes: number };\n expanded: boolean;\n onToggle: () => void;\n gutter: number;\n selectedId: string | null;\n onOpen: (event: CalendarEventV2, element: HTMLElement) => void;\n onKeyDown: (event: KeyboardEvent<HTMLButtonElement>, calendarEvent: CalendarEventV2) => void;\n}\n\nexport function AllDayRow({\n days,\n lanes,\n expanded,\n onToggle,\n gutter,\n selectedId,\n onOpen,\n onKeyDown,\n}: AllDayRowProps) {\n const page = useCalendarPage();\n const { tr, format, timeZone } = page;\n const count = days.length;\n const hasMore = lanes.hiddenPerDay.some((hidden) => hidden > 0);\n const rows = Math.max(1, lanes.laneCount + (hasMore ? 1 : 0));\n const expandable = lanes.totalLanes > ALL_DAY_MAX_LANES;\n const label = tr('calendar.v2.allDay', 'All day');\n\n return (\n <div\n className=\"grid border-b border-border-default\"\n style={{ gridTemplateColumns: `${gutter}px minmax(0, 1fr)` }}\n >\n <div className=\"flex items-start justify-end pe-1.5 pt-[7px] text-[10.5px] whitespace-nowrap text-text-muted\">\n {expandable ? (\n <button\n type=\"button\"\n onClick={onToggle}\n aria-expanded={expanded}\n className={cn(\n 'inline-flex items-center gap-0.5 rounded-sm hover:text-text-primary',\n FOCUS_RING\n )}\n >\n {label}\n {expanded ? (\n <ChevronUp className=\"size-3\" aria-hidden=\"true\" />\n ) : (\n <ChevronDown className=\"size-3\" aria-hidden=\"true\" />\n )}\n </button>\n ) : (\n <span>{label}</span>\n )}\n </div>\n <div\n className=\"relative grid\"\n style={{\n gridTemplateColumns: `repeat(${count}, minmax(0, 1fr))`,\n height: rows * ALL_DAY_LANE_PX + 8,\n }}\n >\n {days.map((day) => (\n <div\n key={day}\n className={cn('border-s border-border-subtle', isWeekendDay(day) && 'bg-bg-sunken/60')}\n />\n ))}\n {lanes.bars.map((bar) => {\n const event = bar.event;\n const look = page.lookOf(event);\n const span = eventDays(event, timeZone);\n const multiDay = span.start !== span.end;\n const style: CSSProperties = {\n ...calendarHueStyle(page.hueOf(event.calendarId)),\n top: 4 + bar.lane * ALL_DAY_LANE_PX,\n height: ALL_DAY_BAR_PX,\n insetInlineStart: `calc(${(bar.firstIndex / count) * 100}% + 3px)`,\n width: `calc(${((bar.lastIndex - bar.firstIndex + 1) / count) * 100}% - 6px)`,\n };\n return (\n <button\n key={event.id}\n type=\"button\"\n data-event-id={event.id}\n data-all-day\n aria-haspopup=\"dialog\"\n aria-label={`${page.labelOf(event)}, ${\n multiDay\n ? tr('calendar.v2.fromTo', '{{from}} to {{to}}', {\n from: formatDay(span.start, format, 'short'),\n to: formatDay(span.end, format, 'short'),\n })\n : formatDay(span.start, format, 'short')\n }`}\n style={style}\n onClick={(clickEvent) => onOpen(event, clickEvent.currentTarget)}\n onKeyDown={(keyEvent) => onKeyDown(keyEvent, event)}\n className={cn(\n 'absolute z-[1] flex min-w-0 items-center gap-1.5 rounded-md px-2 text-start text-xs font-semibold',\n 'hover:shadow-[0_0_0_2px_var(--cal-hue)]',\n FOCUS_RING,\n blockFill(look),\n look.faded && EVENT_PAST,\n bar.continuesBefore && 'rounded-s-none',\n bar.continuesAfter && 'rounded-e-none',\n selectedId === event.id && EVENT_SELECTED\n )}\n >\n {bar.continuesBefore ? (\n <ChevronLeft className=\"size-3 shrink-0 rtl:rotate-180\" aria-hidden=\"true\" />\n ) : null}\n <span className={cn('min-w-0 truncate', look.declined && 'line-through')}>\n {look.title}\n </span>\n {multiDay && !bar.continuesBefore ? (\n <span className=\"ms-auto shrink-0 text-[11px] font-medium whitespace-nowrap text-text-secondary\">\n {tr('calendar.v2.until', 'until {{day}}', {\n day: formatDay(span.end, format, 'short'),\n })}\n </span>\n ) : null}\n {bar.continuesAfter ? (\n <ChevronRight className=\"size-3 shrink-0 rtl:rotate-180\" aria-hidden=\"true\" />\n ) : null}\n </button>\n );\n })}\n {lanes.hiddenPerDay.map((hidden, index) =>\n hidden > 0 ? (\n <button\n key={days[index]}\n type=\"button\"\n onClick={onToggle}\n aria-expanded={false}\n className={cn(\n 'absolute z-[1] rounded-sm px-1.5 text-start text-[11px] font-semibold text-text-link hover:underline',\n FOCUS_RING\n )}\n style={{\n top: 4 + lanes.laneCount * ALL_DAY_LANE_PX,\n height: ALL_DAY_BAR_PX,\n insetInlineStart: `calc(${(index / count) * 100}% + 3px)`,\n }}\n >\n {tr('calendar.v2.moreCount', '+{{count}} more', { count: hidden })}\n </button>\n ) : null\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAmBA,IAAMA,IAAiB;AAevB,SAAgBC,EAAU,EACxB,SACA,UACA,aACA,aACA,WACA,eACA,WACA,gBACiB;CACjB,IAAMC,IAAOC,EAAgB,GACvB,EAAE,OAAI,WAAQ,gBAAaD,GAC3BE,IAAQC,EAAK,QACbC,IAAUC,EAAM,aAAa,MAAM,MAAWC,IAAS,CAAC,GACxDC,IAAO,KAAK,IAAI,GAAGF,EAAM,YAAa,IAAgB,GACtDG,IAAaH,EAAM,aAAA,GACnBI,IAAQC,EAAG,sBAAsB,SAAS;CAEhD,OACE,kBAAC,OAAD;EACE,WAAU;EACV,OAAO,EAAE,qBAAqB,GAAGC,EAAO,mBAAmB;EAF7D,UAAA,CAIE,kBAAC,OAAD;GAAK,WAAU;GACZ,UAAAH,IACC,kBAAC,UAAD;IACE,MAAK;IACL,SAASI;IACT,iBAAeC;IACf,WAAWC,EACT,uEACAC,CACF;IAPF,UAAA,CASGN,GAECO,EADDH,IACEI,IAEAC,GAFD;KAAW,WAAU;KAAS,eAAY;IAAQ,CAEE,CAEhD;GAER,CAAA,IAAA,kBAAC,QAAD,EAAA,UAAOT,EAAY,CAAA;EAElB,CAAA,GACL,kBAAC,OAAD;GACE,WAAU;GACV,OAAO;IACL,qBAAqB,UAAUP,EAAM;IACrC,QAAQK,IAAA,KAAyB;GACnC;GALF,UAAA;IAOGJ,EAAK,KAAK,MACT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