@nxgt/material 3.92.0 → 3.93.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +2 -2
- package/dist/{alert-dialog-Bz5PlYKp.js → alert-dialog-D37eph4I.js} +1 -1
- package/dist/{async-slice-veSVxKqt.js → async-slice-BSqwhAj-.js} +1 -1
- package/dist/{button-a3tH3pq4.js → button-CG9SBAT-.js} +1 -1
- package/dist/{calculator-BtuKV3PK.js → calculator-YD3I3y-I.js} +10 -10
- package/dist/calculator-field.js +6 -6
- package/dist/{calculator-segment-CyB9IhEq.js → calculator-segment-Cjec9zi7.js} +1 -1
- package/dist/calculator.js +1 -1
- package/dist/charts.js +3 -3
- package/dist/{chip-BwGvGx_S.js → chip-BbUSBl3i.js} +2 -2
- package/dist/{code-editor-BLkmEoCi.js → code-editor-ZEM7AAcs.js} +4 -4
- package/dist/code-editor.js +4 -4
- package/dist/{code-language-items-DhAC_tCs.js → code-language-items-CAuHPrHd.js} +2 -2
- package/dist/components/components.css +1 -0
- package/dist/components/ui/widgets/event-calendar/event-calendar-backdrop.css +43 -0
- package/dist/{components-DX4aHtgP.js → components-CuFTrmGy.js} +19654 -19043
- package/dist/components.js +38 -38
- package/dist/{conversion-variant-C4t7aH9d.js → conversion-variant-DmEtTCSP.js} +3 -3
- package/dist/{currency-field-D0UQb5pn.js → currency-field-CabGnVO9.js} +5 -5
- package/dist/{dialog-vQMypIOm.js → dialog-Jhpx6ulb.js} +3 -3
- package/dist/dnd.js +1 -1
- package/dist/{dropdown-menu-B2ctUFti.js → dropdown-menu-nl0Q3tQ2.js} +1 -1
- package/dist/editor.js +7 -7
- package/dist/{empty-state-Bs44jnWk.js → empty-state-mrJuqph3.js} +1 -1
- package/dist/{financial-variant-B5iZ3pYf.js → financial-variant-P8gFA9aI.js} +5 -5
- package/dist/{hooks-CJtRFDYD.js → hooks-CjSpziWf.js} +2 -2
- package/dist/hooks.js +2 -2
- package/dist/{hover-card-B8PYUsv_.js → hover-card-BNb1M8ij.js} +1 -1
- package/dist/i18n.js +3 -3
- package/dist/{icon-badge-YT98b2Vx.js → icon-badge-CVMHwdFm.js} +1 -1
- package/dist/{icon-button-BylI02aX.js → icon-button-Ch0PThsa.js} +1 -1
- package/dist/{input-group-CiayHfBN.js → input-group-CPMSQcBx.js} +1 -1
- package/dist/lib/components/ui/collections/day-grouped-list/index.d.ts +6 -0
- package/dist/lib/components/ui/display/entity-header/entity-metadata.d.ts +2 -0
- package/dist/lib/components/ui/display/event-chip/event-chip-badges.d.ts +21 -0
- package/dist/lib/components/ui/display/event-chip/event-chip-content.d.ts +5 -7
- package/dist/lib/components/ui/display/event-chip/event-chip-title.d.ts +9 -0
- package/dist/lib/components/ui/display/event-chip/event-chip.classes.d.ts +9 -0
- package/dist/lib/components/ui/display/event-chip/event-chip.d.ts +15 -2
- package/dist/lib/components/ui/fields/attributes/attribute-values-form-field-set/attribute-values-form-field-set.d.ts +1 -1
- package/dist/lib/components/ui/fields/choice-list/choice-list-control.d.ts +1 -1
- package/dist/lib/components/ui/fields/choice-list/choice-list-field.d.ts +1 -1
- package/dist/lib/components/ui/fields/choice-list/choice-list-focus.d.ts +6 -3
- package/dist/lib/components/ui/fields/choice-list/choice-list-form-field.d.ts +2 -2
- package/dist/lib/components/ui/fields/choice-list/choice-list-names.d.ts +2 -0
- package/dist/lib/components/ui/fields/choice-list/choice-list.utils.d.ts +2 -0
- package/dist/lib/components/ui/fields/choice-list/index.d.ts +1 -1
- package/dist/lib/components/ui/fields/choice-list/partials/choice-row.d.ts +9 -3
- package/dist/lib/components/ui/fields/choice-list/types.d.ts +20 -0
- package/dist/lib/components/ui/fields/contacts/placeholders.d.ts +1 -1
- package/dist/lib/components/ui/layout/record-page/record-details.d.ts +6 -6
- package/dist/lib/components/ui/widgets/event-calendar/backdrop.types.d.ts +75 -0
- package/dist/lib/components/ui/widgets/event-calendar/chrome.types.d.ts +12 -0
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar-context.d.ts +8 -1
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar-events.utils.d.ts +3 -1
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar-shell.d.ts +1 -1
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar.backdrop.d.ts +38 -0
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar.badges.d.ts +14 -0
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar.labels.d.ts +14 -1
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar.lanes.d.ts +9 -0
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar.read-only.d.ts +57 -0
- package/dist/lib/components/ui/widgets/event-calendar/event-calendar.resources.d.ts +6 -1
- package/dist/lib/components/ui/widgets/event-calendar/index.d.ts +2 -1
- package/dist/lib/components/ui/widgets/event-calendar/partials/all-day-bars.d.ts +14 -0
- package/dist/lib/components/ui/widgets/event-calendar/partials/backdrop-bands.d.ts +11 -0
- package/dist/lib/components/ui/widgets/event-calendar/partials/backdrop-bar.d.ts +11 -0
- package/dist/lib/components/ui/widgets/event-calendar/partials/backdrop-cell.d.ts +13 -0
- package/dist/lib/components/ui/widgets/event-calendar/partials/backdrop-row.d.ts +8 -0
- package/dist/lib/components/ui/widgets/event-calendar/partials/calendar-badge.d.ts +16 -0
- package/dist/lib/components/ui/widgets/event-calendar/partials/month-day-cell.d.ts +4 -1
- package/dist/lib/components/ui/widgets/event-calendar/partials/month-day-parts.d.ts +12 -1
- package/dist/lib/components/ui/widgets/event-calendar/partials/resource-header.d.ts +2 -1
- package/dist/lib/components/ui/widgets/event-calendar/partials/span-event.d.ts +3 -1
- package/dist/lib/components/ui/widgets/event-calendar/partials/time-grid-header-day.d.ts +3 -6
- package/dist/lib/components/ui/widgets/event-calendar/partials/zone-corner.d.ts +10 -2
- package/dist/lib/components/ui/widgets/event-calendar/template.types.d.ts +7 -2
- package/dist/lib/components/ui/widgets/event-calendar/types.d.ts +25 -13
- package/dist/lib/components/ui/widgets/event-calendar/use-backdrops.d.ts +8 -0
- package/dist/lib/components/ui/widgets/event-calendar/use-badges.d.ts +5 -0
- package/dist/lib/components/ui/widgets/event-calendar/use-event-calendar.d.ts +3 -2
- package/dist/lib/components/ui/widgets/event-calendar/use-month-day.d.ts +6 -1
- package/dist/lib/components/ui/widgets/event-calendar/use-time-column.d.ts +1 -0
- package/dist/lib/i18n/resources/en/en.d.ts +7 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +7 -0
- package/dist/lib/i18n/resources/fr/fr.d.ts +7 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +7 -0
- package/dist/lib/i18n/resources/resources.d.ts +14 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib.js +1 -1
- package/dist/main.js +54 -54
- package/dist/map.js +7 -7
- package/dist/material.css +1 -1
- package/dist/pdf-reader.js +1 -1
- package/dist/{percent-field-DuoZieW9.js → percent-field-TWyupyr_.js} +1 -1
- package/dist/{picker-surface-BKzM6TWN.js → picker-surface-CoNsDWxX.js} +4 -4
- package/dist/{popover-ukgGm5B6.js → popover-BA1U82Wk.js} +1 -1
- package/dist/{pos-types-BNXbls3v.js → pos-types-BQqv-kb6.js} +1 -1
- package/dist/{pos-variant-CZ3OZtPq.js → pos-variant-D043n5y8.js} +4 -4
- package/dist/print.js +1 -1
- package/dist/{programmer-variant-DVu-pYhB.js → programmer-variant-jneMqtLs.js} +2 -2
- package/dist/{public-DtXwn8bx.js → public-DgrbdeZj.js} +9 -9
- package/dist/{rich-code-block-DUaSLxLT.js → rich-code-block-CGNjHawR.js} +5 -5
- package/dist/{scientific-variant-Ku9feVN1.js → scientific-variant-1L7brNNT.js} +2 -2
- package/dist/{sortable-provider-DIb1HgZA.js → sortable-provider-DZLV_svg.js} +2 -2
- package/dist/{spinner-CHWFXCfd.js → spinner-CQqRWxAW.js} +1 -1
- package/dist/{tabs-BideU0Rb.js → tabs-DQTx3C8e.js} +1 -1
- package/dist/theme-picker.js +2 -2
- package/dist/{theme-toggle-DUQTEe1y.js → theme-toggle-3NQ3VmJH.js} +1 -1
- package/dist/{toolbar-items-azkXY5w2.js → toolbar-items-BYCdJGUf.js} +4 -4
- package/dist/{translate-material-d8Q5K5a_.js → translate-material-jxfcGlD5.js} +1 -1
- package/dist/{translator-CxyFsfO0.js → translator-6XuDmqUJ.js} +10 -0
- package/dist/{use-chat-composer-FACltVyX.js → use-chat-composer-1eb4I1kM.js} +16 -16
- package/dist/{use-heading-spy-DHd5TScW.js → use-heading-spy-CzPujlKr.js} +4 -4
- package/dist/{use-material-translation-DA5ECZfA.js → use-material-translation-BUPqNmAg.js} +1 -1
- package/dist/{use-return-focus-CAAvJ6p5.js → use-return-focus-B_enQxp5.js} +1 -1
- package/docs/README.md +1 -0
- package/docs/components/data-display.md +6 -1
- package/docs/components/data-table-filter-and-lists.md +3 -0
- package/docs/components/form-fields.md +38 -5
- package/docs/components/navigation-and-layout.md +1 -0
- package/docs/components/rich-widgets.md +58 -5
- package/docs/guides/event-calendar.md +163 -0
- package/docs/guides/forms.md +2 -1
- package/docs/guides/i18n.md +2 -0
- package/docs/previews/data-display-eventchip.webp +0 -0
- package/docs/previews/rich-widgets-eventcalendar.webp +0 -0
- package/docs/roadmap.md +12 -0
- package/lib/components/components.css +1 -0
- package/lib/components/ui/widgets/event-calendar/event-calendar-backdrop.css +43 -0
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
2
|
import { CardTitleElement } from '../../primitives/card/card.js';
|
|
3
3
|
/** One « label date » segment of the meta line. */
|
|
4
4
|
export type RecordDetailsStamp = {
|
|
@@ -7,8 +7,8 @@ export type RecordDetailsStamp = {
|
|
|
7
7
|
/** The instant: a `Date`, an ISO string or a timestamp. */
|
|
8
8
|
at: Date | string | number;
|
|
9
9
|
};
|
|
10
|
-
export type RecordDetailsProps = {
|
|
11
|
-
/** The card's heading. */
|
|
10
|
+
export type RecordDetailsProps = Omit<ComponentProps<'div'>, 'title'> & {
|
|
11
|
+
/** The card's heading, set in `title-md` emphasized like a section title, whatever its level. */
|
|
12
12
|
title?: ReactNode;
|
|
13
13
|
/** The heading level of `title`, `'h2'` by default (under the page's `h1`). */
|
|
14
14
|
titleAs?: CardTitleElement;
|
|
@@ -28,13 +28,13 @@ export type RecordDetailsProps = {
|
|
|
28
28
|
maxColumns?: number;
|
|
29
29
|
/** The `Description`s. */
|
|
30
30
|
children?: ReactNode;
|
|
31
|
-
className?: string;
|
|
32
31
|
};
|
|
33
32
|
/**
|
|
34
33
|
* RecordDetails - the record's facts as one card: a title and a status, the
|
|
35
34
|
* `Description`s in a `DescriptionList` (one column in a side panel, up to
|
|
36
35
|
* `maxColumns` once the panel is stacked and wide) and a muted
|
|
37
36
|
* « Added on … · Updated on … » line under them, the dates written without
|
|
38
|
-
* seconds in `timeZone`. Made for `RecordPage`'s `details`.
|
|
37
|
+
* seconds in `timeZone`. Made for `RecordPage`'s `details`. Any other `div`
|
|
38
|
+
* prop (`data-*`, `id`, `aria-*`, `className`) goes to the root.
|
|
39
39
|
*/
|
|
40
|
-
export declare function RecordDetails({ title, titleAs, status, created, updated, timeZone, maxColumns, children, className, }: RecordDetailsProps): import("react").JSX.Element;
|
|
40
|
+
export declare function RecordDetails({ title, titleAs, status, created, updated, timeZone, maxColumns, children, className, ...props }: RecordDetailsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Tone } from '../../tones.js';
|
|
2
|
+
import { CalendarEventBadge } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* A stretch of time the calendar shades behind its events, such as a holiday,
|
|
5
|
+
* a term, a closure or a half day off. It never blocks a slot: events can be
|
|
6
|
+
* made and dropped over it.
|
|
7
|
+
*
|
|
8
|
+
* `start` and `end` are ISO strings. A date-only value (`2026-12-25`) means
|
|
9
|
+
* whole days, read in the calendar's `timeZone`; `end` is always exclusive, so
|
|
10
|
+
* `2026-12-25` to `2026-12-26` is the single day of 25 December. A value with
|
|
11
|
+
* a time is an instant, which gives a half day (`2026-12-24T12:00:00` to
|
|
12
|
+
* `2026-12-25`).
|
|
13
|
+
*/
|
|
14
|
+
export type EventCalendarSpan = {
|
|
15
|
+
id: string;
|
|
16
|
+
start: string;
|
|
17
|
+
end: string;
|
|
18
|
+
label: string;
|
|
19
|
+
/** Default `'neutral'`. */
|
|
20
|
+
tone?: Tone;
|
|
21
|
+
/**
|
|
22
|
+
* The resource column the span belongs to. One with none shades every
|
|
23
|
+
* column; one with an unknown id shades none.
|
|
24
|
+
*/
|
|
25
|
+
resourceId?: string;
|
|
26
|
+
};
|
|
27
|
+
/** The part of a span that falls on one day of the zone's calendar. */
|
|
28
|
+
export type BackdropSegment = {
|
|
29
|
+
span: EventCalendarSpan;
|
|
30
|
+
/** The `YYYY-MM-DD` day. */
|
|
31
|
+
day: string;
|
|
32
|
+
/** Wall-clock minutes from midnight where the span starts on this day (0 for a whole day). */
|
|
33
|
+
fromMin: number;
|
|
34
|
+
/** Wall-clock minutes where it ends (1440 for a whole day or one running on). */
|
|
35
|
+
toMin: number;
|
|
36
|
+
/** The span covers the whole day, whatever its length (23 or 25 hours on a clock change). */
|
|
37
|
+
whole: boolean;
|
|
38
|
+
};
|
|
39
|
+
/** A span laid out as a bar over the day columns of the all-day strip. */
|
|
40
|
+
export type BackdropLane = {
|
|
41
|
+
span: EventCalendarSpan;
|
|
42
|
+
/** The first column (day) of the bar. */
|
|
43
|
+
startCol: number;
|
|
44
|
+
/** The number of columns it covers. */
|
|
45
|
+
cols: number;
|
|
46
|
+
/** The lane (row) of the strip. */
|
|
47
|
+
row: number;
|
|
48
|
+
continuesBefore: boolean;
|
|
49
|
+
continuesAfter: boolean;
|
|
50
|
+
};
|
|
51
|
+
/** A label with a tone that marks a day or a week, keyed by date (`2026-12-24`). */
|
|
52
|
+
export type EventCalendarBadges = Record<string, CalendarEventBadge>;
|
|
53
|
+
/** The props that decorate the days: shaded spans and badges. */
|
|
54
|
+
export type EventCalendarDayMarksProps = {
|
|
55
|
+
/**
|
|
56
|
+
* Stretches of time shaded behind the events (a holiday, a term, a half day
|
|
57
|
+
* off). They never block a slot, take no pointer event, and are read in the
|
|
58
|
+
* name of the day or column they fall on. Not a prop of `mode="template"`.
|
|
59
|
+
*/
|
|
60
|
+
spans?: EventCalendarSpan[];
|
|
61
|
+
/**
|
|
62
|
+
* A badge on a day, keyed by its `YYYY-MM-DD` date (`{ '2026-12-24': { label:
|
|
63
|
+
* 'Eve', tone: 'info' } }`): in the day's header (week and day views) and
|
|
64
|
+
* next to its number (month). It is read in the name of the day. Not a prop of `mode="template"`, which has no dates. Where the
|
|
65
|
+
* room is short (a phone's week column or month cell) it becomes a short tone bar.
|
|
66
|
+
*/
|
|
67
|
+
dayBadges?: EventCalendarBadges;
|
|
68
|
+
/**
|
|
69
|
+
* A badge on a week, keyed by the `YYYY-MM-DD` date of its first day, which
|
|
70
|
+
* follows `weekStartsOn` (Monday `2026-12-21` when weeks start on Monday). It
|
|
71
|
+
* is drawn in the time views' gutter corner and on the first cell of the
|
|
72
|
+
* month's row, and is read in that cell's name. Not a prop of `mode="template"`.
|
|
73
|
+
*/
|
|
74
|
+
weekBadges?: EventCalendarBadges;
|
|
75
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type EventCalendarChromeState = {
|
|
2
|
+
focusedEventId: string | null;
|
|
3
|
+
query: string;
|
|
4
|
+
/** The way the last move went (-1 back, 1 forward): the view slides from it. */
|
|
5
|
+
direction: -1 | 0 | 1;
|
|
6
|
+
/** A view was picked in the switcher: `phoneView` no longer applies. */
|
|
7
|
+
viewPicked: boolean;
|
|
8
|
+
/** The keyboard moved the cursor: its day takes the focus once rendered. */
|
|
9
|
+
dayFocus: boolean;
|
|
10
|
+
/** The resource the phone's switcher shows; `null` is the first. */
|
|
11
|
+
resourceId: string | null;
|
|
12
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { EventChipVariant } from '../../display/event-chip/event-chip.classes.js';
|
|
3
|
+
import { EventCalendarBadges, EventCalendarSpan } from './backdrop.types.js';
|
|
3
4
|
import { TemplateContext } from './template.types.js';
|
|
4
5
|
import { CalendarEvent, EventCalendarPreviewField, EventCalendarRenderEvent, EventCalendarSlot, EventCalendarView } from './types.js';
|
|
5
6
|
import { EventCalendarModel } from './use-event-calendar.js';
|
|
@@ -8,7 +9,13 @@ export type EventCalendarContextValue = EventCalendarModel & {
|
|
|
8
9
|
sourceEvents?: CalendarEvent[];
|
|
9
10
|
/** Set in `mode="template"`: the lanes, and the lane of each event. */
|
|
10
11
|
template?: TemplateContext;
|
|
11
|
-
|
|
12
|
+
/** The spans to shade behind the events (see `EventCalendarProps.spans`). */
|
|
13
|
+
spans?: EventCalendarSpan[];
|
|
14
|
+
/** Badges on days and on weeks (see `EventCalendarProps.dayBadges`). */
|
|
15
|
+
dayBadges?: EventCalendarBadges;
|
|
16
|
+
weekBadges?: EventCalendarBadges;
|
|
17
|
+
/** The hint that events can be dragged, read as the board's description; unset when they cannot (`readOnlyEvents`). */
|
|
18
|
+
dragHint?: string;
|
|
12
19
|
searchable: boolean;
|
|
13
20
|
/** The views the switcher offers. */
|
|
14
21
|
views?: EventCalendarView[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { closestCenter } from '@dnd-kit/core';
|
|
2
|
-
import { CalendarEvent } from './types.js';
|
|
2
|
+
import { CalendarEvent, CalendarEventBadge } from './types.js';
|
|
3
3
|
export declare const calendarCollisionDetection: typeof closestCenter;
|
|
4
4
|
export declare function snapToStep(date: Date, stepMinutes?: number): Date;
|
|
5
5
|
/** `date` rounded to the nearest `stepMinutes` of the clock's epoch: right in a zone whose offset is a multiple of the step. */
|
|
@@ -15,3 +15,5 @@ export declare function moveEventToDay(event: CalendarEvent, day: Date): Calenda
|
|
|
15
15
|
export declare function moveEventToDateTime(event: CalendarEvent, dateTime: Date, snap?: (date: Date) => Date): CalendarEvent;
|
|
16
16
|
export declare function resizeEventEnd(event: CalendarEvent, end: Date, snap?: (date: Date) => Date): CalendarEvent;
|
|
17
17
|
export declare function isToday(day: Date, now?: Date): boolean;
|
|
18
|
+
/** Every badge of an event, `badge` first. */
|
|
19
|
+
export declare function eventBadges(event: CalendarEvent): CalendarEventBadge[];
|
|
@@ -12,4 +12,4 @@ export type EventCalendarShellProps = EventCalendarProps & {
|
|
|
12
12
|
* mini-month side panel and a phone layout of its own. Events are props; the
|
|
13
13
|
* chrome (search, focus, the last move's direction) lives in a slice.
|
|
14
14
|
*/
|
|
15
|
-
export declare function EventCalendarShell({ template, visible, onEventClick, onSlotClick, eventPreview, previewFields, onEventEdit, onEventDelete, className, renderEvent, toolbar, searchable, views, phoneView, sidebar, eventVariant, scrollToHour, ...options }: EventCalendarShellProps): import("react").JSX.Element;
|
|
15
|
+
export declare function EventCalendarShell({ template, visible, onEventClick, onSlotClick, eventPreview, previewFields, onEventEdit, onEventDelete, className, renderEvent, toolbar, searchable, views, phoneView, sidebar, eventVariant, scrollToHour, spans, dayBadges, weekBadges, ...options }: EventCalendarShellProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BackdropLane, BackdropSegment, EventCalendarSpan } from './backdrop.types.js';
|
|
2
|
+
/** Whether a span value is a date (`2026-12-25`): whole days, not an instant. */
|
|
3
|
+
export declare function isDateOnly(value: string): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* The instants a span covers, `end` exclusive. A date-only value is the first
|
|
6
|
+
* instant of that day in the zone; a time with no offset (`2026-12-24T12:00`)
|
|
7
|
+
* is that wall-clock time in the zone; one with an offset or `Z` is the
|
|
8
|
+
* instant it names. A span
|
|
9
|
+
* with an invalid value, or that ends at or before its start, gives `null`.
|
|
10
|
+
*/
|
|
11
|
+
export declare function spanRange(span: EventCalendarSpan, timeZone?: string): {
|
|
12
|
+
start: Date;
|
|
13
|
+
end: Date;
|
|
14
|
+
} | null;
|
|
15
|
+
/**
|
|
16
|
+
* Whether a span shades a resource column. Without `resourceId` (no
|
|
17
|
+
* resources) every span counts; `null` is the unassigned column, which only
|
|
18
|
+
* the spans with no `resourceId` shade.
|
|
19
|
+
*/
|
|
20
|
+
export declare function spanMatchesResource(span: EventCalendarSpan, resourceId?: string | null): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The part of a span on the zone's day `day`, or `null` when it does not touch
|
|
23
|
+
* it. The day runs from its first instant to the next day's, so on a clock
|
|
24
|
+
* change it is 23 or 25 hours long and a span over all of it is `whole`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function spanOnDay(span: EventCalendarSpan, day: string, timeZone?: string): BackdropSegment | null;
|
|
27
|
+
/**
|
|
28
|
+
* The spans on one day, for one resource column when given, in the order of
|
|
29
|
+
* `spans`. Spans never block anything: this only says what to draw.
|
|
30
|
+
*/
|
|
31
|
+
export declare function spansForDay(spans: EventCalendarSpan[] | undefined, day: string, timeZone?: string, resourceId?: string | null): BackdropSegment[];
|
|
32
|
+
/**
|
|
33
|
+
* The all-day strip: each span as a bar over the consecutive `days` it covers
|
|
34
|
+
* wholly, put in the first lane with room (longest and earliest first). A
|
|
35
|
+
* span that only covers part of a day (a half day) has no bar: it is drawn as
|
|
36
|
+
* a band in the time grid, and by `spansForDay` in the month.
|
|
37
|
+
*/
|
|
38
|
+
export declare function layoutBackdropLanes(spans: EventCalendarSpan[] | undefined, days: string[], timeZone?: string, resourceId?: string | null): BackdropLane[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Locale } from 'date-fns';
|
|
2
|
+
import { EventCalendarBadges } from './backdrop.types.js';
|
|
3
|
+
import { CalendarEventBadge } from './types.js';
|
|
4
|
+
type WeekStart = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
5
|
+
/** The badge set on a day, keyed by its `YYYY-MM-DD` date. */
|
|
6
|
+
export declare function dayBadgeOf(dayBadges: EventCalendarBadges | undefined, day: Date): CalendarEventBadge | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* The key of the week a day falls in: the date of its first day, which follows
|
|
9
|
+
* `weekStartsOn` (the locale's when unset), whatever the view draws of it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function weekBadgeKey(day: Date, locale?: Locale, weekStartsOn?: WeekStart): string;
|
|
12
|
+
/** The badge set on the week a day falls in. */
|
|
13
|
+
export declare function weekBadgeOf(weekBadges: EventCalendarBadges | undefined, day: Date, locale?: Locale, weekStartsOn?: WeekStart): CalendarEventBadge | undefined;
|
|
14
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Locale } from 'date-fns';
|
|
2
|
-
import {
|
|
2
|
+
import { BackdropSegment } from './backdrop.types.js';
|
|
3
|
+
import { CalendarEvent, CalendarEventBadge } from './types.js';
|
|
3
4
|
/**
|
|
4
5
|
* The times a chip or an agenda row shows. In a zone they are read from the
|
|
5
6
|
* true instants with the zone's own clock (`wallOf`), never through the
|
|
@@ -10,9 +11,21 @@ export declare function eventTimes(drawn: CalendarEvent, source: CalendarEvent,
|
|
|
10
11
|
time?: string;
|
|
11
12
|
endTime?: string;
|
|
12
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* The accessible name of an event's group: its title, then its badge, then
|
|
16
|
+
* `cancelled` (the translated word) when its status says so.
|
|
17
|
+
*/
|
|
18
|
+
export declare function eventName(event: CalendarEvent, title: string, cancelled: string): string;
|
|
13
19
|
/**
|
|
14
20
|
* The range label of the popover, in the zone: the day is read at noon and
|
|
15
21
|
* the time on a fixed day, so a wall time the browser's own clock skips never
|
|
16
22
|
* shifts what is said.
|
|
17
23
|
*/
|
|
18
24
|
export declare function zonedRangeLabel(event: CalendarEvent, locale: Locale, zone: string): string;
|
|
25
|
+
/** A day's name with its spans' labels after it: the cell or the column reads them out, the shading is decoration. */
|
|
26
|
+
export declare function nameWithSpans(date: string, segments: BackdropSegment[]): string;
|
|
27
|
+
/** A day's name with its badges after it, for the cell or column that reads them out. */
|
|
28
|
+
export declare function nameWithBadges(name: string, day: CalendarEventBadge | undefined, week: {
|
|
29
|
+
badge: CalendarEventBadge | undefined;
|
|
30
|
+
text: (label: string) => string;
|
|
31
|
+
}): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lane (row) of each item, already in the order they should win a lane:
|
|
3
|
+
* the first lane with room over its columns, a new one when none has. An item
|
|
4
|
+
* covers `cols` columns from `startCol`; `columns` is the width of a lane.
|
|
5
|
+
*/
|
|
6
|
+
export declare function packLanes(items: {
|
|
7
|
+
startCol: number;
|
|
8
|
+
cols: number;
|
|
9
|
+
}[], columns: number): number[];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { CalendarEvent } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* What a read-only event's draggable wrapper must not say: dnd-kit marks it
|
|
4
|
+
* "draggable", points to its pick-up instructions and gives it a tab stop of
|
|
5
|
+
* its own. The chip's own button stays the one focusable, named control.
|
|
6
|
+
*/
|
|
7
|
+
export declare function readOnlyDragProps(readOnly: boolean): {
|
|
8
|
+
readonly 'aria-roledescription': undefined;
|
|
9
|
+
readonly 'aria-describedby': undefined;
|
|
10
|
+
readonly 'aria-disabled': undefined;
|
|
11
|
+
readonly tabIndex: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
readonly 'aria-roledescription'?: undefined;
|
|
14
|
+
'aria-describedby'?: undefined;
|
|
15
|
+
readonly 'aria-disabled'?: undefined;
|
|
16
|
+
readonly tabIndex?: undefined;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The props of an event's draggable wrapper (`Draggable`), the same in the
|
|
20
|
+
* time grid, the all-day strip and the month's overflow list: its drag
|
|
21
|
+
* switches (off with `disabled`, `readOnlyEvents` or the event's own
|
|
22
|
+
* `disabled`), a named group in place of dnd-kit's `button` (which would hold
|
|
23
|
+
* the chip's own button), and the focus that follows the event.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useEventDragProps(event: CalendarEvent, title: string): {
|
|
26
|
+
readonly role: "group";
|
|
27
|
+
readonly 'aria-label': string;
|
|
28
|
+
readonly onFocus: () => void;
|
|
29
|
+
readonly onClick: (click: {
|
|
30
|
+
stopPropagation: () => void;
|
|
31
|
+
}) => void;
|
|
32
|
+
readonly 'aria-roledescription': undefined;
|
|
33
|
+
readonly 'aria-describedby': undefined;
|
|
34
|
+
readonly 'aria-disabled': undefined;
|
|
35
|
+
readonly tabIndex: undefined;
|
|
36
|
+
readonly id: string;
|
|
37
|
+
readonly data: {
|
|
38
|
+
readonly type: "event";
|
|
39
|
+
};
|
|
40
|
+
readonly disabled: boolean;
|
|
41
|
+
} | {
|
|
42
|
+
readonly role: "group";
|
|
43
|
+
readonly 'aria-label': string;
|
|
44
|
+
readonly onFocus: () => void;
|
|
45
|
+
readonly onClick: (click: {
|
|
46
|
+
stopPropagation: () => void;
|
|
47
|
+
}) => void;
|
|
48
|
+
readonly 'aria-roledescription'?: undefined;
|
|
49
|
+
readonly 'aria-describedby'?: undefined;
|
|
50
|
+
readonly 'aria-disabled'?: undefined;
|
|
51
|
+
readonly tabIndex?: undefined;
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly data: {
|
|
54
|
+
readonly type: "event";
|
|
55
|
+
};
|
|
56
|
+
readonly disabled: boolean;
|
|
57
|
+
};
|
|
@@ -24,7 +24,12 @@ export declare function withColumn(event: CalendarEvent, column: string | null):
|
|
|
24
24
|
export declare function columnKey(column: ResourceColumn): string;
|
|
25
25
|
/** The resource an event belongs to; none when it has none or an unknown one. */
|
|
26
26
|
export declare function ownerOf(event: CalendarEvent, resources?: EventCalendarResource[]): EventCalendarResource | undefined;
|
|
27
|
-
/** The event drawn in its
|
|
27
|
+
/** The tone an event is drawn in: its own, else its resource's. */
|
|
28
|
+
export declare function toneOf(event: CalendarEvent, owner?: EventCalendarResource): Tone | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* The event drawn in its tone when it sets no colour of its own: its `color`
|
|
31
|
+
* wins, then its `tone`, then its resource's.
|
|
32
|
+
*/
|
|
28
33
|
export declare function withOwnerTone(event: CalendarEvent, owner?: EventCalendarResource): CalendarEvent;
|
|
29
34
|
/**
|
|
30
35
|
* The column an event is dropped into, or the event itself when it is already
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export type { EventCalendarBadges, EventCalendarDayMarksProps, EventCalendarSpan, } from './backdrop.types.js';
|
|
1
2
|
export type { EventCalendarProps } from './event-calendar.js';
|
|
2
3
|
export { EventCalendar } from './event-calendar.js';
|
|
3
4
|
export { EventCalendarProvider, useEventCalendarContext, } from './event-calendar-context.js';
|
|
4
5
|
export type { EventCalendarLane, EventCalendarTemplateChange, EventCalendarTemplateEvent, EventCalendarTemplateProps, EventCalendarTemplateSlot, EventCalendarWeekday, } from './template.types.js';
|
|
5
|
-
export type { CalendarEvent, CalendarEventBadge, EventCalendarChange, EventCalendarDensity, EventCalendarPreviewField, EventCalendarRenderEvent, EventCalendarResource, EventCalendarSlot, EventCalendarView, } from './types.js';
|
|
6
|
+
export type { CalendarEvent, CalendarEventBadge, CalendarEventStatus, EventCalendarChange, EventCalendarDensity, EventCalendarPreviewField, EventCalendarRenderEvent, EventCalendarResource, EventCalendarSlot, EventCalendarView, } from './types.js';
|
|
6
7
|
export { useEventCalendar } from './use-event-calendar.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BackdropLane } from '../backdrop.types.js';
|
|
2
|
+
import { SpanSegment } from '../event-calendar.spans.js';
|
|
3
|
+
/**
|
|
4
|
+
* What the all-day strip draws: the backdrop spans as bars in the rows on
|
|
5
|
+
* top, then the multi-day events below them.
|
|
6
|
+
*/
|
|
7
|
+
export declare function AllDayBars({ days, segments, backdrop, }: {
|
|
8
|
+
days: Date[];
|
|
9
|
+
segments: SpanSegment[];
|
|
10
|
+
backdrop: {
|
|
11
|
+
lanes: BackdropLane[];
|
|
12
|
+
rows: number;
|
|
13
|
+
};
|
|
14
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BackdropSegment } from '../backdrop.types.js';
|
|
2
|
+
import { DayAxis } from '../event-calendar.axis.js';
|
|
3
|
+
/**
|
|
4
|
+
* The spans of one column of hours: a hatched band under the events (z-0)
|
|
5
|
+
* with its label at the top. Decoration only: `aria-hidden`, no pointer
|
|
6
|
+
* events, no tab stop; the column's name carries the text.
|
|
7
|
+
*/
|
|
8
|
+
export declare function BackdropBands({ segments, axis, }: {
|
|
9
|
+
segments: BackdropSegment[];
|
|
10
|
+
axis: DayAxis;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { BackdropLane } from '../backdrop.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A whole-day span as a bar of the all-day strip, in the rows above the
|
|
4
|
+
* events. Decoration: `aria-hidden`, no pointer events (a click reaches the
|
|
5
|
+
* day under it).
|
|
6
|
+
*/
|
|
7
|
+
export declare function BackdropBar({ lane, showLabel, }: {
|
|
8
|
+
lane: BackdropLane;
|
|
9
|
+
/** False where the columns are too narrow for a label (a phone's week). */
|
|
10
|
+
showLabel?: boolean;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BackdropSegment } from '../backdrop.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The spans of a month cell: the cell shaded (a half day shades its half),
|
|
4
|
+
* the label in its top corner from 7rem of cell width, and under that a dot.
|
|
5
|
+
* Decoration: `aria-hidden`, no pointer events; the cell's name carries the
|
|
6
|
+
* text. The cell is the `day` container and an `isolate` stacking context, so
|
|
7
|
+
* the shading sits under its content.
|
|
8
|
+
*/
|
|
9
|
+
export declare function BackdropCell({ segments, below, }: {
|
|
10
|
+
segments: BackdropSegment[];
|
|
11
|
+
/** The labels sit at the cell's foot: its day badge takes the top row. */
|
|
12
|
+
below?: boolean;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The spans of a day in the agenda and the phone's day list: a hatched row
|
|
3
|
+
* with the label, ahead of the events. It is text, not a control: no pointer
|
|
4
|
+
* events (a click reaches the day) and no tab stop.
|
|
5
|
+
*/
|
|
6
|
+
export declare function BackdropRow({ day }: {
|
|
7
|
+
day: Date;
|
|
8
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CalendarEventBadge } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A day's or a week's badge: a small soft pill, or with `dot` (where the room
|
|
4
|
+
* is short, such as a phone's column) a short tone bar whose label is its tooltip
|
|
5
|
+
* and, hidden visually, its text. The container that names it (a button, a
|
|
6
|
+
* cell) holds the label in its own name.
|
|
7
|
+
*/
|
|
8
|
+
export declare function CalendarBadge({ badge, slot, dot, wrap, className, }: {
|
|
9
|
+
badge: CalendarEventBadge;
|
|
10
|
+
/** The `data-slot` of the pill; the dot adds `-dot`. */
|
|
11
|
+
slot: string;
|
|
12
|
+
dot?: boolean;
|
|
13
|
+
/** The label may take two lines instead of one clipped (a narrow corner). */
|
|
14
|
+
wrap?: boolean;
|
|
15
|
+
className?: string;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MutableRefObject } from 'react';
|
|
2
|
-
|
|
2
|
+
import { CalendarEventBadge } from '../types.js';
|
|
3
|
+
export declare function MonthDayCell({ day, month, draft, draggedRef, weekBadge, }: {
|
|
3
4
|
day: Date;
|
|
4
5
|
month: Date;
|
|
5
6
|
draft: {
|
|
@@ -7,4 +8,6 @@ export declare function MonthDayCell({ day, month, draft, draggedRef, }: {
|
|
|
7
8
|
to: Date;
|
|
8
9
|
} | null;
|
|
9
10
|
draggedRef: MutableRefObject<boolean>;
|
|
11
|
+
/** The week's badge, given to the first cell of the row. */
|
|
12
|
+
weekBadge?: CalendarEventBadge;
|
|
10
13
|
}): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CalendarEvent } from '../types.js';
|
|
1
|
+
import { CalendarEvent, CalendarEventBadge } from '../types.js';
|
|
2
2
|
/** The day number in a month cell: a filled disc today, a ring on the phone's chosen day. */
|
|
3
3
|
export declare function MonthDayNumber({ day, isToday, isCursor, outside, }: {
|
|
4
4
|
day: Date;
|
|
@@ -10,3 +10,14 @@ export declare function MonthDayNumber({ day, isToday, isCursor, outside, }: {
|
|
|
10
10
|
export declare function MonthDayDots({ items }: {
|
|
11
11
|
items: CalendarEvent[];
|
|
12
12
|
}): import("react").JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* The day number with the day's badge: a pill beside it, or on a phone (where
|
|
15
|
+
* the cell has no room) a tone dot in the cell's top corner.
|
|
16
|
+
*/
|
|
17
|
+
export declare function MonthDayTop({ badge, ...number }: React.ComponentProps<typeof MonthDayNumber> & {
|
|
18
|
+
badge?: CalendarEventBadge;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
20
|
+
/** The week's badge on the first cell of a row: a pill along its foot, or a dot on a phone. */
|
|
21
|
+
export declare function MonthWeekBadge({ badge }: {
|
|
22
|
+
badge: CalendarEventBadge;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
@@ -5,7 +5,8 @@ import { ResourceColumn } from '../event-calendar.resources.js';
|
|
|
5
5
|
* column, its label and description. It stays above the hours while they
|
|
6
6
|
* scroll, and the gutter's corner names the zone's offset when there is one.
|
|
7
7
|
*/
|
|
8
|
-
export declare function ResourceHeader({ columns, zoneLabel, zone, }: {
|
|
8
|
+
export declare function ResourceHeader({ day, columns, zoneLabel, zone, }: {
|
|
9
|
+
day: Date;
|
|
9
10
|
columns: ResourceColumn[];
|
|
10
11
|
zoneLabel?: ReactNode;
|
|
11
12
|
zone?: string;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { SpanSegment } from '../event-calendar.spans.js';
|
|
2
|
-
export declare function SpanEvent({ segment }: {
|
|
2
|
+
export declare function SpanEvent({ segment, rowOffset, }: {
|
|
3
3
|
segment: SpanSegment;
|
|
4
|
+
/** Rows above it taken by the backdrop spans of the all-day strip. */
|
|
5
|
+
rowOffset?: number;
|
|
4
6
|
}): import("react").JSX.Element;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
* One day of the grid's header: the weekday and a large date, today's filled.
|
|
3
|
-
* With `canOpen` (a week that offers the day view) it is a button that opens
|
|
4
|
-
* that day.
|
|
5
|
-
*/
|
|
6
|
-
export declare function HeaderDay({ day, canOpen }: {
|
|
1
|
+
export declare function HeaderDay({ day, canOpen, dot, }: {
|
|
7
2
|
day: Date;
|
|
8
3
|
canOpen: boolean;
|
|
4
|
+
/** The day's badge is a tone dot, for a column too narrow for its pill. */
|
|
5
|
+
dot?: boolean;
|
|
9
6
|
}): import("react").JSX.Element;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { CalendarEventBadge } from '../types.js';
|
|
2
3
|
/**
|
|
3
4
|
* The gutter's corner above the hours: it names the zone's offset (`UTC+1`)
|
|
4
|
-
* when the calendar has a `timeZone`, and stays an
|
|
5
|
+
* when the calendar has a `timeZone`, carries the week's badge, and stays an
|
|
6
|
+
* empty cell otherwise. The badges are tone dots where the gutter is narrow
|
|
7
|
+
* (a phone).
|
|
5
8
|
*/
|
|
6
|
-
export declare function ZoneCorner({ zoneLabel, zone, className, }: {
|
|
9
|
+
export declare function ZoneCorner({ zoneLabel, zone, badges, className, }: {
|
|
7
10
|
zoneLabel?: ReactNode;
|
|
8
11
|
zone?: string;
|
|
12
|
+
/** The week's badge, and in a day view with resources the day's. */
|
|
13
|
+
badges?: {
|
|
14
|
+
badge: CalendarEventBadge;
|
|
15
|
+
slot: string;
|
|
16
|
+
}[];
|
|
9
17
|
className?: string;
|
|
10
18
|
}): import("react").JSX.Element;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Tone } from '../../tones.js';
|
|
3
|
+
import { CalendarEventStatus, EventCalendarProps } from './types.js';
|
|
3
4
|
/** ISO weekday: 1 is Monday, 7 is Sunday. */
|
|
4
5
|
export type EventCalendarWeekday = 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
5
6
|
/**
|
|
@@ -15,6 +16,10 @@ export type EventCalendarTemplateEvent = {
|
|
|
15
16
|
/** The alternating week it belongs to (an `EventCalendarLane` id); none: every week. */
|
|
16
17
|
lane?: string;
|
|
17
18
|
color?: string;
|
|
19
|
+
/** A tone the event is drawn in: `color` wins over it. */
|
|
20
|
+
tone?: Tone;
|
|
21
|
+
/** `'cancelled'`: struck through, muted and named so. */
|
|
22
|
+
status?: CalendarEventStatus;
|
|
18
23
|
description?: string;
|
|
19
24
|
disabled?: boolean;
|
|
20
25
|
};
|
|
@@ -41,7 +46,7 @@ export type EventCalendarTemplateChange = {
|
|
|
41
46
|
* slots and changes are keyed by weekday and time. The month, day and agenda
|
|
42
47
|
* views do not apply: `view` is `week` (the default) or `workweek`.
|
|
43
48
|
*/
|
|
44
|
-
export type EventCalendarTemplateProps = Pick<EventCalendarProps, 'disabled' | 'className' | 'toolbar' | 'searchable' | 'density' | 'eventVariant' | 'startHour' | 'endHour' | 'hourHeight' | 'slotDurationMinutes' | 'scrollToHour' | 'eventPreview' | 'previewFields'> & {
|
|
49
|
+
export type EventCalendarTemplateProps = Pick<EventCalendarProps, 'disabled' | 'readOnlyEvents' | 'className' | 'toolbar' | 'searchable' | 'density' | 'eventVariant' | 'startHour' | 'endHour' | 'hourHeight' | 'slotDurationMinutes' | 'scrollToHour' | 'eventPreview' | 'previewFields'> & {
|
|
45
50
|
mode: 'template';
|
|
46
51
|
events?: EventCalendarTemplateEvent[];
|
|
47
52
|
defaultEvents?: EventCalendarTemplateEvent[];
|
|
@@ -2,7 +2,10 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { EventChipBadge } from '../../display/event-chip/event-chip.js';
|
|
3
3
|
import { EventChipVariant } from '../../display/event-chip/event-chip.classes.js';
|
|
4
4
|
import { Tone } from '../../tones.js';
|
|
5
|
+
import { EventCalendarDayMarksProps } from './backdrop.types.js';
|
|
5
6
|
export type EventCalendarView = 'month' | 'week' | 'workweek' | 'day' | 'agenda';
|
|
7
|
+
/** Whether an event takes place: `cancelled` is drawn struck through and muted, and named so. */
|
|
8
|
+
export type CalendarEventStatus = 'scheduled' | 'cancelled';
|
|
6
9
|
export type CalendarEvent = {
|
|
7
10
|
id: string;
|
|
8
11
|
title: string;
|
|
@@ -25,6 +28,19 @@ export type CalendarEvent = {
|
|
|
25
28
|
* box is too small it is hidden visually and still read.
|
|
26
29
|
*/
|
|
27
30
|
badge?: CalendarEventBadge;
|
|
31
|
+
/**
|
|
32
|
+
* Further badges, drawn after `badge` in the same places (a status, then a
|
|
33
|
+
* priority and a progress count). Each is part of the accessible name and
|
|
34
|
+
* becomes a tone dot where the box is narrow or short.
|
|
35
|
+
*/
|
|
36
|
+
badges?: CalendarEventBadge[];
|
|
37
|
+
/**
|
|
38
|
+
* A tone of the library (`'success'`, or one an app declared) the event is
|
|
39
|
+
* drawn in. Colour precedence: `color`, then `tone`, then the resource's.
|
|
40
|
+
*/
|
|
41
|
+
tone?: Tone;
|
|
42
|
+
/** `'cancelled'` strikes the title, mutes the chip and adds "Cancelled" to its name; it stays draggable. */
|
|
43
|
+
status?: CalendarEventStatus;
|
|
28
44
|
};
|
|
29
45
|
export type CalendarEventBadge = EventChipBadge;
|
|
30
46
|
/** A column of the day view: a room, a person, a team. */
|
|
@@ -53,18 +69,7 @@ export type EventCalendarSlot = {
|
|
|
53
69
|
};
|
|
54
70
|
/** `comfortable` (the default) or `compact`: shorter hours and month cells. */
|
|
55
71
|
export type EventCalendarDensity = 'comfortable' | 'compact';
|
|
56
|
-
export type EventCalendarChromeState
|
|
57
|
-
focusedEventId: string | null;
|
|
58
|
-
query: string;
|
|
59
|
-
/** The way the last move went (-1 back, 1 forward): the view slides from it. */
|
|
60
|
-
direction: -1 | 0 | 1;
|
|
61
|
-
/** A view was picked in the switcher: `phoneView` no longer applies. */
|
|
62
|
-
viewPicked: boolean;
|
|
63
|
-
/** The keyboard moved the cursor: its day takes the focus once rendered. */
|
|
64
|
-
dayFocus: boolean;
|
|
65
|
-
/** The resource the phone's switcher shows; `null` is the first. */
|
|
66
|
-
resourceId: string | null;
|
|
67
|
-
};
|
|
72
|
+
export type { EventCalendarChromeState } from './chrome.types.js';
|
|
68
73
|
/** A field of the event preview popover. */
|
|
69
74
|
export type EventCalendarPreviewField = 'title' | 'color' | 'description';
|
|
70
75
|
export type EventCalendarRenderEvent = (event: CalendarEvent) => ReactNode;
|
|
@@ -107,6 +112,13 @@ export type EventCalendarProps = {
|
|
|
107
112
|
hourHeight?: number;
|
|
108
113
|
slotDurationMinutes?: number;
|
|
109
114
|
disabled?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* No event can be dragged, resized, moved by key, edited or deleted, yet
|
|
117
|
+
* each stays focusable, clickable and at full strength; `onSlotClick` still
|
|
118
|
+
* fires. Not `disabled` (the whole calendar) nor `CalendarEvent.disabled`
|
|
119
|
+
* (dims one event, swallows its clicks). Default `false`.
|
|
120
|
+
*/
|
|
121
|
+
readOnlyEvents?: boolean;
|
|
110
122
|
className?: string;
|
|
111
123
|
renderEvent?: EventCalendarRenderEvent;
|
|
112
124
|
toolbar?: ReactNode;
|
|
@@ -147,7 +159,7 @@ export type EventCalendarProps = {
|
|
|
147
159
|
* development). Without it, the machine's clock.
|
|
148
160
|
*/
|
|
149
161
|
timeZone?: string;
|
|
150
|
-
};
|
|
162
|
+
} & EventCalendarDayMarksProps;
|
|
151
163
|
export type LaidOutEvent = {
|
|
152
164
|
event: CalendarEvent;
|
|
153
165
|
column: number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BackdropLane, BackdropSegment } from './backdrop.types.js';
|
|
2
|
+
/** The spans on one day (of one resource column, when given), for the view to shade. */
|
|
3
|
+
export declare function useDaySpans(day: Date, resourceId?: string | null): BackdropSegment[];
|
|
4
|
+
/** The whole-day spans as bars over `days`, and the rows they take above the events. */
|
|
5
|
+
export declare function useBackdropLanes(days: Date[], resourceId?: string | null): {
|
|
6
|
+
lanes: BackdropLane[];
|
|
7
|
+
rows: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CalendarEventBadge } from './types.js';
|
|
2
|
+
/** The badge set on a day (`dayBadges`), if any. */
|
|
3
|
+
export declare function useDayBadge(day: Date): CalendarEventBadge | undefined;
|
|
4
|
+
/** The badge set on the week a day falls in (`weekBadges`, keyed by the week's first day). */
|
|
5
|
+
export declare function useWeekBadge(day: Date): CalendarEventBadge | undefined;
|