@ssa-ui-kit/core 3.23.1 → 3.24.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/dist/ai/source-map.md +155 -52
- package/dist/components/Calendar/Calendar.d.ts +130 -0
- package/dist/components/Calendar/CalendarContext.d.ts +25 -0
- package/dist/components/Calendar/CalendarEventDetails.d.ts +80 -0
- package/dist/components/Calendar/components/CalendarToolbar.d.ts +20 -0
- package/dist/components/Calendar/components/DayView.d.ts +14 -0
- package/dist/components/Calendar/components/EventDetailsLayer.d.ts +17 -0
- package/dist/components/Calendar/components/EventSlot.d.ts +17 -0
- package/dist/components/Calendar/components/HighlightBadge.d.ts +5 -0
- package/dist/components/Calendar/components/MonthView.d.ts +19 -0
- package/dist/components/Calendar/components/MoreEventsPopover.d.ts +16 -0
- package/dist/components/Calendar/components/TaskCheckbox.d.ts +8 -0
- package/dist/components/Calendar/components/useEventClick.d.ts +10 -0
- package/dist/components/Calendar/consts.d.ts +47 -0
- package/dist/components/Calendar/index.d.ts +2 -0
- package/dist/components/Calendar/styles.d.ts +137 -0
- package/dist/components/Calendar/types.d.ts +383 -0
- package/dist/components/Calendar/utils.d.ts +116 -0
- package/dist/components/NestedTable/NestedTableContext.d.ts +3 -3
- package/dist/components/NestedTable/components/NestedTable.d.ts +37 -4
- package/dist/components/NestedTable/components/NestedTableCell.d.ts +2 -3
- package/dist/components/NestedTable/components/NestedTableCellBase.d.ts +16 -0
- package/dist/components/NestedTable/components/NestedTableCellHeader.d.ts +36 -0
- package/dist/components/NestedTable/components/index.d.ts +1 -0
- package/dist/components/NestedTable/consts.d.ts +5 -0
- package/dist/components/NestedTable/hooks/useNestedTableContext.d.ts +1 -1
- package/dist/components/NestedTable/types.d.ts +31 -0
- package/dist/components/Table/ColumnFreezeContext.d.ts +27 -0
- package/dist/components/Table/ColumnFreezeMenu.d.ts +33 -0
- package/dist/components/Table/TableBase.d.ts +8 -1
- package/dist/components/Table/hooks/useColumnFreeze.d.ts +44 -0
- package/dist/components/Table/index.d.ts +2 -0
- package/dist/components/Table/types.d.ts +97 -2
- package/dist/components/Table/utils.d.ts +21 -0
- package/dist/components/TableCellHeader/TableCellHeader.d.ts +2 -1
- package/dist/components/TableCellHeader/types.d.ts +17 -0
- package/dist/components/TableContainer/TableContainer.d.ts +50 -0
- package/dist/components/TableContainer/index.d.ts +2 -0
- package/dist/components/TableContainer/types.d.ts +21 -0
- package/dist/components/index.d.ts +6 -2
- package/dist/index.js +3948 -352
- package/dist/index.mjs +3711 -121
- package/dist/tsbuildcache +1 -1
- package/dist/types/emotion.d.ts +2 -0
- package/package.json +3 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DateTime } from 'luxon';
|
|
2
|
+
import { NormalizedEvent } from '../utils';
|
|
3
|
+
type MoreEventsPopoverProps = {
|
|
4
|
+
date: DateTime;
|
|
5
|
+
/** Entries the cell had no room for — only these are listed. */
|
|
6
|
+
items: NormalizedEvent[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* The "+N more" button of a month cell and the card it opens.
|
|
10
|
+
*
|
|
11
|
+
* Controlled, so the close button can be a plain icon (the kit's
|
|
12
|
+
* `PopoverClose` wraps it in a padded `Button`) and so picking an entry can
|
|
13
|
+
* close the card.
|
|
14
|
+
*/
|
|
15
|
+
export declare const MoreEventsPopover: ({ date, items }: MoreEventsPopoverProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CalendarEvent } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Completion checkbox of a `task` entry. Read-only (disabled) when the
|
|
4
|
+
* calendar has no `onTaskToggle`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TaskCheckbox: ({ event }: {
|
|
7
|
+
event: CalendarEvent;
|
|
8
|
+
}) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
import { CalendarEvent } from '../types';
|
|
3
|
+
/** Marks the root of an entry, the element details anchor to. */
|
|
4
|
+
export declare const EVENT_ROOT_ATTRIBUTE = "data-calendar-event";
|
|
5
|
+
/**
|
|
6
|
+
* Click handler of an entry: fires `onEventClick` and opens the details card,
|
|
7
|
+
* anchored to the entry's root (or to `getAnchor()` when given). `undefined`
|
|
8
|
+
* when entries aren't clickable.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useEventClick: (event: CalendarEvent, getAnchor?: () => HTMLElement | null) => ((clickEvent: MouseEvent<HTMLElement>) => void) | undefined;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Theme } from '@emotion/react';
|
|
2
|
+
import { CalendarColor, CalendarHighlightColor } from './types';
|
|
3
|
+
/** Height of a month-grid cell, and the minimum when it holds more. */
|
|
4
|
+
export declare const MONTH_CELL_MIN_HEIGHT = 178;
|
|
5
|
+
/** Width of the weekly total column: 7-day and 5-day grids. */
|
|
6
|
+
export declare const TOTAL_COLUMN_WIDTH: {
|
|
7
|
+
readonly 7: 91;
|
|
8
|
+
readonly 5: 160;
|
|
9
|
+
};
|
|
10
|
+
/** Height of one hour on the day view's timeline. */
|
|
11
|
+
export declare const HOUR_HEIGHT = 68;
|
|
12
|
+
/**
|
|
13
|
+
* Space above the 00:00 line. It holds untimed entries, and leaves room for
|
|
14
|
+
* the 00:00 label, which is centred on its line.
|
|
15
|
+
*/
|
|
16
|
+
export declare const TIMELINE_LEAD: number;
|
|
17
|
+
/**
|
|
18
|
+
* Height of the day view's scrolling timeline when the calendar has no
|
|
19
|
+
* height of its own: the untimed row and twelve hours.
|
|
20
|
+
*/
|
|
21
|
+
export declare const DAY_SCROLL_HEIGHT: number;
|
|
22
|
+
/** Width of the hour labels column. */
|
|
23
|
+
export declare const HOUR_GUTTER_WIDTH = 64;
|
|
24
|
+
/** Vertical gap between stacked timed events, split above and below. */
|
|
25
|
+
export declare const DAY_EVENT_GAP = 5;
|
|
26
|
+
/** Shortest an event is drawn, however brief. */
|
|
27
|
+
export declare const DAY_EVENT_MIN_HEIGHT = 15;
|
|
28
|
+
/** Stripe colour per palette entry. */
|
|
29
|
+
export declare const getEventColor: (theme: Theme, color: CalendarColor) => `rgb${string}` | undefined;
|
|
30
|
+
/** Outline, 8% tint and badge gradient of a whole-day highlight. */
|
|
31
|
+
export declare const getHighlightColors: (theme: Theme, color: CalendarHighlightColor) => {
|
|
32
|
+
outline: `rgb${string}` | undefined;
|
|
33
|
+
tint: string;
|
|
34
|
+
gradient: string;
|
|
35
|
+
} | {
|
|
36
|
+
outline: `rgb${string}` | undefined;
|
|
37
|
+
tint: string;
|
|
38
|
+
gradient: string;
|
|
39
|
+
} | {
|
|
40
|
+
outline: `rgb${string}` | undefined;
|
|
41
|
+
tint: string;
|
|
42
|
+
gradient: string;
|
|
43
|
+
} | {
|
|
44
|
+
outline: `rgb${string}` | undefined;
|
|
45
|
+
tint: string;
|
|
46
|
+
gradient: string;
|
|
47
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { Theme } from '@emotion/react';
|
|
2
|
+
export declare const root: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
3
|
+
/**
|
|
4
|
+
* Everything under the toolbar. Takes the root's height when it has one, and
|
|
5
|
+
* holds the loading bar.
|
|
6
|
+
*/
|
|
7
|
+
export declare const body: import("@emotion/react").SerializedStyles;
|
|
8
|
+
export declare const loadingBar: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
9
|
+
/** Entries already shown are dimmed while new ones load. */
|
|
10
|
+
export declare const bodyLoading: import("@emotion/react").SerializedStyles;
|
|
11
|
+
export declare const toolbar: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
12
|
+
export declare const toolbarNav: import("@emotion/react").SerializedStyles;
|
|
13
|
+
export declare const toolbarTitle: import("@emotion/react").SerializedStyles;
|
|
14
|
+
export declare const toolbarViews: import("@emotion/react").SerializedStyles;
|
|
15
|
+
export declare const toolbarEnd: import("@emotion/react").SerializedStyles;
|
|
16
|
+
/**
|
|
17
|
+
* The header and the week rows scroll together, so the header can't drift
|
|
18
|
+
* from the columns by a scrollbar's width; it stays in view with `sticky`.
|
|
19
|
+
*/
|
|
20
|
+
export declare const monthScroll: import("@emotion/react").SerializedStyles;
|
|
21
|
+
/**
|
|
22
|
+
* Header and body share these tracks, and the same 2px column gap, so their
|
|
23
|
+
* columns line up without measuring.
|
|
24
|
+
*/
|
|
25
|
+
export declare const monthColumns: (weekdays: 5 | 7, withTotal: boolean) => import("@emotion/react").SerializedStyles;
|
|
26
|
+
export declare const monthHeader: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
27
|
+
export declare const monthHeaderCell: import("@emotion/react").SerializedStyles;
|
|
28
|
+
/** The 2px gaps between cells show this grey as the grid lines. */
|
|
29
|
+
export declare const monthBody: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
30
|
+
export declare const monthCell: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
31
|
+
export declare const monthCellWeekend: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
32
|
+
/** Hover and keyboard focus outline the cell, when days can be added to. */
|
|
33
|
+
export declare const monthCellInteractive: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
34
|
+
export declare const monthCellHighlight: (outline: string | undefined, tint: string) => import("@emotion/react").SerializedStyles;
|
|
35
|
+
export declare const monthCellHead: import("@emotion/react").SerializedStyles;
|
|
36
|
+
export declare const dateNumber: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
37
|
+
export declare const dateNumberClickable: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
38
|
+
export declare const dateNumberOutside: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
39
|
+
export declare const dateNumberToday: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
40
|
+
/**
|
|
41
|
+
* Hidden with `opacity` rather than `display` so it stays reachable by
|
|
42
|
+
* keyboard. The hiding only applies to pointers that can hover; on touch
|
|
43
|
+
* screens the button is always shown.
|
|
44
|
+
*/
|
|
45
|
+
export declare const addButton: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
46
|
+
export declare const addButtonOnHover: import("@emotion/react").SerializedStyles;
|
|
47
|
+
export declare const monthEvents: import("@emotion/react").SerializedStyles;
|
|
48
|
+
export declare const moreButton: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
49
|
+
export declare const totalCell: (weekdays: 5 | 7) => (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
50
|
+
export declare const footer: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
51
|
+
/** A 34px entry row: colour stripe, title, optional time and trailing. */
|
|
52
|
+
export declare const slot: (theme: Theme, stripe: string | undefined) => import("@emotion/react").SerializedStyles;
|
|
53
|
+
export declare const slotButton: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
54
|
+
/** Lets the content button fill the row when the row also holds a checkbox. */
|
|
55
|
+
export declare const slotContentButton: import("@emotion/react").SerializedStyles;
|
|
56
|
+
export declare const slotContent: import("@emotion/react").SerializedStyles;
|
|
57
|
+
export declare const slotMain: import("@emotion/react").SerializedStyles;
|
|
58
|
+
export declare const slotTitle: import("@emotion/react").SerializedStyles;
|
|
59
|
+
export declare const slotTime: import("@emotion/react").SerializedStyles;
|
|
60
|
+
export declare const slotTrailing: import("@emotion/react").SerializedStyles;
|
|
61
|
+
/** Above the row-wide click area of `slotContentButton`. */
|
|
62
|
+
export declare const slotActions: import("@emotion/react").SerializedStyles;
|
|
63
|
+
/** Above the row-wide click area of `slotContentButton`. */
|
|
64
|
+
export declare const slotCheckbox: import("@emotion/react").SerializedStyles;
|
|
65
|
+
export declare const highlightRow: import("@emotion/react").SerializedStyles;
|
|
66
|
+
/** In a month cell the row starts at the cell's edge, past its padding. */
|
|
67
|
+
export declare const highlightRowInCell: import("@emotion/react").SerializedStyles;
|
|
68
|
+
export declare const highlightButton: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
69
|
+
export declare const highlightMain: import("@emotion/react").SerializedStyles;
|
|
70
|
+
export declare const highlightBadge: (gradient: string) => import("@emotion/react").SerializedStyles;
|
|
71
|
+
export declare const popover: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
72
|
+
export declare const popoverHeader: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
73
|
+
export declare const popoverClose: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
74
|
+
export declare const popoverList: import("@emotion/react").SerializedStyles;
|
|
75
|
+
export declare const dayHeader: (theme: Theme, compact: boolean) => import("@emotion/react").SerializedStyles;
|
|
76
|
+
export declare const backButton: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
77
|
+
export declare const dayHeaderDate: import("@emotion/react").SerializedStyles;
|
|
78
|
+
export declare const dayBadge: (theme: Theme, isToday: boolean) => import("@emotion/react").SerializedStyles;
|
|
79
|
+
export declare const dayHeaderWeekdayShort: import("@emotion/react").SerializedStyles;
|
|
80
|
+
export declare const dayHeaderTitle: (size: "weekday" | "monthYear") => import("@emotion/react").SerializedStyles;
|
|
81
|
+
/**
|
|
82
|
+
* Shows a default window of the timeline when the calendar has no height of
|
|
83
|
+
* its own, and grows or shrinks to the calendar's height when it has one.
|
|
84
|
+
*/
|
|
85
|
+
export declare const dayScroll: import("@emotion/react").SerializedStyles;
|
|
86
|
+
/**
|
|
87
|
+
* Every row of the day view is the hour-label column plus the day's column,
|
|
88
|
+
* so the labels line up with their rows without measuring.
|
|
89
|
+
*/
|
|
90
|
+
export declare const dayRow: import("@emotion/react").SerializedStyles;
|
|
91
|
+
export declare const hourGutter: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
92
|
+
/** Centred on the line that starts its hour. */
|
|
93
|
+
export declare const hourLabel: import("@emotion/react").SerializedStyles;
|
|
94
|
+
/**
|
|
95
|
+
* Untimed entries stay in view while the timeline scrolls under them, as an
|
|
96
|
+
* all-day row does.
|
|
97
|
+
*/
|
|
98
|
+
export declare const dayLeadRow: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
99
|
+
/**
|
|
100
|
+
* The sticky untimed row would hide the top half of 00:00, so that one label
|
|
101
|
+
* sits just under its line instead.
|
|
102
|
+
*/
|
|
103
|
+
export declare const hourLabelFirst: import("@emotion/react").SerializedStyles;
|
|
104
|
+
/** Above 00:00. Grows to fit untimed entries. */
|
|
105
|
+
export declare const dayLead: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
106
|
+
export declare const hourCell: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
107
|
+
export declare const hourCellLast: import("@emotion/react").SerializedStyles;
|
|
108
|
+
export declare const hourCellAddable: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
109
|
+
export declare const dayHighlight: (outline: string | undefined, tint: string) => import("@emotion/react").SerializedStyles;
|
|
110
|
+
export declare const dayHighlightLabel: import("@emotion/react").SerializedStyles;
|
|
111
|
+
/** Where the timeline's hours start, below the lead area. */
|
|
112
|
+
export declare const timeline: import("@emotion/react").SerializedStyles;
|
|
113
|
+
/** Holds the timed events over the hour cells, right of the labels. */
|
|
114
|
+
export declare const dayEventsLayer: import("@emotion/react").SerializedStyles;
|
|
115
|
+
/** Places a timed entry; its content fills it. */
|
|
116
|
+
export declare const dayEventBox: import("@emotion/react").SerializedStyles;
|
|
117
|
+
export type DayEventSize = 'large' | 'medium' | 'small';
|
|
118
|
+
export declare const dayEvent: (theme: Theme, stripe: string | undefined, size: DayEventSize) => import("@emotion/react").SerializedStyles;
|
|
119
|
+
export declare const dayEventContent: (size: DayEventSize) => import("@emotion/react").SerializedStyles;
|
|
120
|
+
export declare const dayEventTitle: (size: DayEventSize) => import("@emotion/react").SerializedStyles;
|
|
121
|
+
export declare const dayEventTime: (size: DayEventSize) => import("@emotion/react").SerializedStyles;
|
|
122
|
+
export declare const dayTask: import("@emotion/react").SerializedStyles;
|
|
123
|
+
export declare const nowPointer: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
124
|
+
export declare const detailsLayer: import("@emotion/react").SerializedStyles;
|
|
125
|
+
export declare const detailsOverlay: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
126
|
+
export declare const details: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
127
|
+
export declare const detailsHeader: import("@emotion/react").SerializedStyles;
|
|
128
|
+
export declare const detailsTitle: import("@emotion/react").SerializedStyles;
|
|
129
|
+
export declare const detailsSubtitle: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
130
|
+
export declare const detailsActions: import("@emotion/react").SerializedStyles;
|
|
131
|
+
/** Two columns of label/value pairs, one on narrow screens. */
|
|
132
|
+
export declare const detailsFields: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
133
|
+
export declare const detailsField: (theme: Theme) => import("@emotion/react").SerializedStyles;
|
|
134
|
+
export declare const fullRow: import("@emotion/react").SerializedStyles;
|
|
135
|
+
export declare const detailsLabel: import("@emotion/react").SerializedStyles;
|
|
136
|
+
export declare const detailsValue: import("@emotion/react").SerializedStyles;
|
|
137
|
+
export declare const visuallyHidden: import("@emotion/react").SerializedStyles;
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { CSSProperties, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
import { IconProps } from '../Icon/types';
|
|
3
|
+
/**
|
|
4
|
+
* Which grid the calendar draws: a whole month of day cells, or a single day
|
|
5
|
+
* on an hour timeline.
|
|
6
|
+
*/
|
|
7
|
+
export type CalendarView = 'month' | 'day';
|
|
8
|
+
/**
|
|
9
|
+
* Overall flavour of the month grid.
|
|
10
|
+
*
|
|
11
|
+
* - `events` — a plain calendar.
|
|
12
|
+
* - `timeTracker` — adds a trailing column per week whose content comes from
|
|
13
|
+
* `renderWeekTotal`, for things like "hours logged this week".
|
|
14
|
+
*/
|
|
15
|
+
export type CalendarVariant = 'events' | 'timeTracker';
|
|
16
|
+
/**
|
|
17
|
+
* Colour of an event's stripe. The nine colours of the design's calendar
|
|
18
|
+
* palette.
|
|
19
|
+
*/
|
|
20
|
+
export type CalendarColor = 'purple' | 'blue' | 'lightBlue' | 'turquoise' | 'cyan' | 'green' | 'yellow' | 'orange' | 'red';
|
|
21
|
+
/**
|
|
22
|
+
* Colour of a whole-day highlight — the tinted, outlined cell used for days
|
|
23
|
+
* off, holidays and the like.
|
|
24
|
+
*/
|
|
25
|
+
export type CalendarHighlightColor = 'purple' | 'turquoise' | 'red' | 'yellow';
|
|
26
|
+
/**
|
|
27
|
+
* A date the calendar accepts: a `Date`, or an ISO 8601 string such as
|
|
28
|
+
* `'2026-10-12'` or `'2026-10-12T09:30'`.
|
|
29
|
+
*/
|
|
30
|
+
export type CalendarDateInput = Date | string;
|
|
31
|
+
/**
|
|
32
|
+
* A single entry on the calendar.
|
|
33
|
+
*/
|
|
34
|
+
export type CalendarEvent<TData = unknown> = {
|
|
35
|
+
/** Unique id. Used as the React key. */
|
|
36
|
+
id: string | number;
|
|
37
|
+
/** Text of the entry. */
|
|
38
|
+
title: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* When the entry happens. Only the date part is used for `allDay` entries.
|
|
41
|
+
*/
|
|
42
|
+
start: CalendarDateInput;
|
|
43
|
+
/**
|
|
44
|
+
* When the entry ends. Defaults to 30 minutes after `start` for a timed
|
|
45
|
+
* entry, and to its start day for an `allDay` one — whose `end` is the
|
|
46
|
+
* last day it covers (inclusive; only the date part counts).
|
|
47
|
+
*
|
|
48
|
+
* An `allDay` entry over several days, or a timed one lasting 24 hours or
|
|
49
|
+
* more, is repeated on each day it covers (up to a year). A shorter timed
|
|
50
|
+
* entry that crosses midnight stays on its start day in the month grid,
|
|
51
|
+
* and continues on the next day's timeline in the day view.
|
|
52
|
+
*/
|
|
53
|
+
end?: CalendarDateInput;
|
|
54
|
+
/**
|
|
55
|
+
* The entry has no time of day — a holiday, a reminder, or a time log that
|
|
56
|
+
* records a duration but not when it happened. Untimed entries are listed
|
|
57
|
+
* without a time in the month grid and above the hour timeline in the day
|
|
58
|
+
* view.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
allDay?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Stripe colour.
|
|
64
|
+
* @default 'blue'
|
|
65
|
+
*/
|
|
66
|
+
color?: CalendarColor;
|
|
67
|
+
/**
|
|
68
|
+
* `task` entries get a completion checkbox; see `completed` and
|
|
69
|
+
* `onTaskToggle` on the calendar.
|
|
70
|
+
* @default 'event'
|
|
71
|
+
*/
|
|
72
|
+
kind?: 'event' | 'task';
|
|
73
|
+
/** Whether a `task` is done. */
|
|
74
|
+
completed?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Content at the end of the entry — for example the logged duration
|
|
77
|
+
* (`'2:30'`), a status badge or an avatar group.
|
|
78
|
+
*/
|
|
79
|
+
trailing?: ReactNode;
|
|
80
|
+
/** Anything the consumer wants back in callbacks. */
|
|
81
|
+
data?: TData;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* A whole-day highlight: the cell gets a tinted background and outline, and
|
|
85
|
+
* a badge with an icon and label is listed first.
|
|
86
|
+
*/
|
|
87
|
+
export type CalendarDayHighlight = {
|
|
88
|
+
/** Tint, outline and badge colour. */
|
|
89
|
+
color: CalendarHighlightColor;
|
|
90
|
+
/** Text next to the badge, e.g. `'Vacation'`. */
|
|
91
|
+
label: ReactNode;
|
|
92
|
+
/**
|
|
93
|
+
* Icon inside the round badge. A string is taken as an icon name from the
|
|
94
|
+
* kit's set and drawn white at 16px; any other node is rendered as is.
|
|
95
|
+
*/
|
|
96
|
+
icon?: IconProps['name'] | ReactNode;
|
|
97
|
+
/** Content at the end of the badge row, e.g. `'8:00'`. */
|
|
98
|
+
trailing?: ReactNode;
|
|
99
|
+
/** Makes the badge row clickable. */
|
|
100
|
+
onClick?: () => void;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Per-day options returned by `getDayProps`.
|
|
104
|
+
*/
|
|
105
|
+
export type CalendarDayProps = {
|
|
106
|
+
/** Turns the day into a highlighted, whole-day cell. */
|
|
107
|
+
highlight?: CalendarDayHighlight;
|
|
108
|
+
/**
|
|
109
|
+
* Hides the add button for this day, e.g. on a holiday. For a range of
|
|
110
|
+
* days, use `minAddDate` / `maxAddDate`.
|
|
111
|
+
* @default false
|
|
112
|
+
*/
|
|
113
|
+
disableAdd?: boolean;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* A week row of the month grid, handed to `renderWeekTotal`.
|
|
117
|
+
*/
|
|
118
|
+
export type CalendarWeek<TData = unknown> = {
|
|
119
|
+
/** Monday of the week. */
|
|
120
|
+
start: Date;
|
|
121
|
+
/** Last day shown in the row (Friday or Sunday). */
|
|
122
|
+
end: Date;
|
|
123
|
+
/** Days shown in the row, including days of the neighbouring months. */
|
|
124
|
+
days: Date[];
|
|
125
|
+
/**
|
|
126
|
+
* Events of the row's days that fall in the displayed month — the ones a
|
|
127
|
+
* weekly total would normally add up. Each event is listed once, even
|
|
128
|
+
* one repeated over several of the days.
|
|
129
|
+
*/
|
|
130
|
+
events: CalendarEvent<TData>[];
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Where an event is being drawn, handed to `renderEventActions`.
|
|
134
|
+
*/
|
|
135
|
+
export type CalendarEventSlotContext = {
|
|
136
|
+
view: CalendarView;
|
|
137
|
+
/** `true` inside the "+N more" popover. */
|
|
138
|
+
inPopover: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Which day of a multi-day entry this is, from 1. Always 1 for a
|
|
141
|
+
* single-day entry.
|
|
142
|
+
*/
|
|
143
|
+
dayOfSpan: number;
|
|
144
|
+
/** Days a multi-day entry is repeated on; 1 for a single-day entry. */
|
|
145
|
+
spanDays: number;
|
|
146
|
+
};
|
|
147
|
+
/**
|
|
148
|
+
* Handed to `renderEvent`: where the event is drawn, the default rendering
|
|
149
|
+
* to wrap or extend, and the click handler to put on a custom entry.
|
|
150
|
+
*/
|
|
151
|
+
export type CalendarEventRenderContext = CalendarEventSlotContext & {
|
|
152
|
+
/**
|
|
153
|
+
* The entry as the calendar would draw it. Return it wrapped, or next to
|
|
154
|
+
* something else, to extend the default rather than replace it.
|
|
155
|
+
*/
|
|
156
|
+
defaultContent: ReactNode;
|
|
157
|
+
/**
|
|
158
|
+
* Fires `onEventClick` and opens `renderEventDetails`, anchored to the
|
|
159
|
+
* clicked element. Put it on the clickable part of a custom entry.
|
|
160
|
+
* `undefined` when entries aren't clickable.
|
|
161
|
+
*/
|
|
162
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Extra attributes for an entry's default rendering, returned by
|
|
166
|
+
* `getEventProps`.
|
|
167
|
+
*/
|
|
168
|
+
export type CalendarEventProps = {
|
|
169
|
+
/** Added to the entry's root, e.g. an emotion class to restyle it. */
|
|
170
|
+
className?: string;
|
|
171
|
+
style?: CSSProperties;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Second argument of `onEventClick`.
|
|
175
|
+
*/
|
|
176
|
+
export type CalendarEventClickInfo = {
|
|
177
|
+
/**
|
|
178
|
+
* The element the entry is drawn as — to anchor your own popover to. For
|
|
179
|
+
* an entry in the "+N more" popover, the "+N more" button, since the
|
|
180
|
+
* popover closes on click.
|
|
181
|
+
*/
|
|
182
|
+
anchor: HTMLElement;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Handed to `renderEventDetails`.
|
|
186
|
+
*/
|
|
187
|
+
export type CalendarEventDetailsControls = {
|
|
188
|
+
/** Closes the details. */
|
|
189
|
+
close: () => void;
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* The days a view shows, handed to `onRangeChange`.
|
|
193
|
+
*/
|
|
194
|
+
export type CalendarRange = {
|
|
195
|
+
view: CalendarView;
|
|
196
|
+
/** Start of the first day shown. */
|
|
197
|
+
start: Date;
|
|
198
|
+
/** End of the last day shown (23:59:59.999). */
|
|
199
|
+
end: Date;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Props of the {@link Calendar} component.
|
|
203
|
+
*/
|
|
204
|
+
export type CalendarProps<TData = unknown> = {
|
|
205
|
+
/**
|
|
206
|
+
* Entries to show. They don't have to be limited to the visible range.
|
|
207
|
+
*/
|
|
208
|
+
events?: CalendarEvent<TData>[];
|
|
209
|
+
/**
|
|
210
|
+
* Month grid or single-day timeline. Passing it makes the view
|
|
211
|
+
* controlled: change it from `onViewChange`.
|
|
212
|
+
*/
|
|
213
|
+
view?: CalendarView;
|
|
214
|
+
/**
|
|
215
|
+
* View to start in when `view` isn't controlled.
|
|
216
|
+
* @default the first of `views`
|
|
217
|
+
*/
|
|
218
|
+
defaultView?: CalendarView;
|
|
219
|
+
/**
|
|
220
|
+
* Called when the calendar switches view: a day number opens the `day`
|
|
221
|
+
* view; the day view's back button (shown when there's no toolbar) and
|
|
222
|
+
* the toolbar's toggle switch between the two.
|
|
223
|
+
*/
|
|
224
|
+
onViewChange?: (view: CalendarView) => void;
|
|
225
|
+
/**
|
|
226
|
+
* Views the user can switch between. With a single view there is no
|
|
227
|
+
* switching: day numbers don't open the day view, and the toolbar has no
|
|
228
|
+
* toggle.
|
|
229
|
+
* @default ['month', 'day']
|
|
230
|
+
*/
|
|
231
|
+
views?: CalendarView[];
|
|
232
|
+
/**
|
|
233
|
+
* Date on show: any day of the month in the `month` view, the day itself
|
|
234
|
+
* in the `day` view. Passing it makes the date controlled: change it from
|
|
235
|
+
* `onDateChange`.
|
|
236
|
+
*/
|
|
237
|
+
date?: CalendarDateInput;
|
|
238
|
+
/**
|
|
239
|
+
* Date to start on when `date` isn't controlled.
|
|
240
|
+
* @default today
|
|
241
|
+
*/
|
|
242
|
+
defaultDate?: CalendarDateInput;
|
|
243
|
+
/**
|
|
244
|
+
* Called when the calendar moves to another date: the toolbar's arrows
|
|
245
|
+
* and "Today" button, or a day number opening the day view.
|
|
246
|
+
*/
|
|
247
|
+
onDateChange?: (date: Date) => void;
|
|
248
|
+
/**
|
|
249
|
+
* Called with the days on show whenever they change, and once on mount —
|
|
250
|
+
* the range to fetch events for.
|
|
251
|
+
*/
|
|
252
|
+
onRangeChange?: (range: CalendarRange) => void;
|
|
253
|
+
/**
|
|
254
|
+
* Shows a bar above the grid with previous/next and "Today" buttons, the
|
|
255
|
+
* date on show and, with more than one of `views`, a Month/Day toggle.
|
|
256
|
+
* @default false
|
|
257
|
+
*/
|
|
258
|
+
toolbar?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Content at the end of the toolbar, e.g. a "Create" button.
|
|
261
|
+
*/
|
|
262
|
+
toolbarEnd?: ReactNode;
|
|
263
|
+
/**
|
|
264
|
+
* Marks the calendar busy while events load: a progress bar runs along
|
|
265
|
+
* the top and the region gets `aria-busy`. Entries already shown stay.
|
|
266
|
+
* @default false
|
|
267
|
+
*/
|
|
268
|
+
loading?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Adds the weekly total column to the month grid. See {@link CalendarVariant}.
|
|
271
|
+
* @default 'events'
|
|
272
|
+
*/
|
|
273
|
+
variant?: CalendarVariant;
|
|
274
|
+
/**
|
|
275
|
+
* Columns of the month grid: Monday–Friday or Monday–Sunday.
|
|
276
|
+
* @default 7
|
|
277
|
+
*/
|
|
278
|
+
weekdays?: 5 | 7;
|
|
279
|
+
/**
|
|
280
|
+
* Entries listed in a month cell before the rest collapse behind a
|
|
281
|
+
* "+N more" button.
|
|
282
|
+
* @default 3
|
|
283
|
+
*/
|
|
284
|
+
maxEventsPerDay?: number;
|
|
285
|
+
/**
|
|
286
|
+
* Content of the weekly total cell in the `timeTracker` variant.
|
|
287
|
+
*/
|
|
288
|
+
renderWeekTotal?: (week: CalendarWeek<TData>) => ReactNode;
|
|
289
|
+
/**
|
|
290
|
+
* Header text of the total column.
|
|
291
|
+
* @default 'Total'
|
|
292
|
+
*/
|
|
293
|
+
totalLabel?: ReactNode;
|
|
294
|
+
/**
|
|
295
|
+
* Bar under the month grid, e.g. "Monthly norm" and "Reported" figures.
|
|
296
|
+
* Laid out as a row with space between its children.
|
|
297
|
+
*/
|
|
298
|
+
footer?: ReactNode;
|
|
299
|
+
/**
|
|
300
|
+
* Per-day options: whole-day highlights and disabling the add button.
|
|
301
|
+
*/
|
|
302
|
+
getDayProps?: (date: Date) => CalendarDayProps | undefined;
|
|
303
|
+
/**
|
|
304
|
+
* Shows an add button on each day (on hover in the month grid) and in the
|
|
305
|
+
* day view header. Receives the day clicked.
|
|
306
|
+
*/
|
|
307
|
+
onAddEvent?: (date: Date) => void;
|
|
308
|
+
/**
|
|
309
|
+
* First day the add button shows on, e.g. today to stop adding to the
|
|
310
|
+
* past. Inclusive; only the date part counts.
|
|
311
|
+
*/
|
|
312
|
+
minAddDate?: CalendarDateInput;
|
|
313
|
+
/**
|
|
314
|
+
* Last day the add button shows on, e.g. today to stop adding to the
|
|
315
|
+
* future. Inclusive; only the date part counts. For one-off days, use
|
|
316
|
+
* `getDayProps(date).disableAdd`.
|
|
317
|
+
*/
|
|
318
|
+
maxAddDate?: CalendarDateInput;
|
|
319
|
+
/**
|
|
320
|
+
* Makes entries clickable. `info.anchor` is the clicked element, to anchor
|
|
321
|
+
* your own popover to.
|
|
322
|
+
*/
|
|
323
|
+
onEventClick?: (event: CalendarEvent<TData>, info: CalendarEventClickInfo) => void;
|
|
324
|
+
/**
|
|
325
|
+
* Content of the card a clicked entry opens — typically a
|
|
326
|
+
* `CalendarEventDetails`. The calendar positions, opens and closes it;
|
|
327
|
+
* `close` closes it from inside (e.g. after deleting).
|
|
328
|
+
*/
|
|
329
|
+
renderEventDetails?: (event: CalendarEvent<TData>, controls: CalendarEventDetailsControls) => ReactNode;
|
|
330
|
+
/**
|
|
331
|
+
* How `renderEventDetails` opens: next to the clicked entry, or centred
|
|
332
|
+
* over the page.
|
|
333
|
+
* @default 'popover'
|
|
334
|
+
*/
|
|
335
|
+
eventDetailsDisplay?: 'popover' | 'modal';
|
|
336
|
+
/** Called when a task's checkbox is toggled. */
|
|
337
|
+
onTaskToggle?: (event: CalendarEvent<TData>, completed: boolean) => void;
|
|
338
|
+
/**
|
|
339
|
+
* Called when a day number of the month grid is clicked. Day numbers also
|
|
340
|
+
* open the `day` view unless switching views is off (see `views`).
|
|
341
|
+
*/
|
|
342
|
+
onDayClick?: (date: Date) => void;
|
|
343
|
+
/**
|
|
344
|
+
* Replaces how an entry is drawn. Return `undefined` to fall back to the
|
|
345
|
+
* default for that entry, or `context.defaultContent` wrapped to extend
|
|
346
|
+
* it.
|
|
347
|
+
*/
|
|
348
|
+
renderEvent?: (event: CalendarEvent<TData>, context: CalendarEventRenderContext) => ReactNode;
|
|
349
|
+
/**
|
|
350
|
+
* Buttons at the end of an entry, outside its click target — e.g. a
|
|
351
|
+
* remove button. Shown after `trailing`.
|
|
352
|
+
*/
|
|
353
|
+
renderEventActions?: (event: CalendarEvent<TData>, context: CalendarEventSlotContext) => ReactNode;
|
|
354
|
+
/**
|
|
355
|
+
* Class name and style for an entry's default rendering, to restyle it
|
|
356
|
+
* per event.
|
|
357
|
+
*/
|
|
358
|
+
getEventProps?: (event: CalendarEvent<TData>) => CalendarEventProps | undefined;
|
|
359
|
+
/**
|
|
360
|
+
* Clock used for event times and the hour labels of the day view.
|
|
361
|
+
* @default '24h'
|
|
362
|
+
*/
|
|
363
|
+
timeFormat?: '24h' | '12h';
|
|
364
|
+
/**
|
|
365
|
+
* Header of the day view: the weekday name, or the month and year.
|
|
366
|
+
* @default 'monthYear'
|
|
367
|
+
*/
|
|
368
|
+
dayHeader?: 'weekday' | 'monthYear';
|
|
369
|
+
/**
|
|
370
|
+
* Locale for weekday and month names, e.g. `'uk'`. Defaults to the
|
|
371
|
+
* browser's.
|
|
372
|
+
*/
|
|
373
|
+
locale?: string;
|
|
374
|
+
/**
|
|
375
|
+
* Hour the day view scrolls to when it opens. Defaults to an hour before
|
|
376
|
+
* the current time on today, and to 8:00 on other days.
|
|
377
|
+
*/
|
|
378
|
+
scrollToHour?: number;
|
|
379
|
+
/** Accessible name of the calendar region. */
|
|
380
|
+
'aria-label'?: string;
|
|
381
|
+
className?: string;
|
|
382
|
+
style?: CSSProperties;
|
|
383
|
+
};
|