@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.
- package/dist/components/app-shell-slotted.js +1 -1
- package/dist/components/app-switcher.d.ts +15 -0
- package/dist/components/app-switcher.js +31 -0
- package/dist/components/calendar-event-popup.d.ts +43 -0
- package/dist/components/calendar-event-popup.js +18 -0
- package/dist/components/calendar-event-sidebar.d.ts +34 -0
- package/dist/components/calendar-event-sidebar.js +16 -0
- package/dist/components/calendar-grid.d.ts +8 -7
- package/dist/components/calendar-grid.js +39 -108
- package/dist/components/calendar-popover.d.ts +25 -0
- package/dist/components/calendar-popover.js +84 -0
- package/dist/components/calendar-quick-create.d.ts +35 -0
- package/dist/components/calendar-quick-create.js +26 -0
- package/dist/components/calendar-screen-toolbar.d.ts +30 -0
- package/dist/components/calendar-screen-toolbar.js +24 -0
- package/dist/components/calendar-sheet.d.ts +14 -0
- package/dist/components/calendar-sheet.js +34 -0
- package/dist/components/calendar-side-pane.d.ts +20 -0
- package/dist/components/calendar-side-pane.js +11 -0
- package/dist/components/calendar-time-grid.d.ts +64 -0
- package/dist/components/calendar-time-grid.js +666 -0
- package/dist/components/calendar-toolbar.d.ts +0 -31
- package/dist/components/calendar-toolbar.js +0 -27
- package/dist/components/calendar-year.d.ts +11 -0
- package/dist/components/calendar-year.js +9 -0
- package/dist/components/compose-fab.js +3 -1
- package/dist/components/mini-month.d.ts +19 -0
- package/dist/components/mini-month.js +34 -0
- package/dist/index.d.ts +19 -3
- package/dist/index.js +19 -3
- package/dist/lib/calendar-range.d.ts +10 -0
- package/dist/lib/calendar-range.js +39 -0
- package/dist/lib/calendar-slot-pick.d.ts +29 -0
- package/dist/lib/calendar-slot-pick.js +67 -0
- package/dist/lib/event-drag.d.ts +20 -0
- package/dist/lib/event-drag.js +50 -0
- package/dist/lib/grid-keyboard.d.ts +15 -0
- package/dist/lib/grid-keyboard.js +46 -0
- package/dist/lib/iso-week.d.ts +2 -0
- package/dist/lib/iso-week.js +13 -0
- package/dist/lib/long-press.d.ts +25 -0
- package/dist/lib/long-press.js +37 -0
- package/dist/lib/mini-month.d.ts +27 -0
- package/dist/lib/mini-month.js +33 -0
- package/dist/lib/popup-placement.d.ts +22 -0
- package/dist/lib/popup-placement.js +39 -0
- package/dist/lib/time-grid-layout.d.ts +38 -0
- package/dist/lib/time-grid-layout.js +94 -0
- package/package.json +1 -1
- package/dist/components/event-detail.d.ts +0 -38
- package/dist/components/event-detail.js +0 -21
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { CalendarViewId } from "./calendar-types.js";
|
|
3
|
+
export interface CalendarScreenToolbarProps {
|
|
4
|
+
view: CalendarViewId;
|
|
5
|
+
/** The range on screen, already formatted: "November 2026". */
|
|
6
|
+
title: string;
|
|
7
|
+
/** The ISO week the range starts in, shown as a chip; absent hides it. */
|
|
8
|
+
weekNumber?: number;
|
|
9
|
+
/** The views the dropdown offers. */
|
|
10
|
+
views?: CalendarViewId[];
|
|
11
|
+
onChangeView: (view: CalendarViewId) => void;
|
|
12
|
+
onPrev: () => void;
|
|
13
|
+
onNext: () => void;
|
|
14
|
+
onToday: () => void;
|
|
15
|
+
/** The side pane the hamburger shows and hides. */
|
|
16
|
+
sidePane?: {
|
|
17
|
+
open: boolean;
|
|
18
|
+
controls: string;
|
|
19
|
+
onToggle: () => void;
|
|
20
|
+
};
|
|
21
|
+
/** Controls the view owns, before the view dropdown. */
|
|
22
|
+
trailing?: ReactNode;
|
|
23
|
+
touch?: boolean;
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The calendar's top row, after Google Calendar: the hamburger, Today, the
|
|
28
|
+
* arrows, the month and year with the week number, and one view dropdown.
|
|
29
|
+
*/
|
|
30
|
+
export declare function CalendarScreenToolbar({ view, title, weekNumber, views, onChangeView, onPrev, onNext, onToday, sidePane, trailing, touch, className, }: CalendarScreenToolbarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft, ChevronRight, Menu } from "lucide-react";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
import { Select } from "./select.js";
|
|
5
|
+
const VIEW_LABELS = {
|
|
6
|
+
year: "Year",
|
|
7
|
+
month: "Month",
|
|
8
|
+
week: "Week",
|
|
9
|
+
day: "Day",
|
|
10
|
+
agenda: "Agenda",
|
|
11
|
+
};
|
|
12
|
+
const ALL_VIEWS = ["day", "week", "month", "year", "agenda"];
|
|
13
|
+
/**
|
|
14
|
+
* The calendar's top row, after Google Calendar: the hamburger, Today, the
|
|
15
|
+
* arrows, the month and year with the week number, and one view dropdown.
|
|
16
|
+
*/
|
|
17
|
+
export function CalendarScreenToolbar({ view, title, weekNumber, views = ALL_VIEWS, onChangeView, onPrev, onNext, onToday, sidePane, trailing, touch = false, className, }) {
|
|
18
|
+
const iconButton = cn("flex shrink-0 items-center justify-center rounded-full 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-9");
|
|
19
|
+
return (_jsxs("div", { role: "toolbar", "aria-label": "Calendar", "data-calendar-toolbar": "", className: cn("flex shrink-0 items-center gap-1 border-b border-line bg-surface px-2", touch ? "h-14" : "h-14 gap-2", className), children: [sidePane && (_jsx("button", { type: "button", "aria-label": "Side pane", "aria-expanded": sidePane.open, "aria-controls": sidePane.controls, onClick: sidePane.onToggle, className: iconButton, children: _jsx(Menu, { className: "size-5" }) })), _jsx("button", { type: "button", onClick: onToday, className: cn("shrink-0 rounded-full border border-line px-4 text-sm font-medium text-fg outline-none transition-colors hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring", touch ? "min-h-11" : "h-9"), children: "Today" }), _jsx("button", { type: "button", onClick: onPrev, "aria-label": `Previous ${VIEW_LABELS[view].toLowerCase()}`, className: iconButton, children: _jsx(ChevronLeft, { className: "size-5" }) }), _jsx("button", { type: "button", onClick: onNext, "aria-label": `Next ${VIEW_LABELS[view].toLowerCase()}`, className: iconButton, children: _jsx(ChevronRight, { className: "size-5" }) }), _jsx("h1", { className: cn("min-w-0 truncate font-normal text-fg", touch ? "text-base" : "text-xl"), children: title }), weekNumber !== undefined && (_jsxs("span", { className: "shrink-0 rounded-md bg-surface-sunken px-2 py-0.5 text-xs font-medium text-fg-muted", children: ["Week ", weekNumber] })), _jsx("div", { className: "min-w-0 flex-1" }), !touch && trailing, _jsx(Select, { "aria-label": "View", value: view, onChange: (event) => {
|
|
20
|
+
const picked = views.find((option) => option === event.target.value);
|
|
21
|
+
if (picked)
|
|
22
|
+
onChangeView(picked);
|
|
23
|
+
}, className: cn("shrink-0", touch ? "h-11 w-24" : "w-28"), children: views.map((option) => (_jsx("option", { value: option, children: VIEW_LABELS[option] }, option))) })] }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from "react";
|
|
2
|
+
export interface CalendarSheetProps {
|
|
3
|
+
labelledBy: string;
|
|
4
|
+
onDismiss: () => void;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
sheetRef?: Ref<HTMLDivElement>;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A sheet along the bottom of a phone that leaves the grid above it in view
|
|
11
|
+
* and live: no scrim, so a tap above it reaches the grid. A swipe down on the
|
|
12
|
+
* grabber dismisses it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function CalendarSheet({ labelledBy, onDismiss, children, sheetRef, className, }: CalendarSheetProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState, } from "react";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
const DISMISS_PX = 80;
|
|
5
|
+
/**
|
|
6
|
+
* A sheet along the bottom of a phone that leaves the grid above it in view
|
|
7
|
+
* and live: no scrim, so a tap above it reaches the grid. A swipe down on the
|
|
8
|
+
* grabber dismisses it.
|
|
9
|
+
*/
|
|
10
|
+
export function CalendarSheet({ labelledBy, onDismiss, children, sheetRef, className, }) {
|
|
11
|
+
const start = useRef(null);
|
|
12
|
+
const [offset, setOffset] = useState(0);
|
|
13
|
+
const down = (event) => {
|
|
14
|
+
start.current = event.clientY;
|
|
15
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
16
|
+
};
|
|
17
|
+
const move = (event) => {
|
|
18
|
+
if (start.current === null)
|
|
19
|
+
return;
|
|
20
|
+
setOffset(Math.max(0, event.clientY - start.current));
|
|
21
|
+
};
|
|
22
|
+
const up = () => {
|
|
23
|
+
if (start.current === null)
|
|
24
|
+
return;
|
|
25
|
+
start.current = null;
|
|
26
|
+
if (offset > DISMISS_PX)
|
|
27
|
+
onDismiss();
|
|
28
|
+
setOffset(0);
|
|
29
|
+
};
|
|
30
|
+
return (_jsxs("div", { ref: sheetRef, role: "dialog", "aria-modal": "false", "aria-labelledby": labelledBy, "data-calendar-popover": "", className: cn("fixed inset-x-0 bottom-0 z-50 max-h-[70dvh] overflow-y-auto rounded-t-2xl border-t border-line bg-surface-raised pb-[env(safe-area-inset-bottom,0px)] shadow-2xl shadow-black/30", className), style: {
|
|
31
|
+
transform: `translateY(${offset}px)`,
|
|
32
|
+
transition: offset === 0 ? "transform 200ms ease-out" : "none",
|
|
33
|
+
}, children: [_jsx("div", { "aria-hidden": "true", "data-sheet-grabber": "", onPointerDown: down, onPointerMove: move, onPointerUp: up, onPointerCancel: up, className: "flex h-6 cursor-grab touch-none items-center justify-center", children: _jsx("span", { className: "h-1 w-10 rounded-full bg-line-strong" }) }), children] }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactNode, Ref } from "react";
|
|
2
|
+
export interface CalendarSidePaneProps {
|
|
3
|
+
id: string;
|
|
4
|
+
onNewEvent: () => void;
|
|
5
|
+
newEventRef?: Ref<HTMLButtonElement>;
|
|
6
|
+
/** The mini month. */
|
|
7
|
+
month: ReactNode;
|
|
8
|
+
/** The calendar list, or the failure that stands in for it. */
|
|
9
|
+
calendars: ReactNode;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/** Google Calendar's left pane: New event, the mini month and My calendars. */
|
|
13
|
+
export declare function CalendarSidePane({ id, onNewEvent, newEventRef, month, calendars, className, }: CalendarSidePaneProps): import("react").JSX.Element;
|
|
14
|
+
export interface NewEventSquareProps {
|
|
15
|
+
onNewEvent: () => void;
|
|
16
|
+
newEventRef?: Ref<HTMLButtonElement>;
|
|
17
|
+
className?: string;
|
|
18
|
+
}
|
|
19
|
+
/** What New event shrinks to while the side pane is hidden. */
|
|
20
|
+
export declare function NewEventSquare({ onNewEvent, newEventRef, className, }: NewEventSquareProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Plus } from "lucide-react";
|
|
3
|
+
import { cn } from "../lib/cn.js";
|
|
4
|
+
/** Google Calendar's left pane: New event, the mini month and My calendars. */
|
|
5
|
+
export function CalendarSidePane({ id, onNewEvent, newEventRef, month, calendars, className, }) {
|
|
6
|
+
return (_jsxs("section", { id: id, "aria-label": "Calendar side pane", className: cn("flex w-64 shrink-0 flex-col gap-4 overflow-y-auto bg-surface px-3 py-3", className), children: [_jsxs("button", { ref: newEventRef, type: "button", onClick: onNewEvent, className: "flex h-12 w-fit items-center gap-3 rounded-2xl bg-surface-raised px-5 text-sm font-medium text-fg shadow-md outline-none transition-shadow hover:shadow-lg focus-visible:ring-2 focus-visible:ring-ring", children: [_jsx(Plus, { className: "size-5 text-accent", "aria-hidden": "true" }), "New event"] }), month, _jsxs("section", { "aria-label": "My calendars", className: "flex flex-col gap-1", children: [_jsx("h2", { className: "px-1 text-sm font-medium text-fg", children: "My calendars" }), calendars] })] }));
|
|
7
|
+
}
|
|
8
|
+
/** What New event shrinks to while the side pane is hidden. */
|
|
9
|
+
export function NewEventSquare({ onNewEvent, newEventRef, className, }) {
|
|
10
|
+
return (_jsx("button", { ref: newEventRef, type: "button", "aria-label": "New event", onClick: onNewEvent, className: cn("flex size-12 items-center justify-center rounded-2xl bg-surface-raised text-accent shadow-md outline-none hover:shadow-lg focus-visible:ring-2 focus-visible:ring-ring", className), children: _jsx(Plus, { className: "size-6", "aria-hidden": "true" }) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Density } from "./app-shell-types.js";
|
|
2
|
+
import type { CalendarColorId, CalendarEventData, CalendarSlotPick } from "./calendar-types.js";
|
|
3
|
+
/** What a reader did on the grid, for whoever holds the draft to decide. */
|
|
4
|
+
export type GridGesture = {
|
|
5
|
+
type: "drag";
|
|
6
|
+
range: CalendarSlotPick;
|
|
7
|
+
} | {
|
|
8
|
+
type: "drag-cancel";
|
|
9
|
+
} | {
|
|
10
|
+
type: "drag-end";
|
|
11
|
+
range: CalendarSlotPick;
|
|
12
|
+
} | {
|
|
13
|
+
type: "click";
|
|
14
|
+
range: CalendarSlotPick;
|
|
15
|
+
origin: HTMLElement | null;
|
|
16
|
+
} | {
|
|
17
|
+
type: "keyboard";
|
|
18
|
+
range: CalendarSlotPick;
|
|
19
|
+
origin: HTMLElement | null;
|
|
20
|
+
};
|
|
21
|
+
/** The one range the grid draws over the events: a selection, or the draft being edited. */
|
|
22
|
+
export interface GridDraft {
|
|
23
|
+
range: CalendarSlotPick;
|
|
24
|
+
title: string;
|
|
25
|
+
/** `selection` is solid, as a range being picked; `draft` is dashed and labelled. */
|
|
26
|
+
tone: "selection" | "draft";
|
|
27
|
+
/** A save of this draft failed. */
|
|
28
|
+
warning?: boolean;
|
|
29
|
+
/** Grab handles at both ends, which resize the range. */
|
|
30
|
+
handles?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface CalendarTimeGridProps {
|
|
33
|
+
/** The days in view, `YYYY-MM-DD`. */
|
|
34
|
+
days: readonly string[];
|
|
35
|
+
events: readonly CalendarEventData[];
|
|
36
|
+
colorByCalendarId: Readonly<Record<string, CalendarColorId>>;
|
|
37
|
+
density: Density;
|
|
38
|
+
/** The zone the grid's clock runs on. */
|
|
39
|
+
timeZone: string;
|
|
40
|
+
/** The instant the grid calls now. */
|
|
41
|
+
now: string;
|
|
42
|
+
selectedEventId?: string;
|
|
43
|
+
draft?: GridDraft;
|
|
44
|
+
onGesture: (gesture: GridGesture) => void;
|
|
45
|
+
onSelectEvent: (eventId: string, chip: HTMLElement) => void;
|
|
46
|
+
/** A day heading opens that day. */
|
|
47
|
+
onOpenDay?: (date: string) => void;
|
|
48
|
+
/** A finger selects by holding still, so a scroll never selects. */
|
|
49
|
+
touch?: boolean;
|
|
50
|
+
/** Whether an event may be dragged to a new time; its calendar takes writes. */
|
|
51
|
+
canMove?: (eventId: string) => boolean;
|
|
52
|
+
/** A stored event dropped at a new time or with a new end. */
|
|
53
|
+
onMoveEvent?: (eventId: string, range: CalendarSlotPick) => void;
|
|
54
|
+
className?: string;
|
|
55
|
+
}
|
|
56
|
+
/** "Wednesday 4 November, 08:00 to 09:45", for the live region and the focused slot. */
|
|
57
|
+
export declare function describeRange(range: CalendarSlotPick): string;
|
|
58
|
+
/**
|
|
59
|
+
* A day or a week of time, drawn by the kit rather than a calendar engine, so
|
|
60
|
+
* a press, a drag, a hold and the keyboard all reach the grid the same way.
|
|
61
|
+
* Every gesture leaves through `onGesture`; the grid only draws the draft it
|
|
62
|
+
* is handed.
|
|
63
|
+
*/
|
|
64
|
+
export declare function CalendarTimeGrid({ days, events, colorByCalendarId, density, timeZone, now, selectedEventId, draft, onGesture, onSelectEvent, onOpenDay, touch, canMove, onMoveEvent, className, }: CalendarTimeGridProps): import("react").JSX.Element;
|