@remit/ui 0.0.224 → 0.0.225

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.
Files changed (51) hide show
  1. package/dist/components/app-shell-slotted.js +1 -1
  2. package/dist/components/app-switcher.d.ts +15 -0
  3. package/dist/components/app-switcher.js +31 -0
  4. package/dist/components/calendar-event-popup.d.ts +43 -0
  5. package/dist/components/calendar-event-popup.js +18 -0
  6. package/dist/components/calendar-event-sidebar.d.ts +34 -0
  7. package/dist/components/calendar-event-sidebar.js +16 -0
  8. package/dist/components/calendar-grid.d.ts +8 -7
  9. package/dist/components/calendar-grid.js +39 -108
  10. package/dist/components/calendar-popover.d.ts +25 -0
  11. package/dist/components/calendar-popover.js +84 -0
  12. package/dist/components/calendar-quick-create.d.ts +35 -0
  13. package/dist/components/calendar-quick-create.js +26 -0
  14. package/dist/components/calendar-screen-toolbar.d.ts +30 -0
  15. package/dist/components/calendar-screen-toolbar.js +24 -0
  16. package/dist/components/calendar-sheet.d.ts +14 -0
  17. package/dist/components/calendar-sheet.js +34 -0
  18. package/dist/components/calendar-side-pane.d.ts +20 -0
  19. package/dist/components/calendar-side-pane.js +11 -0
  20. package/dist/components/calendar-time-grid.d.ts +64 -0
  21. package/dist/components/calendar-time-grid.js +666 -0
  22. package/dist/components/calendar-toolbar.d.ts +0 -31
  23. package/dist/components/calendar-toolbar.js +0 -27
  24. package/dist/components/calendar-year.d.ts +11 -0
  25. package/dist/components/calendar-year.js +9 -0
  26. package/dist/components/compose-fab.js +3 -1
  27. package/dist/components/mini-month.d.ts +19 -0
  28. package/dist/components/mini-month.js +34 -0
  29. package/dist/index.d.ts +19 -3
  30. package/dist/index.js +19 -3
  31. package/dist/lib/calendar-range.d.ts +10 -0
  32. package/dist/lib/calendar-range.js +39 -0
  33. package/dist/lib/calendar-slot-pick.d.ts +29 -0
  34. package/dist/lib/calendar-slot-pick.js +67 -0
  35. package/dist/lib/event-drag.d.ts +20 -0
  36. package/dist/lib/event-drag.js +50 -0
  37. package/dist/lib/grid-keyboard.d.ts +15 -0
  38. package/dist/lib/grid-keyboard.js +46 -0
  39. package/dist/lib/iso-week.d.ts +2 -0
  40. package/dist/lib/iso-week.js +13 -0
  41. package/dist/lib/long-press.d.ts +25 -0
  42. package/dist/lib/long-press.js +37 -0
  43. package/dist/lib/mini-month.d.ts +27 -0
  44. package/dist/lib/mini-month.js +33 -0
  45. package/dist/lib/popup-placement.d.ts +22 -0
  46. package/dist/lib/popup-placement.js +39 -0
  47. package/dist/lib/time-grid-layout.d.ts +38 -0
  48. package/dist/lib/time-grid-layout.js +94 -0
  49. package/package.json +1 -1
  50. package/dist/components/event-detail.d.ts +0 -38
  51. package/dist/components/event-detail.js +0 -21
@@ -1,5 +1,3 @@
1
- import { type ReactNode } from "react";
2
- import type { CalendarViewId } from "./calendar-types.js";
3
1
  export interface SegmentOption<T extends string> {
4
2
  value: T;
5
3
  label: string;
@@ -22,32 +20,3 @@ export interface SegmentedProps<T extends string> {
22
20
  className?: string;
23
21
  }
24
22
  export declare function Segmented<T extends string>({ options, value, onChange, touch, ariaLabel, className, }: SegmentedProps<T>): import("react").JSX.Element;
25
- export interface CalendarViewSwitchProps {
26
- value: CalendarViewId;
27
- onChange: (view: CalendarViewId) => void;
28
- /** Restricts the ladder — a phone has no room for a year grid. */
29
- views?: CalendarViewId[];
30
- touch?: boolean;
31
- className?: string;
32
- }
33
- /**
34
- * The zoom ladder. Each step keeps the date in view, so moving between them is
35
- * changing magnification rather than opening a different screen.
36
- */
37
- export declare function CalendarViewSwitch({ value, onChange, views, touch, className, }: CalendarViewSwitchProps): import("react").JSX.Element;
38
- export interface CalendarDateNavProps {
39
- /** The range on screen, already formatted. */
40
- title: string;
41
- onPrev: () => void;
42
- onNext: () => void;
43
- onToday: () => void;
44
- /** Right-hand controls: the view switch, whatever else the view owns. */
45
- children?: ReactNode;
46
- touch?: boolean;
47
- }
48
- /**
49
- * Back, forward, and Today. Today lands on the same target from every view and
50
- * every distance away, so it is a way home rather than a jump whose result
51
- * depends on where you were.
52
- */
53
- export declare function CalendarDateNav({ title, onPrev, onNext, onToday, children, touch, }: CalendarDateNavProps): import("react").JSX.Element;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ChevronLeft, ChevronRight } from "lucide-react";
3
2
  import { useId } from "react";
4
3
  import { cn } from "../lib/cn.js";
5
4
  /**
@@ -16,29 +15,3 @@ export function Segmented({ options, value, onChange, touch, ariaLabel, classNam
16
15
  const group = useId();
17
16
  return (_jsxs("fieldset", { className: cn("inline-flex items-center gap-0.5", className), children: [_jsx("legend", { className: "sr-only", children: ariaLabel }), options.map((option) => (_jsxs("label", { className: cn(segmentClassName(value === option.value), touch ? "min-h-11 flex-1 text-sm" : "h-7 text-xs"), children: [_jsx("input", { type: "radio", name: group, value: option.value, checked: value === option.value, onChange: () => onChange(option.value), className: "sr-only" }), touch ? option.shortLabel : option.label] }, option.value)))] }));
18
17
  }
19
- const VIEW_OPTIONS = [
20
- { value: "year", label: "Year", shortLabel: "Y" },
21
- { value: "month", label: "Month", shortLabel: "M" },
22
- { value: "week", label: "Week", shortLabel: "W" },
23
- { value: "day", label: "Day", shortLabel: "D" },
24
- { value: "agenda", label: "Agenda", shortLabel: "List" },
25
- ];
26
- /**
27
- * The zoom ladder. Each step keeps the date in view, so moving between them is
28
- * changing magnification rather than opening a different screen.
29
- */
30
- export function CalendarViewSwitch({ value, onChange, views, touch, className, }) {
31
- const options = views
32
- ? VIEW_OPTIONS.filter((option) => views.includes(option.value))
33
- : VIEW_OPTIONS;
34
- return (_jsx(Segmented, { ariaLabel: "Calendar view", options: options, value: value, onChange: onChange, touch: touch, className: className }));
35
- }
36
- /**
37
- * Back, forward, and Today. Today lands on the same target from every view and
38
- * every distance away, so it is a way home rather than a jump whose result
39
- * depends on where you were.
40
- */
41
- export function CalendarDateNav({ title, onPrev, onNext, onToday, children, touch, }) {
42
- const stepClass = cn("flex items-center justify-center rounded-md text-fg-muted outline-none transition-colors hover:bg-surface-sunken hover:text-fg focus-visible:ring-2 focus-visible:ring-ring", touch ? "size-11" : "size-7");
43
- return (_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx("button", { type: "button", onClick: onPrev, "aria-label": "Previous", className: stepClass, children: _jsx(ChevronLeft, { className: "size-4" }) }), _jsx("button", { type: "button", onClick: onNext, "aria-label": "Next", className: stepClass, children: _jsx(ChevronRight, { className: "size-4" }) }), _jsx("button", { type: "button", onClick: onToday, className: cn("rounded-md border border-line px-2.5 font-medium text-fg outline-none transition-colors hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring", touch ? "min-h-11 text-sm" : "h-7 text-xs"), children: "Today" }), _jsx("h2", { className: "min-w-0 flex-1 truncate text-sm font-semibold text-fg", children: title }), children] }));
44
- }
@@ -0,0 +1,11 @@
1
+ export interface CalendarYearProps {
2
+ /** Any date in the year to draw. */
3
+ date: string;
4
+ today: string;
5
+ /** Events per day; a dot marks each day that has one. */
6
+ counts: Readonly<Record<string, number>>;
7
+ onPickDay: (date: string) => void;
8
+ className?: string;
9
+ }
10
+ /** Twelve small months with ISO week numbers, today filled and busy days dotted. */
11
+ export declare function CalendarYear({ date, today, counts, onPickDay, className, }: CalendarYearProps): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../lib/cn.js";
3
+ import { MiniMonth } from "./mini-month.js";
4
+ const MONTHS = Array.from({ length: 12 }, (_, index) => String(index + 1).padStart(2, "0"));
5
+ /** Twelve small months with ISO week numbers, today filled and busy days dotted. */
6
+ export function CalendarYear({ date, today, counts, onPickDay, className, }) {
7
+ const year = date.slice(0, 4);
8
+ return (_jsx("div", { "data-calendar-year": "", className: cn("grid h-full content-start gap-x-8 gap-y-6 overflow-y-auto p-6 [grid-template-columns:repeat(auto-fill,minmax(15rem,1fr))]", className), children: MONTHS.map((month) => (_jsx(MiniMonth, { month: `${year}-${month}-01`, today: today, onPickDay: onPickDay, counts: counts }, month))) }));
9
+ }
@@ -1,5 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Pencil } from "lucide-react";
3
3
  export function ComposeFab({ onCompose }) {
4
- return (_jsx("button", { type: "button", onClick: onCompose, "aria-label": "Compose new message", className: "lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all", style: { bottom: "calc(env(safe-area-inset-bottom, 0) + 1rem)" }, children: _jsx(Pencil, { className: "size-6" }) }));
4
+ return (_jsx("button", { type: "button", onClick: onCompose, "aria-label": "Compose new message", className: "lg:hidden fixed right-4 z-30 h-14 w-14 rounded-full bg-accent text-accent-fg shadow-lg flex items-center justify-center hover:opacity-90 active:scale-95 transition-all", style: {
5
+ bottom: "calc(var(--app-tab-bar, 0px) + env(safe-area-inset-bottom, 0px) + 1rem)",
6
+ }, children: _jsx(Pencil, { className: "size-6" }) }));
5
7
  }
@@ -0,0 +1,19 @@
1
+ export interface MiniMonthProps {
2
+ /** Any date in the month on show. */
3
+ month: string;
4
+ today: string;
5
+ /** The range on the grid, inclusive; empty for none. */
6
+ rangeStart?: string;
7
+ rangeEnd?: string;
8
+ onPickDay: (date: string) => void;
9
+ /** Moves the mini month; absent hides its arrows. */
10
+ onShowMonth?: (month: string) => void;
11
+ /** Events per day: a dot marks each day with one, and the day's name counts them. */
12
+ counts?: Readonly<Record<string, number>>;
13
+ className?: string;
14
+ }
15
+ /**
16
+ * A small month with ISO week numbers down the side. Today is filled and the
17
+ * range on the grid is shaded, as in Google Calendar's side pane.
18
+ */
19
+ export declare function MiniMonth({ month, today, rangeStart, rangeEnd, onPickDay, onShowMonth, counts, className, }: MiniMonthProps): import("react").JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronLeft, ChevronRight } from "lucide-react";
3
+ import { cn } from "../lib/cn.js";
4
+ import { miniMonthWeeks, shiftMonth } from "../lib/mini-month.js";
5
+ const WEEKDAYS = ["M", "T", "W", "T", "F", "S", "S"];
6
+ const fullDate = (date) => new Intl.DateTimeFormat(undefined, {
7
+ weekday: "long",
8
+ day: "numeric",
9
+ month: "long",
10
+ year: "numeric",
11
+ timeZone: "UTC",
12
+ }).format(new Date(`${date}T00:00:00Z`));
13
+ const monthTitle = (date) => new Intl.DateTimeFormat(undefined, {
14
+ month: "long",
15
+ year: "numeric",
16
+ timeZone: "UTC",
17
+ }).format(new Date(`${date.slice(0, 7)}-01T00:00:00Z`));
18
+ /**
19
+ * A small month with ISO week numbers down the side. Today is filled and the
20
+ * range on the grid is shaded, as in Google Calendar's side pane.
21
+ */
22
+ export function MiniMonth({ month, today, rangeStart = "", rangeEnd = "", onPickDay, onShowMonth, counts, className, }) {
23
+ const weeks = miniMonthWeeks({ month, today, rangeStart, rangeEnd });
24
+ const title = monthTitle(month);
25
+ return (_jsxs("section", { "aria-label": title, className: cn("select-none", className), children: [_jsxs("div", { className: "flex items-center justify-between px-1 pb-1", children: [_jsx("h2", { className: "text-sm font-medium text-fg", children: title }), onShowMonth && (_jsxs("div", { className: "flex", children: [_jsx("button", { type: "button", "aria-label": "Previous month", onClick: () => onShowMonth(shiftMonth(month, -1)), className: "flex size-7 items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring", children: _jsx(ChevronLeft, { className: "size-4" }) }), _jsx("button", { type: "button", "aria-label": "Next month", onClick: () => onShowMonth(shiftMonth(month, 1)), className: "flex size-7 items-center justify-center rounded-full text-fg-muted outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring", children: _jsx(ChevronRight, { className: "size-4" }) })] }))] }), _jsxs("table", { className: "w-full border-collapse text-center text-2xs", children: [_jsx("thead", { children: _jsxs("tr", { className: "text-fg-subtle", children: [_jsx("th", { scope: "col", className: "w-6 font-normal", children: _jsx("span", { className: "sr-only", children: "Week" }) }), WEEKDAYS.map((weekday, index) => (_jsx("th", { scope: "col", className: "h-6 font-normal", children: weekday }, index)))] }) }), _jsx("tbody", { children: weeks.map((week) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", className: "font-normal text-fg-subtle tabular-nums", children: week.weekNumber }), week.days.map((day) => {
26
+ const count = counts?.[day.date] ?? 0;
27
+ const label = counts === undefined
28
+ ? fullDate(day.date)
29
+ : `${fullDate(day.date)}, ${count === 1 ? "1 event" : `${count} events`}`;
30
+ return (_jsx("td", { className: cn("p-0", day.inRange && "bg-accent-soft"), children: _jsxs("button", { type: "button", "aria-label": label, "aria-current": day.isToday ? "date" : undefined, "data-date": day.date, onClick: () => onPickDay(day.date), className: cn("relative mx-auto flex size-7 items-center justify-center rounded-full tabular-nums outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring", day.isToday
31
+ ? "bg-accent font-semibold text-accent-fg"
32
+ : "hover:bg-surface-sunken", !day.isToday && !day.inMonth && "text-fg-subtle"), children: [day.day, count > 0 && !day.isToday && (_jsx("span", { "aria-hidden": "true", className: "absolute bottom-0.5 size-1 rounded-full bg-accent" }))] }) }, day.date));
33
+ })] }, week.days[0].date))) })] })] }));
34
+ }
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ export { NextUpCard, type NextUpCardProps, } from "./components/agenda-panels.js
12
12
  export { AppPasswordHint, type AppPasswordHintProps, } from "./components/app-password-hint.js";
13
13
  export { type AppShellLayoutContext, AppShellSlotted, type AppShellSlottedProps, useAppShellLayout, } from "./components/app-shell-slotted.js";
14
14
  export { type AppShellProps, type Density, INTELLIGENCE_MIN_WIDTH, type MessageListKeyboard, type MessageListSelection, type NarrowView, type NavAccount, type NavAccountStatus, type NavLinkComponent, type NavLinkRenderProps, type NavMailbox, type NavMailboxRole, type PaneLayout, READING_PANE_MIN_WIDTH, resolvePaneLayout, type ThreadData, type ThreadMessageData, type ThreadRowData, type ThreadSection, type TouchSeed, useContainerWidth, } from "./components/app-shell-types.js";
15
+ export { AppBar, type AppId, type AppSwitcherProps, type AppSwitchItem, AppTabBar, } from "./components/app-switcher.js";
15
16
  export { AppTopBar, type AppTopBarProps } from "./components/app-top-bar.js";
16
17
  export { type AttachmentDownloadState, type AttachmentItem, type AttachmentKind, AttachmentList, type AttachmentListProps, } from "./components/attachment-list.js";
17
18
  export { AttendeeList, type AttendeeListProps, AttendeeRow, type AttendeeRowProps, RsvpBadge, type RsvpBadgeProps, } from "./components/attendee-row.js";
@@ -32,15 +33,24 @@ export { Button, ButtonLink, type ButtonLinkProps, type ButtonProps, } from "./c
32
33
  export { CalendarClashStrip, type CalendarClashStripProps, } from "./components/calendar-clash-strip.js";
33
34
  export { CalendarEventChip, type CalendarEventChipProps, } from "./components/calendar-event-chip.js";
34
35
  export { CalendarEventChipContent, type CalendarEventChipContentProps, } from "./components/calendar-event-chip-content.js";
36
+ export { CalendarEventGone, CalendarEventPopupCard, type CalendarEventPopupCardProps, type CalendarFailure, CalendarFailureBlock, } from "./components/calendar-event-popup.js";
37
+ export { CalendarEventSidebar, type CalendarEventSidebarProps, } from "./components/calendar-event-sidebar.js";
35
38
  export { CalendarFailureNote, type CalendarFailureNoteProps, } from "./components/calendar-failure-note.js";
36
39
  export { CalendarGrid, type CalendarGridProps, } from "./components/calendar-grid.js";
37
40
  export { CalendarInviteCard, type CalendarInviteCardProps, } from "./components/calendar-invite-card.js";
38
41
  export { CalendarList, type CalendarListProps, } from "./components/calendar-list.js";
39
42
  export { CalendarParseBadge, type CalendarParseBadgeProps, calendarParseLabel, calendarParseNote, } from "./components/calendar-parse-badge.js";
43
+ export { CalendarPopover, type CalendarPopoverProps, } from "./components/calendar-popover.js";
44
+ export { CalendarQuickCreateCard, type CalendarQuickCreateCardProps, type QuickCreateFields, } from "./components/calendar-quick-create.js";
45
+ export { CalendarScreenToolbar, type CalendarScreenToolbarProps, } from "./components/calendar-screen-toolbar.js";
46
+ export { CalendarSheet, type CalendarSheetProps, } from "./components/calendar-sheet.js";
47
+ export { CalendarSidePane, type CalendarSidePaneProps, NewEventSquare, type NewEventSquareProps, } from "./components/calendar-side-pane.js";
40
48
  export { CalendarSlotOffers, type CalendarSlotOffersProps, } from "./components/calendar-slot-offers.js";
41
49
  export { CalendarSuggestionDeck, type CalendarSuggestionDeckProps, } from "./components/calendar-suggestion-deck.js";
42
- export { CalendarDateNav, type CalendarDateNavProps, CalendarViewSwitch, type CalendarViewSwitchProps, Segmented, type SegmentedProps, type SegmentOption, segmentClassName, } from "./components/calendar-toolbar.js";
50
+ export { CalendarTimeGrid, type CalendarTimeGridProps, describeRange, type GridDraft, type GridGesture, } from "./components/calendar-time-grid.js";
51
+ export { Segmented, type SegmentedProps, type SegmentOption, segmentClassName, } from "./components/calendar-toolbar.js";
43
52
  export { type CalendarAttendee, type CalendarClash, type CalendarColorId, type CalendarDay, type CalendarDescriptor, type CalendarEventData, type CalendarInvite, type CalendarInviteState, type CalendarParseMethod, type CalendarProposal, type CalendarSlotPick, type CalendarViewId, calendarColorIds, type EventDraft, type EventSuggestion, type RecurrenceScope, type RsvpState, type ZoneCertainty, type ZoneOption, type ZoneOptions, } from "./components/calendar-types.js";
53
+ export { CalendarYear, type CalendarYearProps, } from "./components/calendar-year.js";
44
54
  export { Card, CardBody, CardHeader, type CardProps, CardTitle, } from "./components/card.js";
45
55
  export { CategoryBadge, type CategoryBadgeProps, } from "./components/category-badge.js";
46
56
  export { Checkbox, type CheckboxProps } from "./components/checkbox.js";
@@ -65,7 +75,6 @@ export { ErrorBanner, type ErrorBannerAction, type ErrorBannerEntry, type ErrorB
65
75
  export { ErrorBannerStack } from "./components/ErrorBannerStack.js";
66
76
  export { ErrorState, formatErrorMessage } from "./components/ErrorState.js";
67
77
  export type { AuthorDeclarations, EmailFrameVariant, } from "./components/email-frame-css.js";
68
- export { EventDetail, type EventDetailProps, } from "./components/event-detail.js";
69
78
  export { EventEditor, type EventEditorLayout, type EventEditorProps, endsBeforeStart, withAllDay, withStartDate, } from "./components/event-editor.js";
70
79
  export { EventEditorPane, type EventEditorPaneProps, } from "./components/event-editor-pane.js";
71
80
  export { EventSuggestionCard, type EventSuggestionCardProps, settleZone, ZONE_UNSETTLED_REASON, type ZoneSettlement, } from "./components/event-suggestion-card.js";
@@ -103,6 +112,7 @@ export { type FilterReach, type ListState, MessageListEmpty, type MessageListEmp
103
112
  export { MessageReportDialog, type MessageReportDialogProps, } from "./components/message-report-dialog.js";
104
113
  export { type BriefRowComponent, ComfortableRow, ComfortableRowBody, ComfortableRowLeading, ComfortableRowTextContent, CompactRow, CompactRowBody, comfortableRowClass, compactRowClass, type RowSelection, type RowToggleEvent, } from "./components/message-row.js";
105
114
  export { MessageSettlementBadge, type MessageSettlementBadgeProps, MessageSettlementNotice, type MessageSettlementNoticeProps, messageSettlementCopy, type RowSettlement, } from "./components/message-settlement.js";
115
+ export { MiniMonth, type MiniMonthProps } from "./components/mini-month.js";
106
116
  export { type MobileMessageAction, MobileMessageActionBar, type MobileMessageActionBarProps, } from "./components/mobile-message-action-bar.js";
107
117
  export { type MobileReadingMessageActions, MobileReadingPane, type MobileReadingPaneProps, } from "./components/mobile-reading-pane.js";
108
118
  export { MobileSearchView, type MobileSearchViewProps, } from "./components/mobile-search-view.js";
@@ -174,7 +184,8 @@ export { briefChipCategory, briefChipFilters, briefFilterHasTerm, briefQueryCate
174
184
  export { type BriefFilterId, isBriefFilterId, matchesBriefFilters, narrowBriefSections, } from "./lib/brief-filters.js";
175
185
  export { type CalendarColorClasses, calendarColorClasses, } from "./lib/calendar-color.js";
176
186
  export { type CalendarEventShell, calendarEventBodyClasses, } from "./lib/calendar-event-shell.js";
177
- export { DRAFT_MINUTES, isDraggedSelection, pointPick, rangePick, } from "./lib/calendar-slot-pick.js";
187
+ export { calendarRangeTitle, datesFrom, weekStart, } from "./lib/calendar-range.js";
188
+ export { allDayRange, CLICK_THRESHOLD_PX, clickRange, clockAt, DRAFT_MINUTES, isDraggedSelection, minutesOf, pointPick, rangeMinutes, rangePick, SNAP_MINUTES, slotRange, timedRange, } from "./lib/calendar-slot-pick.js";
178
189
  export { buildCidResolver, type CidResolvableBodyPart, type CidResolver, } from "./lib/cid-resolver.js";
179
190
  export { cn } from "./lib/cn.js";
180
191
  export { browserSpellcheckHelp, COMPOSE_LANGUAGE_OPTIONS, type ComposeLanguageOption, defaultComposeLanguages, detectionCodeFor, languageChipLabel, languageLabel, primaryLanguageSubtag, unwrapLanguage, wrapWithLanguage, } from "./lib/compose-language.js";
@@ -185,11 +196,15 @@ export { createEmailSanitizer, detectAuthorBackground, detectAuthorSpacing, type
185
196
  export { addMinutesToClock } from "./lib/event-phrase.js";
186
197
  export { collapseFolderTree, filterFolderTree, folderAncestors, folderDepth, folderLeaf, folderParent, matchesQuery, orderFolderNodes, queryExpandedPaths, withCreateRows, } from "./lib/folder-tree.js";
187
198
  export { findFirstFocusable, findLastFocusable, findNextFocusable, findParentRow, isFocusable, isSelectable, } from "./lib/folder-tree-focus.js";
199
+ export { type GridSlot, initialFocus } from "./lib/grid-keyboard.js";
200
+ export { isoWeek } from "./lib/iso-week.js";
188
201
  export { defaultKeyboardHints, KEY_HINT_GROUPS, type KeyboardHint, type KeyHint, type KeyHintGroup, keyboardHintsFor, keysForAction, shortcutHintForAction, type TriageAction, type TriageHandlers, tooltipForAction, } from "./lib/keymap.js";
189
202
  export { type DispatchResult, dispatchKey, isControlTarget, isEditableTarget, type KeyStroke, ROW_ATTRIBUTE, type SequencePrefix, } from "./lib/keymap-dispatch.js";
190
203
  export { isLabelColorValue, type LabelColorValue, labelColorOptions, labelDotClass, } from "./lib/label-color.js";
191
204
  export { DESKTOP_MEDIA_QUERY, DESKTOP_MIN_WIDTH, } from "./lib/layout-breakpoints.js";
205
+ export { miniMonthWeeks, shiftMonth } from "./lib/mini-month.js";
192
206
  export { type OverlayAnswers, type OverlayScopeOptions, overlayStack, resolveAgainstOverlays, useOverlayScope, } from "./lib/overlay-scope.js";
207
+ export { placePopup } from "./lib/popup-placement.js";
193
208
  export { derivePropertyClauses, normalizeSubject, sharedSubjectFragment, } from "./lib/property-prefill.js";
194
209
  export { type CustomRecurrence, defaultCustomRecurrence, defaultEndDate, endDateLabel, formatCustomRecurrence, type MonthlyMode, NO_REPEAT, type RecurrenceEnd, type RecurrenceUnit, readCustomRecurrence, repeatChoices, } from "./lib/recurrence.js";
195
210
  export { LIST_ROW_ATTRIBUTE, LIST_ROW_SELECTOR, type RovingOrientation, rovingNextIndex, type UseRovingFocusOptions, useRovingFocus, } from "./lib/roving-focus.js";
@@ -198,6 +213,7 @@ export { quoteSearchTokenValue, type SearchQueryWord, type SearchTermParts, sear
198
213
  export { type DroppedFacet, type DroppedFacetType, isConvertible, type SearchConversion, searchConversionNotice, } from "./lib/search-rule.js";
199
214
  export { collapsibleDomain, deriveSenderClauses, distinctSenders, dominantSender, senderDomain, senderLabel, } from "./lib/sender-derivation.js";
200
215
  export { type SuggestAction, type SuggestKeyState, suggestKeyAction, } from "./lib/suggest-keys.js";
216
+ export { zonedMoment } from "./lib/time-grid-layout.js";
201
217
  export { type ListCursor, useListCursor } from "./lib/use-list-cursor.js";
202
218
  export { type ListKeyboard, type UseListKeyboardOptions, useListKeyboard, } from "./lib/use-list-keyboard.js";
203
219
  export { type UseLongPressOptions, type UseLongPressResult, useLongPress, } from "./lib/use-long-press.js";
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ export { NextUpCard, } from "./components/agenda-panels.js";
12
12
  export { AppPasswordHint, } from "./components/app-password-hint.js";
13
13
  export { AppShellSlotted, useAppShellLayout, } from "./components/app-shell-slotted.js";
14
14
  export { INTELLIGENCE_MIN_WIDTH, READING_PANE_MIN_WIDTH, resolvePaneLayout, useContainerWidth, } from "./components/app-shell-types.js";
15
+ export { AppBar, AppTabBar, } from "./components/app-switcher.js";
15
16
  export { AppTopBar } from "./components/app-top-bar.js";
16
17
  export { AttachmentList, } from "./components/attachment-list.js";
17
18
  export { AttendeeList, AttendeeRow, RsvpBadge, } from "./components/attendee-row.js";
@@ -32,15 +33,24 @@ export { Button, ButtonLink, } from "./components/button.js";
32
33
  export { CalendarClashStrip, } from "./components/calendar-clash-strip.js";
33
34
  export { CalendarEventChip, } from "./components/calendar-event-chip.js";
34
35
  export { CalendarEventChipContent, } from "./components/calendar-event-chip-content.js";
36
+ export { CalendarEventGone, CalendarEventPopupCard, CalendarFailureBlock, } from "./components/calendar-event-popup.js";
37
+ export { CalendarEventSidebar, } from "./components/calendar-event-sidebar.js";
35
38
  export { CalendarFailureNote, } from "./components/calendar-failure-note.js";
36
39
  export { CalendarGrid, } from "./components/calendar-grid.js";
37
40
  export { CalendarInviteCard, } from "./components/calendar-invite-card.js";
38
41
  export { CalendarList, } from "./components/calendar-list.js";
39
42
  export { CalendarParseBadge, calendarParseLabel, calendarParseNote, } from "./components/calendar-parse-badge.js";
43
+ export { CalendarPopover, } from "./components/calendar-popover.js";
44
+ export { CalendarQuickCreateCard, } from "./components/calendar-quick-create.js";
45
+ export { CalendarScreenToolbar, } from "./components/calendar-screen-toolbar.js";
46
+ export { CalendarSheet, } from "./components/calendar-sheet.js";
47
+ export { CalendarSidePane, NewEventSquare, } from "./components/calendar-side-pane.js";
40
48
  export { CalendarSlotOffers, } from "./components/calendar-slot-offers.js";
41
49
  export { CalendarSuggestionDeck, } from "./components/calendar-suggestion-deck.js";
42
- export { CalendarDateNav, CalendarViewSwitch, Segmented, segmentClassName, } from "./components/calendar-toolbar.js";
50
+ export { CalendarTimeGrid, describeRange, } from "./components/calendar-time-grid.js";
51
+ export { Segmented, segmentClassName, } from "./components/calendar-toolbar.js";
43
52
  export { calendarColorIds, } from "./components/calendar-types.js";
53
+ export { CalendarYear, } from "./components/calendar-year.js";
44
54
  export { Card, CardBody, CardHeader, CardTitle, } from "./components/card.js";
45
55
  export { CategoryBadge, } from "./components/category-badge.js";
46
56
  export { Checkbox } from "./components/checkbox.js";
@@ -64,7 +74,6 @@ export { EmptyState } from "./components/EmptyState.js";
64
74
  export { ErrorBanner, } from "./components/ErrorBanner.js";
65
75
  export { ErrorBannerStack } from "./components/ErrorBannerStack.js";
66
76
  export { ErrorState, formatErrorMessage } from "./components/ErrorState.js";
67
- export { EventDetail, } from "./components/event-detail.js";
68
77
  export { EventEditor, endsBeforeStart, withAllDay, withStartDate, } from "./components/event-editor.js";
69
78
  export { EventEditorPane, } from "./components/event-editor-pane.js";
70
79
  export { EventSuggestionCard, settleZone, ZONE_UNSETTLED_REASON, } from "./components/event-suggestion-card.js";
@@ -102,6 +111,7 @@ export { MessageListEmpty, MessageListError, MessageListLoading, MessageListLoad
102
111
  export { MessageReportDialog, } from "./components/message-report-dialog.js";
103
112
  export { ComfortableRow, ComfortableRowBody, ComfortableRowLeading, ComfortableRowTextContent, CompactRow, CompactRowBody, comfortableRowClass, compactRowClass, } from "./components/message-row.js";
104
113
  export { MessageSettlementBadge, MessageSettlementNotice, messageSettlementCopy, } from "./components/message-settlement.js";
114
+ export { MiniMonth } from "./components/mini-month.js";
105
115
  export { MobileMessageActionBar, } from "./components/mobile-message-action-bar.js";
106
116
  export { MobileReadingPane, } from "./components/mobile-reading-pane.js";
107
117
  export { MobileSearchView, } from "./components/mobile-search-view.js";
@@ -173,7 +183,8 @@ export { briefChipCategory, briefChipFilters, briefFilterHasTerm, briefQueryCate
173
183
  export { isBriefFilterId, matchesBriefFilters, narrowBriefSections, } from "./lib/brief-filters.js";
174
184
  export { calendarColorClasses, } from "./lib/calendar-color.js";
175
185
  export { calendarEventBodyClasses, } from "./lib/calendar-event-shell.js";
176
- export { DRAFT_MINUTES, isDraggedSelection, pointPick, rangePick, } from "./lib/calendar-slot-pick.js";
186
+ export { calendarRangeTitle, datesFrom, weekStart, } from "./lib/calendar-range.js";
187
+ export { allDayRange, CLICK_THRESHOLD_PX, clickRange, clockAt, DRAFT_MINUTES, isDraggedSelection, minutesOf, pointPick, rangeMinutes, rangePick, SNAP_MINUTES, slotRange, timedRange, } from "./lib/calendar-slot-pick.js";
177
188
  export { buildCidResolver, } from "./lib/cid-resolver.js";
178
189
  export { cn } from "./lib/cn.js";
179
190
  export { browserSpellcheckHelp, COMPOSE_LANGUAGE_OPTIONS, defaultComposeLanguages, detectionCodeFor, languageChipLabel, languageLabel, primaryLanguageSubtag, unwrapLanguage, wrapWithLanguage, } from "./lib/compose-language.js";
@@ -184,11 +195,15 @@ export { createEmailSanitizer, detectAuthorBackground, detectAuthorSpacing, sani
184
195
  export { addMinutesToClock } from "./lib/event-phrase.js";
185
196
  export { collapseFolderTree, filterFolderTree, folderAncestors, folderDepth, folderLeaf, folderParent, matchesQuery, orderFolderNodes, queryExpandedPaths, withCreateRows, } from "./lib/folder-tree.js";
186
197
  export { findFirstFocusable, findLastFocusable, findNextFocusable, findParentRow, isFocusable, isSelectable, } from "./lib/folder-tree-focus.js";
198
+ export { initialFocus } from "./lib/grid-keyboard.js";
199
+ export { isoWeek } from "./lib/iso-week.js";
187
200
  export { defaultKeyboardHints, KEY_HINT_GROUPS, keyboardHintsFor, keysForAction, shortcutHintForAction, tooltipForAction, } from "./lib/keymap.js";
188
201
  export { dispatchKey, isControlTarget, isEditableTarget, ROW_ATTRIBUTE, } from "./lib/keymap-dispatch.js";
189
202
  export { isLabelColorValue, labelColorOptions, labelDotClass, } from "./lib/label-color.js";
190
203
  export { DESKTOP_MEDIA_QUERY, DESKTOP_MIN_WIDTH, } from "./lib/layout-breakpoints.js";
204
+ export { miniMonthWeeks, shiftMonth } from "./lib/mini-month.js";
191
205
  export { overlayStack, resolveAgainstOverlays, useOverlayScope, } from "./lib/overlay-scope.js";
206
+ export { placePopup } from "./lib/popup-placement.js";
192
207
  export { derivePropertyClauses, normalizeSubject, sharedSubjectFragment, } from "./lib/property-prefill.js";
193
208
  export { defaultCustomRecurrence, defaultEndDate, endDateLabel, formatCustomRecurrence, NO_REPEAT, readCustomRecurrence, repeatChoices, } from "./lib/recurrence.js";
194
209
  export { LIST_ROW_ATTRIBUTE, LIST_ROW_SELECTOR, rovingNextIndex, useRovingFocus, } from "./lib/roving-focus.js";
@@ -197,6 +212,7 @@ export { quoteSearchTokenValue, searchTokenTerm, splitSearchTerm, splitSearchWor
197
212
  export { isConvertible, searchConversionNotice, } from "./lib/search-rule.js";
198
213
  export { collapsibleDomain, deriveSenderClauses, distinctSenders, dominantSender, senderDomain, senderLabel, } from "./lib/sender-derivation.js";
199
214
  export { suggestKeyAction, } from "./lib/suggest-keys.js";
215
+ export { zonedMoment } from "./lib/time-grid-layout.js";
200
216
  export { useListCursor } from "./lib/use-list-cursor.js";
201
217
  export { useListKeyboard, } from "./lib/use-list-keyboard.js";
202
218
  export { useLongPress, } from "./lib/use-long-press.js";
@@ -0,0 +1,10 @@
1
+ import type { CalendarViewId } from "../components/calendar-types.js";
2
+ /** The Monday of the week a `YYYY-MM-DD` date falls in. */
3
+ export declare function weekStart(date: string): string;
4
+ /** The `count` dates from `start`, one day apart. */
5
+ export declare function datesFrom(start: string, count: number): string[];
6
+ /**
7
+ * The toolbar's title for a view on a date. A week that crosses a month names
8
+ * both months, the way Google Calendar does.
9
+ */
10
+ export declare function calendarRangeTitle(view: CalendarViewId, date: string, locale?: string): string;
@@ -0,0 +1,39 @@
1
+ const parse = (date) => {
2
+ const [year, month, day] = date.split("-").map(Number);
3
+ return new Date(Date.UTC(year, month - 1, day));
4
+ };
5
+ const iso = (instant) => instant.toISOString().slice(0, 10);
6
+ /** The Monday of the week a `YYYY-MM-DD` date falls in. */
7
+ export function weekStart(date) {
8
+ const day = parse(date);
9
+ day.setUTCDate(day.getUTCDate() - ((day.getUTCDay() + 6) % 7));
10
+ return iso(day);
11
+ }
12
+ /** The `count` dates from `start`, one day apart. */
13
+ export function datesFrom(start, count) {
14
+ const first = parse(start);
15
+ return Array.from({ length: count }, (_, index) => {
16
+ const next = new Date(first);
17
+ next.setUTCDate(first.getUTCDate() + index);
18
+ return iso(next);
19
+ });
20
+ }
21
+ const format = (date, options, locale) => new Intl.DateTimeFormat(locale, { ...options, timeZone: "UTC" }).format(parse(date));
22
+ /**
23
+ * The toolbar's title for a view on a date. A week that crosses a month names
24
+ * both months, the way Google Calendar does.
25
+ */
26
+ export function calendarRangeTitle(view, date, locale) {
27
+ if (view === "year")
28
+ return format(date, { year: "numeric" }, locale);
29
+ if (view === "day")
30
+ return format(date, { weekday: "long", day: "numeric", month: "long", year: "numeric" }, locale);
31
+ if (view !== "week")
32
+ return format(date, { month: "long", year: "numeric" }, locale);
33
+ const [first, , , , , , last] = datesFrom(weekStart(date), 7);
34
+ if (first.slice(0, 7) === last.slice(0, 7))
35
+ return format(first, { month: "long", year: "numeric" }, locale);
36
+ if (first.slice(0, 4) === last.slice(0, 4))
37
+ return `${format(first, { month: "short" }, locale)} – ${format(last, { month: "short", year: "numeric" }, locale)}`;
38
+ return `${format(first, { month: "short", year: "numeric" }, locale)} – ${format(last, { month: "short", year: "numeric" }, locale)}`;
39
+ }
@@ -16,3 +16,32 @@ export declare function pointPick(dateStr: string, allDay: boolean): CalendarSlo
16
16
  * a click leaves behind — and a click is already a pick of its own.
17
17
  */
18
18
  export declare function isDraggedSelection(startStr: string, endStr: string, allDay: boolean, slotMinutes: number): boolean;
19
+ /** Every range on the grid snaps to a quarter hour, as in Google Calendar. */
20
+ export declare const SNAP_MINUTES = 15;
21
+ /** A press that travels less than this is a click, not a drag. */
22
+ export declare const CLICK_THRESHOLD_PX = 4;
23
+ /** Whether a press moved far enough to be a drag. */
24
+ export declare function isDrag(dx: number, dy: number): boolean;
25
+ /** The quarter hour a vertical offset falls in, from midnight. */
26
+ export declare function minuteAt(offsetY: number, hourHeight: number): number;
27
+ /** `HH:MM` for minutes from midnight. */
28
+ export declare function clockAt(minutes: number): string;
29
+ /** Minutes from midnight for `HH:MM`. */
30
+ export declare function minutesOf(clock: string): number;
31
+ /**
32
+ * A timed range dragged in one column, from the slot pressed to the slot the
33
+ * pointer is over, inclusive of both. A drag that runs to the bottom ends at
34
+ * midnight, which is the next day's `00:00`.
35
+ */
36
+ export declare function timedRange(date: string, anchorMinute: number, currentMinute: number): CalendarSlotPick;
37
+ /** A range on one day from minutes, rolling an end at midnight onto the next day. */
38
+ export declare function slotRange(date: string, startMinute: number, endMinute: number): CalendarSlotPick;
39
+ /** The hour a click lands on: from the quarter pressed, an hour long. */
40
+ export declare function clickRange(date: string, minute: number): CalendarSlotPick;
41
+ /** An all-day range across whichever days the drag covered, in either direction. */
42
+ export declare function allDayRange(anchor: string, current: string): CalendarSlotPick;
43
+ /** Minutes the range covers on its first day, end exclusive. */
44
+ export declare function rangeMinutes(range: CalendarSlotPick): {
45
+ start: number;
46
+ end: number;
47
+ };
@@ -59,3 +59,70 @@ export function isDraggedSelection(startStr, endStr, allDay, slotMinutes) {
59
59
  return Math.round(span / MS_PER_DAY) > 1;
60
60
  return span / MS_PER_MINUTE > slotMinutes;
61
61
  }
62
+ /** Every range on the grid snaps to a quarter hour, as in Google Calendar. */
63
+ export const SNAP_MINUTES = 15;
64
+ /** A press that travels less than this is a click, not a drag. */
65
+ export const CLICK_THRESHOLD_PX = 4;
66
+ const MINUTES_PER_DAY = 1440;
67
+ /** Whether a press moved far enough to be a drag. */
68
+ export function isDrag(dx, dy) {
69
+ return Math.hypot(dx, dy) >= CLICK_THRESHOLD_PX;
70
+ }
71
+ /** The quarter hour a vertical offset falls in, from midnight. */
72
+ export function minuteAt(offsetY, hourHeight) {
73
+ const minutes = (offsetY / hourHeight) * 60;
74
+ const snapped = Math.floor(minutes / SNAP_MINUTES) * SNAP_MINUTES;
75
+ return Math.min(Math.max(snapped, 0), MINUTES_PER_DAY - SNAP_MINUTES);
76
+ }
77
+ const pad = (value) => String(value).padStart(2, "0");
78
+ /** `HH:MM` for minutes from midnight. */
79
+ export function clockAt(minutes) {
80
+ return `${pad(Math.floor(minutes / 60))}:${pad(minutes % 60)}`;
81
+ }
82
+ /** Minutes from midnight for `HH:MM`. */
83
+ export function minutesOf(clock) {
84
+ const [hours, minutes] = clock.split(":").map(Number);
85
+ return hours * 60 + minutes;
86
+ }
87
+ /**
88
+ * A timed range dragged in one column, from the slot pressed to the slot the
89
+ * pointer is over, inclusive of both. A drag that runs to the bottom ends at
90
+ * midnight, which is the next day's `00:00`.
91
+ */
92
+ export function timedRange(date, anchorMinute, currentMinute) {
93
+ const start = Math.min(anchorMinute, currentMinute);
94
+ const end = Math.max(anchorMinute, currentMinute) + SNAP_MINUTES;
95
+ return slotRange(date, start, end);
96
+ }
97
+ /** A range on one day from minutes, rolling an end at midnight onto the next day. */
98
+ export function slotRange(date, startMinute, endMinute) {
99
+ const atMidnight = endMinute >= MINUTES_PER_DAY;
100
+ return {
101
+ date,
102
+ endDate: atMidnight ? addDays(date, 1) : date,
103
+ startTime: clockAt(startMinute),
104
+ endTime: atMidnight ? "00:00" : clockAt(endMinute),
105
+ allDay: false,
106
+ };
107
+ }
108
+ /** The hour a click lands on: from the quarter pressed, an hour long. */
109
+ export function clickRange(date, minute) {
110
+ return slotRange(date, minute, minute + DRAFT_MINUTES);
111
+ }
112
+ /** An all-day range across whichever days the drag covered, in either direction. */
113
+ export function allDayRange(anchor, current) {
114
+ const [first, last] = anchor <= current ? [anchor, current] : [current, anchor];
115
+ return {
116
+ date: first,
117
+ endDate: last,
118
+ startTime: "",
119
+ endTime: "",
120
+ allDay: true,
121
+ };
122
+ }
123
+ /** Minutes the range covers on its first day, end exclusive. */
124
+ export function rangeMinutes(range) {
125
+ const start = minutesOf(range.startTime);
126
+ const end = range.endDate > range.date ? MINUTES_PER_DAY : minutesOf(range.endTime);
127
+ return { start, end };
128
+ }
@@ -0,0 +1,20 @@
1
+ import type { ZonedMoment } from "./time-grid-layout.js";
2
+ /** A pointer travel in pixels as whole quarter hours. */
3
+ export declare function snappedMinutes(deltaY: number, hourHeight: number): number;
4
+ /**
5
+ * A timed event moved by whole days and quarter hours. It keeps its length,
6
+ * and its start lands on a quarter hour.
7
+ */
8
+ export declare function moveTimed(start: ZonedMoment, end: ZonedMoment, dayDelta: number, minuteDelta: number): {
9
+ start: ZonedMoment;
10
+ end: ZonedMoment;
11
+ };
12
+ /** A timed event's end dragged by quarter hours, never shorter than one. */
13
+ export declare function resizeTimed(start: ZonedMoment, end: ZonedMoment, minuteDelta: number): ZonedMoment;
14
+ /** An all-day event, first and last day inclusive, moved by whole days. */
15
+ export declare function moveDays(first: string, last: string, dayDelta: number): {
16
+ first: string;
17
+ last: string;
18
+ };
19
+ /** An all-day event's last day dragged across days, never before its first. */
20
+ export declare function resizeDays(first: string, last: string, dayDelta: number): string;
@@ -0,0 +1,50 @@
1
+ import { addDays } from "./agenda-time.js";
2
+ import { SNAP_MINUTES } from "./calendar-slot-pick.js";
3
+ const DAY = 1440;
4
+ /** A pointer travel in pixels as whole quarter hours. */
5
+ export function snappedMinutes(deltaY, hourHeight) {
6
+ return Math.round(((deltaY / hourHeight) * 60) / SNAP_MINUTES) * SNAP_MINUTES;
7
+ }
8
+ function shift(moment, minutes) {
9
+ const total = moment.minute + minutes;
10
+ const days = Math.floor(total / DAY);
11
+ return { date: addDays(moment.date, days), minute: total - days * DAY };
12
+ }
13
+ const span = (start, end) => {
14
+ let days = 0;
15
+ let cursor = start.date;
16
+ while (cursor < end.date) {
17
+ cursor = addDays(cursor, 1);
18
+ days += 1;
19
+ }
20
+ return days * DAY + end.minute - start.minute;
21
+ };
22
+ /**
23
+ * A timed event moved by whole days and quarter hours. It keeps its length,
24
+ * and its start lands on a quarter hour.
25
+ */
26
+ export function moveTimed(start, end, dayDelta, minuteDelta) {
27
+ const length = span(start, end);
28
+ const moved = shift({ date: addDays(start.date, dayDelta), minute: start.minute }, minuteDelta);
29
+ const snapped = {
30
+ date: moved.date,
31
+ minute: Math.round(moved.minute / SNAP_MINUTES) * SNAP_MINUTES,
32
+ };
33
+ const startAt = snapped.minute === DAY ? shift(snapped, 0) : snapped;
34
+ return { start: startAt, end: shift(startAt, length) };
35
+ }
36
+ /** A timed event's end dragged by quarter hours, never shorter than one. */
37
+ export function resizeTimed(start, end, minuteDelta) {
38
+ const length = Math.max(span(start, end) + minuteDelta, SNAP_MINUTES);
39
+ const minutes = Math.round(length / SNAP_MINUTES) * SNAP_MINUTES;
40
+ return shift(start, minutes);
41
+ }
42
+ /** An all-day event, first and last day inclusive, moved by whole days. */
43
+ export function moveDays(first, last, dayDelta) {
44
+ return { first: addDays(first, dayDelta), last: addDays(last, dayDelta) };
45
+ }
46
+ /** An all-day event's last day dragged across days, never before its first. */
47
+ export function resizeDays(first, last, dayDelta) {
48
+ const next = addDays(last, dayDelta);
49
+ return next < first ? first : next;
50
+ }
@@ -0,0 +1,15 @@
1
+ import type { CalendarSlotPick } from "../components/calendar-types.js";
2
+ /** The quarter hour the grid's keyboard focus sits on. */
3
+ export interface GridSlot {
4
+ date: string;
5
+ minute: number;
6
+ }
7
+ /** The grid's tab stop: the current hour of today, or of the first day in view. */
8
+ export declare function initialFocus(days: readonly string[], today: string, nowMinute: number): GridSlot;
9
+ /** Where an arrow key moves the focus: a quarter hour up or down, a day across. */
10
+ export declare function moveFocus(slot: GridSlot, key: string, days: readonly string[]): GridSlot | null;
11
+ /**
12
+ * The range Shift and the arrows stretch out, from the slot the stretch began
13
+ * on to the focused slot, both included.
14
+ */
15
+ export declare function stretchRange(anchor: GridSlot, focus: GridSlot): CalendarSlotPick;