@abpjs/ui 0.0.0-stage → 0.2.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/LICENSE +55 -0
- package/NOTICE +4 -0
- package/README.md +60 -2
- package/dist/ai.d.ts +493 -0
- package/dist/ai.js +1303 -0
- package/dist/ai.js.map +1 -0
- package/dist/index.d.ts +2734 -0
- package/dist/index.js +8955 -0
- package/dist/index.js.map +1 -0
- package/dist/rules.d.ts +119 -0
- package/dist/rules.js +116 -0
- package/dist/rules.js.map +1 -0
- package/package.json +90 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2734 @@
|
|
|
1
|
+
import * as _chakra_ui_react from '@chakra-ui/react';
|
|
2
|
+
import { SystemConfig, SystemContext, LinkProps, HTMLChakraProps, SystemStyleObject, chakra, ButtonProps as ButtonProps$1, IconButtonProps as IconButtonProps$1, TableRowProps, Checkbox, Field as Field$1, NativeSelect, Switch, Alert, BoxProps as BoxProps$1, InputProps, Tooltip as Tooltip$1 } from '@chakra-ui/react';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { ComponentType, ReactNode, ElementType, AnchorHTMLAttributes, ComponentProps, RefObject, ReactElement } from 'react';
|
|
5
|
+
import { ThemeProviderProps } from 'next-themes';
|
|
6
|
+
import { Announcements } from '@dnd-kit/core';
|
|
7
|
+
import * as _ark_ui_react from '@ark-ui/react';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The colours a host brings (ADR 0109): six scales, light to dark. Components never use a raw step: the semantic tokens
|
|
11
|
+
* (bg, fg, border, accent, success, statusCategory...) pick steps per colour mode, so any brand reads the same way.
|
|
12
|
+
*/
|
|
13
|
+
interface AbpBrand {
|
|
14
|
+
/** Greys: 0 (white) and 25 as the lightest surfaces, 850, 925 and 950 for dark mode's. */
|
|
15
|
+
neutral: Record<0 | 25 | 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 850 | 900 | 925 | 950, string>;
|
|
16
|
+
/** The one accent: links, the selected tint, primary buttons. */
|
|
17
|
+
accent: Scale;
|
|
18
|
+
green: Scale;
|
|
19
|
+
amber: Scale;
|
|
20
|
+
red: Scale;
|
|
21
|
+
blue: Scale;
|
|
22
|
+
}
|
|
23
|
+
type Scale = Record<50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950, string>;
|
|
24
|
+
/** The package's own colours, for a host that brings none: plain greys and a blue accent. */
|
|
25
|
+
declare const defaultBrand: AbpBrand;
|
|
26
|
+
|
|
27
|
+
interface AbpSystemOptions {
|
|
28
|
+
/** The CSS variables' prefix (`--{prefix}-colors-bg`), the host's own; `abp` when not given. */
|
|
29
|
+
prefix?: string;
|
|
30
|
+
/** The host's colours; the package's neutral ones when not given. */
|
|
31
|
+
brand?: AbpBrand;
|
|
32
|
+
/** More of the host's own config, merged last (its tokens, recipes, global CSS). */
|
|
33
|
+
config?: SystemConfig;
|
|
34
|
+
}
|
|
35
|
+
/** The design system's config for a prefix and a brand: for a host that builds its system itself. */
|
|
36
|
+
declare function abpConfig({ prefix, brand }?: Pick<AbpSystemOptions, 'prefix' | 'brand'>): SystemConfig;
|
|
37
|
+
/** The Chakra system a host renders with (ADR 0109): its prefix and brand on the design system's tokens and recipes. */
|
|
38
|
+
declare function createAbpSystem(options?: AbpSystemOptions): SystemContext;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A token's CSS variable in the host's system, with its own prefix (`var(--…-colors-accent-solid)`): for SVG attributes
|
|
42
|
+
* and Web Animations, which take no token references. Style props and recipes write `{colors.accent.solid}` instead.
|
|
43
|
+
*/
|
|
44
|
+
declare function useTokenVar(): (path: string) => string;
|
|
45
|
+
|
|
46
|
+
/** The design system's version, used as the Module Federation shared version. */
|
|
47
|
+
declare const ABP_UI_VERSION: string;
|
|
48
|
+
|
|
49
|
+
/** How much the interface moves for a person (ADR 0058): as their system says, less, or full. */
|
|
50
|
+
type MotionSetting = 'system' | 'reduced' | 'full';
|
|
51
|
+
interface MotionState {
|
|
52
|
+
/** The person's choice. */
|
|
53
|
+
setting: MotionSetting;
|
|
54
|
+
/** Whether movement is off now: their choice, or their system's when they left it to the system. */
|
|
55
|
+
reduce: boolean;
|
|
56
|
+
/** Changes it on this page at once (the host saves it). */
|
|
57
|
+
setSetting: (setting: MotionSetting) => void;
|
|
58
|
+
}
|
|
59
|
+
/** The person's motion setting, and whether movement is off: every moving component asks this. */
|
|
60
|
+
declare function useMotionSetting(): MotionState;
|
|
61
|
+
declare const asMotionSetting: (value: unknown) => MotionSetting;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Every string the components render on their own. The package ships English defaults and
|
|
65
|
+
* knows nothing about i18n libraries: the host passes translated labels to AbpProvider.
|
|
66
|
+
*/
|
|
67
|
+
interface AbpLabels {
|
|
68
|
+
close: string;
|
|
69
|
+
cancel: string;
|
|
70
|
+
confirm: string;
|
|
71
|
+
retry: string;
|
|
72
|
+
loading: string;
|
|
73
|
+
noData: string;
|
|
74
|
+
navigation: string;
|
|
75
|
+
breadcrumb: string;
|
|
76
|
+
/** The folded middle of a long breadcrumb trail. */
|
|
77
|
+
moreBreadcrumbs: string;
|
|
78
|
+
skipToContent: string;
|
|
79
|
+
openNavigation: string;
|
|
80
|
+
collapseSidebar: string;
|
|
81
|
+
expandSidebar: string;
|
|
82
|
+
toggleColorMode: string;
|
|
83
|
+
colorModeLight: string;
|
|
84
|
+
colorModeDark: string;
|
|
85
|
+
sortAscending: string;
|
|
86
|
+
sortDescending: string;
|
|
87
|
+
path: string;
|
|
88
|
+
/** A form's field that's required and empty. */
|
|
89
|
+
formRequired: string;
|
|
90
|
+
/** Above a form with wrong fields, `{count}` of them (ICU plural). */
|
|
91
|
+
formFix: string;
|
|
92
|
+
queryList: QueryListLabels;
|
|
93
|
+
}
|
|
94
|
+
/** Strings of QueryableList. {name} placeholders are filled in by the component. */
|
|
95
|
+
interface QueryListLabels {
|
|
96
|
+
savedView: string;
|
|
97
|
+
group: string;
|
|
98
|
+
sortBy: string;
|
|
99
|
+
sortField: string;
|
|
100
|
+
defaultOrder: string;
|
|
101
|
+
sortAscending: string;
|
|
102
|
+
sortDescending: string;
|
|
103
|
+
search: string;
|
|
104
|
+
searchPlaceholder: string;
|
|
105
|
+
visibleColumns: string;
|
|
106
|
+
hiddenColumns: string;
|
|
107
|
+
showAllColumns: string;
|
|
108
|
+
columnsHint: string;
|
|
109
|
+
dragColumn: string;
|
|
110
|
+
expandAll: string;
|
|
111
|
+
collapseAll: string;
|
|
112
|
+
foldGroup: string;
|
|
113
|
+
unfoldGroup: string;
|
|
114
|
+
noGroupValue: string;
|
|
115
|
+
/** A row's grip in a grouped list: its menu's title, the groups it can go to under it. */
|
|
116
|
+
moveToGroup?: string;
|
|
117
|
+
views: string;
|
|
118
|
+
unsavedView: string;
|
|
119
|
+
saveView: string;
|
|
120
|
+
viewName: string;
|
|
121
|
+
save: string;
|
|
122
|
+
cancel: string;
|
|
123
|
+
deleteView: string;
|
|
124
|
+
groupBy: string;
|
|
125
|
+
/** "Group by {field}" */
|
|
126
|
+
groupByField: string;
|
|
127
|
+
noGrouping: string;
|
|
128
|
+
/** The group menu's second field (grouped by two fields). */
|
|
129
|
+
thenBy: string;
|
|
130
|
+
noSecondGrouping: string;
|
|
131
|
+
/** A row's menu in rank order: "Move up", "Move down". */
|
|
132
|
+
moveUp: string;
|
|
133
|
+
moveDown: string;
|
|
134
|
+
/** A week's group: "Week of {day}". */
|
|
135
|
+
periodWeek: string;
|
|
136
|
+
/** A quarter's group: "Q{quarter} {year}". */
|
|
137
|
+
periodQuarter: string;
|
|
138
|
+
groups: string;
|
|
139
|
+
filterToGroup: string;
|
|
140
|
+
columns: string;
|
|
141
|
+
filterMode: string;
|
|
142
|
+
basic: string;
|
|
143
|
+
rql: string;
|
|
144
|
+
rqlLabel: string;
|
|
145
|
+
rqlPlaceholder: string;
|
|
146
|
+
run: string;
|
|
147
|
+
suggestions: string;
|
|
148
|
+
addFilter: string;
|
|
149
|
+
buildFilters: string;
|
|
150
|
+
clearAll: string;
|
|
151
|
+
matchAll: string;
|
|
152
|
+
sameFieldAny: string;
|
|
153
|
+
noConditions: string;
|
|
154
|
+
addCondition: string;
|
|
155
|
+
activeFilters: string;
|
|
156
|
+
noneActive: string;
|
|
157
|
+
matchCount: string;
|
|
158
|
+
matchCountOnly: string;
|
|
159
|
+
incompleteSkipped: string;
|
|
160
|
+
applyFilters: string;
|
|
161
|
+
incomplete: string;
|
|
162
|
+
/** "Remove the {field} filter" */
|
|
163
|
+
removeFilter: string;
|
|
164
|
+
field: string;
|
|
165
|
+
operator: string;
|
|
166
|
+
value: string;
|
|
167
|
+
valuesHint: string;
|
|
168
|
+
add: string;
|
|
169
|
+
/** "{from}–{to} of {total}" */
|
|
170
|
+
range: string;
|
|
171
|
+
previous: string;
|
|
172
|
+
next: string;
|
|
173
|
+
/** The pagination's name, and a page button's: "Page {page}". */
|
|
174
|
+
pages: string;
|
|
175
|
+
page: string;
|
|
176
|
+
empty: string;
|
|
177
|
+
export: string;
|
|
178
|
+
exportCsv: string;
|
|
179
|
+
exportExcel: string;
|
|
180
|
+
exporting: string;
|
|
181
|
+
/** "The file holds {rows} of {total} rows: an export stops at {limit}." */
|
|
182
|
+
exportCut: string;
|
|
183
|
+
exportFailed: string;
|
|
184
|
+
dismiss: string;
|
|
185
|
+
/** Operator names by JSON-form op: eq, ne, in, notIn, contains… */
|
|
186
|
+
operators: Record<string, string>;
|
|
187
|
+
/** Comparisons as they read for numbers ("is at least") rather than dates ("is on or after"). */
|
|
188
|
+
numberOperators: Record<string, string>;
|
|
189
|
+
/** Suggestion kinds: field, operator, value, function, keyword, person. */
|
|
190
|
+
kinds: Record<string, string>;
|
|
191
|
+
}
|
|
192
|
+
declare const defaultQueryListLabels: QueryListLabels;
|
|
193
|
+
declare const defaultLabels: AbpLabels;
|
|
194
|
+
declare function useAbpLabels(): AbpLabels;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* An answer the server refused, in ABP's error shape (`{ error: { code, message, details, validationErrors } }`), or
|
|
198
|
+
* a problem's title, or the status. Read as JSON whatever the content type says, as file routes answer refusals so.
|
|
199
|
+
*/
|
|
200
|
+
declare class AbpApiError extends Error {
|
|
201
|
+
status: number;
|
|
202
|
+
code: string | null;
|
|
203
|
+
details: string | null;
|
|
204
|
+
validationErrors: {
|
|
205
|
+
message: string;
|
|
206
|
+
members?: string[];
|
|
207
|
+
}[];
|
|
208
|
+
/** The error's data, e.g. { start, end } for a query error. */
|
|
209
|
+
data: Record<string, unknown> | null;
|
|
210
|
+
constructor(status: number, code: string | null, message: string, details?: string | null, validationErrors?: {
|
|
211
|
+
message: string;
|
|
212
|
+
members?: string[];
|
|
213
|
+
}[], data?: Record<string, unknown> | null);
|
|
214
|
+
}
|
|
215
|
+
/** The error for a sensitive action that needs the person to confirm who they are again. */
|
|
216
|
+
declare const STEP_UP_REQUIRED = "step_up_required";
|
|
217
|
+
declare function readAbpError(res: Response): Promise<AbpApiError>;
|
|
218
|
+
/** An error as a person reads it. */
|
|
219
|
+
declare function errorText(e: unknown): string;
|
|
220
|
+
declare const isStepUp: (e: unknown) => boolean;
|
|
221
|
+
|
|
222
|
+
/** What a call sends: its method, a JSON body (or FormData as is), headers, and a way to stop it. */
|
|
223
|
+
interface HostRequestInit {
|
|
224
|
+
method?: string;
|
|
225
|
+
body?: unknown;
|
|
226
|
+
headers?: Record<string, string>;
|
|
227
|
+
signal?: AbortSignal;
|
|
228
|
+
/** The answer as a file (a Blob and the name Content-Disposition gives) rather than JSON. */
|
|
229
|
+
as?: 'json' | 'file';
|
|
230
|
+
}
|
|
231
|
+
/** A file the server answered with. */
|
|
232
|
+
interface HostFile {
|
|
233
|
+
blob: Blob;
|
|
234
|
+
name: string | null;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* The host's way to call its server (ADR 0109): same origin, with its own session, anti-forgery header, sign-in
|
|
238
|
+
* redirect and step-up. Throws `AbpApiError` for a refusal. The screens call nothing else.
|
|
239
|
+
*/
|
|
240
|
+
type HostRequest = <T = unknown>(path: string, init?: HostRequestInit) => Promise<T>;
|
|
241
|
+
interface HostRequestOptions {
|
|
242
|
+
/** The anti-forgery cookie's name and the header it's sent in on every call that changes something. */
|
|
243
|
+
csrf?: {
|
|
244
|
+
cookie: string;
|
|
245
|
+
header: string;
|
|
246
|
+
};
|
|
247
|
+
/** A 401: the host sends the person to sign in. */
|
|
248
|
+
onUnauthorized?: () => void;
|
|
249
|
+
/** A 403 `step_up_required`: the host confirms the person again; true retries the call once. */
|
|
250
|
+
stepUp?: () => Promise<boolean>;
|
|
251
|
+
/** More headers on every call (a development user, a tenant). */
|
|
252
|
+
headers?: () => Record<string, string>;
|
|
253
|
+
fetch?: typeof fetch;
|
|
254
|
+
}
|
|
255
|
+
/** A file's name from Content-Disposition, `filename*=UTF-8''…` first. */
|
|
256
|
+
declare function fileNameOf(disposition: string | null): string | null;
|
|
257
|
+
/**
|
|
258
|
+
* A host request for a host that has none of its own: cookies for the session, the anti-forgery cookie echoed in its
|
|
259
|
+
* header, a 401 handed to the host, and one retry after a step-up. A host with its own request passes that instead.
|
|
260
|
+
*/
|
|
261
|
+
declare function createHostRequest(options?: HostRequestOptions): HostRequest;
|
|
262
|
+
|
|
263
|
+
/** One server-sent event: its name (`message` when none), its data as JSON, and its id when it has one. */
|
|
264
|
+
type HostEventHandler = (name: string, data: Record<string, unknown>, id: string | null) => void;
|
|
265
|
+
/**
|
|
266
|
+
* The host's way to read a stream of server-sent events (ADR 0109 amendment): resumed from `lastEventId`, stopped by
|
|
267
|
+
* `signal`. Resolves with the last event's id when the stream ends; throws the host's error (a refusal, a 401, a
|
|
268
|
+
* step-up not confirmed) before it starts. Optional: a screen without it asks again every few seconds.
|
|
269
|
+
*/
|
|
270
|
+
type HostEvents = (path: string, onEvent: HostEventHandler, options?: {
|
|
271
|
+
lastEventId?: string | null;
|
|
272
|
+
signal?: AbortSignal;
|
|
273
|
+
}) => Promise<string | null>;
|
|
274
|
+
/** Reads a response's server-sent events to its end. */
|
|
275
|
+
declare function readEvents(res: Response, onEvent: HostEventHandler): Promise<void>;
|
|
276
|
+
/** Server-sent events for a host without its own reader: same origin, its headers, a 401 handed back, one step-up. */
|
|
277
|
+
declare function createHostEvents(options?: Pick<HostRequestOptions, 'onUnauthorized' | 'stepUp' | 'headers' | 'fetch'>): HostEvents;
|
|
278
|
+
|
|
279
|
+
/** A scope as a host knows it: a project, an org unit. */
|
|
280
|
+
interface HostScope {
|
|
281
|
+
id: string;
|
|
282
|
+
name: string;
|
|
283
|
+
/** Its short code (a project's key), when the host has one. */
|
|
284
|
+
code?: string;
|
|
285
|
+
parentId?: string | null;
|
|
286
|
+
}
|
|
287
|
+
/** One of the site's languages, for names by language. */
|
|
288
|
+
interface HostLanguage {
|
|
289
|
+
code: string;
|
|
290
|
+
name: string;
|
|
291
|
+
direction?: 'ltr' | 'rtl';
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* What a host gives the screens (ADR 0109 amendment): how to call its server, where each package's API is, how to
|
|
295
|
+
* move, what the person may do, its scopes and people, its languages, its words for any text, and the slots it fills.
|
|
296
|
+
*/
|
|
297
|
+
interface AbpHost {
|
|
298
|
+
/** The host's request: same origin, its session, anti-forgery header, sign-in and step-up (`createHostRequest`). */
|
|
299
|
+
request: HostRequest;
|
|
300
|
+
/** The host's reader for server-sent events (`createHostEvents`); without it, a live screen asks again every few seconds. */
|
|
301
|
+
events?: HostEvents;
|
|
302
|
+
/** The person signed in: their account's id, for "you" and for what's theirs. */
|
|
303
|
+
me?: {
|
|
304
|
+
accountId: string;
|
|
305
|
+
};
|
|
306
|
+
/** Each package's base path on this host: `{ ai: '/api/platform/ai', guard: '/api/guard', agent: '/api/agent' }`. */
|
|
307
|
+
paths: Record<string, string>;
|
|
308
|
+
/** Go to an address in the host's router. */
|
|
309
|
+
navigate?: (href: string) => void;
|
|
310
|
+
/** Whether the person may: a right in the package's own terms (`ai.scope.admin`), for one scope when given. */
|
|
311
|
+
can?: (right: string, scopeId?: string) => boolean;
|
|
312
|
+
/** The host's scopes, for pickers and for naming the ids a screen shows. */
|
|
313
|
+
scopes?: {
|
|
314
|
+
search: (text: string) => Promise<HostScope[]>;
|
|
315
|
+
name?: (ids: string[]) => Promise<Record<string, string>>;
|
|
316
|
+
};
|
|
317
|
+
/** People's names for rows that carry only an id. */
|
|
318
|
+
names?: (accountIds: string[]) => Promise<Record<string, string>>;
|
|
319
|
+
/** The site's languages, the first the default. */
|
|
320
|
+
languages?: HostLanguage[];
|
|
321
|
+
/** The host's words for any area's text, by area then language then key: `{ ai: { en: { 'models.title': 'AI models' } } }`. */
|
|
322
|
+
texts?: Record<string, Record<string, Record<string, string>>>;
|
|
323
|
+
/** What the host draws in a screen's named places (`guard.account.panels`, `guard.directory.panel`). */
|
|
324
|
+
slots?: Record<string, ComponentType<Record<string, unknown>>>;
|
|
325
|
+
}
|
|
326
|
+
declare function HostProvider({ value, children }: {
|
|
327
|
+
value?: AbpHost;
|
|
328
|
+
children: ReactNode;
|
|
329
|
+
}): react.JSX.Element;
|
|
330
|
+
/** The host, for a screen that needs it; a screen rendered without one says so. */
|
|
331
|
+
declare function useHost(): AbpHost;
|
|
332
|
+
/** The host when there is one: for parts that also work without (a slot that draws nothing). */
|
|
333
|
+
declare function useOptionalHost(): AbpHost | null;
|
|
334
|
+
/** A package's calls on this host: its base path in front of each path. */
|
|
335
|
+
declare function useAreaRequest(area: string): HostRequest;
|
|
336
|
+
interface ApiQuery<T> {
|
|
337
|
+
data: T | undefined;
|
|
338
|
+
error: string | null;
|
|
339
|
+
loading: boolean;
|
|
340
|
+
reload: () => Promise<void>;
|
|
341
|
+
setData: (value: T) => void;
|
|
342
|
+
}
|
|
343
|
+
/** GET a package's path on this host, again when the path changes; null waits. The answer to the latest call wins. */
|
|
344
|
+
declare function useApiQuery<T>(area: string, path: string | null): ApiQuery<T>;
|
|
345
|
+
/** An action's busy state and error: `run` gives what the action returns, or undefined when it failed. */
|
|
346
|
+
declare function useApiAction(): {
|
|
347
|
+
busy: boolean;
|
|
348
|
+
error: string | null;
|
|
349
|
+
setError: react.Dispatch<react.SetStateAction<string | null>>;
|
|
350
|
+
run: <R>(fn: () => Promise<R>) => Promise<R | undefined>;
|
|
351
|
+
};
|
|
352
|
+
/** A file a package's path answers with, saved in the browser under the name the server gives (or the fallback). */
|
|
353
|
+
declare function useApiDownload(area: string): (path: string, init?: HostRequestInit, fallbackName?: string) => Promise<HostFile>;
|
|
354
|
+
/**
|
|
355
|
+
* A package's stream of server-sent events on this host, or null when the host reads none (the screen then asks again
|
|
356
|
+
* every few seconds). Resolves with the last event's id, for resuming.
|
|
357
|
+
*/
|
|
358
|
+
declare function useAreaEvents(area: string): ((path: string, onEvent: HostEventHandler, options?: {
|
|
359
|
+
lastEventId?: string | null;
|
|
360
|
+
signal?: AbortSignal;
|
|
361
|
+
}) => Promise<string | null>) | null;
|
|
362
|
+
/** The person signed in, when the host says. */
|
|
363
|
+
declare function useMe(): {
|
|
364
|
+
accountId: string;
|
|
365
|
+
} | null;
|
|
366
|
+
/** Go somewhere in the host's router (a link is `AppLink`). */
|
|
367
|
+
declare function useNavigate(): (href: string) => void;
|
|
368
|
+
/** Whether the person may: false when the host says nothing (the server decides anyway). */
|
|
369
|
+
declare function useCan(): (right: string, scopeId?: string) => boolean;
|
|
370
|
+
/** The site's languages, or none. */
|
|
371
|
+
declare function useHostLanguages(): HostLanguage[];
|
|
372
|
+
/**
|
|
373
|
+
* Names for ids a screen shows (people, scopes): those the server named already stay; the host names the rest, once
|
|
374
|
+
* per set of ids.
|
|
375
|
+
*/
|
|
376
|
+
declare function useNames(kind: 'people' | 'scopes', ids: readonly string[]): Record<string, string>;
|
|
377
|
+
/** What the host draws in a screen's named place, given the screen's context; nothing when the host fills none. */
|
|
378
|
+
declare function HostSlot({ name, context }: {
|
|
379
|
+
name: string;
|
|
380
|
+
context?: Record<string, unknown>;
|
|
381
|
+
}): react.JSX.Element | null;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* The host's router link (next/link in the shell). Components that render links use it so
|
|
385
|
+
* navigation stays client-side, without the package importing a router.
|
|
386
|
+
*/
|
|
387
|
+
type LinkComponent = ElementType<AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
388
|
+
href: string;
|
|
389
|
+
children?: ReactNode;
|
|
390
|
+
}>;
|
|
391
|
+
declare function useLinkComponent(): LinkComponent;
|
|
392
|
+
interface AppLinkProps extends Omit<LinkProps, 'href' | 'asChild'> {
|
|
393
|
+
href: string;
|
|
394
|
+
}
|
|
395
|
+
/** A styled link that navigates with the host's router. */
|
|
396
|
+
declare const AppLink: react.ForwardRefExoticComponent<AppLinkProps & react.RefAttributes<HTMLAnchorElement>>;
|
|
397
|
+
|
|
398
|
+
interface AbpProviderProps {
|
|
399
|
+
children: ReactNode;
|
|
400
|
+
/** The host's Chakra system (`createAbpSystem` with its prefix and brand); the package's own when not given. */
|
|
401
|
+
system?: SystemContext;
|
|
402
|
+
/** What the host gives the screens (`@abpjs/ui/ai` and the other areas): its requests, paths, rights and words. */
|
|
403
|
+
host?: AbpHost;
|
|
404
|
+
/** BCP 47 locale ("en", "ar"). Sets direction for every component, portals included. */
|
|
405
|
+
locale?: string;
|
|
406
|
+
/** Translated strings for the components' own text (close, cancel, sort ...). */
|
|
407
|
+
labels?: Partial<AbpLabels>;
|
|
408
|
+
/** The host router's link component (next/link in the shell). */
|
|
409
|
+
linkComponent?: LinkComponent;
|
|
410
|
+
/** Initial colour mode when the user has not chosen one. */
|
|
411
|
+
defaultColorMode?: 'light' | 'dark' | 'system';
|
|
412
|
+
/** Each plugin's texts in the current language, from the site (see usePluginTexts). */
|
|
413
|
+
pluginTexts?: Record<string, Record<string, unknown>>;
|
|
414
|
+
/** The product's name in the current language, which plugins' texts say for `{product}`. */
|
|
415
|
+
productName?: string;
|
|
416
|
+
/** The person's time zone (IANA); times show in the browser's when it's not given. */
|
|
417
|
+
timeZone?: string;
|
|
418
|
+
/** How much the interface moves for the person (ADR 0058); as their system says when it's not given. */
|
|
419
|
+
motion?: MotionSetting;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Chakra (with the host's system), colour mode (next-themes, class on <html>), locale and
|
|
423
|
+
* direction, labels, motion (reduced motion respected, ADR 0058), confirm dialogs and the toaster. The host renders it once; plugins render
|
|
424
|
+
* inside it and never render their own.
|
|
425
|
+
*
|
|
426
|
+
* The host must also set `<html lang dir>` and `suppressHydrationWarning` on <html>.
|
|
427
|
+
*/
|
|
428
|
+
declare function AbpProvider({ children, system, host, locale, labels, linkComponent, defaultColorMode, pluginTexts, productName, timeZone, motion }: AbpProviderProps): react.JSX.Element;
|
|
429
|
+
|
|
430
|
+
type ColorMode = 'light' | 'dark';
|
|
431
|
+
/** next-themes, configured the way Chakra v3 expects: a `light`/`dark` class on <html>. */
|
|
432
|
+
declare function ColorModeProvider(props: ThemeProviderProps): react.JSX.Element;
|
|
433
|
+
declare function useColorMode(): {
|
|
434
|
+
colorMode: ColorMode | undefined;
|
|
435
|
+
setColorMode: (mode: ColorMode | 'system') => void;
|
|
436
|
+
toggleColorMode: () => void;
|
|
437
|
+
};
|
|
438
|
+
/** Icon button that flips between light and dark. Renders a placeholder until mounted (no hydration mismatch). */
|
|
439
|
+
declare function ColorModeToggle({ size }: {
|
|
440
|
+
size?: 'xs' | 'sm' | 'md';
|
|
441
|
+
}): react.JSX.Element;
|
|
442
|
+
|
|
443
|
+
type Direction = 'ltr' | 'rtl';
|
|
444
|
+
/** Text direction for a BCP 47 locale ("ar", "ar-SA" -> rtl). */
|
|
445
|
+
declare function directionOf(locale: string): Direction;
|
|
446
|
+
/**
|
|
447
|
+
* Locale and direction from the nearest AbpProvider. Plugins use this instead of a router
|
|
448
|
+
* or i18n library: the shell's provider is shared with them through Module Federation.
|
|
449
|
+
*/
|
|
450
|
+
declare function useAbpLocale(): {
|
|
451
|
+
locale: string;
|
|
452
|
+
dir: Direction;
|
|
453
|
+
isRtl: boolean;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
/** The time zone times are shown in: the person's preference from the nearest AbpProvider, else the browser's. */
|
|
457
|
+
declare function useAbpTimeZone(): string | undefined;
|
|
458
|
+
|
|
459
|
+
/** A plugin's texts in one language: flat dotted keys or nested objects (ADR 0026). */
|
|
460
|
+
type Messages = {
|
|
461
|
+
[key: string]: string | Messages;
|
|
462
|
+
};
|
|
463
|
+
|
|
464
|
+
declare function PluginTextsProvider({ value, product, children }: {
|
|
465
|
+
value?: Record<string, Messages>;
|
|
466
|
+
product?: string;
|
|
467
|
+
children: ReactNode;
|
|
468
|
+
}): react.JSX.Element;
|
|
469
|
+
/** The product's name in the current language, as the host gives it (`AbpProvider`'s `productName`). */
|
|
470
|
+
declare function useProductName(): string;
|
|
471
|
+
/**
|
|
472
|
+
* A plugin's translate function (ADR 0026). The plugin ships its texts as `messages/{language}.json` in its package
|
|
473
|
+
* and passes the same files here as `bundled`; the shell supplies the site's version (an admin may have translated
|
|
474
|
+
* or reworded them, or added a language). The site's text wins, then the bundled text in the current language,
|
|
475
|
+
* then the English one, then the key itself. `{name}` placeholders are filled from `values`, and `{product}` with the
|
|
476
|
+
* product's name in the current language as the host gives it, whichever file the text came from, unless `values`
|
|
477
|
+
* gives a `product` of its own.
|
|
478
|
+
*
|
|
479
|
+
* The function stays the same across renders while the site's texts and the language do, however `bundled` is passed:
|
|
480
|
+
* it depends on the files, not on the object holding them (ADR 0078), so an effect that uses it runs when the texts
|
|
481
|
+
* change, not on every render.
|
|
482
|
+
*/
|
|
483
|
+
declare function usePluginTexts<M extends Messages>(pluginKey: string, bundled: {
|
|
484
|
+
en: M;
|
|
485
|
+
} & Record<string, Messages>): (key: string, values?: Record<string, string | number>) => string;
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* What the browser's tab says for a page, kept apart from React so it can be tested alone (provider/title.tsx).
|
|
489
|
+
*
|
|
490
|
+
* The convention, the same in the app, its portals and its plugins: "{what the page shows} · {where} · {site}", the most
|
|
491
|
+
* specific part first ("PAY-41 Retry failed payouts · Payments · Acme"). A page claims its parts; the last claim set
|
|
492
|
+
* wins, and a page's claim leaves with it, so the one under it shows again. An empty claim is no claim, so a page
|
|
493
|
+
* whose title is still loading never shows " · Acme" alone. The site's name ends every title; a portal on a host of
|
|
494
|
+
* its own may claim another name in its place.
|
|
495
|
+
*/
|
|
496
|
+
/** A page's title: one part, or its parts, most specific first. Empty and missing parts are left out. */
|
|
497
|
+
type TitleParts = string | number | readonly (string | number | null | undefined | false)[] | null | undefined | false;
|
|
498
|
+
declare const TITLE_SEPARATOR = " \u00B7 ";
|
|
499
|
+
/** The parts a claim names, trimmed, empty ones dropped. */
|
|
500
|
+
declare function partsOf(title: TitleParts): string[];
|
|
501
|
+
/**
|
|
502
|
+
* The tab's text: the parts, then the site's name, with a part said twice in a row once ("Partnerships · Partnerships").
|
|
503
|
+
* In a right-to-left language, or when a part is in a right-to-left script, each part is isolated and the title starts
|
|
504
|
+
* right to left, so "PAY-41 …" doesn't turn an Arabic title's order around.
|
|
505
|
+
*/
|
|
506
|
+
declare function composeTitle(parts: readonly string[], site: string | undefined, rtl: boolean): string;
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Owns the browser tab's title (provider/title-claims.ts has the convention): it renders the one `<title>` of the
|
|
510
|
+
* document, made of the parts the page claims (`usePageTitle`, and `PageHeader` by itself) and the site's name. The host
|
|
511
|
+
* renders it once, above every frame, and gives the page no title of its own any other way. Without it, claims do
|
|
512
|
+
* nothing, so a host that sets its titles another way (on the server, say) keeps them.
|
|
513
|
+
*/
|
|
514
|
+
declare function PageTitleProvider({ site, children }: {
|
|
515
|
+
site?: string;
|
|
516
|
+
children: ReactNode;
|
|
517
|
+
}): react.JSX.Element;
|
|
518
|
+
/**
|
|
519
|
+
* Claims the tab's title for as long as the calling page shows: its parts, most specific first, without the site's
|
|
520
|
+
* name ("PAY-41 Retry failed payouts", "Payments"). An empty title claims nothing, so a title still loading leaves the
|
|
521
|
+
* one before it. `PageHeader` claims its own text title; call this for a title that's a node, or to say where.
|
|
522
|
+
*/
|
|
523
|
+
declare function usePageTitle(title: TitleParts): void;
|
|
524
|
+
/**
|
|
525
|
+
* Puts another name in the site's place at the end of the title while the calling page shows: a portal with a name of
|
|
526
|
+
* its own (the help center on its own host, a team's portal). Empty puts the site's name back.
|
|
527
|
+
*/
|
|
528
|
+
declare function usePageTitleSite(name: string | null | undefined): void;
|
|
529
|
+
/**
|
|
530
|
+
* The parts the page claims now, most specific first, without the site's name: for what shows a page's title in a
|
|
531
|
+
* narrower place (the phone app's header shows the first). Empty when no page claims one, or with no provider.
|
|
532
|
+
*/
|
|
533
|
+
declare function usePageTitleParts(): readonly string[];
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Orders strings by their UTF-16 code units: what `sort()` does without a compare function, said on purpose. It's the
|
|
537
|
+
* order of ISO dates ("2026-01-31"), ids and keys, the same in every locale, so it's what a canonical form needs (a list
|
|
538
|
+
* sorted to compare it with another). Text people read is sorted with `localeCompare` instead.
|
|
539
|
+
*/
|
|
540
|
+
declare function compareOrdinal(a: string, b: string): number;
|
|
541
|
+
|
|
542
|
+
/** Placeholder for a missing value in tables and property lists. */
|
|
543
|
+
declare const EMPTY_VALUE = "\u2014";
|
|
544
|
+
declare function formatDateTime(value: string | number | Date | null | undefined, locale: string, options?: Intl.DateTimeFormatOptions, timeZone?: string): string;
|
|
545
|
+
declare function formatNumber(value: number | null | undefined, locale: string, options?: Intl.NumberFormatOptions): string;
|
|
546
|
+
/** Formatters bound to the current AbpProvider locale and the person's time zone. */
|
|
547
|
+
declare function useFormatters(): {
|
|
548
|
+
dateTime: (value: string | number | Date | null | undefined, options?: Intl.DateTimeFormatOptions) => string;
|
|
549
|
+
number: (value: number | null | undefined, options?: Intl.NumberFormatOptions) => string;
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Where something comes from, and goes back to: `fade` in place, `rise` from a little below, `drop` from a little
|
|
554
|
+
* above (what hangs from the top bar), `pop` from slightly smaller (what opens from a trigger), `start` and `end` from
|
|
555
|
+
* the reading direction's sides.
|
|
556
|
+
*/
|
|
557
|
+
type Arrival = 'fade' | 'rise' | 'drop' | 'pop' | 'start' | 'end';
|
|
558
|
+
/** A pose Motion animates between. Always the same transform shape, so any two poses interpolate. */
|
|
559
|
+
type Pose = {
|
|
560
|
+
opacity: number;
|
|
561
|
+
transform: string;
|
|
562
|
+
};
|
|
563
|
+
/** Where everything settles. */
|
|
564
|
+
declare const SHOWN: Pose;
|
|
565
|
+
/**
|
|
566
|
+
* The hidden pose for an arrival. `start` is the left in English and the right in Arabic; with reduced motion
|
|
567
|
+
* nothing moves and only the opacity changes.
|
|
568
|
+
*/
|
|
569
|
+
declare function hiddenPose(kind: Arrival, options: {
|
|
570
|
+
rtl: boolean;
|
|
571
|
+
reduce?: boolean;
|
|
572
|
+
distance?: number;
|
|
573
|
+
}): Pose;
|
|
574
|
+
/** How long the item at this place in a list waits before it arrives (capped, so long lists don't wait). */
|
|
575
|
+
declare function staggerDelay(index: number): number;
|
|
576
|
+
/** One particle of a burst: where it flies to, how it turns, its size and colour slot. */
|
|
577
|
+
interface Particle {
|
|
578
|
+
x: number;
|
|
579
|
+
y: number;
|
|
580
|
+
rotate: number;
|
|
581
|
+
size: number;
|
|
582
|
+
tone: number;
|
|
583
|
+
round: boolean;
|
|
584
|
+
}
|
|
585
|
+
/**
|
|
586
|
+
* A small burst (Celebrate): particles spread evenly around the point, each a little off its line, flying 40 to 90 px
|
|
587
|
+
* and falling a little at the end. Seeded, so the same seed gives the same burst.
|
|
588
|
+
*/
|
|
589
|
+
declare function burst(count: number, seed?: number): Particle[];
|
|
590
|
+
|
|
591
|
+
type BoxProps = Omit<HTMLChakraProps<'div'>, 'transition' | 'translate' | 'rotate' | 'scale'>;
|
|
592
|
+
interface FadeInProps extends BoxProps {
|
|
593
|
+
/** Where it comes from; `fade` (in place) by default. */
|
|
594
|
+
from?: Arrival;
|
|
595
|
+
/** Seconds to wait first. */
|
|
596
|
+
delay?: number;
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Arrives once, when it first shows: a page's content, a panel loaded late. Fades in place by default, since what
|
|
600
|
+
* people open many times a day shouldn't travel.
|
|
601
|
+
*/
|
|
602
|
+
declare function FadeIn({ from, delay, children, ...rest }: FadeInProps): react.JSX.Element;
|
|
603
|
+
interface RevealProps extends BoxProps {
|
|
604
|
+
/** Where each item comes from; `rise` by default. */
|
|
605
|
+
from?: Arrival;
|
|
606
|
+
/** The wrapper each item gets ("div" by default; "li" inside a list). */
|
|
607
|
+
itemAs?: 'div' | 'li' | 'span';
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* A group's items arrive in turn, 40 ms apart (capped), the first time it shows: cards on an overview, a dashboard's
|
|
611
|
+
* panels. Each child is wrapped once; use RevealItem where a wrapper would break the layout.
|
|
612
|
+
*/
|
|
613
|
+
declare function Reveal({ from, itemAs, children, ...rest }: RevealProps): react.JSX.Element;
|
|
614
|
+
interface RevealItemProps extends Omit<BoxProps, 'as'> {
|
|
615
|
+
/** Its place in the group: it waits that many steps. */
|
|
616
|
+
index: number;
|
|
617
|
+
from?: Arrival;
|
|
618
|
+
as?: 'div' | 'li' | 'span';
|
|
619
|
+
}
|
|
620
|
+
/** One item of a group that arrives in turn (see Reveal). */
|
|
621
|
+
declare function RevealItem({ index, from, as, children, ...rest }: RevealItemProps): react.JSX.Element;
|
|
622
|
+
interface PresenceProps extends BoxProps {
|
|
623
|
+
/** Whether it's there. Leaving plays the way back. */
|
|
624
|
+
show: boolean;
|
|
625
|
+
/** Where it comes from and goes back to; `pop` by default. */
|
|
626
|
+
from?: Arrival;
|
|
627
|
+
/** Animate when the page first renders it too (off by default: what's already there just is). */
|
|
628
|
+
appear?: boolean;
|
|
629
|
+
}
|
|
630
|
+
/** Something that comes and goes: a hint, a banner, a panel's extra. It leaves the way it came. */
|
|
631
|
+
declare function Presence({ show, from, appear, children, ...rest }: PresenceProps): react.JSX.Element;
|
|
632
|
+
interface PresenceListProps {
|
|
633
|
+
children: ReactNode;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* A list whose items come and go (rows added, removed, filtered): new ones arrive, gone ones leave, and the rest slide
|
|
637
|
+
* to their new places. What's there on first render just is. Each child must be a PresenceItem with a key.
|
|
638
|
+
*/
|
|
639
|
+
declare function PresenceList({ children }: PresenceListProps): react.JSX.Element;
|
|
640
|
+
interface PresenceItemProps extends Omit<BoxProps, 'as'> {
|
|
641
|
+
from?: Arrival;
|
|
642
|
+
as?: 'div' | 'li';
|
|
643
|
+
}
|
|
644
|
+
/** One item of a PresenceList. */
|
|
645
|
+
declare function PresenceItem({ from, as, children, ...rest }: PresenceItemProps): react.JSX.Element;
|
|
646
|
+
interface SlideListProps extends BoxProps {
|
|
647
|
+
/** Changes when the items change (their order, or where they are): those that moved slide to their new places. */
|
|
648
|
+
token: unknown;
|
|
649
|
+
}
|
|
650
|
+
/**
|
|
651
|
+
* Items that change places slide there instead of jumping (a reordered list, cards moved between columns): each item
|
|
652
|
+
* is a SlideItem with an id. Measured against this element, so scrolling isn't taken for a move.
|
|
653
|
+
*/
|
|
654
|
+
declare function SlideList({ token, children, ...rest }: SlideListProps): react.JSX.Element;
|
|
655
|
+
interface SlideItemProps extends BoxProps {
|
|
656
|
+
/** Stays the same wherever the item goes. */
|
|
657
|
+
slideId: string;
|
|
658
|
+
}
|
|
659
|
+
/** One item of a SlideList. */
|
|
660
|
+
declare function SlideItem({ slideId, children, ...rest }: SlideItemProps): react.JSX.Element;
|
|
661
|
+
interface CollapseProps extends BoxProps {
|
|
662
|
+
open: boolean;
|
|
663
|
+
}
|
|
664
|
+
/** Opens to its height and closes back: a group in a menu, details under a row. Short, since it costs layout. */
|
|
665
|
+
declare function Collapse({ open, children, ...rest }: CollapseProps): react.JSX.Element;
|
|
666
|
+
interface SwapProps extends Omit<HTMLChakraProps<'span'>, 'transition' | 'translate' | 'rotate' | 'scale'> {
|
|
667
|
+
/** Changes when the content does: the old gives way to the new. */
|
|
668
|
+
swapKey: string | number;
|
|
669
|
+
from?: Arrival;
|
|
670
|
+
}
|
|
671
|
+
/** One content gives way to another in place (a status, a label, a count) instead of changing in a blink. */
|
|
672
|
+
declare function Swap({ swapKey, from, children, ...rest }: SwapProps): react.JSX.Element;
|
|
673
|
+
interface CounterProps extends Omit<HTMLChakraProps<'span'>, 'children'> {
|
|
674
|
+
value: number;
|
|
675
|
+
/** How the number is written; the locale's own digits and grouping by default. */
|
|
676
|
+
format?: (value: number) => string;
|
|
677
|
+
/** Count up from zero the first time it shows (on by default). */
|
|
678
|
+
fromZero?: boolean;
|
|
679
|
+
}
|
|
680
|
+
/** A number counts to its value: a dashboard's totals the first time they show, and when they change. */
|
|
681
|
+
declare function Counter({ value, format, fromZero, ...rest }: CounterProps): react.JSX.Element;
|
|
682
|
+
interface IndicatorProps {
|
|
683
|
+
/** Which group it slides within: one indicator per group (a menu, a tab list). */
|
|
684
|
+
group: string;
|
|
685
|
+
/** Its look and place: a bar under the item, or a pill behind it. */
|
|
686
|
+
css?: SystemStyleObject;
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* The mark under (or behind) the current item of a menu, tabs or a segmented control. Render it inside the current
|
|
690
|
+
* item only: when the current item changes, it slides from the old one to the new (FLIP, measured against the menu
|
|
691
|
+
* it's in, so a scroll isn't a move).
|
|
692
|
+
*/
|
|
693
|
+
declare function Indicator({ group, css }: IndicatorProps): react.JSX.Element;
|
|
694
|
+
type PressableProps = ComponentProps<typeof chakra.div> & {
|
|
695
|
+
/** Lifts a little under a mouse (cards, tiles); presses always give. */
|
|
696
|
+
lift?: boolean;
|
|
697
|
+
};
|
|
698
|
+
/**
|
|
699
|
+
* Feels pressable: gives a little when pressed, and with `lift`, rises a little under a mouse. Plain CSS, so it costs
|
|
700
|
+
* nothing; hover only where there's a real pointer, and no movement with reduced motion.
|
|
701
|
+
*/
|
|
702
|
+
declare function Pressable({ lift, css, ...rest }: PressableProps): react.JSX.Element;
|
|
703
|
+
interface ArriveOnChangeProps extends BoxProps {
|
|
704
|
+
/** When it changes (the page's address), the content arrives again: a quick fade, nothing travels. */
|
|
705
|
+
token: string;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Shows that the page changed without remounting it: the content fades up from a little transparent in 150 ms when the
|
|
709
|
+
* token changes. Pages change many times a day, so nothing moves and it's barely there; the first render just shows.
|
|
710
|
+
*/
|
|
711
|
+
declare function ArriveOnChange({ token, children, ...rest }: ArriveOnChangeProps): react.JSX.Element;
|
|
712
|
+
interface NudgeProps {
|
|
713
|
+
/** A count: when it grows, the content gives a little wiggle (a bell when a notice comes). Not when it shrinks. */
|
|
714
|
+
on: number;
|
|
715
|
+
children: ReactNode;
|
|
716
|
+
}
|
|
717
|
+
/** A small wiggle that says something new arrived. Never on the first render, never with reduced motion. */
|
|
718
|
+
declare function Nudge({ on, children }: NudgeProps): react.JSX.Element;
|
|
719
|
+
|
|
720
|
+
/** Where a burst starts: an element (its centre) or a point on the screen. */
|
|
721
|
+
type CelebrateTarget = Element | {
|
|
722
|
+
x: number;
|
|
723
|
+
y: number;
|
|
724
|
+
};
|
|
725
|
+
type Celebrate = (target: CelebrateTarget) => void;
|
|
726
|
+
/**
|
|
727
|
+
* A small burst from where something good happened (ADR 0058): a record reaching done, a sprint closed, an approval
|
|
728
|
+
* given, an import finished. Only for real moments, never for a bulk change, and never with reduced motion.
|
|
729
|
+
*/
|
|
730
|
+
declare function useCelebrate(): Celebrate;
|
|
731
|
+
|
|
732
|
+
/**
|
|
733
|
+
* Motion for everything under it (ADR 0058). The person's setting decides: as their system says (Motion's own
|
|
734
|
+
* reduced-motion handling: movement off, fades kept), less (always reduced), or full (even when the system asks for
|
|
735
|
+
* less). The page's root element carries it (`data-motion`), so CSS motion follows the same choice. Springs are soft
|
|
736
|
+
* unless a component asks otherwise, and only the light `m` components are allowed (strict), with Motion's
|
|
737
|
+
* `domAnimation` features: layout motion is the FLIP helper's (flip.ts), a third lighter. AbpProvider renders it;
|
|
738
|
+
* plugins render inside it.
|
|
739
|
+
*/
|
|
740
|
+
declare function MotionProvider({ setting: initial, children }: {
|
|
741
|
+
setting?: MotionSetting;
|
|
742
|
+
children: ReactNode;
|
|
743
|
+
}): react.JSX.Element;
|
|
744
|
+
|
|
745
|
+
/**
|
|
746
|
+
* Motion's ingredients, kept in one place (ADR 0058). The curves are the theme's easing tokens (easings.out, inOut,
|
|
747
|
+
* drawer), so a CSS transition and a Motion animation move alike.
|
|
748
|
+
*/
|
|
749
|
+
declare const curves: {
|
|
750
|
+
/** Entering and leaving: quick at first, settling softly. The default. */
|
|
751
|
+
readonly out: readonly [0.23, 1, 0.32, 1];
|
|
752
|
+
/** Something moving or changing shape on screen. */
|
|
753
|
+
readonly inOut: readonly [0.77, 0, 0.175, 1];
|
|
754
|
+
/** Drawers and sheets. */
|
|
755
|
+
readonly drawer: readonly [0.32, 0.72, 0, 1];
|
|
756
|
+
};
|
|
757
|
+
/** Seconds. Interface motion stays under 300 ms; a number counting up and a burst take longer, being rare. */
|
|
758
|
+
declare const durations: {
|
|
759
|
+
readonly press: 0.16;
|
|
760
|
+
readonly quick: 0.15;
|
|
761
|
+
readonly base: 0.2;
|
|
762
|
+
readonly panel: 0.25;
|
|
763
|
+
readonly count: 0.6;
|
|
764
|
+
readonly burst: 0.7;
|
|
765
|
+
};
|
|
766
|
+
/** Springs carry speed through an interruption: soft by default, snappy for indicators and toggles, bouncy for delights. */
|
|
767
|
+
declare const springs: {
|
|
768
|
+
readonly soft: {
|
|
769
|
+
readonly type: "spring";
|
|
770
|
+
readonly duration: 0.35;
|
|
771
|
+
readonly bounce: 0.1;
|
|
772
|
+
};
|
|
773
|
+
readonly snappy: {
|
|
774
|
+
readonly type: "spring";
|
|
775
|
+
readonly duration: 0.25;
|
|
776
|
+
readonly bounce: 0;
|
|
777
|
+
};
|
|
778
|
+
readonly bouncy: {
|
|
779
|
+
readonly type: "spring";
|
|
780
|
+
readonly duration: 0.5;
|
|
781
|
+
readonly bounce: 0.3;
|
|
782
|
+
};
|
|
783
|
+
};
|
|
784
|
+
|
|
785
|
+
interface AppShellNavItem {
|
|
786
|
+
id: string;
|
|
787
|
+
label: string;
|
|
788
|
+
href: string;
|
|
789
|
+
icon?: ReactNode;
|
|
790
|
+
/** Marks the item as the current page (aria-current). */
|
|
791
|
+
current?: boolean;
|
|
792
|
+
/** Pages under this one (a person's favourite views under Views), indented below it; hidden in the rail. */
|
|
793
|
+
children?: AppShellNavItem[];
|
|
794
|
+
}
|
|
795
|
+
interface AppShellNavSection {
|
|
796
|
+
id: string;
|
|
797
|
+
title?: string;
|
|
798
|
+
items: AppShellNavItem[];
|
|
799
|
+
/** The title opens and closes the section (a project's settings); it opens by itself when it holds the current page. */
|
|
800
|
+
collapsible?: boolean;
|
|
801
|
+
}
|
|
802
|
+
interface AppShellBrand {
|
|
803
|
+
name: ReactNode;
|
|
804
|
+
tagline?: ReactNode;
|
|
805
|
+
/** A small square mark; defaults to the first letter of the name. */
|
|
806
|
+
mark?: ReactNode;
|
|
807
|
+
href?: string;
|
|
808
|
+
}
|
|
809
|
+
/** The place a sidebar belongs to (a project, Administration): shown as a card at its top. */
|
|
810
|
+
interface AppShellPlace {
|
|
811
|
+
name: string;
|
|
812
|
+
/** Under the name: a key, a kind. */
|
|
813
|
+
detail?: ReactNode;
|
|
814
|
+
/** A small square mark; defaults to the first letter of the name. */
|
|
815
|
+
mark?: ReactNode;
|
|
816
|
+
href?: string;
|
|
817
|
+
}
|
|
818
|
+
/** A place's own menu (ADR 0058): a project's pages and settings, or Administration's. */
|
|
819
|
+
interface AppShellSidebar {
|
|
820
|
+
/** Which place: the current page's mark slides within it, and a new place arrives softly. */
|
|
821
|
+
id: string;
|
|
822
|
+
place?: AppShellPlace;
|
|
823
|
+
/** Above the sections (e.g. a box to find a page in the menu). */
|
|
824
|
+
top?: ReactNode;
|
|
825
|
+
sections: AppShellNavSection[];
|
|
826
|
+
/**
|
|
827
|
+
* Its place and pages are coming (ADR 0061): the sidebar is there from the first moment, so the page beside it
|
|
828
|
+
* doesn't move when they come. Its card and `skeletonItems` pages (5) are placeholders until then.
|
|
829
|
+
*/
|
|
830
|
+
loading?: boolean;
|
|
831
|
+
skeletonItems?: number;
|
|
832
|
+
}
|
|
833
|
+
interface AppShellProps {
|
|
834
|
+
brand: AppShellBrand;
|
|
835
|
+
/** Right after the brand, always shown (e.g. the way back from Administration). */
|
|
836
|
+
topbarStart?: ReactNode;
|
|
837
|
+
/** The site's pages, in the top bar. */
|
|
838
|
+
topNav: AppShellNavItem[];
|
|
839
|
+
/** After the site's pages in the top bar (e.g. an Apps menu). */
|
|
840
|
+
topNavEnd?: ReactNode;
|
|
841
|
+
/** The current place's own menu; without one there is no sidebar and the page uses the width. */
|
|
842
|
+
sidebar?: AppShellSidebar | null;
|
|
843
|
+
/** Extra content below the menu (e.g. a warning). */
|
|
844
|
+
navFooter?: ReactNode;
|
|
845
|
+
/** Shown at the bottom of the sidebar. */
|
|
846
|
+
sidebarFooter?: ReactNode;
|
|
847
|
+
/** Top bar, at the end (help, notices, language, colour mode, settings, account). */
|
|
848
|
+
topbarEnd?: ReactNode;
|
|
849
|
+
collapsed?: boolean;
|
|
850
|
+
defaultCollapsed?: boolean;
|
|
851
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
852
|
+
/** Changes with the page (its address): the content then arrives with a quick fade, without remounting. */
|
|
853
|
+
pageKey?: string;
|
|
854
|
+
children: ReactNode;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Application frame (ADR 0058): the site's pages in the top bar, with a mark that slides to the current one; a place's
|
|
858
|
+
* own menu (a project's, Administration's) in a sidebar on the inline start, collapsible to a rail; none elsewhere.
|
|
859
|
+
* Below the xl breakpoint the site's pages, and below md the place's menu too, move into a drawer. Logical properties
|
|
860
|
+
* only, so the whole frame mirrors in right-to-left locales.
|
|
861
|
+
*/
|
|
862
|
+
declare function AppShell({ brand, topbarStart, topNav, topNavEnd, sidebar, navFooter, sidebarFooter, topbarEnd, collapsed: collapsedProp, defaultCollapsed, onCollapsedChange, pageKey, children, }: AppShellProps): react.JSX.Element;
|
|
863
|
+
|
|
864
|
+
interface PaginationProps {
|
|
865
|
+
/** The current page, from 1. */
|
|
866
|
+
page: number;
|
|
867
|
+
pages: number;
|
|
868
|
+
onPage: (page: number) => void;
|
|
869
|
+
/** The navigation's name ("Pages"). */
|
|
870
|
+
label: string;
|
|
871
|
+
previous: string;
|
|
872
|
+
next: string;
|
|
873
|
+
/** A page button's name: "Page 4". */
|
|
874
|
+
pageLabel: (page: number) => string;
|
|
875
|
+
disabled?: boolean;
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* Pages of a list, centred under it (the canvas's v12, UI round 9 step 67): previous, the first and last pages and the
|
|
879
|
+
* ones around the current one (gaps as "…"), next. The current page is filled. One page: nothing to show.
|
|
880
|
+
*/
|
|
881
|
+
declare function Pagination({ page, pages, onPage, label, previous, next, pageLabel, disabled }: PaginationProps): react.JSX.Element | null;
|
|
882
|
+
|
|
883
|
+
interface CommandItem {
|
|
884
|
+
id: string;
|
|
885
|
+
label: string;
|
|
886
|
+
/** Beside the label, quieter (a record's status, a view's project). */
|
|
887
|
+
detail?: ReactNode;
|
|
888
|
+
/** Before the label. */
|
|
889
|
+
icon?: ReactNode;
|
|
890
|
+
onSelect: () => void;
|
|
891
|
+
}
|
|
892
|
+
interface CommandGroup {
|
|
893
|
+
id: string;
|
|
894
|
+
label: string;
|
|
895
|
+
items: CommandItem[];
|
|
896
|
+
}
|
|
897
|
+
interface CommandPaletteProps {
|
|
898
|
+
open: boolean;
|
|
899
|
+
onOpenChange: (open: boolean) => void;
|
|
900
|
+
/** The results for what's typed (and for nothing typed: what to start from), grouped; a group with no items isn't shown. */
|
|
901
|
+
search: (text: string) => Promise<CommandGroup[]> | CommandGroup[];
|
|
902
|
+
labels: {
|
|
903
|
+
/** The box's name and placeholder. */
|
|
904
|
+
placeholder: string;
|
|
905
|
+
searching: string;
|
|
906
|
+
noResults: string;
|
|
907
|
+
/** The active row's hint: "Open". */
|
|
908
|
+
open: string;
|
|
909
|
+
/** Under the results: how to move, open and close. */
|
|
910
|
+
hint: string;
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
/** A label with the typed part in bold, every match, ignoring case. */
|
|
914
|
+
declare function HighlightText({ text, query }: {
|
|
915
|
+
text: string;
|
|
916
|
+
query: string;
|
|
917
|
+
}): react.JSX.Element;
|
|
918
|
+
/**
|
|
919
|
+
* Searching everything from anywhere (the canvas's v12 command search, UI round 9 step 70): a box over the dimmed page,
|
|
920
|
+
* the results grouped, the matched part in bold, the active row on the selected tint with an Enter hint. Up and down
|
|
921
|
+
* move, Enter opens, Esc closes. What's searched and what opening does are the host's.
|
|
922
|
+
*/
|
|
923
|
+
declare function CommandPalette({ open, onOpenChange, search, labels }: CommandPaletteProps): react.JSX.Element;
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* The pages a pagination shows (UI round 9, step 67): the first and the last, the current one and its neighbours, and
|
|
927
|
+
* near either end the first or last four, in order, with 'gap' where pages are left out.
|
|
928
|
+
*/
|
|
929
|
+
declare function pageList(page: number, pages: number): (number | 'gap')[];
|
|
930
|
+
|
|
931
|
+
interface AvatarPerson {
|
|
932
|
+
id: string;
|
|
933
|
+
name: string;
|
|
934
|
+
/** Their picture (ADR 0096), a path on the site; their initials when there's none or it fails. */
|
|
935
|
+
picture?: string | null;
|
|
936
|
+
/** A line under the name, in the tooltip and the list: "4 records". */
|
|
937
|
+
detail?: ReactNode;
|
|
938
|
+
}
|
|
939
|
+
interface AvatarStackProps {
|
|
940
|
+
'aria-label': string;
|
|
941
|
+
people: AvatarPerson[];
|
|
942
|
+
/** How many avatars show before the "+N" circle (5). */
|
|
943
|
+
max?: number;
|
|
944
|
+
/** The "+N" button's name for screen readers: "Show 3 more people". */
|
|
945
|
+
moreLabel: (count: number) => string;
|
|
946
|
+
/** The heading of the list the "+N" button opens. */
|
|
947
|
+
moreTitle: ReactNode;
|
|
948
|
+
/** Its people are coming (ADR 0061): a few placeholder circles. The nearest `Loading` scope's when not given. */
|
|
949
|
+
loading?: boolean;
|
|
950
|
+
/** Who is picked (ringed). With `onToggle`, every person is a button that picks or unpicks them, as a filter. */
|
|
951
|
+
selected?: readonly string[];
|
|
952
|
+
onToggle?: (id: string) => void;
|
|
953
|
+
}
|
|
954
|
+
declare const PALETTES: readonly ["blue", "teal", "purple", "orange", "pink", "cyan", "green", "red"];
|
|
955
|
+
/** A person's colour: the same on every page and every visit, from their id. */
|
|
956
|
+
declare function avatarPalette(id: string): (typeof PALETTES)[number];
|
|
957
|
+
/**
|
|
958
|
+
* People as avatars side by side, 4 apart and never overlapping, no ring (the canvas's v12, UI round 9 step 66; their
|
|
959
|
+
* initials, each in their own colour until the colours land), the first `max` (three) shown and the rest behind a "+N"
|
|
960
|
+
* circle that opens a list of them. Names show on hover and are read out by screen readers. With `onToggle` each
|
|
961
|
+
* person is a toggle (pressed when picked), for filtering by people: the list stays open so several can be picked.
|
|
962
|
+
*/
|
|
963
|
+
declare function AvatarStack({ 'aria-label': ariaLabel, people, max, moreLabel, moreTitle, loading: own, selected, onToggle }: AvatarStackProps): react.JSX.Element | null;
|
|
964
|
+
|
|
965
|
+
/**
|
|
966
|
+
* The design system's button semantics on top of Chakra's button recipe:
|
|
967
|
+
* primary the one main action of a view (accent, solid)
|
|
968
|
+
* secondary every other action (outlined neutral); the default
|
|
969
|
+
* ghost low-emphasis actions in toolbars and table rows
|
|
970
|
+
* link inline text action
|
|
971
|
+
* `danger` turns any of them red for destructive actions.
|
|
972
|
+
*/
|
|
973
|
+
type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'link';
|
|
974
|
+
type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
975
|
+
interface AbpButtonProps {
|
|
976
|
+
variant?: ButtonVariant;
|
|
977
|
+
size?: ButtonSize;
|
|
978
|
+
danger?: boolean;
|
|
979
|
+
}
|
|
980
|
+
type ButtonProps = Omit<ButtonProps$1, 'variant' | 'size' | 'colorPalette'> & AbpButtonProps;
|
|
981
|
+
/**
|
|
982
|
+
* Inside a `Loading` scope a button is drawn as its own ghost, at its size, and can't be pressed (ADR 0061). Its own
|
|
983
|
+
* `loading` is Chakra's: an action is running.
|
|
984
|
+
*/
|
|
985
|
+
declare const Button: react.ForwardRefExoticComponent<Omit<ButtonProps$1, "colorPalette" | "size" | "variant"> & AbpButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
986
|
+
type IconButtonProps = Omit<IconButtonProps$1, 'variant' | 'size' | 'colorPalette'> & AbpButtonProps & {
|
|
987
|
+
'aria-label': string;
|
|
988
|
+
};
|
|
989
|
+
/** Square icon-only button. `aria-label` is required; it is also shown as the native tooltip. */
|
|
990
|
+
declare const IconButton: react.ForwardRefExoticComponent<Omit<IconButtonProps$1, "colorPalette" | "size" | "variant"> & AbpButtonProps & {
|
|
991
|
+
'aria-label': string;
|
|
992
|
+
} & react.RefAttributes<HTMLButtonElement>>;
|
|
993
|
+
|
|
994
|
+
interface ConfirmOptions {
|
|
995
|
+
title: ReactNode;
|
|
996
|
+
description?: ReactNode;
|
|
997
|
+
confirmLabel?: ReactNode;
|
|
998
|
+
cancelLabel?: ReactNode;
|
|
999
|
+
/** Red confirm button for destructive actions. */
|
|
1000
|
+
danger?: boolean;
|
|
1001
|
+
}
|
|
1002
|
+
interface ConfirmDialogProps extends ConfirmOptions {
|
|
1003
|
+
open: boolean;
|
|
1004
|
+
onOpenChange: (open: boolean) => void;
|
|
1005
|
+
onConfirm: () => void | Promise<void>;
|
|
1006
|
+
/** Shows a spinner on the confirm button while the action runs. */
|
|
1007
|
+
busy?: boolean;
|
|
1008
|
+
}
|
|
1009
|
+
/** An alert dialog asking the user to confirm an action. Focus starts on Cancel. */
|
|
1010
|
+
declare function ConfirmDialog({ open, onOpenChange, onConfirm, busy, title, description, confirmLabel, cancelLabel, danger, }: ConfirmDialogProps): react.JSX.Element;
|
|
1011
|
+
type ConfirmFn = (options: ConfirmOptions) => Promise<boolean>;
|
|
1012
|
+
/** Provides `useConfirm()`. AbpProvider renders it; you rarely need it directly. */
|
|
1013
|
+
declare function ConfirmProvider({ children }: {
|
|
1014
|
+
children: ReactNode;
|
|
1015
|
+
}): react.JSX.Element;
|
|
1016
|
+
/** `if (await confirm({ title, danger: true })) ...` */
|
|
1017
|
+
declare function useConfirm(): ConfirmFn;
|
|
1018
|
+
|
|
1019
|
+
type SortDirection = 'asc' | 'desc';
|
|
1020
|
+
interface DataTableSort {
|
|
1021
|
+
columnId: string;
|
|
1022
|
+
direction: SortDirection;
|
|
1023
|
+
}
|
|
1024
|
+
type SortValue = string | number | boolean | Date | null | undefined;
|
|
1025
|
+
interface DataTableColumn<T> {
|
|
1026
|
+
id: string;
|
|
1027
|
+
header: ReactNode;
|
|
1028
|
+
cell: (row: T, index: number) => ReactNode;
|
|
1029
|
+
/** Value the column sorts by. Giving one makes the column sortable. */
|
|
1030
|
+
sortValue?: (row: T) => SortValue;
|
|
1031
|
+
align?: 'start' | 'center' | 'end';
|
|
1032
|
+
/** Numbers: end-aligned, tabular figures. */
|
|
1033
|
+
numeric?: boolean;
|
|
1034
|
+
/** Fixed width as a size token ("24", "sidePanel") or CSS length. */
|
|
1035
|
+
width?: string;
|
|
1036
|
+
/** Prevent wrapping in this column. */
|
|
1037
|
+
nowrap?: boolean;
|
|
1038
|
+
/**
|
|
1039
|
+
* What the column's cells are while the table loads (ADR 0061), so a placeholder row is as tall as a real one: text
|
|
1040
|
+
* (the default), a record key, a status pill, a person's name, a number, a date, nothing, or the column's own
|
|
1041
|
+
* drawing for a row (drawn in a `Loading` scope, its buttons and pills as their ghosts).
|
|
1042
|
+
*/
|
|
1043
|
+
skeleton?: 'text' | 'key' | 'pill' | 'person' | 'number' | 'date' | 'none' | ((index: number) => ReactNode);
|
|
1044
|
+
/** How many characters wide its text placeholder is. */
|
|
1045
|
+
skeletonWidth?: number;
|
|
1046
|
+
}
|
|
1047
|
+
interface DataTableProps<T> {
|
|
1048
|
+
columns: DataTableColumn<T>[];
|
|
1049
|
+
/** undefined while the first load is running. */
|
|
1050
|
+
rows: T[] | undefined;
|
|
1051
|
+
getRowId: (row: T) => string;
|
|
1052
|
+
/** Accessible name of the table. */
|
|
1053
|
+
'aria-label'?: string;
|
|
1054
|
+
/** Its rows are coming (ADR 0061): rows of placeholders. The nearest `Loading` scope's when not given. */
|
|
1055
|
+
loading?: boolean;
|
|
1056
|
+
/** How many placeholder rows it draws while it loads: as many as it's about to show (5). */
|
|
1057
|
+
skeletonRows?: number;
|
|
1058
|
+
/** An error message replaces the body. */
|
|
1059
|
+
error?: ReactNode;
|
|
1060
|
+
/** Shown when rows is an empty array. A string becomes an EmptyState title. */
|
|
1061
|
+
empty?: ReactNode;
|
|
1062
|
+
size?: 'sm' | 'md';
|
|
1063
|
+
/** Keep the header visible while the body scrolls; set maxHeight for a scrolling body. */
|
|
1064
|
+
stickyHeader?: boolean;
|
|
1065
|
+
/** Size token or CSS length; the body scrolls beyond it. */
|
|
1066
|
+
maxHeight?: string;
|
|
1067
|
+
/** Row hover highlight (for rows that open something). */
|
|
1068
|
+
interactive?: boolean;
|
|
1069
|
+
/** Controlled sort. */
|
|
1070
|
+
sort?: DataTableSort | null;
|
|
1071
|
+
defaultSort?: DataTableSort | null;
|
|
1072
|
+
onSortChange?: (sort: DataTableSort | null) => void;
|
|
1073
|
+
/**
|
|
1074
|
+
* "client" sorts the rows in the browser (default). "manual" only reports sort changes, for
|
|
1075
|
+
* server-side ordering (the M2 QueryableList builds on this).
|
|
1076
|
+
*/
|
|
1077
|
+
sortMode?: 'client' | 'manual';
|
|
1078
|
+
/** Extra props per row, e.g. `{ 'data-selected': '' }` to highlight one (bg.selected). */
|
|
1079
|
+
rowProps?: (row: T) => TableRowProps | undefined;
|
|
1080
|
+
/** A full-width row rendered under a row (details, inline forms); return null for none. */
|
|
1081
|
+
renderSubRow?: (row: T) => ReactNode | null;
|
|
1082
|
+
/**
|
|
1083
|
+
* Draws a row its own way, in one cell across every column (a plugin's row view); null draws its cells as usual.
|
|
1084
|
+
* The row itself stays the table's: selection and the keyboard work the same.
|
|
1085
|
+
*/
|
|
1086
|
+
renderRow?: (row: T, index: number) => ReactNode | null;
|
|
1087
|
+
/**
|
|
1088
|
+
* One selected row you move with the keyboard: ↑ ↓ Home End select the next row and focus it, Enter opens the
|
|
1089
|
+
* selected row, a click selects. The selected row is marked (aria-selected) and is the one Tab reaches.
|
|
1090
|
+
*/
|
|
1091
|
+
selection?: DataTableSelection<T>;
|
|
1092
|
+
/**
|
|
1093
|
+
* Rows under headers of their group (a grouped query's rows, which come in group order): a group's header row starts
|
|
1094
|
+
* it, and it folds. Rows of a folded group are skipped, by the eye and by the keyboard.
|
|
1095
|
+
*/
|
|
1096
|
+
grouping?: DataTableGrouping<T>;
|
|
1097
|
+
/**
|
|
1098
|
+
* Rows as a hierarchy (a list grouped by parent): each row under its parent, indented, folding at any depth; rows whose
|
|
1099
|
+
* parent isn't here are roots. `context` rows are parents the search left out, drawn dimmed so their children have
|
|
1100
|
+
* somewhere to sit. Takes the place of `grouping`.
|
|
1101
|
+
*/
|
|
1102
|
+
tree?: DataTableTree<T>;
|
|
1103
|
+
}
|
|
1104
|
+
interface DataTableTree<T> {
|
|
1105
|
+
keyOf: (row: T) => string;
|
|
1106
|
+
parentOf: (row: T) => string | null;
|
|
1107
|
+
context?: readonly T[];
|
|
1108
|
+
/** The fold button's name: "Fold PAY-98", "Unfold PAY-98". */
|
|
1109
|
+
foldLabel: (row: T, folded: boolean) => string;
|
|
1110
|
+
/** What a context row says it is, for screen readers ("Not in your search"). */
|
|
1111
|
+
contextLabel: string;
|
|
1112
|
+
}
|
|
1113
|
+
interface DataTableGrouping<T> {
|
|
1114
|
+
/** The row's group; rows of one group are next to each other. */
|
|
1115
|
+
of: (row: T) => string;
|
|
1116
|
+
/** What the group's header shows after its fold button: its name, its count. */
|
|
1117
|
+
header: (group: string, rows: T[]) => ReactNode;
|
|
1118
|
+
/** A row after the group's rows (a "Create record" row); null for none. Not drawn while the group is folded. */
|
|
1119
|
+
footer?: (group: string, rows: T[]) => ReactNode | null;
|
|
1120
|
+
folded: ReadonlySet<string>;
|
|
1121
|
+
onFold: (group: string) => void;
|
|
1122
|
+
/** The fold button's name: "Fold Draft", "Unfold Draft". */
|
|
1123
|
+
foldLabel: (group: string, folded: boolean) => string;
|
|
1124
|
+
/**
|
|
1125
|
+
* Groups within groups (grouped by two fields; UI round 9, step 63): each group's parent. A parent's header comes before
|
|
1126
|
+
* its first group and folds all of them; its key in `folded` and `onFold` is `parentFoldKey(parent)`.
|
|
1127
|
+
*/
|
|
1128
|
+
parents?: {
|
|
1129
|
+
of: (group: string) => string;
|
|
1130
|
+
header: (parent: string, groups: {
|
|
1131
|
+
key: string;
|
|
1132
|
+
rows: T[];
|
|
1133
|
+
}[]) => ReactNode;
|
|
1134
|
+
foldLabel: (parent: string, folded: boolean) => string;
|
|
1135
|
+
};
|
|
1136
|
+
/**
|
|
1137
|
+
* Rows that move to another group (a record to another status): each row's grip drags onto a group's header, or
|
|
1138
|
+
* opens a menu of the groups it may go to (the keyboard's way). What moving means is the host's.
|
|
1139
|
+
*/
|
|
1140
|
+
move?: DataTableGroupMove<T>;
|
|
1141
|
+
}
|
|
1142
|
+
interface DataTableGroupMove<T> {
|
|
1143
|
+
/** The grip's name: "Move FIN-130 to another status". */
|
|
1144
|
+
label: (row: T) => string;
|
|
1145
|
+
/** The menu's title ("Move to"). */
|
|
1146
|
+
menuTitle: string;
|
|
1147
|
+
/** The groups this row may go to, by key, with their names; the row's own isn't one. */
|
|
1148
|
+
targets: (row: T) => {
|
|
1149
|
+
group: string;
|
|
1150
|
+
label: string;
|
|
1151
|
+
}[];
|
|
1152
|
+
onMove: (row: T, group: string) => void;
|
|
1153
|
+
/**
|
|
1154
|
+
* Rows that also go to a position (a list in rank order; UI round 9, step 64): dropped on a row's upper or lower half,
|
|
1155
|
+
* a row lands before or after it, in that row's group; the grip's menu moves it up or down in its own. Without it, rows
|
|
1156
|
+
* only go to a group.
|
|
1157
|
+
*/
|
|
1158
|
+
place?: {
|
|
1159
|
+
onPlace: (row: T, group: string, at: {
|
|
1160
|
+
before?: T;
|
|
1161
|
+
after?: T;
|
|
1162
|
+
}) => void;
|
|
1163
|
+
/** The menu's "Move up", "Move down". */
|
|
1164
|
+
up: string;
|
|
1165
|
+
down: string;
|
|
1166
|
+
};
|
|
1167
|
+
}
|
|
1168
|
+
interface DataTableSelection<T> {
|
|
1169
|
+
/** The selected row's id; null selects none (Tab then reaches the first row). */
|
|
1170
|
+
selectedId: string | null;
|
|
1171
|
+
onSelect: (row: T) => void;
|
|
1172
|
+
/** Enter on the selected row. */
|
|
1173
|
+
onOpen?: (row: T) => void;
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* A simple table: typed columns, sortable headers (aria-sort), sticky header, loading,
|
|
1177
|
+
* error and empty states. Server-side paging and filtering come with QueryableList in M2.
|
|
1178
|
+
*/
|
|
1179
|
+
declare function DataTable<T>({ columns, rows, getRowId, loading: own, skeletonRows, error, empty, size, stickyHeader, maxHeight, interactive, sort: sortProp, defaultSort, onSortChange, sortMode, rowProps, renderSubRow, renderRow, selection, grouping, tree, 'aria-label': ariaLabel, }: DataTableProps<T>): react.JSX.Element;
|
|
1180
|
+
|
|
1181
|
+
/** A thing on the calendar: its first day and, for a span, its last (yyyy-mm-dd). */
|
|
1182
|
+
interface CalendarItem {
|
|
1183
|
+
id: string;
|
|
1184
|
+
start: string;
|
|
1185
|
+
end?: string | null;
|
|
1186
|
+
/** False: shown but not draggable (a date the person can't change). */
|
|
1187
|
+
movable?: boolean;
|
|
1188
|
+
}
|
|
1189
|
+
interface CalendarGridProps<T extends CalendarItem> {
|
|
1190
|
+
'aria-label': string;
|
|
1191
|
+
/** The days shown, in order, as yyyy-mm-dd: whole weeks (a month's grid, or one week). */
|
|
1192
|
+
days: string[];
|
|
1193
|
+
/** Days outside the period being looked at (a month's leading and trailing days) are dimmed. */
|
|
1194
|
+
inPeriod?: (day: string) => boolean;
|
|
1195
|
+
today?: string;
|
|
1196
|
+
/** Headings for the seven columns, starting with the grid's first weekday. */
|
|
1197
|
+
weekdays: string[];
|
|
1198
|
+
/** The day number or label shown in each cell. */
|
|
1199
|
+
dayLabel: (day: string) => ReactNode;
|
|
1200
|
+
/** Each day's full name, for screen readers ("Tuesday 12 May 2030"). */
|
|
1201
|
+
dayName: (day: string) => string;
|
|
1202
|
+
items: T[];
|
|
1203
|
+
renderItem: (item: T, state: {
|
|
1204
|
+
dragging: boolean;
|
|
1205
|
+
continued: boolean;
|
|
1206
|
+
}) => ReactNode;
|
|
1207
|
+
/** A move to another day: by dragging, or Alt+arrow keys on a focused item (a day, or a week with up and down). */
|
|
1208
|
+
onMove: (item: T, day: string) => void;
|
|
1209
|
+
/** At most this many items per cell before "+n more". */
|
|
1210
|
+
maxPerDay?: number;
|
|
1211
|
+
more?: (count: number) => ReactNode;
|
|
1212
|
+
/** "+n more" opens its day (UI round 9: the calendar's day period); without it, the count is only said. */
|
|
1213
|
+
onMore?: (day: string) => void;
|
|
1214
|
+
/** Week grids are taller: every item shows. */
|
|
1215
|
+
tall?: boolean;
|
|
1216
|
+
/** Its items are coming (ADR 0061): the grid as it is, a few days holding placeholders. The nearest `Loading` scope's when not given. */
|
|
1217
|
+
loading?: boolean;
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Records by date on a grid of weeks (ADR 0027). An item spanning days shows on each of them. Items move by dragging
|
|
1221
|
+
* to another day, or from the keyboard: Alt+Left/Right moves a day, Alt+Up/Down a week. Like the board, the grid only
|
|
1222
|
+
* reports the move.
|
|
1223
|
+
*/
|
|
1224
|
+
declare function CalendarGrid<T extends CalendarItem>({ 'aria-label': ariaLabel, days, inPeriod, today, weekdays, dayLabel, dayName, items, renderItem, onMove, maxPerDay, more, onMore, tall, loading: own, }: CalendarGridProps<T>): react.JSX.Element;
|
|
1225
|
+
|
|
1226
|
+
interface ChartSeries {
|
|
1227
|
+
key: string;
|
|
1228
|
+
label: string;
|
|
1229
|
+
/** A color token; series take the palette in order when left out. */
|
|
1230
|
+
color?: string;
|
|
1231
|
+
/** Drawn dashed (an ideal line, a target). */
|
|
1232
|
+
dashed?: boolean;
|
|
1233
|
+
}
|
|
1234
|
+
interface ChartProps {
|
|
1235
|
+
/** line, area or bar; stacked areas and bars add up (cumulative flow). */
|
|
1236
|
+
kind: 'line' | 'area' | 'bar';
|
|
1237
|
+
stacked?: boolean;
|
|
1238
|
+
/** One row per point on the x axis. */
|
|
1239
|
+
data: Record<string, string | number | null>[];
|
|
1240
|
+
/** The key of the x value in each row. */
|
|
1241
|
+
x: string;
|
|
1242
|
+
series: ChartSeries[];
|
|
1243
|
+
/** What the chart shows, for screen readers; a table of the same numbers is read with it. */
|
|
1244
|
+
'aria-label': string;
|
|
1245
|
+
height?: number | string;
|
|
1246
|
+
formatX?: (value: string) => string;
|
|
1247
|
+
formatValue?: (value: number) => string;
|
|
1248
|
+
/** Its numbers are coming (ADR 0061): a plot of placeholders, as tall as the chart. The nearest `Loading` scope's when not given. */
|
|
1249
|
+
loading?: boolean;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* A chart (ADR 0031) on `@chakra-ui/charts`: design tokens, dark mode, right to left (the axes mirror), a tooltip and a
|
|
1253
|
+
* legend. The same numbers are in a table screen readers read, so nothing is only in the picture.
|
|
1254
|
+
*/
|
|
1255
|
+
declare function Chart({ kind, stacked, data, x, series, 'aria-label': ariaLabel, height, formatX, formatValue, loading: own }: ChartProps): react.JSX.Element;
|
|
1256
|
+
|
|
1257
|
+
/** A widget's place on the grid, in cells: column, row, width and height. */
|
|
1258
|
+
interface GridItem {
|
|
1259
|
+
id: string;
|
|
1260
|
+
x: number;
|
|
1261
|
+
y: number;
|
|
1262
|
+
w: number;
|
|
1263
|
+
h: number;
|
|
1264
|
+
}
|
|
1265
|
+
interface DashboardGridProps<T extends GridItem> {
|
|
1266
|
+
items: T[];
|
|
1267
|
+
/** Columns of the grid (12). Below the md breakpoint every item takes the full width, in reading order. */
|
|
1268
|
+
columns?: number;
|
|
1269
|
+
/** Height of one row, in pixels. */
|
|
1270
|
+
rowHeight?: number;
|
|
1271
|
+
/** Whether items can be moved and resized (with the pointer, or the arrow keys on their handles). */
|
|
1272
|
+
editing?: boolean;
|
|
1273
|
+
/** The layout after a move or a resize, compacted upwards. */
|
|
1274
|
+
onLayoutChange?: (items: GridItem[]) => void;
|
|
1275
|
+
renderItem: (item: T) => ReactNode;
|
|
1276
|
+
labels: {
|
|
1277
|
+
/** Name of an item's move handle, e.g. "Move Open bugs, column 1, row 3". */
|
|
1278
|
+
move: (item: T) => string;
|
|
1279
|
+
/** Name of an item's resize handle. */
|
|
1280
|
+
resize: (item: T) => string;
|
|
1281
|
+
/** How to use the handles from the keyboard. */
|
|
1282
|
+
instructions: string;
|
|
1283
|
+
};
|
|
1284
|
+
'aria-label': string;
|
|
1285
|
+
/**
|
|
1286
|
+
* Its layout is coming (ADR 0061): a few placeholder tiles where widgets will be. Once the layout is known, each widget
|
|
1287
|
+
* draws its own content loading. The nearest `Loading` scope's when not given.
|
|
1288
|
+
*/
|
|
1289
|
+
loading?: boolean;
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Packs a layout upwards: in reading order, each item drops below anything it overlaps, then floats up as far as the
|
|
1293
|
+
* items above it allow. Nothing overlaps afterwards. An item being moved goes before the items on its row when it
|
|
1294
|
+
* moves up and after them when it moves down, so it trades places with the item it lands on.
|
|
1295
|
+
*/
|
|
1296
|
+
declare function compactLayout<T extends GridItem>(items: T[], moved?: string, direction?: -1 | 0 | 1): T[];
|
|
1297
|
+
/** Where a new item of a size goes: the first free place, top to bottom, start to end. */
|
|
1298
|
+
declare function placeItem(items: GridItem[], w: number, h: number, columns?: number): {
|
|
1299
|
+
x: number;
|
|
1300
|
+
y: number;
|
|
1301
|
+
};
|
|
1302
|
+
/**
|
|
1303
|
+
* A free grid of widgets (ADR 0031): 12 columns, rows of a fixed height. While editing, each item has a move handle
|
|
1304
|
+
* and a resize handle that work with the pointer and with the arrow keys; the layout compacts upwards, and right to
|
|
1305
|
+
* left mirrors the columns.
|
|
1306
|
+
*/
|
|
1307
|
+
declare function DashboardGrid<T extends GridItem>({ items, columns, rowHeight, editing, onLayoutChange, renderItem, labels, 'aria-label': ariaLabel, loading: own, }: DashboardGridProps<T>): react.JSX.Element;
|
|
1308
|
+
|
|
1309
|
+
interface CategoryProgressProps {
|
|
1310
|
+
todo: number;
|
|
1311
|
+
inProgress: number;
|
|
1312
|
+
done: number;
|
|
1313
|
+
/** What the bar says to screen readers ("3 of 8 done, 2 in progress"); the bar itself is a picture. */
|
|
1314
|
+
'aria-label': string;
|
|
1315
|
+
size?: 'sm' | 'md';
|
|
1316
|
+
/** Its counts are coming (ADR 0061): the track shines. The nearest `Loading` scope's when not given. */
|
|
1317
|
+
loading?: boolean;
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* Work by status category as one bar (releases, sprints): done, then in progress, then to do, each as wide as its
|
|
1321
|
+
* share. Empty work draws an empty track.
|
|
1322
|
+
*/
|
|
1323
|
+
declare function CategoryProgress({ todo, inProgress, done, size, loading: own, 'aria-label': ariaLabel }: CategoryProgressProps): react.JSX.Element;
|
|
1324
|
+
|
|
1325
|
+
/**
|
|
1326
|
+
* Wraps an icon that points in reading direction (arrows, chevrons, panel toggles) so it
|
|
1327
|
+
* mirrors in right-to-left layouts. Icons with no direction (search, user) need no wrapper.
|
|
1328
|
+
*/
|
|
1329
|
+
declare const DirectionalIcon: _chakra_ui_react.ChakraComponent<"span", {}>;
|
|
1330
|
+
|
|
1331
|
+
interface EmptyStateProps {
|
|
1332
|
+
title: ReactNode;
|
|
1333
|
+
description?: ReactNode;
|
|
1334
|
+
icon?: ReactNode;
|
|
1335
|
+
/** A button or link that resolves the empty state. */
|
|
1336
|
+
action?: ReactNode;
|
|
1337
|
+
/** A second, quieter way on, beside the action ("Clear filters" beside "Create record"). */
|
|
1338
|
+
secondaryAction?: ReactNode;
|
|
1339
|
+
/**
|
|
1340
|
+
* Why it's empty (UI round 9, step 53; the design canvas's kinds): `first-use` (nothing yet: invites a first step, in
|
|
1341
|
+
* the accent), `no-results` (a search found nothing), `no-filter-match` (the filters leave nothing), `completed` (all
|
|
1342
|
+
* done), `prerequisite` (something else comes first), `error` (it couldn't load: the drawing in the danger tint).
|
|
1343
|
+
* It sets the drawing's tone unless `tone` is given.
|
|
1344
|
+
*/
|
|
1345
|
+
kind?: 'first-use' | 'no-results' | 'no-filter-match' | 'completed' | 'prerequisite' | 'error';
|
|
1346
|
+
/**
|
|
1347
|
+
* How much room it takes: `xs` is one quiet line with a small icon (a board column, a short list); `sm` a block for a
|
|
1348
|
+
* panel or a table (the default); `md` a page's main area, with more air around it.
|
|
1349
|
+
*/
|
|
1350
|
+
size?: 'xs' | 'sm' | 'md';
|
|
1351
|
+
/** Its drawing's colour: `neutral` (the default, calm), `accent` (a place that invites a first step) or `danger`. */
|
|
1352
|
+
tone?: 'neutral' | 'accent' | 'danger';
|
|
1353
|
+
}
|
|
1354
|
+
/** What a list, table or page shows when there is nothing in it: a calm drawing, what's missing, what to do, and a way on. */
|
|
1355
|
+
declare function EmptyState({ title, description, icon, action, secondaryAction, kind, size, tone: own }: EmptyStateProps): react.JSX.Element;
|
|
1356
|
+
|
|
1357
|
+
interface AttentionChipProps {
|
|
1358
|
+
count: number;
|
|
1359
|
+
children: ReactNode;
|
|
1360
|
+
tone?: 'danger' | 'warning' | 'neutral';
|
|
1361
|
+
/** It filters the list it sits over: pressed while that filter is on. */
|
|
1362
|
+
pressed?: boolean;
|
|
1363
|
+
onClick?: () => void;
|
|
1364
|
+
disabled?: boolean;
|
|
1365
|
+
/** Its count is coming (ADR 0061): the count's ghost, the chip not yet pressable. The nearest `Loading` scope's when not given. */
|
|
1366
|
+
loading?: boolean;
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Something that needs attention, with how many: "1 Overdue", "2 Due in 7 days". A button that filters to them when it
|
|
1370
|
+
* has a click; a quiet count when there are none.
|
|
1371
|
+
*/
|
|
1372
|
+
declare function AttentionChip({ count, children, tone, pressed, onClick, disabled, loading: own }: AttentionChipProps): react.JSX.Element;
|
|
1373
|
+
|
|
1374
|
+
interface CountBadgeProps extends Omit<HTMLChakraProps<'span'>, 'children'> {
|
|
1375
|
+
value: number;
|
|
1376
|
+
tone?: 'neutral' | 'accent' | 'danger' | 'warning';
|
|
1377
|
+
size?: 'sm' | 'md';
|
|
1378
|
+
/** Its count is coming (ADR 0061): drawn as its ghost. The nearest `Loading` scope's when not given. */
|
|
1379
|
+
loading?: boolean;
|
|
1380
|
+
}
|
|
1381
|
+
/** A count in a small round badge, in the reader's digits: beside a title ("Records 130"), a group, a tab. */
|
|
1382
|
+
declare function CountBadge({ value, tone, size, loading: own, ...rest }: CountBadgeProps): react.JSX.Element;
|
|
1383
|
+
|
|
1384
|
+
interface IconTileProps {
|
|
1385
|
+
children: ReactNode;
|
|
1386
|
+
size?: 'sm' | 'md' | 'lg';
|
|
1387
|
+
/** Raised: the picked tile of a choice, on the accent. */
|
|
1388
|
+
active?: boolean;
|
|
1389
|
+
/** A colour palette for the tile (a record type's own); the soft neutral when not given. */
|
|
1390
|
+
palette?: string;
|
|
1391
|
+
}
|
|
1392
|
+
/** An icon on a soft rounded square: a record's type in a list, a view's layout, a choice of layouts. */
|
|
1393
|
+
declare function IconTile({ children, size, active, palette }: IconTileProps): react.JSX.Element;
|
|
1394
|
+
|
|
1395
|
+
interface PersonChipProps {
|
|
1396
|
+
/** The person's id: their colour, the same everywhere. */
|
|
1397
|
+
id: string;
|
|
1398
|
+
name: string;
|
|
1399
|
+
/**
|
|
1400
|
+
* The person's picture (ADR 0096): a path on the site, such as an agent's. Their initials show while it loads, when
|
|
1401
|
+
* it fails, and when there's none.
|
|
1402
|
+
*/
|
|
1403
|
+
picture?: string | null;
|
|
1404
|
+
/** The initials only, the name in a title and read out (a board card's corner). */
|
|
1405
|
+
compact?: boolean;
|
|
1406
|
+
size?: 'xs' | 'sm' | 'md';
|
|
1407
|
+
/** The person is coming (ADR 0061): a circle and a line of text's ghosts. The nearest `Loading` scope's when not given. */
|
|
1408
|
+
loading?: boolean;
|
|
1409
|
+
}
|
|
1410
|
+
/** A person as their initials in their own colour, and their name beside them unless compact. */
|
|
1411
|
+
declare function PersonChip({ id, name, picture, compact, size, loading: own }: PersonChipProps): react.JSX.Element;
|
|
1412
|
+
|
|
1413
|
+
interface PriorityMarkProps {
|
|
1414
|
+
/**
|
|
1415
|
+
* Where the priority sits among its list, from the top: 0 is the highest. With `of`, the list's length, the mark
|
|
1416
|
+
* fills as many of its four bars as the priority is high.
|
|
1417
|
+
*/
|
|
1418
|
+
rank: number;
|
|
1419
|
+
of: number;
|
|
1420
|
+
/** The priority's name, shown after the bars; without it the bars carry a title only. */
|
|
1421
|
+
children?: ReactNode;
|
|
1422
|
+
/** The name read out and shown on hover when there's no visible label. */
|
|
1423
|
+
title?: string;
|
|
1424
|
+
/** The priority is coming (ADR 0061): its name's ghost. The nearest `Loading` scope's when not given. */
|
|
1425
|
+
loading?: boolean;
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* A priority as signal bars (higher, more bars, warmer colour) and its name. The name always shows or is read out, so the
|
|
1429
|
+
* priority is never told by colour or height alone.
|
|
1430
|
+
*/
|
|
1431
|
+
declare function PriorityMark({ rank, of, children, title, loading }: PriorityMarkProps): react.JSX.Element;
|
|
1432
|
+
|
|
1433
|
+
/**
|
|
1434
|
+
* How many of the four bars a priority fills, and its colour, from where it sits in its list (`rank` 0 is the highest
|
|
1435
|
+
* of `of`): the top of the list reads urgent (red), its middle as a warning (orange), its bottom calm (blue).
|
|
1436
|
+
*/
|
|
1437
|
+
declare function priorityLevel(rank: number, of: number): {
|
|
1438
|
+
bars: number;
|
|
1439
|
+
palette: 'red' | 'orange' | 'blue' | 'gray';
|
|
1440
|
+
};
|
|
1441
|
+
|
|
1442
|
+
/**
|
|
1443
|
+
* A grouped query's rows (ADR 0013): a row's group as a key, a date period's name, and rows cut into their groups.
|
|
1444
|
+
*/
|
|
1445
|
+
/**
|
|
1446
|
+
* A row's group, as a key: a reference's key or id (a status, a person), a value's text, or "" for none. The groups a
|
|
1447
|
+
* grouped query returns key the same way, so a row finds its group's count and name.
|
|
1448
|
+
*/
|
|
1449
|
+
declare function groupKey(value: unknown): string;
|
|
1450
|
+
|
|
1451
|
+
/**
|
|
1452
|
+
* Settings in sections (ADR 0095, moved into the design system by ADR 0109): an area's sections and pages each have a
|
|
1453
|
+
* key and a weight. The higher the weight, the nearer the top; equal ones by title. A host's own come in steps of 100,
|
|
1454
|
+
* so a package's or a plugin's section or page fits between any two of them.
|
|
1455
|
+
*/
|
|
1456
|
+
interface SettingsSectionLike {
|
|
1457
|
+
key: string;
|
|
1458
|
+
weight: number;
|
|
1459
|
+
title: string;
|
|
1460
|
+
}
|
|
1461
|
+
interface SettingsPageLike {
|
|
1462
|
+
section: string;
|
|
1463
|
+
weight: number;
|
|
1464
|
+
title: string;
|
|
1465
|
+
}
|
|
1466
|
+
/** Heavier first, then by title. */
|
|
1467
|
+
declare const heavierFirst: (a: {
|
|
1468
|
+
weight: number;
|
|
1469
|
+
title: string;
|
|
1470
|
+
}, b: {
|
|
1471
|
+
weight: number;
|
|
1472
|
+
title: string;
|
|
1473
|
+
}) => number;
|
|
1474
|
+
/** The sections that have pages, heaviest first, each with its pages heaviest first; a page whose section isn't there is left out. */
|
|
1475
|
+
declare function inSections<S extends SettingsSectionLike, P extends SettingsPageLike>(sections: S[], pages: P[]): {
|
|
1476
|
+
section: S;
|
|
1477
|
+
pages: P[];
|
|
1478
|
+
}[];
|
|
1479
|
+
/** A page that may say who sees it (a flag, or a check the host's rights answer). */
|
|
1480
|
+
interface MaybeVisible {
|
|
1481
|
+
visible?: boolean | (() => boolean);
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* An area's sections with the pages this person may see, heaviest first then by title: the host's static sections and
|
|
1485
|
+
* pages together with the ones it loads (ADR 0095's order, unchanged). A section a package or plugin adds under a key
|
|
1486
|
+
* the host already has is taken once, the host's first.
|
|
1487
|
+
*/
|
|
1488
|
+
declare function settingsArea<S extends SettingsSectionLike, P extends SettingsPageLike & MaybeVisible>(sections: S[], pages: P[]): {
|
|
1489
|
+
section: S;
|
|
1490
|
+
pages: P[];
|
|
1491
|
+
}[];
|
|
1492
|
+
/** The page an address opens, for a host's catch-all route: the one whose `href` is the address or above it, the longest. */
|
|
1493
|
+
declare function findSettingsPage<P extends {
|
|
1494
|
+
href: string;
|
|
1495
|
+
}>(pages: P[], pathname: string): P | undefined;
|
|
1496
|
+
|
|
1497
|
+
/** A slot's own save, run when the dialog or form holding it saves. */
|
|
1498
|
+
type SlotSave = () => Promise<void> | void;
|
|
1499
|
+
/** What a slot inside a dialog receives to join its Save: it registers its save, and gets a way to take it back. */
|
|
1500
|
+
type RegisterSlotSave = (save: SlotSave) => () => void;
|
|
1501
|
+
/**
|
|
1502
|
+
* One Save for a dialog with slots in it (ADR 0109 amendment): the host's fields inside an area's dialog (a slot) add
|
|
1503
|
+
* their own save through `register`, which the slot gets in its context; when the person saves, the area saves its own
|
|
1504
|
+
* part first, then `run()` runs every slot's save in order. A slot that throws stops the rest, and the dialog shows
|
|
1505
|
+
* the error as it shows its own.
|
|
1506
|
+
*/
|
|
1507
|
+
declare function useSlotSaves(): {
|
|
1508
|
+
register: RegisterSlotSave;
|
|
1509
|
+
run: () => Promise<void>;
|
|
1510
|
+
};
|
|
1511
|
+
|
|
1512
|
+
/**
|
|
1513
|
+
* A text with its values filled, in the subset of ICU message syntax the screens' texts use: `{name}`, plurals
|
|
1514
|
+
* (`{count, plural, =0 {none} one {# item} other {# items}}`, with Arabic's zero, two, few and many) and choices
|
|
1515
|
+
* (`{kind, select, a {…} other {…}}`), nested. No React and no i18n library; a value that's missing stays as `{name}`.
|
|
1516
|
+
*/
|
|
1517
|
+
declare function formatMessage(locale: string, pattern: string, values?: Record<string, string | number>): string;
|
|
1518
|
+
|
|
1519
|
+
/** An area's texts in one language: flat keys (`models.title`) to texts in the subset of ICU `formatMessage` reads. */
|
|
1520
|
+
type AreaTexts = Record<string, string>;
|
|
1521
|
+
/**
|
|
1522
|
+
* An area's words (ADR 0109 amendment): its own English and Arabic (and any other language), which a host overrides
|
|
1523
|
+
* key by key through `AbpHost.texts[area]`. The language is the provider's; a key missing in it falls back to its base
|
|
1524
|
+
* language (ar for ar-SA), then English, then the key itself. `{product}` is the host's product name unless `values`
|
|
1525
|
+
* gives one.
|
|
1526
|
+
*/
|
|
1527
|
+
declare function createAreaTexts(area: string, bundled: {
|
|
1528
|
+
en: AreaTexts;
|
|
1529
|
+
} & Record<string, AreaTexts>): () => (key: string, values?: Record<string, string | number>) => string;
|
|
1530
|
+
|
|
1531
|
+
interface FormDialogProps {
|
|
1532
|
+
open: boolean;
|
|
1533
|
+
onOpenChange: (open: boolean) => void;
|
|
1534
|
+
title: ReactNode;
|
|
1535
|
+
description?: ReactNode;
|
|
1536
|
+
submitLabel: ReactNode;
|
|
1537
|
+
onSubmit: () => void | Promise<void>;
|
|
1538
|
+
busy?: boolean;
|
|
1539
|
+
error?: string | null;
|
|
1540
|
+
size?: 'sm' | 'md' | 'lg' | 'xl';
|
|
1541
|
+
/** No submit button (the form inside has its own, e.g. a plugin's create view). */
|
|
1542
|
+
hideSubmit?: boolean;
|
|
1543
|
+
/** The submit button is off until what the form needs is filled in. */
|
|
1544
|
+
submitDisabled?: boolean;
|
|
1545
|
+
children: ReactNode;
|
|
1546
|
+
}
|
|
1547
|
+
/**
|
|
1548
|
+
* A dialog holding a form: title, fields, the server's error message, and Cancel / submit. A field left wrong (required
|
|
1549
|
+
* and empty, or not in its shape) is marked when the person leaves it, not while they type; submitting with any wrong
|
|
1550
|
+
* lists them at the top, each a link to its field, and sends nothing.
|
|
1551
|
+
*/
|
|
1552
|
+
declare function FormDialog({ open, onOpenChange, title, description, submitLabel, onSubmit, busy, error, size, hideSubmit, submitDisabled, children }: FormDialogProps): react.JSX.Element;
|
|
1553
|
+
|
|
1554
|
+
/** A section of a settings area (Administration, a project's settings): the host's own, or one a package or plugin adds. */
|
|
1555
|
+
interface SettingsSection {
|
|
1556
|
+
key: string;
|
|
1557
|
+
title: string;
|
|
1558
|
+
weight: number;
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
* A page of a settings area (ADR 0109, decision 4): the host's own, a package's (`@abpjs/guard`'s, `@abpjs/ai`'s) or a
|
|
1562
|
+
* plugin's, given statically or loaded at run time (a plugin's from its manifest, through the server).
|
|
1563
|
+
*/
|
|
1564
|
+
interface SettingsPage {
|
|
1565
|
+
id: string;
|
|
1566
|
+
section: string;
|
|
1567
|
+
weight: number;
|
|
1568
|
+
title: string;
|
|
1569
|
+
/** Where it opens. A host's own page has its route; a package's page is drawn by the host's catch-all route. */
|
|
1570
|
+
href: string;
|
|
1571
|
+
icon?: ReactNode;
|
|
1572
|
+
/** Its line on the area's overview. */
|
|
1573
|
+
about?: string;
|
|
1574
|
+
/** The plugin or package that adds it. */
|
|
1575
|
+
plugin?: string;
|
|
1576
|
+
/**
|
|
1577
|
+
* Whether this person sees it: the host evaluates its rights (an admin right, a role in the project). Shown when not
|
|
1578
|
+
* given. The server checks every page anyway; this only keeps the menu to pages the person can open.
|
|
1579
|
+
*/
|
|
1580
|
+
visible?: boolean | (() => boolean);
|
|
1581
|
+
/** The page itself, for a package's page that has no route file in the host: its catch-all route draws it. */
|
|
1582
|
+
component?: ComponentType<{
|
|
1583
|
+
path: string[];
|
|
1584
|
+
}>;
|
|
1585
|
+
}
|
|
1586
|
+
interface SettingsArea<P extends SettingsPage = SettingsPage> {
|
|
1587
|
+
section: SettingsSection;
|
|
1588
|
+
pages: P[];
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
interface SettingsLayoutProps extends Omit<AppShellProps, 'sidebar' | 'navFooter' | 'topNav'> {
|
|
1592
|
+
/** The area's sections and the pages this person may see, as `settingsArea` gives them. */
|
|
1593
|
+
area: SettingsArea[];
|
|
1594
|
+
/** The address now, to mark the page that's open. */
|
|
1595
|
+
pathname: string;
|
|
1596
|
+
/** The sidebar's id (its collapsed state is kept by it); `settings` when not given. */
|
|
1597
|
+
sidebarId?: string;
|
|
1598
|
+
labels: {
|
|
1599
|
+
/** The find box's placeholder and name: "Find a setting". */
|
|
1600
|
+
find: string;
|
|
1601
|
+
/** When nothing matches what's typed: "No setting by that name". */
|
|
1602
|
+
noSetting: string;
|
|
1603
|
+
};
|
|
1604
|
+
/** The top bar's links; none when not given (a settings area stands apart from the work). */
|
|
1605
|
+
topNav?: AppShellProps['topNav'];
|
|
1606
|
+
children: ReactNode;
|
|
1607
|
+
}
|
|
1608
|
+
/**
|
|
1609
|
+
* A settings area's frame (ADR 0109, decision 4): the app shell with the area's sections as its menu, a box to find a
|
|
1610
|
+
* setting by its name or its section's, and a line when nothing matches. The host gives the brand, the way back, the
|
|
1611
|
+
* top bar's end and the words; it draws its own pages, and a package's through its catch-all route.
|
|
1612
|
+
*/
|
|
1613
|
+
declare function SettingsLayout({ area, pathname, sidebarId, labels, topNav, children, ...shell }: SettingsLayoutProps): react.JSX.Element;
|
|
1614
|
+
|
|
1615
|
+
interface SegmentedItem<V extends string = string> {
|
|
1616
|
+
value: V;
|
|
1617
|
+
label: ReactNode;
|
|
1618
|
+
/** An icon before the label (a lucide icon element). */
|
|
1619
|
+
icon?: ReactNode;
|
|
1620
|
+
/** A count after the label ("All views 7"). */
|
|
1621
|
+
count?: number | null;
|
|
1622
|
+
disabled?: boolean;
|
|
1623
|
+
/** A tooltip, or the item's name when its label is only an icon. */
|
|
1624
|
+
title?: string;
|
|
1625
|
+
}
|
|
1626
|
+
interface SegmentedControlProps<V extends string = string> {
|
|
1627
|
+
'aria-label': string;
|
|
1628
|
+
items: SegmentedItem<V>[];
|
|
1629
|
+
value: V;
|
|
1630
|
+
onValueChange: (value: V) => void;
|
|
1631
|
+
size?: 'sm' | 'md';
|
|
1632
|
+
/** Fills its row, the items sharing the width. */
|
|
1633
|
+
fitted?: boolean;
|
|
1634
|
+
/** Its value is coming (ADR 0061): drawn without a picked item. The nearest `Loading` scope's when not given. */
|
|
1635
|
+
loading?: boolean;
|
|
1636
|
+
}
|
|
1637
|
+
/**
|
|
1638
|
+
* One choice of a few, side by side, the picked one raised on a mark that slides to it: a list's layouts (List, Board,
|
|
1639
|
+
* Timeline), Basic or RQL, Day / Week / Month, All views or Mine. Arrow keys move between them (a radio group).
|
|
1640
|
+
*/
|
|
1641
|
+
declare function SegmentedControl<V extends string = string>({ 'aria-label': ariaLabel, items, value, onValueChange, size, fitted, loading: own, }: SegmentedControlProps<V>): react.JSX.Element;
|
|
1642
|
+
|
|
1643
|
+
interface FieldProps extends Omit<Field$1.RootProps, 'label'> {
|
|
1644
|
+
label?: ReactNode;
|
|
1645
|
+
helperText?: ReactNode;
|
|
1646
|
+
/** Shown (and the field marked invalid) when set. */
|
|
1647
|
+
errorText?: ReactNode;
|
|
1648
|
+
/** Shown after the label when the field is not required, e.g. "(optional)". */
|
|
1649
|
+
optionalText?: ReactNode;
|
|
1650
|
+
/** Its value is coming (ADR 0061): the control is drawn as its own ghost. The nearest `Loading` scope's when not given. */
|
|
1651
|
+
loading?: boolean;
|
|
1652
|
+
}
|
|
1653
|
+
/**
|
|
1654
|
+
* Label, control, help and error in one block. `required`, `invalid`, `disabled` and
|
|
1655
|
+
* `readOnly` flow into the Chakra input inside through field context.
|
|
1656
|
+
*/
|
|
1657
|
+
declare const Field: react.ForwardRefExoticComponent<FieldProps & react.RefAttributes<HTMLDivElement>>;
|
|
1658
|
+
/** Alias kept for readability in forms. */
|
|
1659
|
+
declare const FormField: react.ForwardRefExoticComponent<FieldProps & react.RefAttributes<HTMLDivElement>>;
|
|
1660
|
+
interface SelectOption {
|
|
1661
|
+
value: string;
|
|
1662
|
+
label: string;
|
|
1663
|
+
disabled?: boolean;
|
|
1664
|
+
}
|
|
1665
|
+
interface SelectFieldProps extends Omit<NativeSelect.FieldProps, 'children' | 'size'> {
|
|
1666
|
+
options: SelectOption[];
|
|
1667
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
1668
|
+
/** Width of the control (token or "auto"); defaults to full width. */
|
|
1669
|
+
width?: NativeSelect.RootProps['width'];
|
|
1670
|
+
disabled?: boolean;
|
|
1671
|
+
/** Its value is coming (ADR 0061): drawn as its own ghost. The nearest `Loading` scope's when not given. */
|
|
1672
|
+
loading?: boolean;
|
|
1673
|
+
}
|
|
1674
|
+
/** A native <select>: fast, accessible and correct on every platform. */
|
|
1675
|
+
declare const SelectField: react.ForwardRefExoticComponent<SelectFieldProps & react.RefAttributes<HTMLSelectElement>>;
|
|
1676
|
+
interface CheckboxFieldProps extends Omit<Checkbox.RootProps, 'onCheckedChange' | 'checked' | 'label'> {
|
|
1677
|
+
label: ReactNode;
|
|
1678
|
+
checked: boolean;
|
|
1679
|
+
onCheckedChange: (checked: boolean) => void;
|
|
1680
|
+
/** Whether it's checked is coming (ADR 0061): the box is drawn as its own ghost. The nearest `Loading` scope's when not given. */
|
|
1681
|
+
loading?: boolean;
|
|
1682
|
+
}
|
|
1683
|
+
declare function CheckboxField({ label, checked, onCheckedChange, loading: own, ...rest }: CheckboxFieldProps): react.JSX.Element;
|
|
1684
|
+
interface SwitchFieldProps extends Omit<Switch.RootProps, 'onCheckedChange' | 'checked' | 'label'> {
|
|
1685
|
+
label: ReactNode;
|
|
1686
|
+
checked: boolean;
|
|
1687
|
+
onCheckedChange: (checked: boolean) => void;
|
|
1688
|
+
/** Whether it's on is coming (ADR 0061): the switch is drawn as its own ghost. The nearest `Loading` scope's when not given. */
|
|
1689
|
+
loading?: boolean;
|
|
1690
|
+
}
|
|
1691
|
+
declare function SwitchField({ label, checked, onCheckedChange, loading: own, ...rest }: SwitchFieldProps): react.JSX.Element;
|
|
1692
|
+
|
|
1693
|
+
/** Semantic status tones. Separate from the accent: success is never "brand". */
|
|
1694
|
+
type StatusTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'info';
|
|
1695
|
+
/** Work-item status categories. */
|
|
1696
|
+
type StatusCategory = 'todo' | 'inProgress' | 'done';
|
|
1697
|
+
interface StatusPillProps extends Omit<HTMLChakraProps<'span'>, 'children'> {
|
|
1698
|
+
tone?: StatusTone;
|
|
1699
|
+
/** Use a status category instead of a tone (to do / in progress / done). */
|
|
1700
|
+
category?: StatusCategory;
|
|
1701
|
+
variant?: 'subtle' | 'outline';
|
|
1702
|
+
size?: 'sm' | 'md';
|
|
1703
|
+
/** Show the coloured dot (default true): status is never told by colour alone, the label carries it. */
|
|
1704
|
+
dot?: boolean;
|
|
1705
|
+
/** Its label is coming (ADR 0061): drawn as its own ghost. The nearest `Loading` scope's when not given. */
|
|
1706
|
+
loading?: boolean;
|
|
1707
|
+
/** How many characters wide its placeholder is, when its label isn't known yet (8). */
|
|
1708
|
+
skeletonWidth?: number;
|
|
1709
|
+
children?: ReactNode;
|
|
1710
|
+
}
|
|
1711
|
+
declare const StatusPill: react.ForwardRefExoticComponent<StatusPillProps & react.RefAttributes<HTMLSpanElement>>;
|
|
1712
|
+
|
|
1713
|
+
interface InlineAlertProps extends Omit<Alert.RootProps, 'status' | 'title'> {
|
|
1714
|
+
tone?: Exclude<StatusTone, 'accent'>;
|
|
1715
|
+
title?: ReactNode;
|
|
1716
|
+
children?: ReactNode;
|
|
1717
|
+
}
|
|
1718
|
+
/**
|
|
1719
|
+
* A message inside the page flow (errors from a request, results of an action). Renders
|
|
1720
|
+
* nothing when there is neither a title nor content, so `<InlineAlert>{error}</InlineAlert>`
|
|
1721
|
+
* can stay in place.
|
|
1722
|
+
*/
|
|
1723
|
+
declare function InlineAlert({ tone, title, children, size, ...rest }: InlineAlertProps): react.JSX.Element | null;
|
|
1724
|
+
|
|
1725
|
+
interface KanbanColumn {
|
|
1726
|
+
id: string;
|
|
1727
|
+
title: ReactNode;
|
|
1728
|
+
/** How many cards it holds, in a badge beside its title (and on its folded lane). */
|
|
1729
|
+
count?: number;
|
|
1730
|
+
/** Its name as text, for the fold button's name and the folded lane's title; the title when that is text. */
|
|
1731
|
+
name?: string;
|
|
1732
|
+
/** Shown under the title: a count, a WIP limit. */
|
|
1733
|
+
meta?: ReactNode;
|
|
1734
|
+
/** A column over its limit is marked. */
|
|
1735
|
+
over?: boolean;
|
|
1736
|
+
}
|
|
1737
|
+
interface KanbanLane {
|
|
1738
|
+
id: string;
|
|
1739
|
+
title: ReactNode;
|
|
1740
|
+
meta?: ReactNode;
|
|
1741
|
+
}
|
|
1742
|
+
interface KanbanItem {
|
|
1743
|
+
id: string;
|
|
1744
|
+
column: string;
|
|
1745
|
+
/** The lane the card sits in; "" when the board has no lanes. */
|
|
1746
|
+
lane: string;
|
|
1747
|
+
}
|
|
1748
|
+
interface KanbanMove {
|
|
1749
|
+
column: string;
|
|
1750
|
+
lane: string;
|
|
1751
|
+
/** The card it lands before, or after (in the target cell). */
|
|
1752
|
+
before?: string;
|
|
1753
|
+
after?: string;
|
|
1754
|
+
}
|
|
1755
|
+
interface KanbanBoardProps<T extends KanbanItem> {
|
|
1756
|
+
'aria-label': string;
|
|
1757
|
+
columns: KanbanColumn[];
|
|
1758
|
+
/** Swimlanes; without them the board is one row. */
|
|
1759
|
+
lanes?: KanbanLane[];
|
|
1760
|
+
/**
|
|
1761
|
+
* Cards in order (rank). Keep the same array until the host's data changes: a new array is its answer to the
|
|
1762
|
+
* person's move, which the board shows until then.
|
|
1763
|
+
*/
|
|
1764
|
+
items: T[];
|
|
1765
|
+
renderCard: (item: T, state: {
|
|
1766
|
+
dragging: boolean;
|
|
1767
|
+
}) => ReactNode;
|
|
1768
|
+
/** Whether the dragged card may land in a cell: false dims it; undefined means not known yet (allowed). */
|
|
1769
|
+
canDrop?: (item: T, column: string, lane: string) => boolean | undefined;
|
|
1770
|
+
onDragStart?: (item: T) => void;
|
|
1771
|
+
/** The drag ended, dropped or cancelled (the host may refresh the board again). */
|
|
1772
|
+
onDragEnd?: () => void;
|
|
1773
|
+
onMove: (item: T, to: KanbanMove) => void;
|
|
1774
|
+
/**
|
|
1775
|
+
* The selected cards (several moved at once, ADR 0058 amended). The host keeps them; with `onSelect` the board
|
|
1776
|
+
* selects: a click takes one card, Ctrl or Cmd+click adds or takes one away, Shift+click the cards between in a cell,
|
|
1777
|
+
* Esc or a click on the board's empty space clears.
|
|
1778
|
+
*/
|
|
1779
|
+
selected?: ReadonlySet<string>;
|
|
1780
|
+
onSelect?: (ids: ReadonlySet<string>) => void;
|
|
1781
|
+
/** Selected cards dropped together, in the board's order, the dragged one among them; without it only that one moves. */
|
|
1782
|
+
onMoveMany?: (items: T[], to: KanbanMove) => void;
|
|
1783
|
+
/** What the preview under the pointer says when it carries several ("3 cards"). */
|
|
1784
|
+
carrying?: (count: number) => string;
|
|
1785
|
+
/** Screen reader texts while dragging (translated by the host). */
|
|
1786
|
+
announcements?: Announcements;
|
|
1787
|
+
screenReaderInstructions?: string;
|
|
1788
|
+
/** Shown in an empty cell: one text, or the column's own (its title, and a line on why it's empty). */
|
|
1789
|
+
empty?: ReactNode | ((column: string) => {
|
|
1790
|
+
title: ReactNode;
|
|
1791
|
+
description?: ReactNode;
|
|
1792
|
+
});
|
|
1793
|
+
/**
|
|
1794
|
+
* Its cards are coming (ADR 0061): each column holds a few placeholder cards, and with no columns yet the board draws
|
|
1795
|
+
* `skeletonColumns` (4). A placeholder card is `skeletonCard` when given (the host's card drawn loading), else a card
|
|
1796
|
+
* with a key, a title and a pill coming. The nearest `Loading` scope's when not given.
|
|
1797
|
+
*/
|
|
1798
|
+
loading?: boolean;
|
|
1799
|
+
skeletonCard?: (index: number) => ReactNode;
|
|
1800
|
+
/**
|
|
1801
|
+
* Columns fold into a narrow lane (their title upright, their count) to make room: a fold button on each header. Kept
|
|
1802
|
+
* per board in this browser under this key; without it they fold until the page is left.
|
|
1803
|
+
*/
|
|
1804
|
+
foldKey?: string;
|
|
1805
|
+
/** The fold button's name: "Fold Draft", "Unfold Draft". */
|
|
1806
|
+
foldLabel?: (name: string, folded: boolean) => string;
|
|
1807
|
+
/** What goes under a column's cards (a "Create record" button); null for none. */
|
|
1808
|
+
columnFooter?: (column: string) => ReactNode | null;
|
|
1809
|
+
/**
|
|
1810
|
+
* Columns reorder from their headers: a grip that drags onto another column's header, or moves with Left and Right
|
|
1811
|
+
* (in reading order). Given the columns' ids in their new order; without it, columns stay where they are.
|
|
1812
|
+
*/
|
|
1813
|
+
onReorderColumns?: (ids: string[]) => void;
|
|
1814
|
+
/** The grip's name: "Reorder Draft, position 1 of 8. Drag, or use the Left and Right arrow keys." */
|
|
1815
|
+
reorderLabel?: (name: string, position: number, of: number) => string;
|
|
1816
|
+
/** Where a dragged column lands, on the header it's over (the canvas's "Drop Review here"). */
|
|
1817
|
+
dropColumnLabel?: (name: string) => string;
|
|
1818
|
+
skeletonColumns?: number;
|
|
1819
|
+
}
|
|
1820
|
+
/**
|
|
1821
|
+
* A board of cards in columns, optionally in swimlanes (ADR 0027). Cards are sorted within a cell and moved between
|
|
1822
|
+
* cells by pointer or keyboard (space to lift, arrows to move, space to drop). The board doesn't change anything
|
|
1823
|
+
* itself: it reports the move, and the host decides (and reloads).
|
|
1824
|
+
*
|
|
1825
|
+
* A card the person drops shows where they put it at once, until the host's next items (its answer) arrive; a move the
|
|
1826
|
+
* host refuses then slides back. When cards change places for any other reason (someone else, a rule, a refresh), they
|
|
1827
|
+
* slide to their new cells instead of jumping (ADR 0058): not while the person drags, and not the card they just
|
|
1828
|
+
* dropped, which the drag itself brought there. The slide moves a wrapper inside each card, never the element the drag
|
|
1829
|
+
* moves.
|
|
1830
|
+
*
|
|
1831
|
+
* With `selected` and `onSelect`, cards can be selected and dragged together (ADR 0058, amended): the others wait,
|
|
1832
|
+
* faded, where they are, then land beside the dragged one in their order, shown at once; they travel there from where
|
|
1833
|
+
* they waited.
|
|
1834
|
+
*/
|
|
1835
|
+
declare function KanbanBoard<T extends KanbanItem>({ 'aria-label': ariaLabel, columns, lanes, items, renderCard, canDrop, onDragStart, onDragEnd, onMove, selected, onSelect, onMoveMany, carrying, announcements, screenReaderInstructions, empty, loading: own, skeletonCard, skeletonColumns, foldKey, onReorderColumns, reorderLabel, dropColumnLabel, foldLabel, columnFooter, }: KanbanBoardProps<T>): react.JSX.Element;
|
|
1836
|
+
|
|
1837
|
+
/**
|
|
1838
|
+
* Placeholder lines while content loads, for a free-form block no component describes. A page draws its own layout
|
|
1839
|
+
* loading instead (ADR 0061); this is never a page's whole answer. Announces "Loading" to screen readers.
|
|
1840
|
+
*/
|
|
1841
|
+
declare function LoadingState({ lines, label }: {
|
|
1842
|
+
lines?: number;
|
|
1843
|
+
label?: string;
|
|
1844
|
+
}): react.JSX.Element;
|
|
1845
|
+
|
|
1846
|
+
interface LoadingProps {
|
|
1847
|
+
/** While true, every component inside draws its skeleton. */
|
|
1848
|
+
when: boolean;
|
|
1849
|
+
/** What screen readers hear while it loads; "Loading" by default. */
|
|
1850
|
+
label?: string;
|
|
1851
|
+
children?: ReactNode;
|
|
1852
|
+
}
|
|
1853
|
+
/**
|
|
1854
|
+
* Says once that a page, or a part of one, is waiting for its data (ADR 0061): every component inside draws its own
|
|
1855
|
+
* skeleton at its own size, and nothing inside takes focus or clicks. It adds no box of its own, so it can wrap
|
|
1856
|
+
* anything without changing the layout; screen readers hear "Loading" once, and the content fades in where its
|
|
1857
|
+
* placeholders were when the data comes.
|
|
1858
|
+
*/
|
|
1859
|
+
declare function Loading({ when, label, children }: LoadingProps): react.JSX.Element;
|
|
1860
|
+
/** A component's loading: its own `loading` prop when given, else the nearest `Loading` scope's. */
|
|
1861
|
+
declare function useLoading(own?: boolean): boolean;
|
|
1862
|
+
/**
|
|
1863
|
+
* True for a moment after loading ends: what replaced a placeholder fades in there (150 ms, none with less motion),
|
|
1864
|
+
* instead of appearing at once.
|
|
1865
|
+
*/
|
|
1866
|
+
declare function useArriving(loading: boolean): boolean;
|
|
1867
|
+
|
|
1868
|
+
/**
|
|
1869
|
+
* What every placeholder shares: a flat gray block with a gentle pulse, no shine crossing it (the canvas's v12 skeleton,
|
|
1870
|
+
* UI round 9 step 66; ADR 0058's shine before). Still with less motion: the global rule ends keyframes at once when the
|
|
1871
|
+
* person chose less, and this one when the system asks for less and the person left it to the system.
|
|
1872
|
+
*/
|
|
1873
|
+
declare const shineCss: SystemStyleObject;
|
|
1874
|
+
/**
|
|
1875
|
+
* A component drawn as its own placeholder (ADR 0061): the real element, at its real size, with its content hidden
|
|
1876
|
+
* and the shine where it will be. Its radius stays its own.
|
|
1877
|
+
*/
|
|
1878
|
+
declare const ghostCss: SystemStyleObject;
|
|
1879
|
+
/** What replaced a placeholder fades in there, nothing moving (150 ms on the `out` curve; none with less motion). */
|
|
1880
|
+
declare const arriveCss: SystemStyleObject;
|
|
1881
|
+
interface BoneProps extends Omit<HTMLChakraProps<'span'>, 'children'> {
|
|
1882
|
+
/** A circle (an avatar, a dot): its width is its height. */
|
|
1883
|
+
circle?: boolean;
|
|
1884
|
+
}
|
|
1885
|
+
/** A placeholder shape: a box, a line or a circle, for anything a page draws itself. */
|
|
1886
|
+
declare function Bone({ circle, width, height, borderRadius, css, ...rest }: BoneProps): react.JSX.Element;
|
|
1887
|
+
interface TextBoneProps {
|
|
1888
|
+
/** Its width: characters of the slot's own font (a number), or any CSS width. 12 characters by default. */
|
|
1889
|
+
width?: number | string;
|
|
1890
|
+
/** Several lines, the last one shorter: a paragraph. */
|
|
1891
|
+
lines?: number;
|
|
1892
|
+
}
|
|
1893
|
+
/**
|
|
1894
|
+
* Text that's coming (ADR 0061). Given a width in characters, it's text of that length, invisible, shining: it sits on
|
|
1895
|
+
* the line, wraps where the text would and takes the room the text will, in the text style of wherever it sits. Given
|
|
1896
|
+
* a CSS width ("full", "60%"), it's a bar one line box tall (CSS `1lh`). Several lines are a block of bars.
|
|
1897
|
+
*/
|
|
1898
|
+
declare function TextBone({ width, lines }: TextBoneProps): react.JSX.Element;
|
|
1899
|
+
interface TextSlotProps extends TextBoneProps {
|
|
1900
|
+
/** Its own loading; the nearest `Loading` scope's when not given. */
|
|
1901
|
+
loading?: boolean;
|
|
1902
|
+
children?: ReactNode;
|
|
1903
|
+
}
|
|
1904
|
+
/**
|
|
1905
|
+
* A place for text whose data is coming: a `TextBone` while it loads, then the text, fading in where the bone was.
|
|
1906
|
+
* Pages use it for their own text (a heading, a sentence); components use it for their data slots.
|
|
1907
|
+
*/
|
|
1908
|
+
declare function TextSlot({ loading: own, width, lines, children }: TextSlotProps): react.JSX.Element;
|
|
1909
|
+
/**
|
|
1910
|
+
* Widths for a list of placeholders that look like text, not like a ruler: the same for a position on every render,
|
|
1911
|
+
* between `min` and `max` characters.
|
|
1912
|
+
*/
|
|
1913
|
+
declare function boneWidth(index: number, min?: number, max?: number): number;
|
|
1914
|
+
|
|
1915
|
+
interface BreadcrumbItem {
|
|
1916
|
+
/** Its label; while the page loads, one not given yet is drawn as text that's coming. */
|
|
1917
|
+
label?: ReactNode;
|
|
1918
|
+
/** Omit for the current page. */
|
|
1919
|
+
href?: string;
|
|
1920
|
+
}
|
|
1921
|
+
interface PageHeaderProps {
|
|
1922
|
+
/** The page's title; while the page loads, one not given yet is drawn as text that's coming, in the title's size. */
|
|
1923
|
+
title?: ReactNode;
|
|
1924
|
+
description?: ReactNode;
|
|
1925
|
+
breadcrumbs?: BreadcrumbItem[];
|
|
1926
|
+
/** Status pills, counts, owners: shown next to the title. */
|
|
1927
|
+
meta?: ReactNode;
|
|
1928
|
+
/** How many things the page holds, in a badge right after the title ("Records 130"). */
|
|
1929
|
+
count?: number | null;
|
|
1930
|
+
/** Small things that belong to the title itself, right after it (and its count): a favourite star, who sees it. */
|
|
1931
|
+
adornments?: ReactNode;
|
|
1932
|
+
actions?: ReactNode;
|
|
1933
|
+
/** The page is waiting for its data (ADR 0061). The nearest `Loading` scope's when not given. */
|
|
1934
|
+
loading?: boolean;
|
|
1935
|
+
/** How many characters wide the title's placeholder is (24). */
|
|
1936
|
+
titleWidth?: number;
|
|
1937
|
+
/**
|
|
1938
|
+
* What the browser's tab says for the page, most specific part first, without the site's name (PageTitleProvider).
|
|
1939
|
+
* By default the title, when it's text, then the breadcrumb above the page, when that's text ("Groups · People").
|
|
1940
|
+
* Give it for a title that's a node (a record's key and title); null claims nothing.
|
|
1941
|
+
*/
|
|
1942
|
+
documentTitle?: TitleParts;
|
|
1943
|
+
}
|
|
1944
|
+
/** Title block at the top of every page: breadcrumbs, title, description, meta and actions. */
|
|
1945
|
+
declare function PageHeader({ title, description, breadcrumbs, meta, count, adornments, actions, loading: own, titleWidth, documentTitle }: PageHeaderProps): react.JSX.Element;
|
|
1946
|
+
/**
|
|
1947
|
+
* Breadcrumb trail; the separator chevron mirrors in right-to-left layouts. Past four levels the middle ones fold into
|
|
1948
|
+
* "…", a menu of them (the canvas's v12, UI round 9 step 66): the first and the last two stay.
|
|
1949
|
+
*/
|
|
1950
|
+
declare function Breadcrumbs({ items, loading: own }: {
|
|
1951
|
+
items: BreadcrumbItem[];
|
|
1952
|
+
loading?: boolean;
|
|
1953
|
+
}): react.JSX.Element;
|
|
1954
|
+
|
|
1955
|
+
interface PanelProps extends Omit<HTMLChakraProps<'section'>, 'title'> {
|
|
1956
|
+
title?: ReactNode;
|
|
1957
|
+
description?: ReactNode;
|
|
1958
|
+
/** Buttons or meta shown at the end of the header. */
|
|
1959
|
+
actions?: ReactNode;
|
|
1960
|
+
footer?: ReactNode;
|
|
1961
|
+
/** No body padding: for tables and lists that run edge to edge. */
|
|
1962
|
+
flush?: boolean;
|
|
1963
|
+
/** Heading level of the title (default h2). */
|
|
1964
|
+
headingAs?: 'h2' | 'h3' | 'h4';
|
|
1965
|
+
/** What it holds is waiting for its data (ADR 0061): a `Loading` scope for its body. Its title and actions stay. */
|
|
1966
|
+
loading?: boolean;
|
|
1967
|
+
/** `card` (the bordered surface) or `section` (a heading over a rule, no box); the nearest `PanelTone`'s when not given. */
|
|
1968
|
+
tone?: 'card' | 'section';
|
|
1969
|
+
}
|
|
1970
|
+
/** The look of every Panel inside it that doesn't ask for its own (the record page's main column: `section`). */
|
|
1971
|
+
declare function PanelTone({ tone, children }: {
|
|
1972
|
+
tone: 'card' | 'section';
|
|
1973
|
+
children: ReactNode;
|
|
1974
|
+
}): react.JSX.Element;
|
|
1975
|
+
/** The bordered surface every block of content sits in. */
|
|
1976
|
+
declare const Panel: react.ForwardRefExoticComponent<PanelProps & react.RefAttributes<HTMLElement>>;
|
|
1977
|
+
|
|
1978
|
+
interface PathChipsProps extends Omit<HTMLChakraProps<'ol'>, 'children'> {
|
|
1979
|
+
/** e.g. ["backend", "engineering", "all-staff"] */
|
|
1980
|
+
path: string[];
|
|
1981
|
+
/** Emphasise the last segment (the group that was reached). Default true. */
|
|
1982
|
+
highlightLast?: boolean;
|
|
1983
|
+
/** Its path is coming (ADR 0061): `skeletonCount` chips as ghosts. The nearest `Loading` scope's when not given. */
|
|
1984
|
+
loading?: boolean;
|
|
1985
|
+
/** How many chips stand for the path while it loads (3). */
|
|
1986
|
+
skeletonCount?: number;
|
|
1987
|
+
}
|
|
1988
|
+
/**
|
|
1989
|
+
* A nesting path as chips joined by arrows. The arrow points in reading direction: right in
|
|
1990
|
+
* English, left in Arabic. Each segment is bidi-isolated so mixed scripts keep their order.
|
|
1991
|
+
*/
|
|
1992
|
+
declare function PathChips({ path, highlightLast, loading: own, skeletonCount, css, ...rest }: PathChipsProps): react.JSX.Element;
|
|
1993
|
+
|
|
1994
|
+
interface PropertyItem {
|
|
1995
|
+
label: ReactNode;
|
|
1996
|
+
/** Its value; while the list loads, one not given yet is drawn as text that's coming. */
|
|
1997
|
+
value?: ReactNode;
|
|
1998
|
+
/** Stable key; defaults to the index. */
|
|
1999
|
+
id?: string;
|
|
2000
|
+
/** How many characters wide its value's placeholder is. */
|
|
2001
|
+
skeletonWidth?: number;
|
|
2002
|
+
}
|
|
2003
|
+
interface PropertyListProps {
|
|
2004
|
+
items: PropertyItem[];
|
|
2005
|
+
size?: 'sm' | 'md';
|
|
2006
|
+
/** Its values are coming (ADR 0061). The nearest `Loading` scope's when not given. */
|
|
2007
|
+
loading?: boolean;
|
|
2008
|
+
}
|
|
2009
|
+
/** Label / value pairs (account details, directory summary). Stacks on narrow screens. */
|
|
2010
|
+
declare function PropertyList({ items, size, loading: own }: PropertyListProps): react.JSX.Element;
|
|
2011
|
+
|
|
2012
|
+
/** A field a query can use, as GET /api/query/{entity}/fields returns it. */
|
|
2013
|
+
interface QueryField {
|
|
2014
|
+
id: string;
|
|
2015
|
+
kind: string;
|
|
2016
|
+
label: string;
|
|
2017
|
+
sortable: boolean;
|
|
2018
|
+
groupable: boolean;
|
|
2019
|
+
/** JSON-form operator names: eq, ne, in, notIn, contains, isEmpty… */
|
|
2020
|
+
operators: string[];
|
|
2021
|
+
}
|
|
2022
|
+
interface QuerySuggestion {
|
|
2023
|
+
text: string;
|
|
2024
|
+
label: string;
|
|
2025
|
+
kind: string;
|
|
2026
|
+
detail?: string | null;
|
|
2027
|
+
}
|
|
2028
|
+
interface QuerySuggestions {
|
|
2029
|
+
replaceStart: number;
|
|
2030
|
+
replaceEnd: number;
|
|
2031
|
+
items: QuerySuggestion[];
|
|
2032
|
+
}
|
|
2033
|
+
interface QueryGroup {
|
|
2034
|
+
value: string | null;
|
|
2035
|
+
label: string;
|
|
2036
|
+
count: number;
|
|
2037
|
+
/** Grouped by two fields: the second field's value and name in this group (each group is one pair). */
|
|
2038
|
+
then?: {
|
|
2039
|
+
value: string | null;
|
|
2040
|
+
label: string;
|
|
2041
|
+
} | null;
|
|
2042
|
+
}
|
|
2043
|
+
interface QueryRow {
|
|
2044
|
+
id: string;
|
|
2045
|
+
key: string;
|
|
2046
|
+
values: Record<string, unknown>;
|
|
2047
|
+
}
|
|
2048
|
+
/** The JSON form of a query (ADR 0013): { where, groupBy, orderBy }. */
|
|
2049
|
+
type QueryJson = {
|
|
2050
|
+
where?: QueryNodeJson | null;
|
|
2051
|
+
groupBy?: {
|
|
2052
|
+
field: string;
|
|
2053
|
+
period?: string | null;
|
|
2054
|
+
then?: {
|
|
2055
|
+
field: string;
|
|
2056
|
+
period?: string | null;
|
|
2057
|
+
} | null;
|
|
2058
|
+
aggregates?: unknown[];
|
|
2059
|
+
} | null;
|
|
2060
|
+
orderBy?: {
|
|
2061
|
+
field: string;
|
|
2062
|
+
desc?: boolean;
|
|
2063
|
+
}[];
|
|
2064
|
+
};
|
|
2065
|
+
type QueryNodeJson = {
|
|
2066
|
+
and: QueryNodeJson[];
|
|
2067
|
+
} | {
|
|
2068
|
+
or: QueryNodeJson[];
|
|
2069
|
+
} | {
|
|
2070
|
+
not: QueryNodeJson;
|
|
2071
|
+
} | QueryConditionJson | Record<string, unknown>;
|
|
2072
|
+
interface QueryConditionJson {
|
|
2073
|
+
field: string;
|
|
2074
|
+
op: string;
|
|
2075
|
+
value?: unknown;
|
|
2076
|
+
}
|
|
2077
|
+
/**
|
|
2078
|
+
* What the list shows: a query (as RQL text, or as JSON when the list just changed it) and the columns. The host keeps
|
|
2079
|
+
* it in the URL and runs it; the list never fetches.
|
|
2080
|
+
*/
|
|
2081
|
+
interface QueryableListState {
|
|
2082
|
+
rql?: string;
|
|
2083
|
+
query?: QueryJson;
|
|
2084
|
+
columns: string[];
|
|
2085
|
+
}
|
|
2086
|
+
interface QueryableListView {
|
|
2087
|
+
id: string;
|
|
2088
|
+
name: string;
|
|
2089
|
+
isOwner: boolean;
|
|
2090
|
+
}
|
|
2091
|
+
/** The files an export can be: CSV, or an Excel workbook. */
|
|
2092
|
+
type QueryExportFormat = 'csv' | 'xlsx';
|
|
2093
|
+
/** What an export held (from the response's headers): rows in the file, rows that matched, and the limit that cut it. */
|
|
2094
|
+
interface QueryableListExport {
|
|
2095
|
+
rows: number;
|
|
2096
|
+
total: number;
|
|
2097
|
+
limit: number;
|
|
2098
|
+
truncated: boolean;
|
|
2099
|
+
}
|
|
2100
|
+
interface QueryableListError {
|
|
2101
|
+
message: string;
|
|
2102
|
+
/** The records couldn't load (the server or the connection failed), not a problem with the query: Try again, in the table's place. */
|
|
2103
|
+
failed?: boolean;
|
|
2104
|
+
/** Where in the RQL the problem is, when the server knows. */
|
|
2105
|
+
start?: number;
|
|
2106
|
+
end?: number;
|
|
2107
|
+
}
|
|
2108
|
+
/**
|
|
2109
|
+
* A field's own control for a filter's value in the basic search (a field type's filter component, ADR 0077): it gets the
|
|
2110
|
+
* field, the operator and the value so far, and gives the value the condition takes (a list for in, has any…). Null
|
|
2111
|
+
* keeps the text box with its suggestions.
|
|
2112
|
+
*/
|
|
2113
|
+
type QueryValueEditor = (props: {
|
|
2114
|
+
field: QueryField;
|
|
2115
|
+
op: string;
|
|
2116
|
+
value: unknown;
|
|
2117
|
+
onChange: (value: unknown) => void;
|
|
2118
|
+
}) => ReactNode | null;
|
|
2119
|
+
interface QueryableListProps {
|
|
2120
|
+
'aria-label': string;
|
|
2121
|
+
/** undefined while loading. */
|
|
2122
|
+
fields: QueryField[] | undefined;
|
|
2123
|
+
state: QueryableListState;
|
|
2124
|
+
onStateChange: (next: QueryableListState) => void;
|
|
2125
|
+
/** The last result: rows, total, groups, and the query the server ran (canonical RQL and JSON). */
|
|
2126
|
+
result?: {
|
|
2127
|
+
total: number;
|
|
2128
|
+
items: QueryRow[];
|
|
2129
|
+
groups?: QueryGroup[] | null;
|
|
2130
|
+
rql: string;
|
|
2131
|
+
query: QueryJson;
|
|
2132
|
+
} | null;
|
|
2133
|
+
/** Its rows are coming (ADR 0061): a page of placeholder rows, each column's by its field. The nearest `Loading` scope's when not given. */
|
|
2134
|
+
loading?: boolean;
|
|
2135
|
+
error?: QueryableListError | null;
|
|
2136
|
+
renderCell: (columnId: string, value: unknown, row: QueryRow) => ReactNode;
|
|
2137
|
+
/** Draws a row its own way, across every column (a plugin's row view); null draws its cells. */
|
|
2138
|
+
renderRow?: (row: QueryRow) => ReactNode | null;
|
|
2139
|
+
/** One selected row, moved with the keyboard (↑ ↓ Home End), opened with Enter. */
|
|
2140
|
+
selection?: DataTableSelection<QueryRow>;
|
|
2141
|
+
/** How many records conditions match with the list's search (the filter builder's live count, UI round 9 step 57). */
|
|
2142
|
+
countMatches?: (conditions: QueryConditionJson[]) => Promise<number>;
|
|
2143
|
+
/** A column before the fields' (the checkboxes of rows picked for a change, UI round 9 step 56). */
|
|
2144
|
+
leadingColumn?: DataTableColumn<QueryRow>;
|
|
2145
|
+
/** A row under the toolbar, across it (picking rows, changing them). */
|
|
2146
|
+
toolbarFooter?: ReactNode;
|
|
2147
|
+
/** RQL autocomplete at the caret; without it the RQL box is a plain input. */
|
|
2148
|
+
suggest?: (rql: string, caret: number) => Promise<QuerySuggestions>;
|
|
2149
|
+
/** A field's own value control in the basic search; without it, or when it gives null, the text box. */
|
|
2150
|
+
renderValueEditor?: QueryValueEditor;
|
|
2151
|
+
skip: number;
|
|
2152
|
+
take: number;
|
|
2153
|
+
onSkipChange: (skip: number) => void;
|
|
2154
|
+
views?: QueryableListView[];
|
|
2155
|
+
activeViewId?: string | null;
|
|
2156
|
+
onSelectView?: (id: string | null) => void;
|
|
2157
|
+
onSaveView?: (name: string, replaceId: string | null) => void;
|
|
2158
|
+
onDeleteView?: (id: string) => void;
|
|
2159
|
+
/**
|
|
2160
|
+
* Downloads what the list shows (its query and columns, every page) as a file; without it there's no Export menu.
|
|
2161
|
+
* Resolves with what the file held, so the list can say when it was cut short; a rejection is shown as an error.
|
|
2162
|
+
*/
|
|
2163
|
+
onExport?: (format: QueryExportFormat) => Promise<QueryableListExport | void>;
|
|
2164
|
+
/** Extra buttons on the toolbar (e.g. "Create record"). */
|
|
2165
|
+
actions?: ReactNode;
|
|
2166
|
+
empty?: ReactNode;
|
|
2167
|
+
/** In the table's place when the records couldn't load (an error that's `failed`): the host's Try again (UI round 9, step 61). */
|
|
2168
|
+
loadFailed?: ReactNode;
|
|
2169
|
+
/** At the toolbar's start, before the saved views: the host's layout switch (List, Board, Timeline). */
|
|
2170
|
+
leading?: ReactNode;
|
|
2171
|
+
/** At the end of the filter row: what needs attention, as chips that filter ("1 Overdue", "2 Due in 7 days"). */
|
|
2172
|
+
attention?: ReactNode;
|
|
2173
|
+
/**
|
|
2174
|
+
* A quick search box in the basic filters: what's typed becomes a "contains" condition on this field (a record's
|
|
2175
|
+
* title), shown in the box rather than as a chip. With `keyField`, text shaped like a key ("FIN-12") looks for that
|
|
2176
|
+
* key instead (an "equals" on that field). Without it there's no box.
|
|
2177
|
+
*/
|
|
2178
|
+
search?: {
|
|
2179
|
+
field: string;
|
|
2180
|
+
placeholder?: string;
|
|
2181
|
+
keyField?: string;
|
|
2182
|
+
};
|
|
2183
|
+
/** Where the Export menu goes when not on the toolbar: the page header's actions (an element the host holds). */
|
|
2184
|
+
exportTarget?: HTMLElement | null;
|
|
2185
|
+
/** A column's header other than its field's name (the records list's "Record" over its titles). */
|
|
2186
|
+
columnLabels?: Record<string, ReactNode>;
|
|
2187
|
+
/** A row after each group's rows in a grouped list ("Create record" in that group); null for none. */
|
|
2188
|
+
renderGroupFooter?: (group: {
|
|
2189
|
+
field: string;
|
|
2190
|
+
value: string | null;
|
|
2191
|
+
label: string;
|
|
2192
|
+
then?: {
|
|
2193
|
+
field: string;
|
|
2194
|
+
value: string | null;
|
|
2195
|
+
};
|
|
2196
|
+
}) => ReactNode | null;
|
|
2197
|
+
/** After a group's name and count in its header: what else to say of the group ("1 overdue"); null for nothing. */
|
|
2198
|
+
renderGroupAside?: (group: {
|
|
2199
|
+
field: string;
|
|
2200
|
+
value: string | null;
|
|
2201
|
+
label: string;
|
|
2202
|
+
}) => ReactNode | null;
|
|
2203
|
+
/**
|
|
2204
|
+
* Rows that move to another group while the list is grouped by `field` (a record to another status): each row's grip
|
|
2205
|
+
* drags onto a group's header, or opens a menu of the groups. `accepts` leaves out groups a row can't go to.
|
|
2206
|
+
*/
|
|
2207
|
+
/**
|
|
2208
|
+
* Grouped by this field (parent), the list is a tree: each record under its parent, folding, at any depth. `context`
|
|
2209
|
+
* are parents the search left out, shown dimmed so their children sit under them; `contextLabel` says so to screen readers.
|
|
2210
|
+
*/
|
|
2211
|
+
tree?: {
|
|
2212
|
+
field: string;
|
|
2213
|
+
context?: QueryRow[];
|
|
2214
|
+
contextLabel: string;
|
|
2215
|
+
};
|
|
2216
|
+
moveToGroup?: {
|
|
2217
|
+
field: string;
|
|
2218
|
+
label: (row: QueryRow) => string;
|
|
2219
|
+
accepts?: (row: QueryRow, group: QueryGroup) => boolean;
|
|
2220
|
+
onMove: (row: QueryRow, group: QueryGroup) => void;
|
|
2221
|
+
/**
|
|
2222
|
+
* Puts a row at a position: before or after another, in that row's group (UI round 9, step 64). Offered only while the
|
|
2223
|
+
* list is in rank order, where a position is something the list shows.
|
|
2224
|
+
*/
|
|
2225
|
+
onPlace?: (row: QueryRow, group: QueryGroup, at: {
|
|
2226
|
+
before?: QueryRow;
|
|
2227
|
+
after?: QueryRow;
|
|
2228
|
+
}) => void;
|
|
2229
|
+
};
|
|
2230
|
+
}
|
|
2231
|
+
/** The flat AND of plain conditions the basic filters can show, or null when the query is more than that. */
|
|
2232
|
+
declare function basicConditions(where: QueryNodeJson | null | undefined): QueryConditionJson[] | null;
|
|
2233
|
+
/**
|
|
2234
|
+
* The dynamic list (catalog §6): basic filters or RQL with autocomplete, columns, server-side sort, grouping with
|
|
2235
|
+
* counts, saved views and paging, over any entity the query engine serves. Controlled: the host runs the query and
|
|
2236
|
+
* keeps the state in the URL.
|
|
2237
|
+
*/
|
|
2238
|
+
declare function QueryableList({ 'aria-label': ariaLabel, fields, state, onStateChange, result, loading: own, error, renderCell, renderRow, selection, leadingColumn, toolbarFooter, countMatches, suggest, renderValueEditor, skip, take, onSkipChange, views, activeViewId, onSelectView, onSaveView, onDeleteView, onExport, actions, empty, loadFailed, leading, attention, search, renderGroupFooter, renderGroupAside, moveToGroup, tree, columnLabels, exportTarget, }: QueryableListProps): react.JSX.Element;
|
|
2239
|
+
|
|
2240
|
+
interface RecordKeyProps extends Omit<HTMLChakraProps<'span'>, 'children'> {
|
|
2241
|
+
/** The key, e.g. "PAY-41". Children win when both are given. */
|
|
2242
|
+
value?: string;
|
|
2243
|
+
children?: ReactNode;
|
|
2244
|
+
/** Makes the key a link (rendered with the host's link component). */
|
|
2245
|
+
href?: string;
|
|
2246
|
+
variant?: 'plain' | 'chip' | 'muted';
|
|
2247
|
+
size?: 'xs' | 'sm' | 'md';
|
|
2248
|
+
/**
|
|
2249
|
+
* The key moves to where the next page shows the same key (its record's header), when the person opens it
|
|
2250
|
+
* (ADR 0058; the browser's view transitions). Only one key per record on a page may glide: give it to a list's key
|
|
2251
|
+
* column, never to a parent's key or to lists that can show a record twice.
|
|
2252
|
+
*/
|
|
2253
|
+
glide?: boolean;
|
|
2254
|
+
/** Its key is coming (ADR 0061): drawn as its own ghost, as wide as a key. The nearest `Loading` scope's when not given. */
|
|
2255
|
+
loading?: boolean;
|
|
2256
|
+
}
|
|
2257
|
+
/** A record key or identifier in mono, always left-to-right, never wrapped. */
|
|
2258
|
+
declare const RecordKey: react.ForwardRefExoticComponent<RecordKeyProps & react.RefAttributes<HTMLElement>>;
|
|
2259
|
+
|
|
2260
|
+
interface FileDropAreaProps extends BoxProps$1 {
|
|
2261
|
+
/** Files are being dragged over the page: the area wakes and says what a drop does. */
|
|
2262
|
+
awake?: boolean;
|
|
2263
|
+
/** They're over the area itself: let go here. */
|
|
2264
|
+
over?: boolean;
|
|
2265
|
+
/** What a drop does, shown over the area while it's awake ("Drop to attach to PAY-41"). */
|
|
2266
|
+
hint?: ReactNode;
|
|
2267
|
+
}
|
|
2268
|
+
/**
|
|
2269
|
+
* Where files can be dropped (ADR 0011, amended). At rest it's the dashed box around its children (an Upload button);
|
|
2270
|
+
* while files are dragged over the page it wakes (the accent, and over its children what a drop does); with them over
|
|
2271
|
+
* it, it lifts a little and its arrow bobs. Its size never changes, so nothing around it moves.
|
|
2272
|
+
*/
|
|
2273
|
+
declare const FileDropArea: react.ForwardRefExoticComponent<FileDropAreaProps & react.RefAttributes<HTMLDivElement>>;
|
|
2274
|
+
interface DropHintProps {
|
|
2275
|
+
/** Files are over the page, and not over a drop area that says it itself. */
|
|
2276
|
+
show: boolean;
|
|
2277
|
+
children: ReactNode;
|
|
2278
|
+
}
|
|
2279
|
+
/**
|
|
2280
|
+
* A pill at the bottom of the window while files are dragged over the page: a drop anywhere works, and it says where
|
|
2281
|
+
* the files will go. It never catches the pointer, so the drop lands on the page beneath it.
|
|
2282
|
+
*/
|
|
2283
|
+
declare function DropHint({ show, children }: DropHintProps): react.JSX.Element;
|
|
2284
|
+
|
|
2285
|
+
/**
|
|
2286
|
+
* The rules of an upload queue (ADR 0011, amended), kept apart from React and the network so they can be tested:
|
|
2287
|
+
* which files go next, what's refused before sending, how far along the whole queue is, the folders a dropped folder
|
|
2288
|
+
* needs, and the name a pasted file gets.
|
|
2289
|
+
*/
|
|
2290
|
+
/** Where a file is: waiting its turn, being sent, done, failed (it can be tried again), cancelled, or refused before sending. */
|
|
2291
|
+
type UploadState = 'waiting' | 'sending' | 'done' | 'failed' | 'cancelled' | 'refused';
|
|
2292
|
+
interface UploadJob {
|
|
2293
|
+
id: string;
|
|
2294
|
+
/** The name it will have. */
|
|
2295
|
+
name: string;
|
|
2296
|
+
size: number;
|
|
2297
|
+
/** The folder it goes into ("" for the top). */
|
|
2298
|
+
folder: string;
|
|
2299
|
+
state: UploadState;
|
|
2300
|
+
/** Bytes sent so far. */
|
|
2301
|
+
sent: number;
|
|
2302
|
+
}
|
|
2303
|
+
/** Files sent at once: enough to keep a connection busy, few enough that each one's bar moves. */
|
|
2304
|
+
declare const UPLOADS_AT_ONCE = 3;
|
|
2305
|
+
/** The same file to the server: the same name (compared without case) in the same folder. */
|
|
2306
|
+
declare const targetOf: (job: Pick<UploadJob, "folder" | "name">) => string;
|
|
2307
|
+
/**
|
|
2308
|
+
* The waiting files to start now, in the order they came: up to the limit with those already going, and never two of
|
|
2309
|
+
* the same name into the same folder at once (both would make the file, or race for its next version).
|
|
2310
|
+
*/
|
|
2311
|
+
declare function toStart<T extends UploadJob>(jobs: readonly T[], limit?: number): T[];
|
|
2312
|
+
/** Why a file can't be sent, before sending it: it's empty, or bigger than the server takes; null when it can. */
|
|
2313
|
+
declare function refusal(size: number, maxBytes?: number | null): 'empty' | 'tooBig' | null;
|
|
2314
|
+
interface QueueProgress {
|
|
2315
|
+
/** The files that go, or went: neither cancelled nor refused before sending. */
|
|
2316
|
+
total: number;
|
|
2317
|
+
done: number;
|
|
2318
|
+
/** Sent and not taken: they can be tried again. */
|
|
2319
|
+
failed: number;
|
|
2320
|
+
/** Not sent at all (empty, or too big). */
|
|
2321
|
+
refused: number;
|
|
2322
|
+
/** Still waiting or going. */
|
|
2323
|
+
active: number;
|
|
2324
|
+
/** Of the files still going or done, how much is sent: 0 to 1. */
|
|
2325
|
+
fraction: number;
|
|
2326
|
+
}
|
|
2327
|
+
/** How far along the whole queue is, for its one line ("3 of 5 uploaded") and its bar. */
|
|
2328
|
+
declare function progressOf(jobs: readonly UploadJob[]): QueueProgress;
|
|
2329
|
+
/**
|
|
2330
|
+
* The folders a dropped folder needs, parents first, from its files' paths inside it ("Specs/v2/a.pdf" needs "Specs"
|
|
2331
|
+
* and "Specs/v2"). Files at the top need none. Empty parts ("a//b") are skipped.
|
|
2332
|
+
*/
|
|
2333
|
+
declare function foldersFor(paths: readonly string[]): string[];
|
|
2334
|
+
/** The folder part of a file's path inside a dropped folder ("Specs/v2/a.pdf" → "Specs/v2"; "a.pdf" → ""). */
|
|
2335
|
+
declare const folderOf: (path: string) => string;
|
|
2336
|
+
/**
|
|
2337
|
+
* The name a pasted file gets: its own when it has one (a file copied from a folder), else "Pasted image" (or "Pasted
|
|
2338
|
+
* file") with the local time, as "Pasted image 2026-10-17 13.05.42.png" (no colons, which some systems refuse).
|
|
2339
|
+
*/
|
|
2340
|
+
declare function pastedName(original: string | undefined, type: string, at: Date): string;
|
|
2341
|
+
/** Whether a newer answer may replace what's shown: it has every file shown now (one sent earlier can't hide another). */
|
|
2342
|
+
declare function covers(shown: Iterable<string>, incoming: Iterable<string>): boolean;
|
|
2343
|
+
|
|
2344
|
+
interface UploadRow {
|
|
2345
|
+
id: string;
|
|
2346
|
+
name: string;
|
|
2347
|
+
state: UploadState;
|
|
2348
|
+
/** How much of it is sent, 0 to 1. */
|
|
2349
|
+
fraction: number;
|
|
2350
|
+
/** Under the name: its size, where it goes, what will happen (a new version), or why it failed. */
|
|
2351
|
+
detail?: ReactNode;
|
|
2352
|
+
/** The row's end: "Waiting", "42 %", "Too big", ... */
|
|
2353
|
+
status?: ReactNode;
|
|
2354
|
+
/** A small picture of it (an image's own); a file's icon otherwise. */
|
|
2355
|
+
preview?: string;
|
|
2356
|
+
}
|
|
2357
|
+
interface UploadListProps {
|
|
2358
|
+
rows: UploadRow[];
|
|
2359
|
+
/** One line over the rows ("3 of 5 uploaded"); with `fraction`, the whole queue's bar under it. */
|
|
2360
|
+
summary?: ReactNode;
|
|
2361
|
+
fraction?: number;
|
|
2362
|
+
/** Said to screen readers when it changes ("2 of 5 uploaded"). */
|
|
2363
|
+
announce?: string;
|
|
2364
|
+
labels: {
|
|
2365
|
+
cancel: (name: string) => string;
|
|
2366
|
+
retry: (name: string) => string;
|
|
2367
|
+
dismiss: (name: string) => string;
|
|
2368
|
+
};
|
|
2369
|
+
onCancel: (id: string) => void;
|
|
2370
|
+
onRetry: (id: string) => void;
|
|
2371
|
+
onDismiss: (id: string) => void;
|
|
2372
|
+
}
|
|
2373
|
+
/**
|
|
2374
|
+
* Files on their way (ADR 0011, amended): each a row that arrives at once with a picture of it, its name, a bar that
|
|
2375
|
+
* fills as it's sent and what's happening; a finished one ticks (then the host lets it go), a failed one says why and
|
|
2376
|
+
* can be tried again. Keep it on the page while uploads can happen, so the first row arrives too.
|
|
2377
|
+
*/
|
|
2378
|
+
declare function UploadList({ rows, summary, fraction, announce, labels, onCancel, onRetry, onDismiss }: UploadListProps): react.JSX.Element;
|
|
2379
|
+
|
|
2380
|
+
/**
|
|
2381
|
+
* Files dropped or pasted onto a page (ADR 0011, amended): knowing files are being dragged over it (so drop zones can
|
|
2382
|
+
* wake), a drop zone that knows which of its parts the pointer is over, a catch for drops anywhere else (the browser
|
|
2383
|
+
* would otherwise open the file in place of the page), dropped folders read with their paths, and pasted files.
|
|
2384
|
+
* Only files count: dragging text, a link or a board card wakes nothing.
|
|
2385
|
+
*/
|
|
2386
|
+
/** A dropped file, with where it was inside a dropped folder ("Specs/v2/a.pdf"; just its name when dropped alone). */
|
|
2387
|
+
interface DroppedFile {
|
|
2388
|
+
file: File;
|
|
2389
|
+
path: string;
|
|
2390
|
+
/** The name it gets, when not the file's own (a pasted screenshot). */
|
|
2391
|
+
name?: string;
|
|
2392
|
+
}
|
|
2393
|
+
/** Whether files are being dragged over the page right now (from the desktop or another window). */
|
|
2394
|
+
declare function useFilesOverPage(): boolean;
|
|
2395
|
+
/**
|
|
2396
|
+
* The files in a drop, folders read through with their paths. Call it in the drop's own handler: the browser hands out
|
|
2397
|
+
* what was dropped only then (reading the folders may finish later).
|
|
2398
|
+
*/
|
|
2399
|
+
declare function droppedFiles(data: DataTransfer | null): Promise<DroppedFile[]>;
|
|
2400
|
+
interface DropZoneOptions {
|
|
2401
|
+
/** Off: the zone takes nothing (the browser's own handling stays off while a page catch is on). */
|
|
2402
|
+
enabled?: boolean;
|
|
2403
|
+
/** The part of the zone a drop lands on: the closest `[data-drop]` holds it; elsewhere in the zone, null. */
|
|
2404
|
+
onFiles: (files: DroppedFile[], part: string | null) => void;
|
|
2405
|
+
}
|
|
2406
|
+
interface DropZoneState {
|
|
2407
|
+
/** Files are over the zone. */
|
|
2408
|
+
over: boolean;
|
|
2409
|
+
/** The `[data-drop]` part they're over, if any. */
|
|
2410
|
+
part: string | null;
|
|
2411
|
+
}
|
|
2412
|
+
/**
|
|
2413
|
+
* Makes an element take dropped files: it says when they're over it, and which part (`data-drop` on a child: a
|
|
2414
|
+
* folder's row), and hands them over with that part. A drop here never reaches a page catch.
|
|
2415
|
+
*/
|
|
2416
|
+
declare function useDropZone(ref: RefObject<HTMLElement | null>, { enabled, onFiles }: DropZoneOptions): DropZoneState;
|
|
2417
|
+
/**
|
|
2418
|
+
* Catches files dropped anywhere on the page outside a drop zone (one page catch at a time: the record's attachments).
|
|
2419
|
+
* While it's on, the browser never opens a dropped file in place of the page.
|
|
2420
|
+
*/
|
|
2421
|
+
declare function usePageDrop({ enabled, onFiles }: {
|
|
2422
|
+
enabled?: boolean;
|
|
2423
|
+
onFiles: (files: DroppedFile[]) => void;
|
|
2424
|
+
}): void;
|
|
2425
|
+
/**
|
|
2426
|
+
* Files pasted on the page (a screenshot from the clipboard), named as `pastedName` says. In a text box a paste is the
|
|
2427
|
+
* box's, unless it holds files and no text (a screenshot pasted while typing a comment is still attached).
|
|
2428
|
+
*/
|
|
2429
|
+
declare function usePastedFiles({ enabled, onFiles }: {
|
|
2430
|
+
enabled?: boolean;
|
|
2431
|
+
onFiles: (files: DroppedFile[]) => void;
|
|
2432
|
+
}): void;
|
|
2433
|
+
|
|
2434
|
+
interface SearchInputProps extends Omit<InputProps, 'size' | 'width' | 'maxW'> {
|
|
2435
|
+
size?: 'xs' | 'sm' | 'md' | 'lg';
|
|
2436
|
+
/** Maximum width as a size token ("xs", "md") or CSS length. Defaults to full width. */
|
|
2437
|
+
maxW?: InputProps['maxW'];
|
|
2438
|
+
}
|
|
2439
|
+
/** A text input with a leading search icon, for filtering lists. Give it an aria-label. */
|
|
2440
|
+
declare const SearchInput: react.ForwardRefExoticComponent<SearchInputProps & react.RefAttributes<HTMLInputElement>>;
|
|
2441
|
+
|
|
2442
|
+
interface SortableSection<T extends {
|
|
2443
|
+
id: string;
|
|
2444
|
+
}> {
|
|
2445
|
+
id: string;
|
|
2446
|
+
/** The section's heading row: a name, counts, actions. */
|
|
2447
|
+
header: ReactNode;
|
|
2448
|
+
/** Items in order (rank). */
|
|
2449
|
+
items: T[];
|
|
2450
|
+
/** Shown when the section has no items (it still takes drops). */
|
|
2451
|
+
empty?: ReactNode;
|
|
2452
|
+
/** Under its items: creating one in place. */
|
|
2453
|
+
footer?: ReactNode;
|
|
2454
|
+
}
|
|
2455
|
+
interface SectionMove {
|
|
2456
|
+
section: string;
|
|
2457
|
+
/** The item it lands before, or after, in the target section. */
|
|
2458
|
+
before?: string;
|
|
2459
|
+
after?: string;
|
|
2460
|
+
}
|
|
2461
|
+
interface SortableSectionsProps<T extends {
|
|
2462
|
+
id: string;
|
|
2463
|
+
}> {
|
|
2464
|
+
'aria-label': string;
|
|
2465
|
+
sections: SortableSection<T>[];
|
|
2466
|
+
renderItem: (item: T, state: {
|
|
2467
|
+
dragging: boolean;
|
|
2468
|
+
}) => ReactNode;
|
|
2469
|
+
onMove: (item: T, to: SectionMove) => void;
|
|
2470
|
+
announcements?: Announcements;
|
|
2471
|
+
screenReaderInstructions?: string;
|
|
2472
|
+
/**
|
|
2473
|
+
* Its items are coming (ADR 0061): each section without items holds `skeletonItems` placeholder rows, `skeletonItemHeight`
|
|
2474
|
+
* tall (a row's height); with no sections yet, two placeholder sections. The nearest `Loading` scope's when not given.
|
|
2475
|
+
*/
|
|
2476
|
+
loading?: boolean;
|
|
2477
|
+
skeletonItems?: number;
|
|
2478
|
+
/** A row's height while it loads, as a size token or CSS length ("9", 36px). */
|
|
2479
|
+
skeletonItemHeight?: string;
|
|
2480
|
+
}
|
|
2481
|
+
/**
|
|
2482
|
+
* Lists in sections, each sortable, with items dragged within and between sections (ADR 0029: sprints and the
|
|
2483
|
+
* backlog). Pointer or keyboard (space to lift, arrows to move, space to drop). Like the board, it only reports the
|
|
2484
|
+
* move; the host decides and reloads.
|
|
2485
|
+
*/
|
|
2486
|
+
declare function SortableSections<T extends {
|
|
2487
|
+
id: string;
|
|
2488
|
+
}>({ 'aria-label': ariaLabel, sections, renderItem, onMove, announcements, screenReaderInstructions, loading: own, skeletonItems, skeletonItemHeight, }: SortableSectionsProps<T>): react.JSX.Element;
|
|
2489
|
+
|
|
2490
|
+
/**
|
|
2491
|
+
* The page's single toaster. It lives in the design system (a Module Federation singleton), so a
|
|
2492
|
+
* plugin calling `notify.success(...)` shows its toast in the shell's toaster.
|
|
2493
|
+
*/
|
|
2494
|
+
declare const toaster: _ark_ui_react.CreateToasterReturn<ReactNode>;
|
|
2495
|
+
type Message = ReactNode;
|
|
2496
|
+
declare const notify: {
|
|
2497
|
+
success: (title: Message, description?: Message) => string;
|
|
2498
|
+
error: (title: Message, description?: Message) => string;
|
|
2499
|
+
warning: (title: Message, description?: Message) => string;
|
|
2500
|
+
info: (title: Message, description?: Message) => string;
|
|
2501
|
+
};
|
|
2502
|
+
/** Rendered once by AbpProvider. */
|
|
2503
|
+
declare function Toaster(): react.JSX.Element;
|
|
2504
|
+
|
|
2505
|
+
/** A bar: its first and last day (yyyy-mm-dd); with only one of them, it's that one day. */
|
|
2506
|
+
interface TimelineItem {
|
|
2507
|
+
id: string;
|
|
2508
|
+
start?: string | null;
|
|
2509
|
+
end?: string | null;
|
|
2510
|
+
movable?: boolean;
|
|
2511
|
+
/** How the bar reads: its own dates (solid), dates it takes from elsewhere (dashed), or its children's span (a thin bar). */
|
|
2512
|
+
tone?: 'own' | 'inferred' | 'rollup';
|
|
2513
|
+
/** Done, 0 to 1: a strip along the bottom of the bar. */
|
|
2514
|
+
progress?: number | null;
|
|
2515
|
+
/** Whether a dependency can be drawn from this bar (with `onLink`): the person may change the record. */
|
|
2516
|
+
linkable?: boolean;
|
|
2517
|
+
/** Its colour: a colour palette's name (`blue`, `inProgress`, …); the accent when not given. */
|
|
2518
|
+
palette?: string;
|
|
2519
|
+
/** Picked out (ringed, as on a critical path) or set back (faded) while something else is picked out. */
|
|
2520
|
+
emphasis?: 'strong' | 'faint';
|
|
2521
|
+
/** A point in time, drawn as a diamond on its day; by default, a bar with only one of its dates is one. */
|
|
2522
|
+
milestone?: boolean;
|
|
2523
|
+
/** Its dates in a baseline it's compared with: a thin strip along the foot of its row, under the bar. */
|
|
2524
|
+
baseline?: {
|
|
2525
|
+
start?: string | null;
|
|
2526
|
+
end?: string | null;
|
|
2527
|
+
} | null;
|
|
2528
|
+
}
|
|
2529
|
+
interface TimelineRow<T extends TimelineItem> {
|
|
2530
|
+
id: string;
|
|
2531
|
+
/** A group heading row (no bar), or a record row. */
|
|
2532
|
+
heading?: ReactNode;
|
|
2533
|
+
item?: T;
|
|
2534
|
+
/**
|
|
2535
|
+
* A lane instead of a bar (someone's workload, say): cells along the timeline, each a span with a short text, a tone
|
|
2536
|
+
* (low, at capacity, over) and what it says in words. The row's `heading` is its label, without a heading's shading.
|
|
2537
|
+
*/
|
|
2538
|
+
lane?: {
|
|
2539
|
+
start: string;
|
|
2540
|
+
end: string;
|
|
2541
|
+
text: string;
|
|
2542
|
+
tone: 'low' | 'full' | 'over';
|
|
2543
|
+
label: string;
|
|
2544
|
+
}[];
|
|
2545
|
+
}
|
|
2546
|
+
interface TimelineChartProps<T extends TimelineItem> {
|
|
2547
|
+
'aria-label': string;
|
|
2548
|
+
/** The window shown, first and last day (yyyy-mm-dd). */
|
|
2549
|
+
from: string;
|
|
2550
|
+
to: string;
|
|
2551
|
+
/** Pixels per day: 32 shows days, 12 weeks, 4 months. */
|
|
2552
|
+
dayWidth: number;
|
|
2553
|
+
/** Fills the width it's given: when the window is narrower than the chart, the days go on past `to`. */
|
|
2554
|
+
fill?: boolean;
|
|
2555
|
+
rows: TimelineRow<T>[];
|
|
2556
|
+
/** Dependencies: <c>from</c> must end before <c>to</c> starts (drawn red when it doesn't). `strong` ones are picked out and the rest fade. */
|
|
2557
|
+
links?: {
|
|
2558
|
+
from: string;
|
|
2559
|
+
to: string;
|
|
2560
|
+
strong?: boolean;
|
|
2561
|
+
}[];
|
|
2562
|
+
today?: string;
|
|
2563
|
+
/** Periods shown as labelled bands in a strip under the header (sprints); the `current` one is also shaded down the chart. */
|
|
2564
|
+
bands?: {
|
|
2565
|
+
id: string;
|
|
2566
|
+
start: string;
|
|
2567
|
+
end: string;
|
|
2568
|
+
label: string;
|
|
2569
|
+
detail?: ReactNode;
|
|
2570
|
+
current?: boolean;
|
|
2571
|
+
}[];
|
|
2572
|
+
/** Days marked with a flag in a strip under the header and a line down the chart (releases' due dates). */
|
|
2573
|
+
markers?: {
|
|
2574
|
+
id: string;
|
|
2575
|
+
day: string;
|
|
2576
|
+
label: string;
|
|
2577
|
+
detail?: ReactNode;
|
|
2578
|
+
palette?: string;
|
|
2579
|
+
}[];
|
|
2580
|
+
/** Days off (a calendar's weekend and holidays), shaded at the finer zooms (12px a day or more); a holiday is named. */
|
|
2581
|
+
offDays?: (day: string) => {
|
|
2582
|
+
kind: 'weekend';
|
|
2583
|
+
} | {
|
|
2584
|
+
kind: 'holiday';
|
|
2585
|
+
label: string;
|
|
2586
|
+
} | null;
|
|
2587
|
+
/**
|
|
2588
|
+
* Zooming, asked for with Ctrl or ⌘ and the wheel (or a trackpad pinch) over the chart, or + and − while it has focus:
|
|
2589
|
+
* 1 in, −1 out. The host changes `dayWidth`; the chart keeps the day under the pointer (or in the middle) where it was.
|
|
2590
|
+
*/
|
|
2591
|
+
onZoom?: (step: 1 | -1) => void;
|
|
2592
|
+
/** Scrolls this day to the middle of the timeline, each time a new object is given (a Today button). */
|
|
2593
|
+
reveal?: {
|
|
2594
|
+
day: string;
|
|
2595
|
+
} | null;
|
|
2596
|
+
/** What goes in the header's corner, above the labels column (zoom buttons, say). */
|
|
2597
|
+
corner?: ReactNode;
|
|
2598
|
+
/** The label column for a record row. */
|
|
2599
|
+
renderLabel: (item: T) => ReactNode;
|
|
2600
|
+
/** Text inside a bar. */
|
|
2601
|
+
renderBar?: (item: T) => ReactNode;
|
|
2602
|
+
/** A card about a bar, shown while the pointer rests on it or it has keyboard focus (hidden while dragging). */
|
|
2603
|
+
renderCard?: (item: T) => ReactNode;
|
|
2604
|
+
/** What a bar says to screen readers: "PAY-3 Checkout, 1 to 14 June". */
|
|
2605
|
+
describe: (item: T) => string;
|
|
2606
|
+
/** Header ticks: the label for a day that starts a period (a month, or a week at finer zoom). */
|
|
2607
|
+
tick: (day: string) => string | null;
|
|
2608
|
+
/** A second header row under the ticks: a label centred on each day that has one (its number, at the finest zoom). */
|
|
2609
|
+
subTick?: (day: string) => string | null;
|
|
2610
|
+
/** A move: dragging the bar moves both ends, its right edge moves the end. Arrow keys move a focused bar a day; Shift+arrows its end. */
|
|
2611
|
+
onMove: (item: T, start: string, end: string) => void;
|
|
2612
|
+
/** A new dependency, drawn by dragging the dot at a bar's end onto another bar: `to` depends on `from`. */
|
|
2613
|
+
onLink?: (from: T, to: T) => void;
|
|
2614
|
+
/** Removing a dependency, from the menu its arrow opens. */
|
|
2615
|
+
onUnlink?: (link: {
|
|
2616
|
+
from: string;
|
|
2617
|
+
to: string;
|
|
2618
|
+
}) => void;
|
|
2619
|
+
/** The words for drawing and removing dependencies: the dot's name, an arrow's ("PAY-2 depends on PAY-1"), the remove button. */
|
|
2620
|
+
linkTexts?: {
|
|
2621
|
+
handle: string;
|
|
2622
|
+
arrow: (from: string, to: string) => string;
|
|
2623
|
+
remove: string;
|
|
2624
|
+
};
|
|
2625
|
+
labelWidth?: number;
|
|
2626
|
+
rowHeight?: number;
|
|
2627
|
+
instructions?: string;
|
|
2628
|
+
/** Its rows are coming (ADR 0061): `skeletonRows` rows of placeholders, each a row's height. The nearest `Loading` scope's when not given. */
|
|
2629
|
+
loading?: boolean;
|
|
2630
|
+
/** How many placeholder rows it draws while it loads (6). */
|
|
2631
|
+
skeletonRows?: number;
|
|
2632
|
+
}
|
|
2633
|
+
/**
|
|
2634
|
+
* A timeline (ADR 0027): one row per record, its bar from start to end on a day axis, group headings, and dependency
|
|
2635
|
+
* arrows. Bars move by dragging (both ends) or by their right edge (the end), and from the keyboard; the chart only
|
|
2636
|
+
* reports the move. Horizontal scrolling keeps the label column in place.
|
|
2637
|
+
*/
|
|
2638
|
+
declare function TimelineChart<T extends TimelineItem>({ 'aria-label': ariaLabel, from, to, dayWidth, fill, rows, links, today, bands, markers, offDays, onZoom, reveal, corner, renderLabel, renderBar, renderCard, describe, tick, subTick, onMove, onLink, onUnlink, linkTexts, labelWidth, rowHeight, instructions, loading: own, skeletonRows, }: TimelineChartProps<T>): react.JSX.Element;
|
|
2639
|
+
|
|
2640
|
+
type TimelineScale = 'day' | 'week' | 'month';
|
|
2641
|
+
/** A record the card timeline places: its due day, and a start day when it spans a range. */
|
|
2642
|
+
interface TimelineCardItem {
|
|
2643
|
+
id: string;
|
|
2644
|
+
start?: string | null;
|
|
2645
|
+
due: string;
|
|
2646
|
+
}
|
|
2647
|
+
interface TimelineCardsProps<T extends TimelineCardItem> {
|
|
2648
|
+
'aria-label': string;
|
|
2649
|
+
scale: TimelineScale;
|
|
2650
|
+
/** The period's days, in order (one for a day). */
|
|
2651
|
+
days: string[];
|
|
2652
|
+
today: string;
|
|
2653
|
+
items: T[];
|
|
2654
|
+
/** A day's head: its short weekday and its number. */
|
|
2655
|
+
weekday: (day: string) => string;
|
|
2656
|
+
dayLabel: (day: string) => string;
|
|
2657
|
+
/** The card's inside: title, then a line of who and which. */
|
|
2658
|
+
renderCard: (item: T, place: {
|
|
2659
|
+
range: boolean;
|
|
2660
|
+
}) => ReactNode;
|
|
2661
|
+
/** The colour of the card's edge (a status category's), as a token. */
|
|
2662
|
+
accent?: (item: T) => string;
|
|
2663
|
+
/** What the card says to assistive tech. */
|
|
2664
|
+
describe: (item: T) => string;
|
|
2665
|
+
/** The hover card: the record's details. */
|
|
2666
|
+
details?: (item: T) => ReactNode;
|
|
2667
|
+
onOpen: (item: T) => void;
|
|
2668
|
+
/** D, W and M change the scale while focus is in the timeline. */
|
|
2669
|
+
onScale?: (scale: TimelineScale) => void;
|
|
2670
|
+
/** Shown in place of the lanes when nothing falls in the period. */
|
|
2671
|
+
empty?: ReactNode;
|
|
2672
|
+
/** Under the lanes (creating a record in place). */
|
|
2673
|
+
footer?: ReactNode;
|
|
2674
|
+
/** Its records are coming (ADR 0061): placeholder cards in a few lanes. The nearest `Loading` scope's when not given. */
|
|
2675
|
+
loading?: boolean;
|
|
2676
|
+
}
|
|
2677
|
+
/**
|
|
2678
|
+
* The card timeline (UI round 9, step 48; the design canvas's Timeline): one day, week or month of records as cards on
|
|
2679
|
+
* their real dates, packed into lanes over day columns, with a today line. A card spans from its start to its due day
|
|
2680
|
+
* when it has both; else it sits on its due day. A day is a grid of its cards. Start and end follow the reading direction.
|
|
2681
|
+
* The bar chart with groups, zoom and links is the Gantt (`TimelineChart`).
|
|
2682
|
+
*/
|
|
2683
|
+
declare function TimelineCards<T extends TimelineCardItem>(props: TimelineCardsProps<T>): react.JSX.Element;
|
|
2684
|
+
|
|
2685
|
+
/**
|
|
2686
|
+
* Where the card timeline (UI round 9, step 48) puts each record: one period (a week or a month) of day columns, a card
|
|
2687
|
+
* per record on its real dates, packed into lanes. A record with a start date before its due date spans the two; a record
|
|
2688
|
+
* with only a due date starts on that day (or ends on it when it would run past the period). Cards are never moved to
|
|
2689
|
+
* other dates. Lanes are packed first-fit in date order with room between cards, for the canvas's staggered rhythm.
|
|
2690
|
+
*/
|
|
2691
|
+
interface CardDates {
|
|
2692
|
+
id: string;
|
|
2693
|
+
/** ISO day the record starts, when it has one. Ignored when after `due`. */
|
|
2694
|
+
start?: string | null;
|
|
2695
|
+
/** ISO day the record is due. */
|
|
2696
|
+
due: string;
|
|
2697
|
+
}
|
|
2698
|
+
interface PlacedCard {
|
|
2699
|
+
id: string;
|
|
2700
|
+
/** From the grid's start edge, px. */
|
|
2701
|
+
offset: number;
|
|
2702
|
+
width: number;
|
|
2703
|
+
lane: number;
|
|
2704
|
+
/** Spans a start to a due date. */
|
|
2705
|
+
range: boolean;
|
|
2706
|
+
/** The range starts before the period (its start edge is cut). */
|
|
2707
|
+
cutStart: boolean;
|
|
2708
|
+
/** The range ends after the period. */
|
|
2709
|
+
cutEnd: boolean;
|
|
2710
|
+
}
|
|
2711
|
+
/**
|
|
2712
|
+
* Places the records that fall in the period (`first`, `days` long) and packs them into lanes. Records due before the
|
|
2713
|
+
* period, or starting after it, are left out. Returns the cards in lane order and how many lanes there are.
|
|
2714
|
+
*/
|
|
2715
|
+
declare function placeCards(items: CardDates[], first: string, days: number, scale: 'week' | 'month', colW?: number): {
|
|
2716
|
+
cards: PlacedCard[];
|
|
2717
|
+
lanes: number;
|
|
2718
|
+
};
|
|
2719
|
+
|
|
2720
|
+
interface TooltipProps extends Omit<Tooltip$1.RootProps, 'children'> {
|
|
2721
|
+
content: ReactNode;
|
|
2722
|
+
children: ReactElement;
|
|
2723
|
+
/** Render nothing extra when true (keeps call sites simple). */
|
|
2724
|
+
disabled?: boolean;
|
|
2725
|
+
/** Kept in place but never shown: for a tooltip that comes and goes with a state, so its trigger isn't remounted. */
|
|
2726
|
+
inactive?: boolean;
|
|
2727
|
+
}
|
|
2728
|
+
/**
|
|
2729
|
+
* Short helper text on hover and focus: after 400 ms of hover, at once on keyboard focus (v12). Never the only place
|
|
2730
|
+
* important information lives.
|
|
2731
|
+
*/
|
|
2732
|
+
declare const Tooltip: react.ForwardRefExoticComponent<TooltipProps & react.RefAttributes<HTMLDivElement>>;
|
|
2733
|
+
|
|
2734
|
+
export { ABP_UI_VERSION, AbpApiError, type AbpBrand, type AbpHost, type AbpLabels, AbpProvider, type AbpProviderProps, type AbpSystemOptions, type ApiQuery, AppLink, type AppLinkProps, AppShell, type AppShellBrand, type AppShellNavItem, type AppShellNavSection, type AppShellPlace, type AppShellProps, type AppShellSidebar, type AreaTexts, type Arrival, ArriveOnChange, type ArriveOnChangeProps, AttentionChip, type AttentionChipProps, type AvatarPerson, AvatarStack, type AvatarStackProps, Bone, type BoneProps, type BreadcrumbItem, Breadcrumbs, Button, type ButtonProps, type ButtonSize, type ButtonVariant, CalendarGrid, type CalendarGridProps, type CalendarItem, type CardDates, CategoryProgress, type CategoryProgressProps, type CelebrateTarget, Chart, type ChartProps, type ChartSeries, CheckboxField, type CheckboxFieldProps, Collapse, type CollapseProps, type ColorMode, ColorModeProvider, ColorModeToggle, type CommandGroup, type CommandItem, CommandPalette, type CommandPaletteProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmOptions, ConfirmProvider, CountBadge, type CountBadgeProps, Counter, type CounterProps, DashboardGrid, type DashboardGridProps, DataTable, type DataTableColumn, type DataTableProps, type DataTableSelection, type DataTableSort, type Direction, DirectionalIcon, DropHint, type DropHintProps, type DropZoneOptions, type DropZoneState, type DroppedFile, EMPTY_VALUE, EmptyState, type EmptyStateProps, FadeIn, type FadeInProps, Field, type FieldProps, FileDropArea, type FileDropAreaProps, FormDialog, type FormDialogProps, FormField, type GridItem, HighlightText, type HostEventHandler, type HostEvents, type HostFile, type HostLanguage, HostProvider, type HostRequest, type HostRequestInit, type HostRequestOptions, type HostScope, HostSlot, IconButton, type IconButtonProps, IconTile, type IconTileProps, Indicator, type IndicatorProps, InlineAlert, type InlineAlertProps, KanbanBoard, type KanbanBoardProps, type KanbanColumn, type KanbanItem, type KanbanLane, type KanbanMove, type LinkComponent, Loading, type LoadingProps, LoadingState, MotionProvider, type MotionSetting, type MotionState, Nudge, type NudgeProps, PageHeader, type PageHeaderProps, PageTitleProvider, Pagination, type PaginationProps, Panel, type PanelProps, PanelTone, type Particle, PathChips, type PathChipsProps, PersonChip, type PersonChipProps, type PlacedCard, PluginTextsProvider, type Pose, Presence, PresenceItem, type PresenceItemProps, PresenceList, type PresenceListProps, type PresenceProps, Pressable, type PressableProps, PriorityMark, type PriorityMarkProps, type PropertyItem, PropertyList, type PropertyListProps, type QueryConditionJson, type QueryExportFormat, type QueryField, type QueryGroup, type QueryJson, type QueryListLabels, type QueryNodeJson, type QueryRow, type QuerySuggestion, type QuerySuggestions, type QueryValueEditor, QueryableList, type QueryableListError, type QueryableListExport, type QueryableListProps, type QueryableListState, type QueryableListView, type QueueProgress, RecordKey, type RecordKeyProps, type RegisterSlotSave, Reveal, RevealItem, type RevealItemProps, type RevealProps, SHOWN, STEP_UP_REQUIRED, type Scale, SearchInput, type SearchInputProps, type SectionMove, SegmentedControl, type SegmentedControlProps, type SegmentedItem, SelectField, type SelectFieldProps, type SelectOption, type SettingsArea, SettingsLayout, type SettingsLayoutProps, type SettingsPage, type SettingsSection, SlideItem, type SlideItemProps, SlideList, type SlideListProps, type SlotSave, type SortDirection, type SortableSection, SortableSections, type SortableSectionsProps, type StatusCategory, StatusPill, type StatusPillProps, type StatusTone, Swap, type SwapProps, SwitchField, type SwitchFieldProps, TITLE_SEPARATOR, TextBone, type TextBoneProps, TextSlot, type TextSlotProps, type TimelineCardItem, TimelineCards, type TimelineCardsProps, TimelineChart, type TimelineChartProps, type TimelineItem, type TimelineRow, type TimelineScale, type TitleParts, Toaster, Tooltip, type TooltipProps, UPLOADS_AT_ONCE, type UploadJob, UploadList, type UploadListProps, type UploadRow, type UploadState, abpConfig, arriveCss, asMotionSetting, avatarPalette, basicConditions, boneWidth, burst, compactLayout, compareOrdinal, composeTitle, covers, createAbpSystem, createAreaTexts, createHostEvents, createHostRequest, curves, defaultBrand, defaultLabels, defaultQueryListLabels, directionOf, droppedFiles, errorText, fileNameOf, findSettingsPage, folderOf, foldersFor, formatDateTime, formatMessage, formatNumber, ghostCss, groupKey, heavierFirst, hiddenPose, inSections, isStepUp, durations as motionDurations, notify, pageList, partsOf, pastedName, placeCards, placeItem, priorityLevel, progressOf, readAbpError, readEvents, refusal, settingsArea, shineCss, springs, staggerDelay, targetOf, toStart, toaster, useAbpLabels, useAbpLocale, useAbpTimeZone, useApiAction, useApiDownload, useApiQuery, useAreaEvents, useAreaRequest, useArriving, useCan, useCelebrate, useColorMode, useConfirm, useDropZone, useFilesOverPage, useFormatters, useHost, useHostLanguages, useLinkComponent, useLoading, useMe, useMotionSetting, useNames, useNavigate, useOptionalHost, usePageDrop, usePageTitle, usePageTitleParts, usePageTitleSite, usePastedFiles, usePluginTexts, useProductName, useSlotSaves, useTokenVar };
|