@leonardaustin/ui 0.4.0 → 0.5.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/app-shell/AppShell.d.ts +4 -2
- package/dist/components/app-shell/AppShell.d.ts.map +1 -1
- package/dist/components/app-shell/MobileDrawer.d.ts +4 -2
- package/dist/components/app-shell/MobileDrawer.d.ts.map +1 -1
- package/dist/components/app-shell/TopBar.d.ts +5 -3
- package/dist/components/app-shell/TopBar.d.ts.map +1 -1
- package/dist/components/app-shell/navigation.d.ts +7 -2
- package/dist/components/app-shell/navigation.d.ts.map +1 -1
- package/dist/components/app-shell/types.d.ts +13 -1
- package/dist/components/app-shell/types.d.ts.map +1 -1
- package/dist/components/charts/AreaChart.d.ts +11 -7
- package/dist/components/charts/AreaChart.d.ts.map +1 -1
- package/dist/components/charts/BarChart.d.ts +25 -7
- package/dist/components/charts/BarChart.d.ts.map +1 -1
- package/dist/components/charts/DonutChart.d.ts +9 -4
- package/dist/components/charts/DonutChart.d.ts.map +1 -1
- package/dist/components/charts/RadarChart.d.ts +10 -4
- package/dist/components/charts/RadarChart.d.ts.map +1 -1
- package/dist/components/charts/RadialBarChart.d.ts +10 -4
- package/dist/components/charts/RadialBarChart.d.ts.map +1 -1
- package/dist/components/charts/SparkLine.d.ts +7 -1
- package/dist/components/charts/SparkLine.d.ts.map +1 -1
- package/dist/components/charts/StackedBarChart.d.ts +12 -1
- package/dist/components/charts/StackedBarChart.d.ts.map +1 -1
- package/dist/components/charts/VerticalBarChart.d.ts +26 -8
- package/dist/components/charts/VerticalBarChart.d.ts.map +1 -1
- package/dist/components/charts/chartUtils.d.ts +43 -0
- package/dist/components/charts/chartUtils.d.ts.map +1 -0
- package/dist/components/tables/ColumnPicker.d.ts +19 -2
- package/dist/components/tables/ColumnPicker.d.ts.map +1 -1
- package/dist/components/ui/Calendar.d.ts +174 -0
- package/dist/components/ui/Calendar.d.ts.map +1 -0
- package/dist/components/ui/CodeInput.d.ts +33 -0
- package/dist/components/ui/CodeInput.d.ts.map +1 -0
- package/dist/components/ui/PasswordRequirements.d.ts +13 -0
- package/dist/components/ui/PasswordRequirements.d.ts.map +1 -0
- package/dist/components/ui/QrCode.d.ts +33 -0
- package/dist/components/ui/QrCode.d.ts.map +1 -0
- package/dist/components/ui/StepProgress.d.ts.map +1 -1
- package/dist/components/ui/calendar/AgendaView.d.ts +11 -0
- package/dist/components/ui/calendar/AgendaView.d.ts.map +1 -0
- package/dist/components/ui/calendar/MonthView.d.ts +10 -0
- package/dist/components/ui/calendar/MonthView.d.ts.map +1 -0
- package/dist/components/ui/calendar/TimeGrid.d.ts +11 -0
- package/dist/components/ui/calendar/TimeGrid.d.ts.map +1 -0
- package/dist/components/ui/calendar/TimelineView.d.ts +11 -0
- package/dist/components/ui/calendar/TimelineView.d.ts.map +1 -0
- package/dist/components/ui/calendar/context.d.ts +56 -0
- package/dist/components/ui/calendar/context.d.ts.map +1 -0
- package/dist/components/ui/calendar/items.d.ts +46 -0
- package/dist/components/ui/calendar/items.d.ts.map +1 -0
- package/dist/components/ui/calendar/types.d.ts +125 -0
- package/dist/components/ui/calendar/types.d.ts.map +1 -0
- package/dist/components/ui/calendar/useGridInteraction.d.ts +39 -0
- package/dist/components/ui/calendar/useGridInteraction.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6658 -3115
- package/dist/lib/calendar.d.ts +305 -0
- package/dist/lib/calendar.d.ts.map +1 -0
- package/dist/lib/codeInput.d.ts +28 -0
- package/dist/lib/codeInput.d.ts.map +1 -0
- package/dist/lib/passwordRequirements.d.ts +12 -0
- package/dist/lib/passwordRequirements.d.ts.map +1 -0
- package/dist/lib/qrCode.d.ts +20 -0
- package/dist/lib/qrCode.d.ts.map +1 -0
- package/dist/styles.css +710 -0
- package/package.json +3 -2
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calendar — a Google-Calendar-style scheduler for bookings and availability.
|
|
3
|
+
*
|
|
4
|
+
* Views: day, 3-day, work week, week (default), month, agenda and a resource
|
|
5
|
+
* timeline. Pass `resources` to split time-grid columns per clinician/room.
|
|
6
|
+
* Availability blocks render as a background layer (time outside them is
|
|
7
|
+
* striped as busy); switch `editLayer` to "availability" to drag those instead of
|
|
8
|
+
* events.
|
|
9
|
+
*
|
|
10
|
+
* Fully controlled: the calendar never changes your data. Drag-to-create,
|
|
11
|
+
* move and resize (pointer or keyboard) call `onCreate`, `onEventChange` and
|
|
12
|
+
* `onAvailabilityChange`; apply the change to your state (or reject it in
|
|
13
|
+
* `validate`, which also drives the live drag preview).
|
|
14
|
+
*
|
|
15
|
+
* Times are local `Date`s on a wall-clock grid. See lib/calendar.ts for the
|
|
16
|
+
* timezone and DST notes.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <Calendar
|
|
21
|
+
* events={bookings}
|
|
22
|
+
* availability={expandAvailabilityRules(rules, range)}
|
|
23
|
+
* resources={clinicians}
|
|
24
|
+
* slotDuration={15}
|
|
25
|
+
* onCreate={(sel) => openNewBooking(sel)}
|
|
26
|
+
* onEventChange={(change) => moveBooking(change)}
|
|
27
|
+
* onRangeChange={setRange}
|
|
28
|
+
* />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
import { type ReactNode } from "react";
|
|
32
|
+
import { type CalendarAvailability, type CalendarEvent, type CalendarResource, type CalendarView, type Weekday } from "../../lib/calendar";
|
|
33
|
+
import { type CalendarAvailabilityChange, type CalendarDisplay, type CalendarDraft, type CalendarEventChange, type CalendarLabelOverrides, type CalendarRange, type CalendarRenderEvent, type CalendarSelection } from "./calendar/types";
|
|
34
|
+
export interface CalendarProps<T = unknown, A = unknown> {
|
|
35
|
+
/** Bookings/events to show. Filter them to the visible range for speed. */
|
|
36
|
+
events?: readonly CalendarEvent<T>[];
|
|
37
|
+
/**
|
|
38
|
+
* Availability and absence blocks, drawn behind events. Use
|
|
39
|
+
* `expandAvailabilityRules` to turn weekly rules into blocks. When provided,
|
|
40
|
+
* time no block covers is striped as busy (see `shadeOutsideAvailability`).
|
|
41
|
+
*/
|
|
42
|
+
availability?: readonly CalendarAvailability<A>[];
|
|
43
|
+
/**
|
|
44
|
+
* Resources (clinicians, rooms…). Time-grid views get one column per
|
|
45
|
+
* resource per day; the timeline gets one row each. Events need a matching
|
|
46
|
+
* `resourceId` to appear in resource views — add an "Unassigned" resource
|
|
47
|
+
* for events without one.
|
|
48
|
+
*/
|
|
49
|
+
resources?: readonly CalendarResource[];
|
|
50
|
+
/** Controlled view. */
|
|
51
|
+
view?: CalendarView;
|
|
52
|
+
/** Initial view when uncontrolled. Defaults to `week`. */
|
|
53
|
+
defaultView?: CalendarView;
|
|
54
|
+
onViewChange?: (view: CalendarView) => void;
|
|
55
|
+
/** Views offered by the toolbar switcher. */
|
|
56
|
+
views?: readonly CalendarView[];
|
|
57
|
+
/** Controlled anchor date (any time on the day to show). */
|
|
58
|
+
date?: Date;
|
|
59
|
+
/** Initial anchor date when uncontrolled. Defaults to today. */
|
|
60
|
+
defaultDate?: Date;
|
|
61
|
+
onDateChange?: (date: Date) => void;
|
|
62
|
+
/** Fires with the visible [start, end) range whenever it changes — fetch here. */
|
|
63
|
+
onRangeChange?: (range: CalendarRange) => void;
|
|
64
|
+
/** First day of the week. Defaults to 1 (Monday). */
|
|
65
|
+
weekStartsOn?: Weekday;
|
|
66
|
+
/** Days in the `workWeek` view. Defaults to Monday–Friday. */
|
|
67
|
+
workWeekDays?: readonly Weekday[];
|
|
68
|
+
/** Days in the `agenda` view. Defaults to 7. */
|
|
69
|
+
agendaDays?: number;
|
|
70
|
+
/** First visible time, "HH:mm". Defaults to "07:00". */
|
|
71
|
+
slotMinTime?: string;
|
|
72
|
+
/** Last visible time, "HH:mm" ("24:00" allowed). Defaults to "20:00". */
|
|
73
|
+
slotMaxTime?: string;
|
|
74
|
+
/** Snap step and keyboard step in minutes (5, 10, 15, 30…). Defaults to 15. */
|
|
75
|
+
slotDuration?: number;
|
|
76
|
+
/** Minutes between time labels. Defaults to 60. */
|
|
77
|
+
slotLabelInterval?: number;
|
|
78
|
+
/** Pixel height of one hour in time-grid views. Defaults to 48. */
|
|
79
|
+
hourHeight?: number;
|
|
80
|
+
/** Pixel width of one hour in the timeline. Defaults to 96. */
|
|
81
|
+
timelineHourWidth?: number;
|
|
82
|
+
/** Minimum width of a resource column. Defaults to 120. */
|
|
83
|
+
resourceMinWidth?: number;
|
|
84
|
+
/**
|
|
85
|
+
* Time to scroll to on mount, "HH:mm". Defaults to the earliest visible
|
|
86
|
+
* availability, else 08:00.
|
|
87
|
+
*/
|
|
88
|
+
scrollToTime?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Where the scroll time lands: at the top (left in the timeline) of the
|
|
91
|
+
* visible hours, or in the middle. Defaults to "start".
|
|
92
|
+
*/
|
|
93
|
+
scrollAlign?: "start" | "center";
|
|
94
|
+
/** Current time for the now-line and "Today". Defaults to the live clock. */
|
|
95
|
+
now?: Date;
|
|
96
|
+
/** Show the current-time line. Defaults to true. */
|
|
97
|
+
nowIndicator?: boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Which layer the pointer edits. `events` (default): availability is a
|
|
100
|
+
* passive background. `availability`: blocks become draggable cards and
|
|
101
|
+
* events are dimmed.
|
|
102
|
+
*/
|
|
103
|
+
editLayer?: "events" | "availability";
|
|
104
|
+
/** Disable every create, move and resize. */
|
|
105
|
+
readOnly?: boolean;
|
|
106
|
+
/** Allow creating by drag/click on empty time. Defaults to `!!onCreate`. */
|
|
107
|
+
selectable?: boolean;
|
|
108
|
+
/** Length in minutes of a click (not drag) or keyboard create. Defaults to 30. */
|
|
109
|
+
clickCreateDuration?: number;
|
|
110
|
+
/**
|
|
111
|
+
* Stripe time no block covers as busy, like an absence. Defaults to true.
|
|
112
|
+
*/
|
|
113
|
+
shadeOutsideAvailability?: boolean;
|
|
114
|
+
/** Empty time was selected (drag, click, Enter, or a month-day click). */
|
|
115
|
+
onCreate?: (selection: CalendarSelection) => void;
|
|
116
|
+
onEventClick?: (event: CalendarEvent<T>) => void;
|
|
117
|
+
/** An event was moved or resized. Enables event dragging. */
|
|
118
|
+
onEventChange?: (change: CalendarEventChange<T>) => void;
|
|
119
|
+
onAvailabilityClick?: (availability: CalendarAvailability<A>) => void;
|
|
120
|
+
/**
|
|
121
|
+
* A block was moved or resized (in `editLayer="availability"`). For a
|
|
122
|
+
* recurring occurrence (`seriesId` set) ask whether it applies to this
|
|
123
|
+
* occurrence or the series.
|
|
124
|
+
*/
|
|
125
|
+
onAvailabilityChange?: (change: CalendarAvailabilityChange<A>) => void;
|
|
126
|
+
/**
|
|
127
|
+
* Return a reason to reject a proposed create/move/resize. Called while
|
|
128
|
+
* dragging (the preview shows the reason) and before each callback.
|
|
129
|
+
*/
|
|
130
|
+
validate?: (draft: CalendarDraft<T, A>) => string | null | undefined | void;
|
|
131
|
+
/**
|
|
132
|
+
* A change was dropped but `validate` rejected it. Keyboard, click and
|
|
133
|
+
* month-chip changes have no live drag preview, so this is their only
|
|
134
|
+
* feedback: wire it up (e.g. to a toast) whenever you pass `validate`.
|
|
135
|
+
*/
|
|
136
|
+
onInvalidChange?: (draft: CalendarDraft<T, A>, reason: string) => void;
|
|
137
|
+
/** A day header or month day number was clicked. Defaults to opening the day view. */
|
|
138
|
+
onDateClick?: (date: Date) => void;
|
|
139
|
+
/** Replace the contents of an event box. */
|
|
140
|
+
renderEvent?: CalendarRenderEvent<T>;
|
|
141
|
+
/** Rows per month cell before "+N more". Defaults to as many as fit. */
|
|
142
|
+
monthMaxEvents?: number;
|
|
143
|
+
/** List availability in the agenda view. Defaults to true. */
|
|
144
|
+
agendaShowAvailability?: boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Text shown on boxes, chips and blocks outside the agenda, e.g.
|
|
147
|
+
* `{ time: false, status: false }`. Hidden text is removed, not replaced.
|
|
148
|
+
*/
|
|
149
|
+
display?: CalendarDisplay;
|
|
150
|
+
/**
|
|
151
|
+
* View used instead of multi-day time grids when the calendar is narrower
|
|
152
|
+
* than `narrowWidth`. Defaults to `day`; false keeps the chosen view.
|
|
153
|
+
*/
|
|
154
|
+
narrowView?: CalendarView | false;
|
|
155
|
+
/** Width in px below which `narrowView` applies. Defaults to 640. */
|
|
156
|
+
narrowWidth?: number;
|
|
157
|
+
/** Locale for dates and times. Defaults to "en-GB". */
|
|
158
|
+
locale?: string;
|
|
159
|
+
/** 12-hour clock. Defaults to false. */
|
|
160
|
+
hour12?: boolean;
|
|
161
|
+
/** Override any user-facing string. */
|
|
162
|
+
labels?: CalendarLabelOverrides;
|
|
163
|
+
/** Show the built-in toolbar. Defaults to true. */
|
|
164
|
+
toolbar?: boolean;
|
|
165
|
+
/** Extra toolbar content (filters, "New" button), before the view switcher. */
|
|
166
|
+
toolbarActions?: ReactNode;
|
|
167
|
+
/** Dim the calendar and show a spinner. */
|
|
168
|
+
loading?: boolean;
|
|
169
|
+
className?: string;
|
|
170
|
+
/** Accessible name for the calendar region. */
|
|
171
|
+
"aria-label"?: string;
|
|
172
|
+
}
|
|
173
|
+
export declare function Calendar<T = unknown, A = unknown>({ events, availability, resources, view: viewProp, defaultView, onViewChange, views, date: dateProp, defaultDate, onDateChange, onRangeChange, weekStartsOn, workWeekDays, agendaDays, slotMinTime, slotMaxTime, slotDuration, slotLabelInterval, hourHeight, timelineHourWidth, resourceMinWidth, scrollToTime, scrollAlign, now: nowProp, nowIndicator, editLayer, readOnly, selectable, clickCreateDuration, shadeOutsideAvailability, onCreate, onEventClick, onEventChange, onAvailabilityClick, onAvailabilityChange, validate, onInvalidChange, onDateClick, renderEvent, monthMaxEvents, agendaShowAvailability, display, narrowView, narrowWidth, locale, hour12, labels: labelOverrides, toolbar, toolbarActions, loading, className, "aria-label": ariaLabel, }: CalendarProps<T, A>): import("react/jsx-runtime").JSX.Element;
|
|
174
|
+
//# sourceMappingURL=Calendar.d.ts.map
|
|
@@ -0,0 +1 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AC,EAAE,OAAO,CAAC;IAClB,+EAA+E;IAC/E,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,2CAA2C;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAiED,wBAAgB,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,EACjD,MAAW,EACX,YAAY,EACZ,SAAc,EACd,IAAI,EAAE,QAAQ,EACd,WAAoB,EACpB,YAAY,EACZ,KAAqB,EACrB,IAAI,EAAE,QAAQ,EACd,WAAW,EACX,YAAY,EACZ,aAAa,EACb,YAAgB,EAChB,YAAY,EACZ,UAAc,EACd,WAAqB,EACrB,WAAqB,EACrB,YAAiB,EACjB,iBAAsB,EACtB,UAAe,EACf,iBAAsB,EACtB,gBAAsB,EACtB,YAAY,EACZ,WAAqB,EACrB,GAAG,EAAE,OAAO,EACZ,YAAmB,EACnB,SAAoB,EACpB,QAAgB,EAChB,UAAU,EACV,mBAAwB,EACxB,wBAA+B,EAC/B,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,QAAQ,EACR,eAAe,EACf,WAAW,EACX,WAAW,EACX,cAAc,EACd,sBAA6B,EAC7B,OAAO,EACP,UAAkB,EAClB,WAAiB,EACjB,MAAgB,EAChB,MAAc,EACd,MAAM,EAAE,cAAc,EACtB,OAAc,EACd,cAAc,EACd,OAAe,EACf,SAAS,EACT,YAAY,EAAE,SAAS,GACxB,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,2CA2YrB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface CodeInputProps {
|
|
2
|
+
/**
|
|
3
|
+
* The digits entered so far (controlled). Boxes the user has cleared are
|
|
4
|
+
* left out, so `value.length === length` only when every box is filled.
|
|
5
|
+
*/
|
|
6
|
+
value: string;
|
|
7
|
+
onChange: (value: string) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Called with the code whenever an edit leaves every box filled — use it
|
|
10
|
+
* to auto-submit. Fires again if the user then changes a digit.
|
|
11
|
+
*/
|
|
12
|
+
onComplete?: (value: string) => void;
|
|
13
|
+
/** Number of digit boxes. Only digits are accepted. */
|
|
14
|
+
length?: number;
|
|
15
|
+
/** Error message shown below the boxes; also marks them invalid. */
|
|
16
|
+
error?: string;
|
|
17
|
+
/** Marks the boxes invalid without a message (e.g. when it's shown elsewhere). */
|
|
18
|
+
invalid?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
autoFocus?: boolean;
|
|
21
|
+
/** Submits the joined code under this name in a native form post. */
|
|
22
|
+
name?: string;
|
|
23
|
+
/** Accessible name for the group of boxes. */
|
|
24
|
+
"aria-label"?: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A row of single-digit boxes for one-time codes (MFA, email verification).
|
|
29
|
+
* Handles typing, paste, SMS autofill, Backspace/Delete and arrow keys; each
|
|
30
|
+
* box keeps its position, so clearing one never shifts the others.
|
|
31
|
+
*/
|
|
32
|
+
export declare function CodeInput({ value, onChange, onComplete, length, error, invalid, disabled, autoFocus, name, "aria-label": ariaLabel, className, }: CodeInputProps): import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
//# sourceMappingURL=CodeInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeInput.d.ts","sourceRoot":"","sources":["../../../src/components/ui/CodeInput.tsx"],"names":[],"mappings":"AAWA,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qEAAqE;IACrE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,UAAU,EACV,MAAU,EACV,KAAK,EACL,OAAO,EACP,QAAQ,EACR,SAAS,EACT,IAAI,EACJ,YAAY,EAAE,SAA+B,EAC7C,SAAS,GACV,EAAE,cAAc,2CAkGhB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type PasswordRequirement } from "../../lib/passwordRequirements";
|
|
2
|
+
export interface PasswordRequirementsProps {
|
|
3
|
+
/** The password to check against each rule. */
|
|
4
|
+
password: string;
|
|
5
|
+
/** Rules to list, each with a unique label. Defaults to `defaultPasswordRequirements`. */
|
|
6
|
+
requirements?: readonly PasswordRequirement[];
|
|
7
|
+
/** Keep the list visible while the password is empty. */
|
|
8
|
+
showWhenEmpty?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/** A live checklist of password rules, ticked off as the user types. */
|
|
12
|
+
export declare function PasswordRequirements({ password, requirements, showWhenEmpty, className, }: PasswordRequirementsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
//# sourceMappingURL=PasswordRequirements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordRequirements.d.ts","sourceRoot":"","sources":["../../../src/components/ui/PasswordRequirements.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,gCAAgC,CAAC;AAExC,MAAM,WAAW,yBAAyB;IACxC,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,0FAA0F;IAC1F,YAAY,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC9C,yDAAyD;IACzD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wEAAwE;AACxE,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,YAA0C,EAC1C,aAAqB,EACrB,SAAS,GACV,EAAE,yBAAyB,kDA+B3B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type QrErrorCorrection } from "../../lib/qrCode";
|
|
3
|
+
export interface QrCodeProps {
|
|
4
|
+
/**
|
|
5
|
+
* Text to encode, e.g. a URL or an `otpauth://` URI for authenticator apps.
|
|
6
|
+
* An empty string renders nothing.
|
|
7
|
+
*/
|
|
8
|
+
value: string;
|
|
9
|
+
/**
|
|
10
|
+
* How much of the code can be damaged and still scan: L ≈ 7%, M ≈ 15%,
|
|
11
|
+
* Q ≈ 25%, H ≈ 30%. Higher levels produce denser codes.
|
|
12
|
+
*/
|
|
13
|
+
errorCorrection?: QrErrorCorrection;
|
|
14
|
+
/** Rendered width and height in pixels. */
|
|
15
|
+
size?: number;
|
|
16
|
+
/** Light border around the code, in modules. The spec asks for 4. */
|
|
17
|
+
margin?: number;
|
|
18
|
+
/** Accessible description of what the code contains. */
|
|
19
|
+
"aria-label"?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Rendered instead when `value` is too long to fit in a QR code at this
|
|
22
|
+
* error-correction level (2,953 bytes at L down to 1,273 at H).
|
|
23
|
+
*/
|
|
24
|
+
fallback?: ReactNode;
|
|
25
|
+
className?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A scannable QR code rendered as crisp SVG, with no runtime dependencies.
|
|
29
|
+
* Colours come from `--qr-foreground` / `--qr-background` so it stays
|
|
30
|
+
* dark-on-light in every theme.
|
|
31
|
+
*/
|
|
32
|
+
export declare function QrCode({ value, errorCorrection, size, margin, "aria-label": ariaLabel, fallback, className, }: QrCodeProps): import("react/jsx-runtime").JSX.Element | null;
|
|
33
|
+
//# sourceMappingURL=QrCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QrCode.d.ts","sourceRoot":"","sources":["../../../src/components/ui/QrCode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,eAAe,CAAC,EAAE,iBAAiB,CAAC;IACpC,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,eAAqB,EACrB,IAAU,EACV,MAAU,EACV,YAAY,EAAE,SAAqB,EACnC,QAAe,EACf,SAAS,GACV,EAAE,WAAW,kDA0Cb"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepProgress.d.ts","sourceRoot":"","sources":["../../../src/components/ui/StepProgress.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjD,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,SAAS,GACV,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"StepProgress.d.ts","sourceRoot":"","sources":["../../../src/components/ui/StepProgress.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjD,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,SAAS,GACV,EAAE,iBAAiB,2CAsDnB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CalendarAvailability, type CalendarEvent } from "../../../lib/calendar";
|
|
2
|
+
interface AgendaViewProps {
|
|
3
|
+
days: Date[];
|
|
4
|
+
events: readonly CalendarEvent[];
|
|
5
|
+
availability: readonly CalendarAvailability[];
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
/** A printable list of days, each with its events (and availability). */
|
|
9
|
+
export declare function AgendaView({ days, events, availability, label, }: AgendaViewProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=AgendaView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgendaView.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/calendar/AgendaView.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAI/B,UAAU,eAAe;IACvB,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IACjC,YAAY,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC9C,KAAK,EAAE,MAAM,CAAC;CACf;AAMD,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,KAAK,GACN,EAAE,eAAe,2CAwFjB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CalendarAvailability, type CalendarEvent } from "../../../lib/calendar";
|
|
2
|
+
interface MonthViewProps {
|
|
3
|
+
date: Date;
|
|
4
|
+
events: readonly CalendarEvent[];
|
|
5
|
+
availability: readonly CalendarAvailability[];
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function MonthView({ date, events, availability, label, }: MonthViewProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=MonthView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MonthView.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/calendar/MonthView.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAgBL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAK/B,UAAU,cAAc;IACtB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IACjC,YAAY,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC9C,KAAK,EAAE,MAAM,CAAC;CACf;AAyBD,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,MAAM,EACN,YAAY,EACZ,KAAK,GACN,EAAE,cAAc,2CAgehB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CalendarAvailability, type CalendarEvent } from "../../../lib/calendar";
|
|
2
|
+
interface TimeGridProps {
|
|
3
|
+
days: Date[];
|
|
4
|
+
events: readonly CalendarEvent[];
|
|
5
|
+
availability: readonly CalendarAvailability[];
|
|
6
|
+
/** Accessible name for the grid, e.g. the toolbar title. */
|
|
7
|
+
label: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function TimeGrid({ days, events, availability, label }: TimeGridProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=TimeGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimeGrid.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/calendar/TimeGrid.tsx"],"names":[],"mappings":"AAUA,OAAO,EAcL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;AAM/B,UAAU,aAAa;IACrB,IAAI,EAAE,IAAI,EAAE,CAAC;IACb,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IACjC,YAAY,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC9C,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;CACf;AAyCD,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,EAAE,aAAa,2CAokB5E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type CalendarAvailability, type CalendarEvent } from "../../../lib/calendar";
|
|
2
|
+
interface TimelineViewProps {
|
|
3
|
+
day: Date;
|
|
4
|
+
events: readonly CalendarEvent[];
|
|
5
|
+
availability: readonly CalendarAvailability[];
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
/** One day, one horizontal row per resource, grouped by `resource.group`. */
|
|
9
|
+
export declare function TimelineView({ day, events, availability, label, }: TimelineViewProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=TimelineView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TimelineView.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/calendar/TimelineView.tsx"],"names":[],"mappings":"AAWA,OAAO,EASL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAEnB,MAAM,uBAAuB,CAAC;AAM/B,UAAU,iBAAiB;IACzB,GAAG,EAAE,IAAI,CAAC;IACV,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IACjC,YAAY,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC9C,KAAK,EAAE,MAAM,CAAC;CACf;AA+BD,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,EAC3B,GAAG,EACH,MAAM,EACN,YAAY,EACZ,KAAK,GACN,EAAE,iBAAiB,2CAkdnB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { CalendarAvailability, CalendarColor, CalendarEvent, CalendarResource, CalendarView, TimeBounds, Weekday } from "../../../lib/calendar";
|
|
2
|
+
import type { CalendarDisplay, CalendarDraft, CalendarLabels, CalendarRenderEvent } from "./types";
|
|
3
|
+
/** Resolved configuration shared by every calendar view (internal). */
|
|
4
|
+
export interface CalendarContextValue {
|
|
5
|
+
view: CalendarView;
|
|
6
|
+
locale: string;
|
|
7
|
+
hour12: boolean;
|
|
8
|
+
weekStartsOn: Weekday;
|
|
9
|
+
now: Date;
|
|
10
|
+
nowIndicator: boolean;
|
|
11
|
+
labels: CalendarLabels;
|
|
12
|
+
/** Id of the hidden element describing item keyboard controls. */
|
|
13
|
+
itemHelpId: string;
|
|
14
|
+
resources: readonly CalendarResource[];
|
|
15
|
+
resourceById: Map<string, CalendarResource>;
|
|
16
|
+
/** Snap step in minutes. */
|
|
17
|
+
step: number;
|
|
18
|
+
bounds: TimeBounds;
|
|
19
|
+
hourHeight: number;
|
|
20
|
+
slotLabelInterval: number;
|
|
21
|
+
timelineHourWidth: number;
|
|
22
|
+
resourceMinWidth: number;
|
|
23
|
+
editLayer: "events" | "availability";
|
|
24
|
+
selectable: boolean;
|
|
25
|
+
clickCreateDuration: number;
|
|
26
|
+
hasAvailability: boolean;
|
|
27
|
+
shadeOutsideAvailability: boolean;
|
|
28
|
+
/** Undefined = fit to the cell height. */
|
|
29
|
+
monthMaxEvents?: number;
|
|
30
|
+
agendaShowAvailability: boolean;
|
|
31
|
+
/** Text shown in the grid, month and timeline (not the agenda). */
|
|
32
|
+
display: Required<CalendarDisplay>;
|
|
33
|
+
scrollToMinute?: number;
|
|
34
|
+
scrollAlign: "start" | "center";
|
|
35
|
+
canEditEvent: (event: CalendarEvent) => boolean;
|
|
36
|
+
canEditBlock: (block: CalendarAvailability) => boolean;
|
|
37
|
+
eventColor: (event: CalendarEvent) => CalendarColor;
|
|
38
|
+
blockColor: (block: CalendarAvailability) => CalendarColor;
|
|
39
|
+
statusLabel: (event: CalendarEvent) => string | undefined;
|
|
40
|
+
describeEvent: (event: CalendarEvent) => string;
|
|
41
|
+
describeBlock: (block: CalendarAvailability) => string;
|
|
42
|
+
renderEvent?: CalendarRenderEvent<unknown>;
|
|
43
|
+
hasEventClick: boolean;
|
|
44
|
+
hasBlockClick: boolean;
|
|
45
|
+
clickEvent: (event: CalendarEvent) => void;
|
|
46
|
+
clickBlock: (block: CalendarAvailability) => void;
|
|
47
|
+
/** Returns a rejection reason for a draft, if any. */
|
|
48
|
+
check: (draft: CalendarDraft) => string | undefined;
|
|
49
|
+
/** Validates and emits a draft. Returns false when it was rejected. */
|
|
50
|
+
commit: (draft: CalendarDraft, source: "pointer" | "keyboard") => boolean;
|
|
51
|
+
/** Opens a day (header or month-cell click). */
|
|
52
|
+
openDay: (date: Date) => void;
|
|
53
|
+
}
|
|
54
|
+
export declare const CalendarContext: import("react").Context<CalendarContextValue | null>;
|
|
55
|
+
export declare function useCalendarContext(): CalendarContextValue;
|
|
56
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/calendar/context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,OAAO,EACR,MAAM,uBA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,UAAU,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,aAAa,CAAC;IACpD,UAAU,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,aAAa,CAAC;IAC3D,WAAW,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,GAAG,SAAS,CAAC;IAC1D,aAAa,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,CAAC;IAChD,aAAa,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,MAAM,CAAC;IACvD,WAAW,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC3C,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3C,UAAU,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAClD,sDAAsD;IACtD,KAAK,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,GAAG,SAAS,CAAC;IACpD,uEAAuE;IACvE,MAAM,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,SAAS,GAAG,UAAU,KAAK,OAAO,CAAC;IAC1E,gDAAgD;IAChD,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,eAAe,sDAAmD,CAAC;AAEhF,wBAAgB,kBAAkB,IAAI,oBAAoB,CAIzD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { CSSProperties, KeyboardEvent, MouseEvent } from "react";
|
|
2
|
+
import { type CalendarAvailability, type CalendarEvent } from "../../../lib/calendar";
|
|
3
|
+
import type { CalendarDraft } from "./types";
|
|
4
|
+
interface EventBoxProps {
|
|
5
|
+
event: CalendarEvent;
|
|
6
|
+
style: CSSProperties;
|
|
7
|
+
/** Resize handle edge, or none. */
|
|
8
|
+
resizeEdge?: "bottom" | "right";
|
|
9
|
+
compact: boolean;
|
|
10
|
+
/** Title plus one time · status line (timeline rows). */
|
|
11
|
+
dense?: boolean;
|
|
12
|
+
continuesBefore?: boolean;
|
|
13
|
+
continuesAfter?: boolean;
|
|
14
|
+
dragging?: boolean;
|
|
15
|
+
onKeyDown?: (e: KeyboardEvent<HTMLElement>) => void;
|
|
16
|
+
/**
|
|
17
|
+
* Click handler. Boxes inside the pointer-handled grid only need it for
|
|
18
|
+
* assistive-technology activation (a synthetic click, `detail === 0`).
|
|
19
|
+
*/
|
|
20
|
+
onClick?: (e: MouseEvent<HTMLElement>) => void;
|
|
21
|
+
}
|
|
22
|
+
/** A positioned event in the time grid, all-day row or timeline. */
|
|
23
|
+
export declare function EventBox({ event, style, resizeEdge, compact, dense, continuesBefore, continuesAfter, dragging, onKeyDown, onClick, }: EventBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
interface BlockBoxProps {
|
|
25
|
+
block: CalendarAvailability;
|
|
26
|
+
style: CSSProperties;
|
|
27
|
+
resizeEdge?: "bottom" | "right";
|
|
28
|
+
continuesAfter?: boolean;
|
|
29
|
+
dragging?: boolean;
|
|
30
|
+
onKeyDown?: (e: KeyboardEvent<HTMLElement>) => void;
|
|
31
|
+
/** Like `EventBox`'s `onClick`. */
|
|
32
|
+
onClick?: (e: MouseEvent<HTMLElement>) => void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* An availability block. In the events layer it's a passive background tint;
|
|
36
|
+
* with `editLayer="availability"` it becomes a focusable, draggable card.
|
|
37
|
+
*/
|
|
38
|
+
export declare function BlockBox({ block, style, resizeEdge, continuesAfter, dragging, onKeyDown, onClick, }: BlockBoxProps): import("react/jsx-runtime").JSX.Element | null;
|
|
39
|
+
/** Drag preview: the proposed time, or why it's not allowed. */
|
|
40
|
+
export declare function Ghost({ draft, invalid, style, }: {
|
|
41
|
+
draft: CalendarDraft;
|
|
42
|
+
invalid?: string;
|
|
43
|
+
style: CSSProperties;
|
|
44
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=items.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/calendar/items.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEtE,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EACnB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,UAAU,aAAa;IACrB,KAAK,EAAE,aAAa,CAAC;IACrB,KAAK,EAAE,aAAa,CAAC;IACrB,mCAAmC;IACnC,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,yDAAyD;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACpD;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CAChD;AAED,oEAAoE;AACpE,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,KAAK,EACL,UAAU,EACV,OAAO,EACP,KAAK,EACL,eAAe,EACf,cAAc,EACd,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,aAAa,2CAwEf;AAmDD,UAAU,aAAa;IACrB,KAAK,EAAE,oBAAoB,CAAC;IAC5B,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACpD,mCAAmC;IACnC,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CAChD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,KAAK,EACL,UAAU,EACV,cAAc,EACd,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,aAAa,kDAkDf;AAED,gEAAgE;AAChE,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,OAAO,EACP,KAAK,GACN,EAAE;IACD,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;CACtB,2CAsBA"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { CalendarAvailability, CalendarEvent, CalendarEventStatus, CalendarView, DateRange } from "../../../lib/calendar";
|
|
3
|
+
/** A new range picked by dragging (or clicking) on empty time. */
|
|
4
|
+
export interface CalendarSelection {
|
|
5
|
+
start: Date;
|
|
6
|
+
end: Date;
|
|
7
|
+
allDay: boolean;
|
|
8
|
+
/** Resource of the column or row the selection was made in. */
|
|
9
|
+
resourceId?: string;
|
|
10
|
+
/** How it was made. */
|
|
11
|
+
source: "pointer" | "keyboard";
|
|
12
|
+
}
|
|
13
|
+
interface ChangeBase {
|
|
14
|
+
action: "move" | "resize";
|
|
15
|
+
start: Date;
|
|
16
|
+
end: Date;
|
|
17
|
+
/** Resource of the column/row it was dropped on (undefined without resources). */
|
|
18
|
+
resourceId?: string;
|
|
19
|
+
/** Resource of the column/row the change started from. */
|
|
20
|
+
previousResourceId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The item's resource ids with `previousResourceId` replaced by
|
|
23
|
+
* `resourceId`; undefined when the item had none (applies to all).
|
|
24
|
+
*/
|
|
25
|
+
resourceIds?: string[];
|
|
26
|
+
source: "pointer" | "keyboard";
|
|
27
|
+
}
|
|
28
|
+
/** A requested move or resize of an event. The consumer applies it. */
|
|
29
|
+
export interface CalendarEventChange<T = unknown> extends ChangeBase {
|
|
30
|
+
event: CalendarEvent<T>;
|
|
31
|
+
}
|
|
32
|
+
/** A requested move or resize of an availability block. */
|
|
33
|
+
export interface CalendarAvailabilityChange<A = unknown> extends ChangeBase {
|
|
34
|
+
availability: CalendarAvailability<A>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A proposed create/move/resize, passed to `validate` while the user drags
|
|
38
|
+
* (and before keyboard changes) so you can reject it with a reason.
|
|
39
|
+
*/
|
|
40
|
+
export type CalendarDraft<T = unknown, A = unknown> = ({
|
|
41
|
+
target: "selection";
|
|
42
|
+
action: "create";
|
|
43
|
+
} & Omit<CalendarSelection, "source">) | ({
|
|
44
|
+
target: "event";
|
|
45
|
+
} & Omit<CalendarEventChange<T>, "source">) | ({
|
|
46
|
+
target: "availability";
|
|
47
|
+
} & Omit<CalendarAvailabilityChange<A>, "source">);
|
|
48
|
+
/**
|
|
49
|
+
* Text shown on event boxes, chips and availability blocks in the time
|
|
50
|
+
* grid, month and timeline. Hidden text is removed, never substituted, and
|
|
51
|
+
* stays in the screen-reader labels of events and editable blocks. The
|
|
52
|
+
* agenda always shows it all.
|
|
53
|
+
* Every field defaults to true.
|
|
54
|
+
*/
|
|
55
|
+
export interface CalendarDisplay {
|
|
56
|
+
/** Start and end times. */
|
|
57
|
+
time?: boolean;
|
|
58
|
+
/** The event's `description` line, e.g. service and room. */
|
|
59
|
+
description?: boolean;
|
|
60
|
+
/** Status labels such as "Tentative". The box styling still marks status. */
|
|
61
|
+
status?: boolean;
|
|
62
|
+
/** The event's `badge`, e.g. "Arrived". */
|
|
63
|
+
badge?: boolean;
|
|
64
|
+
/** Block labels. Off leaves blocks unlabelled rather than "Available". */
|
|
65
|
+
blockLabels?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Draw `available` blocks. Off hides them but they still mark working
|
|
68
|
+
* hours for the outside-availability shading. Always on while editing
|
|
69
|
+
* availability.
|
|
70
|
+
*/
|
|
71
|
+
availableBlocks?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/** Visible range reported by `onRangeChange`. */
|
|
74
|
+
export interface CalendarRange extends DateRange {
|
|
75
|
+
view: CalendarView;
|
|
76
|
+
}
|
|
77
|
+
/** Context passed to `renderEvent`. */
|
|
78
|
+
export interface CalendarEventRenderContext {
|
|
79
|
+
view: CalendarView;
|
|
80
|
+
/** True when the box is too short for more than one line. */
|
|
81
|
+
compact: boolean;
|
|
82
|
+
/** Formatted time range, e.g. "09:00–09:30". */
|
|
83
|
+
timeLabel: string;
|
|
84
|
+
/**
|
|
85
|
+
* Text for the event's status: undefined when confirmed or when
|
|
86
|
+
* `display.status` is false.
|
|
87
|
+
*/
|
|
88
|
+
statusLabel?: string;
|
|
89
|
+
}
|
|
90
|
+
/** Every user-facing string, for translation or different wording. */
|
|
91
|
+
export interface CalendarLabels {
|
|
92
|
+
today: string;
|
|
93
|
+
previous: string;
|
|
94
|
+
next: string;
|
|
95
|
+
view: string;
|
|
96
|
+
allDay: string;
|
|
97
|
+
more: (count: number) => string;
|
|
98
|
+
/** Count announced for a month day, e.g. "3 events". */
|
|
99
|
+
eventCount: (count: number) => string;
|
|
100
|
+
showLess: string;
|
|
101
|
+
noEvents: string;
|
|
102
|
+
noResources: string;
|
|
103
|
+
earlier: (count: number) => string;
|
|
104
|
+
later: (count: number) => string;
|
|
105
|
+
available: string;
|
|
106
|
+
unavailable: string;
|
|
107
|
+
loading: string;
|
|
108
|
+
close: string;
|
|
109
|
+
views: Record<CalendarView, string>;
|
|
110
|
+
status: Record<CalendarEventStatus, string>;
|
|
111
|
+
/** Screen-reader help for the time grid's keyboard controls. */
|
|
112
|
+
gridHelp: string;
|
|
113
|
+
/** Screen-reader help for focused events and blocks. */
|
|
114
|
+
itemHelp: string;
|
|
115
|
+
}
|
|
116
|
+
/** Partial labels; `views` and `status` may be partial too. */
|
|
117
|
+
export type CalendarLabelOverrides = Partial<Omit<CalendarLabels, "views" | "status">> & {
|
|
118
|
+
views?: Partial<CalendarLabels["views"]>;
|
|
119
|
+
status?: Partial<CalendarLabels["status"]>;
|
|
120
|
+
};
|
|
121
|
+
export declare const DEFAULT_CALENDAR_LABELS: CalendarLabels;
|
|
122
|
+
/** Render override for an event's contents. */
|
|
123
|
+
export type CalendarRenderEvent<T> = (event: CalendarEvent<T>, context: CalendarEventRenderContext) => ReactNode;
|
|
124
|
+
export {};
|
|
125
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/calendar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACV,MAAM,uBAAuB,CAAC;AAE/B,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI,CAAC;IACV,MAAM,EAAE,OAAO,CAAC;IAChB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,MAAM,EAAE,SAAS,GAAG,UAAU,CAAC;CAChC;AAED,UAAU,UAAU;IAClB,MAAM,EAAE,MAAM,GAAG,QAAQ,CAAC;IAC1B,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI,CAAC;IACV,kFAAkF;IAClF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;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AAQ,CAAC,CACzC,GAAG;IACF,KAAK,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;CAC5C,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,cAoCrC,CAAC;AAEF,+CAA+C;AAC/C,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CACnC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,EACvB,OAAO,EAAE,0BAA0B,KAChC,SAAS,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type FocusEvent, type KeyboardEvent, type PointerEvent as ReactPointerEvent, type RefObject } from "react";
|
|
2
|
+
import { type CalendarAvailability, type CalendarEvent } from "../../../lib/calendar";
|
|
3
|
+
import type { CalendarDraft } from "./types";
|
|
4
|
+
export interface GridColumn {
|
|
5
|
+
key: string;
|
|
6
|
+
day: Date;
|
|
7
|
+
resourceId?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface GridDraftState {
|
|
10
|
+
draft: CalendarDraft;
|
|
11
|
+
invalid?: string;
|
|
12
|
+
itemId?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GridCursor {
|
|
15
|
+
column: number;
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
}
|
|
19
|
+
interface Options {
|
|
20
|
+
axis: "x" | "y";
|
|
21
|
+
columns: readonly GridColumn[];
|
|
22
|
+
pxPerMinute: number;
|
|
23
|
+
scrollRef: RefObject<HTMLElement | null>;
|
|
24
|
+
events: ReadonlyMap<string, CalendarEvent>;
|
|
25
|
+
blocks: ReadonlyMap<string, CalendarAvailability>;
|
|
26
|
+
/** Column the keyboard cursor starts in. */
|
|
27
|
+
initialColumn: number;
|
|
28
|
+
}
|
|
29
|
+
export declare function useGridInteraction({ axis, columns, pxPerMinute, scrollRef, events, blocks, initialColumn, }: Options): {
|
|
30
|
+
drag: GridDraftState | null;
|
|
31
|
+
cursor: GridCursor | null;
|
|
32
|
+
onPointerDown: (e: ReactPointerEvent<HTMLElement>) => void;
|
|
33
|
+
onItemKeyDown: (e: KeyboardEvent<HTMLElement>, type: "event" | "availability", id: string, columnIndex: number) => void;
|
|
34
|
+
onGridFocus: (e: FocusEvent<HTMLElement>) => void;
|
|
35
|
+
onGridBlur: (e: FocusEvent<HTMLElement>) => void;
|
|
36
|
+
onGridKeyDown: (e: KeyboardEvent<HTMLElement>) => void;
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=useGridInteraction.d.ts.map
|