@burdenoff/microfe-calendar 2026.1123.2 → 2026.1124.1
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 +596 -0
- package/dist/generated/wspace-operations.js +190 -85
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/translations/en.d.ts +292 -0
- package/dist/v2/CalendarPageV2.js +87 -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 +204 -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 +179 -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 +12 -0
- package/dist/v2/list/ListViewV2.js +90 -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 +324 -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 +284 -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/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,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,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,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,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;MAC/D,YAAY,MAAaC,EAAUC,GAAUd,CAAK;MAClD,WAAWP,EACT,qGACA,2CACAC,GACAqB,EAAUb,CAAI,GACdA,EAAK,SAAA,kBACLD,EAAI,mBAAmB,kBACvBA,EAAI,kBAAkB,kBACtBe,MAAehB,EAAM,MAAA,8DACvB;MA1BF,UAAA;OA4BGC,EAAI,kBACH,kBAACgB,GAAD;QAAa,WAAU;QAAiC,eAAY;OAAQ,CAAA,IAC1E;OACJ,kBAAC,QAAD;QAAM,WAAWxB,EAAG,oBAAoBS,EAAK,YAAY,cAAc;QACpE,UAAAA,EAAK;OACF,CAAA;OACLI,KAAY,CAACL,EAAI,kBAChB,kBAAC,QAAD;QAAM,WAAU;QACb,UAAAZ,EAAG,qBAAqB,iBAAiB,EACxC,KAAKoB,EAAUN,EAAK,KAAKO,GAAQ,OAAO,EAC1C,CAAC;OACG,CAAA,IACJ;OACHT,EAAI,iBACH,kBAACiB,GAAD;QAAc,WAAU;QAAiC,eAAY;OAAQ,CAAA,IAC3E;MACE;KA3CD,GAAAlB,EAAM,EA2CL;IAEZ,CAAC;IACAhB,EAAM,aAAa,KAAK,GAAQ,MAC/BC,IAAS,IACP,kBAAC,UAAD;KAEE,MAAK;KACL,SAASM;KACT,iBAAe;KACf,WAAWE,EACT,wGACAC,CACF;KACA,OAAO;MACL,KAAK,IAAIV,EAAM,YAAA;MACf,QAAQP;MACR,kBAAkB,QAAS0C,IAAQtC,IAAS,IAAI;KAClD;KAEC,UAAAQ,EAAG,yBAAyB,mBAAmB,EAAE,OAAOJ,EAAO,CAAC;IAC3D,GAfDH,EAAKqC,EAeJ,IACN,IACN;GACG;EACF,CAAA,CAAA;;AAET"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { KeyboardEvent } from 'react';
|
|
2
|
+
import { EventLook } from '../events/eventLook';
|
|
3
|
+
import { CalendarFormat } from '../format';
|
|
4
|
+
import { CalendarEventV2, PlacedSegment } from '../types';
|
|
5
|
+
import { CalendarHue } from '../colors';
|
|
6
|
+
export interface EventBlockProps {
|
|
7
|
+
placed: PlacedSegment<CalendarEventV2>;
|
|
8
|
+
hourHeight: number;
|
|
9
|
+
look: EventLook;
|
|
10
|
+
hue: CalendarHue;
|
|
11
|
+
label: string;
|
|
12
|
+
format: CalendarFormat;
|
|
13
|
+
selected: boolean;
|
|
14
|
+
/** Shows the resize handle (desktop, editable). */
|
|
15
|
+
resizable: boolean;
|
|
16
|
+
onOpen: (event: CalendarEventV2, element: HTMLElement) => void;
|
|
17
|
+
onKeyDown: (event: KeyboardEvent<HTMLButtonElement>, calendarEvent: CalendarEventV2) => void;
|
|
18
|
+
/** A drag just ended on this piece: its click must not open the peek. */
|
|
19
|
+
consumeClick: () => boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function EventBlock({ placed, hourHeight, look, hue, label, format, selected, resizable, onOpen, onKeyDown, consumeClick, }: EventBlockProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { calendarHueStyle as e } from "../colors.js";
|
|
2
|
+
import { formatMinuteRange as t, formatMinutes as n } from "../format.js";
|
|
3
|
+
import { EVENT_EDGE as r, blockFill as i } from "../styles.js";
|
|
4
|
+
import { minuteOffset as a } from "./geometry.js";
|
|
5
|
+
import { AlertTriangle as o, CircleHelp as s, Clock3 as c, Repeat as l, Video as u } from "lucide-react";
|
|
6
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
7
|
+
import { cn as m } from "@burdenoff/fe-libs/utils";
|
|
8
|
+
// src/v2/grid/EventBlock.tsx
|
|
9
|
+
var h = 34, g = 52;
|
|
10
|
+
function _(e, t) {
|
|
11
|
+
return e.roomRefused ? /* @__PURE__ */ f(o, {
|
|
12
|
+
className: "size-3 text-status-warning-text",
|
|
13
|
+
"aria-hidden": "true"
|
|
14
|
+
}) : e.invitation ? /* @__PURE__ */ f(s, {
|
|
15
|
+
className: "size-3",
|
|
16
|
+
"aria-hidden": "true"
|
|
17
|
+
}) : e.roomPending ? /* @__PURE__ */ f(c, {
|
|
18
|
+
className: "size-3",
|
|
19
|
+
"aria-hidden": "true"
|
|
20
|
+
}) : t ? null : e.online ? /* @__PURE__ */ f(u, {
|
|
21
|
+
className: "size-3 text-text-muted",
|
|
22
|
+
"aria-hidden": "true"
|
|
23
|
+
}) : e.repeating ? /* @__PURE__ */ f(l, {
|
|
24
|
+
className: "size-3 text-text-muted",
|
|
25
|
+
"aria-hidden": "true"
|
|
26
|
+
}) : null;
|
|
27
|
+
}
|
|
28
|
+
function v(t, n, r) {
|
|
29
|
+
let i = Math.max(a(t.endMinute - t.startMinute, n), 20) - 2, o = t.column + t.span === t.columns;
|
|
30
|
+
return {
|
|
31
|
+
style: {
|
|
32
|
+
...e(r),
|
|
33
|
+
top: a(t.startMinute, n) + 1,
|
|
34
|
+
height: i,
|
|
35
|
+
insetInlineStart: `calc(${t.column / t.columns * 100}% + 2px)`,
|
|
36
|
+
width: `calc(${t.span / t.columns * 100}% - ${o ? 6 : 4}px)`
|
|
37
|
+
},
|
|
38
|
+
height: i
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
var y = "min-w-0 font-semibold", b = "min-w-0 truncate text-[11px] text-text-secondary";
|
|
42
|
+
function x({ placed: e, look: t, format: r }) {
|
|
43
|
+
let i = _(t, !0);
|
|
44
|
+
return /* @__PURE__ */ p(d, { children: [
|
|
45
|
+
/* @__PURE__ */ f("span", {
|
|
46
|
+
className: m(y, "shrink truncate", t.declined && "line-through"),
|
|
47
|
+
children: t.title
|
|
48
|
+
}),
|
|
49
|
+
/* @__PURE__ */ f("span", {
|
|
50
|
+
className: m(b, "shrink-[100] tabular-nums"),
|
|
51
|
+
children: n(e.startMinute, r)
|
|
52
|
+
}),
|
|
53
|
+
i ? /* @__PURE__ */ f("span", {
|
|
54
|
+
className: "ms-auto inline-flex shrink-0",
|
|
55
|
+
children: i
|
|
56
|
+
}) : null
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
59
|
+
function S({ placed: e, look: n, format: r, roomy: i }) {
|
|
60
|
+
let a = _(n, !1), o = !i && n.place ? ` · ${n.place}` : "";
|
|
61
|
+
return /* @__PURE__ */ p(d, { children: [
|
|
62
|
+
a ? /* @__PURE__ */ f("span", {
|
|
63
|
+
className: "absolute end-1 top-1 inline-flex",
|
|
64
|
+
children: a
|
|
65
|
+
}) : null,
|
|
66
|
+
/* @__PURE__ */ f("span", {
|
|
67
|
+
className: m(y, "line-clamp-2 break-words", n.declined && "line-through", a && "pe-3.5"),
|
|
68
|
+
children: n.title
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ p("span", {
|
|
71
|
+
className: m(b, "tabular-nums"),
|
|
72
|
+
children: [t(e.startMinute, e.endMinute, r), o]
|
|
73
|
+
}),
|
|
74
|
+
i && n.place ? /* @__PURE__ */ f("span", {
|
|
75
|
+
className: b,
|
|
76
|
+
children: n.place
|
|
77
|
+
}) : null
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
function C({ placed: e, hourHeight: t, look: n, hue: a, label: o, format: s, selected: c, resizable: l, onOpen: u, onKeyDown: d, consumeClick: _ }) {
|
|
81
|
+
let { event: y } = e, { style: b, height: C } = v(e, t, a), w = C < h;
|
|
82
|
+
return /* @__PURE__ */ p("button", {
|
|
83
|
+
type: "button",
|
|
84
|
+
"data-event-id": y.id,
|
|
85
|
+
"data-movable": n.movable || void 0,
|
|
86
|
+
"aria-label": o,
|
|
87
|
+
"aria-haspopup": "dialog",
|
|
88
|
+
style: b,
|
|
89
|
+
onClick: (e) => {
|
|
90
|
+
_() || u(y, e.currentTarget);
|
|
91
|
+
},
|
|
92
|
+
onKeyDown: (e) => d(e, y),
|
|
93
|
+
className: m("group absolute z-[3] flex min-w-0 overflow-hidden rounded-[7px] text-start text-xs leading-[1.3] transition-shadow", "hover:z-[6] hover:shadow-[0_4px_14px_color-mix(in_oklab,var(--cal-hue)_28%,transparent)]", "focus-visible:z-[6] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--color-focus-ring)]", r, i(n), w ? "flex-row items-center gap-1.5 px-[7px] py-0" : "flex-col gap-px px-[7px] pt-[3px] pb-0.5", n.movable ? "cursor-grab" : "cursor-pointer", n.faded && "opacity-[0.56]", n.happeningNow && "shadow-[0_0_0_1.5px_var(--cal-hue)]", c && m("outline-2 outline-offset-1 outline-[var(--color-focus-ring)]", "z-[7]"), e.continuesBefore && "rounded-t-none", e.continuesAfter && "rounded-b-none"),
|
|
94
|
+
children: [w ? /* @__PURE__ */ f(x, {
|
|
95
|
+
placed: e,
|
|
96
|
+
look: n,
|
|
97
|
+
format: s
|
|
98
|
+
}) : /* @__PURE__ */ f(S, {
|
|
99
|
+
placed: e,
|
|
100
|
+
look: n,
|
|
101
|
+
format: s,
|
|
102
|
+
roomy: C >= g
|
|
103
|
+
}), l ? /* @__PURE__ */ f("span", {
|
|
104
|
+
"data-resize-handle": !0,
|
|
105
|
+
"aria-hidden": "true",
|
|
106
|
+
className: "absolute inset-x-0 bottom-0 h-[7px] cursor-ns-resize after:absolute after:start-1/2 after:bottom-0.5 after:h-[3px] after:w-[18px] after:-translate-x-1/2 after:rounded-[3px] after:bg-[var(--cal-hue)] after:opacity-0 after:transition-opacity group-hover:after:opacity-70"
|
|
107
|
+
}) : null]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
export { C as EventBlock };
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=EventBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventBlock.js","names":["_Fragment","SHORT_PX","ROOMY_PX","markerIcon","look","AlertTriangle","CircleHelp","Clock3","short","Video","Repeat","blockStyle","height","minuteOffset","placed","hourHeight","lastColumn","calendarHueStyle","hue","BODY_TITLE","BODY_META","ShortBody","marker","Fragment","cn","formatMinutes","format","TallBody","placeInline","roomy","formatMinuteRange","EventBlock","event","label","consumeClick","onOpen","clickEvent","onKeyDown","keyEvent","EVENT_EDGE","blockFill","selected","resizable"],"sources":["../../../src/v2/grid/EventBlock.tsx"],"sourcesContent":["/**\n * One event's piece in a time-grid column (BOFF-15698 A1): placed by the overlap layout, in its\n * calendar's hue, with its markers: an invitation outlined, \"Maybe\" striped, someone else's\n * private time hatched \"Busy\", ended ones faded, the one on now ringed. A short piece shows its\n * title and start on one line; a taller one its time and place too. Editable pieces have a\n * resize handle at the bottom (not on phones).\n */\nimport type { CSSProperties, KeyboardEvent, MouseEvent } from 'react';\nimport { AlertTriangle, CircleHelp, Clock3, Repeat, Video } from 'lucide-react';\nimport { cn } from '@burdenoff/fe-libs/utils';\nimport { calendarHueStyle } from '../colors';\nimport type { EventLook } from '../events/eventLook';\nimport { formatMinuteRange, formatMinutes, type CalendarFormat } from '../format';\nimport { blockFill, EVENT_EDGE, EVENT_NOW, EVENT_PAST, EVENT_SELECTED } from '../styles';\nimport type { CalendarEventV2, PlacedSegment } from '../types';\nimport type { CalendarHue } from '../colors';\nimport { minuteOffset } from './geometry';\n\n/** Below this height a piece shows one line. */\nconst SHORT_PX = 34;\n/** From this height a piece shows its place on its own line. */\nconst ROOMY_PX = 52;\n\nexport interface EventBlockProps {\n placed: PlacedSegment<CalendarEventV2>;\n hourHeight: number;\n look: EventLook;\n hue: CalendarHue;\n label: string;\n format: CalendarFormat;\n selected: boolean;\n /** Shows the resize handle (desktop, editable). */\n resizable: boolean;\n onOpen: (event: CalendarEventV2, element: HTMLElement) => void;\n onKeyDown: (event: KeyboardEvent<HTMLButtonElement>, calendarEvent: CalendarEventV2) => void;\n /** A drag just ended on this piece: its click must not open the peek. */\n consumeClick: () => boolean;\n}\n\nfunction markerIcon(look: EventLook, short: boolean) {\n if (look.roomRefused)\n return <AlertTriangle className=\"size-3 text-status-warning-text\" aria-hidden=\"true\" />;\n if (look.invitation) return <CircleHelp className=\"size-3\" aria-hidden=\"true\" />;\n if (look.roomPending) return <Clock3 className=\"size-3\" aria-hidden=\"true\" />;\n if (short) return null;\n if (look.online) return <Video className=\"size-3 text-text-muted\" aria-hidden=\"true\" />;\n if (look.repeating) return <Repeat className=\"size-3 text-text-muted\" aria-hidden=\"true\" />;\n return null;\n}\n\n/** Where a piece sits in its column: its minutes down, its columns across. */\nfunction blockStyle(placed: PlacedSegment<CalendarEventV2>, hourHeight: number, hue: CalendarHue) {\n const height = Math.max(minuteOffset(placed.endMinute - placed.startMinute, hourHeight), 20) - 2;\n const lastColumn = placed.column + placed.span === placed.columns;\n const style: CSSProperties = {\n ...calendarHueStyle(hue),\n top: minuteOffset(placed.startMinute, hourHeight) + 1,\n height,\n insetInlineStart: `calc(${(placed.column / placed.columns) * 100}% + 2px)`,\n width: `calc(${(placed.span / placed.columns) * 100}% - ${lastColumn ? 6 : 4}px)`,\n };\n return { style, height };\n}\n\ninterface BodyProps {\n placed: PlacedSegment<CalendarEventV2>;\n look: EventLook;\n format: CalendarFormat;\n}\n\nconst BODY_TITLE = 'min-w-0 font-semibold';\nconst BODY_META = 'min-w-0 truncate text-[11px] text-text-secondary';\n\n/** A short piece: its title and start on one line, the marker at the end. */\nfunction ShortBody({ placed, look, format }: BodyProps) {\n const marker = markerIcon(look, true);\n return (\n <>\n <span className={cn(BODY_TITLE, 'shrink truncate', look.declined && 'line-through')}>\n {look.title}\n </span>\n <span className={cn(BODY_META, 'shrink-[100] tabular-nums')}>\n {formatMinutes(placed.startMinute, format)}\n </span>\n {marker ? <span className=\"ms-auto inline-flex shrink-0\">{marker}</span> : null}\n </>\n );\n}\n\n/** A taller piece: its title, its time, and its place (on its own line when there's room). */\nfunction TallBody({ placed, look, format, roomy }: BodyProps & { roomy: boolean }) {\n const marker = markerIcon(look, false);\n const placeInline = !roomy && look.place ? ` · ${look.place}` : '';\n return (\n <>\n {marker ? <span className=\"absolute end-1 top-1 inline-flex\">{marker}</span> : null}\n <span\n className={cn(\n BODY_TITLE,\n 'line-clamp-2 break-words',\n look.declined && 'line-through',\n marker && 'pe-3.5'\n )}\n >\n {look.title}\n </span>\n <span className={cn(BODY_META, 'tabular-nums')}>\n {formatMinuteRange(placed.startMinute, placed.endMinute, format)}\n {placeInline}\n </span>\n {roomy && look.place ? <span className={BODY_META}>{look.place}</span> : null}\n </>\n );\n}\n\nexport function EventBlock({\n placed,\n hourHeight,\n look,\n hue,\n label,\n format,\n selected,\n resizable,\n onOpen,\n onKeyDown,\n consumeClick,\n}: EventBlockProps) {\n const { event } = placed;\n const { style, height } = blockStyle(placed, hourHeight, hue);\n const short = height < SHORT_PX;\n\n const onClick = (clickEvent: MouseEvent<HTMLButtonElement>) => {\n if (consumeClick()) return;\n onOpen(event, clickEvent.currentTarget);\n };\n\n return (\n <button\n type=\"button\"\n data-event-id={event.id}\n data-movable={look.movable || undefined}\n aria-label={label}\n aria-haspopup=\"dialog\"\n style={style}\n onClick={onClick}\n onKeyDown={(keyEvent) => onKeyDown(keyEvent, event)}\n className={cn(\n 'group absolute z-[3] flex min-w-0 overflow-hidden rounded-[7px] text-start text-xs leading-[1.3] transition-shadow',\n 'hover:z-[6] hover:shadow-[0_4px_14px_color-mix(in_oklab,var(--cal-hue)_28%,transparent)]',\n 'focus-visible:z-[6] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--color-focus-ring)]',\n EVENT_EDGE,\n blockFill(look),\n short\n ? 'flex-row items-center gap-1.5 px-[7px] py-0'\n : 'flex-col gap-px px-[7px] pt-[3px] pb-0.5',\n look.movable ? 'cursor-grab' : 'cursor-pointer',\n look.faded && EVENT_PAST,\n look.happeningNow && EVENT_NOW,\n selected && cn(EVENT_SELECTED, 'z-[7]'),\n placed.continuesBefore && 'rounded-t-none',\n placed.continuesAfter && 'rounded-b-none'\n )}\n >\n {short ? (\n <ShortBody placed={placed} look={look} format={format} />\n ) : (\n <TallBody placed={placed} look={look} format={format} roomy={height >= ROOMY_PX} />\n )}\n {resizable ? (\n <span\n data-resize-handle\n aria-hidden=\"true\"\n className=\"absolute inset-x-0 bottom-0 h-[7px] cursor-ns-resize after:absolute after:start-1/2 after:bottom-0.5 after:h-[3px] after:w-[18px] after:-translate-x-1/2 after:rounded-[3px] after:bg-[var(--cal-hue)] after:opacity-0 after:transition-opacity group-hover:after:opacity-70\"\n />\n ) : null}\n </button>\n );\n}\n"],"mappings":";;;;;;;;AAmBA,IAAMC,IAAW,IAEXC,IAAW;AAkBjB,SAASC,EAAW,GAAiB,GAAgB;CAQnD,OAPIC,EAAK,cACA,kBAACC,GAAD;EAAe,WAAU;EAAkC,eAAY;CAAQ,CAAA,IACpFD,EAAK,aAAmB,kBAACE,GAAD;EAAY,WAAU;EAAS,eAAY;CAAQ,CAAA,IAC3EF,EAAK,cAAoB,kBAACG,GAAD;EAAQ,WAAU;EAAS,eAAY;CAAQ,CAAA,IACxEC,IAAc,OACdJ,EAAK,SAAe,kBAACK,GAAD;EAAO,WAAU;EAAyB,eAAY;CAAQ,CAAA,IAClFL,EAAK,YAAkB,kBAACM,GAAD;EAAQ,WAAU;EAAyB,eAAY;CAAQ,CAAA,IACnF;AACT;AAGA,SAASC,EAAW,GAAwC,GAAoB,GAAkB;CAChG,IAAMC,IAAS,KAAK,IAAIC,EAAaC,EAAO,YAAYA,EAAO,aAAaC,CAAU,GAAG,EAAE,IAAI,GACzFC,IAAaF,EAAO,SAASA,EAAO,SAASA,EAAO;CAQ1D,OAAO;EAAE,OAAA;GANP,GAAGG,EAAiBC,CAAG;GACvB,KAAKL,EAAaC,EAAO,aAAaC,CAAU,IAAI;GACpD;GACA,kBAAkB,QAASD,EAAO,SAASA,EAAO,UAAW,IAAI;GACjE,OAAO,QAASA,EAAO,OAAOA,EAAO,UAAW,IAAI,MAAME,IAAa,IAAI,EAAE;EAEtE;EAAO;CAAO;AACzB;AAQA,IAAMG,IAAa,yBACbC,IAAY;AAGlB,SAASC,EAAU,EAAE,WAAQ,SAAM,aAAqB;CACtD,IAAMC,IAASnB,EAAWC,GAAM,EAAI;CACpC,OACE,kBAAAJ,GAAA,EAAA,UAAA;EACE,kBAAC,QAAD;GAAM,WAAWwB,EAAGL,GAAY,mBAAm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AAOH,GAAOI,EAAW,aAAa;EACxC;EAWI,YAAY,MAAaC,EAAUC,GAAUN,CAAK;EAClD,WAAWR,EACT,sHACA,4FACA,8HACAe,GACAC,EAAUpC,CAAI,GACdI,IACI,gDACA,4CACJJ,EAAK,UAAU,gBAAgB,kBAC/BA,EAAK,SAAA,kBACLA,EAAK,gBAAA,uCACLqC,KAAYjB,EAAA,gEAAmB,OAAO,GACtCV,EAAO,mBAAmB,kBAC1BA,EAAO,kBAAkB,gBAC3B;EAxBF,UAAA,CA0BGN,IACC,kBAACa,GAAD;GAAmB;GAAc;GAAc;EAAS,CAAA,IAExD,kBAACM,GAAD;GAAkB;GAAc;GAAc;GAAQ,OAAOf,KAAUV;EAAW,CAAA,GAEnFwC,IACC,kBAAC,QAAD;GACE,sBAAA;GACA,eAAY;GACZ,WAAU;EACX,CAAA,IACC,IACE;;AAEZ"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CSSProperties, KeyboardEvent } from 'react';
|
|
2
|
+
import { DateValue } from '@burdenoff/fe-libs/ui';
|
|
3
|
+
import { QuickDraft } from '../page/CalendarPageContext';
|
|
4
|
+
import { CalendarEventV2, PlacedSegment } from '../types';
|
|
5
|
+
import { DragGhost } from './useGridDrag';
|
|
6
|
+
/** The time zone (it opens Calendar settings) and the shown days (each opens its Day view). */
|
|
7
|
+
export declare function DayHeaderRow({ columnsStyle }: {
|
|
8
|
+
columnsStyle: CSSProperties;
|
|
9
|
+
}): import('react').JSX.Element;
|
|
10
|
+
/** The hours down the side, and the time now beside the now line (when today is shown). */
|
|
11
|
+
export declare function HourGutter({ hourHeight }: {
|
|
12
|
+
hourHeight: number;
|
|
13
|
+
}): import('react').JSX.Element;
|
|
14
|
+
export interface DayColumnProps {
|
|
15
|
+
day: DateValue;
|
|
16
|
+
placed: readonly PlacedSegment<CalendarEventV2>[];
|
|
17
|
+
hourHeight: number;
|
|
18
|
+
selectedId: string | null;
|
|
19
|
+
onOpen: (event: CalendarEventV2, element: HTMLElement) => void;
|
|
20
|
+
onKeyDown: (event: KeyboardEvent<HTMLButtonElement>, calendarEvent: CalendarEventV2) => void;
|
|
21
|
+
consumeClick: () => boolean;
|
|
22
|
+
/** A drag's preview in this column. */
|
|
23
|
+
ghost: DragGhost | null;
|
|
24
|
+
/** The quick create's slot in this column. */
|
|
25
|
+
quick: QuickDraft | null;
|
|
26
|
+
/** The keyboard cursor's minute in this column. */
|
|
27
|
+
cursorMinute: number | null;
|
|
28
|
+
}
|
|
29
|
+
/** One day of the grid: its working hours, events, the now line and what's being made. */
|
|
30
|
+
export declare function DayColumn({ day, placed, hourHeight, selectedId, onOpen, onKeyDown, consumeClick, ghost, quick, cursorMinute, }: DayColumnProps): import('react').JSX.Element;
|
|
31
|
+
export declare function GridGhost({ start, end, hourHeight, label, hueStyle, quickAnchor, }: {
|
|
32
|
+
start: number;
|
|
33
|
+
end: number;
|
|
34
|
+
hourHeight: number;
|
|
35
|
+
label: string;
|
|
36
|
+
hueStyle?: CSSProperties;
|
|
37
|
+
quickAnchor?: boolean;
|
|
38
|
+
}): import('react').JSX.Element;
|
|
39
|
+
/** Nothing on the shown days: a card over the grid, which stays usable around it. */
|
|
40
|
+
export declare function GridEmpty(): import('react').JSX.Element;
|