@tensor_1/react 2.31.0 → 2.33.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/README.md +367 -0
- package/dist/SchedulingCalendar-C4XVbqZr.d.ts +339 -0
- package/dist/attachment-labels.d.ts +16 -0
- package/dist/attachment-labels.js +9 -0
- package/dist/calendar-model.d.ts +141 -1
- package/dist/calendar-model.js +200 -11
- package/dist/chart-preset.cjs +127 -7
- package/dist/chart-preset.d.cts +2 -2
- package/dist/chart-preset.d.ts +1 -0
- package/dist/chart-preset.js +6 -1
- package/dist/chart-theme-Cl0IrkKQ.d.cts +112 -0
- package/dist/chart-theme.d.ts +51 -0
- package/dist/chart-theme.js +99 -0
- package/dist/chart.cjs +127 -7
- package/dist/chart.d.cts +2 -2
- package/dist/chart.d.ts +1 -0
- package/dist/chart.js +6 -2
- package/dist/components/Alert.d.ts +17 -1
- package/dist/components/Alert.js +9 -4
- package/dist/components/AlertDismiss.d.ts +14 -0
- package/dist/components/AlertDismiss.js +11 -0
- package/dist/components/Attachment.d.ts +15 -12
- package/dist/components/Attachment.js +17 -17
- package/dist/components/AttachmentParts.d.ts +24 -0
- package/dist/components/AttachmentParts.js +20 -0
- package/dist/components/Chart.d.ts +1 -0
- package/dist/components/Chart.js +6 -1
- package/dist/components/ChartCore.d.ts +6 -1
- package/dist/components/ChartCore.js +23 -5
- package/dist/components/Chip.d.ts +17 -2
- package/dist/components/Chip.js +35 -11
- package/dist/components/ChipRemove.d.ts +17 -0
- package/dist/components/ChipRemove.js +13 -0
- package/dist/components/CollapsibleParts.d.ts +29 -0
- package/dist/components/CollapsibleParts.js +20 -0
- package/dist/components/CollapsibleSection.d.ts +30 -3
- package/dist/components/CollapsibleSection.js +7 -11
- package/dist/components/CollapsibleSectionState.d.ts +1 -1
- package/dist/components/CollapsibleSectionState.js +54 -27
- package/dist/components/DashboardGrid.d.ts +60 -0
- package/dist/components/DashboardGrid.js +40 -0
- package/dist/components/DateRangePicker.d.ts +7 -1
- package/dist/components/DateRangePicker.js +5 -1
- package/dist/components/DescriptionList.d.ts +12 -1
- package/dist/components/DescriptionList.js +5 -5
- package/dist/components/Dialogs.d.ts +24 -3
- package/dist/components/Dialogs.js +74 -16
- package/dist/components/FileUpload.d.ts +10 -2
- package/dist/components/FileUpload.js +10 -4
- package/dist/components/FilterEditor.d.ts +4 -0
- package/dist/components/FilterEditor.js +13 -2
- package/dist/components/Heartbeat.d.ts +31 -0
- package/dist/components/Heartbeat.js +28 -0
- package/dist/components/Menu.d.ts +53 -5
- package/dist/components/Menu.js +104 -4
- package/dist/components/Meter.d.ts +7 -3
- package/dist/components/Meter.js +2 -1
- package/dist/components/Popover.d.ts +21 -2
- package/dist/components/Popover.js +94 -17
- package/dist/components/Prose.d.ts +6 -2
- package/dist/components/Prose.js +1 -1
- package/dist/components/RuleBuilder.d.ts +52 -4
- package/dist/components/RuleBuilder.js +109 -24
- package/dist/components/SchedulingCalendar.d.ts +4 -110
- package/dist/components/SchedulingCalendar.js +299 -63
- package/dist/components/SchedulingTimeGrid.d.ts +4 -0
- package/dist/components/SchedulingTimeGrid.js +521 -0
- package/dist/components/SchedulingTimeline.d.ts +2 -1
- package/dist/components/Segmented.d.ts +17 -3
- package/dist/components/Segmented.js +59 -5
- package/dist/components/Select.d.ts +66 -2
- package/dist/components/Select.js +800 -10
- package/dist/components/Spinner.d.ts +2 -1
- package/dist/components/Spinner.js +1 -1
- package/dist/components/StatusPill.d.ts +8 -2
- package/dist/components/StatusPill.js +2 -2
- package/dist/components/Steps.d.ts +28 -4
- package/dist/components/Steps.js +46 -16
- package/dist/components/TableControls.js +4 -3
- package/dist/components/Tabs.d.ts +7 -2
- package/dist/components/Tabs.js +14 -1
- package/dist/components/TextDiff.d.ts +49 -0
- package/dist/components/TextDiff.js +124 -0
- package/dist/{emoji-image-6mPZ15Zy.d.cts → emoji-image-DjCKpdwE.d.cts} +1 -1
- package/dist/emoji.cjs +169 -27
- package/dist/emoji.d.cts +3 -3
- package/dist/file-model.d.ts +22 -3
- package/dist/file-model.js +6 -4
- package/dist/filter-model.d.ts +26 -2
- package/dist/filter-model.js +13 -1
- package/dist/hooks/useAnchoredPosition.d.ts +24 -1
- package/dist/hooks/useAnchoredPosition.js +58 -8
- package/dist/hooks/useVirtualRows.d.ts +17 -2
- package/dist/hooks/useVirtualRows.js +6 -5
- package/dist/icons/Icon.d.ts +14 -14
- package/dist/index.cjs +4888 -1714
- package/dist/index.d.cts +1871 -658
- package/dist/index.d.ts +16 -9
- package/dist/index.js +67 -4
- package/dist/labels-context.d.ts +29 -1
- package/dist/{overlay-position-Cjv5E7mn.d.cts → overlay-position-2Afke51l.d.cts} +20 -0
- package/dist/overlay-position.d.ts +20 -0
- package/dist/overlay-position.js +17 -2
- package/dist/rich-text.cjs +169 -27
- package/dist/rich-text.d.cts +3 -3
- package/dist/rule-builder-model.d.ts +34 -2
- package/dist/rule-builder-model.js +48 -12
- package/dist/scheduling-calendar-model.d.ts +169 -0
- package/dist/scheduling-calendar-model.js +176 -0
- package/dist/select-model.d.ts +80 -0
- package/dist/select-model.js +109 -0
- package/dist/table-engine.d.ts +7 -0
- package/dist/table-engine.js +2 -1
- package/dist/text-diff-model.d.ts +71 -0
- package/dist/text-diff-model.js +261 -0
- package/package.json +1 -1
- package/dist/ChartCore-DzWe10bN.d.cts +0 -59
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { CalendarWeekday } from './calendar-model.js';
|
|
4
|
+
import { MoveProposal, MonthSpanLayout } from './scheduling-calendar-model.js';
|
|
5
|
+
|
|
6
|
+
interface TimeGridEntryContext {
|
|
7
|
+
/** Whole text lines that fit in the item: 0 shows the markers only. */
|
|
8
|
+
availableLines: number;
|
|
9
|
+
}
|
|
10
|
+
interface SchedulingTimeGridProps {
|
|
11
|
+
view: 'week' | 'day';
|
|
12
|
+
days: string[];
|
|
13
|
+
timeZone: string;
|
|
14
|
+
entries: SchedulingCalendarEntry[];
|
|
15
|
+
overlays: SchedulingCalendarOverlay[];
|
|
16
|
+
dayInfo?: Record<string, SchedulingCalendarDay>;
|
|
17
|
+
labels: Required<SchedulingCalendarLabels>;
|
|
18
|
+
gridLabel: string;
|
|
19
|
+
dateText: (date: string, part: SchedulingDatePart) => string;
|
|
20
|
+
formatInstant: (instant: string) => string;
|
|
21
|
+
entryName: (entry: SchedulingCalendarEntry) => string;
|
|
22
|
+
entryStatus: (entry: SchedulingCalendarEntry) => string;
|
|
23
|
+
entryMarkers: (entry: SchedulingCalendarEntry) => SchedulingMarker[];
|
|
24
|
+
overlayName: (overlay: SchedulingCalendarOverlay) => string;
|
|
25
|
+
renderEntry?: (entry: SchedulingCalendarEntry, context?: TimeGridEntryContext) => ReactNode;
|
|
26
|
+
renderMarker: (marker: SchedulingMarker, showLabel?: boolean) => ReactNode;
|
|
27
|
+
onSelectEntry?: (entry: SchedulingCalendarEntry) => void;
|
|
28
|
+
onSelectOverlay?: (overlay: SchedulingCalendarOverlay) => void;
|
|
29
|
+
onSelectDate?: (date: string) => void;
|
|
30
|
+
onShowMore?: (date: string, entries: SchedulingCalendarEntry[]) => void;
|
|
31
|
+
now?: string;
|
|
32
|
+
canMove: boolean;
|
|
33
|
+
step: number;
|
|
34
|
+
onProposeMove?: (id: string, proposal: MoveProposal) => void | Promise<unknown>;
|
|
35
|
+
topLaneCrossMidnightMinutes: number;
|
|
36
|
+
topLaneCap: number;
|
|
37
|
+
windowLaneCap: number;
|
|
38
|
+
maxLanes: number;
|
|
39
|
+
emptyNote?: ReactNode;
|
|
40
|
+
nothingToShow: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** Week (seven columns) or Day (one column) with an hour axis. */
|
|
43
|
+
declare function SchedulingTimeGrid({ view, days, timeZone, entries: givenEntries, overlays: givenOverlays, dayInfo, labels, gridLabel, dateText, formatInstant, entryName, entryStatus, entryMarkers, overlayName, renderEntry, renderMarker, onSelectEntry, onSelectOverlay, onSelectDate, onShowMore, now, canMove, step: givenStep, onProposeMove, topLaneCrossMidnightMinutes, topLaneCap, windowLaneCap, maxLanes, emptyNote, nothingToShow, }: SchedulingTimeGridProps): react.JSX.Element;
|
|
44
|
+
|
|
45
|
+
/** `day` is one column of the time grid. `week` is the time grid when `timeGrid` is set, else seven day cells. */
|
|
46
|
+
type SchedulingCalendarView = 'month' | 'week' | 'day' | 'agenda';
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated Use `band`, `status` and `markers` on the entry: they carry no product
|
|
49
|
+
* vocabulary and the consumer supplies every word. The values keep working in 2.x.
|
|
50
|
+
*/
|
|
51
|
+
type SchedulingEntryState = 'scheduled' | 'conflicted' | 'in-progress' | 'blackout-violation';
|
|
52
|
+
/** @deprecated Use `pattern` and `kindLabel` on the overlay. The values keep working in 2.x. */
|
|
53
|
+
type SchedulingOverlayKind = 'maintenance' | 'blackout';
|
|
54
|
+
/**
|
|
55
|
+
* The one dimension that takes a hue. `none` and `low` are untinted, `medium` gets a
|
|
56
|
+
* heavier edge, and only `high` is filled. The consumer decides what a band means.
|
|
57
|
+
*/
|
|
58
|
+
type SchedulingBand = 'none' | 'low' | 'medium' | 'high';
|
|
59
|
+
/**
|
|
60
|
+
* The state channel, drawn without hue: `tentative` is dashed, `committed` is the plain
|
|
61
|
+
* item, `live` carries a leading dot, `done` is dimmed and `dead` is struck through.
|
|
62
|
+
*/
|
|
63
|
+
type SchedulingStatus = 'tentative' | 'committed' | 'live' | 'done' | 'dead';
|
|
64
|
+
type SchedulingMarkerEmphasis = 'refused' | 'warning' | 'neutral';
|
|
65
|
+
/** How a window is hatched. Windows are neutral: the pattern and the visible label tell them apart. */
|
|
66
|
+
type SchedulingOverlayPattern = 'diagonal' | 'cross' | 'dotted' | 'solid';
|
|
67
|
+
/**
|
|
68
|
+
* Which date text a `formatDate` call is for (TENSOR B1/C9, HAR-1347):
|
|
69
|
+
* `day` names one day (each day cell's accessible name, the week-range title);
|
|
70
|
+
* `weekday` is the short column header (the date is any day of that weekday);
|
|
71
|
+
* `month` is the month-view title (the date is the first of the month);
|
|
72
|
+
* `column` heads one day column of the time grid (weekday and date, e.g. "Wed 07.10").
|
|
73
|
+
*/
|
|
74
|
+
type SchedulingDatePart = 'day' | 'weekday' | 'month' | 'column';
|
|
75
|
+
/** A shape or icon with text. The text is always in the accessible name; a marker never relies on colour. */
|
|
76
|
+
interface SchedulingMarker {
|
|
77
|
+
id: string;
|
|
78
|
+
/** An icon from `@tensor_1/react/icons`. Without one the marker draws a shape for its `emphasis`. */
|
|
79
|
+
icon?: ReactNode;
|
|
80
|
+
label: string;
|
|
81
|
+
emphasis?: SchedulingMarkerEmphasis;
|
|
82
|
+
}
|
|
83
|
+
interface SchedulingCalendarEntry {
|
|
84
|
+
id: string;
|
|
85
|
+
title: string;
|
|
86
|
+
start: string;
|
|
87
|
+
end: string;
|
|
88
|
+
/** @deprecated Use `band`, `status` and `markers`. */
|
|
89
|
+
state?: SchedulingEntryState;
|
|
90
|
+
meta?: string;
|
|
91
|
+
band?: SchedulingBand;
|
|
92
|
+
status?: SchedulingStatus;
|
|
93
|
+
markers?: SchedulingMarker[];
|
|
94
|
+
/** The complete accessible name, built by the consumer from its own words. Replaces `labels.entry`. */
|
|
95
|
+
accessibleName?: string;
|
|
96
|
+
/** No time of day. In the time grid the entry is drawn in the top lane. */
|
|
97
|
+
allDay?: boolean;
|
|
98
|
+
/** `false` keeps this entry where it is when the grid allows moves (`canMove`). */
|
|
99
|
+
movable?: boolean;
|
|
100
|
+
}
|
|
101
|
+
interface SchedulingCalendarOverlay {
|
|
102
|
+
id: string;
|
|
103
|
+
/** The window's name, shown as text. */
|
|
104
|
+
label: string;
|
|
105
|
+
start: string;
|
|
106
|
+
end: string;
|
|
107
|
+
/** @deprecated Use `pattern` and `kindLabel`. */
|
|
108
|
+
kind?: SchedulingOverlayKind;
|
|
109
|
+
/** Defaults to `'solid'`. */
|
|
110
|
+
pattern?: SchedulingOverlayPattern;
|
|
111
|
+
/** What kind of window this is, in the consumer's words. Shown before the name. */
|
|
112
|
+
kindLabel?: string;
|
|
113
|
+
/** What the window applies to. Shown after the name. */
|
|
114
|
+
scopeLabel?: string;
|
|
115
|
+
/** The window applies to everything. A window that is not global never gets the global treatment. */
|
|
116
|
+
global?: boolean;
|
|
117
|
+
/** The complete accessible name. Replaces `labels.overlay`. */
|
|
118
|
+
accessibleName?: string;
|
|
119
|
+
}
|
|
120
|
+
/** What the consumer knows about one day (`YYYY-MM-DD`). The calendar shows these numbers and never derives them. */
|
|
121
|
+
interface SchedulingCalendarDay {
|
|
122
|
+
/** Every item on the day, shown in the cell even when no chip fits. */
|
|
123
|
+
count: number;
|
|
124
|
+
/** The "+N" of the cell. 0 shows none. */
|
|
125
|
+
overflowCount: number;
|
|
126
|
+
/** The accessible text of the count, e.g. "7 items, 2 need review". */
|
|
127
|
+
label?: string;
|
|
128
|
+
markers?: SchedulingMarker[];
|
|
129
|
+
}
|
|
130
|
+
interface SchedulingLegendItem {
|
|
131
|
+
id: string;
|
|
132
|
+
label: string;
|
|
133
|
+
swatch: {
|
|
134
|
+
band?: SchedulingBand;
|
|
135
|
+
status?: SchedulingStatus;
|
|
136
|
+
pattern?: SchedulingOverlayPattern;
|
|
137
|
+
icon?: ReactNode;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Every word the calendar renders (TENSOR RX-125, UIX-12). `{timeZone}`, `{view}`,
|
|
142
|
+
* `{title}`, `{state}`, `{start}`, `{end}` are placeholders.
|
|
143
|
+
*/
|
|
144
|
+
interface SchedulingCalendarLabels {
|
|
145
|
+
region: string;
|
|
146
|
+
/** @deprecated Use `previousMonth` and `previousWeek`. Still used when those are not set. */
|
|
147
|
+
previous: string;
|
|
148
|
+
/** @deprecated Use `nextMonth` and `nextWeek`. Still used when those are not set. */
|
|
149
|
+
next: string;
|
|
150
|
+
previousMonth?: string;
|
|
151
|
+
nextMonth?: string;
|
|
152
|
+
/** Also names the agenda's step, which moves by a week. */
|
|
153
|
+
previousWeek?: string;
|
|
154
|
+
nextWeek?: string;
|
|
155
|
+
previousDay?: string;
|
|
156
|
+
nextDay?: string;
|
|
157
|
+
viewGroup: string;
|
|
158
|
+
viewMonth: string;
|
|
159
|
+
viewWeek: string;
|
|
160
|
+
viewDay?: string;
|
|
161
|
+
viewAgenda: string;
|
|
162
|
+
loading: string;
|
|
163
|
+
retry: string;
|
|
164
|
+
agenda: string;
|
|
165
|
+
agendaEmpty: string;
|
|
166
|
+
grid: string;
|
|
167
|
+
/** An entry's accessible name unless it sets `accessibleName`. Its marker labels are appended. */
|
|
168
|
+
entry: string;
|
|
169
|
+
/** A window's accessible name unless it sets `accessibleName`. `{title}` is its kind, name and scope. */
|
|
170
|
+
overlay?: string;
|
|
171
|
+
legend: string;
|
|
172
|
+
/** The "+N more" toggle on a day with more entries than `maxEntriesPerDay`. `{count}` placeholder. */
|
|
173
|
+
moreEntries: string;
|
|
174
|
+
/** Accessible name of that toggle. `{count}` and `{date}` placeholders. */
|
|
175
|
+
moreEntriesLabel: string;
|
|
176
|
+
/** The toggle once the day is expanded in place. */
|
|
177
|
+
fewerEntries: string;
|
|
178
|
+
/** The "+N" at the end of a week row whose spans did not all get a lane. `{count}` placeholder. */
|
|
179
|
+
moreSpans?: string;
|
|
180
|
+
/** Accessible name of that control. `{count}` and `{date}` (the first day with a hidden span). */
|
|
181
|
+
moreSpansLabel?: string;
|
|
182
|
+
/** The accessible text of a day's count when `days[date].label` is not given. `{count}` placeholder. */
|
|
183
|
+
dayCount?: string;
|
|
184
|
+
states: Record<SchedulingEntryState, string>;
|
|
185
|
+
/** The words for `status`, used in the default accessible name and the agenda. */
|
|
186
|
+
statuses?: Partial<Record<SchedulingStatus, string>>;
|
|
187
|
+
/** The header of the hour axis: it names the display zone. `{timeZone}` placeholder. */
|
|
188
|
+
timeZone?: string;
|
|
189
|
+
/** Names the strip of windows above the time grid. */
|
|
190
|
+
windows?: string;
|
|
191
|
+
/** "+N windows" when the strip has more windows than lanes. `{count}` placeholder. */
|
|
192
|
+
moreWindows?: string;
|
|
193
|
+
/** Accessible name of that control. `{count}` and `{date}` (the first day with a hidden window). */
|
|
194
|
+
moreWindowsLabel?: string;
|
|
195
|
+
/** Names the lane above the hours that holds all-day and long entries. */
|
|
196
|
+
topLane?: string;
|
|
197
|
+
/** The cue on the second-day part of an entry that crosses midnight. `{time}` is its start. */
|
|
198
|
+
continuesFrom?: string;
|
|
199
|
+
/** Read after an item's name when it can be moved. */
|
|
200
|
+
moveHint?: string;
|
|
201
|
+
/** Announced for a pending move. `{start}` and `{end}` placeholders. */
|
|
202
|
+
moveProposed?: string;
|
|
203
|
+
/** Announced when a pending move is dropped. */
|
|
204
|
+
moveCancelled?: string;
|
|
205
|
+
/** Announced when the time asked for does not exist that day. `{time}` is the time used instead. */
|
|
206
|
+
gapForward?: string;
|
|
207
|
+
}
|
|
208
|
+
declare const DEFAULT_SCHEDULING_CALENDAR_LABELS: SchedulingCalendarLabels;
|
|
209
|
+
interface SchedulingCalendarProps {
|
|
210
|
+
/**
|
|
211
|
+
* The entries. Without `dayEntries` the calendar places each on its day in the order
|
|
212
|
+
* given; with `dayEntries` only the entries that cover more than one day are read from
|
|
213
|
+
* here (they are drawn as spans).
|
|
214
|
+
*/
|
|
215
|
+
entries: SchedulingCalendarEntry[];
|
|
216
|
+
anchorDate: string;
|
|
217
|
+
timeZone: string;
|
|
218
|
+
view?: SchedulingCalendarView;
|
|
219
|
+
onViewChange?: (view: SchedulingCalendarView) => void;
|
|
220
|
+
onAnchorDateChange?: (date: string) => void;
|
|
221
|
+
/** Called by a click or Enter on a chip, a span or an agenda row. */
|
|
222
|
+
onSelectEntry?: (entry: SchedulingCalendarEntry) => void;
|
|
223
|
+
overlays?: SchedulingCalendarOverlay[];
|
|
224
|
+
/** Called by a click or Enter on a window span. */
|
|
225
|
+
onSelectOverlay?: (overlay: SchedulingCalendarOverlay) => void;
|
|
226
|
+
filter?: (entry: SchedulingCalendarEntry) => boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Replaces a chip's content. The default is the start time in `timeZone` (24 h) and the title.
|
|
229
|
+
* In the time grid the second argument says how many text lines fit in the item (0: show the
|
|
230
|
+
* markers only); elsewhere it is not passed.
|
|
231
|
+
*/
|
|
232
|
+
renderEntry?: (entry: SchedulingCalendarEntry, context?: TimeGridEntryContext) => ReactNode;
|
|
233
|
+
locale?: string;
|
|
234
|
+
/** First column of the month and week grids: 0 = Sunday … 6 = Saturday. Defaults to 1 (Monday). */
|
|
235
|
+
weekStartsOn?: CalendarWeekday;
|
|
236
|
+
/**
|
|
237
|
+
* Formats every calendar date the component writes (`date` is `YYYY-MM-DD`). Use it to
|
|
238
|
+
* apply a product date format such as DD.MM.YYYY; defaults to `Intl` in `locale`.
|
|
239
|
+
*/
|
|
240
|
+
formatDate?: (date: string, part: SchedulingDatePart) => string;
|
|
241
|
+
/**
|
|
242
|
+
* Formats a start or end instant (ISO 8601) for the agenda and the accessible names.
|
|
243
|
+
* The component does not shift it: render it in `timeZone` yourself. Defaults to the
|
|
244
|
+
* `day` date text followed by the 24-hour time in `timeZone`.
|
|
245
|
+
*/
|
|
246
|
+
formatInstant?: (instant: string) => string;
|
|
247
|
+
/**
|
|
248
|
+
* How many chips a day shows. Without `dayEntries` the rest collapse behind "+N more";
|
|
249
|
+
* with `dayEntries` it only sizes the cell (the consumer already cut the list, and a longer
|
|
250
|
+
* list makes the cells taller, never clipped). Unset shows every entry where the cells
|
|
251
|
+
* grow, and sizes a fixed cell for three chips.
|
|
252
|
+
*/
|
|
253
|
+
maxEntriesPerDay?: number;
|
|
254
|
+
/**
|
|
255
|
+
* Called by a day's "+N more" and by a week row's "+N" with the day (and, without
|
|
256
|
+
* `dayEntries`, every entry on it). When set, the consumer shows them (a popover, a
|
|
257
|
+
* drawer, the day view) and the day stays collapsed. Required with `days` or `dayEntries`:
|
|
258
|
+
* a controlled day never expands in place.
|
|
259
|
+
*/
|
|
260
|
+
onShowMore?: (date: string, entries: SchedulingCalendarEntry[]) => void;
|
|
261
|
+
/**
|
|
262
|
+
* A small badge beside a day's date, e.g. a collision count. Keep it short (a number or a
|
|
263
|
+
* glyph): it shares a narrow column with the date and is clipped, not wrapped. It sits
|
|
264
|
+
* outside the date button, so give it its own accessible text (a visually hidden word next
|
|
265
|
+
* to the number). Return null for no badge.
|
|
266
|
+
*/
|
|
267
|
+
renderDayBadge?: (date: string, entries: SchedulingCalendarEntry[]) => ReactNode;
|
|
268
|
+
/**
|
|
269
|
+
* Consumer-owned numbers per day (`YYYY-MM-DD`). When set, each listed day shows its
|
|
270
|
+
* `count` and markers even with no chip, and its "+N" is `overflowCount`, never a number
|
|
271
|
+
* derived from the entries given. Without `dayEntries` the chips are still this day's
|
|
272
|
+
* `entries`, cut to `maxEntriesPerDay`; the day never expands in place.
|
|
273
|
+
*/
|
|
274
|
+
days?: Record<string, SchedulingCalendarDay>;
|
|
275
|
+
/**
|
|
276
|
+
* The single-day chips of each day, already ranked and cut by the consumer. When set, the
|
|
277
|
+
* calendar renders exactly these in the order given: it does not place, rank, cut or count.
|
|
278
|
+
*/
|
|
279
|
+
dayEntries?: Record<string, SchedulingCalendarEntry[]>;
|
|
280
|
+
/**
|
|
281
|
+
* The result of `layoutMonthSpans` for this grid. When set, the calendar draws exactly
|
|
282
|
+
* these spans and never packs lanes itself. Compute it with `schedulingGridDays`.
|
|
283
|
+
*/
|
|
284
|
+
spanLayout?: MonthSpanLayout;
|
|
285
|
+
/**
|
|
286
|
+
* Lanes kept for windows above the chips. Windows never take a chip slot. Default 2 where
|
|
287
|
+
* the cells have a fixed height; where they grow with their content every window gets a lane.
|
|
288
|
+
*/
|
|
289
|
+
windowLaneCap?: number;
|
|
290
|
+
/** Lanes kept for entries that cover more than one day. Default as for `windowLaneCap`. */
|
|
291
|
+
spanLaneCap?: number;
|
|
292
|
+
/** When set, the legend is exactly these items (an empty list draws no legend). Unset keeps the built-in state legend. */
|
|
293
|
+
legend?: SchedulingLegendItem[];
|
|
294
|
+
/** A line under the legend, e.g. the display zone. */
|
|
295
|
+
legendCaption?: ReactNode;
|
|
296
|
+
/** `false` hides the previous/next buttons, the title and the view switch (the page has its own toolbar). */
|
|
297
|
+
showHeader?: boolean;
|
|
298
|
+
/** Shown above the grid, e.g. "Showing the first 2,000 items". */
|
|
299
|
+
notice?: ReactNode;
|
|
300
|
+
/** Shown inside the grid, below the day cells, when there is nothing to show. */
|
|
301
|
+
emptyNote?: ReactNode;
|
|
302
|
+
/** Called by a click or Enter on a day number. */
|
|
303
|
+
onSelectDate?: (date: string) => void;
|
|
304
|
+
/**
|
|
305
|
+
* Draws `view="week"` as a time grid: seven day columns on an hour axis. `view="day"` is
|
|
306
|
+
* always a time grid. Default `false`: the week stays seven day cells.
|
|
307
|
+
*/
|
|
308
|
+
timeGrid?: boolean;
|
|
309
|
+
/** An instant (ISO 8601). The time grid draws one line at it, in the column of its day. The component keeps no clock. */
|
|
310
|
+
now?: string;
|
|
311
|
+
/**
|
|
312
|
+
* Lets the user ask for a move in the time grid (drag, or Shift and an arrow key, then
|
|
313
|
+
* Enter). Without it, or without `onProposeMove`, items have no move affordance at all.
|
|
314
|
+
*/
|
|
315
|
+
canMove?: boolean;
|
|
316
|
+
/** Minutes a move snaps to. Default 15. */
|
|
317
|
+
step?: number;
|
|
318
|
+
/**
|
|
319
|
+
* Called once per finished gesture with the window the user asks for. The calendar never
|
|
320
|
+
* moves the item: it draws entries where the props say, so an entry whose props do not
|
|
321
|
+
* change is back where it was. Return a promise to keep the outline until it settles.
|
|
322
|
+
*/
|
|
323
|
+
onProposeMove?: (id: string, proposal: MoveProposal) => void | Promise<unknown>;
|
|
324
|
+
/** An entry running more than this many minutes past its first local midnight goes to the top lane. Default 360. */
|
|
325
|
+
topLaneCrossMidnightMinutes?: number;
|
|
326
|
+
/** Rows of the top lane of the time grid. Default 3. */
|
|
327
|
+
topLaneCap?: number;
|
|
328
|
+
/** Lanes side by side in one day column of the time grid, at most. Fewer are used when the column is narrow. Default 4. */
|
|
329
|
+
maxLanes?: number;
|
|
330
|
+
loading?: boolean;
|
|
331
|
+
error?: string;
|
|
332
|
+
onRetry?: () => void;
|
|
333
|
+
className?: string;
|
|
334
|
+
labels?: Partial<SchedulingCalendarLabels>;
|
|
335
|
+
}
|
|
336
|
+
/** Month/week/agenda calendar for UTC ranges rendered in an explicit IANA time zone. */
|
|
337
|
+
declare function SchedulingCalendar({ entries, anchorDate, timeZone, view: controlledView, onViewChange, onAnchorDateChange, onSelectEntry, overlays, onSelectOverlay, filter, renderEntry, locale, weekStartsOn, formatDate, formatInstant: formatInstantProp, maxEntriesPerDay, onShowMore, renderDayBadge, days: dayInfo, dayEntries, spanLayout, windowLaneCap, spanLaneCap, legend, legendCaption, showHeader, notice, emptyNote, onSelectDate, timeGrid, now, canMove, step, onProposeMove, topLaneCrossMidnightMinutes, topLaneCap, maxLanes, loading, error, onRetry, className, labels: labelOverrides, }: SchedulingCalendarProps): react.JSX.Element;
|
|
338
|
+
|
|
339
|
+
export { DEFAULT_SCHEDULING_CALENDAR_LABELS as D, type SchedulingBand as S, type TimeGridEntryContext as T, SchedulingCalendar as a, type SchedulingCalendarDay as b, type SchedulingCalendarEntry as c, type SchedulingCalendarLabels as d, type SchedulingCalendarOverlay as e, type SchedulingCalendarProps as f, type SchedulingCalendarView as g, type SchedulingDatePart as h, type SchedulingEntryState as i, type SchedulingLegendItem as j, type SchedulingMarker as k, type SchedulingMarkerEmphasis as l, type SchedulingOverlayKind as m, type SchedulingOverlayPattern as n, type SchedulingStatus as o, SchedulingTimeGrid as p, type SchedulingTimeGridProps as q };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words of an `Attachment` row. In a module of its own, with no "use client": the
|
|
3
|
+
* server-renderable `Attachment` and its client parts both read it, and a server component can
|
|
4
|
+
* still import the defaults as plain values.
|
|
5
|
+
*/
|
|
6
|
+
interface AttachmentLabels {
|
|
7
|
+
/** Remove button. `{name}`. */
|
|
8
|
+
remove: string;
|
|
9
|
+
/** Download link name when `download` is set. `{name}`. */
|
|
10
|
+
download: string;
|
|
11
|
+
loading: string;
|
|
12
|
+
forbidden: string;
|
|
13
|
+
}
|
|
14
|
+
declare const DEFAULT_ATTACHMENT_LABELS: AttachmentLabels;
|
|
15
|
+
|
|
16
|
+
export { type AttachmentLabels, DEFAULT_ATTACHMENT_LABELS };
|
package/dist/calendar-model.d.ts
CHANGED
|
@@ -19,9 +19,149 @@ declare function startOfMonth(value: string): string;
|
|
|
19
19
|
/** A weekday in `Date.getUTCDay()` numbering: 0 = Sunday … 6 = Saturday. */
|
|
20
20
|
type CalendarWeekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
21
21
|
declare function buildMonthGrid(month: string, weekStartsOn?: CalendarWeekday): CalendarDay[];
|
|
22
|
+
/**
|
|
23
|
+
* A shared `Intl.DateTimeFormat` for `locale` and `options`. Formatters are expensive to
|
|
24
|
+
* build, so one instance is kept per locale and options shape (key order does not matter);
|
|
25
|
+
* the cache holds up to 64 shapes and drops the oldest past that.
|
|
26
|
+
*/
|
|
27
|
+
declare function cachedDateTimeFormat(locale: string | readonly string[] | undefined, options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
|
|
28
|
+
/** The calendar date (`YYYY-MM-DD`) of an instant in `timeZone`. */
|
|
22
29
|
declare function zonedDateKey(instant: string | Date, timeZone: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* The 24-hour wall-clock time (`HH:MM`) of an instant in `timeZone`. It reads the same
|
|
32
|
+
* cached formatter as the zone math, so it adds no `Intl.DateTimeFormat` instance.
|
|
33
|
+
*/
|
|
34
|
+
declare function zonedTimeOfDay(instant: string | number | Date, timeZone: string): string;
|
|
35
|
+
interface ZonedDayBounds {
|
|
36
|
+
/** The first instant of the day in the zone (local 00:00, or the first existing time after a gap). */
|
|
37
|
+
start: Date;
|
|
38
|
+
/** The first instant of the next day: `end` of D equals `start` of D + 1. */
|
|
39
|
+
end: Date;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The half-open interval `[start, end)` of a calendar day in `timeZone`. DST days are 23 or
|
|
43
|
+
* 25 hours long; a day whose midnight does not exist starts at its first existing instant.
|
|
44
|
+
*/
|
|
45
|
+
declare function zonedDayBounds(dateKey: string, timeZone: string): ZonedDayBounds;
|
|
46
|
+
interface ZonedHourSlot {
|
|
47
|
+
/** The real instant the local hour starts. */
|
|
48
|
+
instant: Date;
|
|
49
|
+
/** The local hour, two digits (`'00'` … `'23'`). */
|
|
50
|
+
label: string;
|
|
51
|
+
/**
|
|
52
|
+
* The UTC offset (`'+02:00'`) when this local hour occurs twice in the day (clocks went
|
|
53
|
+
* back), set on both occurrences; otherwise `null`.
|
|
54
|
+
*/
|
|
55
|
+
offsetLabel: string | null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* One entry per real hour start in the day `[start, end)` in `timeZone`: 24 on most days,
|
|
59
|
+
* 23 when clocks go forward (no slot for the skipped hour) and 25 when they go back (the
|
|
60
|
+
* repeated hour twice, each with an `offsetLabel`).
|
|
61
|
+
*/
|
|
62
|
+
declare function zonedHourSlots(dateKey: string, timeZone: string): ZonedHourSlot[];
|
|
63
|
+
interface ZonedDayShift {
|
|
64
|
+
instant: Date;
|
|
65
|
+
/** `'gap_forward'` when the target wall-clock time did not exist and moved forward past the gap. */
|
|
66
|
+
adjusted: 'gap_forward' | null;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Moves an instant by `days` calendar days in `timeZone`, keeping its wall-clock time
|
|
70
|
+
* ("+1 day" is the same local time on the next day, whether that day has 23, 24 or 25
|
|
71
|
+
* hours). A wall time that occurs twice keeps the source's offset when it can (else the
|
|
72
|
+
* earlier one). A wall time that does not exist moves forward by the gap, once, and the
|
|
73
|
+
* result says so (`adjusted: 'gap_forward'`).
|
|
74
|
+
*/
|
|
75
|
+
declare function addZonedDays(instant: string | Date, days: number, timeZone: string): ZonedDayShift;
|
|
76
|
+
/**
|
|
77
|
+
* Calendar days `[start, end)` as date keys: `end` is the first day NOT covered.
|
|
78
|
+
* Produced by `zonedDaySpan`, read by `enumerateDateKeys`.
|
|
79
|
+
*/
|
|
80
|
+
interface ZonedDaySpan {
|
|
81
|
+
start: string;
|
|
82
|
+
end: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The calendar days an instant interval `[start, end)` touches in `timeZone`, end-exclusive:
|
|
86
|
+
* an entry ending exactly at local 00:00 occupies only the day before. Throws a `RangeError`
|
|
87
|
+
* when `end` is not after `start`; it never swaps the ends.
|
|
88
|
+
*/
|
|
89
|
+
declare function zonedDaySpan(start: string | Date, end: string | Date, timeZone: string): ZonedDaySpan;
|
|
90
|
+
/**
|
|
91
|
+
* The date keys of a `ZonedDaySpan` (`[start, end)`), at most `limit` of them (default
|
|
92
|
+
* 370; `Infinity` for no limit). `truncated` is true when the span has more days than were
|
|
93
|
+
* returned, so a long span is never cut silently. Throws a `RangeError` on an inverted span.
|
|
94
|
+
*/
|
|
95
|
+
declare function enumerateDateKeys(span: ZonedDaySpan, options?: {
|
|
96
|
+
limit?: number;
|
|
97
|
+
}): {
|
|
98
|
+
dates: string[];
|
|
99
|
+
truncated: boolean;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Inclusive date keys of an instant interval, with inverted ends swapped.
|
|
103
|
+
* @deprecated Use `zonedDaySpan`, which is end-exclusive (an entry ending at local 00:00
|
|
104
|
+
* does not paint the next day) and throws on an inverted interval instead of swapping.
|
|
105
|
+
* The behaviour here is unchanged in 2.x; changing it follows the contract-change process (E13).
|
|
106
|
+
*/
|
|
23
107
|
declare function zonedDateSpan(start: string, end: string, timeZone: string): ZonedDateSpan;
|
|
108
|
+
/**
|
|
109
|
+
* Date keys of an inclusive span, stopping silently after `limit` (370).
|
|
110
|
+
* @deprecated Use `enumerateDateKeys`, which reads an end-exclusive `ZonedDaySpan` and
|
|
111
|
+
* reports `truncated` instead of stopping silently. The behaviour here is unchanged in 2.x (E13).
|
|
112
|
+
*/
|
|
24
113
|
declare function enumerateDateSpan(span: ZonedDateSpan, limit?: number): string[];
|
|
114
|
+
interface LaneInterval {
|
|
115
|
+
id: string;
|
|
116
|
+
/** Half-open `[start, end)`: ISO string, epoch ms or Date. */
|
|
117
|
+
start: string | number | Date;
|
|
118
|
+
end: string | number | Date;
|
|
119
|
+
}
|
|
120
|
+
interface LanePlacement {
|
|
121
|
+
/** 0-based lane, or `null` when the interval did not fit in `maxLanes`. */
|
|
122
|
+
lane: number | null;
|
|
123
|
+
/** Index into `PackedLanes.clusters`. */
|
|
124
|
+
cluster: number;
|
|
125
|
+
}
|
|
126
|
+
interface LaneCluster {
|
|
127
|
+
/** Ids of one run of transitively overlapping intervals, by start, then end, then id. */
|
|
128
|
+
ids: string[];
|
|
129
|
+
/** Lanes the cluster uses (≤ `maxLanes`); a renderer divides the width by this. */
|
|
130
|
+
laneCount: number;
|
|
131
|
+
/** Intervals of the cluster that got no lane. */
|
|
132
|
+
overflow: number;
|
|
133
|
+
}
|
|
134
|
+
interface PackedLanes {
|
|
135
|
+
lanes: Record<string, LanePlacement>;
|
|
136
|
+
clusters: LaneCluster[];
|
|
137
|
+
/** Intervals that got no lane, over all clusters. */
|
|
138
|
+
overflow: number;
|
|
139
|
+
}
|
|
140
|
+
interface PackLanesOptions {
|
|
141
|
+
/**
|
|
142
|
+
* `'start'` (default): greedy first-fit by start, then end, then id, so the result does
|
|
143
|
+
* not depend on input order. `'given'`: first-fit in input order, so the consumer's
|
|
144
|
+
* ranking decides which intervals get a lane when there are not enough.
|
|
145
|
+
*/
|
|
146
|
+
order?: 'start' | 'given';
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Assigns half-open intervals to at most `maxLanes` lanes, first-fit. Two intervals that
|
|
150
|
+
* overlap never share a lane; two that only touch (`a.end === b.start`) may. Intervals
|
|
151
|
+
* that do not fit get `lane: null` and count towards their cluster's `overflow`. A
|
|
152
|
+
* zero-length interval occupies its start instant. Throws on `end < start` (it never
|
|
153
|
+
* swaps) and on a duplicate id.
|
|
154
|
+
*/
|
|
155
|
+
declare function packLanes(intervals: readonly LaneInterval[], maxLanes: number, options?: PackLanesOptions): PackedLanes;
|
|
156
|
+
/**
|
|
157
|
+
* Sorts a copy of `items` with `compare` (stable) and cuts it after `n`. `hidden` is the
|
|
158
|
+
* number of items not shown, so it is a true total only when `items` is complete; a
|
|
159
|
+
* consumer that knows a larger total shows that instead.
|
|
160
|
+
*/
|
|
161
|
+
declare function rankOverflow<T>(items: readonly T[], compare: (a: T, b: T) => number, n: number): {
|
|
162
|
+
visible: T[];
|
|
163
|
+
hidden: number;
|
|
164
|
+
};
|
|
25
165
|
declare function selectRangeDate(current: DateRangeValue, date: string): DateRangeValue;
|
|
26
166
|
declare function isDateInRange(date: string, value: DateRangeValue): boolean;
|
|
27
167
|
declare function isDateUnavailable(date: string, options: {
|
|
@@ -30,4 +170,4 @@ declare function isDateUnavailable(date: string, options: {
|
|
|
30
170
|
isDisabled?: (date: string) => boolean;
|
|
31
171
|
}): boolean;
|
|
32
172
|
|
|
33
|
-
export { type CalendarDay, type CalendarWeekday, type DateRangeValue, type ZonedDateSpan, addCalendarDays, addCalendarMonths, buildMonthGrid, enumerateDateSpan, isDateInRange, isDateUnavailable, selectRangeDate, startOfMonth, toDateKey, zonedDateKey, zonedDateSpan };
|
|
173
|
+
export { type CalendarDay, type CalendarWeekday, type DateRangeValue, type LaneCluster, type LaneInterval, type LanePlacement, type PackLanesOptions, type PackedLanes, type ZonedDateSpan, type ZonedDayBounds, type ZonedDayShift, type ZonedDaySpan, type ZonedHourSlot, addCalendarDays, addCalendarMonths, addZonedDays, buildMonthGrid, cachedDateTimeFormat, enumerateDateKeys, enumerateDateSpan, isDateInRange, isDateUnavailable, packLanes, rankOverflow, selectRangeDate, startOfMonth, toDateKey, zonedDateKey, zonedDateSpan, zonedDayBounds, zonedDaySpan, zonedHourSlots, zonedTimeOfDay };
|