@redvars/peacock 4.4.0 → 4.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/dist/{BaseField-Cj2rNVeC.js → BaseField-BbOj212R.js} +3 -3
  2. package/dist/{BaseField-Cj2rNVeC.js.map → BaseField-BbOj212R.js.map} +1 -1
  3. package/dist/{BaseInput-CSOLv2-i.js → BaseInput-Cv03GZLu.js} +2 -2
  4. package/dist/{BaseInput-CSOLv2-i.js.map → BaseInput-Cv03GZLu.js.map} +1 -1
  5. package/dist/ai-badge.js +2 -2
  6. package/dist/ai-summary.js +2 -2
  7. package/dist/alert.js +2 -2
  8. package/dist/anchor-nav.js +2 -2
  9. package/dist/app-shell.js +2 -2
  10. package/dist/assistant-panel.js +2 -2
  11. package/dist/assistant-step.js +2 -2
  12. package/dist/assistant-steps.js +2 -2
  13. package/dist/avatar-group.js +2 -2
  14. package/dist/banner.js +2 -2
  15. package/dist/{base-progress-DduJjUeq.js → base-progress-CqsyiVOV.js} +2 -2
  16. package/dist/{base-progress-DduJjUeq.js.map → base-progress-CqsyiVOV.js.map} +1 -1
  17. package/dist/bottom-sheet.js +2 -2
  18. package/dist/breadcrumb.js +2 -2
  19. package/dist/calendar-column-view.js +648 -30
  20. package/dist/calendar-column-view.js.map +1 -1
  21. package/dist/calendar-drag-IXMPZrTN.js +344 -0
  22. package/dist/calendar-drag-IXMPZrTN.js.map +1 -0
  23. package/dist/{calendar-event-_OYdAT3c.js → calendar-event-BQChlMXy.js} +15 -4
  24. package/dist/calendar-event-BQChlMXy.js.map +1 -0
  25. package/dist/calendar-header-DVrfThwr.js +59 -0
  26. package/dist/calendar-header-DVrfThwr.js.map +1 -0
  27. package/dist/calendar-month-view.js +311 -21
  28. package/dist/calendar-month-view.js.map +1 -1
  29. package/dist/calendar-timeline.js +1877 -0
  30. package/dist/calendar-timeline.js.map +1 -0
  31. package/dist/calendar.js +224 -62
  32. package/dist/calendar.js.map +1 -1
  33. package/dist/{canvas-base-Bfpv5_HJ.js → canvas-base-BjiU3Ecl.js} +2 -2
  34. package/dist/{canvas-base-Bfpv5_HJ.js.map → canvas-base-BjiU3Ecl.js.map} +1 -1
  35. package/dist/carousel.js +2 -2
  36. package/dist/{cartesian-chart-SnqFbbXV.js → cartesian-chart-iE3cmeGF.js} +2 -2
  37. package/dist/{cartesian-chart-SnqFbbXV.js.map → cartesian-chart-iE3cmeGF.js.map} +1 -1
  38. package/dist/{cb-group-base-DZIzMlen.js → cb-group-base-CWctDJvy.js} +2 -2
  39. package/dist/{cb-group-base-DZIzMlen.js.map → cb-group-base-CWctDJvy.js.map} +1 -1
  40. package/dist/cb-group.js +3 -3
  41. package/dist/cb-rule.js +3 -3
  42. package/dist/chart-area.js +4 -4
  43. package/dist/chart-bar.js +4 -4
  44. package/dist/{chart-base-C2N0WQLI.js → chart-base-CDyVDmz7.js} +2 -2
  45. package/dist/{chart-base-C2N0WQLI.js.map → chart-base-CDyVDmz7.js.map} +1 -1
  46. package/dist/chart-doughnut.js +3 -3
  47. package/dist/chart-line.js +4 -4
  48. package/dist/chart-pie.js +3 -3
  49. package/dist/chat-event.js +2 -2
  50. package/dist/chat-message.js +2 -2
  51. package/dist/chat-thread.js +2 -2
  52. package/dist/checkbox-group.js +3 -3
  53. package/dist/checkbox.js +3 -3
  54. package/dist/chip-set.js +2 -2
  55. package/dist/chip.js +2 -2
  56. package/dist/circular-progress.js +3 -3
  57. package/dist/citation.js +2 -2
  58. package/dist/code-editor.js +3 -3
  59. package/dist/code-highlighter.js +2 -2
  60. package/dist/color-field.js +4 -4
  61. package/dist/color-picker.js +2 -2
  62. package/dist/command-palette.js +2 -2
  63. package/dist/comment-composer.js +4 -4
  64. package/dist/condition-builder.js +3 -3
  65. package/dist/confirm-dialog.js +2 -2
  66. package/dist/copy-button.js +2 -2
  67. package/dist/currency-field.js +4 -4
  68. package/dist/custom-elements-jsdocs.json +52 -129
  69. package/dist/custom-elements.json +3109 -5
  70. package/dist/{date-vFrYT1S9.js → date-cfPx3alz.js} +20 -3
  71. package/dist/date-cfPx3alz.js.map +1 -0
  72. package/dist/date-field.js +8 -8
  73. package/dist/date-picker.js +4 -4
  74. package/dist/date-range-field.js +8 -8
  75. package/dist/datetime-field.js +7 -7
  76. package/dist/dependency-map.js +3 -3
  77. package/dist/description-item.js +2 -2
  78. package/dist/description-list.js +2 -2
  79. package/dist/{diagram-W_Kddt7I.js → diagram-D2aM93kf.js} +2 -2
  80. package/dist/{diagram-W_Kddt7I.js.map → diagram-D2aM93kf.js.map} +1 -1
  81. package/dist/diagram-controls.js +2 -2
  82. package/dist/diagram-minimap.js +2 -2
  83. package/dist/diagram.js +4 -4
  84. package/dist/diff-viewer.js +2 -2
  85. package/dist/discussion-activity.js +2 -2
  86. package/dist/discussion-comment.js +2 -2
  87. package/dist/discussion.js +4 -4
  88. package/dist/{document-editor-dBgmcyUW.js → document-editor-BS6al7Hq.js} +2 -2
  89. package/dist/{document-editor-dBgmcyUW.js.map → document-editor-BS6al7Hq.js.map} +1 -1
  90. package/dist/document-editor.js +3 -3
  91. package/dist/draft-card.js +2 -2
  92. package/dist/erd.js +3 -3
  93. package/dist/{event-manager-CWAWPOUE.js → event-manager-KGMT2x2Q.js} +10 -8
  94. package/dist/event-manager-KGMT2x2Q.js.map +1 -0
  95. package/dist/file-upload.js +3 -3
  96. package/dist/filter-bar.js +4 -4
  97. package/dist/flow.js +4 -4
  98. package/dist/form.js +2 -2
  99. package/dist/{generative-view-CfW6yMpY.js → generative-view-DsSOPf26.js} +2 -2
  100. package/dist/{generative-view-CfW6yMpY.js.map → generative-view-DsSOPf26.js.map} +1 -1
  101. package/dist/generative-view.js +3 -3
  102. package/dist/html-editor.js +4 -4
  103. package/dist/{i18n-controller-DNAjVSIP.js → i18n-controller-BTeChxE0.js} +2 -2
  104. package/dist/{i18n-controller-DNAjVSIP.js.map → i18n-controller-BTeChxE0.js.map} +1 -1
  105. package/dist/image.js +2 -2
  106. package/dist/index.js +26 -23
  107. package/dist/index.js.map +1 -1
  108. package/dist/inline-edit.js +2 -2
  109. package/dist/input.js +3 -3
  110. package/dist/json-viewer.js +2 -2
  111. package/dist/kanban.js +2 -2
  112. package/dist/kbd.js +2 -2
  113. package/dist/linear-progress.js +3 -3
  114. package/dist/listbox.js +2 -2
  115. package/dist/loader-full.js +13 -13
  116. package/dist/loader.js +17 -13
  117. package/dist/loader.js.map +1 -1
  118. package/dist/markdown-editor.js +4 -4
  119. package/dist/mention-input.js +4 -4
  120. package/dist/modal.js +2 -2
  121. package/dist/navigation-bar.js +2 -2
  122. package/dist/navigation-drawer.js +2 -2
  123. package/dist/navigation-rail.js +2 -2
  124. package/dist/notification-center.js +2 -2
  125. package/dist/number-field.js +4 -4
  126. package/dist/page-header.js +2 -2
  127. package/dist/pagination.js +2 -2
  128. package/dist/password-field.js +4 -4
  129. package/dist/password-rules.js +2 -2
  130. package/dist/phone-field.js +4 -4
  131. package/dist/{picker-field-Mi7_hbo8.js → picker-field-DmXYPvbF.js} +3 -3
  132. package/dist/{picker-field-Mi7_hbo8.js.map → picker-field-DmXYPvbF.js.map} +1 -1
  133. package/dist/pin-input.js +4 -4
  134. package/dist/presence-indicator.js +2 -2
  135. package/dist/prompt-input.js +4 -4
  136. package/dist/radio.js +3 -3
  137. package/dist/{range-utils-BoKOhxVX.js → range-utils-DZe96GnO.js} +2 -2
  138. package/dist/{range-utils-BoKOhxVX.js.map → range-utils-DZe96GnO.js.map} +1 -1
  139. package/dist/rating.js +3 -3
  140. package/dist/redvars-loader.js +2 -2
  141. package/dist/relative-time.js +2 -2
  142. package/dist/resizable-panels.js +2 -2
  143. package/dist/{rich-text-input-O1ku1q-J.js → rich-text-input-BCZ46UF8.js} +3 -3
  144. package/dist/{rich-text-input-O1ku1q-J.js.map → rich-text-input-BCZ46UF8.js.map} +1 -1
  145. package/dist/{schema-BWH1ANdE.js → schema-D0PCeIEA.js} +2 -2
  146. package/dist/{schema-BWH1ANdE.js.map → schema-D0PCeIEA.js.map} +1 -1
  147. package/dist/search.js +3 -3
  148. package/dist/select.js +4 -4
  149. package/dist/side-sheet.js +2 -2
  150. package/dist/signature-pad.js +3 -3
  151. package/dist/site-header.js +2 -2
  152. package/dist/slider.js +3 -3
  153. package/dist/snackbar.js +2 -2
  154. package/dist/sparkline.js +2 -2
  155. package/dist/split-button.js +2 -2
  156. package/dist/src/__internal/i18n/strings.d.ts +16 -0
  157. package/dist/src/__internal/utils/date.d.ts +5 -0
  158. package/dist/src/calendar/base-event.d.ts +5 -0
  159. package/dist/src/calendar/calendar-column-view.d.ts +65 -1
  160. package/dist/src/calendar/calendar-drag.d.ts +91 -0
  161. package/dist/src/calendar/calendar-header.d.ts +28 -0
  162. package/dist/src/calendar/calendar-month-view.d.ts +39 -1
  163. package/dist/src/calendar/calendar.d.ts +83 -6
  164. package/dist/src/calendar/index.d.ts +2 -2
  165. package/dist/src/calendar/types.d.ts +32 -0
  166. package/dist/src/calendar/utils.d.ts +53 -0
  167. package/dist/src/calendar-timeline/calendar-timeline.d.ts +287 -0
  168. package/dist/src/calendar-timeline/index.d.ts +3 -0
  169. package/dist/src/calendar-timeline/layout.d.ts +39 -0
  170. package/dist/src/calendar-timeline/types.d.ts +60 -0
  171. package/dist/src/index.d.ts +4 -2
  172. package/dist/stat.js +2 -2
  173. package/dist/status-indicator.js +2 -2
  174. package/dist/step.js +2 -2
  175. package/dist/stepper.js +2 -2
  176. package/dist/{strings-BpCoUL0V.js → strings-DeiQWMd9.js} +18 -1
  177. package/dist/strings-DeiQWMd9.js.map +1 -0
  178. package/dist/svg.js +2 -2
  179. package/dist/switch.js +3 -3
  180. package/dist/table.js +2 -2
  181. package/dist/test/calendar-timeline.test.d.ts +1 -0
  182. package/dist/textarea.js +4 -4
  183. package/dist/time-field.js +7 -7
  184. package/dist/time-picker.js +4 -4
  185. package/dist/timeline-item.js +2 -2
  186. package/dist/timeline.js +2 -2
  187. package/dist/{toggle-base-BRNNka2o.js → toggle-base-BtjRAZ5z.js} +2 -2
  188. package/dist/{toggle-base-BRNNka2o.js.map → toggle-base-BtjRAZ5z.js.map} +1 -1
  189. package/dist/tour.js +2 -2
  190. package/dist/transfer-list.js +3 -3
  191. package/dist/tree-chart.js +3 -3
  192. package/dist/tree-item.js +2 -2
  193. package/dist/tree.js +2 -2
  194. package/dist/tsconfig.tsbuildinfo +1 -1
  195. package/dist/typing-indicator.js +2 -2
  196. package/dist/url-field.js +4 -4
  197. package/dist/user-menu.js +2 -2
  198. package/dist/{utils-D92ldd1V.js → utils-DcvLgexs.js} +116 -19
  199. package/dist/utils-DcvLgexs.js.map +1 -0
  200. package/dist/{video-DBdRuyh4.js → video-DPjOBk6I.js} +2 -2
  201. package/dist/{video-DBdRuyh4.js.map → video-DPjOBk6I.js.map} +1 -1
  202. package/dist/video.js +3 -3
  203. package/dist/virtual-list.js +2 -2
  204. package/dist/workflow-timeline.js +2 -2
  205. package/dist/workflow.js +3 -3
  206. package/dist/workspace-switcher.js +2 -2
  207. package/package.json +1 -1
  208. package/readme.md +1 -0
  209. package/src/__internal/i18n/strings.ts +25 -0
  210. package/src/__internal/utils/date.ts +19 -0
  211. package/src/calendar/_calendar-header.scss +33 -0
  212. package/src/calendar/base-event.ts +19 -2
  213. package/src/calendar/calendar-column-view.scss +174 -2
  214. package/src/calendar/calendar-column-view.ts +665 -37
  215. package/src/calendar/calendar-drag.ts +403 -0
  216. package/src/calendar/calendar-header.ts +78 -0
  217. package/src/calendar/calendar-month-view.scss +89 -0
  218. package/src/calendar/calendar-month-view.ts +289 -23
  219. package/src/calendar/calendar.scss +2 -27
  220. package/src/calendar/calendar.ts +264 -62
  221. package/src/calendar/event-manager.ts +11 -7
  222. package/src/calendar/index.ts +8 -2
  223. package/src/calendar/types.ts +35 -0
  224. package/src/calendar/utils.ts +160 -20
  225. package/src/calendar-timeline/calendar-timeline.scss +564 -0
  226. package/src/calendar-timeline/calendar-timeline.ts +1528 -0
  227. package/src/calendar-timeline/index.ts +14 -0
  228. package/src/calendar-timeline/layout.ts +129 -0
  229. package/src/calendar-timeline/types.ts +65 -0
  230. package/src/index.ts +18 -0
  231. package/src/loader.ts +4 -0
  232. package/dist/calendar-event-_OYdAT3c.js.map +0 -1
  233. package/dist/date-vFrYT1S9.js.map +0 -1
  234. package/dist/event-manager-CWAWPOUE.js.map +0 -1
  235. package/dist/strings-BpCoUL0V.js.map +0 -1
  236. package/dist/utils-D92ldd1V.js.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import { LitElement, PropertyValues } from 'lit';
2
- import type { CalendarViewType, EventType } from './types.js';
2
+ import type { CalendarEventChangeDetail, CalendarViewType, EventType } from './types.js';
3
3
  import type { PeacockStrings } from '../__internal/i18n/strings.js';
4
+ export type { CalendarEventAddDetail, CalendarEventChangeAction, CalendarEventChangeDetail, } from './types.js';
4
5
  /** Detail of `date-change`. */
5
6
  export type CalendarDateChangeDetail = {
6
7
  /** The new context date. */
@@ -8,6 +9,14 @@ export type CalendarDateChangeDetail = {
8
9
  /** The same date as an ISO string, `YYYY-MM-DD`. */
9
10
  value: string;
10
11
  };
12
+ /**
13
+ * Applies an `event-change` to an `events` array the way the calendar does, returning a new array
14
+ * in which the event is replaced by a copy with the new `start` and `end`. The event is found by
15
+ * identity, else by `id`. The copy is made with object spread, so give the calendar plain objects,
16
+ * not class instances. Use it to apply a change you canceled, for example once the server has
17
+ * accepted it.
18
+ */
19
+ export declare function applyCalendarChange<T extends EventType>(events: readonly T[], change: Pick<CalendarEventChangeDetail, 'event' | 'start' | 'end'>): T[];
11
20
  /**
12
21
  * @label Calendar
13
22
  * @tag wc-calendar
@@ -16,10 +25,11 @@ export type CalendarDateChangeDetail = {
16
25
  *
17
26
  * @overview
18
27
  * <p>Pass events as the <code>events</code> property; each has a <code>start</code>,
19
- * <code>end</code>, <code>title</code> and optional palette <code>color</code>. The day and week
20
- * views lay timed events out in a column per day, with events lasting a day or more in a row
21
- * above; the month view shows six weeks. <code>available-views</code> sets the views offered in
22
- * the header's segmented buttons, and <code>view</code> the one shown.</p>
28
+ * <code>end</code>, <code>title</code> and optional palette <code>color</code>. <code>end</code> is
29
+ * exclusive: an all-day event on November 4 runs from midnight on the 4th to midnight on the 5th.
30
+ * The day and week views lay timed events out in a column per day, with events lasting a day or
31
+ * more in a row above; the month view shows six weeks. <code>available-views</code> sets the views
32
+ * offered in the header's segmented buttons, and <code>view</code> the one shown.</p>
23
33
  * <p>The header has a Today button, previous and next buttons and the current date, which is a
24
34
  * polite live region. <code>previous()</code>, <code>next()</code> and <code>today()</code> do the
25
35
  * same from code; each fires <code>date-change</code>. The date shown is <code>date</code> (an ISO
@@ -31,6 +41,22 @@ export type CalendarDateChangeDetail = {
31
41
  * <code>loading</code> shows a progress bar and marks the calendar busy. <code>first-day</code>
32
42
  * sets the week start (else the locale's), <code>timezone</code> the zone the current time is
33
43
  * shown in, and <code>locale</code> the language of names and times.</p>
44
+ * <p>With <code>editable</code>, people drag events to move them and drag their edges to change
45
+ * when they start or end: timed events in steps of <code>minute-step</code> minutes, all-day events
46
+ * and every event in the month view by whole days. Each drop fires the cancelable
47
+ * <code>event-change</code>; unless it is canceled, the calendar replaces <code>events</code> with
48
+ * a new array holding a copy of the event with its new times. To confirm a change with a server
49
+ * first, cancel the event and apply it later with <code>applyCalendarChange()</code>. An event with
50
+ * <code>editable: false</code> stays put, and <code>events-readonly</code> turns editing off. On
51
+ * touch screens, hold an event briefly before dragging it. Escape cancels a drag.</p>
52
+ * <p>With <code>addable</code>, dragging across empty time, or clicking it, fires
53
+ * <code>event-add</code> with the range: a click gives <code>default-duration</code> minutes, and
54
+ * the all-day row and the month view give whole days. The calendar does not add the event itself.
55
+ * It marks the range as a new event until <code>events</code> changes, the person presses Escape
56
+ * or starts another drag, or <code>clearPlaceholder()</code> is called, for example when a dialog
57
+ * asking for the event's title is canceled. Each change is announced to screen readers. Dragging
58
+ * needs a pointer, so offer another way to change an event's time too, such as the dialog that
59
+ * <code>event-click</code> opens.</p>
34
60
  *
35
61
  * @cssprop --calendar-border-color - Border color used throughout the calendar grid.
36
62
  * @cssprop --calendar-event-bg-color - Background color for calendar events.
@@ -39,11 +65,28 @@ export type CalendarDateChangeDetail = {
39
65
  * @fires {CustomEvent<{event: EventType}>} event-click - An event was clicked, or chosen with Enter or Space. Detail contains `{ event }`. Not fired with `events-readonly`.
40
66
  * @fires {CustomEvent<{view: string}>} view-change - The view changed. Detail contains `{ view }`.
41
67
  * @fires {CustomEvent<{date: Date, value: string}>} date-change - The context date changed. Detail contains `{ date, value }`: the `Date` and its ISO string.
68
+ * @fires {CustomEvent<CalendarEventChangeDetail>} event-change - An event was dragged to a new time (`action: 'move'`) or had its start or end dragged (`action: 'resize'`). Detail contains `{ event, start, end, action }`, where `event` is the object from `events` as it was. Cancelable: cancel it to keep the event where it was. Only with `editable`.
69
+ * @fires {CustomEvent<CalendarEventAddDetail>} event-add - Empty time was dragged across or clicked. Detail contains `{ start, end, allDay }`. Only with `addable`.
42
70
  *
43
71
  * @example
44
72
  * ```html
45
73
  * <wc-calendar view="week" date="2026-11-06" style="height: 600px"></wc-calendar>
46
74
  * ```
75
+ *
76
+ * @example
77
+ * ```html
78
+ * <wc-calendar id="planner" view="week" editable addable style="height: 600px"></wc-calendar>
79
+ * <script>
80
+ * const planner = document.getElementById('planner');
81
+ * planner.events = [
82
+ * { id: 1, title: 'Standup', start: new Date(2026, 10, 4, 9), end: new Date(2026, 10, 4, 9, 30) },
83
+ * ];
84
+ * planner.addEventListener('event-change', event => console.log(event.detail));
85
+ * planner.addEventListener('event-add', ({ detail }) => {
86
+ * planner.events = [...planner.events, { id: Date.now(), title: 'New event', ...detail }];
87
+ * });
88
+ * </script>
89
+ * ```
47
90
  */
48
91
  export declare class Calendar extends LitElement {
49
92
  static styles: import("lit").CSSResultGroup[];
@@ -71,6 +114,20 @@ export declare class Calendar extends LitElement {
71
114
  firstDay?: number;
72
115
  /** Events are shown but cannot be clicked or focused, and `event-click` does not fire. */
73
116
  eventsReadonly: boolean;
117
+ /**
118
+ * People can drag events to move them and drag their edges to resize them. Each drop fires the
119
+ * cancelable `event-change`. An event with `editable: false` stays put.
120
+ */
121
+ editable: boolean;
122
+ /**
123
+ * Dragging across empty time, or clicking it, fires `event-add` with the range and marks it as a
124
+ * new event until `events` changes.
125
+ */
126
+ addable: boolean;
127
+ /** Minutes that dragging moves, resizes and draws timed events by. Defaults to 15. */
128
+ minuteStep: number;
129
+ /** Length in minutes of an event added by clicking empty time in the day or week view. Defaults to 60. */
130
+ defaultDuration: number;
74
131
  /** Shows a progress bar and marks the calendar busy while events load. */
75
132
  loading: boolean;
76
133
  /** IANA time zone the current time is shown in, for example `America/New_York`. Defaults to the browser's. */
@@ -86,9 +143,12 @@ export declare class Calendar extends LitElement {
86
143
  private _currentTime;
87
144
  /** The entry of `availableViews` matching `view`. */
88
145
  private _currentView;
146
+ /** The range of the last `event-add`, marked as a new event until the app adds it. */
147
+ private _placeholder;
89
148
  /** Peacock's strings and the resolved locale. */
90
149
  private readonly _i18n;
91
150
  connectedCallback(): void;
151
+ disconnectedCallback(): void;
92
152
  willUpdate(changed: PropertyValues<this>): void;
93
153
  /** Moves back one period: a day or week in column views, a month in the month view. */
94
154
  previous(): void;
@@ -96,6 +156,11 @@ export declare class Calendar extends LitElement {
96
156
  next(): void;
97
157
  /** Moves the view to today, in `timezone`. */
98
158
  today(): void;
159
+ /**
160
+ * Removes the new event marked after `event-add`, for when adding it is canceled. It also goes
161
+ * when `events` changes.
162
+ */
163
+ clearPlaceholder(): void;
99
164
  /** Now, as wall-clock time in `timezone`. */
100
165
  private _now;
101
166
  /** Keeps `date` and `contextDate` in step; `date` wins when both changed. */
@@ -104,11 +169,23 @@ export declare class Calendar extends LitElement {
104
169
  private _weekStart;
105
170
  /** Whether events can be clicked: not `events-readonly`. */
106
171
  private _eventsInteractive;
172
+ /** Whether events can be dragged: `editable` and not `events-readonly`. */
173
+ private _eventsEditable;
107
174
  private _step;
108
175
  private _setContextDate;
176
+ /**
177
+ * Reads `message` in the live region. Its text is set directly, so an announcement does not
178
+ * render the calendar, and its views, again.
179
+ */
180
+ private _announce;
181
+ private readonly _handlePointerDown;
182
+ private readonly _handleKeyDown;
183
+ private readonly _handleWindowKeyDown;
109
184
  private _onViewDateClick;
110
185
  private _onViewEventClick;
111
- private _onViewSegmentChange;
186
+ private _onViewEventChange;
187
+ private _onViewEventAdd;
188
+ private _changeView;
112
189
  /** The view's own label, else Peacock's string for the built-in views, else its value. */
113
190
  private _viewLabel;
114
191
  private _renderHeader;
@@ -1,5 +1,5 @@
1
- export { Calendar } from './calendar.js';
1
+ export { Calendar, applyCalendarChange } from './calendar.js';
2
2
  export type { CalendarDateChangeDetail } from './calendar.js';
3
3
  export { CalendarColumnView } from './calendar-column-view.js';
4
4
  export { CalendarMonthView } from './calendar-month-view.js';
5
- export type { CalendarViewType, EventType } from './types.js';
5
+ export type { CalendarViewType, EventType, CalendarEventAddDetail, CalendarEventChangeAction, CalendarEventChangeDetail, } from './types.js';
@@ -6,9 +6,41 @@ export type CalendarViewType = {
6
6
  days?: number;
7
7
  };
8
8
  export type EventType = {
9
+ /**
10
+ * When the event starts. An event lasting a day or more, or running from one midnight to
11
+ * another, is shown in the all-day row.
12
+ */
9
13
  start: Date;
14
+ /** When the event ends, exclusive: an all-day event on November 4 ends at midnight on November 5. */
10
15
  end: Date;
11
16
  title: string;
17
+ /** A palette color name, such as `blue` or `green`. */
12
18
  color?: string;
19
+ /** Identifies the event, so `applyCalendarChange()` finds it after the array was replaced. */
20
+ id?: string | number;
21
+ /** `false` keeps this event in place when the calendar is `editable`. */
22
+ editable?: boolean;
13
23
  [key: string]: any;
14
24
  };
25
+ /** How an `event-change` changed the event. */
26
+ export type CalendarEventChangeAction = 'move' | 'resize';
27
+ /** Detail of `event-change`. */
28
+ export type CalendarEventChangeDetail = {
29
+ /** The event as it was, the object from `events`. */
30
+ event: EventType;
31
+ /** The new start. */
32
+ start: Date;
33
+ /** The new end. */
34
+ end: Date;
35
+ /** `move` when the event was dragged, `resize` when its start or end was. */
36
+ action: CalendarEventChangeAction;
37
+ };
38
+ /** Detail of `event-add`. */
39
+ export type CalendarEventAddDetail = {
40
+ /** Start of the range the person drew or clicked. */
41
+ start: Date;
42
+ /** End of the range, exclusive: midnight after the last day of an all-day range. */
43
+ end: Date;
44
+ /** Whether the range is whole days, drawn in the all-day row or the month view. */
45
+ allDay: boolean;
46
+ };
@@ -27,6 +27,48 @@ export declare function calculateDateRange(view: string, contextDate: Date, days
27
27
  totalDays: number;
28
28
  };
29
29
  export declare const LONG_EVENT_PADDING = 0.25;
30
+ /** Milliseconds in a day of 24 hours. */
31
+ export declare const DAY_MS = 86400000;
32
+ /** Milliseconds in a minute. */
33
+ export declare const MINUTE_MS = 60000;
34
+ export declare function clamp(value: number, min: number, max: number): number;
35
+ /** Whether `date` is at local midnight. */
36
+ export declare function isMidnight(date: Date): boolean;
37
+ /**
38
+ * Whether a range belongs in the all-day row: it lasts a day or more, or runs from one midnight to
39
+ * a later one (a day the clocks go forward on has only 23 hours).
40
+ */
41
+ export declare function isAllDayRange(start: Date, end: Date): boolean;
42
+ /**
43
+ * The last day a range covers. `end` is exclusive, so a range that ends at midnight ends the day
44
+ * before. Never earlier than the day of `start`.
45
+ */
46
+ export declare function lastDayOf(start: Date, end: Date): Date;
47
+ /**
48
+ * Whether the range `start`–`end` (end exclusive) shares time with `from`–`to`. A range without
49
+ * length counts when its instant falls inside.
50
+ */
51
+ export declare function rangesOverlap(start: Date, end: Date, from: Date, to: Date): boolean;
52
+ /**
53
+ * The start of the day after `date`'s. Unlike `addDays(day, 1)`, it lands on midnight even after a
54
+ * day whose midnight the clocks skipped, where `startOfDay` gives 01:00.
55
+ */
56
+ export declare function nextDay(date: Date): Date;
57
+ /**
58
+ * Wall-clock minutes from the start of `day` to `date`: negative before it, 1440 or more after
59
+ * it. The day and week views draw 24 equal hours, also on the days the clocks change.
60
+ */
61
+ export declare function wallMinutes(date: Date, day: Date): number;
62
+ /** The time `minutes` after the start of `day` on the wall clock; 1440 is the next midnight. */
63
+ export declare function atWallMinutes(day: Date, minutes: number): Date;
64
+ /** The time at `fraction` (0 to 1) down `day`'s column: the inverse of `getTimePercent`. */
65
+ export declare function timeAtFraction(day: Date, fraction: number): Date;
66
+ /**
67
+ * `date` moved to a multiple of `minutes` on the wall clock after the start of `day` (by default
68
+ * its own day): the nearest one, or the one before or after. The result stays within `day`, whose
69
+ * end is the next midnight.
70
+ */
71
+ export declare function snapTime(date: Date, minutes: number, mode?: 'round' | 'floor' | 'ceil', day?: Date): Date;
30
72
  /** Wall-clock date and time fields; `month` is 1–12. */
31
73
  export type WallClockParts = {
32
74
  year: number;
@@ -51,8 +93,19 @@ export declare function toZonedWallClock(date: Date, timeZone: string): Date;
51
93
  * their own month and day names, order and clock. `dd-MM-yyyy` is a fixed key, not display text.
52
94
  */
53
95
  export declare function formatDate(date: Date, pattern: string, locale?: string): string;
96
+ /**
97
+ * When an event happens, for example `Nov 6, 2026, 9:00 – 9:30 AM`. An all-day event shows its
98
+ * days only, through the day before an `end` at midnight.
99
+ */
100
+ export declare function formatEventWhen(start: Date, end: Date, locale: string, allDay?: boolean): string;
101
+ /** The times of a range without its date, for example `9:00 – 10:30 AM`. */
102
+ export declare function formatTimeRange(start: Date, end: Date, locale: string): string;
54
103
  /** Accessible name of an event: its title and when it happens, for example `Standup, Nov 6, 2026, 9:00 – 9:30 AM`. */
55
104
  export declare function formatEventLabel(title: string, start: Date, end: Date, locale: string, allDay?: boolean): string;
56
105
  /** Runs `action` on Enter or Space, the keys that activate a button. */
57
106
  export declare function onActivateKey(action: () => void): (event: KeyboardEvent) => void;
107
+ /**
108
+ * How far down `forDay`'s column (by default `date`'s own day) `date` falls, in percent, on a
109
+ * 24-hour wall clock: a 9:00 event sits at the 9 AM row also on the days the clocks change.
110
+ */
58
111
  export declare function getTimePercent(date: Date, forDay?: Date): number;
@@ -0,0 +1,287 @@
1
+ import { LitElement, type PropertyValues } from 'lit';
2
+ import type { PeacockStrings } from '../__internal/i18n/strings.js';
3
+ import type { CalendarTimelineEvent, CalendarTimelineEventChangeDetail, CalendarTimelineResource, CalendarTimelineViewType } from './types.js';
4
+ export type { CalendarTimelineEvent, CalendarTimelineEventAddDetail, CalendarTimelineEventChangeAction, CalendarTimelineEventChangeDetail, CalendarTimelineGroupToggleDetail, CalendarTimelineResource, CalendarTimelineViewType, } from './types.js';
5
+ /** Detail of `date-change`. */
6
+ export type CalendarTimelineDateChangeDetail = {
7
+ /** The new context date. */
8
+ date: Date;
9
+ /** The same date as an ISO string, `YYYY-MM-DD`. */
10
+ value: string;
11
+ };
12
+ /**
13
+ * Applies an `event-change` to an `events` array the way the timeline does, returning a new array in
14
+ * which the event is replaced by a copy with the new `start`, `end` and `resourceId`. The event is
15
+ * found by identity, else by `id`. The copy is made with object spread, so give the timeline plain
16
+ * objects. Use it to apply a change you canceled, for example once the server has accepted it.
17
+ */
18
+ export declare function applyCalendarTimelineChange<T extends CalendarTimelineEvent>(events: readonly T[], change: Pick<CalendarTimelineEventChangeDetail, 'event' | 'start' | 'end' | 'resourceId'>): T[];
19
+ /**
20
+ * @label Calendar Timeline
21
+ * @tag wc-calendar-timeline
22
+ * @rawTag calendar-timeline
23
+ * @summary Resources such as people, rooms or machines as rows against a horizontal time axis, with events that can be dragged between times and rows.
24
+ *
25
+ * @overview
26
+ * <p>Pass the rows as <code>resources</code> (<code>{ id, title, supportingText? }</code>) and the
27
+ * events as <code>events</code>: the calendar's event objects with a <code>resourceId</code>. An
28
+ * event whose <code>resourceId</code> matches no resource is not shown, and <code>end</code> is
29
+ * exclusive, as in <code>wc-calendar</code>.</p>
30
+ * <p>Each entry of <code>available-views</code> is <code>{ value, label?, slot, days? }</code>:
31
+ * <code>slot</code> is what a column stands for, <code>hour</code> or <code>day</code>, and without
32
+ * <code>days</code> the view is a calendar month. The defaults are <code>day</code> (24 hour
33
+ * columns), <code>week</code> (7 day columns from the week's first day) and <code>month</code>. In
34
+ * hour views an event is drawn from its start to its end; in day views it covers the days it
35
+ * touches. Events that overlap in a row stack in lanes. Columns share the width, never narrower
36
+ * than <code>--calendar-timeline-hour-width</code> or <code>--calendar-timeline-day-width</code>, and a
37
+ * range that does not fit scrolls sideways under a header and a resource column that stay in
38
+ * place. A line marks the current time.</p>
39
+ * <p>The header, <code>date</code>, <code>contextDate</code>, <code>view</code>,
40
+ * <code>first-day</code>, <code>timezone</code>, <code>locale</code>, <code>previous()</code>,
41
+ * <code>next()</code> and <code>today()</code> work as in <code>wc-calendar</code>, so the two can
42
+ * share a view switcher and a date.</p>
43
+ * <p>With <code>editable</code>, people drag an event to another time or another resource's row,
44
+ * and drag its edges to resize it: in steps of <code>minute-step</code> minutes in hour views, by
45
+ * whole days in day views. Each drop fires the cancelable <code>event-change</code>, with the new
46
+ * <code>resourceId</code>; unless it is canceled, the timeline replaces <code>events</code> with a new
47
+ * array holding a copy of the event. To confirm a change with a server first, cancel the event and
48
+ * apply it later with <code>applyCalendarTimelineChange()</code>. With <code>addable</code>, dragging
49
+ * across empty time in a row, or clicking it, fires <code>event-add</code>; the range stays marked
50
+ * as a new event until <code>events</code> changes or <code>clearPlaceholder()</code> is called.
51
+ * An event with <code>editable: false</code> stays put, and <code>events-readonly</code> turns
52
+ * editing off.</p>
53
+ * <p><code>group-by</code> names a resource field, such as <code>team</code>, to group the rows by.
54
+ * Groups keep the order they first appear in, and resources without the field form an
55
+ * "(Empty)" group. Each group has a header row whose button collapses or expands it and fires
56
+ * <code>group-toggle</code>; <code>collapsed-groups</code> holds the keys of the collapsed groups,
57
+ * their values as strings. A collapsed group's header shows its events as thin bars, so its busy
58
+ * times stay in sight. Events can be dragged between rows of different groups.</p>
59
+ * <p>The timeline is a table: a row per resource, with the resource's title as its row header and its
60
+ * events in its cell. Events are buttons, named with their title, resource and time, that fire
61
+ * <code>event-click</code>. Changes are announced to screen readers. Dragging needs a pointer, so
62
+ * offer another way to change an event too, such as the dialog <code>event-click</code> opens.</p>
63
+ *
64
+ * @cssprop --calendar-timeline-resource-width - Width of the resource column. Defaults to `12rem`.
65
+ * @cssprop --calendar-timeline-hour-width - Narrowest an hour column gets before the timeline scrolls. Defaults to `4rem`.
66
+ * @cssprop --calendar-timeline-day-width - Narrowest a day column gets before the timeline scrolls. Defaults to `3rem`.
67
+ * @cssprop --calendar-timeline-lane-height - Height of each lane of events in a row. Defaults to `2rem`.
68
+ * @cssprop --calendar-timeline-border-color - Color of the grid lines.
69
+ * @cssprop --calendar-timeline-event-bg-color - Background color of events without a `color`.
70
+ * @cssprop --calendar-timeline-event-border-color - Start border color of events without a `color`.
71
+ *
72
+ * @fires {CustomEvent<{event: CalendarTimelineEvent}>} event-click - An event was clicked, or chosen with Enter or Space. Detail contains `{ event }`. Not fired with `events-readonly`.
73
+ * @fires {CustomEvent<{view: string}>} view-change - The view changed. Detail contains `{ view }`.
74
+ * @fires {CustomEvent<CalendarTimelineDateChangeDetail>} date-change - The context date changed. Detail contains `{ date, value }`: the `Date` and its ISO string.
75
+ * @fires {CustomEvent<CalendarTimelineEventChangeDetail>} event-change - An event was dragged to a new time or row (`action: 'move'`), or had its start or end dragged (`action: 'resize'`). Detail contains `{ event, start, end, resourceId, action }`, where `event` is the object from `events` as it was. Cancelable: cancel it to keep the event where it was. Only with `editable`.
76
+ * @fires {CustomEvent<CalendarTimelineEventAddDetail>} event-add - Empty time in a row was dragged across or clicked. Detail contains `{ start, end, allDay, resourceId }`. Only with `addable`.
77
+ * @fires {CustomEvent<CalendarTimelineGroupToggleDetail>} group-toggle - A group was collapsed or expanded with its header's button. Detail contains `{ group, expanded }`.
78
+ *
79
+ * @example
80
+ * ```html
81
+ * <wc-calendar-timeline id="rooms" view="day" resource-label="Rooms" editable addable style="height: 24rem"></wc-calendar-timeline>
82
+ * <script>
83
+ * const rooms = document.getElementById('rooms');
84
+ * rooms.resources = [
85
+ * { id: 'aspen', title: 'Aspen', supportingText: '8 seats' },
86
+ * { id: 'birch', title: 'Birch', supportingText: '4 seats' },
87
+ * ];
88
+ * rooms.events = [
89
+ * { id: 1, resourceId: 'aspen', title: 'Design review', start: new Date(2026, 10, 4, 9), end: new Date(2026, 10, 4, 10) },
90
+ * ];
91
+ * rooms.addEventListener('event-change', event => console.log(event.detail));
92
+ * </script>
93
+ * ```
94
+ */
95
+ export declare class CalendarTimeline extends LitElement {
96
+ static styles: import("lit").CSSResultGroup[];
97
+ /** The rows, in order. */
98
+ resources: CalendarTimelineResource[];
99
+ /** The events. Each one is shown in the row of the resource its `resourceId` names. */
100
+ events: CalendarTimelineEvent[];
101
+ /**
102
+ * The views offered in the header. A view without a `label` shows Peacock's `day`, `week` or
103
+ * `month` string for those values, else its `value`.
104
+ */
105
+ availableViews: CalendarTimelineViewType[];
106
+ /** The view shown: the `value` of one of `availableViews`. */
107
+ view: string;
108
+ /**
109
+ * The date the view shows, as an ISO string (`YYYY-MM-DD`). Kept in step with `contextDate`.
110
+ * Defaults to today.
111
+ */
112
+ date: string;
113
+ /** The date the view shows, as a `Date`. Kept in step with `date`. */
114
+ contextDate: Date | null;
115
+ /** First day of the week, `0` (Sunday) to `6` (Saturday). Defaults to the locale's week start. */
116
+ firstDay?: number;
117
+ /** Header of the resource column, such as "Rooms" or "People". Defaults to "Resources". */
118
+ resourceLabel: string;
119
+ /**
120
+ * A resource field to group the rows by, such as `team`. Each group gets a header row that
121
+ * collapses it. Groups keep the order they first appear in.
122
+ */
123
+ groupBy: string;
124
+ /** Keys of the collapsed groups: their `group-by` values as strings (`""` for resources without one). */
125
+ collapsedGroups: string[];
126
+ /** Events are shown but cannot be clicked or focused, and `event-click` does not fire. */
127
+ eventsReadonly: boolean;
128
+ /**
129
+ * People can drag events to other times and rows, and drag their edges to resize them. Each drop
130
+ * fires the cancelable `event-change`. An event with `editable: false` stays put.
131
+ */
132
+ editable: boolean;
133
+ /**
134
+ * Dragging across empty time in a row, or clicking it, fires `event-add` with the range and
135
+ * marks it as a new event until `events` changes.
136
+ */
137
+ addable: boolean;
138
+ /** Minutes that dragging moves, resizes and draws events by in hour views. Defaults to 15. */
139
+ minuteStep: number;
140
+ /** Length in minutes of an event added by clicking empty time in an hour view. Defaults to 60. */
141
+ defaultDuration: number;
142
+ /** Shows a progress bar and marks the timeline busy while events load. */
143
+ loading: boolean;
144
+ /** IANA time zone the current time is shown in, for example `America/New_York`. Defaults to the browser's. */
145
+ timezone: string;
146
+ /**
147
+ * Locale for day names and times. Defaults to the nearest `lang`, then the browser language.
148
+ */
149
+ locale: string;
150
+ /** Overrides Peacock's strings for this instance only. */
151
+ strings?: Partial<PeacockStrings>;
152
+ /** Now, as wall-clock time in `timezone`. */
153
+ private _currentTime;
154
+ /** The drag in progress, where it would put its event. */
155
+ private _preview;
156
+ /** The range of the last `event-add`, marked as a new event until the app adds it. */
157
+ private _placeholder;
158
+ /** Peacock's strings and the resolved locale. */
159
+ private readonly _i18n;
160
+ /** The days shown. */
161
+ private _range;
162
+ /** The rows, laid out before each render, in the order of `resources`. */
163
+ private _rows;
164
+ /** The rows by `group-by` value, when grouped. */
165
+ private _groups;
166
+ /** Whether to scroll the axis to now, or to the morning, after the next render. */
167
+ private _scrollPending;
168
+ private readonly _drag;
169
+ connectedCallback(): void;
170
+ disconnectedCallback(): void;
171
+ willUpdate(changed: PropertyValues<this>): void;
172
+ updated(): void;
173
+ /** Moves back one period: the view's number of days, or a month. */
174
+ previous(): void;
175
+ /** Moves forward one period: the view's number of days, or a month. */
176
+ next(): void;
177
+ /** Moves the view to today, in `timezone`. */
178
+ today(): void;
179
+ /**
180
+ * Removes the new event marked after `event-add`, for when adding it is canceled. It also goes
181
+ * when `events` changes.
182
+ */
183
+ clearPlaceholder(): void;
184
+ /** The entry of `availableViews` matching `view`. */
185
+ private get _view();
186
+ /** What a column of the current view stands for. */
187
+ private get _slot();
188
+ /** `minuteStep` when it is a whole number of minutes in a day, else 15. */
189
+ private get _step();
190
+ /** `defaultDuration` when it is a positive number of minutes, else 60. */
191
+ private get _duration();
192
+ /** Now, as wall-clock time in `timezone`. */
193
+ private _now;
194
+ /** Keeps `date` and `contextDate` in step; `date` wins when both changed. */
195
+ private _syncDate;
196
+ /** The week start in effect: `firstDay` when valid, else the locale's. */
197
+ private _weekStart;
198
+ /** Whether events can be dragged: `editable` and not `events-readonly`. */
199
+ private _eventsEditable;
200
+ /** Whether an event can be dragged: the timeline is editable and the event did not opt out. */
201
+ private _canEdit;
202
+ /** Each resource's events within the range, in lanes. */
203
+ private _layout;
204
+ /** The rows by their `group-by` value, in the order each value first appears. */
205
+ private _groupsOf;
206
+ /** `collapsedGroups` as strings. */
207
+ private _collapsedKeys;
208
+ /** Collapses or expands a group, and fires `group-toggle`. */
209
+ private _toggleGroup;
210
+ private _shift;
211
+ private _setContextDate;
212
+ private _changeView;
213
+ /** The view's own label, else Peacock's string for the built-in views, else its value. */
214
+ private _viewLabel;
215
+ /** The days shown, for the header and the table's name. */
216
+ private _rangeLabel;
217
+ /** Custom properties that colour an event with a palette `color`. */
218
+ private _colorVars;
219
+ private _styleMap;
220
+ /** The `inset-inline-start` and `width` of something spanning `span` of the axis. */
221
+ private _position;
222
+ /** When an event happens, for its accessible name and the live region. */
223
+ private _when;
224
+ /** The time an event shows after its title: its times in hour views, its start in day views. */
225
+ private _timeText;
226
+ /**
227
+ * Reads `message` in the live region. Its text is set directly, so an announcement does not
228
+ * render the timeline again.
229
+ */
230
+ private _announce;
231
+ /** Scrolls the axis to just before now when it is in range, else to the morning or the start. */
232
+ private _scrollAxis;
233
+ /** Minutes along the axis at viewport `x`; the axis runs from the inline start. */
234
+ private _axisAt;
235
+ /** The time at viewport `x`. */
236
+ private _timeAt;
237
+ /** The day at viewport `x`, at midnight. */
238
+ private _dayAt;
239
+ /**
240
+ * The index of the row at viewport `y`, or of the nearest shown; -1 without rows. Rows of
241
+ * collapsed groups are not shown, so each track names its row.
242
+ */
243
+ private _rowAt;
244
+ /** The time a press at `x` starts from: the day in day views. */
245
+ private _pressTime;
246
+ private _onEventPointerDown;
247
+ private _onTrackPointerDown;
248
+ /** Where the drag of `press` would put its event with the pointer at `point`. */
249
+ private _previewFor;
250
+ /** The range a drag in an hour view gives, snapped to `minuteStep` and kept in the range. */
251
+ private _hourRange;
252
+ private _follow;
253
+ private _drop;
254
+ /** A click on empty time adds an event there: `defaultDuration` long, or the whole day. */
255
+ private _tap;
256
+ /** Fires `event-change` and, unless it is canceled, applies and announces it. */
257
+ private _change;
258
+ /** Marks the range as a new event, fires `event-add` and announces it. */
259
+ private _add;
260
+ /**
261
+ * Blurs the focused event when a drag starts. The drop redraws the events, and the element that
262
+ * held focus could then show another event, which Enter would open.
263
+ */
264
+ private _blurFocused;
265
+ private readonly _handlePointerDown;
266
+ private readonly _handleKeyDown;
267
+ private readonly _handleWindowKeyDown;
268
+ /** Classes of the scroller, which set the cursor during a drag. */
269
+ private _scrollerClasses;
270
+ private _renderHeader;
271
+ /** The column labels: hours (under their days when there are several), or days. */
272
+ private _renderTimeHeader;
273
+ /** Today, weekends and day boundaries behind every row, and the current-time line. */
274
+ private _renderOverlay;
275
+ private _renderEvent;
276
+ /** A new or moved event where the drag would put it in this row, or the placeholder. */
277
+ private _renderRowPreview;
278
+ private _renderRow;
279
+ /** A collapsed group's events as thin bars, so its busy times stay in sight. */
280
+ private _renderGroupSummary;
281
+ /** A group's header row, then its rows unless it is collapsed. */
282
+ private _renderGroup;
283
+ /** The rows, under their groups' headers when grouped. */
284
+ private _renderRows;
285
+ private _renderGrid;
286
+ render(): import("lit-html").TemplateResult<1>;
287
+ }
@@ -0,0 +1,3 @@
1
+ export { CalendarTimeline, applyCalendarTimelineChange, } from './calendar-timeline.js';
2
+ export type { CalendarTimelineDateChangeDetail } from './calendar-timeline.js';
3
+ export type { CalendarTimelineEvent, CalendarTimelineEventAddDetail, CalendarTimelineEventChangeAction, CalendarTimelineEventChangeDetail, CalendarTimelineGroupToggleDetail, CalendarTimelineResource, CalendarTimelineViewType, } from './types.js';
@@ -0,0 +1,39 @@
1
+ import type { WeekDay } from '../__internal/utils/date.js';
2
+ import type { CalendarTimelineViewType } from './types.js';
3
+ /** Minutes in a day on the wall clock. */
4
+ export declare const DAY_MINUTES = 1440;
5
+ /** The days a view shows: `days` days from the midnight of `start`. */
6
+ export interface TimelineRange {
7
+ start: Date;
8
+ days: number;
9
+ }
10
+ /** Where an item sits on the axis, in minutes from the start of the range. */
11
+ export interface AxisSpan {
12
+ from: number;
13
+ to: number;
14
+ }
15
+ /** The days `view` shows around `date`: a calendar month when it has no `days`. */
16
+ export declare function viewRange(view: CalendarTimelineViewType, date: Date, weekStartsOn: WeekDay): TimelineRange;
17
+ /** Minutes on the axis of the whole range. */
18
+ export declare function axisLength(range: TimelineRange): number;
19
+ /** The midnight that ends the range. */
20
+ export declare function rangeEnd(range: TimelineRange): Date;
21
+ /** The day `index` days into the range, at midnight. */
22
+ export declare function dayOfRange(range: TimelineRange, index: number): Date;
23
+ /** Wall-clock minutes from the start of the range to `date`: negative before it, not clamped. */
24
+ export declare function axisMinutes(range: TimelineRange, date: Date): number;
25
+ /** The time `minutes` along the axis, kept within the range. */
26
+ export declare function dateAtAxis(range: TimelineRange, minutes: number): Date;
27
+ /**
28
+ * Where an event sits on the axis, within the range: from its start to its end in hour views, and
29
+ * over the whole days it touches in day views.
30
+ */
31
+ export declare function eventSpan(range: TimelineRange, slot: CalendarTimelineViewType['slot'], start: Date, end: Date): AxisSpan;
32
+ /**
33
+ * Lanes for the events of a row: each takes the first lane that is free when it starts, so
34
+ * events that only touch share a lane. `lanes` is at least 1.
35
+ */
36
+ export declare function assignLanes<T extends AxisSpan>(items: readonly T[]): {
37
+ lanes: number;
38
+ laneOf: Map<T, number>;
39
+ };