@burdenoff/microfe-calendar 2026.1123.3 → 2026.1124.2

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 (251) hide show
  1. package/dist/components/AgendaView.js.map +1 -1
  2. package/dist/generated/wspace-operations.d.ts +785 -0
  3. package/dist/generated/wspace-operations.js +250 -84
  4. package/dist/generated/wspace-operations.js.map +1 -1
  5. package/dist/generated/wspace-types.d.ts +1243 -10
  6. package/dist/hooks/useSafePermissions.js.map +1 -1
  7. package/dist/index.d.ts +1 -0
  8. package/dist/providers/CalendarProvider.d.ts +3 -1
  9. package/dist/providers/CalendarProvider.js +12 -10
  10. package/dist/providers/CalendarProvider.js.map +1 -1
  11. package/dist/translations/en.d.ts +351 -0
  12. package/dist/types/index.d.ts +9 -0
  13. package/dist/v2/CalendarPageV2.js +92 -14
  14. package/dist/v2/CalendarPageV2.js.map +1 -1
  15. package/dist/v2/colors.d.ts +23 -0
  16. package/dist/v2/colors.js +92 -0
  17. package/dist/v2/colors.js.map +1 -0
  18. package/dist/v2/data/enums.d.ts +6 -0
  19. package/dist/v2/data/enums.js +10 -0
  20. package/dist/v2/data/enums.js.map +1 -0
  21. package/dist/v2/data/errors.d.ts +4 -0
  22. package/dist/v2/data/errors.js +17 -0
  23. package/dist/v2/data/errors.js.map +1 -0
  24. package/dist/v2/data/invalidation.js +19 -0
  25. package/dist/v2/data/invalidation.js.map +1 -0
  26. package/dist/v2/data/normalize.js +181 -16
  27. package/dist/v2/data/normalize.js.map +1 -1
  28. package/dist/v2/data/serialWrites.d.ts +17 -0
  29. package/dist/v2/data/serialWrites.js +21 -0
  30. package/dist/v2/data/serialWrites.js.map +1 -0
  31. package/dist/v2/data/useCalendarsV2.d.ts +10 -1
  32. package/dist/v2/data/useCalendarsV2.js +68 -16
  33. package/dist/v2/data/useCalendarsV2.js.map +1 -1
  34. package/dist/v2/data/useEventActions.d.ts +49 -0
  35. package/dist/v2/data/useEventActions.js +399 -0
  36. package/dist/v2/data/useEventActions.js.map +1 -0
  37. package/dist/v2/data/useEventForPeek.d.ts +17 -0
  38. package/dist/v2/data/useEventForPeek.js +29 -0
  39. package/dist/v2/data/useEventForPeek.js.map +1 -0
  40. package/dist/v2/data/useEventSearchV2.d.ts +15 -0
  41. package/dist/v2/data/useEventSearchV2.js +80 -0
  42. package/dist/v2/data/useEventSearchV2.js.map +1 -0
  43. package/dist/v2/data/useEventsInRangeV2.js +78 -0
  44. package/dist/v2/data/useEventsInRangeV2.js.map +1 -0
  45. package/dist/v2/data/useFreeBusy.d.ts +5 -0
  46. package/dist/v2/data/useFreeBusy.js +83 -0
  47. package/dist/v2/data/useFreeBusy.js.map +1 -0
  48. package/dist/v2/data/useKeyedLoad.js +47 -0
  49. package/dist/v2/data/useKeyedLoad.js.map +1 -0
  50. package/dist/v2/data/useRoomsV2.d.ts +28 -0
  51. package/dist/v2/data/useRoomsV2.js +45 -0
  52. package/dist/v2/data/useRoomsV2.js.map +1 -0
  53. package/dist/v2/day/DayPanel.d.ts +6 -0
  54. package/dist/v2/day/DayPanel.js +215 -0
  55. package/dist/v2/day/DayPanel.js.map +1 -0
  56. package/dist/v2/day/daySummary.d.ts +37 -0
  57. package/dist/v2/day/daySummary.js +37 -0
  58. package/dist/v2/day/daySummary.js.map +1 -0
  59. package/dist/v2/dialogs/CalendarDialogsV2.d.ts +1 -0
  60. package/dist/v2/dialogs/CalendarDialogsV2.js +17 -0
  61. package/dist/v2/dialogs/CalendarDialogsV2.js.map +1 -0
  62. package/dist/v2/dialogs/ShortcutsDialog.d.ts +4 -0
  63. package/dist/v2/dialogs/ShortcutsDialog.js +42 -0
  64. package/dist/v2/dialogs/ShortcutsDialog.js.map +1 -0
  65. package/dist/v2/events/eventLook.d.ts +46 -0
  66. package/dist/v2/events/eventLook.js +35 -0
  67. package/dist/v2/events/eventLook.js.map +1 -0
  68. package/dist/v2/events/eventModel.d.ts +92 -0
  69. package/dist/v2/events/eventModel.js +116 -0
  70. package/dist/v2/events/eventModel.js.map +1 -0
  71. package/dist/v2/events/localChanges.d.ts +4 -0
  72. package/dist/v2/events/localChanges.js +23 -0
  73. package/dist/v2/events/localChanges.js.map +1 -0
  74. package/dist/v2/format.d.ts +67 -0
  75. package/dist/v2/format.js +112 -0
  76. package/dist/v2/format.js.map +1 -0
  77. package/dist/v2/grid/AllDayRow.d.ts +20 -0
  78. package/dist/v2/grid/AllDayRow.js +94 -0
  79. package/dist/v2/grid/AllDayRow.js.map +1 -0
  80. package/dist/v2/grid/EventBlock.d.ts +21 -0
  81. package/dist/v2/grid/EventBlock.js +112 -0
  82. package/dist/v2/grid/EventBlock.js.map +1 -0
  83. package/dist/v2/grid/GridParts.d.ts +40 -0
  84. package/dist/v2/grid/GridParts.js +210 -0
  85. package/dist/v2/grid/GridParts.js.map +1 -0
  86. package/dist/v2/grid/QuickCreate.d.ts +1 -0
  87. package/dist/v2/grid/QuickCreate.js +175 -0
  88. package/dist/v2/grid/QuickCreate.js.map +1 -0
  89. package/dist/v2/grid/TimeGrid.d.ts +1 -0
  90. package/dist/v2/grid/TimeGrid.js +188 -0
  91. package/dist/v2/grid/TimeGrid.js.map +1 -0
  92. package/dist/v2/grid/geometry.d.ts +72 -0
  93. package/dist/v2/grid/geometry.js +85 -0
  94. package/dist/v2/grid/geometry.js.map +1 -0
  95. package/dist/v2/grid/layout.d.ts +24 -0
  96. package/dist/v2/grid/layout.js +77 -0
  97. package/dist/v2/grid/layout.js.map +1 -0
  98. package/dist/v2/grid/useGridDrag.d.ts +42 -0
  99. package/dist/v2/grid/useGridDrag.js +181 -0
  100. package/dist/v2/grid/useGridDrag.js.map +1 -0
  101. package/dist/v2/grid/useSlotCursor.d.ts +32 -0
  102. package/dist/v2/grid/useSlotCursor.js +57 -0
  103. package/dist/v2/grid/useSlotCursor.js.map +1 -0
  104. package/dist/v2/grid/workingHours.d.ts +21 -0
  105. package/dist/v2/grid/workingHours.js +101 -0
  106. package/dist/v2/grid/workingHours.js.map +1 -0
  107. package/dist/v2/hooks/useAvailableHeight.d.ts +2 -0
  108. package/dist/v2/hooks/useAvailableHeight.js +25 -0
  109. package/dist/v2/hooks/useAvailableHeight.js.map +1 -0
  110. package/dist/v2/hooks/useCalendarShortcuts.d.ts +9 -0
  111. package/dist/v2/hooks/useCalendarShortcuts.js +60 -0
  112. package/dist/v2/hooks/useCalendarShortcuts.js.map +1 -0
  113. package/dist/v2/hooks/useDebouncedValue.d.ts +1 -0
  114. package/dist/v2/hooks/useDebouncedValue.js +12 -0
  115. package/dist/v2/hooks/useDebouncedValue.js.map +1 -0
  116. package/dist/v2/hooks/useMediaQuery.d.ts +5 -0
  117. package/dist/v2/hooks/useMediaQuery.js +17 -0
  118. package/dist/v2/hooks/useMediaQuery.js.map +1 -0
  119. package/dist/v2/hooks/useNow.d.ts +2 -0
  120. package/dist/v2/hooks/useNow.js +31 -0
  121. package/dist/v2/hooks/useNow.js.map +1 -0
  122. package/dist/v2/limits.d.ts +6 -0
  123. package/dist/v2/limits.js +5 -0
  124. package/dist/v2/limits.js.map +1 -0
  125. package/dist/v2/list/EventListRow.d.ts +10 -0
  126. package/dist/v2/list/EventListRow.js +109 -0
  127. package/dist/v2/list/EventListRow.js.map +1 -0
  128. package/dist/v2/list/ListViewV2.d.ts +16 -0
  129. package/dist/v2/list/ListViewV2.js +96 -0
  130. package/dist/v2/list/ListViewV2.js.map +1 -0
  131. package/dist/v2/month/MonthView.d.ts +1 -0
  132. package/dist/v2/month/MonthView.js +328 -0
  133. package/dist/v2/month/MonthView.js.map +1 -0
  134. package/dist/v2/month/monthLayout.d.ts +39 -0
  135. package/dist/v2/month/monthLayout.js +29 -0
  136. package/dist/v2/month/monthLayout.js.map +1 -0
  137. package/dist/v2/page/CalendarChrome.d.ts +2 -0
  138. package/dist/v2/page/CalendarChrome.js +295 -0
  139. package/dist/v2/page/CalendarChrome.js.map +1 -0
  140. package/dist/v2/page/CalendarPageContext.d.ts +92 -0
  141. package/dist/v2/page/CalendarPageContext.js +11 -0
  142. package/dist/v2/page/CalendarPageContext.js.map +1 -0
  143. package/dist/v2/page/pageHelpers.d.ts +19 -0
  144. package/dist/v2/page/pageHelpers.js +39 -0
  145. package/dist/v2/page/pageHelpers.js.map +1 -0
  146. package/dist/v2/page/useCalendarPageModel.d.ts +2 -0
  147. package/dist/v2/page/useCalendarPageModel.js +198 -0
  148. package/dist/v2/page/useCalendarPageModel.js.map +1 -0
  149. package/dist/v2/page/viewState.d.ts +70 -0
  150. package/dist/v2/page/viewState.js +47 -0
  151. package/dist/v2/page/viewState.js.map +1 -0
  152. package/dist/v2/peek/EventPeek.d.ts +2 -0
  153. package/dist/v2/peek/EventPeek.js +92 -0
  154. package/dist/v2/peek/EventPeek.js.map +1 -0
  155. package/dist/v2/peek/PeekEvent.d.ts +4 -0
  156. package/dist/v2/peek/PeekEvent.js +443 -0
  157. package/dist/v2/peek/PeekEvent.js.map +1 -0
  158. package/dist/v2/peek/PeekParts.d.ts +14 -0
  159. package/dist/v2/peek/PeekParts.js +75 -0
  160. package/dist/v2/peek/PeekParts.js.map +1 -0
  161. package/dist/v2/prefs/calendarPrefs.d.ts +2 -2
  162. package/dist/v2/prefs/calendarPrefs.js +35 -34
  163. package/dist/v2/prefs/calendarPrefs.js.map +1 -1
  164. package/dist/v2/rail/CalendarRail.d.ts +3 -0
  165. package/dist/v2/rail/CalendarRail.js +258 -0
  166. package/dist/v2/rail/CalendarRail.js.map +1 -0
  167. package/dist/v2/rail/railStatus.d.ts +54 -0
  168. package/dist/v2/rail/railStatus.js +84 -0
  169. package/dist/v2/rail/railStatus.js.map +1 -0
  170. package/dist/v2/rail/syncWords.d.ts +10 -0
  171. package/dist/v2/rail/syncWords.js +75 -0
  172. package/dist/v2/rail/syncWords.js.map +1 -0
  173. package/dist/v2/rail/useMonthEventDates.d.ts +4 -0
  174. package/dist/v2/rail/useMonthEventDates.js +30 -0
  175. package/dist/v2/rail/useMonthEventDates.js.map +1 -0
  176. package/dist/v2/routes.js +4 -1
  177. package/dist/v2/routes.js.map +1 -1
  178. package/dist/v2/runs/RunPeek.d.ts +2 -0
  179. package/dist/v2/runs/RunPeek.js +382 -0
  180. package/dist/v2/runs/RunPeek.js.map +1 -0
  181. package/dist/v2/runs/RunPills.d.ts +28 -0
  182. package/dist/v2/runs/RunPills.js +179 -0
  183. package/dist/v2/runs/RunPills.js.map +1 -0
  184. package/dist/v2/runs/RunRows.d.ts +21 -0
  185. package/dist/v2/runs/RunRows.js +140 -0
  186. package/dist/v2/runs/RunRows.js.map +1 -0
  187. package/dist/v2/runs/RunsNotices.d.ts +1 -0
  188. package/dist/v2/runs/RunsNotices.js +37 -0
  189. package/dist/v2/runs/RunsNotices.js.map +1 -0
  190. package/dist/v2/runs/RunsSwitch.d.ts +1 -0
  191. package/dist/v2/runs/RunsSwitch.js +54 -0
  192. package/dist/v2/runs/RunsSwitch.js.map +1 -0
  193. package/dist/v2/runs/WorkflowRunsLayer.d.ts +4 -0
  194. package/dist/v2/runs/WorkflowRunsLayer.js +82 -0
  195. package/dist/v2/runs/WorkflowRunsLayer.js.map +1 -0
  196. package/dist/v2/runs/runAccess.d.ts +37 -0
  197. package/dist/v2/runs/runAccess.js +14 -0
  198. package/dist/v2/runs/runAccess.js.map +1 -0
  199. package/dist/v2/runs/runLayout.d.ts +76 -0
  200. package/dist/v2/runs/runLayout.js +129 -0
  201. package/dist/v2/runs/runLayout.js.map +1 -0
  202. package/dist/v2/runs/runLinks.d.ts +32 -0
  203. package/dist/v2/runs/runLinks.js +50 -0
  204. package/dist/v2/runs/runLinks.js.map +1 -0
  205. package/dist/v2/runs/runModel.d.ts +97 -0
  206. package/dist/v2/runs/runModel.js +132 -0
  207. package/dist/v2/runs/runModel.js.map +1 -0
  208. package/dist/v2/runs/runPeekState.d.ts +53 -0
  209. package/dist/v2/runs/runPeekState.js +62 -0
  210. package/dist/v2/runs/runPeekState.js.map +1 -0
  211. package/dist/v2/runs/runTypes.d.ts +60 -0
  212. package/dist/v2/runs/runWords.d.ts +23 -0
  213. package/dist/v2/runs/runWords.js +83 -0
  214. package/dist/v2/runs/runWords.js.map +1 -0
  215. package/dist/v2/runs/runsLayerContext.d.ts +26 -0
  216. package/dist/v2/runs/runsLayerContext.js +33 -0
  217. package/dist/v2/runs/runsLayerContext.js.map +1 -0
  218. package/dist/v2/runs/useRunHrefs.d.ts +10 -0
  219. package/dist/v2/runs/useRunHrefs.js +60 -0
  220. package/dist/v2/runs/useRunHrefs.js.map +1 -0
  221. package/dist/v2/runs/useRunLabels.d.ts +6 -0
  222. package/dist/v2/runs/useRunLabels.js +27 -0
  223. package/dist/v2/runs/useRunLabels.js.map +1 -0
  224. package/dist/v2/runs/useRunsAccess.d.ts +2 -0
  225. package/dist/v2/runs/useRunsAccess.js +14 -0
  226. package/dist/v2/runs/useRunsAccess.js.map +1 -0
  227. package/dist/v2/runs/useWorkflowRuns.d.ts +61 -0
  228. package/dist/v2/runs/useWorkflowRuns.js +119 -0
  229. package/dist/v2/runs/useWorkflowRuns.js.map +1 -0
  230. package/dist/v2/search/SearchResults.d.ts +1 -0
  231. package/dist/v2/search/SearchResults.js +88 -0
  232. package/dist/v2/search/SearchResults.js.map +1 -0
  233. package/dist/v2/search/searchModel.d.ts +20 -0
  234. package/dist/v2/search/searchModel.js +22 -0
  235. package/dist/v2/search/searchModel.js.map +1 -0
  236. package/dist/v2/state/calendarV2Store.d.ts +4 -1
  237. package/dist/v2/state/calendarV2Store.js +3 -1
  238. package/dist/v2/state/calendarV2Store.js.map +1 -1
  239. package/dist/v2/state/useCalendarV2Navigation.d.ts +1 -0
  240. package/dist/v2/state/useCalendarV2Navigation.js +4 -1
  241. package/dist/v2/state/useCalendarV2Navigation.js.map +1 -1
  242. package/dist/v2/states/CalendarStates.d.ts +18 -0
  243. package/dist/v2/states/CalendarStates.js +122 -0
  244. package/dist/v2/states/CalendarStates.js.map +1 -0
  245. package/dist/v2/styles.d.ts +32 -0
  246. package/dist/v2/styles.js +10 -0
  247. package/dist/v2/styles.js.map +1 -0
  248. package/dist/v2/time/calendarTime.js +121 -35
  249. package/dist/v2/time/calendarTime.js.map +1 -1
  250. package/dist/v2/types.d.ts +22 -2
  251. package/package.json +1 -1
@@ -0,0 +1,21 @@
1
+ import { KeyboardEvent } from 'react';
2
+ import { EventLook } from '../events/eventLook';
3
+ import { CalendarFormat } from '../format';
4
+ import { CalendarEventV2, PlacedSegment } from '../types';
5
+ import { CalendarHue } from '../colors';
6
+ export interface EventBlockProps {
7
+ placed: PlacedSegment<CalendarEventV2>;
8
+ hourHeight: number;
9
+ look: EventLook;
10
+ hue: CalendarHue;
11
+ label: string;
12
+ format: CalendarFormat;
13
+ selected: boolean;
14
+ /** Shows the resize handle (desktop, editable). */
15
+ resizable: boolean;
16
+ onOpen: (event: CalendarEventV2, element: HTMLElement) => void;
17
+ onKeyDown: (event: KeyboardEvent<HTMLButtonElement>, calendarEvent: CalendarEventV2) => void;
18
+ /** A drag just ended on this piece: its click must not open the peek. */
19
+ consumeClick: () => boolean;
20
+ }
21
+ export declare function EventBlock({ placed, hourHeight, look, hue, label, format, selected, resizable, onOpen, onKeyDown, consumeClick, }: EventBlockProps): import('react').JSX.Element;
@@ -0,0 +1,112 @@
1
+ import { calendarHueStyle as e } from "../colors.js";
2
+ import { formatMinuteRange as t, formatMinutes as n } from "../format.js";
3
+ import { EVENT_EDGE as r, blockFill as i } from "../styles.js";
4
+ import { minuteOffset as a } from "./geometry.js";
5
+ import { AlertTriangle as o, CircleHelp as s, Clock3 as c, Repeat as l, Video as u } from "lucide-react";
6
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
7
+ import { cn as m } from "@burdenoff/fe-libs/utils";
8
+ // src/v2/grid/EventBlock.tsx
9
+ var h = 34, g = 52;
10
+ function _(e, t) {
11
+ return e.roomRefused ? /* @__PURE__ */ f(o, {
12
+ className: "size-3 text-status-warning-text",
13
+ "aria-hidden": "true"
14
+ }) : e.invitation ? /* @__PURE__ */ f(s, {
15
+ className: "size-3",
16
+ "aria-hidden": "true"
17
+ }) : e.roomPending ? /* @__PURE__ */ f(c, {
18
+ className: "size-3",
19
+ "aria-hidden": "true"
20
+ }) : t ? null : e.online ? /* @__PURE__ */ f(u, {
21
+ className: "size-3 text-text-muted",
22
+ "aria-hidden": "true"
23
+ }) : e.repeating ? /* @__PURE__ */ f(l, {
24
+ className: "size-3 text-text-muted",
25
+ "aria-hidden": "true"
26
+ }) : null;
27
+ }
28
+ function v(t, n, r) {
29
+ let i = Math.max(a(t.endMinute - t.startMinute, n), 20) - 2, o = t.column + t.span === t.columns;
30
+ return {
31
+ style: {
32
+ ...e(r),
33
+ top: a(t.startMinute, n) + 1,
34
+ height: i,
35
+ insetInlineStart: `calc(${t.column / t.columns * 100}% + 2px)`,
36
+ width: `calc(${t.span / t.columns * 100}% - ${o ? 6 : 4}px)`
37
+ },
38
+ height: i
39
+ };
40
+ }
41
+ var y = "min-w-0 font-semibold", b = "min-w-0 truncate text-[11px] text-text-secondary";
42
+ function x({ placed: e, look: t, format: r }) {
43
+ let i = _(t, !0);
44
+ return /* @__PURE__ */ p(d, { children: [
45
+ /* @__PURE__ */ f("span", {
46
+ className: m(y, "shrink truncate", t.declined && "line-through"),
47
+ children: t.title
48
+ }),
49
+ /* @__PURE__ */ f("span", {
50
+ className: m(b, "shrink-[100] tabular-nums"),
51
+ children: n(e.startMinute, r)
52
+ }),
53
+ i ? /* @__PURE__ */ f("span", {
54
+ className: "ms-auto inline-flex shrink-0",
55
+ children: i
56
+ }) : null
57
+ ] });
58
+ }
59
+ function S({ placed: e, look: n, format: r, roomy: i }) {
60
+ let a = _(n, !1), o = !i && n.place ? ` · ${n.place}` : "";
61
+ return /* @__PURE__ */ p(d, { children: [
62
+ a ? /* @__PURE__ */ f("span", {
63
+ className: "absolute end-1 top-1 inline-flex",
64
+ children: a
65
+ }) : null,
66
+ /* @__PURE__ */ f("span", {
67
+ className: m(y, "line-clamp-2 break-words", n.declined && "line-through", a && "pe-3.5"),
68
+ children: n.title
69
+ }),
70
+ /* @__PURE__ */ p("span", {
71
+ className: m(b, "tabular-nums"),
72
+ children: [t(e.startMinute, e.endMinute, r), o]
73
+ }),
74
+ i && n.place ? /* @__PURE__ */ f("span", {
75
+ className: b,
76
+ children: n.place
77
+ }) : null
78
+ ] });
79
+ }
80
+ function C({ placed: e, hourHeight: t, look: n, hue: a, label: o, format: s, selected: c, resizable: l, onOpen: u, onKeyDown: d, consumeClick: _ }) {
81
+ let { event: y } = e, { style: b, height: C } = v(e, t, a), w = C < h;
82
+ return /* @__PURE__ */ p("button", {
83
+ type: "button",
84
+ "data-event-id": y.id,
85
+ "data-movable": n.movable || void 0,
86
+ "aria-label": o,
87
+ "aria-haspopup": "dialog",
88
+ style: b,
89
+ onClick: (e) => {
90
+ _() || u(y, e.currentTarget);
91
+ },
92
+ onKeyDown: (e) => d(e, y),
93
+ className: m("group absolute z-[3] flex min-w-0 overflow-hidden rounded-[7px] text-start text-xs leading-[1.3] transition-shadow", "hover:z-[6] hover:shadow-[0_4px_14px_color-mix(in_oklab,var(--cal-hue)_28%,transparent)]", "focus-visible:z-[6] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--color-focus-ring)]", r, i(n), w ? "flex-row items-center gap-1.5 px-[7px] py-0" : "flex-col gap-px px-[7px] pt-[3px] pb-0.5", n.movable ? "cursor-grab" : "cursor-pointer", n.faded && "opacity-[0.56]", n.happeningNow && "shadow-[0_0_0_1.5px_var(--cal-hue)]", c && m("outline-2 outline-offset-1 outline-[var(--color-focus-ring)]", "z-[7]"), e.continuesBefore && "rounded-t-none", e.continuesAfter && "rounded-b-none"),
94
+ children: [w ? /* @__PURE__ */ f(x, {
95
+ placed: e,
96
+ look: n,
97
+ format: s
98
+ }) : /* @__PURE__ */ f(S, {
99
+ placed: e,
100
+ look: n,
101
+ format: s,
102
+ roomy: C >= g
103
+ }), l ? /* @__PURE__ */ f("span", {
104
+ "data-resize-handle": !0,
105
+ "aria-hidden": "true",
106
+ className: "absolute inset-x-0 bottom-0 h-[7px] cursor-ns-resize after:absolute after:start-1/2 after:bottom-0.5 after:h-[3px] after:w-[18px] after:-translate-x-1/2 after:rounded-[3px] after:bg-[var(--cal-hue)] after:opacity-0 after:transition-opacity group-hover:after:opacity-70"
107
+ }) : null]
108
+ });
109
+ }
110
+ export { C as EventBlock };
111
+
112
+ //# sourceMappingURL=EventBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventBlock.js","names":["_Fragment","SHORT_PX","ROOMY_PX","markerIcon","look","AlertTriangle","CircleHelp","Clock3","short","Video","Repeat","blockStyle","height","minuteOffset","placed","hourHeight","lastColumn","calendarHueStyle","hue","BODY_TITLE","BODY_META","ShortBody","marker","Fragment","cn","formatMinutes","format","TallBody","placeInline","roomy","formatMinuteRange","EventBlock","event","label","consumeClick","onOpen","clickEvent","onKeyDown","keyEvent","EVENT_EDGE","blockFill","selected","resizable"],"sources":["../../../src/v2/grid/EventBlock.tsx"],"sourcesContent":["/**\n * One event's piece in a time-grid column (BOFF-15698 A1): placed by the overlap layout, in its\n * calendar's hue, with its markers: an invitation outlined, \"Maybe\" striped, someone else's\n * private time hatched \"Busy\", ended ones faded, the one on now ringed. A short piece shows its\n * title and start on one line; a taller one its time and place too. Editable pieces have a\n * resize handle at the bottom (not on phones).\n */\nimport type { CSSProperties, KeyboardEvent, MouseEvent } from 'react';\nimport { AlertTriangle, CircleHelp, Clock3, Repeat, Video } from 'lucide-react';\nimport { cn } from '@burdenoff/fe-libs/utils';\nimport { calendarHueStyle } from '../colors';\nimport type { EventLook } from '../events/eventLook';\nimport { formatMinuteRange, formatMinutes, type CalendarFormat } from '../format';\nimport { blockFill, EVENT_EDGE, EVENT_NOW, EVENT_PAST, EVENT_SELECTED } from '../styles';\nimport type { CalendarEventV2, PlacedSegment } from '../types';\nimport type { CalendarHue } from '../colors';\nimport { minuteOffset } from './geometry';\n\n/** Below this height a piece shows one line. */\nconst SHORT_PX = 34;\n/** From this height a piece shows its place on its own line. */\nconst ROOMY_PX = 52;\n\nexport interface EventBlockProps {\n placed: PlacedSegment<CalendarEventV2>;\n hourHeight: number;\n look: EventLook;\n hue: CalendarHue;\n label: string;\n format: CalendarFormat;\n selected: boolean;\n /** Shows the resize handle (desktop, editable). */\n resizable: boolean;\n onOpen: (event: CalendarEventV2, element: HTMLElement) => void;\n onKeyDown: (event: KeyboardEvent<HTMLButtonElement>, calendarEvent: CalendarEventV2) => void;\n /** A drag just ended on this piece: its click must not open the peek. */\n consumeClick: () => boolean;\n}\n\nfunction markerIcon(look: EventLook, short: boolean) {\n if (look.roomRefused)\n return <AlertTriangle className=\"size-3 text-status-warning-text\" aria-hidden=\"true\" />;\n if (look.invitation) return <CircleHelp className=\"size-3\" aria-hidden=\"true\" />;\n if (look.roomPending) return <Clock3 className=\"size-3\" aria-hidden=\"true\" />;\n if (short) return null;\n if (look.online) return <Video className=\"size-3 text-text-muted\" aria-hidden=\"true\" />;\n if (look.repeating) return <Repeat className=\"size-3 text-text-muted\" aria-hidden=\"true\" />;\n return null;\n}\n\n/** Where a piece sits in its column: its minutes down, its columns across. */\nfunction blockStyle(placed: PlacedSegment<CalendarEventV2>, hourHeight: number, hue: CalendarHue) {\n const height = Math.max(minuteOffset(placed.endMinute - placed.startMinute, hourHeight), 20) - 2;\n const lastColumn = placed.column + placed.span === placed.columns;\n const style: CSSProperties = {\n ...calendarHueStyle(hue),\n top: minuteOffset(placed.startMinute, hourHeight) + 1,\n height,\n insetInlineStart: `calc(${(placed.column / placed.columns) * 100}% + 2px)`,\n width: `calc(${(placed.span / placed.columns) * 100}% - ${lastColumn ? 6 : 4}px)`,\n };\n return { style, height };\n}\n\ninterface BodyProps {\n placed: PlacedSegment<CalendarEventV2>;\n look: EventLook;\n format: CalendarFormat;\n}\n\nconst BODY_TITLE = 'min-w-0 font-semibold';\nconst BODY_META = 'min-w-0 truncate text-[11px] text-text-secondary';\n\n/** A short piece: its title and start on one line, the marker at the end. */\nfunction ShortBody({ placed, look, format }: BodyProps) {\n const marker = markerIcon(look, true);\n return (\n <>\n <span className={cn(BODY_TITLE, 'shrink truncate', look.declined && 'line-through')}>\n {look.title}\n </span>\n <span className={cn(BODY_META, 'shrink-[100] tabular-nums')}>\n {formatMinutes(placed.startMinute, format)}\n </span>\n {marker ? <span className=\"ms-auto inline-flex shrink-0\">{marker}</span> : null}\n </>\n );\n}\n\n/** A taller piece: its title, its time, and its place (on its own line when there's room). */\nfunction TallBody({ placed, look, format, roomy }: BodyProps & { roomy: boolean }) {\n const marker = markerIcon(look, false);\n const placeInline = !roomy && look.place ? ` · ${look.place}` : '';\n return (\n <>\n {marker ? <span className=\"absolute end-1 top-1 inline-flex\">{marker}</span> : null}\n <span\n className={cn(\n BODY_TITLE,\n 'line-clamp-2 break-words',\n look.declined && 'line-through',\n marker && 'pe-3.5'\n )}\n >\n {look.title}\n </span>\n <span className={cn(BODY_META, 'tabular-nums')}>\n {formatMinuteRange(placed.startMinute, placed.endMinute, format)}\n {placeInline}\n </span>\n {roomy && look.place ? <span className={BODY_META}>{look.place}</span> : null}\n </>\n );\n}\n\nexport function EventBlock({\n placed,\n hourHeight,\n look,\n hue,\n label,\n format,\n selected,\n resizable,\n onOpen,\n onKeyDown,\n consumeClick,\n}: EventBlockProps) {\n const { event } = placed;\n const { style, height } = blockStyle(placed, hourHeight, hue);\n const short = height < SHORT_PX;\n\n const onClick = (clickEvent: MouseEvent<HTMLButtonElement>) => {\n if (consumeClick()) return;\n onOpen(event, clickEvent.currentTarget);\n };\n\n return (\n <button\n type=\"button\"\n data-event-id={event.id}\n data-movable={look.movable || undefined}\n aria-label={label}\n aria-haspopup=\"dialog\"\n style={style}\n onClick={onClick}\n onKeyDown={(keyEvent) => onKeyDown(keyEvent, event)}\n className={cn(\n 'group absolute z-[3] flex min-w-0 overflow-hidden rounded-[7px] text-start text-xs leading-[1.3] transition-shadow',\n 'hover:z-[6] hover:shadow-[0_4px_14px_color-mix(in_oklab,var(--cal-hue)_28%,transparent)]',\n 'focus-visible:z-[6] focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--color-focus-ring)]',\n EVENT_EDGE,\n blockFill(look),\n short\n ? 'flex-row items-center gap-1.5 px-[7px] py-0'\n : 'flex-col gap-px px-[7px] pt-[3px] pb-0.5',\n look.movable ? 'cursor-grab' : 'cursor-pointer',\n look.faded && EVENT_PAST,\n look.happeningNow && EVENT_NOW,\n selected && cn(EVENT_SELECTED, 'z-[7]'),\n placed.continuesBefore && 'rounded-t-none',\n placed.continuesAfter && 'rounded-b-none'\n )}\n >\n {short ? (\n <ShortBody placed={placed} look={look} format={format} />\n ) : (\n <TallBody placed={placed} look={look} format={format} roomy={height >= ROOMY_PX} />\n )}\n {resizable ? (\n <span\n data-resize-handle\n aria-hidden=\"true\"\n className=\"absolute inset-x-0 bottom-0 h-[7px] cursor-ns-resize after:absolute after:start-1/2 after:bottom-0.5 after:h-[3px] after:w-[18px] after:-translate-x-1/2 after:rounded-[3px] after:bg-[var(--cal-hue)] after:opacity-0 after:transition-opacity group-hover:after:opacity-70\"\n />\n ) : null}\n </button>\n );\n}\n"],"mappings":";;;;;;;;AAmBA,IAAMC,IAAW,IAEXC,IAAW;AAkBjB,SAASC,EAAW,GAAiB,GAAgB;CAQnD,OAPIC,EAAK,cACA,kBAACC,GAAD;EAAe,WAAU;EAAkC,eAAY;CAAQ,CAAA,IACpFD,EAAK,aAAmB,kBAACE,GAAD;EAAY,WAAU;EAAS,eAAY;CAAQ,CAAA,IAC3EF,EAAK,cAAoB,kBAACG,GAAD;EAAQ,WAAU;EAAS,eAAY;CAAQ,CAAA,IACxEC,IAAc,OACdJ,EAAK,SAAe,kBAACK,GAAD;EAAO,WAAU;EAAyB,eAAY;CAAQ,CAAA,IAClFL,EAAK,YAAkB,kBAACM,GAAD;EAAQ,WAAU;EAAyB,eAAY;CAAQ,CAAA,IACnF;AACT;AAGA,SAASC,EAAW,GAAwC,GAAoB,GAAkB;CAChG,IAAMC,IAAS,KAAK,IAAIC,EAAaC,EAAO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AAc;GAA7C,UAAA,CACGU,EAAkBhB,EAAO,aAAaA,EAAO,WAAWY,CAAM,GAC9DE,CACG;;EACLC,KAASzB,EAAK,QAAQ,kBAAC,QAAD;GAAM,WAAWgB;GAAY,UAAAhB,EAAK;EAAY,CAAA,IAAI;CACzE,EAAA,CAAA;AAEN;AAEA,SAAgB2B,EAAW,EACzB,WACA,eACA,SACA,QACA,UACA,WACA,aACA,cACA,WACA,cACA,mBACkB;CAClB,IAAM,EAAE,aAAUjB,GACZ,EAAE,UAAO,cAAWH,EAAWG,GAAQC,GAAYG,CAAG,GACtDV,IAAQI,IAASX;CAOvB,OACE,kBAAC,UAAD;EACE,MAAK;EACL,iBAAe+B,EAAM;EACrB,gBAAc5B,EAAK,WAAW,KAAA;EAC9B,cAAY6B;EACZ,iBAAc;EACP;EACE,UAbI,MAA8C;GAC7D,AAAIC,EAAa,KACjBC,EAAOH,GAAOI,EAAW,aAAa;EACxC;EAWI,YAAY,MAAaC,EAAUC,GAAUN,CAAK;EAClD,WAAWR,EACT,sHACA,4FACA,8HACAe,GACAC,EAAUpC,CAAI,GACdI,IACI,gDACA,4CACJJ,EAAK,UAAU,gBAAgB,kBAC/BA,EAAK,SAAA,kBACLA,EAAK,gBAAA,uCACLqC,KAAYjB,EAAA,gEAAmB,OAAO,GACtCV,EAAO,mBAAmB,kBAC1BA,EAAO,kBAAkB,gBAC3B;EAxBF,UAAA,CA0BGN,IACC,kBAACa,GAAD;GAAmB;GAAc;GAAc;EAAS,CAAA,IAExD,kBAACM,GAAD;GAAkB;GAAc;GAAc;GAAQ,OAAOf,KAAUV;EAAW,CAAA,GAEnFwC,IACC,kBAAC,QAAD;GACE,sBAAA;GACA,eAAY;GACZ,WAAU;EACX,CAAA,IACC,IACE;;AAEZ"}
@@ -0,0 +1,40 @@
1
+ import { CSSProperties, KeyboardEvent } from 'react';
2
+ import { DateValue } from '@burdenoff/fe-libs/ui';
3
+ import { QuickDraft } from '../page/CalendarPageContext';
4
+ import { CalendarEventV2, PlacedSegment } from '../types';
5
+ import { DragGhost } from './useGridDrag';
6
+ /** The time zone (it opens Calendar settings) and the shown days (each opens its Day view). */
7
+ export declare function DayHeaderRow({ columnsStyle }: {
8
+ columnsStyle: CSSProperties;
9
+ }): import('react').JSX.Element;
10
+ /** The hours down the side, and the time now beside the now line (when today is shown). */
11
+ export declare function HourGutter({ hourHeight }: {
12
+ hourHeight: number;
13
+ }): import('react').JSX.Element;
14
+ export interface DayColumnProps {
15
+ day: DateValue;
16
+ placed: readonly PlacedSegment<CalendarEventV2>[];
17
+ hourHeight: number;
18
+ selectedId: string | null;
19
+ onOpen: (event: CalendarEventV2, element: HTMLElement) => void;
20
+ onKeyDown: (event: KeyboardEvent<HTMLButtonElement>, calendarEvent: CalendarEventV2) => void;
21
+ consumeClick: () => boolean;
22
+ /** A drag's preview in this column. */
23
+ ghost: DragGhost | null;
24
+ /** The quick create's slot in this column. */
25
+ quick: QuickDraft | null;
26
+ /** The keyboard cursor's minute in this column. */
27
+ cursorMinute: number | null;
28
+ }
29
+ /** One day of the grid: its working hours, events, the now line and what's being made. */
30
+ export declare function DayColumn({ day, placed, hourHeight, selectedId, onOpen, onKeyDown, consumeClick, ghost, quick, cursorMinute, }: DayColumnProps): import('react').JSX.Element;
31
+ export declare function GridGhost({ start, end, hourHeight, label, hueStyle, quickAnchor, }: {
32
+ start: number;
33
+ end: number;
34
+ hourHeight: number;
35
+ label: string;
36
+ hueStyle?: CSSProperties;
37
+ quickAnchor?: boolean;
38
+ }): import('react').JSX.Element;
39
+ /** Nothing on the shown days: a card over the grid, which stays usable around it. */
40
+ export declare function GridEmpty(): import('react').JSX.Element;
@@ -0,0 +1,210 @@
1
+ import { calendarHueStyle as e } from "../colors.js";
2
+ import { formatDay as t, formatDuration as n, formatMinuteRange as r, formatMinutes as i } from "../format.js";
3
+ import { useCalendarPage as a } from "../page/CalendarPageContext.js";
4
+ import { DayRunPills as o } from "../runs/RunPills.js";
5
+ import { FOCUS_RING as s } from "../styles.js";
6
+ import { isWeekendDay as c } from "../time/calendarTime.js";
7
+ import { EventBlock as l } from "./EventBlock.js";
8
+ import { minuteOffset as u } from "./geometry.js";
9
+ import { offHours as d } from "./workingHours.js";
10
+ import { CalendarPlus as f, Plus as p } from "lucide-react";
11
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
12
+ import { Button as _, EmptyState as v, formatTimeZoneOffset as y } from "@burdenoff/fe-libs/ui";
13
+ import { cn as b } from "@burdenoff/fe-libs/utils";
14
+ // src/v2/grid/GridParts.tsx
15
+ var x = Array.from({ length: 24 }, (e, t) => t);
16
+ function S({ columnsStyle: e }) {
17
+ let t = a(), { tr: n, format: r, timeZone: i, compact: o, days: c, today: l, nav: u } = t, d = y(i, t.now, r.locale), f = n("calendar.v2.timeZoneButton", "Time zone: {{zone}}", { zone: i });
18
+ return /* @__PURE__ */ g("div", {
19
+ className: "grid border-b border-border-subtle",
20
+ style: e,
21
+ children: [/* @__PURE__ */ h("div", {
22
+ className: "flex items-end justify-end pe-1 pb-1.5",
23
+ children: /* @__PURE__ */ h("button", {
24
+ type: "button",
25
+ onClick: () => u.openDialog("settings"),
26
+ title: f,
27
+ "aria-label": f,
28
+ className: b("rounded px-[3px] py-0.5 text-[10px] whitespace-nowrap tabular-nums text-text-muted hover:bg-bg-sunken hover:text-text-primary", s),
29
+ children: o ? d.replace(/^[^+−-]*/, "") : d
30
+ })
31
+ }), c.map((e) => /* @__PURE__ */ h(C, {
32
+ day: e,
33
+ isToday: e === l
34
+ }, e))]
35
+ });
36
+ }
37
+ function C({ day: e, isToday: n }) {
38
+ let { tr: r, format: i, compact: o, nav: l } = a(), u = c(e), d = n ? "today" : u ? "weekend" : "day";
39
+ return /* @__PURE__ */ g("button", {
40
+ type: "button",
41
+ onClick: () => l.goTo({
42
+ view: "day",
43
+ date: e
44
+ }),
45
+ "aria-current": n ? "date" : void 0,
46
+ "aria-label": r("calendar.v2.openDay", "{{day}}. Open the day", { day: t(e, i, "full") }),
47
+ className: b("flex min-w-0 items-center justify-center gap-1.5 border-s border-border-subtle px-0.5 py-[7px] hover:bg-bg-sunken", o && "flex-col gap-px py-[5px]", s),
48
+ children: [/* @__PURE__ */ h("span", {
49
+ className: b("text-[11px] font-semibold uppercase tracking-[0.06em]", d === "today" && "text-action-primary-bg", d === "weekend" && "text-text-muted", d === "day" && "text-text-secondary"),
50
+ children: t(e, i, "weekday")
51
+ }), /* @__PURE__ */ h("span", {
52
+ className: b("grid h-[30px] min-w-[30px] place-items-center rounded-full px-1 text-lg font-semibold tabular-nums", o && "h-7 min-w-7 text-base", d === "today" && "bg-action-primary-bg text-action-primary-text", d === "weekend" && "text-text-muted", d === "day" && "text-text-primary"),
53
+ children: t(e, i, "dayNumber")
54
+ })]
55
+ });
56
+ }
57
+ function w({ hourHeight: e }) {
58
+ let { format: t, days: n, today: r, nowMinute: o } = a(), s = n.includes(r);
59
+ return /* @__PURE__ */ g("div", {
60
+ className: "relative",
61
+ "aria-hidden": "true",
62
+ children: [x.map((n) => n === 0 || s && Math.abs(n * 60 - o) < 13 ? null : /* @__PURE__ */ h("span", {
63
+ className: "absolute end-[7px] -translate-y-1/2 text-[11px] leading-none whitespace-nowrap tabular-nums text-text-muted",
64
+ style: { top: n * e },
65
+ children: i(n * 60, t)
66
+ }, n)), s ? /* @__PURE__ */ h("span", {
67
+ className: "absolute end-[3px] z-[4] -translate-y-1/2 rounded-full bg-action-primary-bg px-[5px] py-[3px] text-[10.5px] leading-none font-bold whitespace-nowrap tabular-nums text-action-primary-text",
68
+ style: { top: u(o, e) },
69
+ children: i(o, t)
70
+ }) : null]
71
+ });
72
+ }
73
+ function T({ day: e, hourHeight: t }) {
74
+ let { workingHoursOn: n } = a(), r = n(e);
75
+ return r === void 0 ? null : /* @__PURE__ */ h(m, { children: d(r).map((e) => /* @__PURE__ */ h("div", {
76
+ className: "pointer-events-none absolute inset-x-0 bg-bg-sunken/70",
77
+ style: {
78
+ top: u(e.start, t),
79
+ height: u(e.end - e.start, t)
80
+ }
81
+ }, e.start)) });
82
+ }
83
+ function E({ isToday: e, hourHeight: t }) {
84
+ let { nowMinute: n } = a();
85
+ return /* @__PURE__ */ h("div", {
86
+ "aria-hidden": "true",
87
+ className: b("pointer-events-none absolute inset-x-0", e ? "-start-px z-[5] -mt-px h-0.5 bg-action-primary-bg before:absolute before:-start-[5px] before:-top-1 before:size-2.5 before:rounded-full before:bg-action-primary-bg" : "z-[2] h-px bg-[color-mix(in_oklab,var(--color-action-primary-bg)_40%,transparent)]"),
88
+ style: { top: u(n, t) }
89
+ });
90
+ }
91
+ function D({ day: i, placed: s, hourHeight: c, selectedId: d, onOpen: f, onKeyDown: p, consumeClick: m, ghost: _, quick: v, cursorMinute: y }) {
92
+ let x = a(), { tr: S, format: C, compact: w, today: D, days: k } = x, A = i === D, j = {
93
+ backgroundImage: "linear-gradient(to bottom, var(--color-border-subtle) 1px, transparent 1px), linear-gradient(to bottom, color-mix(in oklab, var(--color-border-subtle) 45%, transparent) 1px, transparent 1px)",
94
+ backgroundSize: `100% ${c}px, 100% ${c}px`,
95
+ backgroundPosition: `0 0, 0 ${c / 2}px`
96
+ };
97
+ return /* @__PURE__ */ g("div", {
98
+ "data-grid-day": i,
99
+ role: "group",
100
+ "aria-label": S("calendar.v2.dayColumn", "{{day}}: {{count}} events", {
101
+ day: t(i, C, "full"),
102
+ count: s.length
103
+ }),
104
+ className: b("relative border-s border-border-subtle", A && "bg-accent-soft/30"),
105
+ style: j,
106
+ children: [
107
+ /* @__PURE__ */ h(T, {
108
+ day: i,
109
+ hourHeight: c
110
+ }),
111
+ s.map((e) => {
112
+ let t = x.lookOf(e.event);
113
+ return /* @__PURE__ */ h(l, {
114
+ placed: e,
115
+ hourHeight: c,
116
+ look: t,
117
+ hue: x.hueOf(e.event.calendarId),
118
+ label: x.labelOf(e.event),
119
+ format: C,
120
+ selected: d === e.event.id,
121
+ resizable: t.movable && !w && !e.continuesAfter,
122
+ onOpen: f,
123
+ onKeyDown: p,
124
+ consumeClick: m
125
+ }, `${e.event.id}|${e.date}`);
126
+ }),
127
+ /* @__PURE__ */ h(o, {
128
+ day: i,
129
+ hourHeight: c,
130
+ placed: s
131
+ }),
132
+ k.includes(D) ? /* @__PURE__ */ h(E, {
133
+ isToday: A,
134
+ hourHeight: c
135
+ }) : null,
136
+ _ ? /* @__PURE__ */ h(O, {
137
+ start: _.start,
138
+ end: _.end,
139
+ hourHeight: c,
140
+ hueStyle: _.event ? e(x.hueOf(_.event.calendarId)) : void 0,
141
+ label: _.event ? `${_.event.title} · ${r(_.start, _.end, C)}` : `${r(_.start, _.end, C)} · ${n(_.end - _.start, x.durationWords)}`
142
+ }) : null,
143
+ v ? /* @__PURE__ */ h(O, {
144
+ start: v.start,
145
+ end: v.end,
146
+ hourHeight: c,
147
+ label: r(v.start, v.end, C),
148
+ quickAnchor: !0
149
+ }) : null,
150
+ y === null ? null : /* @__PURE__ */ h("div", {
151
+ "aria-hidden": "true",
152
+ className: "pointer-events-none absolute inset-x-0.5 z-[8] rounded-md border-2 border-[var(--color-focus-ring)] bg-accent-soft/40 px-1.5 text-[11px] font-semibold text-text-primary",
153
+ style: {
154
+ top: u(y, c),
155
+ height: u(30, c) - 2
156
+ },
157
+ children: r(y, y + 30, C)
158
+ })
159
+ ]
160
+ });
161
+ }
162
+ function O({ start: e, end: t, hourHeight: n, label: r, hueStyle: i, quickAnchor: a = !1 }) {
163
+ return /* @__PURE__ */ h("div", {
164
+ "aria-hidden": "true",
165
+ "data-quick-ghost": a || void 0,
166
+ className: b("pointer-events-none absolute inset-x-0.5 z-[9] overflow-hidden rounded-md border border-dashed px-1.5 py-0.5 text-[11px] font-semibold text-text-primary", i ? "border-[var(--cal-hue)] bg-[color-mix(in_oklab,var(--cal-hue)_22%,var(--color-bg-surface))]" : "border-action-primary-bg bg-accent-soft/70"),
167
+ style: {
168
+ ...i,
169
+ top: u(e, n),
170
+ height: Math.max(18, u(t - e, n) - 2)
171
+ },
172
+ children: r
173
+ });
174
+ }
175
+ function k() {
176
+ let e = a(), { tr: t, compact: n } = e, r = e.days.includes(e.today) ? e.today : e.days[0] ?? e.today;
177
+ return /* @__PURE__ */ h("div", {
178
+ className: "pointer-events-none absolute inset-0 z-30 grid place-items-center p-4",
179
+ children: /* @__PURE__ */ h("div", {
180
+ className: "pointer-events-auto w-full max-w-sm rounded-card border border-border-default bg-bg-elevated shadow-elevation-3",
181
+ children: /* @__PURE__ */ h(v, {
182
+ compact: !0,
183
+ size: "panel",
184
+ kind: "first-use",
185
+ illustration: "calendar",
186
+ title: t("calendar.v2.emptyDays", "Nothing on these days"),
187
+ description: n ? t("calendar.v2.emptyDaysPhone", "Add an event, or bring in a team, holiday or other calendar.") : t("calendar.v2.emptyDaysDesktop", "Click and drag on the grid to add an event, or bring in a team, holiday or other calendar."),
188
+ action: /* @__PURE__ */ g(_, {
189
+ type: "button",
190
+ onClick: () => e.openEventDialog({
191
+ date: r,
192
+ start: e.workingHoursOn(r)?.start ?? 540,
193
+ end: (e.workingHoursOn(r)?.start ?? 540) + e.prefs.defaultDuration,
194
+ allDay: !1
195
+ }),
196
+ children: [/* @__PURE__ */ h(p, { "aria-hidden": "true" }), t("calendar.v2.newEvent", "New event")]
197
+ }),
198
+ secondaryAction: /* @__PURE__ */ g(_, {
199
+ type: "button",
200
+ variant: "outline",
201
+ onClick: () => e.nav.openDialog("share"),
202
+ children: [/* @__PURE__ */ h(f, { "aria-hidden": "true" }), t("calendar.v2.addCalendar", "Add a calendar")]
203
+ })
204
+ })
205
+ })
206
+ });
207
+ }
208
+ export { D as DayColumn, S as DayHeaderRow, k as GridEmpty, O as GridGhost, w as HourGutter };
209
+
210
+ //# sourceMappingURL=GridParts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GridParts.js","names":["_Fragment","HOURS","hour","DayHeaderRow","page","useCalendarPage","offsetLabel","formatTimeZoneOffset","timeZone","format","zoneLabel","tr","columnsStyle","nav","cn","FOCUS_RING","compact","days","DayHeader","day","today","weekend","isWeekendDay","tone","isToday","formatDay","HourGutter","showsToday","nowMinute","hourHeight","formatMinutes","minuteOffset","OffHours","hours","workingHoursOn","Fragment","offHours","stretch","NowLine","DayColumn","lineStyle","placed","look","piece","EventBlock","selectedId","DayRunPills","ghost","GridGhost","calendarHueStyle","formatMinuteRange","formatDuration","quick","cursorMinute","quickAnchor","hueStyle","start","end","label","GridEmpty","EmptyState","Button","Plus","CalendarPlus"],"sources":["../../../src/v2/grid/GridParts.tsx"],"sourcesContent":["/**\n * The time grid's parts (BOFF-15698 A1): the row of days, the hours down the side with the now\n * time, a day's column (working hours unshaded, its events, its workflow runs (B5), the now\n * line, a drag's ghost, the quick create's slot and the keyboard cursor), and the \"nothing on\n * these days\" card.\n */\nimport type { CSSProperties, KeyboardEvent } from 'react';\nimport { CalendarPlus, Plus } from 'lucide-react';\nimport { Button, EmptyState, formatTimeZoneOffset, type DateValue } from '@burdenoff/fe-libs/ui';\nimport { cn } from '@burdenoff/fe-libs/utils';\nimport { calendarHueStyle } from '../colors';\nimport { formatDay, formatDuration, formatMinuteRange, formatMinutes } from '../format';\nimport { useCalendarPage, type QuickDraft } from '../page/CalendarPageContext';\nimport { DayRunPills } from '../runs/RunPills';\nimport { FOCUS_RING } from '../styles';\nimport { isWeekendDay } from '../time/calendarTime';\nimport type { CalendarEventV2, PlacedSegment } from '../types';\nimport { EventBlock } from './EventBlock';\nimport { CURSOR_STEP, minuteOffset } from './geometry';\nimport type { DragGhost } from './useGridDrag';\nimport { offHours } from './workingHours';\n\nconst HOURS = Array.from({ length: 24 }, (_, hour) => hour);\n\n/** The time zone (it opens Calendar settings) and the shown days (each opens its Day view). */\nexport function DayHeaderRow({ columnsStyle }: { columnsStyle: CSSProperties }) {\n const page = useCalendarPage();\n const { tr, format, timeZone, compact, days, today, nav } = page;\n const offsetLabel = formatTimeZoneOffset(timeZone, page.now, format.locale);\n const zoneLabel = tr('calendar.v2.timeZoneButton', 'Time zone: {{zone}}', { zone: timeZone });\n return (\n <div className=\"grid border-b border-border-subtle\" style={columnsStyle}>\n <div className=\"flex items-end justify-end pe-1 pb-1.5\">\n <button\n type=\"button\"\n onClick={() => nav.openDialog('settings')}\n title={zoneLabel}\n aria-label={zoneLabel}\n className={cn(\n 'rounded px-[3px] py-0.5 text-[10px] whitespace-nowrap tabular-nums text-text-muted hover:bg-bg-sunken hover:text-text-primary',\n FOCUS_RING\n )}\n >\n {compact ? offsetLabel.replace(/^[^+−-]*/, '') : offsetLabel}\n </button>\n </div>\n {days.map((day) => (\n <DayHeader key={day} day={day} isToday={day === today} />\n ))}\n </div>\n );\n}\n\nfunction DayHeader({ day, isToday }: { day: DateValue; isToday: boolean }) {\n const { tr, format, compact, nav } = useCalendarPage();\n const weekend = isWeekendDay(day);\n const tone = isToday ? 'today' : weekend ? 'weekend' : 'day';\n return (\n <button\n type=\"button\"\n onClick={() => nav.goTo({ view: 'day', date: day })}\n aria-current={isToday ? 'date' : undefined}\n aria-label={tr('calendar.v2.openDay', '{{day}}. Open the day', {\n day: formatDay(day, format, 'full'),\n })}\n className={cn(\n 'flex min-w-0 items-center justify-center gap-1.5 border-s border-border-subtle px-0.5 py-[7px] hover:bg-bg-sunken',\n compact && 'flex-col gap-px py-[5px]',\n FOCUS_RING\n )}\n >\n <span\n className={cn(\n 'text-[11px] font-semibold uppercase tracking-[0.06em]',\n tone === 'today' && 'text-action-primary-bg',\n tone === 'weekend' && 'text-text-muted',\n tone === 'day' && 'text-text-secondary'\n )}\n >\n {formatDay(day, format, 'weekday')}\n </span>\n <span\n className={cn(\n 'grid h-[30px] min-w-[30px] place-items-center rounded-full px-1 text-lg font-semibold tabular-nums',\n compact && 'h-7 min-w-7 text-base',\n tone === 'today' && 'bg-action-primary-bg text-action-primary-text',\n tone === 'weekend' && 'text-text-muted',\n tone === 'day' && 'text-text-primary'\n )}\n >\n {formatDay(day, format, 'dayNumber')}\n </span>\n </button>\n );\n}\n\n/** The hours down the side, and the time now beside the now line (when today is shown). */\nexport function HourGutter({ hourHeight }: { hourHeight: number }) {\n const { format, days, today, nowMinute } = useCalendarPage();\n const showsToday = days.includes(today);\n return (\n <div className=\"relative\" aria-hidden=\"true\">\n {HOURS.map((hour) =>\n hour === 0 || (showsToday && Math.abs(hour * 60 - nowMinute) < 13) ? null : (\n <span\n key={hour}\n className=\"absolute end-[7px] -translate-y-1/2 text-[11px] leading-none whitespace-nowrap tabular-nums text-text-muted\"\n style={{ top: hour * hourHeight }}\n >\n {formatMinutes(hour * 60, format)}\n </span>\n )\n )}\n {showsToday ? (\n <span\n className=\"absolute end-[3px] z-[4] -translate-y-1/2 rounded-full bg-action-primary-bg px-[5px] py-[3px] text-[10.5px] leading-none font-bold whitespace-nowrap tabular-nums text-action-primary-text\"\n style={{ top: minuteOffset(nowMinute, hourHeight) }}\n >\n {formatMinutes(nowMinute, format)}\n </span>\n ) : null}\n </div>\n );\n}\n\n/** The hours outside the working day, shaded (a day off is shaded whole). */\nfunction OffHours({ day, hourHeight }: { day: DateValue; hourHeight: number }) {\n const { workingHoursOn } = useCalendarPage();\n const hours = workingHoursOn(day);\n // Not known (free/busy hasn't answered, or failed): no shading rather than a guess.\n if (hours === undefined) return null;\n return (\n <>\n {offHours(hours).map((stretch) => (\n <div\n key={stretch.start}\n className=\"pointer-events-none absolute inset-x-0 bg-bg-sunken/70\"\n style={{\n top: minuteOffset(stretch.start, hourHeight),\n height: minuteOffset(stretch.end - stretch.start, hourHeight),\n }}\n />\n ))}\n </>\n );\n}\n\n/** Now: a line with a dot across today, faint across the other shown days. */\nfunction NowLine({ isToday, hourHeight }: { isToday: boolean; hourHeight: number }) {\n const { nowMinute } = useCalendarPage();\n return (\n <div\n aria-hidden=\"true\"\n className={cn(\n 'pointer-events-none absolute inset-x-0',\n isToday\n ? '-start-px z-[5] -mt-px h-0.5 bg-action-primary-bg before:absolute before:-start-[5px] before:-top-1 before:size-2.5 before:rounded-full before:bg-action-primary-bg'\n : 'z-[2] h-px bg-[color-mix(in_oklab,var(--color-action-primary-bg)_40%,transparent)]'\n )}\n style={{ top: minuteOffset(nowMinute, hourHeight) }}\n />\n );\n}\n\nexport interface DayColumnProps {\n day: DateValue;\n placed: readonly PlacedSegment<CalendarEventV2>[];\n hourHeight: number;\n selectedId: string | null;\n onOpen: (event: CalendarEventV2, element: HTMLElement) => void;\n onKeyDown: (event: KeyboardEvent<HTMLButtonElement>, calendarEvent: CalendarEventV2) => void;\n consumeClick: () => boolean;\n /** A drag's preview in this column. */\n ghost: DragGhost | null;\n /** The quick create's slot in this column. */\n quick: QuickDraft | null;\n /** The keyboard cursor's minute in this column. */\n cursorMinute: number | null;\n}\n\n/** One day of the grid: its working hours, events, the now line and what's being made. */\nexport function DayColumn({\n day,\n placed,\n hourHeight,\n selectedId,\n onOpen,\n onKeyDown,\n consumeClick,\n ghost,\n quick,\n cursorMinute,\n}: DayColumnProps) {\n const page = useCalendarPage();\n const { tr, format, compact, today, days } = page;\n const isToday = day === today;\n const lineStyle: CSSProperties = {\n backgroundImage:\n 'linear-gradient(to bottom, var(--color-border-subtle) 1px, transparent 1px), linear-gradient(to bottom, color-mix(in oklab, var(--color-border-subtle) 45%, transparent) 1px, transparent 1px)',\n backgroundSize: `100% ${hourHeight}px, 100% ${hourHeight}px`,\n backgroundPosition: `0 0, 0 ${hourHeight / 2}px`,\n };\n return (\n <div\n data-grid-day={day}\n role=\"group\"\n aria-label={tr('calendar.v2.dayColumn', '{{day}}: {{count}} events', {\n day: formatDay(day, format, 'full'),\n count: placed.length,\n })}\n className={cn('relative border-s border-border-subtle', isToday && 'bg-accent-soft/30')}\n style={lineStyle}\n >\n <OffHours day={day} hourHeight={hourHeight} />\n {placed.map((piece) => {\n const look = page.lookOf(piece.event);\n return (\n <EventBlock\n key={`${piece.event.id}|${piece.date}`}\n placed={piece}\n hourHeight={hourHeight}\n look={look}\n hue={page.hueOf(piece.event.calendarId)}\n label={page.labelOf(piece.event)}\n format={format}\n selected={selectedId === piece.event.id}\n resizable={look.movable && !compact && !piece.continuesAfter}\n onOpen={onOpen}\n onKeyDown={onKeyDown}\n consumeClick={consumeClick}\n />\n );\n })}\n <DayRunPills day={day} hourHeight={hourHeight} placed={placed} />\n {days.includes(today) ? <NowLine isToday={isToday} hourHeight={hourHeight} /> : null}\n {ghost ? (\n <GridGhost\n start={ghost.start}\n end={ghost.end}\n hourHeight={hourHeight}\n hueStyle={ghost.event ? calendarHueStyle(page.hueOf(ghost.event.calendarId)) : undefined}\n label={\n ghost.event\n ? `${ghost.event.title} · ${formatMinuteRange(ghost.start, ghost.end, format)}`\n : `${formatMinuteRange(ghost.start, ghost.end, format)} · ${formatDuration(ghost.end - ghost.start, page.durationWords)}`\n }\n />\n ) : null}\n {quick ? (\n <GridGhost\n start={quick.start}\n end={quick.end}\n hourHeight={hourHeight}\n label={formatMinuteRange(quick.start, quick.end, format)}\n quickAnchor\n />\n ) : null}\n {cursorMinute !== null ? (\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute inset-x-0.5 z-[8] rounded-md border-2 border-[var(--color-focus-ring)] bg-accent-soft/40 px-1.5 text-[11px] font-semibold text-text-primary\"\n style={{\n top: minuteOffset(cursorMinute, hourHeight),\n height: minuteOffset(CURSOR_STEP, hourHeight) - 2,\n }}\n >\n {formatMinuteRange(cursorMinute, cursorMinute + CURSOR_STEP, format)}\n </div>\n ) : null}\n </div>\n );\n}\n\nexport function GridGhost({\n start,\n end,\n hourHeight,\n label,\n hueStyle,\n quickAnchor = false,\n}: {\n start: number;\n end: number;\n hourHeight: number;\n label: string;\n hueStyle?: CSSProperties;\n quickAnchor?: boolean;\n}) {\n return (\n <div\n aria-hidden=\"true\"\n data-quick-ghost={quickAnchor || undefined}\n className={cn(\n 'pointer-events-none absolute inset-x-0.5 z-[9] overflow-hidden rounded-md border border-dashed px-1.5 py-0.5 text-[11px] font-semibold text-text-primary',\n hueStyle\n ? 'border-[var(--cal-hue)] bg-[color-mix(in_oklab,var(--cal-hue)_22%,var(--color-bg-surface))]'\n : 'border-action-primary-bg bg-accent-soft/70'\n )}\n style={{\n ...hueStyle,\n top: minuteOffset(start, hourHeight),\n height: Math.max(18, minuteOffset(end - start, hourHeight) - 2),\n }}\n >\n {label}\n </div>\n );\n}\n\n/** Nothing on the shown days: a card over the grid, which stays usable around it. */\nexport function GridEmpty() {\n const page = useCalendarPage();\n const { tr, compact } = page;\n const day = page.days.includes(page.today) ? page.today : (page.days[0] ?? page.today);\n return (\n <div className=\"pointer-events-none absolute inset-0 z-30 grid place-items-center p-4\">\n <div className=\"pointer-events-auto w-full max-w-sm rounded-card border border-border-default bg-bg-elevated shadow-elevation-3\">\n <EmptyState\n compact\n size=\"panel\"\n kind=\"first-use\"\n illustration=\"calendar\"\n title={tr('calendar.v2.emptyDays', 'Nothing on these days')}\n description={\n compact\n ? tr(\n 'calendar.v2.emptyDaysPhone',\n 'Add an event, or bring in a team, holiday or other calendar.'\n )\n : tr(\n 'calendar.v2.emptyDaysDesktop',\n 'Click and drag on the grid to add an event, or bring in a team, holiday or other calendar.'\n )\n }\n action={\n <Button\n type=\"button\"\n onClick={() =>\n page.openEventDialog({\n date: day,\n start: page.workingHoursOn(day)?.start ?? 9 * 60,\n end: (page.workingHoursOn(day)?.start ?? 9 * 60) + page.prefs.defaultDuration,\n allDay: false,\n })\n }\n >\n <Plus aria-hidden=\"true\" />\n {tr('calendar.v2.newEvent', 'New event')}\n </Button>\n }\n secondaryAction={\n <Button type=\"button\" variant=\"outline\" onClick={() => page.nav.openDialog('share')}>\n <CalendarPlus aria-hidden=\"true\" />\n {tr('calendar.v2.addCalendar', 'Add a calendar')}\n </Button>\n }\n />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAsBA,IAAMC,IAAQ,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,MAASC,CAAI;AAG1D,SAAgBC,EAAa,EAAE,mBAAiD;CAC9E,IAAMC,IAAOC,EAAgB,GACvB,EAAE,OAAI,WAAQ,aAAU,YAAS,SAAM,UAAO,WAAQD,GACtDE,IAAcC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MAAK;IACL,cAAa;IACb,OAAOjD,EAAG,yBAAyB,uBAAuB;IAC1D,aACEK,IACIL,EACE,8BACA,8DACF,IACAA,EACE,gCACA,4FACF;IAEN,QACE,kBAACkD,GAAD;KACE,MAAK;KACL,eACEzD,EAAK,gBAAgB;MACnB,MAAMe;MACN,OAAOf,EAAK,eAAee,CAAG,CAAC,EAAE,SAAS;MAC1C,MAAMf,EAAK,eAAee,CAAG,CAAC,EAAE,SAAS,OAAUf,EAAK,MAAM;MAC9D,QAAQ;KACV,CAAC;KARL,UAAA,CAWE,kBAAC0D,GAAD,EAAM,eAAY,OAAQ,CAAA,GACzBnD,EAAG,wBAAwB,WAAW,CACjC;;IAEV,iBACE,kBAACkD,GAAD;KAAQ,MAAK;KAAS,SAAQ;KAAU,eAAezD,EAAK,IAAI,WAAW,OAAO;KAAlF,UAAA,CACE,kBAAC2D,GAAD,EAAc,eAAY,OAAQ,CAAA,GACjCpD,EAAG,2BAA2B,gBAAgB,CACzC;;GAEX,CAAA;EACE,CAAA;CACF,CAAA;AAET"}
@@ -0,0 +1 @@
1
+ export declare function QuickCreateHost(): import('react').JSX.Element | null;
@@ -0,0 +1,175 @@
1
+ import { calendarHueStyle as e } from "../colors.js";
2
+ import { formatDay as t, formatDuration as n, formatMinuteRange as r } from "../format.js";
3
+ import { useCalendarPage as i } from "../page/CalendarPageContext.js";
4
+ import { zonedTimeToInstant as a } from "../time/calendarTime.js";
5
+ import { FOCUS_RING as o, ICON_BUTTON as s } from "../styles.js";
6
+ import { useMemo as c, useState as l } from "react";
7
+ import { Check as u, ChevronDown as d, Clock3 as f, X as p } from "lucide-react";
8
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
9
+ import { Button as g, DropdownMenu as _, DropdownMenuContent as v, DropdownMenuRadioGroup as y, DropdownMenuRadioItem as b, DropdownMenuTrigger as x, Input as S, Popover as C, PopoverAnchor as w, PopoverContent as T } from "@burdenoff/fe-libs/ui";
10
+ import { cn as E } from "@burdenoff/fe-libs/utils";
11
+ // src/v2/grid/QuickCreate.tsx
12
+ function D() {
13
+ let e = i(), t = e.quickDraft;
14
+ return !t || e.compact ? null : /* @__PURE__ */ m(O, { draft: t }, `${t.date}|${t.start}|${t.end}`);
15
+ }
16
+ function O({ draft: D }) {
17
+ let O = i(), { tr: k, format: A } = O, [j, M] = l(""), [N, P] = l(O.defaultCalendarId), [F, I] = l(!1), L = O.writableCalendars.find((e) => e.id === N) ?? null, R = c(() => ({ current: { getBoundingClientRect: () => {
18
+ let e = document.querySelector("[data-quick-ghost]") ?? (D.anchor?.isConnected ? D.anchor : null);
19
+ return e ? e.getBoundingClientRect() : new DOMRect(window.innerWidth / 2, 160, 0, 0);
20
+ } } }), [D.anchor]), z = D.allDay ? k("calendar.v2.allDayLower", "all day") : `${r(D.start, D.end, A)} (${n(D.end - D.start, O.durationWords)})`, B = async (e) => {
21
+ if (e?.preventDefault(), !L || F) return;
22
+ I(!0);
23
+ let t = !1;
24
+ try {
25
+ t = await O.actions.quickCreate({
26
+ calendarId: L.id,
27
+ title: j.trim() || k("calendar.v2.newEventTitle", "New event"),
28
+ start: a(D.date, D.allDay ? 0 : D.start, O.timeZone),
29
+ end: a(D.date, D.allDay ? 1440 : D.end, O.timeZone),
30
+ allDay: D.allDay
31
+ });
32
+ } finally {
33
+ I(!1);
34
+ }
35
+ t && O.closeQuickCreate();
36
+ };
37
+ return /* @__PURE__ */ h(C, {
38
+ open: !0,
39
+ onOpenChange: (e) => e ? void 0 : O.closeQuickCreate(),
40
+ children: [/* @__PURE__ */ m(w, { virtualRef: R }), /* @__PURE__ */ m(T, {
41
+ side: "right",
42
+ align: "start",
43
+ sideOffset: 8,
44
+ collisionPadding: 12,
45
+ className: "w-[340px] p-0",
46
+ "aria-labelledby": "calendar-quick-create-title",
47
+ onOpenAutoFocus: (e) => {
48
+ e.preventDefault(), document.getElementById("calendar-quick-create-input")?.focus();
49
+ },
50
+ children: /* @__PURE__ */ h("form", {
51
+ onSubmit: (e) => void B(e),
52
+ className: "flex flex-col gap-3 p-4",
53
+ children: [
54
+ /* @__PURE__ */ h("div", {
55
+ className: "flex items-center gap-2",
56
+ children: [/* @__PURE__ */ m("h3", {
57
+ id: "calendar-quick-create-title",
58
+ className: "flex-1 text-base font-bold text-text-primary",
59
+ children: k("calendar.v2.newEvent", "New event")
60
+ }), /* @__PURE__ */ m("button", {
61
+ type: "button",
62
+ className: s,
63
+ "aria-label": k("calendar.v2.close", "Close"),
64
+ onClick: O.closeQuickCreate,
65
+ children: /* @__PURE__ */ m(p, { "aria-hidden": "true" })
66
+ })]
67
+ }),
68
+ /* @__PURE__ */ m("label", {
69
+ className: "sr-only",
70
+ htmlFor: "calendar-quick-create-input",
71
+ children: k("calendar.v2.eventTitle", "Title")
72
+ }),
73
+ /* @__PURE__ */ m(S, {
74
+ id: "calendar-quick-create-input",
75
+ autoComplete: "off",
76
+ maxLength: 200,
77
+ placeholder: k("calendar.v2.addTitle", "Add a title"),
78
+ value: j,
79
+ onChange: (e) => M(e.target.value),
80
+ className: "h-11 text-base"
81
+ }),
82
+ /* @__PURE__ */ h("p", {
83
+ className: "flex items-center gap-2 text-sm text-text-primary",
84
+ children: [/* @__PURE__ */ m(f, {
85
+ className: "size-3.5 shrink-0 text-text-muted",
86
+ "aria-hidden": "true"
87
+ }), /* @__PURE__ */ h("span", { children: [
88
+ /* @__PURE__ */ m("b", {
89
+ className: "font-semibold",
90
+ children: t(D.date, A, "mid")
91
+ }),
92
+ " · ",
93
+ /* @__PURE__ */ m("span", {
94
+ className: "text-text-secondary",
95
+ children: z
96
+ })
97
+ ] })]
98
+ }),
99
+ O.writableCalendars.length > 0 ? /* @__PURE__ */ h(_, { children: [/* @__PURE__ */ m(x, {
100
+ asChild: !0,
101
+ children: /* @__PURE__ */ h("button", {
102
+ type: "button",
103
+ "aria-label": k("calendar.v2.pickCalendar", "Calendar: {{name}}", { name: L?.name ?? "" }),
104
+ className: E("flex h-10 w-full items-center gap-2 rounded-input border border-border-default bg-bg-surface px-3 text-start text-sm text-text-primary hover:border-border-strong", o),
105
+ children: [
106
+ L ? /* @__PURE__ */ m("span", {
107
+ "aria-hidden": "true",
108
+ className: "size-2.5 shrink-0 rounded-[3px] bg-[var(--cal-hue)]",
109
+ style: e(O.hueOf(L.id))
110
+ }) : null,
111
+ /* @__PURE__ */ m("span", {
112
+ className: "min-w-0 flex-1 truncate",
113
+ children: L?.name
114
+ }),
115
+ /* @__PURE__ */ m(d, {
116
+ className: "size-4 text-text-muted",
117
+ "aria-hidden": "true"
118
+ })
119
+ ]
120
+ })
121
+ }), /* @__PURE__ */ m(v, {
122
+ align: "start",
123
+ className: "w-[var(--radix-dropdown-menu-trigger-width)]",
124
+ children: /* @__PURE__ */ m(y, {
125
+ value: N ?? "",
126
+ onValueChange: P,
127
+ children: O.writableCalendars.map((t) => /* @__PURE__ */ h(b, {
128
+ value: t.id,
129
+ className: "gap-2",
130
+ children: [/* @__PURE__ */ m("span", {
131
+ "aria-hidden": "true",
132
+ className: "size-2.5 shrink-0 rounded-[3px] bg-[var(--cal-hue)]",
133
+ style: e(O.hueOf(t.id))
134
+ }), /* @__PURE__ */ m("span", {
135
+ className: "truncate",
136
+ children: t.name
137
+ })]
138
+ }, t.id))
139
+ })
140
+ })] }) : /* @__PURE__ */ m("p", {
141
+ className: "text-sm text-text-secondary",
142
+ children: k("calendar.v2.noWritableCalendar", "You don’t have a calendar you can add events to.")
143
+ }),
144
+ /* @__PURE__ */ h("div", {
145
+ className: "flex items-center gap-2",
146
+ children: [
147
+ /* @__PURE__ */ m(g, {
148
+ type: "button",
149
+ variant: "ghost",
150
+ onClick: () => O.openEventDialog({
151
+ date: D.date,
152
+ start: D.start,
153
+ end: D.end,
154
+ allDay: D.allDay,
155
+ calendarId: L?.id,
156
+ title: j.trim() || void 0
157
+ }),
158
+ children: k("calendar.v2.moreOptions", "More options")
159
+ }),
160
+ /* @__PURE__ */ m("span", { className: "flex-1" }),
161
+ /* @__PURE__ */ h(g, {
162
+ type: "submit",
163
+ disabled: !L || F,
164
+ children: [/* @__PURE__ */ m(u, { "aria-hidden": "true" }), k("calendar.v2.save", "Save")]
165
+ })
166
+ ]
167
+ })
168
+ ]
169
+ })
170
+ })]
171
+ });
172
+ }
173
+ export { D as QuickCreateHost };
174
+
175
+ //# sourceMappingURL=QuickCreate.js.map