@remit/web-client 0.0.328 → 0.0.330

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 (159) hide show
  1. package/dist/src/components/calendar/CalendarEventEditor.d.ts +6 -0
  2. package/dist/src/components/calendar/CalendarEventEditor.js +371 -0
  3. package/dist/src/components/calendar/CalendarEventPopup.d.ts +10 -0
  4. package/dist/src/components/calendar/CalendarEventPopup.js +198 -0
  5. package/dist/src/components/calendar/CalendarLoadFailed.d.ts +8 -0
  6. package/dist/src/components/calendar/CalendarLoadFailed.js +11 -0
  7. package/dist/src/components/calendar/CalendarNavPane.d.ts +11 -0
  8. package/dist/src/components/calendar/CalendarNavPane.js +50 -0
  9. package/dist/src/components/calendar/CalendarQuickCreate.d.ts +22 -0
  10. package/dist/src/components/calendar/CalendarQuickCreate.js +204 -0
  11. package/dist/src/components/calendar/CalendarScreen.d.ts +11 -0
  12. package/dist/src/components/calendar/CalendarScreen.js +184 -0
  13. package/dist/src/components/calendar/CalendarSession.d.ts +24 -0
  14. package/dist/src/components/calendar/CalendarSession.js +12 -0
  15. package/dist/src/components/calendar/CalendarTaskPopup.d.ts +4 -0
  16. package/dist/src/components/calendar/CalendarTaskPopup.js +95 -0
  17. package/dist/src/components/calendar/CalendarWaiting.d.ts +3 -3
  18. package/dist/src/components/calendar/CalendarWaiting.js +5 -10
  19. package/dist/src/components/calendar/ChangeCalendarSuggestion.js +39 -5
  20. package/dist/src/components/calendar/EventMoves.d.ts +17 -0
  21. package/dist/src/components/calendar/EventMoves.js +103 -0
  22. package/dist/src/components/calendar/calendar-story-fixtures.js +8 -2
  23. package/dist/src/components/calendar/calendar-story-server.d.ts +2 -5
  24. package/dist/src/components/calendar/calendar-story-server.js +5 -6
  25. package/dist/src/components/compose/ComposeForm.js +1 -1
  26. package/dist/src/components/layout/AppFrame.d.ts +11 -0
  27. package/dist/src/components/layout/AppFrame.js +16 -0
  28. package/dist/src/components/mail/BulkRunProvider.js +1 -1
  29. package/dist/src/components/mail/MailSidebarAdapter.js +1 -1
  30. package/dist/src/components/mail/MessageActionMenu.js +1 -1
  31. package/dist/src/components/mail/MessageList.js +1 -1
  32. package/dist/src/components/mail/OutboxPane.js +1 -1
  33. package/dist/src/components/mail/ThreadListInteraction.js +1 -1
  34. package/dist/src/components/settings/CalendarDefaultSenderCard.d.ts +2 -0
  35. package/dist/src/components/settings/CalendarDefaultSenderCard.js +16 -0
  36. package/dist/src/components/ui/ErrorBannerProvider.d.ts +0 -23
  37. package/dist/src/components/ui/ErrorBannerProvider.js +3 -39
  38. package/dist/src/components/ui/SignedOutOverlay.d.ts +6 -0
  39. package/dist/src/components/ui/SignedOutOverlay.js +29 -0
  40. package/dist/src/components/ui/error-banner-context.d.ts +23 -0
  41. package/dist/src/components/ui/error-banner-context.js +38 -0
  42. package/dist/src/hooks/calendar/draft-session.d.ts +78 -0
  43. package/dist/src/hooks/calendar/draft-session.js +110 -0
  44. package/dist/src/hooks/calendar/draft.d.ts +8 -2
  45. package/dist/src/hooks/calendar/draft.js +17 -4
  46. package/dist/src/hooks/calendar/index.d.ts +6 -3
  47. package/dist/src/hooks/calendar/index.js +5 -2
  48. package/dist/src/hooks/calendar/instance.d.ts +2 -1
  49. package/dist/src/hooks/calendar/instance.js +14 -1
  50. package/dist/src/hooks/calendar/useCalendarJump.d.ts +0 -2
  51. package/dist/src/hooks/calendar/useCalendarJump.js +3 -5
  52. package/dist/src/hooks/calendar/useCalendarScheduling.d.ts +33 -0
  53. package/dist/src/hooks/calendar/useCalendarScheduling.js +118 -0
  54. package/dist/src/hooks/calendar/useCalendarTasks.d.ts +53 -0
  55. package/dist/src/hooks/calendar/useCalendarTasks.js +105 -0
  56. package/dist/src/hooks/calendar/useCalendarWrites.d.ts +18 -2
  57. package/dist/src/hooks/calendar/useCalendarWrites.js +19 -6
  58. package/dist/src/hooks/calendar/useCalendars.d.ts +3 -0
  59. package/dist/src/hooks/calendar/useCalendars.js +13 -5
  60. package/dist/src/hooks/calendar/useDraftSession.d.ts +32 -0
  61. package/dist/src/hooks/calendar/useDraftSession.js +106 -0
  62. package/dist/src/hooks/calendar/useMoveEvent.d.ts +4 -0
  63. package/dist/src/hooks/calendar/useMoveEvent.js +62 -0
  64. package/dist/src/hooks/use-system-update.js +3 -5
  65. package/dist/src/hooks/useApplyLabel.js +1 -1
  66. package/dist/src/hooks/useCalendarData.d.ts +9 -2
  67. package/dist/src/hooks/useCalendarData.js +22 -5
  68. package/dist/src/hooks/useCalendarSidePane.d.ts +14 -0
  69. package/dist/src/hooks/useCalendarSidePane.js +30 -0
  70. package/dist/src/hooks/useComposeLanguages.js +1 -1
  71. package/dist/src/hooks/useDeleteMessages.js +1 -1
  72. package/dist/src/hooks/useEmptyTrash.js +1 -1
  73. package/dist/src/hooks/useEscalatedActions.js +1 -1
  74. package/dist/src/hooks/useFilters.d.ts +1 -1
  75. package/dist/src/hooks/useLabels.d.ts +1 -1
  76. package/dist/src/hooks/useMarkAsRead.js +1 -1
  77. package/dist/src/hooks/useMoveMessages.js +1 -1
  78. package/dist/src/hooks/useRefreshControl.js +4 -8
  79. package/dist/src/hooks/useReportSpam.js +1 -1
  80. package/dist/src/hooks/useSignature.js +1 -1
  81. package/dist/src/hooks/useStaleAccountSync.js +4 -4
  82. package/dist/src/hooks/useStarredThreads.d.ts +1 -1
  83. package/dist/src/hooks/useToggleStar.js +1 -1
  84. package/dist/src/hooks/useToggleTrusted.js +1 -1
  85. package/dist/src/hooks/useTriggerSync.d.ts +1 -1
  86. package/dist/src/hooks/useUpdateAddressFlags.js +1 -1
  87. package/dist/src/hooks/useWarningsAttention.js +1 -3
  88. package/dist/src/lib/calendar-route.d.ts +6 -0
  89. package/dist/src/lib/calendar-route.js +14 -0
  90. package/dist/src/lib/calendar-side-pane-pref.d.ts +14 -0
  91. package/dist/src/lib/calendar-side-pane-pref.js +27 -0
  92. package/dist/src/lib/error-classifier.d.ts +5 -30
  93. package/dist/src/lib/error-classifier.js +7 -10
  94. package/dist/src/lib/escalate.d.ts +6 -0
  95. package/dist/src/lib/escalate.js +16 -0
  96. package/dist/src/lib/intelligence-pref.js +3 -2
  97. package/dist/src/lib/new-event-range.d.ts +26 -0
  98. package/dist/src/lib/new-event-range.js +69 -0
  99. package/dist/src/lib/query-error-handler.d.ts +2 -6
  100. package/dist/src/lib/query-error-handler.js +5 -14
  101. package/dist/src/lib/signed-out.d.ts +13 -0
  102. package/dist/src/lib/signed-out.js +28 -0
  103. package/dist/src/routeTree.gen.d.ts +98 -19
  104. package/dist/src/routeTree.gen.js +32 -1
  105. package/dist/src/routes/__root.js +8 -2
  106. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId/edit.d.ts +5 -0
  107. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId/edit.js +11 -0
  108. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId/index.d.ts +5 -0
  109. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId/index.js +12 -0
  110. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId.d.ts +1 -1
  111. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/$recurrenceId.js +4 -13
  112. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/edit.d.ts +5 -0
  113. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/edit.js +14 -0
  114. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/index.d.ts +1 -1
  115. package/dist/src/routes/calendar/$view.$date/$calendarObjectId/index.js +4 -4
  116. package/dist/src/routes/calendar/$view.$date/$calendarObjectId.d.ts +1 -1
  117. package/dist/src/routes/calendar/$view.$date/index.d.ts +1 -6
  118. package/dist/src/routes/calendar/$view.$date/index.js +3 -10
  119. package/dist/src/routes/calendar/$view.$date/new.d.ts +6 -2
  120. package/dist/src/routes/calendar/$view.$date/new.js +8 -13
  121. package/dist/src/routes/calendar/$view.$date/suggestion.$suggestionId.d.ts +1 -1
  122. package/dist/src/routes/calendar/$view.$date/suggestion.$suggestionId.js +2 -2
  123. package/dist/src/routes/calendar/$view.$date/task.$calendarTaskId.d.ts +5 -0
  124. package/dist/src/routes/calendar/$view.$date/task.$calendarTaskId.js +16 -0
  125. package/dist/src/routes/calendar/$view.$date.d.ts +1 -1
  126. package/dist/src/routes/calendar/$view.$date.js +14 -50
  127. package/dist/src/routes/calendar/index.d.ts +1 -1
  128. package/dist/src/routes/calendar/index.js +2 -1
  129. package/dist/src/routes/calendar.d.ts +4 -9
  130. package/dist/src/routes/calendar.js +10 -35
  131. package/dist/src/routes/mail/index.d.ts +1 -1
  132. package/dist/src/routes/mail/index.js +7 -2
  133. package/dist/src/routes/mail.js +6 -5
  134. package/dist/src/routes/settings/calendars.js +2 -1
  135. package/dist/src/routing/app-switch.d.ts +11 -0
  136. package/dist/src/routing/app-switch.js +35 -0
  137. package/dist/src/routing/calendar.d.ts +45 -4
  138. package/dist/src/routing/calendar.js +135 -13
  139. package/dist/src/routing/fragment.d.ts +1 -1
  140. package/dist/src/routing/fragment.js +6 -1
  141. package/dist/src/routing/index.d.ts +2 -1
  142. package/dist/src/routing/index.js +2 -1
  143. package/package.json +2 -2
  144. package/dist/src/components/calendar/CalendarComposePane.d.ts +0 -49
  145. package/dist/src/components/calendar/CalendarComposePane.js +0 -8
  146. package/dist/src/components/calendar/CalendarComposeSeed.d.ts +0 -7
  147. package/dist/src/components/calendar/CalendarComposeSeed.js +0 -19
  148. package/dist/src/components/calendar/CalendarEventPane.d.ts +0 -48
  149. package/dist/src/components/calendar/CalendarEventPane.js +0 -48
  150. package/dist/src/components/calendar/CalendarShell.d.ts +0 -43
  151. package/dist/src/components/calendar/CalendarShell.js +0 -35
  152. package/dist/src/components/calendar/CalendarViewPlaceholder.d.ts +0 -1
  153. package/dist/src/components/calendar/CalendarViewPlaceholder.js +0 -5
  154. package/dist/src/components/calendar/CalendarWorkspace.d.ts +0 -49
  155. package/dist/src/components/calendar/CalendarWorkspace.js +0 -65
  156. package/dist/src/components/calendar/OpenCalendarEvent.d.ts +0 -20
  157. package/dist/src/components/calendar/OpenCalendarEvent.js +0 -169
  158. package/dist/src/components/calendar/WriteCalendarEvent.d.ts +0 -13
  159. package/dist/src/components/calendar/WriteCalendarEvent.js +0 -59
@@ -1,9 +1,10 @@
1
- import { useNavigate, useParams, useRouter, useSearch, } from "@tanstack/react-router";
2
- import { useCallback, useMemo } from "react";
3
- import { canonicalCalendarParams, isoDate, stepCalendarDate, } from "../lib/calendar-route";
1
+ import { useBlocker, useNavigate, useParams, useRouter, useSearch, } from "@tanstack/react-router";
2
+ import { useCallback, useMemo, useRef } from "react";
3
+ import { canonicalCalendarParams, isoDate, } from "../lib/calendar-route";
4
4
  import { useRetainOpenPanels } from "./fragment";
5
5
  const VIEW_ROUTE = "/calendar/$view/$date";
6
6
  const SUGGESTION_ROUTE = "/calendar/$view/$date/suggestion/$suggestionId";
7
+ const TASK_ROUTE = "/calendar/$view/$date/task/$calendarTaskId";
7
8
  /**
8
9
  * The calendar the address names.
9
10
  *
@@ -36,12 +37,42 @@ export function useOpenCalendarEvent() {
36
37
  const recurrenceId = instance?.recurrenceId;
37
38
  return useMemo(() => (calendarObjectId ? { calendarObjectId, recurrenceId } : undefined), [calendarObjectId, recurrenceId]);
38
39
  }
40
+ /** The task the popup has open, if the address names one. */
41
+ export function useOpenCalendarTask() {
42
+ return useParams({ from: TASK_ROUTE, shouldThrow: false })?.calendarTaskId;
43
+ }
39
44
  /** Whether the composer is up, which is a route rather than a flag. */
40
45
  export function useChangingSuggestionId() {
41
46
  return useParams({ from: SUGGESTION_ROUTE, shouldThrow: false })
42
47
  ?.suggestionId;
43
48
  }
49
+ /** The stored event the sidebar is editing, if the address has one open. */
50
+ export function useEditingEvent() {
51
+ const series = useParams({
52
+ from: "/calendar/$view/$date/$calendarObjectId/edit",
53
+ shouldThrow: false,
54
+ });
55
+ const occurrence = useParams({
56
+ from: "/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit",
57
+ shouldThrow: false,
58
+ });
59
+ const calendarObjectId = series?.calendarObjectId ?? occurrence?.calendarObjectId;
60
+ const recurrenceId = occurrence?.recurrenceId;
61
+ return useMemo(() => (calendarObjectId ? { calendarObjectId, recurrenceId } : undefined), [calendarObjectId, recurrenceId]);
62
+ }
63
+ /** The range `/new` names in its query, unread until a sidebar reads it. */
64
+ export function useNewEventBounds() {
65
+ const search = useSearch({
66
+ from: "/calendar/$view/$date/new",
67
+ shouldThrow: false,
68
+ });
69
+ const start = search?.start;
70
+ const end = search?.end;
71
+ const open = search !== undefined;
72
+ return useMemo(() => (open ? { start, end } : undefined), [open, start, end]);
73
+ }
44
74
  export function useIsWritingEvent() {
75
+ const editing = useEditingEvent();
45
76
  const composer = useParams({
46
77
  from: "/calendar/$view/$date/new",
47
78
  shouldThrow: false,
@@ -50,7 +81,7 @@ export function useIsWritingEvent() {
50
81
  from: SUGGESTION_ROUTE,
51
82
  shouldThrow: false,
52
83
  });
53
- return composer !== undefined || changing !== undefined;
84
+ return (composer !== undefined || changing !== undefined || editing !== undefined);
54
85
  }
55
86
  /**
56
87
  * Every move the calendar makes, as an address.
@@ -65,6 +96,9 @@ export function useCalendarNavigation() {
65
96
  const router = useRouter();
66
97
  const retainPanels = useRetainOpenPanels();
67
98
  const { view, date } = useCalendarAddress();
99
+ const openedEvent = useOpenCalendarEvent();
100
+ const openedTask = useOpenCalendarTask();
101
+ const popupOpen = openedEvent !== undefined || openedTask !== undefined;
68
102
  const goTo = useCallback((params) => {
69
103
  navigate({
70
104
  to: VIEW_ROUTE,
@@ -81,15 +115,31 @@ export function useCalendarNavigation() {
81
115
  }).href, [router, retainPanels]);
82
116
  return useMemo(() => ({
83
117
  goToView: (next) => goTo({ view: next, date }),
84
- step: (direction) => goTo({ view, date: stepCalendarDate(date, view, direction) }),
85
118
  goToToday: () => goTo({ view, date: isoDate(new Date()) }),
86
- setAnchorDate: (next) => navigate({
119
+ goToDate: (next) => goTo({ view, date: next }),
120
+ setCalendarIds: (calendarIds) => navigate({
87
121
  to: VIEW_ROUTE,
88
- params: { view, date: next },
89
- search: true,
90
- hash: retainPanels,
122
+ params: { view, date },
123
+ search: (previous) => ({
124
+ ...previous,
125
+ calendarId: calendarIds.length === 0 ? undefined : [...calendarIds],
126
+ }),
127
+ hash: true,
91
128
  replace: true,
92
129
  }),
130
+ setAnchorDate: (next) => {
131
+ // An open popup is a child of the view; rewriting the day under
132
+ // it would close it, so the strip waits until it is gone.
133
+ if (popupOpen)
134
+ return;
135
+ navigate({
136
+ to: VIEW_ROUTE,
137
+ params: { view, date: next },
138
+ search: true,
139
+ hash: retainPanels,
140
+ replace: true,
141
+ });
142
+ },
93
143
  zoomToDay: (next) => navigate({ href: dayHref(next) }),
94
144
  dayHref,
95
145
  openEvent: (calendarObjectId, recurrenceId) => recurrenceId === undefined || recurrenceId === ""
@@ -98,27 +148,80 @@ export function useCalendarNavigation() {
98
148
  params: { view, date, calendarObjectId },
99
149
  search: true,
100
150
  hash: retainPanels,
151
+ replace: popupOpen,
152
+ state: { openedFromView: true },
101
153
  })
102
154
  : navigate({
103
155
  to: "/calendar/$view/$date/$calendarObjectId/$recurrenceId",
104
156
  params: { view, date, calendarObjectId, recurrenceId },
105
157
  search: true,
106
158
  hash: retainPanels,
159
+ replace: popupOpen,
160
+ state: { openedFromView: true },
107
161
  }),
108
- closeEvent: () => goTo({ view, date }),
109
- openComposer: () => navigate({
162
+ openTask: (calendarTaskId) => navigate({
163
+ to: TASK_ROUTE,
164
+ params: { view, date, calendarTaskId },
165
+ search: true,
166
+ hash: retainPanels,
167
+ replace: popupOpen,
168
+ state: { openedFromView: true },
169
+ }),
170
+ closeToView: () => {
171
+ if (router.state.location.state.openedFromView === true) {
172
+ router.history.back();
173
+ return;
174
+ }
175
+ navigate({
176
+ to: VIEW_ROUTE,
177
+ params: { view, date },
178
+ search: (previous) => ({
179
+ calendarId: previous.calendarId,
180
+ }),
181
+ hash: retainPanels,
182
+ replace: true,
183
+ });
184
+ },
185
+ openNewEvent: (bounds) => navigate({
110
186
  to: "/calendar/$view/$date/new",
111
187
  params: { view, date },
112
- search: true,
188
+ search: (previous) => ({ ...previous, ...bounds }),
113
189
  hash: retainPanels,
190
+ replace: popupOpen,
191
+ state: { openedFromView: true },
114
192
  }),
193
+ setNewEventBounds: (bounds) => navigate({
194
+ to: "/calendar/$view/$date/new",
195
+ params: { view, date },
196
+ search: (previous) => ({ ...previous, ...bounds }),
197
+ hash: true,
198
+ replace: true,
199
+ state: (previous) => previous,
200
+ }),
201
+ openEditor: (calendarObjectId, recurrenceId) => recurrenceId === undefined || recurrenceId === ""
202
+ ? navigate({
203
+ to: "/calendar/$view/$date/$calendarObjectId/edit",
204
+ params: { view, date, calendarObjectId },
205
+ search: true,
206
+ hash: retainPanels,
207
+ replace: popupOpen,
208
+ state: { openedFromView: true },
209
+ })
210
+ : navigate({
211
+ to: "/calendar/$view/$date/$calendarObjectId/$recurrenceId/edit",
212
+ params: { view, date, calendarObjectId, recurrenceId },
213
+ search: true,
214
+ hash: retainPanels,
215
+ replace: popupOpen,
216
+ state: { openedFromView: true },
217
+ }),
115
218
  changeSuggestionFirst: (suggestionId, on) => navigate({
116
219
  to: SUGGESTION_ROUTE,
117
220
  params: { view, date: on, suggestionId },
118
221
  search: true,
119
222
  hash: retainPanels,
120
223
  }),
121
- }), [goTo, navigate, dayHref, retainPanels, view, date]);
224
+ }), [goTo, navigate, dayHref, retainPanels, view, date, router, popupOpen]);
122
225
  }
123
226
  /**
124
227
  * Leave the mail for one event on the calendar, on the day it falls, so the
@@ -150,3 +253,22 @@ export function useChangeSuggestionOnCalendar() {
150
253
  });
151
254
  }, [navigate]);
152
255
  }
256
+ /**
257
+ * Back answered by a layer that holds no address of its own: the phone's
258
+ * quick-create sheet, or an editor that asks before a touched draft goes.
259
+ * Only Back is caught, and only while `onBack` says it answered it; a
260
+ * navigation the app starts is never blocked.
261
+ */
262
+ export function useBackCloses(active, onBack) {
263
+ const latest = useRef(onBack);
264
+ latest.current = onBack;
265
+ useBlocker({
266
+ shouldBlockFn: ({ action }) => {
267
+ if (action !== "BACK")
268
+ return false;
269
+ return latest.current();
270
+ },
271
+ enableBeforeUnload: false,
272
+ disabled: !active,
273
+ });
274
+ }
@@ -4,7 +4,7 @@
4
4
  * independent of in-memory data, so a cold load of the URL reproduces it
5
5
  * exactly.
6
6
  */
7
- export declare const panelFragments: readonly ["intelligence", "nav", "shortcuts"];
7
+ export declare const panelFragments: readonly ["intelligence", "sidebar", "nav", "shortcuts"];
8
8
  export type PanelFragment = (typeof panelFragments)[number];
9
9
  /**
10
10
  * The panels that cover the view rather than sit in it. The rail is a pane in
@@ -8,7 +8,12 @@ import { useIsDesktop } from "../hooks/useMediaQuery";
8
8
  * independent of in-memory data, so a cold load of the URL reproduces it
9
9
  * exactly.
10
10
  */
11
- export const panelFragments = ["intelligence", "nav", "shortcuts"];
11
+ export const panelFragments = [
12
+ "intelligence",
13
+ "sidebar",
14
+ "nav",
15
+ "shortcuts",
16
+ ];
12
17
  /**
13
18
  * The panels that cover the view rather than sit in it. The rail is a pane in
14
19
  * the shell's row and the other two are modal over it, so a sheet opening can
@@ -1,5 +1,6 @@
1
+ export { type AppSwitch, useAppSwitch } from "./app-switch";
1
2
  export { type BrowsedList, useBrowsedList, useOpensDetail, } from "./browsed-list";
2
- export { type CalendarAddress, type CalendarNavigation, type OpenCalendarEvent, useCalendarAddress, useCalendarNavigation, useChangeSuggestionOnCalendar, useChangingSuggestionId, useIsWritingEvent, useOpenCalendarEvent, useOpenEventOnCalendar, } from "./calendar";
3
+ export { type CalendarAddress, type CalendarNavigation, type OpenCalendarEvent, useBackCloses, useCalendarAddress, useCalendarNavigation, useChangeSuggestionOnCalendar, useChangingSuggestionId, useEditingEvent, useIsWritingEvent, useNewEventBounds, useOpenCalendarEvent, useOpenCalendarTask, useOpenEventOnCalendar, } from "./calendar";
3
4
  export { useAdoptComposeDraft, useCloseCompose, useComposeDraftId, useEditDraft, useIsComposing, useOpenCompose, } from "./compose";
4
5
  export { formatOpenPanels, isOverlayPanel, type OverlayPanel, overlayPanels, type PanelFragment, panelFragments, panelsWithOverlay, parseOpenPanels, retainOpenPanelsAtTier, useOpenPanels, useRetainOpenPanels, useSetOpenPanels, } from "./fragment";
5
6
  export { NavLink, type NavLinkProps } from "./nav-link";
@@ -1,5 +1,6 @@
1
+ export { useAppSwitch } from "./app-switch";
1
2
  export { useBrowsedList, useOpensDetail, } from "./browsed-list";
2
- export { useCalendarAddress, useCalendarNavigation, useChangeSuggestionOnCalendar, useChangingSuggestionId, useIsWritingEvent, useOpenCalendarEvent, useOpenEventOnCalendar, } from "./calendar";
3
+ export { useBackCloses, useCalendarAddress, useCalendarNavigation, useChangeSuggestionOnCalendar, useChangingSuggestionId, useEditingEvent, useIsWritingEvent, useNewEventBounds, useOpenCalendarEvent, useOpenCalendarTask, useOpenEventOnCalendar, } from "./calendar";
3
4
  export { useAdoptComposeDraft, useCloseCompose, useComposeDraftId, useEditDraft, useIsComposing, useOpenCompose, } from "./compose";
4
5
  export { formatOpenPanels, isOverlayPanel, overlayPanels, panelFragments, panelsWithOverlay, parseOpenPanels, retainOpenPanelsAtTier, useOpenPanels, useRetainOpenPanels, useSetOpenPanels, } from "./fragment";
5
6
  export { NavLink } from "./nav-link";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/web-client",
3
- "version": "0.0.328",
3
+ "version": "0.0.330",
4
4
  "type": "module",
5
5
  "description": "Remit web client, published as composable primitives — the app shell, auth shells, and runtime config. A distributor imports what it composes and bundles it.",
6
6
  "exports": {
@@ -91,7 +91,7 @@
91
91
  },
92
92
  "dependencies": {
93
93
  "@hookform/resolvers": "5.4.0",
94
- "@remit/ui": "0.0.224",
94
+ "@remit/ui": "0.0.226",
95
95
  "@tanstack/react-query": "5.101.2",
96
96
  "@tanstack/react-query-devtools": "5.101.2",
97
97
  "@tanstack/react-router": "1.170.18",
@@ -1,49 +0,0 @@
1
- import { type CalendarClash, type CalendarDescriptor, type EventDraft } from "@remit/ui";
2
- /**
3
- * Writing an event, and editing one.
4
- *
5
- * Presentational, like the pane it sits beside: it holds no draft of its own
6
- * and saves nothing. The route owns the draft and the write, so this renders
7
- * the same form whichever of the two the address named.
8
- *
9
- * Guests are left out because the calendar store has nowhere to put them yet,
10
- * which is the kit's default. A field that takes names and drops them is worse
11
- * than no field: the reader only finds out afterwards, from an event with
12
- * nobody on it.
13
- */
14
- export interface CalendarComposePaneProps {
15
- /** What the pane is doing: "New event", "Edit event". */
16
- title: string;
17
- /** The one line of context the title cannot carry — which day, which series. */
18
- subtitle?: string;
19
- notice?: string;
20
- calendars: CalendarDescriptor[];
21
- draft: EventDraft;
22
- onChange: (draft: EventDraft) => void;
23
- /**
24
- * Why the last save did not happen, in the words the reader needs: what was
25
- * refused and what to do about it. Empty when nothing has been refused.
26
- */
27
- problem: string;
28
- saveLabel: string;
29
- isSaving: boolean;
30
- /**
31
- * The rule belongs to the series rather than to one morning of it, so an
32
- * edit scoped to a single occurrence reads it back instead of offering it.
33
- */
34
- repeatEditable?: boolean;
35
- /**
36
- * Whether the event can still be sent to a different calendar. Writing one
37
- * chooses; editing one cannot, because the collection a resource lives in is
38
- * part of its address and the patch has no field for it.
39
- */
40
- calendarEditable?: boolean;
41
- /**
42
- * What the span on the form runs into. Undefined while there is nothing to
43
- * check or the answer has not landed, which draws no strip at all.
44
- */
45
- clashes?: CalendarClash[];
46
- onSave: () => void;
47
- onCancel: () => void;
48
- }
49
- export declare function CalendarComposePane({ title, subtitle, notice, calendars, draft, onChange, problem, saveLabel, isSaving, repeatEditable, calendarEditable, clashes, onSave, onCancel, }: CalendarComposePaneProps): import("react").JSX.Element;
@@ -1,8 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CalendarClashStrip, EventEditor, EventEditorPane, } from "@remit/ui";
3
- import { AlertCircle, AlertTriangle } from "lucide-react";
4
- export function CalendarComposePane({ title, subtitle, notice = "", calendars, draft, onChange, problem, saveLabel, isSaving, repeatEditable = true, calendarEditable = true, clashes, onSave, onCancel, }) {
5
- return (_jsx(EventEditorPane, { title: title, subtitle: subtitle, onClose: onCancel, children: _jsx(EventEditor, { draft: draft, onChange: onChange, calendars: calendars, layout: "pane", repeatEditable: repeatEditable, calendarEditable: calendarEditable, saveLabel: isSaving ? "Saving…" : saveLabel, onSave: onSave, onCancel: onCancel, header: problem === "" &&
6
- notice === "" &&
7
- clashes === undefined ? undefined : (_jsxs("div", { className: "space-y-2", children: [notice !== "" && (_jsxs("p", { className: "flex items-start gap-2 rounded-md border border-warning/40 bg-warning-soft px-3 py-2 text-sm text-fg", children: [_jsx(AlertTriangle, { className: "mt-0.5 size-4 shrink-0 text-warning", "aria-hidden": "true" }), _jsx("span", { className: "min-w-0 flex-1 break-words", children: notice })] })), problem !== "" && (_jsxs("div", { role: "alert", className: "flex items-start gap-2 rounded-md border border-danger/40 bg-danger-soft px-3 py-2 text-sm", children: [_jsx(AlertCircle, { className: "mt-0.5 size-4 shrink-0 text-danger", "aria-hidden": "true" }), _jsx("p", { className: "min-w-0 flex-1 break-words text-fg", children: problem })] })), clashes !== undefined && (_jsx(CalendarClashStrip, { clashes: clashes, clearText: "Nothing else is booked at this time." }))] })) }) }));
8
- }
@@ -1,7 +0,0 @@
1
- import type { CalendarSlotPick } from "@remit/ui";
2
- import { type ReactNode } from "react";
3
- export declare const CalendarComposeSeedProvider: ({ pick, children, }: {
4
- pick: CalendarSlotPick | undefined;
5
- children?: ReactNode;
6
- }) => import("react").JSX.Element;
7
- export declare const useCalendarComposeSeed: () => CalendarSlotPick | undefined;
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext } from "react";
3
- /**
4
- * The slot a reader dragged out of the grid, handed to the composer the click
5
- * opened.
6
- *
7
- * It is not in the address on purpose. What a half-written event says is not a
8
- * fact about where the reader is, and a link to a composer pre-filled with
9
- * somebody else's Tuesday afternoon is not an address worth being able to send.
10
- * The composer opened without one starts on the day the calendar is showing.
11
- *
12
- * It lives outside the route files for the same reason
13
- * `CalendarShell`'s context does: the generated route tree imports route files
14
- * relatively, so a context declared inside one resolves to a second module
15
- * instance and hands the consumer an empty default.
16
- */
17
- const CalendarComposeSeedCtx = createContext(undefined);
18
- export const CalendarComposeSeedProvider = ({ pick, children, }) => (_jsx(CalendarComposeSeedCtx.Provider, { value: pick, children: children }));
19
- export const useCalendarComposeSeed = () => useContext(CalendarComposeSeedCtx);
@@ -1,48 +0,0 @@
1
- import type { CalendarDescriptor, CalendarEventData } from "@remit/ui";
2
- import type { ReactNode } from "react";
3
- export type CalendarEventAbsence = {
4
- kind: "NotInView";
5
- } | {
6
- kind: "Finding";
7
- } | {
8
- kind: "Deleted";
9
- } | {
10
- kind: "NoOccurrenceFound";
11
- } | {
12
- kind: "SignedOut";
13
- signIn: ReactNode;
14
- } | {
15
- kind: "Failed";
16
- reason: string;
17
- reportHref: string;
18
- };
19
- /**
20
- * The event the address has open.
21
- *
22
- * Presentational, like the workspace beside it: the route resolves the event
23
- * and turns closing, editing and deleting into things it does, so this renders
24
- * what it is handed and nothing else. Each control appears only when the route
25
- * gave it somewhere to go — a control that leads nowhere is worse than none.
26
- */
27
- export interface CalendarEventPaneProps {
28
- /** Absent when the address names an event the calendar does not have. */
29
- event: CalendarEventData | undefined;
30
- calendar: CalendarDescriptor | undefined;
31
- /** Whether the address names one occurrence rather than the series. */
32
- isOccurrence: boolean;
33
- absence?: CalendarEventAbsence;
34
- /**
35
- * A write that did not happen, stated where the reader is looking. Empty
36
- * when the last one did.
37
- */
38
- problem?: string;
39
- /**
40
- * Why this event cannot be changed here, stated where Edit and Delete would
41
- * be. Empty for an event the reader can change.
42
- */
43
- readOnlyNote?: string;
44
- onEdit?: () => void;
45
- onDelete?: () => void;
46
- onClose: () => void;
47
- }
48
- export declare function CalendarEventPane({ event, calendar, isOccurrence, absence, problem, readOnlyNote, onEdit, onDelete, onClose, }: CalendarEventPaneProps): import("react").JSX.Element;
@@ -1,48 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { EventDetail } from "@remit/ui";
3
- import { AlertCircle, CalendarDays, Lock } from "lucide-react";
4
- import { formatEventWhen } from "../../lib/calendar-format";
5
- const NOT_IN_VIEW = { kind: "NotInView" };
6
- const LINK = "rounded-md border border-line px-2.5 py-1 text-sm font-medium text-fg outline-none hover:bg-surface-sunken focus-visible:ring-2 focus-visible:ring-ring";
7
- function absenceText(absence) {
8
- switch (absence.kind) {
9
- case "Finding":
10
- return {
11
- title: "Finding the event",
12
- detail: "Looking for the day it falls on.",
13
- };
14
- case "Deleted":
15
- return {
16
- title: "This event was deleted",
17
- detail: "None of your calendars holds it any more.",
18
- };
19
- case "NoOccurrenceFound":
20
- return {
21
- title: "No occurrence in its first year or the coming year",
22
- detail: "Its repeat rule, or the days taken out of it, leave it no day in either.",
23
- };
24
- case "SignedOut":
25
- return {
26
- title: "Your session has ended",
27
- detail: "Sign in again to open this event.",
28
- };
29
- case "Failed":
30
- return {
31
- title: "The event couldn't be looked up",
32
- detail: absence.reason,
33
- };
34
- case "NotInView":
35
- return {
36
- title: "That event isn't on this week",
37
- detail: "The address names an event the calendar doesn't have here.",
38
- };
39
- }
40
- }
41
- export function CalendarEventPane({ event, calendar, isOccurrence, absence = NOT_IN_VIEW, problem = "", readOnlyNote = "", onEdit, onDelete, onClose, }) {
42
- if (!event || !calendar) {
43
- const { title, detail } = absenceText(absence);
44
- const loud = absence.kind === "Failed" || absence.kind === "SignedOut";
45
- return (_jsxs("div", { role: loud ? "alert" : undefined, className: "flex h-full flex-col items-center justify-center gap-2 bg-surface p-8 text-center", children: [_jsx(CalendarDays, { className: "size-8 text-fg-subtle", "aria-hidden": "true" }), _jsx("p", { className: "text-sm font-medium text-fg", children: title }), _jsx("p", { className: "max-w-xs break-words text-sm text-fg-muted", children: detail }), _jsxs("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [absence.kind === "SignedOut" && absence.signIn, absence.kind === "Failed" && (_jsx("a", { href: absence.reportHref, target: "_blank", rel: "noreferrer", className: LINK, children: "Report an issue" })), _jsx("button", { type: "button", onClick: onClose, className: LINK, children: "Back to the calendar" })] })] }));
46
- }
47
- return (_jsxs("div", { className: "flex h-full min-h-0 flex-col bg-surface", children: [isOccurrence && (_jsx("p", { className: "shrink-0 border-b border-line bg-surface-sunken px-row-inset py-1.5 text-2xs uppercase tracking-wider text-fg-subtle", children: "One occurrence of a repeating event" })), readOnlyNote !== "" && (_jsxs("p", { className: "flex shrink-0 items-start gap-2 border-b border-line bg-surface-sunken px-row-inset py-2 text-sm text-fg-muted", children: [_jsx(Lock, { className: "mt-0.5 size-4 shrink-0", "aria-hidden": "true" }), _jsx("span", { className: "min-w-0 flex-1 break-words", children: readOnlyNote })] })), problem !== "" && (_jsxs("div", { role: "alert", className: "flex shrink-0 items-start gap-2 border-b border-danger/40 bg-danger-soft px-row-inset py-2 text-sm", children: [_jsx(AlertCircle, { className: "mt-0.5 size-4 shrink-0 text-danger", "aria-hidden": "true" }), _jsx("p", { className: "min-w-0 flex-1 break-words text-fg", children: problem })] })), _jsx(EventDetail, { event: event, calendar: calendar, whenText: formatEventWhen(event), onEdit: onEdit, onDelete: onDelete, onClose: onClose, className: "min-h-0 flex-1" })] }));
48
- }
@@ -1,43 +0,0 @@
1
- import { type ReactNode } from "react";
2
- /**
3
- * The chrome the calendar shares with mail, published by the `/calendar` layout
4
- * and consumed by the view route that mounts the shell.
5
- *
6
- * It lives outside the route files for the same reason
7
- * `lib/mail-context.ts` does: the generated route tree imports route files
8
- * relatively, so a context declared inside one would resolve to a second module
9
- * instance and hand the consumer an empty default.
10
- */
11
- export interface CalendarShellChrome {
12
- /** Below the reading boundary the shell shows one pane, as mail's does. */
13
- isSinglePane: boolean;
14
- isLoading: boolean;
15
- nav: ReactNode;
16
- navOpen: boolean;
17
- onOpenNav: () => void;
18
- onCloseNav: () => void;
19
- }
20
- export declare const CalendarShellProvider: ({ chrome, children, }: {
21
- chrome: CalendarShellChrome;
22
- children: ReactNode;
23
- }) => import("react").JSX.Element;
24
- export interface CalendarShellProps {
25
- /** The grid, or whatever the current zoom draws. */
26
- workspace: ReactNode;
27
- /** The open event, from the route below this one. */
28
- reading: ReactNode;
29
- /** Whether the address has an event or the composer open. */
30
- hasOpenEvent: boolean;
31
- }
32
- /**
33
- * The shell the calendar mounts around its own panes.
34
- *
35
- * `listBias="list"` because the grid is the work rather than an index into it:
36
- * a week of columns costs width it cannot give back when a detail opens, which
37
- * is the opposite of the split a message list wants.
38
- *
39
- * Below the reading boundary there is one pane, so the open event replaces the
40
- * grid in it — the same swap mail makes, read off the address rather than
41
- * decided here.
42
- */
43
- export declare function CalendarShell({ workspace, reading, hasOpenEvent, }: CalendarShellProps): import("react").JSX.Element;
@@ -1,35 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { AppShellSlotted } from "@remit/ui";
3
- import { createContext, useContext } from "react";
4
- import { AppShellSkeleton } from "../layout/AppShellSkeleton";
5
- const CalendarShellCtx = createContext(null);
6
- export const CalendarShellProvider = ({ chrome, children, }) => (_jsx(CalendarShellCtx.Provider, { value: chrome, children: children }));
7
- /**
8
- * The shell the calendar mounts around its own panes.
9
- *
10
- * `listBias="list"` because the grid is the work rather than an index into it:
11
- * a week of columns costs width it cannot give back when a detail opens, which
12
- * is the opposite of the split a message list wants.
13
- *
14
- * Below the reading boundary there is one pane, so the open event replaces the
15
- * grid in it — the same swap mail makes, read off the address rather than
16
- * decided here.
17
- */
18
- export function CalendarShell({ workspace, reading, hasOpenEvent, }) {
19
- const chrome = useContext(CalendarShellCtx);
20
- if (!chrome)
21
- return _jsx(AppShellSkeleton, {});
22
- const shared = {
23
- nav: chrome.nav,
24
- skeleton: _jsx(AppShellSkeleton, {}),
25
- isLoading: chrome.isLoading,
26
- navOpen: chrome.navOpen,
27
- onOpenNav: chrome.onOpenNav,
28
- onCloseNav: chrome.onCloseNav,
29
- listBias: "list",
30
- };
31
- if (chrome.isSinglePane) {
32
- return (_jsx(AppShellSlotted, { ...shared, list: hasOpenEvent ? reading : workspace }));
33
- }
34
- return _jsx(AppShellSlotted, { ...shared, list: workspace, reading: reading });
35
- }
@@ -1 +0,0 @@
1
- export declare function CalendarViewPlaceholder(): import("react").JSX.Element;
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { CalendarRange } from "lucide-react";
3
- export function CalendarViewPlaceholder() {
4
- return (_jsxs("div", { className: "flex h-full flex-col items-center justify-center gap-2 bg-surface p-8 text-center", "data-testid": "calendar-placeholder-year", children: [_jsx(CalendarRange, { className: "size-8 text-fg-subtle", "aria-hidden": "true" }), _jsx("p", { className: "text-sm font-medium text-fg", children: "Not built yet" }), _jsx("p", { className: "max-w-xs text-sm text-fg-muted", children: "The year grid arrives with the rest of the zoom ladder. Month, Week, Day and Agenda work now." })] }));
5
- }
@@ -1,49 +0,0 @@
1
- import { type CalendarColorId, type CalendarEventData, type CalendarSlotPick, type CalendarViewId, type Density } from "@remit/ui";
2
- import { type ReactNode } from "react";
3
- export interface CalendarWorkspaceProps {
4
- view: CalendarViewId;
5
- /** The day the view is centred on, `YYYY-MM-DD`. */
6
- date: string;
7
- events: CalendarEventData[];
8
- colorByCalendarId: Record<string, CalendarColorId>;
9
- /**
10
- * The strip, at the one zoom that draws it. A slot rather than something
11
- * built here because it loads its own days over a rolling range, and this
12
- * pane holds no events and knows no router.
13
- */
14
- agenda: ReactNode;
15
- /**
16
- * What the mail is still asking about time, beside whichever zoom is drawn.
17
- * A slot for the reason the strip is one: it reads its own data.
18
- */
19
- waiting?: ReactNode;
20
- /** The first read of this window is still out; the grid has nothing yet. */
21
- isLoading?: boolean;
22
- /**
23
- * A refusal the calendar states in place of the grid. A week drawn empty
24
- * because the read failed is indistinguishable from a week with nothing in
25
- * it, which is the one thing this must never look like.
26
- */
27
- error?: unknown;
28
- onRetry?: () => void;
29
- density: Density;
30
- /** The event the reading pane has open, empty for none. */
31
- selectedEventId: string;
32
- timeZone: string;
33
- /** The instant the grid calls now. */
34
- now: string;
35
- onChangeView: (view: CalendarViewId) => void;
36
- onToday: () => void;
37
- onChangeDensity: (density: Density) => void;
38
- onSelectEvent: (eventId: string) => void;
39
- onPickSlot: (pick: CalendarSlotPick) => void;
40
- onStep: (direction: -1 | 1) => void;
41
- dayHref: (date: string) => string;
42
- onZoomDay: (date: string) => void;
43
- /**
44
- * A phone: the toolbar splits into two rows of thumb-sized controls, because
45
- * one row of them is wider than the screen and pushes the grid off it.
46
- */
47
- touch?: boolean;
48
- }
49
- export declare function CalendarWorkspace({ view, date, events, colorByCalendarId, agenda, waiting, isLoading, error, onRetry, density, selectedEventId, timeZone, now, onChangeView, onToday, onChangeDensity, onSelectEvent, onPickSlot, onStep, dayHref, onZoomDay, touch, }: CalendarWorkspaceProps): import("react").JSX.Element;