nish-ui 1.9.0 → 2.0.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/README.md +218 -58
- package/dist/base-tailwind.css +1757 -0
- package/dist/base.css +1590 -1445
- package/dist/chart.d.ts +4 -1
- package/dist/chart.js +122 -49
- package/dist/elements-all.d.ts +8 -0
- package/dist/elements-all.js +178 -0
- package/dist/elements-charts.d.ts +71 -0
- package/dist/elements-charts.js +56 -57
- package/dist/elements-data.d.ts +71 -0
- package/dist/elements-data.js +5 -6
- package/dist/elements-forms.d.ts +71 -0
- package/dist/elements-forms.js +24 -25
- package/dist/elements.d.ts +71 -0
- package/dist/elements.js +4 -5
- package/dist/esm/chart-values.js +58 -0
- package/dist/esm/chart.js +10 -0
- package/dist/esm/cn.js +19 -0
- package/dist/esm/combobox-filter.js +13 -0
- package/dist/esm/components/accordion.js +166 -0
- package/dist/esm/components/app-shell.js +198 -0
- package/dist/esm/components/avatar-classes.js +28 -0
- package/dist/esm/components/avatar.js +113 -0
- package/dist/esm/components/breadcrumbs.js +154 -0
- package/dist/esm/components/canvas/follow-caption.js +32 -0
- package/dist/esm/components/canvas/follow.js +119 -0
- package/dist/esm/components/canvas/icons.js +70 -0
- package/dist/esm/components/canvas/index.js +10 -0
- package/dist/esm/components/canvas/layout.js +258 -0
- package/dist/esm/components/canvas/legend.js +93 -0
- package/dist/esm/components/canvas/minimap.js +127 -0
- package/dist/esm/components/canvas/node.js +87 -0
- package/dist/esm/components/canvas/route.js +262 -0
- package/dist/esm/components/canvas/system-canvas.js +837 -0
- package/dist/esm/components/canvas/types.js +10 -0
- package/dist/esm/components/canvas/view.js +47 -0
- package/dist/esm/components/chart-hooks.js +19 -0
- package/dist/esm/components/charts.js +467 -0
- package/dist/esm/components/client.js +24 -0
- package/dist/esm/components/combobox.js +343 -0
- package/dist/esm/components/command.js +403 -0
- package/dist/esm/components/data-classes.js +159 -0
- package/dist/esm/components/data.js +517 -0
- package/dist/esm/components/display-classes.js +130 -0
- package/dist/esm/components/display.js +755 -0
- package/dist/esm/components/error-boundary.js +64 -0
- package/dist/esm/components/feedback.js +136 -0
- package/dist/esm/components/file-dropzone.js +184 -0
- package/dist/esm/components/filters.js +108 -0
- package/dist/esm/components/flow.js +746 -0
- package/dist/esm/components/forms-classes.js +43 -0
- package/dist/esm/components/forms.js +581 -0
- package/dist/esm/components/hooks-classes.js +9 -0
- package/dist/esm/components/hooks.js +236 -0
- package/dist/esm/components/icons.js +96 -0
- package/dist/esm/components/inbox-classes.js +29 -0
- package/dist/esm/components/inbox.js +257 -0
- package/dist/esm/components/latest.js +13 -0
- package/dist/esm/components/layout-vars.js +96 -0
- package/dist/esm/components/layout.js +272 -0
- package/dist/esm/components/media.js +143 -0
- package/dist/esm/components/nav.js +614 -0
- package/dist/esm/components/overlay-classes.js +66 -0
- package/dist/esm/components/overlay.js +1461 -0
- package/dist/esm/components/pagination-classes.js +29 -0
- package/dist/esm/components/pagination.js +154 -0
- package/dist/esm/components/portal.js +16 -0
- package/dist/esm/components/primitives-classes.js +198 -0
- package/dist/esm/components/primitives.js +268 -0
- package/dist/esm/components/progress.js +77 -0
- package/dist/esm/components/provider.js +32 -0
- package/dist/esm/components/radio-group.js +186 -0
- package/dist/esm/components/resource-classes.js +133 -0
- package/dist/esm/components/resource.js +209 -0
- package/dist/esm/components/segmented.js +178 -0
- package/dist/esm/components/separator.js +38 -0
- package/dist/esm/components/service-tokens.js +221 -0
- package/dist/esm/components/settings.js +301 -0
- package/dist/esm/components/slider.js +262 -0
- package/dist/esm/components/split-classes.js +8 -0
- package/dist/esm/components/split.js +411 -0
- package/dist/esm/components/strings.js +119 -0
- package/dist/esm/components/table.js +144 -0
- package/dist/esm/components/tabs-classes.js +21 -0
- package/dist/esm/components/tabs.js +201 -0
- package/dist/esm/components/tag-input.js +257 -0
- package/dist/esm/components/theme-toggle.js +177 -0
- package/dist/esm/components/toast.js +361 -0
- package/dist/esm/components/url-state.js +118 -0
- package/dist/esm/components/visually-hidden.js +20 -0
- package/dist/esm/format.js +320 -0
- package/dist/esm/inbox-client.js +2 -0
- package/dist/esm/inbox-types.js +2 -0
- package/dist/esm/index.js +320 -0
- package/dist/esm/runtime.js +37 -0
- package/dist/esm/server/inbox/client.js +297 -0
- package/dist/esm/server/inbox/types.js +24 -0
- package/dist/esm/sparkline-path.js +59 -0
- package/dist/esm/split-layout.js +419 -0
- package/dist/esm/system-canvas.js +2 -0
- package/dist/esm/theme.js +804 -0
- package/dist/esm/tokens.mjs +425 -0
- package/dist/esm/url.js +20 -0
- package/dist/files.json +5 -1
- package/dist/fonts/LICENSE-Inter.txt +93 -0
- package/dist/format.d.ts +32 -18
- package/dist/format.js +227 -82
- package/dist/inbox-client.js +3 -1
- package/dist/index.d.ts +1686 -667
- package/dist/nish-components.css +4649 -4506
- package/dist/nish-components.min.css +1 -0
- package/dist/nish.css +1603 -1450
- package/dist/nish.min.css +1 -0
- package/dist/node/eslint.js +29 -14
- package/dist/node/th-check.js +29 -14
- package/dist/node/vite.d.ts +12 -0
- package/dist/node/vite.js +12 -2
- package/dist/server/hono.d.ts +15 -6
- package/dist/server/hono.js +30 -25
- package/dist/server/index.d.ts +3 -10
- package/dist/server/index.js +71 -38
- package/dist/{spa-DuVB5O7S.d.ts → spa-BLlMc0eI.d.ts} +38 -5
- package/dist/system-canvas-BLuWd69H.d.ts +183 -0
- package/dist/system-canvas.d.ts +2 -168
- package/dist/tailwind-core.css +114 -0
- package/dist/tailwind.css +3 -7
- package/dist/theme-init.js +23 -9
- package/dist/theme-init.sha256 +1 -0
- package/dist/theme.d.ts +243 -4
- package/dist/theme.global.js +356 -89
- package/dist/theme.js +337 -67
- package/dist/tokens.css +14 -6
- package/dist/tokens.dtcg.json +1513 -0
- package/dist/tokens.js +29 -14
- package/dist/tokens.json +512 -0
- package/package.json +51 -13
- package/dist/chart.js.map +0 -1
- package/dist/elements-charts.js.map +0 -1
- package/dist/elements-data.js.map +0 -1
- package/dist/elements-forms.js.map +0 -1
- package/dist/elements.js.map +0 -1
- package/dist/format.js.map +0 -1
- package/dist/inbox-client.js.map +0 -1
- package/dist/index.js +0 -10260
- package/dist/index.js.map +0 -1
- package/dist/server/hono.js.map +0 -1
- package/dist/server/index.js.map +0 -1
- package/dist/split-layout.js.map +0 -1
- package/dist/system-canvas.js +0 -2204
- package/dist/system-canvas.js.map +0 -1
- package/dist/theme.global.js.map +0 -1
- package/dist/theme.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { HTMLAttributes,
|
|
4
|
-
export { SystemCanvas, layoutSystem, pickLayout, routeEdges } from './system-canvas.js';
|
|
3
|
+
import { ReactNode, useLayoutEffect, HTMLAttributes, Ref, ButtonHTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes, FieldsetHTMLAttributes, ChangeEvent, MouseEvent, TextareaHTMLAttributes, ComponentPropsWithoutRef, ReactElement, RefObject, ComponentProps, ElementType, ComponentPropsWithRef, SVGProps } from 'react';
|
|
4
|
+
export { C as CanvasEdge, a as CanvasEdgeKind, b as CanvasGroup, c as CanvasHue, d as CanvasLabels, e as CanvasLayout, f as CanvasLayoutMode, g as CanvasNode, h as CanvasNodeKind, D as DEFAULT_CANVAS_LABELS, L as LayoutOptions, R as RoutedEdge, S as SystemCanvas, i as SystemCanvasProps, l as layoutSystem, p as pickLayout, r as routeEdges } from './system-canvas-BLuWd69H.js';
|
|
5
5
|
|
|
6
6
|
/** Conditional Tailwind classes with conflict resolution. */
|
|
7
7
|
declare function cn(...inputs: ClassValue[]): string;
|
|
8
8
|
|
|
9
|
+
/** The version of this copy: injected by the build, `dev` in source. */
|
|
10
|
+
declare const VERSION: string;
|
|
11
|
+
|
|
12
|
+
/** href for user-supplied links: relative URLs, #fragments, http(s), mailto and tel pass;
|
|
13
|
+
* anything else (javascript:, data:, vbscript:, file:) returns null. Trims leading and trailing
|
|
14
|
+
* C0 controls and spaces and drops tabs and newlines the way the WHATWG URL parser does, then
|
|
15
|
+
* reads the scheme from the very string that is returned. Other Unicode whitespace (NBSP, U+FEFF,
|
|
16
|
+
* U+2028, U+3000) is not stripped by browsers, so it is kept, and a scheme hidden behind it is
|
|
17
|
+
* not a scheme there either. */
|
|
18
|
+
declare function safeUrl(href: string | null | undefined): string | null;
|
|
19
|
+
|
|
9
20
|
type Scheme = 'dark' | 'light';
|
|
10
21
|
interface ThemeDef {
|
|
11
22
|
label: string;
|
|
@@ -24,6 +35,236 @@ declare const DEFAULT_THEME: 'dark';
|
|
|
24
35
|
declare const SCALE: Record<string, string>;
|
|
25
36
|
declare const SHADOWS: Record<'card' | 'pop' | 'modal', string>;
|
|
26
37
|
|
|
38
|
+
interface NishStrings {
|
|
39
|
+
/** Modal, Drawer, SheetHandle, CommandPalette: close button label. */
|
|
40
|
+
close: string;
|
|
41
|
+
/** ConfirmDialog, service-tokens revoke dialog: cancel button. */
|
|
42
|
+
cancel: string;
|
|
43
|
+
/** DropdownMenu: sheet title on phones. */
|
|
44
|
+
menu: string;
|
|
45
|
+
/** DropdownMenu sub-menu header, read by screen readers before the parent label. */
|
|
46
|
+
back: string;
|
|
47
|
+
/** Toast, Callout: dismiss button. */
|
|
48
|
+
dismiss: string;
|
|
49
|
+
/** Callout: badge label for a repeat count. */
|
|
50
|
+
moreCount: (count: number) => string;
|
|
51
|
+
/** CopyButton: idle label. */
|
|
52
|
+
copy: string;
|
|
53
|
+
/** CopyButton: label after copying. */
|
|
54
|
+
copied: string;
|
|
55
|
+
/** AppHeader: hub pill title. */
|
|
56
|
+
hubTitle: string;
|
|
57
|
+
/** AppHeader: hub pill text. */
|
|
58
|
+
hubLabel: string;
|
|
59
|
+
/** AppHeader: overflow kebab. */
|
|
60
|
+
moreActions: string;
|
|
61
|
+
/** BottomNav, MoreSheet, AppShell: the More tab and sheet title. */
|
|
62
|
+
more: string;
|
|
63
|
+
/** ChartLegend, LineChart: legend landmark. */
|
|
64
|
+
legend: string;
|
|
65
|
+
/** Field, FieldGroup: tag for a non-required field. */
|
|
66
|
+
optional: string;
|
|
67
|
+
/** SearchInput, FilterBar, CommandPalette: input placeholder and aria fallback. */
|
|
68
|
+
search: string;
|
|
69
|
+
/** SearchInput: clear button. */
|
|
70
|
+
clearSearch: string;
|
|
71
|
+
/** Chip: remove button without a name. */
|
|
72
|
+
remove: string;
|
|
73
|
+
/** Chip: remove button for a named chip. */
|
|
74
|
+
removeNamed: (name: string) => string;
|
|
75
|
+
/** Combobox, CommandPalette: empty list. */
|
|
76
|
+
noMatches: string;
|
|
77
|
+
/** Combobox, FilterBar, FilterSheet: clear button. */
|
|
78
|
+
clear: string;
|
|
79
|
+
/** Combobox: loading row. */
|
|
80
|
+
searching: string;
|
|
81
|
+
/** CommandPalette: input placeholder. */
|
|
82
|
+
searchPlaceholder: string;
|
|
83
|
+
/** CommandPalette: nothing found. */
|
|
84
|
+
noResults: string;
|
|
85
|
+
/** CommandPalette: listbox label. */
|
|
86
|
+
results: string;
|
|
87
|
+
/** Spinner, Skeleton, SkeletonRows, SkeletonCard, LoadingBar, Progress: announced loading state. */
|
|
88
|
+
loading: string;
|
|
89
|
+
/** ErrorState, AsyncPanel: default message. */
|
|
90
|
+
failedToLoad: string;
|
|
91
|
+
/** ErrorState, ConnectionBanner: retry button. */
|
|
92
|
+
retry: string;
|
|
93
|
+
/** StickyActionBar: landmark label. */
|
|
94
|
+
actions: string;
|
|
95
|
+
/** ConnectionBanner: offline message. */
|
|
96
|
+
offline: string;
|
|
97
|
+
/** ResponsiveTable, AsyncPanel: empty state. */
|
|
98
|
+
nothingHere: string;
|
|
99
|
+
/** ResponsiveTable: skeleton label. */
|
|
100
|
+
loadingNamed: (label: string) => string;
|
|
101
|
+
/** ResponsiveTable: phone sort select label. */
|
|
102
|
+
sortBy: string;
|
|
103
|
+
/** ResponsiveTable: phone sort default option. */
|
|
104
|
+
sortDefault: string;
|
|
105
|
+
/** LineChart, BarChart: empty text. */
|
|
106
|
+
noData: string;
|
|
107
|
+
/** LineChart, BarChart: aria label of an empty chart. */
|
|
108
|
+
noDataNamed: (label: string) => string;
|
|
109
|
+
/** FilterBar, FilterSheet: title. */
|
|
110
|
+
filters: string;
|
|
111
|
+
/** FilterBar: clear all filters. */
|
|
112
|
+
clearFilters: string;
|
|
113
|
+
/** FilterSheet: result button. */
|
|
114
|
+
done: string;
|
|
115
|
+
/** FilterBar: badge aria label. */
|
|
116
|
+
activeCount: (n: number) => string;
|
|
117
|
+
/** Nav badges: aria label. */
|
|
118
|
+
newCount: (value: string | number) => string;
|
|
119
|
+
/** BottomNav, NavRail, SectionNav: landmark. */
|
|
120
|
+
sections: string;
|
|
121
|
+
/** MoreSheet: theme row. */
|
|
122
|
+
theme: string;
|
|
123
|
+
/** NavRail: sidebar landmark. */
|
|
124
|
+
sidebar: string;
|
|
125
|
+
/** NavRail: expand button. */
|
|
126
|
+
expandSidebar: string;
|
|
127
|
+
/** NavRail: collapse button. */
|
|
128
|
+
collapseSidebar: string;
|
|
129
|
+
/** AppShell: skip link. */
|
|
130
|
+
skipToContent: string;
|
|
131
|
+
/** ThemeToggle: name of the system mode. */
|
|
132
|
+
themeSystem: string;
|
|
133
|
+
/** ThemeToggle: name of the light mode. */
|
|
134
|
+
themeLight: string;
|
|
135
|
+
/** ThemeToggle: name of the dark mode. */
|
|
136
|
+
themeDark: string;
|
|
137
|
+
/** ThemeToggle: button label for the current and next mode. */
|
|
138
|
+
themeToggleLabel: (current: string, next: string) => string;
|
|
139
|
+
/** ThemeToggle: preset select aria label. */
|
|
140
|
+
themePreset: string;
|
|
141
|
+
/** ThemeToggle: preset select placeholder. */
|
|
142
|
+
themePresetPlaceholder: string;
|
|
143
|
+
/** AppErrorBoundary: title when a new version is deployed. */
|
|
144
|
+
errorStaleTitle: string;
|
|
145
|
+
/** AppErrorBoundary: body when a new version is deployed. */
|
|
146
|
+
errorStaleBody: string;
|
|
147
|
+
/** AppErrorBoundary: title. */
|
|
148
|
+
errorTitle: string;
|
|
149
|
+
/** AppErrorBoundary: body when the error has no message. */
|
|
150
|
+
errorBody: string;
|
|
151
|
+
/** AppErrorBoundary: stack summary. */
|
|
152
|
+
errorDetails: string;
|
|
153
|
+
/** AppErrorBoundary: reset button. */
|
|
154
|
+
errorTryAgain: string;
|
|
155
|
+
/** AppErrorBoundary: reload button. */
|
|
156
|
+
errorReload: string;
|
|
157
|
+
/** useSaveStatus, SettingRow: saving. */
|
|
158
|
+
saving: string;
|
|
159
|
+
/** useSaveStatus, SettingRow: saved. */
|
|
160
|
+
saved: string;
|
|
161
|
+
/** useSaveStatus, SettingRow: failed with no message. */
|
|
162
|
+
saveFailed: string;
|
|
163
|
+
/** NumberField: validation message. */
|
|
164
|
+
enterNumber: string;
|
|
165
|
+
/** SplitDividers: column divider label. */
|
|
166
|
+
resizeColumns: string;
|
|
167
|
+
/** SplitDividers: row divider label. */
|
|
168
|
+
resizeRows: string;
|
|
169
|
+
/** LayoutPresetPicker: group label. */
|
|
170
|
+
layoutPresets: string;
|
|
171
|
+
/** MediaRow: live badge. */
|
|
172
|
+
live: string;
|
|
173
|
+
/** MediaRow: offline badge. */
|
|
174
|
+
offlineBadge: string;
|
|
175
|
+
/** FlowSteps: group label. */
|
|
176
|
+
progress: string;
|
|
177
|
+
/** WorkflowBoard: group label. */
|
|
178
|
+
workflow: string;
|
|
179
|
+
/** ActivityFeed: group label. */
|
|
180
|
+
activity: string;
|
|
181
|
+
/** WorkflowBoard: catch-all column. */
|
|
182
|
+
other: string;
|
|
183
|
+
/** WorkflowBoard: waiting column. */
|
|
184
|
+
waiting: string;
|
|
185
|
+
/** ActivityFeed: empty text. */
|
|
186
|
+
noActivity: string;
|
|
187
|
+
/** SystemCanvas: region label. */
|
|
188
|
+
systemMap: string;
|
|
189
|
+
/** SystemCanvas: zoom out button. */
|
|
190
|
+
zoomOut: string;
|
|
191
|
+
/** SystemCanvas: zoom in button. */
|
|
192
|
+
zoomIn: string;
|
|
193
|
+
/** SystemCanvas: fit button. */
|
|
194
|
+
fitToScreen: string;
|
|
195
|
+
/** SystemCanvas: follow button. */
|
|
196
|
+
followActivity: string;
|
|
197
|
+
/** SystemCanvas legend: menu label. */
|
|
198
|
+
canvasLines: string;
|
|
199
|
+
/** ServiceTokens: title. */
|
|
200
|
+
serviceTokens: string;
|
|
201
|
+
/** ServiceTokens: intro text. */
|
|
202
|
+
serviceTokensIntro: string;
|
|
203
|
+
/** ServiceTokens: loading label. */
|
|
204
|
+
loadingServiceTokens: string;
|
|
205
|
+
/** ServiceTokens: revoke button and confirm label. */
|
|
206
|
+
tokenRevoke: string;
|
|
207
|
+
/** ServiceTokens: revoked tag. */
|
|
208
|
+
tokenRevoked: string;
|
|
209
|
+
/** ServiceTokens: revoked tag title with a time. */
|
|
210
|
+
tokenRevokedAt: (when: string) => string;
|
|
211
|
+
/** ServiceTokens: revoke button aria label. */
|
|
212
|
+
tokenRevokeNamed: (name: string) => string;
|
|
213
|
+
/** ServiceTokens: confirm dialog title. */
|
|
214
|
+
tokenRevokeTitle: (name: string) => string;
|
|
215
|
+
/** ServiceTokens: revoke failure with no message. */
|
|
216
|
+
tokenRevokeFailed: string;
|
|
217
|
+
/** Inbox: mark-handled action. */
|
|
218
|
+
inboxMarkHandled: string;
|
|
219
|
+
/** Inbox: snooze action. */
|
|
220
|
+
inboxSnooze: string;
|
|
221
|
+
/** Inbox: row actions menu. */
|
|
222
|
+
inboxActions: string;
|
|
223
|
+
/** Inbox: tab list label. */
|
|
224
|
+
inboxViews: string;
|
|
225
|
+
/** Inbox: Open tab. */
|
|
226
|
+
inboxOpen: string;
|
|
227
|
+
/** Inbox: Snoozed tab. */
|
|
228
|
+
inboxSnoozed: string;
|
|
229
|
+
/** Inbox: Handled tab. */
|
|
230
|
+
inboxHandled: string;
|
|
231
|
+
/** Inbox: source chip group label. */
|
|
232
|
+
inboxFilterBySource: string;
|
|
233
|
+
/** Inbox: repeat count aria label. */
|
|
234
|
+
inboxHappened: (count: number) => string;
|
|
235
|
+
/** Pagination: previous button. */
|
|
236
|
+
previousPage: string;
|
|
237
|
+
/** Pagination: next button. */
|
|
238
|
+
nextPage: string;
|
|
239
|
+
/** Pagination: page button aria label. */
|
|
240
|
+
pageLabel: (n: number) => string;
|
|
241
|
+
/** Pagination: nav landmark. */
|
|
242
|
+
paginationLabel: string;
|
|
243
|
+
/** Breadcrumbs: nav landmark. */
|
|
244
|
+
breadcrumbs: string;
|
|
245
|
+
/** TagInput: remove button aria label. */
|
|
246
|
+
removeTag: (tag: string) => string;
|
|
247
|
+
/** FileDropzone: drop area text. */
|
|
248
|
+
dropzoneLabel: string;
|
|
249
|
+
/** FileDropzone: browse button. */
|
|
250
|
+
browseFiles: string;
|
|
251
|
+
/** FileDropzone: remove button aria label. */
|
|
252
|
+
removeFile: (name: string) => string;
|
|
253
|
+
/** Avatar: fallback image label. */
|
|
254
|
+
avatar: string;
|
|
255
|
+
/** AvatarGroup: overflow badge aria label. */
|
|
256
|
+
avatarMore: (count: number) => string;
|
|
257
|
+
/** Slider: minimum thumb label on a range. */
|
|
258
|
+
sliderMin: string;
|
|
259
|
+
/** Slider: maximum thumb label on a range. */
|
|
260
|
+
sliderMax: string;
|
|
261
|
+
/** Accordion: group label. */
|
|
262
|
+
accordion: string;
|
|
263
|
+
/** Progress: label of an indeterminate bar. */
|
|
264
|
+
progressIndeterminate: string;
|
|
265
|
+
}
|
|
266
|
+
declare const DEFAULT_STRINGS: NishStrings;
|
|
267
|
+
|
|
27
268
|
/** Theme switching shared by every nish.software page.
|
|
28
269
|
*
|
|
29
270
|
* The choice ('system' or a theme name) lives in a `nish-theme` cookie on
|
|
@@ -44,6 +285,7 @@ interface ThemePreset {
|
|
|
44
285
|
colors: Record<string, string>;
|
|
45
286
|
}
|
|
46
287
|
declare const PRESETS: ThemePreset[];
|
|
288
|
+
type Listener = (choice: ThemeChoice, theme: ThemeName) => void;
|
|
47
289
|
/** Let an app offer its own themes next to the shared ones. Call it before
|
|
48
290
|
* initTheme(), and set the same map on window.__nishExtraThemes before theme-init.js
|
|
49
291
|
* runs, so the first paint knows them too. */
|
|
@@ -60,7 +302,6 @@ declare function applyTheme(choice?: ThemeChoice): ThemeName;
|
|
|
60
302
|
declare function setThemeChoice(choice: ThemeChoice): ThemeName;
|
|
61
303
|
/** Current value of a token on <html>, e.g. readToken('chart-1') for canvas charts. */
|
|
62
304
|
declare function readToken(name: string): string;
|
|
63
|
-
type Listener = (choice: ThemeChoice, theme: ThemeName) => void;
|
|
64
305
|
/** Subscribe to theme changes; returns an unsubscribe function. */
|
|
65
306
|
declare function onThemeChange(fn: Listener): () => void;
|
|
66
307
|
/** The order a one-button toggle steps through. */
|
|
@@ -74,6 +315,11 @@ interface MountThemeToggleOptions {
|
|
|
74
315
|
/** Replace the words "System", "Light" and "Dark" in the button's label, e.g. for
|
|
75
316
|
* another language. The label reads "Theme: Light. Switch to Dark". */
|
|
76
317
|
labels?: ThemeToggleLabels;
|
|
318
|
+
/** Replace the label sentence: `themeToggleLabel(current, next)`. Defaults to DEFAULT_STRINGS. */
|
|
319
|
+
strings?: Partial<Pick<NishStrings, 'themeToggleLabel'>>;
|
|
320
|
+
/** The words after a preset saved on another site: "Theme: Mocha (set on another site). …".
|
|
321
|
+
* Default "set on another site". */
|
|
322
|
+
elsewhereLabel?: string;
|
|
77
323
|
/** Also show the current choice as a word after the icon (System, Light, Dark, or a
|
|
78
324
|
* preset's name such as "Mocha" when one was saved on another site): a
|
|
79
325
|
* <span data-theme-word aria-hidden="true">, kept in sync on click and on theme
|
|
@@ -107,14 +353,17 @@ interface ShowToastOptions {
|
|
|
107
353
|
* user can reach a link inside it. */
|
|
108
354
|
duration?: number | 'sticky';
|
|
109
355
|
/** One text action after the message: a link (href) or a button (onClick). Clicking
|
|
110
|
-
* it hides the toast.
|
|
356
|
+
* it hides the toast. An href goes through safeUrl(): a javascript: or data: URL
|
|
357
|
+
* drops the action. */
|
|
111
358
|
action?: {
|
|
112
359
|
label: string;
|
|
113
360
|
href?: string;
|
|
114
361
|
onClick?: () => void;
|
|
115
362
|
};
|
|
116
|
-
/** Accessible name of the dismiss button. Default "Dismiss". */
|
|
363
|
+
/** Accessible name of the dismiss button. Default DEFAULT_STRINGS.dismiss ("Dismiss"). */
|
|
117
364
|
dismissLabel?: string;
|
|
365
|
+
/** Strings for this toast (another language): `dismiss`. `dismissLabel` wins when both are given. */
|
|
366
|
+
strings?: Partial<Pick<NishStrings, 'dismiss'>>;
|
|
118
367
|
}
|
|
119
368
|
/** Show one toast on a static page: a .nish-toast inside a single role="status"
|
|
120
369
|
* aria-live="polite" region (created on first use). A new toast replaces the one on
|
|
@@ -129,8 +378,10 @@ interface ConfirmDialogOptions {
|
|
|
129
378
|
body?: string | Node;
|
|
130
379
|
/** The confirm button's label: a verb that names the action. Default "Confirm". */
|
|
131
380
|
confirmLabel?: string;
|
|
132
|
-
/** The cancel button's label. Default "Cancel". */
|
|
381
|
+
/** The cancel button's label. Default DEFAULT_STRINGS.cancel ("Cancel"). */
|
|
133
382
|
cancelLabel?: string;
|
|
383
|
+
/** Strings for this dialog (another language): `cancel`. `cancelLabel` wins when both are given. */
|
|
384
|
+
strings?: Partial<Pick<NishStrings, 'cancel'>>;
|
|
134
385
|
/** danger: a red confirm button, and focus starts on Cancel (as in the React
|
|
135
386
|
* ConfirmDialog). Without it: an accent confirm button that takes the first focus. */
|
|
136
387
|
tone?: 'danger' | 'primary';
|
|
@@ -193,6 +444,63 @@ declare function mountChecklist(list: HTMLElement): () => void;
|
|
|
193
444
|
/** For pages without a framework: apply now and start syncing. */
|
|
194
445
|
declare function initTheme(): ThemeName;
|
|
195
446
|
|
|
447
|
+
/** Sets the locale every formatter uses when it is not given one. Default 'en-US'. */
|
|
448
|
+
declare function setDefaultLocale(locale: string): void;
|
|
449
|
+
/** The locale formatters use when not given one. */
|
|
450
|
+
declare function getDefaultLocale(): string;
|
|
451
|
+
/** Options every formatter accepts. */
|
|
452
|
+
interface LocaleOptions {
|
|
453
|
+
/** BCP 47 tag, e.g. 'de-DE'. Default getDefaultLocale() ('en-US'). */
|
|
454
|
+
locale?: string;
|
|
455
|
+
}
|
|
456
|
+
/** Options for the date formatters. */
|
|
457
|
+
interface DateOptions extends LocaleOptions {
|
|
458
|
+
/** IANA zone such as 'UTC'. Default the viewer's zone. A bare YYYY-MM-DD string is a calendar day and ignores it. */
|
|
459
|
+
timeZone?: string;
|
|
460
|
+
}
|
|
461
|
+
interface AgoOptions extends LocaleOptions {
|
|
462
|
+
now?: number;
|
|
463
|
+
style?: 'short' | 'long';
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
interface NishConfig {
|
|
467
|
+
strings: NishStrings;
|
|
468
|
+
locale?: string;
|
|
469
|
+
dir?: 'ltr' | 'rtl';
|
|
470
|
+
/** Where Portal renders. Default document.body. */
|
|
471
|
+
portalContainer?: HTMLElement | null;
|
|
472
|
+
}
|
|
473
|
+
interface NishProviderProps {
|
|
474
|
+
strings?: Partial<NishStrings>;
|
|
475
|
+
locale?: string;
|
|
476
|
+
dir?: 'ltr' | 'rtl';
|
|
477
|
+
portalContainer?: HTMLElement | null;
|
|
478
|
+
children: ReactNode;
|
|
479
|
+
}
|
|
480
|
+
/** Sets strings, locale, direction and the portal container once for everything below it.
|
|
481
|
+
* Nests: an inner provider overrides the outer one key by key. */
|
|
482
|
+
declare function NishProvider({ strings, locale, dir, portalContainer, children }: NishProviderProps): react.JSX.Element;
|
|
483
|
+
/** The current config; English defaults without a provider. */
|
|
484
|
+
declare function useNishConfig(): NishConfig;
|
|
485
|
+
/** The current strings; English defaults without a provider. */
|
|
486
|
+
declare function useNishStrings(): NishStrings;
|
|
487
|
+
|
|
488
|
+
interface PortalProps {
|
|
489
|
+
children: ReactNode;
|
|
490
|
+
/** Target element. Default: the provider's portalContainer, then document.body. */
|
|
491
|
+
container?: HTMLElement | null;
|
|
492
|
+
}
|
|
493
|
+
/** Renders children into `container`. Null on the server and in the first client render, so
|
|
494
|
+
* hydration matches; the portal mounts right after. */
|
|
495
|
+
declare function Portal({ children, container }: PortalProps): react.ReactPortal | null;
|
|
496
|
+
|
|
497
|
+
/** False on the server and in the first client render, true afterwards (no hydration mismatch). */
|
|
498
|
+
declare function useIsClient(): boolean;
|
|
499
|
+
/** useLayoutEffect in the browser, useEffect on the server (no SSR warning). */
|
|
500
|
+
declare const useIsoLayoutEffect: typeof useLayoutEffect;
|
|
501
|
+
/** True when the element is laid out right-to-left. False on the server or without an element. */
|
|
502
|
+
declare function isRtl(el: Element | null | undefined): boolean;
|
|
503
|
+
|
|
196
504
|
type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger' | 'soft' | 'subtle' | 'link';
|
|
197
505
|
type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
198
506
|
interface ButtonClassOptions {
|
|
@@ -222,28 +530,6 @@ declare function linkClass({ tone, inline, className }?: LinkClassOptions): stri
|
|
|
222
530
|
/** Classes that hide a row action until its row is hovered or focused, and always show
|
|
223
531
|
* it on touch screens (there is no hover). Put `group` on the row. */
|
|
224
532
|
declare function revealClass(className?: string): string;
|
|
225
|
-
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
226
|
-
/** primary: the one main action in a view. secondary: everything else. ghost:
|
|
227
|
-
* toolbars and quiet actions. danger: destructive actions. soft: an accent action
|
|
228
|
-
* that is not the main one (replaces "accent outline" buttons). subtle: a filled,
|
|
229
|
-
* quiet button for dense toolbars and chips on a surface. link: looks like a text
|
|
230
|
-
* link and sits inline in text (no height or padding; on touch screens an invisible
|
|
231
|
-
* 44px hit area, unless `inline`). */
|
|
232
|
-
variant?: ButtonVariant;
|
|
233
|
-
/** xs for dense tool rows (24px), sm for dense rows and toolbars, lg for a page's
|
|
234
|
-
* main call to action. xs, sm and md grow to 44px on touch screens. */
|
|
235
|
-
size?: ButtonSize;
|
|
236
|
-
/** Link variant only: skip the 44px touch hit area, for a link inside running text. */
|
|
237
|
-
inline?: boolean;
|
|
238
|
-
/** Shows a spinner and disables the button. */
|
|
239
|
-
loading?: boolean;
|
|
240
|
-
/** Icon before the label (16px for md and lg, 12–14px for xs and sm). Replaced by the
|
|
241
|
-
* spinner while loading. */
|
|
242
|
-
icon?: ReactNode;
|
|
243
|
-
}
|
|
244
|
-
/** The standard button. Defaults to type="button", so it never submits a form by
|
|
245
|
-
* accident; pass type="submit" for the one that should. */
|
|
246
|
-
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
247
533
|
type IconButtonSize = '2xs' | 'xs' | 'sm' | 'md';
|
|
248
534
|
type IconButtonVariant = 'ghost' | 'subtle' | 'soft';
|
|
249
535
|
interface IconButtonClassOptions {
|
|
@@ -261,23 +547,6 @@ interface IconButtonClassOptions {
|
|
|
261
547
|
/** The classes `<IconButton>` renders. Use it on an icon-only `<a>` or router `<Link>`,
|
|
262
548
|
* and give that element an aria-label. */
|
|
263
549
|
declare function iconButtonClass({ size, variant, tone, active, className, }?: IconButtonClassOptions): string;
|
|
264
|
-
interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
265
|
-
/** Required: an icon-only button needs a name for screen readers and tooltips. It is
|
|
266
|
-
* also the title, so tests that query by title keep working. */
|
|
267
|
-
label: string;
|
|
268
|
-
/** 2xs: 20px (row-level reveal actions, 22px widget title bars), xs: 24px (dense
|
|
269
|
-
* headers), sm: 28px, md: 36px. All grow to 44px on touch screens. */
|
|
270
|
-
size?: IconButtonSize;
|
|
271
|
-
/** Pressed state for toggles (sets aria-pressed). */
|
|
272
|
-
active?: boolean;
|
|
273
|
-
/** ghost: no fill until hover (default). subtle: a quiet filled square for toolbars on
|
|
274
|
-
* a surface. soft: an accent tint for the highlighted action. */
|
|
275
|
-
variant?: IconButtonVariant;
|
|
276
|
-
/** danger: hover and pressed turn loss-red, for delete and remove actions. */
|
|
277
|
-
tone?: 'neutral' | 'danger';
|
|
278
|
-
}
|
|
279
|
-
/** A square button holding only an icon, with its label as aria-label and title. */
|
|
280
|
-
declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
281
550
|
type CardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
282
551
|
type CardElement = 'div' | 'section' | 'article' | 'aside' | 'li';
|
|
283
552
|
interface CardClassOptions {
|
|
@@ -296,13 +565,90 @@ interface CardClassOptions {
|
|
|
296
565
|
/** The classes `<Card>` renders. Use it on a router `<Link>` or `<a>` that is a whole
|
|
297
566
|
* card: `<Link className={cardClass({ interactive: true })}>`. */
|
|
298
567
|
declare function cardClass({ padding, padded, interactive, variant, className }?: CardClassOptions): string;
|
|
568
|
+
type BadgeTone = 'neutral' | 'accent' | 'ok' | 'loss' | 'warn' | 'info' | 'on-accent';
|
|
569
|
+
type BadgeHue = 'emerald' | 'indigo' | 'amber' | 'lime' | 'rose' | 'sky' | 'violet' | 'teal';
|
|
570
|
+
interface BadgeClassOptions {
|
|
571
|
+
/** Same tones as Badge. Default "neutral". */
|
|
572
|
+
tone?: BadgeTone;
|
|
573
|
+
/** Same hues as Badge; overrides tone. */
|
|
574
|
+
hue?: BadgeHue;
|
|
575
|
+
/** Same sizes as Badge. Default "sm". */
|
|
576
|
+
size?: 'xs' | 'sm';
|
|
577
|
+
/** Same variants as Badge. Default "pill". */
|
|
578
|
+
variant?: 'pill' | 'tag';
|
|
579
|
+
/** Extra classes, merged last. */
|
|
580
|
+
className?: string;
|
|
581
|
+
}
|
|
582
|
+
/** The classes `<Badge>` renders (without the dot), for a badge-shaped link or a
|
|
583
|
+
* label inside a third-party renderer. */
|
|
584
|
+
declare function badgeClass({ tone, hue, size, variant, className }?: BadgeClassOptions): string;
|
|
585
|
+
type FieldSize = 'xs' | 'sm' | 'md';
|
|
586
|
+
interface FieldClassOptions {
|
|
587
|
+
/** md h-9 (default), sm h-8, xs h-7. All grow to 44px on touch screens. */
|
|
588
|
+
size?: FieldSize;
|
|
589
|
+
/** The red invalid border, for elements that do not set aria-invalid themselves. */
|
|
590
|
+
invalid?: boolean;
|
|
591
|
+
/** Extra classes, merged last. */
|
|
592
|
+
className?: string;
|
|
593
|
+
}
|
|
594
|
+
/** The classes `<Input>` renders: the shared field look at a size. Use it for a one-off
|
|
595
|
+
* control (a date input, a contenteditable) instead of copying a class string. */
|
|
596
|
+
declare function fieldClass({ size, invalid, className }?: FieldClassOptions): string;
|
|
597
|
+
|
|
598
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
599
|
+
/** The button element. */
|
|
600
|
+
ref?: Ref<HTMLButtonElement>;
|
|
601
|
+
/** primary: the one main action in a view. secondary: everything else. ghost:
|
|
602
|
+
* toolbars and quiet actions. danger: destructive actions. soft: an accent action
|
|
603
|
+
* that is not the main one (replaces "accent outline" buttons). subtle: a filled,
|
|
604
|
+
* quiet button for dense toolbars and chips on a surface. link: looks like a text
|
|
605
|
+
* link and sits inline in text (no height or padding; on touch screens an invisible
|
|
606
|
+
* 44px hit area, unless `inline`). */
|
|
607
|
+
variant?: ButtonVariant;
|
|
608
|
+
/** xs for dense tool rows (24px), sm for dense rows and toolbars, lg for a page's
|
|
609
|
+
* main call to action. xs, sm and md grow to 44px on touch screens. */
|
|
610
|
+
size?: ButtonSize;
|
|
611
|
+
/** Link variant only: skip the 44px touch hit area, for a link inside running text. */
|
|
612
|
+
inline?: boolean;
|
|
613
|
+
/** Shows a spinner, disables the button and sets aria-busy. */
|
|
614
|
+
loading?: boolean;
|
|
615
|
+
/** Icon before the label (16px for md and lg, 12–14px for xs and sm). Replaced by the
|
|
616
|
+
* spinner while loading. */
|
|
617
|
+
icon?: ReactNode;
|
|
618
|
+
}
|
|
619
|
+
/** The standard button. Defaults to type="button", so it never submits a form by
|
|
620
|
+
* accident; pass type="submit" for the one that should. */
|
|
621
|
+
declare function Button({ variant, size, inline, loading, icon, className, children, disabled, type, ref, ...rest }: ButtonProps): react.JSX.Element;
|
|
622
|
+
interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
623
|
+
/** The button element. */
|
|
624
|
+
ref?: Ref<HTMLButtonElement>;
|
|
625
|
+
/** Required: an icon-only button needs a name for screen readers and tooltips. It is
|
|
626
|
+
* also the title, so tests that query by title keep working. */
|
|
627
|
+
label: string;
|
|
628
|
+
/** 2xs: 20px (row-level reveal actions, 22px widget title bars; under a mouse its hit
|
|
629
|
+
* area is 24px), xs: 24px (dense headers), sm: 28px, md: 36px. All grow to 44px on
|
|
630
|
+
* touch screens. */
|
|
631
|
+
size?: IconButtonSize;
|
|
632
|
+
/** Pressed state for toggles (sets aria-pressed). */
|
|
633
|
+
active?: boolean;
|
|
634
|
+
/** ghost: no fill until hover (default). subtle: a quiet filled square for toolbars on
|
|
635
|
+
* a surface. soft: an accent tint for the highlighted action. */
|
|
636
|
+
variant?: IconButtonVariant;
|
|
637
|
+
/** danger: hover and pressed turn loss-red, for delete and remove actions. (Button's
|
|
638
|
+
* destructive look is `variant="danger"`; an icon button keeps the tone.) */
|
|
639
|
+
tone?: 'neutral' | 'danger';
|
|
640
|
+
}
|
|
641
|
+
/** A square button holding only an icon, with its label as aria-label and title. */
|
|
642
|
+
declare function IconButton({ label, size, active, variant, tone, className, children, type, disabled, ref, ...rest }: IconButtonProps): react.JSX.Element;
|
|
299
643
|
interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
644
|
+
/** The header row element. */
|
|
645
|
+
ref?: Ref<HTMLDivElement>;
|
|
300
646
|
/** The card's heading. */
|
|
301
647
|
title: ReactNode;
|
|
302
648
|
/** A quieter line under the title. */
|
|
303
649
|
description?: ReactNode;
|
|
304
|
-
/**
|
|
305
|
-
* the title on narrow cards. */
|
|
650
|
+
/** End-aligned slot (right in left-to-right layouts): a Button, an IconButton, a Badge,
|
|
651
|
+
* a Segmented. It wraps under the title on narrow cards. */
|
|
306
652
|
action?: ReactNode;
|
|
307
653
|
/** A small icon before the title (16px). */
|
|
308
654
|
icon?: ReactNode;
|
|
@@ -315,8 +661,10 @@ interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>
|
|
|
315
661
|
titleId?: string;
|
|
316
662
|
}
|
|
317
663
|
/** The header row of a card: title, optional description and icon, and an action slot. */
|
|
318
|
-
declare function CardHeader({ title, description, action, icon, as: Heading, divided, titleId, className, ...rest }: CardHeaderProps): react.JSX.Element;
|
|
664
|
+
declare function CardHeader({ title, description, action, icon, as: Heading, divided, titleId, className, ref, ...rest }: CardHeaderProps): react.JSX.Element;
|
|
319
665
|
interface CardProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
666
|
+
/** The card element (whatever `as` renders). */
|
|
667
|
+
ref?: Ref<HTMLElement>;
|
|
320
668
|
/** The element to render. Use section or article for a titled region, li inside a list. */
|
|
321
669
|
as?: CardElement;
|
|
322
670
|
/** Inner padding: sm p-3, md p-4 (p-5 from 640px; the default), lg p-6, none for
|
|
@@ -335,35 +683,19 @@ interface CardProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
|
335
683
|
title?: ReactNode;
|
|
336
684
|
/** The header's description; only with title. */
|
|
337
685
|
description?: ReactNode;
|
|
338
|
-
/** The header's
|
|
686
|
+
/** The header's end-aligned action slot; only with title. */
|
|
339
687
|
action?: ReactNode;
|
|
340
688
|
}
|
|
341
689
|
/** The surface panel every widget, table and form sits in. */
|
|
342
|
-
declare
|
|
343
|
-
type BadgeTone = 'neutral' | 'accent' | 'ok' | 'loss' | 'warn' | 'info' | 'on-accent';
|
|
344
|
-
type Tone = BadgeTone;
|
|
345
|
-
type BadgeHue = 'emerald' | 'indigo' | 'amber' | 'lime' | 'rose' | 'sky' | 'violet' | 'teal';
|
|
346
|
-
interface BadgeClassOptions {
|
|
347
|
-
/** Same tones as Badge. Default "neutral". */
|
|
348
|
-
tone?: Tone;
|
|
349
|
-
/** Same hues as Badge; overrides tone. */
|
|
350
|
-
hue?: BadgeHue;
|
|
351
|
-
/** Same sizes as Badge. Default "sm". */
|
|
352
|
-
size?: 'xs' | 'sm';
|
|
353
|
-
/** Same variants as Badge. Default "pill". */
|
|
354
|
-
variant?: 'pill' | 'tag';
|
|
355
|
-
/** Extra classes, merged last. */
|
|
356
|
-
className?: string;
|
|
357
|
-
}
|
|
358
|
-
/** The classes `<Badge>` renders (without the dot), for a badge-shaped link or a
|
|
359
|
-
* label inside a third-party renderer. */
|
|
360
|
-
declare function badgeClass({ tone, hue, size, variant, className }?: BadgeClassOptions): string;
|
|
690
|
+
declare function Card({ as, padding, padded, interactive, variant, title, description, action, className, children, ref, ...rest }: CardProps): react.JSX.Element;
|
|
361
691
|
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
692
|
+
/** The badge element. */
|
|
693
|
+
ref?: Ref<HTMLSpanElement>;
|
|
362
694
|
/** Text on its own soft tint; every tone clears 4.5:1 in every theme. on-accent: a
|
|
363
695
|
* small label inside a solid accent fill (a primary Button, an accent link), in the
|
|
364
696
|
* on-accent color over a 20% on-accent tint. It has no hover state; pair a short
|
|
365
697
|
* label with sr-only text that says what it means. */
|
|
366
|
-
tone?:
|
|
698
|
+
tone?: BadgeTone;
|
|
367
699
|
/** A color with no meaning (stores, categories, tags): the hue's soft tint with hi
|
|
368
700
|
* text, so it reads in every theme. Overrides tone. */
|
|
369
701
|
hue?: BadgeHue;
|
|
@@ -377,39 +709,32 @@ interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
377
709
|
dot?: boolean;
|
|
378
710
|
}
|
|
379
711
|
/** A small status pill: counts, states, tags. */
|
|
380
|
-
declare function Badge({ tone, hue, size, variant, dot, className, children, ...rest }: BadgeProps): react.JSX.Element;
|
|
381
|
-
type FieldSize = 'xs' | 'sm' | 'md';
|
|
382
|
-
interface FieldClassOptions {
|
|
383
|
-
/** md h-9 (default), sm h-8, xs h-7. All grow to 44px on touch screens. */
|
|
384
|
-
size?: FieldSize;
|
|
385
|
-
/** The red invalid border, for elements that do not set aria-invalid themselves. */
|
|
386
|
-
invalid?: boolean;
|
|
387
|
-
/** Extra classes, merged last. */
|
|
388
|
-
className?: string;
|
|
389
|
-
}
|
|
390
|
-
/** The classes `<Input>` renders: the shared field look at a size. Use it for a one-off
|
|
391
|
-
* control (a date input, a contenteditable) instead of copying a class string. */
|
|
392
|
-
declare function fieldClass({ size, invalid, className }?: FieldClassOptions): string;
|
|
712
|
+
declare function Badge({ tone, hue, size, variant, dot, className, children, ref, ...rest }: BadgeProps): react.JSX.Element;
|
|
393
713
|
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
714
|
+
/** The input element (not the wrapper, when there are slots). */
|
|
715
|
+
ref?: Ref<HTMLInputElement>;
|
|
394
716
|
/** Red border and aria-invalid. Pair it with an error message tied by aria-describedby. */
|
|
395
717
|
invalid?: boolean;
|
|
396
718
|
/** md h-9 (default), sm h-8 with 12px text, xs h-7 with 11px text. Touch screens
|
|
397
719
|
* always get 16px text and a 44px height. (Replaces the native size attribute; set a width with
|
|
398
720
|
* className instead.) */
|
|
399
721
|
size?: FieldSize;
|
|
400
|
-
/** A decorative slot inside the
|
|
401
|
-
* pointer events, so clicks reach the input. */
|
|
722
|
+
/** A decorative slot inside the start edge (left in left-to-right layouts): a search
|
|
723
|
+
* icon, a "$" prefix. It ignores pointer events, so clicks reach the input. */
|
|
402
724
|
leading?: ReactNode;
|
|
403
|
-
/** A slot inside the
|
|
725
|
+
/** A slot inside the end edge that may be interactive: a clear IconButton, a unit
|
|
404
726
|
* suffix. */
|
|
405
727
|
trailing?: ReactNode;
|
|
406
728
|
/** Classes for the wrapper span that holds the slots (only rendered with leading or
|
|
407
729
|
* trailing). className stays on the input. */
|
|
408
730
|
wrapperClassName?: string;
|
|
409
731
|
}
|
|
410
|
-
/** Text input. 16px text on touch screens so iOS does not zoom the page on focus.
|
|
411
|
-
|
|
732
|
+
/** Text input. 16px text on touch screens so iOS does not zoom the page on focus. `rest`
|
|
733
|
+
* lands on the input, also when the slots add a wrapper. */
|
|
734
|
+
declare function Input({ invalid, size, leading, trailing, wrapperClassName, className, ref, ...rest }: InputProps): react.JSX.Element;
|
|
412
735
|
interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
736
|
+
/** The select element (not the wrapper). */
|
|
737
|
+
ref?: Ref<HTMLSelectElement>;
|
|
413
738
|
/** Red border and aria-invalid. */
|
|
414
739
|
invalid?: boolean;
|
|
415
740
|
/** md h-9 (default), sm h-8, xs h-7, the same as Input. Touch screens get 16px text
|
|
@@ -419,12 +744,38 @@ interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'siz
|
|
|
419
744
|
* use this instead of reaching in with [&>select]:… */
|
|
420
745
|
selectClassName?: string;
|
|
421
746
|
}
|
|
422
|
-
/** Native select (keeps the platform picker on phones) with the shared field look.
|
|
423
|
-
|
|
747
|
+
/** Native select (keeps the platform picker on phones) with the shared field look. The
|
|
748
|
+
* wrapper span takes `className`; `rest` and `ref` go to the select, so `name`,
|
|
749
|
+
* `value` and `onChange` work as on a native select. */
|
|
750
|
+
declare function Select({ invalid, size, selectClassName, className, children, ref, ...rest }: SelectProps): react.JSX.Element;
|
|
751
|
+
interface LabelProps extends HTMLAttributes<HTMLSpanElement> {
|
|
752
|
+
/** The span element. */
|
|
753
|
+
ref?: Ref<HTMLSpanElement>;
|
|
754
|
+
}
|
|
424
755
|
/** Small uppercase label for form fields and section headings. */
|
|
425
|
-
declare function Label({ className, ...rest }:
|
|
756
|
+
declare function Label({ className, ref, ...rest }: LabelProps): react.JSX.Element;
|
|
757
|
+
|
|
758
|
+
type ChipVariant = 'toggle' | 'suggestion' | 'tag';
|
|
759
|
+
interface ChipClassOptions {
|
|
760
|
+
/** The pressed (on) look of a toggle chip: the accent tint. On a link, set
|
|
761
|
+
* aria-current="page" for the active one (links take aria-current, not aria-pressed). */
|
|
762
|
+
pressed?: boolean;
|
|
763
|
+
/** Same variants as Chip. Default "toggle". */
|
|
764
|
+
variant?: ChipVariant;
|
|
765
|
+
/** md: 32px (default), sm: 28px. Both reach 44px on touch screens. */
|
|
766
|
+
size?: 'sm' | 'md';
|
|
767
|
+
/** Extra classes, merged last. */
|
|
768
|
+
className?: string;
|
|
769
|
+
}
|
|
770
|
+
/** The classes `<Chip>` renders, for router links and anchors that look like chips:
|
|
771
|
+
* `<Link className={chipClass({ pressed: active })} aria-current={active ? 'page' : undefined}>`.
|
|
772
|
+
* Mirrors .nish-chip in nish-components.css. */
|
|
773
|
+
declare function chipClass({ pressed, variant, size, className }?: ChipClassOptions): string;
|
|
774
|
+
type SegmentedTone = 'accent' | 'warn' | 'loss';
|
|
426
775
|
|
|
427
776
|
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
777
|
+
/** The textarea element. */
|
|
778
|
+
ref?: Ref<HTMLTextAreaElement>;
|
|
428
779
|
/** Red border and aria-invalid. Pair it with an error message tied by aria-describedby
|
|
429
780
|
* (Field does both for you). */
|
|
430
781
|
invalid?: boolean;
|
|
@@ -440,31 +791,55 @@ interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
|
440
791
|
}
|
|
441
792
|
/** Multi-line text with the shared field look. 16px text on touch screens (no iOS zoom); the
|
|
442
793
|
* reader can resize it vertically, or it grows with its content when autoGrow is set. */
|
|
443
|
-
declare
|
|
794
|
+
declare function Textarea({ ref, invalid, size, autoGrow, className, rows, value, onInput, ...rest }: TextareaProps): react.JSX.Element;
|
|
444
795
|
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {
|
|
796
|
+
/** The checkbox input. */
|
|
797
|
+
ref?: Ref<HTMLInputElement>;
|
|
445
798
|
/** Text beside the box; clicking it toggles the box. Optional when the box has an
|
|
446
799
|
* aria-label instead (a table row's select box). */
|
|
447
800
|
label?: ReactNode;
|
|
448
|
-
/** A quieter line under the label.
|
|
801
|
+
/** A quieter line under the label. It describes the box (aria-describedby) and is not
|
|
802
|
+
* part of its name. */
|
|
449
803
|
hint?: ReactNode;
|
|
450
804
|
/** The "some but not all" state of a select-all box. Set through the DOM property, so
|
|
451
805
|
* screen readers announce it as mixed. Clicking still toggles `checked`. */
|
|
452
806
|
indeterminate?: boolean;
|
|
453
807
|
/** A right-aligned slot on the same row (a price, a count). The row then fills its
|
|
454
|
-
* container's width. */
|
|
808
|
+
* container's width. Described by, not part of, the box's name. */
|
|
455
809
|
trailing?: ReactNode;
|
|
456
810
|
/** md: 16px box, 14px text. sm: 14px box, 12px text for dense lists. The row is the
|
|
457
811
|
* 44px tap target on touch screens either way. */
|
|
458
812
|
size?: 'sm' | 'md';
|
|
813
|
+
/** Red border and aria-invalid. Field sets it for you. */
|
|
814
|
+
invalid?: boolean;
|
|
459
815
|
}
|
|
460
816
|
/** A checkbox with its label. The box is drawn from theme roles (its unchecked border
|
|
461
|
-
* reads in light themes too), and the whole row is the 44px tap target on touch.
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
817
|
+
* reads in light themes too), and the whole row is the 44px tap target on touch. Props
|
|
818
|
+
* other than `className` go to the `<input>` (name, checked, onChange, form). */
|
|
819
|
+
declare function Checkbox({ ref, label, hint, indeterminate, trailing, size, invalid, className, id, disabled, onChange, ...rest }: CheckboxProps): react.JSX.Element;
|
|
820
|
+
interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onChange' | 'role' | 'type' | 'value' | 'defaultValue' | 'name' | 'form'> {
|
|
821
|
+
/** The switch button. */
|
|
822
|
+
ref?: Ref<HTMLButtonElement>;
|
|
823
|
+
/** On or off, when you keep the state yourself. Leave it out and use `defaultChecked`
|
|
824
|
+
* for an uncontrolled switch. */
|
|
825
|
+
checked?: boolean;
|
|
826
|
+
/** The starting state of an uncontrolled switch (no `checked`). */
|
|
827
|
+
defaultChecked?: boolean;
|
|
828
|
+
/** Called with the new value and the click event when the switch is clicked or toggled
|
|
829
|
+
* with Space/Enter. Kept for 2.x; prefer onCheckedChange. */
|
|
830
|
+
onChange?: (checked: boolean, event: MouseEvent<HTMLButtonElement>) => void;
|
|
831
|
+
/** Called with the new value. The form-library friendly callback: use it with
|
|
832
|
+
* react-hook-form's Controller (`onCheckedChange={field.onChange}`). */
|
|
833
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
834
|
+
/** Field name for a native form. With it, a hidden checkbox mirrors the state, so
|
|
835
|
+
* FormData and `<form action>` carry the value. */
|
|
836
|
+
name?: string;
|
|
837
|
+
/** The submitted value while on. Default "on", like a native checkbox. */
|
|
838
|
+
value?: string;
|
|
839
|
+
/** Marks the control required (aria-required, and the hidden checkbox blocks submit). */
|
|
840
|
+
required?: boolean;
|
|
841
|
+
/** The id of the `<form>` the hidden checkbox belongs to, when it is not an ancestor. */
|
|
842
|
+
form?: string;
|
|
468
843
|
/** Visible label, linked to the switch by aria-labelledby. Clicking it toggles too.
|
|
469
844
|
* Without one, pass aria-label or aria-labelledby. */
|
|
470
845
|
label?: ReactNode;
|
|
@@ -478,19 +853,26 @@ interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onC
|
|
|
478
853
|
labelSide?: 'start' | 'end';
|
|
479
854
|
}
|
|
480
855
|
/** An on/off switch that takes effect immediately (a setting, not a form choice that
|
|
481
|
-
* waits for Save; use Checkbox for that). A `<button role="switch" aria-checked
|
|
482
|
-
|
|
483
|
-
|
|
856
|
+
* waits for Save; use Checkbox for that). A `<button role="switch" aria-checked>`; with a
|
|
857
|
+
* `name` it also posts in native forms. `ref` and the remaining props go to the button;
|
|
858
|
+
* `className` goes to the row (or to the button when there is no label). */
|
|
859
|
+
declare function Switch({ ref, checked: checkedProp, defaultChecked, onChange, onCheckedChange, name, value, required, form, label, description, size, labelSide, disabled, className, id, onClick, ...rest }: SwitchProps): react.JSX.Element;
|
|
860
|
+
interface FieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
861
|
+
/** The wrapper element. */
|
|
862
|
+
ref?: Ref<HTMLDivElement>;
|
|
484
863
|
/** The visible label, in sentence case ("Email address"). Rendered as a real <label>
|
|
485
864
|
* tied to the control. */
|
|
486
865
|
label: ReactNode;
|
|
487
866
|
/** Help text under the control, tied by aria-describedby. Hidden while an error shows. */
|
|
488
867
|
hint?: ReactNode;
|
|
489
868
|
/** Error message under the control, announced (role="alert") and tied by
|
|
490
|
-
* aria-describedby. Also sets
|
|
869
|
+
* aria-describedby. Also sets aria-invalid on the control. */
|
|
491
870
|
error?: ReactNode;
|
|
492
871
|
/** Shows a quiet "Optional" tag after the label. */
|
|
493
872
|
optional?: boolean;
|
|
873
|
+
/** Marks the control required: `required` and `aria-required` on it, and a "*" after
|
|
874
|
+
* the label (hidden from screen readers, which hear "required" from the control). */
|
|
875
|
+
required?: boolean;
|
|
494
876
|
/** The control's id. Leave it out and Field gives the control one (or uses the id the
|
|
495
877
|
* control already has). */
|
|
496
878
|
htmlFor?: string;
|
|
@@ -499,14 +881,16 @@ interface FieldProps {
|
|
|
499
881
|
layout?: 'stack' | 'inline';
|
|
500
882
|
/** Width of the label column in the inline layout. Any CSS length; default 7rem. */
|
|
501
883
|
labelWidth?: string;
|
|
502
|
-
/** One control: Input, Select, Textarea, SearchInput
|
|
884
|
+
/** One control: Input, Select, Textarea, SearchInput, Checkbox, Switch, Combobox,
|
|
885
|
+
* Segmented or a native element. */
|
|
503
886
|
children: ReactNode;
|
|
504
|
-
className?: string;
|
|
505
887
|
}
|
|
506
888
|
/** A labelled form row: label, one control, and its hint or error, all wired up for
|
|
507
|
-
* screen readers (id, aria-describedby, aria-invalid). */
|
|
508
|
-
declare function Field({ label, hint, error, optional, htmlFor, layout, labelWidth, children, className }: FieldProps): react.JSX.Element;
|
|
509
|
-
interface FieldGroupProps extends Omit<
|
|
889
|
+
* screen readers (id, aria-describedby, aria-invalid, aria-required). */
|
|
890
|
+
declare function Field({ ref, label, hint, error, optional, required, htmlFor, layout, labelWidth, children, className, style, ...rest }: FieldProps): react.JSX.Element;
|
|
891
|
+
interface FieldGroupProps extends Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, 'children'> {
|
|
892
|
+
/** The fieldset element. */
|
|
893
|
+
ref?: Ref<HTMLFieldSetElement>;
|
|
510
894
|
/** The group's visible name, in sentence case ("Work mode"). Rendered as the
|
|
511
895
|
* fieldset's <legend>, styled like Field's stack label. */
|
|
512
896
|
label: ReactNode;
|
|
@@ -524,12 +908,16 @@ interface FieldGroupProps extends Omit<HTMLAttributes<HTMLFieldSetElement>, 'chi
|
|
|
524
908
|
/** Field for a group of controls: a <fieldset> whose <legend> looks like Field's label,
|
|
525
909
|
* with the hint or error tied to the whole group. Use Field when there is exactly one
|
|
526
910
|
* control to label. */
|
|
527
|
-
declare function FieldGroup({ label, hint, error, optional, className, children, ...rest }: FieldGroupProps): react.JSX.Element;
|
|
528
|
-
interface SearchInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'size' | 'type'> {
|
|
529
|
-
/** The
|
|
530
|
-
|
|
911
|
+
declare function FieldGroup({ ref, label, hint, error, optional, className, children, ...rest }: FieldGroupProps): react.JSX.Element;
|
|
912
|
+
interface SearchInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange' | 'size' | 'type'> {
|
|
913
|
+
/** The `<input>` element. */
|
|
914
|
+
ref?: Ref<HTMLInputElement>;
|
|
915
|
+
/** The query, when you keep it yourself. Leave it out for an uncontrolled field. */
|
|
916
|
+
value?: string;
|
|
917
|
+
/** The starting query of an uncontrolled field. */
|
|
918
|
+
defaultValue?: string;
|
|
531
919
|
/** Called with the new query on typing, on Clear and on Escape. */
|
|
532
|
-
onChange
|
|
920
|
+
onChange?: (value: string, event?: ChangeEvent<HTMLInputElement>) => void;
|
|
533
921
|
/** Also called after Clear or Escape empties the field (e.g. to reset results). */
|
|
534
922
|
onClear?: () => void;
|
|
535
923
|
/** md: 36px, sm: 32px, xs: 28px (dense toolbars). All 44px with 16px text on touch screens. */
|
|
@@ -543,27 +931,17 @@ interface SearchInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, '
|
|
|
543
931
|
className?: string;
|
|
544
932
|
/** Class for the <input> itself. */
|
|
545
933
|
inputClassName?: string;
|
|
934
|
+
/** Accessible name of the Clear button. Default from NishProvider strings ("Clear search"). */
|
|
935
|
+
clearLabel?: string;
|
|
546
936
|
}
|
|
547
937
|
/** A search field: leading search icon, a Clear button while it has a value, and
|
|
548
|
-
* Escape to clear. type="search" with the Search key on phone keyboards.
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
interface ChipClassOptions {
|
|
552
|
-
/** The pressed (on) look of a toggle chip: the accent tint. On a link, set
|
|
553
|
-
* aria-current="page" for the active one (links take aria-current, not aria-pressed). */
|
|
554
|
-
pressed?: boolean;
|
|
555
|
-
/** Same variants as Chip. Default "toggle". */
|
|
556
|
-
variant?: ChipVariant;
|
|
557
|
-
/** md: 32px (default), sm: 28px. Both reach 44px on touch screens. */
|
|
558
|
-
size?: 'sm' | 'md';
|
|
559
|
-
/** Extra classes, merged last. */
|
|
560
|
-
className?: string;
|
|
561
|
-
}
|
|
562
|
-
/** The classes `<Chip>` renders, for router links and anchors that look like chips:
|
|
563
|
-
* `<Link className={chipClass({ pressed: active })} aria-current={active ? 'page' : undefined}>`.
|
|
564
|
-
* Mirrors .nish-chip in nish-components.css. */
|
|
565
|
-
declare function chipClass({ pressed, variant, size, className }?: ChipClassOptions): string;
|
|
938
|
+
* Escape to clear. type="search" with the Search key on phone keyboards. `ref` and the
|
|
939
|
+
* remaining props go to the `<input>`; `className` goes to the wrapper. */
|
|
940
|
+
declare function SearchInput({ ref, value: valueProp, defaultValue, onChange, onClear, size, variant, className, inputClassName, onKeyDown, placeholder, clearLabel, disabled, ...rest }: SearchInputProps): react.JSX.Element;
|
|
566
941
|
interface ChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
942
|
+
/** The chip's button. For `variant="tag"` the chip is a `<span>` and this ref (and the
|
|
943
|
+
* remaining props) go to that span. */
|
|
944
|
+
ref?: Ref<HTMLButtonElement>;
|
|
567
945
|
/** toggle: an on/off filter (`aria-pressed`). suggestion: a dashed "+ add this" chip.
|
|
568
946
|
* tag: a static label (a <span>) with an optional remove button. */
|
|
569
947
|
variant?: ChipVariant;
|
|
@@ -572,7 +950,7 @@ interface ChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
572
950
|
/** Tag chips only: shows a remove button that calls this. */
|
|
573
951
|
onRemove?: () => void;
|
|
574
952
|
/** Accessible name of the remove button. Default "Remove <children>" when the chip's
|
|
575
|
-
* text is a plain string, else "Remove". */
|
|
953
|
+
* text is a plain string, else "Remove" (from NishProvider strings). */
|
|
576
954
|
removeLabel?: string;
|
|
577
955
|
/** Leading icon (14px for sm, 16px for md). Suggestion chips show "+" when unset. */
|
|
578
956
|
icon?: ReactNode;
|
|
@@ -583,21 +961,22 @@ interface ChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
583
961
|
}
|
|
584
962
|
/** A compact pill for multi-select filters (toggle), quick suggestions and removable
|
|
585
963
|
* tags. For one choice among several, use Segmented instead. */
|
|
586
|
-
declare
|
|
964
|
+
declare function Chip({ ref, variant, pressed, onRemove, removeLabel, icon, trailing, size, className, children, type, ...rest }: ChipProps): react.JSX.Element;
|
|
587
965
|
interface ChipGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
966
|
+
/** The wrapper element. */
|
|
967
|
+
ref?: Ref<HTMLDivElement>;
|
|
588
968
|
/** Names the group for screen readers: "Filter by status". */
|
|
589
969
|
label: string;
|
|
590
970
|
/** On phones, one row that scrolls sideways instead of wrapping. */
|
|
591
971
|
scroll?: boolean;
|
|
592
972
|
children: ReactNode;
|
|
593
973
|
}
|
|
594
|
-
/** A labelled row of Chips (role="group"). Wraps by default.
|
|
595
|
-
|
|
974
|
+
/** A labelled row of Chips (role="group"). Wraps by default. The arrow keys move focus
|
|
975
|
+
* between the chips (mirrored in a right-to-left layout); each chip stays a Tab stop. */
|
|
976
|
+
declare function ChipGroup({ ref, label, scroll, className, children, onKeyDown, ...rest }: ChipGroupProps): react.JSX.Element;
|
|
596
977
|
|
|
597
978
|
type TabsVariant = 'underline' | 'pill';
|
|
598
979
|
type TabsSize = 'xs' | 'sm' | 'md';
|
|
599
|
-
/** The breakpoint from which responsive tabs show every panel at once. */
|
|
600
|
-
type TabsBreakpoint = 'md' | 'lg';
|
|
601
980
|
/** The look of one tab, for router links that act as tabs:
|
|
602
981
|
* `<NavLink className={({ isActive }) => tabClass({ active: isActive })}>`. Router links
|
|
603
982
|
* are navigation, not ARIA tabs: they take aria-current="page", not role="tab". */
|
|
@@ -613,6 +992,9 @@ declare function tabClass(o: {
|
|
|
613
992
|
/** Extra classes, merged last. */
|
|
614
993
|
className?: string;
|
|
615
994
|
}): string;
|
|
995
|
+
|
|
996
|
+
/** The breakpoint from which responsive tabs show every panel at once. */
|
|
997
|
+
type TabsBreakpoint = 'md' | 'lg';
|
|
616
998
|
interface TabItem {
|
|
617
999
|
value: string;
|
|
618
1000
|
label: ReactNode;
|
|
@@ -623,11 +1005,15 @@ interface TabItem {
|
|
|
623
1005
|
/** Shown but not selectable; the arrow keys skip it. */
|
|
624
1006
|
disabled?: boolean;
|
|
625
1007
|
}
|
|
626
|
-
interface TabsProps {
|
|
627
|
-
/** The selected tab's value.
|
|
628
|
-
value
|
|
1008
|
+
interface TabsProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onChange' | 'children' | 'defaultValue'> {
|
|
1009
|
+
/** The selected tab's value (controlled). Omit it, with `defaultValue`, for an uncontrolled Tabs. */
|
|
1010
|
+
value?: string;
|
|
1011
|
+
/** The first selected tab of an uncontrolled Tabs. Default: the first enabled tab. */
|
|
1012
|
+
defaultValue?: string;
|
|
629
1013
|
/** Called with the new value on click and on arrow keys (selection follows focus). */
|
|
630
|
-
|
|
1014
|
+
onValueChange?: (value: string) => void;
|
|
1015
|
+
/** Alias of `onValueChange`, kept for existing code. Both are called when both are given. */
|
|
1016
|
+
onChange?: (value: string) => void;
|
|
631
1017
|
items: TabItem[];
|
|
632
1018
|
/** Names the tab list for screen readers: "Job sections". */
|
|
633
1019
|
label: string;
|
|
@@ -653,11 +1039,14 @@ interface TabsProps {
|
|
|
653
1039
|
children?: ReactNode;
|
|
654
1040
|
/** Class for the tab list. */
|
|
655
1041
|
className?: string;
|
|
1042
|
+
/** The tab list element. */
|
|
1043
|
+
ref?: Ref<HTMLDivElement>;
|
|
656
1044
|
}
|
|
657
1045
|
/** Tabs that switch between panels in place: the full ARIA tabs pattern (tablist, tab
|
|
658
|
-
* with aria-selected and aria-controls, arrow keys
|
|
659
|
-
*
|
|
660
|
-
|
|
1046
|
+
* with aria-selected and aria-controls, arrow keys that mirror in right-to-left layouts,
|
|
1047
|
+
* Home and End). Controlled (`value` + `onValueChange`) or uncontrolled (`defaultValue`).
|
|
1048
|
+
* For links that change the URL, use tabClass() on the router's link instead. */
|
|
1049
|
+
declare function Tabs({ value: valueProp, defaultValue, onValueChange, onChange, items, label, variant, size, block, hideFrom, idBase, controlsPanels, children, className, ref, onKeyDown, ...rest }: TabsProps): react.JSX.Element | null;
|
|
661
1050
|
interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
662
1051
|
/** The tab value this panel belongs to. */
|
|
663
1052
|
value: string;
|
|
@@ -673,87 +1062,104 @@ interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
673
1062
|
* a scroll position or a draft survives switching tabs. */
|
|
674
1063
|
keepMounted?: boolean;
|
|
675
1064
|
children?: ReactNode;
|
|
1065
|
+
ref?: Ref<HTMLDivElement>;
|
|
676
1066
|
}
|
|
677
1067
|
/** The content for one tab: role="tabpanel", labelled by its tab, hidden unless its tab
|
|
678
1068
|
* is selected. Render it as a child of Tabs, or pass idBase and active. */
|
|
679
|
-
declare function TabPanel({ value, idBase, active, showFrom, keepMounted, children, className, ...rest }: TabPanelProps): react.JSX.Element;
|
|
1069
|
+
declare function TabPanel({ value, idBase, active, showFrom, keepMounted, children, className, ref, ...rest }: TabPanelProps): react.JSX.Element;
|
|
680
1070
|
|
|
681
|
-
|
|
682
|
-
declare function Skeleton({ className, style, }: {
|
|
1071
|
+
interface SkeletonProps extends ComponentPropsWithoutRef<'div'> {
|
|
683
1072
|
/** Size and shape: h-4 w-2/5, size-9 rounded-full, … */
|
|
684
1073
|
className?: string;
|
|
685
1074
|
/** For sizes known only at runtime, e.g. { height: chartHeight }. */
|
|
686
|
-
style?:
|
|
687
|
-
|
|
688
|
-
|
|
1075
|
+
style?: ComponentPropsWithoutRef<'div'>['style'];
|
|
1076
|
+
ref?: Ref<HTMLDivElement>;
|
|
1077
|
+
}
|
|
1078
|
+
/** One shimmer block; size it with width/height classes. Decorative (aria-hidden). */
|
|
1079
|
+
declare function Skeleton({ className, style, ref, ...rest }: SkeletonProps): react.JSX.Element;
|
|
1080
|
+
interface SkeletonRowsProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
689
1081
|
/** How many rows. Default 5. */
|
|
690
1082
|
rows?: number;
|
|
691
1083
|
/** Height of each row: pixels or any CSS length. Default 56. */
|
|
692
1084
|
height?: number | string;
|
|
693
1085
|
/** Space between rows: sm 6px, md 10px (default). */
|
|
694
1086
|
gap?: 'sm' | 'md';
|
|
695
|
-
/** Accessible name of the loading region. Default "Loading". */
|
|
1087
|
+
/** Accessible name of the loading region, read out as hidden text. Default "Loading". */
|
|
696
1088
|
label?: string;
|
|
697
1089
|
/** Classes for the column (padding, margins). */
|
|
698
1090
|
className?: string;
|
|
699
1091
|
/** Classes for every row, e.g. "h-16" instead of height, or "rounded-lg". */
|
|
700
1092
|
rowClassName?: string;
|
|
1093
|
+
ref?: Ref<HTMLDivElement>;
|
|
701
1094
|
}
|
|
702
1095
|
/** A column of full-width, card-shaped shimmer rows (rounded-xl) while a list or table
|
|
703
|
-
* loads, announced once (role="status"
|
|
704
|
-
* card body's text lines, use SkeletonLines. */
|
|
705
|
-
declare function SkeletonRows({ rows, height, gap, label, className, rowClassName }: SkeletonRowsProps): react.JSX.Element;
|
|
1096
|
+
* loads, announced once (role="status", the label is visually hidden text inside it).
|
|
1097
|
+
* The shimmer stops under reduced motion. For a card body's text lines, use SkeletonLines. */
|
|
1098
|
+
declare function SkeletonRows({ rows, height, gap, label, className, rowClassName, ref, ...rest }: SkeletonRowsProps): react.JSX.Element;
|
|
706
1099
|
declare const SPINNER_SIZE: {
|
|
707
1100
|
readonly xs: 12;
|
|
708
1101
|
readonly sm: 14;
|
|
709
1102
|
readonly md: 16;
|
|
710
1103
|
readonly lg: 24;
|
|
711
1104
|
};
|
|
712
|
-
interface SpinnerProps {
|
|
1105
|
+
interface SpinnerProps extends Omit<ComponentPropsWithoutRef<'span'>, 'children'> {
|
|
713
1106
|
/** xs 12px, sm 14px, md 16px (default), lg 24px. */
|
|
714
1107
|
size?: keyof typeof SPINNER_SIZE;
|
|
715
1108
|
/** Announces the spinner (role="status") with this accessible name, e.g.
|
|
716
|
-
* "Loading jobs". Without it the spinner is decorative
|
|
717
|
-
* visible text or an aria-busy container. */
|
|
1109
|
+
* "Loading jobs", as visually hidden text. Without it the spinner is decorative
|
|
1110
|
+
* (aria-hidden); pair it with visible text or an aria-busy container. */
|
|
718
1111
|
label?: string;
|
|
719
1112
|
/** Color and spacing. The spinner draws in currentColor. */
|
|
720
1113
|
className?: string;
|
|
1114
|
+
ref?: Ref<HTMLSpanElement>;
|
|
721
1115
|
}
|
|
722
1116
|
/** A spinning loader in the current text color: the one spinner every app uses,
|
|
723
1117
|
* instead of hand-rolled border spinners. */
|
|
724
|
-
declare function Spinner({ size, label, className }: SpinnerProps): react.JSX.Element;
|
|
725
|
-
|
|
726
|
-
declare function SkeletonLines({ lines, className, }: {
|
|
1118
|
+
declare function Spinner({ size, label, className, ref, ...rest }: SpinnerProps): react.JSX.Element;
|
|
1119
|
+
interface SkeletonLinesProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
727
1120
|
/** Body lines under the heading bar. */
|
|
728
1121
|
lines?: number;
|
|
729
1122
|
className?: string;
|
|
730
|
-
|
|
731
|
-
|
|
1123
|
+
/** Accessible name of the loading region. Default "Loading". */
|
|
1124
|
+
label?: string;
|
|
1125
|
+
ref?: Ref<HTMLDivElement>;
|
|
1126
|
+
}
|
|
1127
|
+
/** A padded stack of shimmer bars: the default loading body for a card or widget, announced
|
|
1128
|
+
* once (role="status"). */
|
|
1129
|
+
declare function SkeletonLines({ lines, className, label, ref, ...rest }: SkeletonLinesProps): react.JSX.Element;
|
|
1130
|
+
interface SkeletonCardProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
732
1131
|
/** Text lines under the title bar. Default 3. */
|
|
733
1132
|
lines?: number;
|
|
734
1133
|
/** A media block above the text: square (96px), wide (16:9) or none (default). */
|
|
735
1134
|
media?: 'square' | 'wide' | 'none';
|
|
736
1135
|
className?: string;
|
|
1136
|
+
ref?: Ref<HTMLDivElement>;
|
|
737
1137
|
}
|
|
738
1138
|
/** A card-shaped shimmer for one loading card: optional media, a title bar and text lines. */
|
|
739
|
-
declare function SkeletonCard({ lines, media, className }: SkeletonCardProps): react.JSX.Element;
|
|
740
|
-
interface StatGridSkeletonProps {
|
|
1139
|
+
declare function SkeletonCard({ lines, media, className, ref, ...rest }: SkeletonCardProps): react.JSX.Element;
|
|
1140
|
+
interface StatGridSkeletonProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
741
1141
|
/** How many tiles. Default 4. */
|
|
742
1142
|
count?: number;
|
|
743
1143
|
className?: string;
|
|
1144
|
+
/** Accessible name of the loading region. Default "Loading". */
|
|
1145
|
+
label?: string;
|
|
1146
|
+
ref?: Ref<HTMLDivElement>;
|
|
744
1147
|
}
|
|
745
1148
|
/** Shimmer tiles that match a StatGrid (2 columns, 4 from md) while its numbers load. */
|
|
746
|
-
declare function StatGridSkeleton({ count, className }: StatGridSkeletonProps): react.JSX.Element;
|
|
747
|
-
interface CardListSkeletonProps {
|
|
1149
|
+
declare function StatGridSkeleton({ count, className, label, ref, ...rest }: StatGridSkeletonProps): react.JSX.Element;
|
|
1150
|
+
interface CardListSkeletonProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
748
1151
|
/** How many cards. Default 3. */
|
|
749
1152
|
count?: number;
|
|
750
1153
|
/** Text lines in each card. Default 2. */
|
|
751
1154
|
lines?: number;
|
|
752
1155
|
className?: string;
|
|
1156
|
+
/** Accessible name of the loading region. Default "Loading". */
|
|
1157
|
+
label?: string;
|
|
1158
|
+
ref?: Ref<HTMLDivElement>;
|
|
753
1159
|
}
|
|
754
1160
|
/** A stack of shimmer cards while a card list loads, announced once (role="status"). */
|
|
755
|
-
declare function CardListSkeleton({ count, lines, className }: CardListSkeletonProps): react.JSX.Element;
|
|
756
|
-
interface EmptyStateProps {
|
|
1161
|
+
declare function CardListSkeleton({ count, lines, className, label, ref, ...rest }: CardListSkeletonProps): react.JSX.Element;
|
|
1162
|
+
interface EmptyStateProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title'> {
|
|
757
1163
|
/** A 28px line icon, shown in the ghost color. */
|
|
758
1164
|
icon?: ReactNode;
|
|
759
1165
|
/** What is empty, in a few words: "No price drops yet". */
|
|
@@ -765,22 +1171,26 @@ interface EmptyStateProps {
|
|
|
765
1171
|
/** compact: no border, fills a widget body. Default: dashed box on a page. */
|
|
766
1172
|
compact?: boolean;
|
|
767
1173
|
className?: string;
|
|
1174
|
+
ref?: Ref<HTMLDivElement>;
|
|
768
1175
|
}
|
|
769
1176
|
/** What a list, table or widget shows when there is nothing in it yet. */
|
|
770
|
-
declare function EmptyState({ icon, title, detail, action, compact, className }: EmptyStateProps): react.JSX.Element;
|
|
771
|
-
interface ErrorStateProps {
|
|
772
|
-
/** What failed and, when known, what to do about it. */
|
|
1177
|
+
declare function EmptyState({ icon, title, detail, action, compact, className, ref, ...rest }: EmptyStateProps): react.JSX.Element;
|
|
1178
|
+
interface ErrorStateProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
1179
|
+
/** What failed and, when known, what to do about it. Default "Failed to load". */
|
|
773
1180
|
message?: ReactNode;
|
|
774
1181
|
/** Shows a Retry button when given. */
|
|
775
1182
|
onRetry?: () => void;
|
|
1183
|
+
/** Text of the Retry button. Default "Retry". */
|
|
1184
|
+
retryLabel?: string;
|
|
776
1185
|
/** Spinner on the Retry button while the retry runs. */
|
|
777
1186
|
retrying?: boolean;
|
|
778
1187
|
/** No box: fills a widget body. Default: a tinted box on a page. */
|
|
779
1188
|
compact?: boolean;
|
|
780
1189
|
className?: string;
|
|
1190
|
+
ref?: Ref<HTMLDivElement>;
|
|
781
1191
|
}
|
|
782
1192
|
/** A failed load, announced to screen readers (role="alert"), with an optional Retry. */
|
|
783
|
-
declare function ErrorState({ message, onRetry, retrying, compact, className, }: ErrorStateProps): react.JSX.Element;
|
|
1193
|
+
declare function ErrorState({ message, onRetry, retryLabel, retrying, compact, className, ref, ...rest }: ErrorStateProps): react.JSX.Element;
|
|
784
1194
|
|
|
785
1195
|
type ToastTone = 'success' | 'error' | 'warn' | 'info';
|
|
786
1196
|
/** A button inside a toast, such as Undo. */
|
|
@@ -797,7 +1207,8 @@ interface ToastOptions {
|
|
|
797
1207
|
* onClick and then dismisses the toast. */
|
|
798
1208
|
action?: ToastAction;
|
|
799
1209
|
/** Milliseconds before it dismisses itself, or 'sticky' to stay until dismissed.
|
|
800
|
-
* Default 4000; errors default to 'sticky'
|
|
1210
|
+
* Default 4000; errors default to 'sticky'; Infinity means 'sticky'. Sticky toasts and
|
|
1211
|
+
* errors are never pushed out by newer toasts. The timer pauses while the toast is
|
|
801
1212
|
* hovered or holds focus. */
|
|
802
1213
|
duration?: number | 'sticky';
|
|
803
1214
|
/** A slot name. A new toast with the same id replaces the old one instead of
|
|
@@ -821,18 +1232,29 @@ interface ToastItem {
|
|
|
821
1232
|
/** Remove a toast now, by the id toast() returned. */
|
|
822
1233
|
declare function dismissToast(id: number): void;
|
|
823
1234
|
type ToastCall = (title: string, bodyOrOptions?: string | ToastOptions) => number;
|
|
1235
|
+
/** What toast.promise shows: a sticky toast while the promise is pending, replaced by a
|
|
1236
|
+
* success or an error toast. Each message may be a function of the result or the error. */
|
|
1237
|
+
interface ToastPromiseMessages<T> {
|
|
1238
|
+
loading: string;
|
|
1239
|
+
success: string | ((value: T) => string);
|
|
1240
|
+
error: string | ((error: unknown) => string);
|
|
1241
|
+
}
|
|
824
1242
|
type ToastFn = ToastCall & {
|
|
825
1243
|
success: ToastCall;
|
|
826
1244
|
error: ToastCall;
|
|
827
1245
|
warn: ToastCall;
|
|
828
1246
|
info: ToastCall;
|
|
1247
|
+
/** Shows the loading message until the promise settles, then swaps it for the success or
|
|
1248
|
+
* error message in the same slot. Returns the promise itself, so a rejection still reaches the caller. */
|
|
1249
|
+
promise: <T>(promise: Promise<T>, messages: ToastPromiseMessages<T>) => Promise<T>;
|
|
829
1250
|
};
|
|
830
1251
|
/** toast('Saved'), toast.error('Could not save', detail), or
|
|
831
|
-
* toast.success('Archived', { action: { label: 'Undo', onClick: undo }, id: 'undo' }).
|
|
1252
|
+
* toast.success('Archived', { action: { label: 'Undo', onClick: undo }, id: 'undo' }).
|
|
1253
|
+
* Each call returns the toast's id for dismissToast(). */
|
|
832
1254
|
declare const toast: ToastFn;
|
|
833
1255
|
/** Same API as a hook, for code that prefers one. */
|
|
834
1256
|
declare function useToast(): ToastFn;
|
|
835
|
-
interface ToasterProps {
|
|
1257
|
+
interface ToasterProps extends Omit<ComponentPropsWithoutRef<'div'>, 'className' | 'children'> {
|
|
836
1258
|
/** Extra classes for the stack, e.g. to lift it above a bottom nav: sm:bottom-20. */
|
|
837
1259
|
className?: string;
|
|
838
1260
|
/** Distance from the bottom of the screen on phones (under 640px, or up to
|
|
@@ -845,18 +1267,44 @@ interface ToasterProps {
|
|
|
845
1267
|
* the bar. From sm the stack still moves to the bottom right; between sm and this
|
|
846
1268
|
* breakpoint it keeps the offset. */
|
|
847
1269
|
offsetUntil?: 'sm' | 'md' | 'lg';
|
|
1270
|
+
/** The stack's root element. */
|
|
1271
|
+
ref?: Ref<HTMLDivElement>;
|
|
848
1272
|
}
|
|
849
1273
|
/** The toast stack: bottom-center full width on phones, bottom-right on wider screens.
|
|
850
1274
|
* It sits above any bottom bar through --nish-bottom-inset, and moves to the top of
|
|
851
1275
|
* the screen on phones while a sheet or dialog is open (html[data-nish-layer-open]). */
|
|
852
|
-
declare function Toaster({ className, offset, offsetUntil }: ToasterProps): react.
|
|
1276
|
+
declare function Toaster({ className, offset, offsetUntil, style: userStyle, ref, ...rest }: ToasterProps): react.JSX.Element;
|
|
1277
|
+
|
|
1278
|
+
interface MenuItemClassOptions {
|
|
1279
|
+
/** The current choice: the highlighted look (set aria-current on the row too). */
|
|
1280
|
+
active?: boolean;
|
|
1281
|
+
/** A destructive action: loss-colored text and hover. */
|
|
1282
|
+
danger?: boolean;
|
|
1283
|
+
/** The disabled look (set disabled or aria-disabled on the row too). */
|
|
1284
|
+
disabled?: boolean;
|
|
1285
|
+
/** Extra classes, merged last. */
|
|
1286
|
+
className?: string;
|
|
1287
|
+
}
|
|
1288
|
+
/** The classes `<MenuItem>` renders, for menu-looking rows that are not in a
|
|
1289
|
+
* DropdownMenu: tabbable buttons in a Popover panel that also holds IconButtons,
|
|
1290
|
+
* inputs or color pickers. The rows keep their own roles (plain buttons, Tab order);
|
|
1291
|
+
* hover and keyboard focus get the same highlight as MenuItem. */
|
|
1292
|
+
declare function menuItemClass({ active, danger, disabled, className }?: MenuItemClassOptions): string;
|
|
853
1293
|
|
|
854
|
-
interface ModalProps {
|
|
1294
|
+
interface ModalProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title' | 'children' | 'className'> {
|
|
855
1295
|
/** Heading of the dialog; also its accessible name. Optional only when `header`
|
|
856
1296
|
* replaces the title row (then pass `aria-label`). */
|
|
857
1297
|
title?: ReactNode;
|
|
858
|
-
/** Called on Escape, a backdrop click and the close button. Unmount the modal here
|
|
859
|
-
|
|
1298
|
+
/** Called on Escape, a backdrop click and the close button. Unmount the modal here
|
|
1299
|
+
* (or set `open` to false). Optional when `onOpenChange` is used. */
|
|
1300
|
+
onClose?: () => void;
|
|
1301
|
+
/** Controlled open state. When given, the modal renders only while it is true and
|
|
1302
|
+
* `onOpenChange(false)` asks you to close it. When omitted, a mounted Modal is open
|
|
1303
|
+
* (the parent unmounts it in `onClose`). */
|
|
1304
|
+
open?: boolean;
|
|
1305
|
+
/** Called with false on Escape, a backdrop click and the close button, together with
|
|
1306
|
+
* `onClose`. */
|
|
1307
|
+
onOpenChange?: (open: boolean) => void;
|
|
860
1308
|
/** The body. It scrolls when taller than the screen. */
|
|
861
1309
|
children: ReactNode;
|
|
862
1310
|
/** md: compact dialogs (default). lg / xl: wide content like guides and editors.
|
|
@@ -890,19 +1338,30 @@ interface ModalProps {
|
|
|
890
1338
|
* dialog open with no exit animation, e.g. while a form holds invalid input; show
|
|
891
1339
|
* the reason yourself. */
|
|
892
1340
|
canClose?: () => boolean;
|
|
1341
|
+
/** Classes for the dialog panel. */
|
|
893
1342
|
className?: string;
|
|
1343
|
+
/** The dialog panel (role="dialog"). */
|
|
1344
|
+
ref?: Ref<HTMLDivElement>;
|
|
894
1345
|
}
|
|
895
1346
|
/** Dialog: centered panel on wide screens, bottom sheet under 640px. Closes on
|
|
896
1347
|
* Escape and backdrop click, traps Tab inside, returns focus to the opener, and
|
|
897
|
-
* locks page scroll (on both <html> and <body>) while open.
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
1348
|
+
* locks page scroll (on both <html> and <body>) while open. Renders through a Portal:
|
|
1349
|
+
* nothing on the server. */
|
|
1350
|
+
declare function Modal({ open, ...props }: ModalProps): react.JSX.Element | null;
|
|
1351
|
+
interface DrawerProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title' | 'children' | 'className'> {
|
|
1352
|
+
/** Heading of the drawer; also its accessible name unless `aria-label` is set. Optional
|
|
1353
|
+
* only when you pass `aria-label` or `aria-labelledby`. */
|
|
1354
|
+
title?: ReactNode;
|
|
902
1355
|
/** A line under the title (counts, status, timestamps). */
|
|
903
1356
|
subtitle?: ReactNode;
|
|
904
|
-
/** Called on Escape, a scrim click and the close button. Unmount the drawer here
|
|
905
|
-
|
|
1357
|
+
/** Called on Escape, a scrim click and the close button. Unmount the drawer here (or set
|
|
1358
|
+
* `open` to false). Optional when `onOpenChange` is used. */
|
|
1359
|
+
onClose?: () => void;
|
|
1360
|
+
/** Controlled open state. When given, the drawer renders only while it is true and
|
|
1361
|
+
* `onOpenChange(false)` asks you to close it. When omitted, a mounted Drawer is open. */
|
|
1362
|
+
open?: boolean;
|
|
1363
|
+
/** Called with false on Escape, a scrim click and the close button, together with `onClose`. */
|
|
1364
|
+
onOpenChange?: (open: boolean) => void;
|
|
906
1365
|
/** right (default) and left: a full-height panel from that edge. bottom: a sheet
|
|
907
1366
|
* from the bottom edge at every width. */
|
|
908
1367
|
side?: 'right' | 'left' | 'bottom';
|
|
@@ -932,19 +1391,22 @@ interface DrawerProps {
|
|
|
932
1391
|
children: ReactNode;
|
|
933
1392
|
/** Classes for the panel. */
|
|
934
1393
|
className?: string;
|
|
1394
|
+
/** The drawer panel (role="dialog"). */
|
|
1395
|
+
ref?: Ref<HTMLDivElement>;
|
|
935
1396
|
}
|
|
936
1397
|
/** A panel that slides in from an edge: notifications, an assistant, filters, a phone
|
|
937
1398
|
* "More" sheet. It is a modal dialog: it traps Tab, closes on Escape and a scrim
|
|
938
|
-
* click, returns focus to the opener and locks page scroll.
|
|
939
|
-
|
|
1399
|
+
* click, returns focus to the opener and locks page scroll. Renders through a Portal:
|
|
1400
|
+
* nothing on the server. */
|
|
1401
|
+
declare function Drawer({ open, ...props }: DrawerProps): react.JSX.Element | null;
|
|
940
1402
|
interface ConfirmDialogProps {
|
|
941
1403
|
/** The question, e.g. "Delete this tracker?". Also the dialog's name. */
|
|
942
1404
|
title: ReactNode;
|
|
943
|
-
/** What happens if they confirm. Keep it to a sentence or two. */
|
|
1405
|
+
/** What happens if they confirm. Keep it to a sentence or two. The dialog's description. */
|
|
944
1406
|
body?: ReactNode;
|
|
945
1407
|
/** The confirm button's label: a verb that names the action ("Delete", "Archive"). */
|
|
946
1408
|
confirmLabel: string;
|
|
947
|
-
/** The cancel button's label. Default "Cancel". */
|
|
1409
|
+
/** The cancel button's label. Default "Cancel" (or the provider's `cancel` string). */
|
|
948
1410
|
cancelLabel?: string;
|
|
949
1411
|
/** danger (default): a red confirm button, and focus starts on Cancel. primary: an
|
|
950
1412
|
* accent confirm button that takes the first focus. */
|
|
@@ -954,17 +1416,24 @@ interface ConfirmDialogProps {
|
|
|
954
1416
|
pending?: boolean;
|
|
955
1417
|
/** Runs the action. Close the dialog (unmount it) when it is done. */
|
|
956
1418
|
onConfirm: () => void;
|
|
957
|
-
/** Called on Cancel, Escape and a backdrop click. Unmount the dialog here
|
|
958
|
-
|
|
1419
|
+
/** Called on Cancel, Escape and a backdrop click. Unmount the dialog here (or set
|
|
1420
|
+
* `open` to false). Optional when `onOpenChange` is used. */
|
|
1421
|
+
onCancel?: () => void;
|
|
1422
|
+
/** Controlled open state. When given, the dialog renders only while it is true. When
|
|
1423
|
+
* omitted, a mounted ConfirmDialog is open. */
|
|
1424
|
+
open?: boolean;
|
|
1425
|
+
/** Called with false on Cancel, Escape and a backdrop click, together with `onCancel`. */
|
|
1426
|
+
onOpenChange?: (open: boolean) => void;
|
|
959
1427
|
}
|
|
960
1428
|
/** A yes-or-no question before an action, in place of `window.confirm`: a small
|
|
961
|
-
* Modal with Cancel and a confirm button. */
|
|
962
|
-
declare function ConfirmDialog({ title, body, confirmLabel, cancelLabel, tone, pending, onConfirm, onCancel, }: ConfirmDialogProps): react.JSX.Element;
|
|
963
|
-
interface TooltipProps {
|
|
1429
|
+
* Modal (role="alertdialog") with Cancel and a confirm button. */
|
|
1430
|
+
declare function ConfirmDialog({ title, body, confirmLabel, cancelLabel, tone, pending, onConfirm, onCancel, open, onOpenChange, }: ConfirmDialogProps): react.JSX.Element;
|
|
1431
|
+
interface TooltipProps extends Omit<ComponentPropsWithoutRef<'span'>, 'children' | 'className'> {
|
|
964
1432
|
/** What the tooltip says. Keep it to a sentence or two. */
|
|
965
1433
|
tip: ReactNode;
|
|
966
|
-
/** The trigger.
|
|
967
|
-
*
|
|
1434
|
+
/** The trigger. When it is a single focusable element (a button, a link, an IconButton)
|
|
1435
|
+
* it gets `aria-describedby` and no extra Tab stop; any other content is wrapped in a
|
|
1436
|
+
* focusable span so keyboard users can read the tip. */
|
|
968
1437
|
children: ReactNode;
|
|
969
1438
|
className?: string;
|
|
970
1439
|
/** Preferred side; flips to the opposite one when there is no room. `right` suits
|
|
@@ -973,20 +1442,25 @@ interface TooltipProps {
|
|
|
973
1442
|
/** Element used for the trigger. Pass `tr` inside tables, where a span would be
|
|
974
1443
|
* invalid markup and get hoisted out of the table by the parser. */
|
|
975
1444
|
as?: 'span' | 'tr';
|
|
976
|
-
/** Adds the
|
|
1445
|
+
/** Adds the wrapper to the Tab order. Default: true, except when the child is a single
|
|
1446
|
+
* focusable element (that element is the tab stop). Set false for dense marks such
|
|
977
1447
|
* as 60 chart bars, and make the value reachable another way. */
|
|
978
1448
|
focusable?: boolean;
|
|
979
1449
|
/** default: the trigger keeps its own look. hint: a dotted underline and a help
|
|
980
1450
|
* cursor, for a term whose meaning the tip explains. */
|
|
981
1451
|
variant?: 'default' | 'hint';
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1452
|
+
/** The trigger wrapper. */
|
|
1453
|
+
ref?: Ref<HTMLElement>;
|
|
1454
|
+
}
|
|
1455
|
+
/** Hover/focus tooltip rendered through a portal (into the dialog it sits in, else the
|
|
1456
|
+
* configured container, else <body>), so `overflow:hidden` ancestors (truncated labels,
|
|
1457
|
+
* scrolling tables) can never clip it. Positioned from the trigger's viewport rect,
|
|
1458
|
+
* flipped and clamped to stay on screen. Escape dismisses it, and the pointer can move
|
|
1459
|
+
* onto it (WCAG 1.4.13). */
|
|
1460
|
+
declare function Tooltip({ tip, children, className, side, as, focusable, variant, ref, ...rest }: TooltipProps): react.JSX.Element;
|
|
987
1461
|
/** Why a Popover or DropdownMenu closed itself: Escape, a press outside, or Tab out. */
|
|
988
1462
|
type PopoverCloseReason = 'escape' | 'outside' | 'tab';
|
|
989
|
-
interface PopoverProps {
|
|
1463
|
+
interface PopoverProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className'> {
|
|
990
1464
|
/** Whether the panel shows. The popover is controlled: pair it with `onOpenChange`. */
|
|
991
1465
|
open: boolean;
|
|
992
1466
|
/** Called with false on Escape, a press outside, and Tab out of the panel. The second
|
|
@@ -1001,7 +1475,8 @@ interface PopoverProps {
|
|
|
1001
1475
|
anchor: RefObject<HTMLElement | null>;
|
|
1002
1476
|
/** Preferred side; flips when there is no room. Default bottom. */
|
|
1003
1477
|
side?: 'top' | 'bottom';
|
|
1004
|
-
/** Which edge of the anchor the panel lines up with
|
|
1478
|
+
/** Which edge of the anchor the panel lines up with (mirrored in right-to-left
|
|
1479
|
+
* layouts). Default start. */
|
|
1005
1480
|
align?: 'start' | 'center' | 'end';
|
|
1006
1481
|
/** Panel width: a number of pixels or any CSS length. Default: fits the content. */
|
|
1007
1482
|
width?: number | string;
|
|
@@ -1010,16 +1485,20 @@ interface PopoverProps {
|
|
|
1010
1485
|
/** Classes for the panel (e.g. `p-0`, or `app-region-no-drag` in Electron apps). */
|
|
1011
1486
|
className?: string;
|
|
1012
1487
|
children: ReactNode;
|
|
1488
|
+
/** The popover panel (role="dialog"). */
|
|
1489
|
+
ref?: Ref<HTMLDivElement>;
|
|
1013
1490
|
}
|
|
1014
1491
|
/** A non-modal floating panel anchored to an element: filters, a color picker, a
|
|
1015
1492
|
* details card. Portaled (so no parent clips it), flipped and clamped to the screen.
|
|
1016
|
-
* Escape and a press outside close it; focus returns to the anchor.
|
|
1017
|
-
|
|
1018
|
-
|
|
1493
|
+
* Escape and a press outside close it; focus returns to the anchor. Renders nothing on
|
|
1494
|
+
* the server. */
|
|
1495
|
+
declare function Popover({ open, onOpenChange, dismissOnOutside, anchor, side, align, width, 'aria-label': ariaLabel, className, children, ref, style, onKeyDown: userKeyDown, ...rest }: PopoverProps): react.ReactPortal | null;
|
|
1496
|
+
interface DropdownMenuProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className' | 'onChange'> {
|
|
1019
1497
|
/** The button that opens the menu (a Button or IconButton). It gets aria-haspopup,
|
|
1020
1498
|
* aria-expanded and aria-controls, opens on click, and on ArrowDown / ArrowUp. */
|
|
1021
1499
|
trigger: ReactElement;
|
|
1022
|
-
/** Which edge of the trigger the menu lines up with
|
|
1500
|
+
/** Which edge of the trigger the menu lines up with (mirrored in right-to-left
|
|
1501
|
+
* layouts). Default start. */
|
|
1023
1502
|
align?: 'start' | 'center' | 'end';
|
|
1024
1503
|
/** Preferred side; flips when there is no room. Default bottom. */
|
|
1025
1504
|
side?: 'top' | 'bottom';
|
|
@@ -1038,30 +1517,18 @@ interface DropdownMenuProps {
|
|
|
1038
1517
|
/** `'sm'`: under 640px the menu opens as a bottom sheet with 48px rows instead of a
|
|
1039
1518
|
* floating panel. Default false (always a floating panel). */
|
|
1040
1519
|
sheetBelow?: 'sm' | false;
|
|
1041
|
-
/** Title of the bottom sheet when `sheetBelow` is set. Default "Menu"
|
|
1520
|
+
/** Title of the bottom sheet when `sheetBelow` is set. Default "Menu" (the provider's
|
|
1521
|
+
* `menu` string). */
|
|
1042
1522
|
sheetTitle?: string;
|
|
1043
1523
|
/** Classes for the menu panel (e.g. a width, or `app-region-no-drag`). */
|
|
1044
1524
|
className?: string;
|
|
1525
|
+
/** The menu panel (role="menu"). */
|
|
1526
|
+
ref?: Ref<HTMLDivElement>;
|
|
1045
1527
|
}
|
|
1046
1528
|
/** A menu of actions behind a button: role="menu" with arrow keys, Home and End,
|
|
1047
1529
|
* Escape, Tab to leave, and focus back on the trigger when it closes. */
|
|
1048
|
-
declare function DropdownMenu({ trigger, align, side, children, open: openProp, onOpenChange, defaultOpen, 'aria-label': ariaLabel, sheetBelow, sheetTitle, className, }: DropdownMenuProps): react.JSX.Element;
|
|
1049
|
-
interface
|
|
1050
|
-
/** The current choice: the highlighted look (set aria-current on the row too). */
|
|
1051
|
-
active?: boolean;
|
|
1052
|
-
/** A destructive action: loss-colored text and hover. */
|
|
1053
|
-
danger?: boolean;
|
|
1054
|
-
/** The disabled look (set disabled or aria-disabled on the row too). */
|
|
1055
|
-
disabled?: boolean;
|
|
1056
|
-
/** Extra classes, merged last. */
|
|
1057
|
-
className?: string;
|
|
1058
|
-
}
|
|
1059
|
-
/** The classes `<MenuItem>` renders, for menu-looking rows that are not in a
|
|
1060
|
-
* DropdownMenu: tabbable buttons in a Popover panel that also holds IconButtons,
|
|
1061
|
-
* inputs or color pickers. The rows keep their own roles (plain buttons, Tab order);
|
|
1062
|
-
* hover and keyboard focus get the same highlight as MenuItem. */
|
|
1063
|
-
declare function menuItemClass({ active, danger, disabled, className }?: MenuItemClassOptions): string;
|
|
1064
|
-
interface MenuItemProps {
|
|
1530
|
+
declare function DropdownMenu({ trigger, align, side, children, open: openProp, onOpenChange, defaultOpen, 'aria-label': ariaLabel, sheetBelow, sheetTitle, className, ref, style, onKeyDown: userKeyDown, ...rest }: DropdownMenuProps): react.JSX.Element;
|
|
1531
|
+
interface MenuItemProps extends Omit<ComponentPropsWithoutRef<'button'>, 'onSelect' | 'children' | 'className' | 'type' | 'role'> {
|
|
1065
1532
|
/** Leading icon (14px reads best). */
|
|
1066
1533
|
icon?: ReactNode;
|
|
1067
1534
|
/** Right-aligned extra: a shortcut (Kbd), a count or a chevron. */
|
|
@@ -1079,32 +1546,84 @@ interface MenuItemProps {
|
|
|
1079
1546
|
/** Classes for the row. */
|
|
1080
1547
|
className?: string;
|
|
1081
1548
|
children: ReactNode;
|
|
1549
|
+
/** The row's button. */
|
|
1550
|
+
ref?: Ref<HTMLButtonElement>;
|
|
1082
1551
|
}
|
|
1083
1552
|
/** One action in a DropdownMenu. */
|
|
1084
|
-
declare function MenuItem({ icon, trailing, danger, active, disabled, onSelect, className, children }: MenuItemProps): react.JSX.Element;
|
|
1553
|
+
declare function MenuItem({ icon, trailing, danger, active, disabled, onSelect, className, children, ref, onClick, onMouseMove, ...rest }: MenuItemProps): react.JSX.Element;
|
|
1085
1554
|
/** A small heading over a group of MenuItems. Not focusable. */
|
|
1086
|
-
declare function MenuLabel({ children, className }: {
|
|
1087
|
-
children: ReactNode;
|
|
1555
|
+
declare function MenuLabel({ children, className, ref, ...rest }: Omit<ComponentPropsWithoutRef<'div'>, 'className' | 'role'> & {
|
|
1088
1556
|
className?: string;
|
|
1557
|
+
ref?: Ref<HTMLDivElement>;
|
|
1089
1558
|
}): react.JSX.Element;
|
|
1090
1559
|
/** A thin line between groups of MenuItems. */
|
|
1091
|
-
declare function MenuSeparator({ className }: {
|
|
1560
|
+
declare function MenuSeparator({ className, ref, ...rest }: Omit<ComponentPropsWithoutRef<'div'>, 'className' | 'role' | 'children'> & {
|
|
1092
1561
|
className?: string;
|
|
1562
|
+
ref?: Ref<HTMLDivElement>;
|
|
1093
1563
|
}): react.JSX.Element;
|
|
1094
|
-
interface MenuSubHeaderProps {
|
|
1095
|
-
/** Goes back to the parent view (also on ArrowLeft
|
|
1564
|
+
interface MenuSubHeaderProps extends Omit<ComponentPropsWithoutRef<'button'>, 'onClick' | 'children' | 'className' | 'type' | 'role'> {
|
|
1565
|
+
/** Goes back to the parent view (also on ArrowLeft, ArrowRight in right-to-left
|
|
1566
|
+
* layouts). The menu stays open. */
|
|
1096
1567
|
onBack: () => void;
|
|
1097
1568
|
/** The submenu's title. */
|
|
1098
1569
|
children: ReactNode;
|
|
1099
1570
|
className?: string;
|
|
1571
|
+
/** The header's button. */
|
|
1572
|
+
ref?: Ref<HTMLButtonElement>;
|
|
1100
1573
|
}
|
|
1101
1574
|
/** The first row of a submenu view shown in place: a back arrow and the view's title. */
|
|
1102
|
-
declare function MenuSubHeader({ onBack, children, className }: MenuSubHeaderProps): react.JSX.Element;
|
|
1575
|
+
declare function MenuSubHeader({ onBack, children, className, ref, onKeyDown, ...rest }: MenuSubHeaderProps): react.JSX.Element;
|
|
1103
1576
|
|
|
1104
1577
|
/** Status tones shared by the display components. */
|
|
1105
1578
|
type StatusTone = 'ok' | 'warn' | 'loss' | 'info' | 'accent' | 'neutral';
|
|
1106
1579
|
type CalloutTone = 'neutral' | 'accent' | 'info' | 'ok' | 'warn' | 'loss';
|
|
1107
|
-
|
|
1580
|
+
/** ok for a positive number, loss for a negative one, neutral for zero or nothing.
|
|
1581
|
+
* Replaces `n >= 0 ? gain : loss` ternaries. */
|
|
1582
|
+
declare function signTone(n: number | null | undefined): 'ok' | 'loss' | 'neutral';
|
|
1583
|
+
/** ok, warn or loss for a value against two thresholds. When loss is above warn, higher
|
|
1584
|
+
* is worse (disk use: { warn: 75, loss: 90 }). When loss is below warn, lower is worse
|
|
1585
|
+
* (battery: { warn: 30, loss: 10 }). */
|
|
1586
|
+
declare function toneFor(value: number, t: {
|
|
1587
|
+
warn: number;
|
|
1588
|
+
loss: number;
|
|
1589
|
+
}): 'ok' | 'warn' | 'loss';
|
|
1590
|
+
type ChartTone$1 = `chart-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}`;
|
|
1591
|
+
type MeterTone = 'accent' | 'ok' | 'warn' | 'loss' | 'info' | 'neutral' | ChartTone$1;
|
|
1592
|
+
type SparklineTone = ChartTone$1 | 'accent' | 'ok' | 'warn' | 'loss' | 'info';
|
|
1593
|
+
type ChartLegendTone = ChartTone$1 | 'accent' | 'ok' | 'warn' | 'loss' | 'info';
|
|
1594
|
+
|
|
1595
|
+
declare const DOT_SIZE: {
|
|
1596
|
+
readonly xs: "size-1.5";
|
|
1597
|
+
readonly sm: "size-2";
|
|
1598
|
+
readonly md: "size-2.5";
|
|
1599
|
+
readonly lg: "size-3.5";
|
|
1600
|
+
};
|
|
1601
|
+
declare const STAT_VALUE_SIZE: {
|
|
1602
|
+
readonly sm: "text-base";
|
|
1603
|
+
readonly md: "text-xl";
|
|
1604
|
+
readonly lg: "text-2xl";
|
|
1605
|
+
};
|
|
1606
|
+
declare const GRID_BASE: {
|
|
1607
|
+
readonly 1: "grid-cols-1";
|
|
1608
|
+
readonly 2: "grid-cols-2";
|
|
1609
|
+
readonly 3: "grid-cols-3";
|
|
1610
|
+
readonly 4: "grid-cols-4";
|
|
1611
|
+
};
|
|
1612
|
+
declare const GRID_MD: {
|
|
1613
|
+
readonly 2: "md:grid-cols-2";
|
|
1614
|
+
readonly 3: "md:grid-cols-3";
|
|
1615
|
+
readonly 4: "md:grid-cols-4";
|
|
1616
|
+
readonly 5: "md:grid-cols-5";
|
|
1617
|
+
readonly 6: "md:grid-cols-6";
|
|
1618
|
+
};
|
|
1619
|
+
declare const METER_THICK: {
|
|
1620
|
+
readonly xs: "h-1";
|
|
1621
|
+
readonly sm: "h-1.5";
|
|
1622
|
+
readonly md: "h-2.5";
|
|
1623
|
+
};
|
|
1624
|
+
interface CalloutProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title' | 'onClick'> {
|
|
1625
|
+
/** The root element. */
|
|
1626
|
+
ref?: Ref<HTMLDivElement>;
|
|
1108
1627
|
/** What kind of notice: info and accent for news, ok for success, warn for something to
|
|
1109
1628
|
* check, loss for a failure. neutral is a plain grey note. */
|
|
1110
1629
|
tone?: CalloutTone;
|
|
@@ -1118,6 +1637,8 @@ interface CalloutProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'o
|
|
|
1118
1637
|
action?: ReactNode;
|
|
1119
1638
|
/** Adds a Dismiss button that calls this. */
|
|
1120
1639
|
onDismiss?: () => void;
|
|
1640
|
+
/** Accessible name of the dismiss button. Default: the provider's `dismiss` string. */
|
|
1641
|
+
dismissLabel?: string;
|
|
1121
1642
|
/** box: a rounded tinted box in the flow (default). bar: full width with square
|
|
1122
1643
|
* corners and no side borders, for a sticky page-level alert. */
|
|
1123
1644
|
variant?: 'box' | 'bar';
|
|
@@ -1132,7 +1653,9 @@ interface CalloutProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'o
|
|
|
1132
1653
|
/** Limits the body to 1, 2 or 3 lines with an ellipsis, instead of growing. */
|
|
1133
1654
|
clamp?: 1 | 2 | 3;
|
|
1134
1655
|
/** Makes the icon, title and text one link (at least 44px tall) with a trailing
|
|
1135
|
-
* chevron. `action` and the dismiss button stay separate controls beside it.
|
|
1656
|
+
* chevron. `action` and the dismiss button stay separate controls beside it. A URL that
|
|
1657
|
+
* is not safe (`javascript:` and so on) is dropped with a dev warning, and the callout
|
|
1658
|
+
* is not a link. */
|
|
1136
1659
|
href?: string;
|
|
1137
1660
|
/** Like href, but a button. */
|
|
1138
1661
|
onClick?: () => void;
|
|
@@ -1142,14 +1665,10 @@ interface CalloutProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'o
|
|
|
1142
1665
|
/** An inline notice: a tinted box with an icon, an optional title, text and an action.
|
|
1143
1666
|
* variant="bar" is opaque, so it can stick under the header without content showing
|
|
1144
1667
|
* through. */
|
|
1145
|
-
declare function Callout({ tone, icon, title, children, action, onDismiss, variant, compact, live, sticky, clamp, href, onClick, count, className, ...rest }: CalloutProps): react.JSX.Element;
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
readonly md: "size-2.5";
|
|
1150
|
-
readonly lg: "size-3.5";
|
|
1151
|
-
};
|
|
1152
|
-
interface StatusDotProps {
|
|
1668
|
+
declare function Callout({ tone, icon, title, children, action, onDismiss, dismissLabel, variant, compact, live, sticky, clamp, href: hrefProp, onClick, count, className, ref, ...rest }: CalloutProps): react.JSX.Element;
|
|
1669
|
+
interface StatusDotProps extends Omit<ComponentPropsWithoutRef<'span'>, 'children'> {
|
|
1670
|
+
/** The dot element. */
|
|
1671
|
+
ref?: Ref<HTMLSpanElement>;
|
|
1153
1672
|
/** ok, warn, loss and info use the status fills; accent the accent; neutral the ghost grey. */
|
|
1154
1673
|
tone: StatusTone;
|
|
1155
1674
|
/** xs 6px, sm 8px (default), md 10px, lg 14px. */
|
|
@@ -1161,20 +1680,13 @@ interface StatusDotProps {
|
|
|
1161
1680
|
/** The accessible name read by screen readers ("Up", "Degraded"; role="img"). Without it the
|
|
1162
1681
|
* dot is aria-hidden, so always pair it with visible text then. */
|
|
1163
1682
|
label?: string;
|
|
1164
|
-
className?: string;
|
|
1165
1683
|
}
|
|
1166
1684
|
/** A small round status mark. Color is never the only signal: give it a label or
|
|
1167
|
-
* put text beside it. */
|
|
1168
|
-
declare function StatusDot({ tone, size, pulse, halo, label, className }: StatusDotProps): react.JSX.Element;
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
declare const STAT_VALUE_SIZE: {
|
|
1173
|
-
readonly sm: "text-base";
|
|
1174
|
-
readonly md: "text-xl";
|
|
1175
|
-
readonly lg: "text-2xl";
|
|
1176
|
-
};
|
|
1177
|
-
interface StatProps {
|
|
1685
|
+
* put text beside it. In forced-colors mode it stays visible in the system highlight color. */
|
|
1686
|
+
declare function StatusDot({ tone, size, pulse, halo, label, className, ref, ...rest }: StatusDotProps): react.JSX.Element;
|
|
1687
|
+
interface StatProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'title'> {
|
|
1688
|
+
/** The root element: the card, or the `dl` / `div` of the other variants. */
|
|
1689
|
+
ref?: Ref<HTMLElement>;
|
|
1178
1690
|
/** What the number is: "Open positions", "Uptime (30d)". */
|
|
1179
1691
|
label: ReactNode;
|
|
1180
1692
|
/** The number, already formatted ("$12,480", "99.95%"). */
|
|
@@ -1192,25 +1704,13 @@ interface StatProps {
|
|
|
1192
1704
|
variant?: 'card' | 'inset' | 'plain';
|
|
1193
1705
|
/** Skeleton bars of the same size instead of the value and sub. */
|
|
1194
1706
|
loading?: boolean;
|
|
1195
|
-
className?: string;
|
|
1196
1707
|
}
|
|
1197
1708
|
/** One labelled number. Inside a StatGrid it is a row of the grid's <dl>; on its own it
|
|
1198
1709
|
* renders its own <dl>. */
|
|
1199
|
-
declare function Stat({ label, value, sub, tone, tip, size, variant, loading, className, }: StatProps): react.JSX.Element;
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
readonly 3: "grid-cols-3";
|
|
1204
|
-
readonly 4: "grid-cols-4";
|
|
1205
|
-
};
|
|
1206
|
-
declare const GRID_MD: {
|
|
1207
|
-
readonly 2: "md:grid-cols-2";
|
|
1208
|
-
readonly 3: "md:grid-cols-3";
|
|
1209
|
-
readonly 4: "md:grid-cols-4";
|
|
1210
|
-
readonly 5: "md:grid-cols-5";
|
|
1211
|
-
readonly 6: "md:grid-cols-6";
|
|
1212
|
-
};
|
|
1213
|
-
interface StatGridProps {
|
|
1710
|
+
declare function Stat({ label, value, sub, tone, tip, size, variant, loading, className, ref, ...rest }: StatProps): react.JSX.Element;
|
|
1711
|
+
interface StatGridProps extends Omit<ComponentPropsWithoutRef<'dl'>, 'children'> {
|
|
1712
|
+
/** The `dl` element. */
|
|
1713
|
+
ref?: Ref<HTMLDListElement>;
|
|
1214
1714
|
/** Columns on phones (base, default 2) and from 768px (md, default 4). */
|
|
1215
1715
|
cols?: {
|
|
1216
1716
|
base?: keyof typeof GRID_BASE;
|
|
@@ -1218,25 +1718,12 @@ interface StatGridProps {
|
|
|
1218
1718
|
};
|
|
1219
1719
|
/** Stat elements. */
|
|
1220
1720
|
children: ReactNode;
|
|
1221
|
-
className?: string;
|
|
1222
1721
|
}
|
|
1223
1722
|
/** A responsive grid of Stats, rendered as one <dl>. */
|
|
1224
|
-
declare function StatGrid({ cols, children, className }: StatGridProps): react.JSX.Element;
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
declare function toneFor(value: number, t: {
|
|
1229
|
-
warn: number;
|
|
1230
|
-
loss: number;
|
|
1231
|
-
}): 'ok' | 'warn' | 'loss';
|
|
1232
|
-
type ChartTone$1 = `chart-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}`;
|
|
1233
|
-
type MeterTone = 'accent' | 'ok' | 'warn' | 'loss' | 'info' | 'neutral' | ChartTone$1;
|
|
1234
|
-
declare const METER_THICK: {
|
|
1235
|
-
readonly xs: "h-1";
|
|
1236
|
-
readonly sm: "h-1.5";
|
|
1237
|
-
readonly md: "h-2.5";
|
|
1238
|
-
};
|
|
1239
|
-
interface MeterProps {
|
|
1723
|
+
declare function StatGrid({ cols, children, className, ref, ...rest }: StatGridProps): react.JSX.Element;
|
|
1724
|
+
interface MeterProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'role'> {
|
|
1725
|
+
/** The element with the `meter` / `progressbar` role (the bar itself, also with `showValue`). */
|
|
1726
|
+
ref?: Ref<HTMLDivElement>;
|
|
1240
1727
|
/** The current value, between min and max (clamped). */
|
|
1241
1728
|
value: number;
|
|
1242
1729
|
/** Default 0. */
|
|
@@ -1264,12 +1751,14 @@ interface MeterProps {
|
|
|
1264
1751
|
kind?: 'meter' | 'progress';
|
|
1265
1752
|
/** Shows the rounded percentage beside a horizontal bar. */
|
|
1266
1753
|
showValue?: boolean;
|
|
1267
|
-
className?: string;
|
|
1268
1754
|
}
|
|
1269
|
-
/** A thin bar showing how full something is: disk, quota, progress, a score.
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1755
|
+
/** A thin bar showing how full something is: disk, quota, progress, a score. The fill
|
|
1756
|
+
* stays visible in forced-colors mode (system highlight on a bordered track). `className`
|
|
1757
|
+
* goes on the bar, or on the wrapper row with `showValue`. */
|
|
1758
|
+
declare function Meter({ value, min, max, label, tone, thresholds, size, orientation, track, kind, showValue, className, ref, ...rest }: MeterProps): react.JSX.Element;
|
|
1759
|
+
interface SparklineProps extends Omit<ComponentPropsWithoutRef<'svg'>, 'values' | 'fill' | 'min' | 'max' | 'width' | 'height' | 'children'> {
|
|
1760
|
+
/** The svg element. */
|
|
1761
|
+
ref?: Ref<SVGSVGElement>;
|
|
1273
1762
|
/** The series, oldest first. null leaves a gap (a missed check, a closed market). */
|
|
1274
1763
|
values: (number | null)[];
|
|
1275
1764
|
/** Accessible name, ideally with the trend: "Response time, last 24 hours, 120 to 180 ms". */
|
|
@@ -1286,12 +1775,14 @@ interface SparklineProps {
|
|
|
1286
1775
|
min?: number;
|
|
1287
1776
|
/** Top of the scale. Default: the largest value. */
|
|
1288
1777
|
max?: number;
|
|
1289
|
-
className?: string;
|
|
1290
1778
|
}
|
|
1291
1779
|
/** A tiny line chart with no axes, for a trend beside a number. Plain SVG, no chart
|
|
1292
|
-
* library. Gaps at nulls; a flat dashed line when there is no data.
|
|
1293
|
-
|
|
1294
|
-
|
|
1780
|
+
* library. Gaps at nulls; a flat dashed line when there is no data. The geometry is
|
|
1781
|
+
* recomputed only when `values`, the size or the scale change. */
|
|
1782
|
+
declare function Sparkline({ values, label, tone, width, height, fill, min, max, className, ref, ...rest }: SparklineProps): react.JSX.Element;
|
|
1783
|
+
interface DisclosureProps extends Omit<ComponentPropsWithoutRef<'details'>, 'open' | 'onToggle' | 'children'> {
|
|
1784
|
+
/** The `details` element. */
|
|
1785
|
+
ref?: Ref<HTMLDetailsElement>;
|
|
1295
1786
|
/** The always-visible row that opens and closes it. */
|
|
1296
1787
|
summary: ReactNode;
|
|
1297
1788
|
/** What it reveals. */
|
|
@@ -1304,23 +1795,33 @@ interface DisclosureProps {
|
|
|
1304
1795
|
onOpenChange?: (open: boolean) => void;
|
|
1305
1796
|
/** plain: a bare row (default). card: a bordered surface box. */
|
|
1306
1797
|
variant?: 'plain' | 'card';
|
|
1307
|
-
className?: string;
|
|
1308
1798
|
}
|
|
1309
1799
|
/** Show-more on native <details>/<summary>: keyboard and find-in-page work for free,
|
|
1310
|
-
* with a chevron that turns when open. */
|
|
1311
|
-
declare function Disclosure({ summary, children, defaultOpen, open, onOpenChange, variant, className, }: DisclosureProps): react.JSX.Element;
|
|
1800
|
+
* with a chevron that turns when open. The root carries `data-state="open|closed"`. */
|
|
1801
|
+
declare function Disclosure({ summary, children, defaultOpen, open, onOpenChange, variant, className, ref, ...rest }: DisclosureProps): react.JSX.Element;
|
|
1802
|
+
interface KbdProps extends ComponentPropsWithoutRef<'kbd'> {
|
|
1803
|
+
/** The `kbd` element. */
|
|
1804
|
+
ref?: Ref<HTMLElement>;
|
|
1805
|
+
}
|
|
1312
1806
|
/** A keyboard key or shortcut, e.g. <Kbd>⌘K</Kbd>. */
|
|
1313
|
-
declare function Kbd({ className, ...rest }:
|
|
1314
|
-
/** Copies text to the clipboard. Uses the Clipboard API
|
|
1315
|
-
*
|
|
1807
|
+
declare function Kbd({ className, ref, ...rest }: KbdProps): react.JSX.Element;
|
|
1808
|
+
/** Copies text to the clipboard. Uses the Clipboard API when it exists and the page is a
|
|
1809
|
+
* secure context; otherwise (no API, an insecure origin, a denied permission, an old
|
|
1810
|
+
* browser) it falls back to a hidden textarea and `execCommand('copy')`. Resolves true when
|
|
1811
|
+
* it worked, false when neither path did. */
|
|
1316
1812
|
declare function copyText(text: string): Promise<boolean>;
|
|
1317
|
-
interface CopyButtonProps {
|
|
1813
|
+
interface CopyButtonProps extends Omit<ComponentPropsWithoutRef<'button'>, 'onCopy' | 'onClick' | 'children' | 'type'> {
|
|
1814
|
+
/** The button element. */
|
|
1815
|
+
ref?: Ref<HTMLButtonElement>;
|
|
1318
1816
|
/** What lands on the clipboard. */
|
|
1319
1817
|
text: string;
|
|
1320
|
-
/** Button text, and the accessible name when iconOnly. Default "Copy". */
|
|
1818
|
+
/** Button text, and the accessible name when iconOnly. Default: the provider's `copy` string ("Copy"). */
|
|
1321
1819
|
label?: string;
|
|
1322
|
-
/** Shown for 1.5s after a copy and announced politely. Default
|
|
1820
|
+
/** Shown for 1.5s after a copy and announced politely. Default: the provider's `copied` string. */
|
|
1323
1821
|
copiedLabel?: string;
|
|
1822
|
+
/** Shown for 1.5s when neither the Clipboard API nor the textarea fallback worked, and
|
|
1823
|
+
* announced politely. Default "Copy failed". */
|
|
1824
|
+
failedLabel?: string;
|
|
1324
1825
|
/** A square IconButton instead of a labelled Button. */
|
|
1325
1826
|
iconOnly?: boolean;
|
|
1326
1827
|
/** Button size (or IconButton size when iconOnly). Default sm. */
|
|
@@ -1329,11 +1830,14 @@ interface CopyButtonProps {
|
|
|
1329
1830
|
variant?: ButtonProps['variant'];
|
|
1330
1831
|
/** Called after each copy attempt with whether it worked. */
|
|
1331
1832
|
onCopy?: (ok: boolean) => void;
|
|
1332
|
-
className?: string;
|
|
1333
1833
|
}
|
|
1334
|
-
/** Copies text with one click, shows "Copied" for 1.5s and tells screen readers.
|
|
1335
|
-
|
|
1336
|
-
|
|
1834
|
+
/** Copies text with one click, shows "Copied" for 1.5s and tells screen readers. Without a
|
|
1835
|
+
* Clipboard API (or on an insecure origin) it falls back to a textarea and `execCommand`;
|
|
1836
|
+
* when that fails too it shows `failedLabel` instead. */
|
|
1837
|
+
declare function CopyButton({ text, label, copiedLabel, failedLabel, iconOnly, size, variant, onCopy, className, ref, ...rest }: CopyButtonProps): react.JSX.Element;
|
|
1838
|
+
interface PageHeaderProps extends Omit<ComponentPropsWithoutRef<'header'>, 'title'> {
|
|
1839
|
+
/** The `header` element. */
|
|
1840
|
+
ref?: Ref<HTMLElement>;
|
|
1337
1841
|
/** The page's title. */
|
|
1338
1842
|
title: ReactNode;
|
|
1339
1843
|
/** One sentence under the title. */
|
|
@@ -1353,12 +1857,22 @@ interface PageHeaderProps {
|
|
|
1353
1857
|
/** Sticky only: under 640px, once stuck, hide the description and show the title as
|
|
1354
1858
|
* one truncated line, so the bar stays short. Default true. */
|
|
1355
1859
|
collapseWhenStuck?: boolean;
|
|
1356
|
-
className?: string;
|
|
1357
1860
|
}
|
|
1358
1861
|
/** The title block at the top of a page: optional back link and eyebrow, the title,
|
|
1359
1862
|
* a description and actions. */
|
|
1360
|
-
declare function PageHeader({ title, description, eyebrow, back, actions, as: H, sticky, collapseWhenStuck, className, }: PageHeaderProps): react.JSX.Element;
|
|
1361
|
-
|
|
1863
|
+
declare function PageHeader({ title, description, eyebrow, back, actions, as: H, sticky, collapseWhenStuck, className, ref: refProp, ...rest }: PageHeaderProps): react.JSX.Element;
|
|
1864
|
+
/** The hub pill: a link back to the site that hosts a family of apps. */
|
|
1865
|
+
interface AppHeaderHub {
|
|
1866
|
+
/** Where the pill goes. An unsafe URL (`javascript:` and so on) hides the pill with a dev warning. */
|
|
1867
|
+
href: string;
|
|
1868
|
+
/** The pill text after the arrow ("nish.software", "Acme home"). */
|
|
1869
|
+
label: ReactNode;
|
|
1870
|
+
/** The pill's title attribute. Default: the provider's `hubTitle` string. */
|
|
1871
|
+
title?: string;
|
|
1872
|
+
}
|
|
1873
|
+
interface AppHeaderProps extends Omit<ComponentPropsWithoutRef<'header'>, 'children'> {
|
|
1874
|
+
/** The `header` element. */
|
|
1875
|
+
ref?: Ref<HTMLElement>;
|
|
1362
1876
|
/** The app's name, shown as the wordmark. */
|
|
1363
1877
|
name: ReactNode;
|
|
1364
1878
|
/** An icon before the name, drawn in the accent color. */
|
|
@@ -1367,8 +1881,10 @@ interface AppHeaderProps {
|
|
|
1367
1881
|
* switcher, a wordmark with a subtitle). It is not wrapped in a link; `name` stays for
|
|
1368
1882
|
* screen readers. */
|
|
1369
1883
|
brand?: ReactNode;
|
|
1370
|
-
/**
|
|
1371
|
-
|
|
1884
|
+
/** A pill at the start of the header that links back to a hub site ("← nish.software").
|
|
1885
|
+
* Default false: no pill. The nish.software apps pass
|
|
1886
|
+
* `{ href: 'https://nish.software', label: 'nish.software' }`. */
|
|
1887
|
+
hub?: AppHeaderHub | false;
|
|
1372
1888
|
/** Buttons before the theme toggle. */
|
|
1373
1889
|
actions?: ReactNode;
|
|
1374
1890
|
/** A second row of nav links (use tabClass on each, aria-current on the active one). */
|
|
@@ -1384,8 +1900,8 @@ interface AppHeaderProps {
|
|
|
1384
1900
|
/** Under 640px show only the icon; the name stays for screen readers, so the pill,
|
|
1385
1901
|
* actions and theme toggle fit on one row. Needs an icon. */
|
|
1386
1902
|
hideNameBelow?: 'sm';
|
|
1387
|
-
/** Names the nav row's <nav> landmark
|
|
1388
|
-
*
|
|
1903
|
+
/** Names the nav row's <nav> landmark. Default: the provider's `sections` string. Give
|
|
1904
|
+
* each nav on a page its own name. */
|
|
1389
1905
|
navLabel?: string;
|
|
1390
1906
|
/** Under 480px the hub pill shrinks to its arrow (.nish-pill-link--compact), for
|
|
1391
1907
|
* headers with a long name. */
|
|
@@ -1396,13 +1912,14 @@ interface AppHeaderProps {
|
|
|
1396
1912
|
/** Extra MenuItems. From 640px they render after `actions`; under 640px they collapse
|
|
1397
1913
|
* into a "More actions" kebab menu, so the row never wraps. */
|
|
1398
1914
|
overflowActions?: ReactNode;
|
|
1399
|
-
className?: string;
|
|
1400
1915
|
}
|
|
1401
|
-
/** The shared app header:
|
|
1916
|
+
/** The shared app header: an optional hub pill, the wordmark, actions and the theme toggle,
|
|
1402
1917
|
* with an optional nav row. Opaque by default (glass is opt-in), safe-area aware. A
|
|
1403
1918
|
* sticky header publishes its height as `--nish-header-h` for the rest of the layout. */
|
|
1404
|
-
declare function AppHeader({ name, icon, brand,
|
|
1405
|
-
interface SectionHeaderProps {
|
|
1919
|
+
declare function AppHeader({ name, icon, brand, hub, actions, nav, themeToggle, sticky, innerClassName, homeHref, hideNameBelow, navLabel, compactPill, glass, overflowActions, className, ref: refProp, ...rest }: AppHeaderProps): react.JSX.Element;
|
|
1920
|
+
interface SectionHeaderProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title' | 'id'> {
|
|
1921
|
+
/** The wrapper row. */
|
|
1922
|
+
ref?: Ref<HTMLDivElement>;
|
|
1406
1923
|
/** The section's title. */
|
|
1407
1924
|
title: ReactNode;
|
|
1408
1925
|
/** id for the heading, so the section can point aria-labelledby at it. */
|
|
@@ -1413,11 +1930,10 @@ interface SectionHeaderProps {
|
|
|
1413
1930
|
meta?: ReactNode;
|
|
1414
1931
|
/** A control on the right, after meta (a Button, a Segmented, a link). */
|
|
1415
1932
|
action?: ReactNode;
|
|
1416
|
-
className?: string;
|
|
1417
1933
|
}
|
|
1418
1934
|
/** The heading row of a section inside a page: the title, with optional meta text
|
|
1419
1935
|
* and an action on the right. Smaller than PageHeader, larger than CardHeader. */
|
|
1420
|
-
declare function SectionHeader({ title, id, as: H, meta, action, className }: SectionHeaderProps): react.JSX.Element;
|
|
1936
|
+
declare function SectionHeader({ title, id, as: H, meta, action, className, ref, ...rest }: SectionHeaderProps): react.JSX.Element;
|
|
1421
1937
|
interface KeyValueItem {
|
|
1422
1938
|
/** React key; unique in the list. */
|
|
1423
1939
|
key: string;
|
|
@@ -1432,59 +1948,59 @@ interface KeyValueItem {
|
|
|
1432
1948
|
* - `'words'`: prose (a phrase-long status or error). Both cells wrap at word breaks,
|
|
1433
1949
|
* labels first: the label keeps its one-line width up to 60% of the row
|
|
1434
1950
|
* (`shrink-0 max-w-[calc(60%-0.75rem)]`), so a short label never wraps one word per
|
|
1435
|
-
* line, and the value takes the rest, at least 40% (`min-w-0 flex-1 text-
|
|
1951
|
+
* line, and the value takes the rest, at least 40% (`min-w-0 flex-1 text-end`). A
|
|
1436
1952
|
* word splits only when it alone is wider than its cell (`overflow-wrap: anywhere`).
|
|
1437
1953
|
* Without `wrap` the value keeps its full width, so keep it short. */
|
|
1438
1954
|
wrap?: boolean | 'anywhere' | 'words';
|
|
1439
1955
|
}
|
|
1440
|
-
interface KeyValueListProps {
|
|
1956
|
+
interface KeyValueListProps extends Omit<ComponentPropsWithoutRef<'ul'>, 'children'> {
|
|
1957
|
+
/** The `ul` or `dl` element. */
|
|
1958
|
+
ref?: Ref<HTMLElement>;
|
|
1441
1959
|
items: KeyValueItem[];
|
|
1442
1960
|
/** Rows 32px tall instead of 44px, for dense panels. */
|
|
1443
1961
|
dense?: boolean;
|
|
1444
1962
|
/** ul: a list of rows (default). dl: a description list with dt and dd, for label
|
|
1445
1963
|
* and value pairs that read as "name: value". */
|
|
1446
1964
|
as?: 'ul' | 'dl';
|
|
1447
|
-
className?: string;
|
|
1448
1965
|
}
|
|
1449
1966
|
/** Label and value rows with dividers: services and their status, runner details,
|
|
1450
1967
|
* vitals. Each row is at least 44px tall (32px dense); an item with `wrap` lets its row
|
|
1451
1968
|
* wrap and grow: `true`/`'anywhere'` for a path or URL, `'words'` for prose. */
|
|
1452
|
-
declare function KeyValueList({ items, dense, as, className }: KeyValueListProps): react.JSX.Element;
|
|
1453
|
-
type ChartLegendTone = ChartTone$1 | 'accent' | 'ok' | 'warn' | 'loss' | 'info';
|
|
1969
|
+
declare function KeyValueList({ items, dense, as, className, ref, ...rest }: KeyValueListProps): react.JSX.Element;
|
|
1454
1970
|
interface ChartLegendItem {
|
|
1455
1971
|
/** The series name. */
|
|
1456
1972
|
label: string;
|
|
1457
1973
|
/** The series color, the same role the chart draws it in. */
|
|
1458
1974
|
tone: ChartLegendTone;
|
|
1459
1975
|
}
|
|
1460
|
-
interface ChartLegendProps {
|
|
1976
|
+
interface ChartLegendProps extends Omit<ComponentPropsWithoutRef<'ul'>, 'children'> {
|
|
1977
|
+
/** The `ul` element. */
|
|
1978
|
+
ref?: Ref<HTMLUListElement>;
|
|
1461
1979
|
items: ChartLegendItem[];
|
|
1462
1980
|
/** line: a short 3px x 10px stroke, for line charts (default). dot: an 8px dot, for
|
|
1463
1981
|
* bars and points. */
|
|
1464
1982
|
marker?: 'line' | 'dot';
|
|
1465
|
-
/** Accessible name of the list. Default
|
|
1983
|
+
/** Accessible name of the list. Default: the provider's `legend` string. */
|
|
1466
1984
|
label?: string;
|
|
1467
|
-
className?: string;
|
|
1468
1985
|
}
|
|
1469
1986
|
/** The key for a multi-series chart (uPlot and canvas charts draw none of their own):
|
|
1470
1987
|
* each series' color mark and name. The marks are decorative; the names carry it. */
|
|
1471
|
-
declare function ChartLegend({ items, marker, label, className }: ChartLegendProps): react.JSX.Element;
|
|
1988
|
+
declare function ChartLegend({ items, marker, label, className, ref, ...rest }: ChartLegendProps): react.JSX.Element;
|
|
1472
1989
|
|
|
1473
|
-
type
|
|
1474
|
-
type RowTone = 'ok' | 'warn' | 'loss';
|
|
1990
|
+
type RowTone$1 = 'ok' | 'warn' | 'loss';
|
|
1475
1991
|
/** The table recipes as strings, for renderers that take classes (TanStack Table cells,
|
|
1476
|
-
* static markup). The components
|
|
1992
|
+
* static markup). The components in table.tsx use exactly these. */
|
|
1477
1993
|
declare const tableClass: {
|
|
1478
1994
|
/** The scroll box around the table. */
|
|
1479
|
-
readonly wrap: "relative overflow-auto rounded-xl border border-th-line bg-th-surface";
|
|
1995
|
+
readonly wrap: "relative overflow-auto rounded-xl border border-th-line bg-th-surface focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-th-accent";
|
|
1480
1996
|
/** Add to wrap for a header that stays put while the body scrolls (give wrap a max height). */
|
|
1481
|
-
readonly sticky: "[&_thead_th]:sticky [&_thead_th]:top-0 [&_thead_th]:z-[1] [&_thead_th]:bg-th-surface";
|
|
1997
|
+
readonly sticky: "[&_thead_th]:sticky [&_thead_th]:top-0 [&_thead_th]:z-[var(--nish-z-sticky,1)] [&_thead_th]:bg-th-surface";
|
|
1482
1998
|
/** The <table>. */
|
|
1483
1999
|
readonly table: "w-full border-collapse text-sm tabular-nums text-th-hi2";
|
|
1484
2000
|
/** Add to table for striped rows. */
|
|
1485
2001
|
readonly zebra: "[&_tbody>tr:nth-child(even)]:bg-th-elevated/50";
|
|
1486
2002
|
/** A header cell (add padY.normal or padY.dense). */
|
|
1487
|
-
readonly th: "whitespace-nowrap border-b border-th-line px-3 text-
|
|
2003
|
+
readonly th: "whitespace-nowrap border-b border-th-line px-3 text-start align-middle text-xs font-medium uppercase tracking-wider text-th-hi3";
|
|
1488
2004
|
/** A body cell (add padY.normal or padY.dense). */
|
|
1489
2005
|
readonly td: "px-3 align-middle";
|
|
1490
2006
|
/** Vertical cell padding: normal or dense. */
|
|
@@ -1497,11 +2013,25 @@ declare const tableClass: {
|
|
|
1497
2013
|
/** Add to tr for a clickable row. */
|
|
1498
2014
|
readonly trInteractive: "cursor-pointer transition-colors hover:bg-th-elevated focus-within:bg-th-elevated";
|
|
1499
2015
|
/** Add to th or td for a right-aligned number column. */
|
|
1500
|
-
readonly numeric: "whitespace-nowrap text-
|
|
2016
|
+
readonly numeric: "whitespace-nowrap text-end tabular-nums";
|
|
1501
2017
|
/** Add to tr for a status edge. */
|
|
1502
|
-
readonly tone: Record<RowTone, string>;
|
|
2018
|
+
readonly tone: Record<RowTone$1, string>;
|
|
1503
2019
|
};
|
|
1504
|
-
|
|
2020
|
+
/** Turns a host and a CSS size into an icon URL, or null for "no image" (letter avatar). */
|
|
2021
|
+
type FaviconResolver = (host: string, size: number) => string | null;
|
|
2022
|
+
/** Google's favicon service: one request per host to google.com that tells Google which
|
|
2023
|
+
* sites are shown. Opt in with `configureFavicons({ resolve: googleFavicon })`. */
|
|
2024
|
+
declare const googleFavicon: FaviconResolver;
|
|
2025
|
+
/** Sets the resolver every Favicon (and LinkCard icon) uses when it has no `src` or
|
|
2026
|
+
* `resolve` of its own. Call it once at startup. The default returns null: no request,
|
|
2027
|
+
* a letter avatar. */
|
|
2028
|
+
declare function configureFavicons(options: {
|
|
2029
|
+
resolve?: FaviconResolver | null;
|
|
2030
|
+
}): void;
|
|
2031
|
+
|
|
2032
|
+
type Align = 'left' | 'center' | 'right';
|
|
2033
|
+
type RowTone = 'ok' | 'warn' | 'loss';
|
|
2034
|
+
interface TableWrapProps extends ComponentProps<'div'> {
|
|
1505
2035
|
/** The table's minimum width (e.g. 640 or '40rem'); narrower screens scroll sideways
|
|
1506
2036
|
* inside the box instead of squeezing columns. */
|
|
1507
2037
|
minWidth?: number | string;
|
|
@@ -1511,13 +2041,17 @@ interface TableWrapProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
1511
2041
|
stickyHeader?: boolean;
|
|
1512
2042
|
/** Fades the left and right edges while there is more to scroll sideways. Default true. */
|
|
1513
2043
|
fade?: boolean;
|
|
1514
|
-
/** Pins the first column (header and body cells) to the
|
|
2044
|
+
/** Pins the first column (header and body cells) to the start edge while the table
|
|
1515
2045
|
* scrolls sideways, with an edge shadow once it has scrolled. */
|
|
1516
2046
|
stickyFirstColumn?: boolean;
|
|
2047
|
+
/** The accessible name of the scroll box. While the table overflows, the box is a
|
|
2048
|
+
* focusable region with this name, so keyboard users can scroll it. */
|
|
2049
|
+
label?: string;
|
|
1517
2050
|
}
|
|
1518
|
-
/** The bordered scroll box a table sits in. Use it instead of a Card for tables.
|
|
1519
|
-
|
|
1520
|
-
|
|
2051
|
+
/** The bordered scroll box a table sits in. Use it instead of a Card for tables. While the
|
|
2052
|
+
* table is wider or taller than the box, the box takes focus (Tab, then arrow keys scroll). */
|
|
2053
|
+
declare function TableWrap({ minWidth, maxHeight, stickyHeader, fade, stickyFirstColumn, label, className, style, children, ref: forwardedRef, ...rest }: TableWrapProps): react.JSX.Element;
|
|
2054
|
+
interface TableProps extends ComponentProps<'table'> {
|
|
1521
2055
|
/** Tighter rows (6px vertical padding instead of 10px) for dense data. */
|
|
1522
2056
|
dense?: boolean;
|
|
1523
2057
|
/** Striped body rows. */
|
|
@@ -1525,8 +2059,9 @@ interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
|
1525
2059
|
}
|
|
1526
2060
|
/** A full-width table with tabular numbers. Put it in a TableWrap. */
|
|
1527
2061
|
declare function Table({ dense, zebra, className, ...rest }: TableProps): react.JSX.Element;
|
|
1528
|
-
interface ThProps extends Omit<
|
|
1529
|
-
/** Text alignment
|
|
2062
|
+
interface ThProps extends Omit<ComponentProps<'th'>, 'align'> {
|
|
2063
|
+
/** Text alignment: the start edge, the end edge (both mirror in RTL) or centered.
|
|
2064
|
+
* Default left (right when numeric). */
|
|
1530
2065
|
align?: Align;
|
|
1531
2066
|
/** A number column: right-aligned with tabular figures. */
|
|
1532
2067
|
numeric?: boolean;
|
|
@@ -1538,8 +2073,9 @@ interface ThProps extends Omit<ThHTMLAttributes<HTMLTableCellElement>, 'align'>
|
|
|
1538
2073
|
}
|
|
1539
2074
|
/** A header cell. With onSort it holds a sort button and reports aria-sort. */
|
|
1540
2075
|
declare function Th({ align, numeric, sort, onSort, className, children, scope, ...rest }: ThProps): react.JSX.Element;
|
|
1541
|
-
interface TdProps extends Omit<
|
|
1542
|
-
/** Text alignment
|
|
2076
|
+
interface TdProps extends Omit<ComponentProps<'td'>, 'align'> {
|
|
2077
|
+
/** Text alignment: the start edge, the end edge (both mirror in RTL) or centered.
|
|
2078
|
+
* Default left (right when numeric). */
|
|
1543
2079
|
align?: Align;
|
|
1544
2080
|
/** A number column: right-aligned with tabular figures, never wrapping. */
|
|
1545
2081
|
numeric?: boolean;
|
|
@@ -1548,8 +2084,8 @@ interface TdProps extends Omit<TdHTMLAttributes<HTMLTableCellElement>, 'align'>
|
|
|
1548
2084
|
}
|
|
1549
2085
|
/** A body cell. */
|
|
1550
2086
|
declare function Td({ align, numeric, nowrap, className, ...rest }: TdProps): react.JSX.Element;
|
|
1551
|
-
interface TrProps extends
|
|
1552
|
-
/** A 3px status edge
|
|
2087
|
+
interface TrProps extends ComponentProps<'tr'> {
|
|
2088
|
+
/** A 3px status edge at the start (ok, warn, loss). Say the status in a cell too. */
|
|
1553
2089
|
tone?: RowTone;
|
|
1554
2090
|
/** Hover and focus-within highlight for a clickable row. Put a real link or button
|
|
1555
2091
|
* in the row as well, so keyboard users can reach it. */
|
|
@@ -1573,7 +2109,9 @@ interface ThemeState {
|
|
|
1573
2109
|
setChoice: (choice: ThemeChoice) => void;
|
|
1574
2110
|
}
|
|
1575
2111
|
/** The current theme choice and what it renders as, kept in sync across tabs and
|
|
1576
|
-
* subdomains.
|
|
2112
|
+
* subdomains. Server render and hydration see { choice: 'system', theme: 'dark' }; the real
|
|
2113
|
+
* value follows right after. If a hydration pass wiped <html data-theme>, it is applied
|
|
2114
|
+
* again on mount. */
|
|
1577
2115
|
declare function useTheme(): ThemeState;
|
|
1578
2116
|
interface ThemeToggleProps {
|
|
1579
2117
|
/** Also offer the extra presets (slate, terminal, …) in a select. */
|
|
@@ -1601,12 +2139,17 @@ interface ThemeToggleProps {
|
|
|
1601
2139
|
* width, for a drawer or settings page that has the room. */
|
|
1602
2140
|
collapse?: 'sm' | 'never';
|
|
1603
2141
|
className?: string;
|
|
2142
|
+
/** The words after a preset saved on another site in the button label: "Theme: Mocha (set on
|
|
2143
|
+
* another site). Switch to System". Default "set on another site". */
|
|
2144
|
+
elsewhereLabel?: string;
|
|
2145
|
+
/** The root element: the segmented group, or the button of the compact and pill variants. */
|
|
2146
|
+
ref?: Ref<HTMLElement>;
|
|
1604
2147
|
}
|
|
1605
2148
|
/** System / Light / Dark as a Segmented radio group, optionally with a preset picker,
|
|
1606
|
-
* or one cycling icon button when compact.
|
|
1607
|
-
|
|
2149
|
+
* or one cycling icon button when compact. Words come from `useNishStrings()`. Other props
|
|
2150
|
+
* (id, data-*, aria-*, style) go on the root element. */
|
|
2151
|
+
declare function ThemeToggle({ ref, presets, labels, block, size, compact, variant, phone, collapse, className, elsewhereLabel, ...rest }: ThemeToggleProps & Omit<HTMLAttributes<HTMLElement>, 'children' | 'onChange'>): react.JSX.Element;
|
|
1608
2152
|
|
|
1609
|
-
type SegmentedTone = 'accent' | 'warn' | 'loss';
|
|
1610
2153
|
interface SegmentedOption<T extends string> {
|
|
1611
2154
|
value: T;
|
|
1612
2155
|
label: ReactNode;
|
|
@@ -1626,13 +2169,28 @@ interface SegmentedOption<T extends string> {
|
|
|
1626
2169
|
/** Shown but not selectable; the arrow keys skip it. */
|
|
1627
2170
|
disabled?: boolean;
|
|
1628
2171
|
}
|
|
1629
|
-
interface SegmentedProps<T extends string> {
|
|
2172
|
+
interface SegmentedProps<T extends string> extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'children' | 'role' | 'dir'> {
|
|
2173
|
+
/** The radiogroup element. */
|
|
2174
|
+
ref?: Ref<HTMLDivElement>;
|
|
1630
2175
|
/** Name of the whole group for screen readers: "Chart range". */
|
|
1631
2176
|
label: string;
|
|
1632
2177
|
options: SegmentedOption<T>[];
|
|
1633
|
-
/** The selected value; a value not among the options
|
|
1634
|
-
|
|
1635
|
-
|
|
2178
|
+
/** The selected value, when you keep the state yourself; a value not among the options
|
|
2179
|
+
* leaves none selected. Leave it out and use `defaultValue` for an uncontrolled control. */
|
|
2180
|
+
value?: T | (string & {});
|
|
2181
|
+
/** The starting value of an uncontrolled control. */
|
|
2182
|
+
defaultValue?: T | (string & {});
|
|
2183
|
+
/** Called with the new value. Same as onValueChange; kept for existing code. */
|
|
2184
|
+
onChange?: (value: T) => void;
|
|
2185
|
+
/** Called with the new value (the form-library friendly name). */
|
|
2186
|
+
onValueChange?: (value: T) => void;
|
|
2187
|
+
/** Field name for a native form. Hidden radio inputs carry the selection, so FormData
|
|
2188
|
+
* and `<form action>` see it. */
|
|
2189
|
+
name?: string;
|
|
2190
|
+
/** The id of the `<form>` the hidden inputs belong to, when it is not an ancestor. */
|
|
2191
|
+
form?: string;
|
|
2192
|
+
/** Marks the group required (aria-required, and the hidden radios block an empty submit). */
|
|
2193
|
+
required?: boolean;
|
|
1636
2194
|
/** xs: 24px for dense widget headers. sm: 28px (default). md: 32px. All grow to 44px
|
|
1637
2195
|
* on touch screens. */
|
|
1638
2196
|
size?: 'xs' | 'sm' | 'md';
|
|
@@ -1650,7 +2208,7 @@ interface SegmentedProps<T extends string> {
|
|
|
1650
2208
|
* radio group. The selected option gets the accent tint and ring, so it reads at a
|
|
1651
2209
|
* glance in light themes too. Arrow keys, Home and End move the choice and the focus,
|
|
1652
2210
|
* like a native radio group. For multi-select toggles use ChipGroup and Chip. */
|
|
1653
|
-
declare function Segmented<T extends string>({ label, options, value, onChange, size, block, overflow, fullWidth, className }: SegmentedProps<T>): react.JSX.Element;
|
|
2211
|
+
declare function Segmented<T extends string>({ ref, label, options, value: valueProp, defaultValue, onChange, onValueChange, name, form, required, size, block, overflow, fullWidth, className, onKeyDown, ...rest }: SegmentedProps<T>): react.JSX.Element;
|
|
1654
2212
|
|
|
1655
2213
|
/**
|
|
1656
2214
|
* Publishes an element's height as a CSS variable on `<html>` (the layout contract:
|
|
@@ -1691,7 +2249,8 @@ interface NavItem {
|
|
|
1691
2249
|
label: string;
|
|
1692
2250
|
/** A 20-24px SVG icon drawn in currentColor. */
|
|
1693
2251
|
icon: ReactNode;
|
|
1694
|
-
/** Rendered as an `<a>` unless `renderLink` is given.
|
|
2252
|
+
/** Rendered as an `<a>` unless `renderLink` is given. A URL that is not safe
|
|
2253
|
+
* (`javascript:`, `data:` and so on) removes the item, with a dev warning. */
|
|
1695
2254
|
href?: string;
|
|
1696
2255
|
/** Rendered as a `<button>` when there is no href. Also called when an `<a>` is clicked. */
|
|
1697
2256
|
onSelect?: () => void;
|
|
@@ -1708,17 +2267,21 @@ type RenderLink = (item: NavItem, props: {
|
|
|
1708
2267
|
className: string;
|
|
1709
2268
|
children: ReactNode;
|
|
1710
2269
|
'aria-current'?: 'page';
|
|
2270
|
+
'data-state'?: 'active' | 'inactive';
|
|
1711
2271
|
onClick?: () => void;
|
|
1712
2272
|
/** true when rendered inside a sheet: pass it to the router's `<Link replace>` so the
|
|
1713
2273
|
* navigation replaces the sheet's own history entry instead of stacking on it. */
|
|
1714
2274
|
replace?: boolean;
|
|
1715
2275
|
}) => ReactElement;
|
|
1716
2276
|
type NavBreakpoint = 'md' | 'lg';
|
|
1717
|
-
interface BottomNavProps {
|
|
2277
|
+
interface BottomNavProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'children'> {
|
|
2278
|
+
/** The `nav` element. */
|
|
2279
|
+
ref?: Ref<HTMLElement>;
|
|
1718
2280
|
/** The destinations. Four or five fit a 360px screen; put the rest behind `more`. */
|
|
1719
2281
|
items: NavItem[];
|
|
1720
2282
|
/** A last "More" button that opens a MoreSheet. You own the sheet's open state. */
|
|
1721
2283
|
more?: {
|
|
2284
|
+
/** Default: the provider's `more` string. */
|
|
1722
2285
|
label?: string;
|
|
1723
2286
|
icon?: ReactNode;
|
|
1724
2287
|
/** Highlight the button, e.g. when the current page lives inside the sheet. */
|
|
@@ -1730,25 +2293,25 @@ interface BottomNavProps {
|
|
|
1730
2293
|
trailing?: ReactNode;
|
|
1731
2294
|
/** The breakpoint from which the bar is hidden (default md, 768px). */
|
|
1732
2295
|
hideFrom?: NavBreakpoint;
|
|
1733
|
-
/** Names the nav landmark. Default
|
|
2296
|
+
/** Names the nav landmark. Default: the provider's `sections` string. */
|
|
1734
2297
|
label?: string;
|
|
1735
2298
|
/** Renders router links instead of plain anchors. */
|
|
1736
2299
|
renderLink?: RenderLink;
|
|
1737
|
-
className?: string;
|
|
1738
2300
|
}
|
|
1739
2301
|
/** A phone tab bar fixed to the bottom of the screen: icon over label, the current page
|
|
1740
2302
|
* tinted, safe-area padding and 56px targets. It publishes its height as
|
|
1741
2303
|
* `--nish-bottom-nav-h` while it is visible, so Toaster, StickyActionBar and page
|
|
1742
2304
|
* padding make room for it. Hidden from `hideFrom` up (pair it with NavRail or a sidebar). */
|
|
1743
|
-
declare function BottomNav({ items, more, trailing, hideFrom, label, renderLink, className }: BottomNavProps): react.JSX.Element;
|
|
2305
|
+
declare function BottomNav({ items, more, trailing, hideFrom, label, renderLink, className, ref: refProp, ...rest }: BottomNavProps): react.JSX.Element;
|
|
1744
2306
|
interface MoreSheetProps {
|
|
1745
2307
|
open: boolean;
|
|
1746
2308
|
/** Called on Escape, a scrim click, the swipe, Android back and after a row is chosen. */
|
|
1747
2309
|
onClose: () => void;
|
|
1748
2310
|
items: NavItem[];
|
|
1749
|
-
/** Default
|
|
2311
|
+
/** Default: the provider's `more` string. */
|
|
1750
2312
|
title?: string;
|
|
1751
|
-
/** Pinned under the list. Defaults to a "Theme" row
|
|
2313
|
+
/** Pinned under the list. Defaults to a "Theme" row (the provider's `theme` string) with a
|
|
2314
|
+
* segmented ThemeToggle. */
|
|
1752
2315
|
footer?: ReactNode;
|
|
1753
2316
|
renderLink?: RenderLink;
|
|
1754
2317
|
}
|
|
@@ -1756,7 +2319,9 @@ interface MoreSheetProps {
|
|
|
1756
2319
|
* so the bar stays visible and tappable. Rows are 52px with an icon, a label and a
|
|
1757
2320
|
* one-line hint. Choosing a row navigates and closes the sheet. */
|
|
1758
2321
|
declare function MoreSheet({ open, onClose, items, title, footer, renderLink }: MoreSheetProps): react.JSX.Element | null;
|
|
1759
|
-
interface NavRailProps {
|
|
2322
|
+
interface NavRailProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'children'> {
|
|
2323
|
+
/** The `nav` element. */
|
|
2324
|
+
ref?: Ref<HTMLElement>;
|
|
1760
2325
|
items: NavItem[];
|
|
1761
2326
|
/** A second group under the items, after a divider (settings, search). */
|
|
1762
2327
|
tools?: ReactNode;
|
|
@@ -1766,16 +2331,17 @@ interface NavRailProps {
|
|
|
1766
2331
|
showFrom?: 'sm' | 'md' | 'lg';
|
|
1767
2332
|
/** The breakpoint from which it hides again (default lg, 1024px); pass false to keep it. */
|
|
1768
2333
|
hideFrom?: 'md' | 'lg' | 'xl' | false;
|
|
1769
|
-
/** Names the nav landmark. Default
|
|
2334
|
+
/** Names the nav landmark. Default: the provider's `sections` string. */
|
|
1770
2335
|
label?: string;
|
|
1771
2336
|
renderLink?: RenderLink;
|
|
1772
|
-
className?: string;
|
|
1773
2337
|
}
|
|
1774
2338
|
/** A 72px icon rail for the unfolded and tablet range between the phone BottomNav and a
|
|
1775
2339
|
* full sidebar: each destination is an icon in a pill over an 11px label. The `hint`
|
|
1776
2340
|
* shows as a tooltip on mouse hover and keyboard focus. */
|
|
1777
|
-
declare function NavRail({ items, tools, footer, showFrom, hideFrom, label, renderLink, className }: NavRailProps): react.JSX.Element;
|
|
1778
|
-
interface ScrollRowProps {
|
|
2341
|
+
declare function NavRail({ items, tools, footer, showFrom, hideFrom, label, renderLink, className, ref: refProp, ...rest }: NavRailProps): react.JSX.Element;
|
|
2342
|
+
interface ScrollRowProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2343
|
+
/** The scrolling element (the tag chosen by `as`). */
|
|
2344
|
+
ref?: Ref<HTMLElement>;
|
|
1779
2345
|
children: ReactNode;
|
|
1780
2346
|
/** Let the row run to the screen edges inside a padded page. */
|
|
1781
2347
|
bleed?: boolean;
|
|
@@ -1787,12 +2353,11 @@ interface ScrollRowProps {
|
|
|
1787
2353
|
as?: 'div' | 'ul' | 'ol' | 'nav';
|
|
1788
2354
|
/** Accessible name of the row (`aria-label`). */
|
|
1789
2355
|
label?: string;
|
|
1790
|
-
className?: string;
|
|
1791
2356
|
}
|
|
1792
2357
|
/** A single horizontally scrolling row (chips, filters, tabs) with edge fades and no
|
|
1793
2358
|
* scrollbar. The pressed, selected or current child is scrolled into view when it
|
|
1794
2359
|
* changes. */
|
|
1795
|
-
declare function ScrollRow({ children, bleed, fade, snap, as, label, className }: ScrollRowProps): react.JSX.Element;
|
|
2360
|
+
declare function ScrollRow({ children, bleed, fade, snap, as, label, className, ref: refProp, ...rest }: ScrollRowProps): react.JSX.Element;
|
|
1796
2361
|
/** The id of the section crossing the middle band of the viewport: the last one that
|
|
1797
2362
|
* entered it. At the very top of the page, or before any section has been seen, it is
|
|
1798
2363
|
* the first id. Sections are looked up with `document.getElementById`.
|
|
@@ -1811,7 +2376,9 @@ interface SectionNavItem {
|
|
|
1811
2376
|
/** A count after the label. */
|
|
1812
2377
|
count?: number;
|
|
1813
2378
|
}
|
|
1814
|
-
interface SectionNavProps {
|
|
2379
|
+
interface SectionNavProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'children' | 'onSelect'> {
|
|
2380
|
+
/** The `nav` element. */
|
|
2381
|
+
ref?: Ref<HTMLElement>;
|
|
1815
2382
|
items: SectionNavItem[];
|
|
1816
2383
|
/** Stick under the app header (default true). */
|
|
1817
2384
|
sticky?: boolean;
|
|
@@ -1820,17 +2387,19 @@ interface SectionNavProps {
|
|
|
1820
2387
|
/** Write `#id` with history.replaceState on click (default true). Pass false in apps that
|
|
1821
2388
|
* use hash routing. */
|
|
1822
2389
|
updateHash?: boolean;
|
|
1823
|
-
/** Accessible name. Default "Sections"
|
|
2390
|
+
/** Accessible name. Default "On this page" (not "Sections", which the app navs use, so
|
|
2391
|
+
* the two landmarks differ). Translate it per instance. */
|
|
1824
2392
|
label?: string;
|
|
1825
|
-
className?: string;
|
|
1826
2393
|
}
|
|
1827
2394
|
/** A row of jump chips for a long page. The chip of the section being read is marked
|
|
1828
2395
|
* (`aria-current="true"`) and kept in view; clicking one scrolls to its section. Give the
|
|
1829
2396
|
* sections the `nish-scroll-target` class so they stop below the sticky bars. It publishes
|
|
1830
|
-
* its own height as `--nish-sticky-extra`. */
|
|
1831
|
-
declare function SectionNav({ items, sticky, onSelect, updateHash, label, className }: SectionNavProps): react.JSX.Element;
|
|
2397
|
+
* its own height as `--nish-sticky-extra`. Chips are 44px on coarse pointers. */
|
|
2398
|
+
declare function SectionNav({ items, sticky, onSelect, updateHash, label, className, style, ref: refProp, ...rest }: SectionNavProps): react.JSX.Element;
|
|
1832
2399
|
|
|
1833
|
-
interface StickyBarProps {
|
|
2400
|
+
interface StickyBarProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2401
|
+
/** The bar element. */
|
|
2402
|
+
ref?: Ref<HTMLElement>;
|
|
1834
2403
|
/** The bar's content: a filter row, a toolbar, a SectionNav. */
|
|
1835
2404
|
children?: ReactNode;
|
|
1836
2405
|
/** CSS `top` offset. Defaults to just under the app header (`var(--nish-header-h, 0px)`). */
|
|
@@ -1839,55 +2408,62 @@ interface StickyBarProps {
|
|
|
1839
2408
|
elevate?: boolean;
|
|
1840
2409
|
/** The element to render. Default `div`. */
|
|
1841
2410
|
as?: ElementType;
|
|
1842
|
-
className?: string;
|
|
1843
2411
|
}
|
|
1844
2412
|
/**
|
|
1845
2413
|
* A bar that sticks under the app header while the page scrolls. Opaque, and its
|
|
1846
2414
|
* background reaches the screen edges (it bleeds through the page gutter). Publishes its
|
|
1847
2415
|
* height as `--nish-sticky-extra` while mounted, so anchor links scroll clear of it.
|
|
1848
2416
|
*/
|
|
1849
|
-
declare function StickyBar({ children, top, elevate, as, className }: StickyBarProps): react.JSX.Element;
|
|
1850
|
-
interface StickyActionBarProps {
|
|
2417
|
+
declare function StickyBar({ children, top, elevate, as, className, style, ref: refProp, ...rest }: StickyBarProps): react.JSX.Element;
|
|
2418
|
+
interface StickyActionBarProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2419
|
+
/** The bar element. */
|
|
2420
|
+
ref?: Ref<HTMLDivElement>;
|
|
1851
2421
|
/** Shows the bar. Closed, it renders nothing and publishes no height. */
|
|
1852
2422
|
open: boolean;
|
|
1853
|
-
/** Short text
|
|
2423
|
+
/** Short text at the start, e.g. "3 changes". Truncates to one line. */
|
|
1854
2424
|
message?: ReactNode;
|
|
1855
2425
|
/** The main action, usually a primary Button. */
|
|
1856
2426
|
primary: ReactNode;
|
|
1857
2427
|
/** A second action, usually a ghost or secondary Button (Discard, Cancel). */
|
|
1858
2428
|
secondary?: ReactNode;
|
|
1859
|
-
/** Accessible name of the region. Default
|
|
2429
|
+
/** Accessible name of the region. Default: the provider's `actions` string. */
|
|
1860
2430
|
label?: string;
|
|
1861
|
-
className?: string;
|
|
1862
2431
|
}
|
|
1863
2432
|
/**
|
|
1864
2433
|
* A bar fixed to the bottom of the screen for the actions of an unsaved form or a
|
|
1865
2434
|
* selection. Sits above a BottomNav when there is one, and publishes `--nish-bottom-bar-h`
|
|
1866
2435
|
* while open so page padding and toasts clear it. From sm it floats as a pill at the
|
|
1867
|
-
* bottom
|
|
2436
|
+
* bottom end.
|
|
1868
2437
|
*/
|
|
1869
|
-
declare function StickyActionBar({ open, message, primary, secondary, label, className }: StickyActionBarProps): react.JSX.Element | null;
|
|
1870
|
-
interface LoadingBarProps {
|
|
2438
|
+
declare function StickyActionBar({ open, message, primary, secondary, label, className, ref: refProp, ...rest }: StickyActionBarProps): react.JSX.Element | null;
|
|
2439
|
+
interface LoadingBarProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2440
|
+
/** The bar element (rendered after the delay). */
|
|
2441
|
+
ref?: Ref<HTMLDivElement>;
|
|
1871
2442
|
/** True while something loads (a route change, a refetch). */
|
|
1872
2443
|
active: boolean;
|
|
1873
2444
|
/** Waits this long before showing, so quick loads never flash a bar. Default 200. */
|
|
1874
2445
|
delayMs?: number;
|
|
1875
2446
|
/** CSS `top`. Defaults to just under the app header. */
|
|
1876
2447
|
top?: string;
|
|
1877
|
-
|
|
2448
|
+
/** Text for screen readers ("Loading page…"). With it set, the bar renders a persistent
|
|
2449
|
+
* polite live region that holds the text while the bar shows (after `delayMs`) and is
|
|
2450
|
+
* emptied when loading ends, so the start is announced. Without it nothing is announced. */
|
|
2451
|
+
announce?: string;
|
|
1878
2452
|
}
|
|
1879
2453
|
/**
|
|
1880
2454
|
* A thin indeterminate progress bar fixed under the app header. Appears only after
|
|
1881
2455
|
* `delayMs` of being active. With reduced motion it is a static partial bar.
|
|
1882
2456
|
*/
|
|
1883
|
-
declare function LoadingBar({ active, delayMs, top, className }: LoadingBarProps): react.JSX.Element
|
|
2457
|
+
declare function LoadingBar({ active, delayMs, top, announce, className, style, ref, ...rest }: LoadingBarProps): react.JSX.Element;
|
|
1884
2458
|
declare const CONTAINER_SIZE: {
|
|
1885
2459
|
readonly narrow: "max-w-2xl";
|
|
1886
2460
|
readonly default: "max-w-4xl";
|
|
1887
2461
|
readonly wide: "max-w-7xl";
|
|
1888
2462
|
readonly full: "max-w-none";
|
|
1889
2463
|
};
|
|
1890
|
-
interface PageContainerProps {
|
|
2464
|
+
interface PageContainerProps extends Omit<ComponentPropsWithoutRef<'main'>, 'children'> {
|
|
2465
|
+
/** The container element. */
|
|
2466
|
+
ref?: Ref<HTMLElement>;
|
|
1891
2467
|
/** Max width: narrow 42rem, default 56rem, wide 80rem, full none. */
|
|
1892
2468
|
size?: keyof typeof CONTAINER_SIZE;
|
|
1893
2469
|
children?: ReactNode;
|
|
@@ -1895,16 +2471,18 @@ interface PageContainerProps {
|
|
|
1895
2471
|
padBottom?: boolean;
|
|
1896
2472
|
/** The element to render. Default `main`. */
|
|
1897
2473
|
as?: ElementType;
|
|
1898
|
-
className?: string;
|
|
1899
2474
|
}
|
|
1900
2475
|
/**
|
|
1901
2476
|
* The page's content column: centered, with the shared side gutter and vertical padding,
|
|
1902
2477
|
* and bottom padding that keeps the last row clear of fixed bottom bars.
|
|
1903
2478
|
*/
|
|
1904
|
-
declare function PageContainer({ size, children, padBottom, as, className }: PageContainerProps): react.JSX.Element;
|
|
1905
|
-
/** Whether the browser reports a network connection (`navigator.onLine`). True on the server
|
|
2479
|
+
declare function PageContainer({ size, children, padBottom, as, className, ref, ...rest }: PageContainerProps): react.JSX.Element;
|
|
2480
|
+
/** Whether the browser reports a network connection (`navigator.onLine`). True on the server
|
|
2481
|
+
* and in the first client render. */
|
|
1906
2482
|
declare function useOnline(): boolean;
|
|
1907
|
-
interface ConnectionBannerProps {
|
|
2483
|
+
interface ConnectionBannerProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'title' | 'onClick'> {
|
|
2484
|
+
/** The banner's root element. */
|
|
2485
|
+
ref?: Ref<HTMLDivElement>;
|
|
1908
2486
|
/** A URL to probe with `fetch` (cache: no-store). When it fails or returns a non-2xx
|
|
1909
2487
|
* status the banner shows. Leave out to react to the browser's online/offline state only. */
|
|
1910
2488
|
healthUrl?: string;
|
|
@@ -1912,8 +2490,10 @@ interface ConnectionBannerProps {
|
|
|
1912
2490
|
intervalMs?: number;
|
|
1913
2491
|
/** Shown when the probe fails. Default "Can't reach the server". */
|
|
1914
2492
|
message?: string;
|
|
1915
|
-
/** Shown when the browser is offline. Default
|
|
2493
|
+
/** Shown when the browser is offline. Default: the provider's `offline` string. */
|
|
1916
2494
|
offlineMessage?: string;
|
|
2495
|
+
/** Retry button text. Default: the provider's `retry` string. */
|
|
2496
|
+
retryLabel?: string;
|
|
1917
2497
|
/** Called after the Retry button re-probes. */
|
|
1918
2498
|
onRetry?: () => void;
|
|
1919
2499
|
}
|
|
@@ -1922,7 +2502,7 @@ interface ConnectionBannerProps {
|
|
|
1922
2502
|
* `healthUrl`, probes the server with backoff (and right away when the browser comes back
|
|
1923
2503
|
* online or the tab becomes visible). Renders nothing while everything is reachable.
|
|
1924
2504
|
*/
|
|
1925
|
-
declare function ConnectionBanner({ healthUrl, intervalMs, message, offlineMessage, onRetry, }: ConnectionBannerProps): react.JSX.Element | null;
|
|
2505
|
+
declare function ConnectionBanner({ healthUrl, intervalMs, message, offlineMessage, retryLabel, onRetry, ...rest }: ConnectionBannerProps): react.JSX.Element | null;
|
|
1926
2506
|
|
|
1927
2507
|
/** One column of a ResponsiveTable. */
|
|
1928
2508
|
interface Column<T> {
|
|
@@ -1951,10 +2531,18 @@ type Sort = {
|
|
|
1951
2531
|
dir: 'asc' | 'desc';
|
|
1952
2532
|
} | null;
|
|
1953
2533
|
type CardsBelow = 'sm' | 'md' | 'lg';
|
|
1954
|
-
|
|
2534
|
+
/** Words a ResponsiveTable says about sorting. English by default. */
|
|
2535
|
+
interface SortText {
|
|
2536
|
+
/** The live-region message after the sort changes (dir is null when it is cleared). */
|
|
2537
|
+
announce?: (header: string, dir: 'asc' | 'desc' | null) => string;
|
|
2538
|
+
/** The label of the card-mode direction button, given the current direction. */
|
|
2539
|
+
toggle?: (dir: 'asc' | 'desc' | null) => string;
|
|
2540
|
+
}
|
|
2541
|
+
interface ResponsiveTableProps<T> extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
1955
2542
|
/** The data. */
|
|
1956
2543
|
rows: T[];
|
|
1957
|
-
/** The columns, in table order.
|
|
2544
|
+
/** The columns, in table order. Keep the array stable (module level or useMemo): rows only
|
|
2545
|
+
* skip re-rendering while it is the same array. Sorting does not depend on it. */
|
|
1958
2546
|
columns: Column<T>[];
|
|
1959
2547
|
/** A stable key for a row. */
|
|
1960
2548
|
rowKey: (row: T) => string;
|
|
@@ -1962,13 +2550,14 @@ interface ResponsiveTableProps<T> {
|
|
|
1962
2550
|
cardsBelow?: CardsBelow;
|
|
1963
2551
|
/** Called when a row (or card) is activated by click, Enter or Space. */
|
|
1964
2552
|
onRowClick?: (row: T) => void;
|
|
1965
|
-
/** Makes each row a link to this URL (cards become real anchors).
|
|
2553
|
+
/** Makes each row a link to this URL (cards become real anchors). A URL that is not safe
|
|
2554
|
+
* (javascript:, data:) is ignored: the row does not navigate. */
|
|
1966
2555
|
rowHref?: (row: T) => string;
|
|
1967
2556
|
/** Called with the URL when a row is activated by click or key, so a router can navigate
|
|
1968
2557
|
* without a page reload. Without it the table assigns `location`. Card links stay real
|
|
1969
2558
|
* anchors. */
|
|
1970
2559
|
onNavigate?: (href: string) => void;
|
|
1971
|
-
/** A 3px
|
|
2560
|
+
/** A 3px edge at the start of a row: ok, warn or loss. Say the status in a cell too. */
|
|
1972
2561
|
rowTone?: (row: T) => 'ok' | 'warn' | 'loss' | undefined;
|
|
1973
2562
|
/** The current sort, when you control it. */
|
|
1974
2563
|
sort?: Sort;
|
|
@@ -1985,7 +2574,7 @@ interface ResponsiveTableProps<T> {
|
|
|
1985
2574
|
stickyFirstColumn?: boolean;
|
|
1986
2575
|
/** Shows skeleton rows (table) or skeleton cards instead of the data. */
|
|
1987
2576
|
loading?: boolean;
|
|
1988
|
-
/** Shown when there are no rows. Default: "
|
|
2577
|
+
/** Shown when there are no rows. Default: the "nothingHere" string. */
|
|
1989
2578
|
empty?: ReactNode;
|
|
1990
2579
|
/** Shows an ErrorState instead of the data. */
|
|
1991
2580
|
error?: {
|
|
@@ -1996,15 +2585,19 @@ interface ResponsiveTableProps<T> {
|
|
|
1996
2585
|
label: string;
|
|
1997
2586
|
/** Renders a whole card yourself (inside the card's button or link). */
|
|
1998
2587
|
renderCard?: (row: T) => ReactNode;
|
|
2588
|
+
/** Replaces the English sort announcement and direction-button label. */
|
|
2589
|
+
sortText?: SortText;
|
|
1999
2590
|
className?: string;
|
|
2591
|
+
ref?: Ref<HTMLDivElement>;
|
|
2000
2592
|
}
|
|
2001
2593
|
/**
|
|
2002
2594
|
* A table on wide screens and a list of cards on phones, from one column definition.
|
|
2003
2595
|
* Sortable headers (and a sort menu in card mode), clickable or linked rows, a status
|
|
2004
|
-
* edge per row, loading, empty and error states built in.
|
|
2596
|
+
* edge per row, loading, empty and error states built in. A sort change is announced to
|
|
2597
|
+
* screen readers.
|
|
2005
2598
|
*/
|
|
2006
|
-
declare function ResponsiveTable<T>({ rows, columns, rowKey, cardsBelow, onRowClick, rowHref, onNavigate, rowTone, sort, onSortChange, minWidth, stickyHeader, maxHeight, stickyFirstColumn, loading, empty, error, label, renderCard, className, }: ResponsiveTableProps<T>): react.JSX.Element;
|
|
2007
|
-
interface ListRowProps {
|
|
2599
|
+
declare function ResponsiveTable<T>({ rows, columns, rowKey, cardsBelow, onRowClick, rowHref, onNavigate, rowTone, sort, onSortChange, minWidth, stickyHeader, maxHeight, stickyFirstColumn, loading, empty, error, label, renderCard, sortText, className, ref, ...rest }: ResponsiveTableProps<T>): react.JSX.Element;
|
|
2600
|
+
interface ListRowProps extends Omit<ComponentPropsWithoutRef<'li'>, 'title' | 'onClick' | 'children' | 'className'> {
|
|
2008
2601
|
/** A leading icon or avatar (kept at its size). */
|
|
2009
2602
|
icon?: ReactNode;
|
|
2010
2603
|
/** The main line; truncates, or wraps to two lines with `titleLines={2}`. */
|
|
@@ -2017,7 +2610,7 @@ interface ListRowProps {
|
|
|
2017
2610
|
meta?: ReactNode;
|
|
2018
2611
|
/** A control or badge at the far right (outside the meta). */
|
|
2019
2612
|
trailing?: ReactNode;
|
|
2020
|
-
/** Makes the whole row a link. */
|
|
2613
|
+
/** Makes the whole row a link. A URL that is not safe (javascript:, data:) makes it a plain row. */
|
|
2021
2614
|
href?: string;
|
|
2022
2615
|
/** Makes the whole row a button. */
|
|
2023
2616
|
onClick?: () => void;
|
|
@@ -2033,26 +2626,37 @@ interface ListRowProps {
|
|
|
2033
2626
|
compact?: boolean;
|
|
2034
2627
|
/** Opens the link in a new tab with an external icon. */
|
|
2035
2628
|
external?: boolean;
|
|
2629
|
+
/** Classes for the row itself (the link, button or box inside the wrapper). */
|
|
2036
2630
|
className?: string;
|
|
2037
2631
|
/** The wrapper element. Default 'li'; pass 'div' outside a list. */
|
|
2038
2632
|
as?: 'li' | 'div';
|
|
2633
|
+
/** The wrapper element. */
|
|
2634
|
+
ref?: Ref<HTMLElement>;
|
|
2039
2635
|
}
|
|
2040
2636
|
/** A list row: icon, title, subtitle, meta and a chevron, where the whole row is the link or button. */
|
|
2041
|
-
declare function ListRow({ icon, title, titleLines, subtitle, meta, trailing, href, onClick, active, tone, chevron, dense, compact, external, className, as:
|
|
2042
|
-
interface FaviconProps {
|
|
2637
|
+
declare function ListRow({ icon, title, titleLines, subtitle, meta, trailing, href, onClick, active, tone, chevron, dense, compact, external, className, as: wrapperTag, ref, ...rest }: ListRowProps): react.JSX.Element;
|
|
2638
|
+
interface FaviconProps extends Omit<ComponentPropsWithoutRef<'img'>, 'src' | 'width' | 'height' | 'alt' | 'children' | 'loading' | 'referrerPolicy' | 'onLoad' | 'onError'> {
|
|
2043
2639
|
/** The site's address; only the host is used. */
|
|
2044
2640
|
url: string;
|
|
2045
2641
|
/** Width and height in px. Default 16. */
|
|
2046
2642
|
size?: number;
|
|
2047
2643
|
/** The text whose first letter fills the fallback avatar. Default: the host name. */
|
|
2048
2644
|
label?: string;
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
/**
|
|
2052
|
-
|
|
2645
|
+
/** An image to show for this site, used as is (https, http or relative; unsafe URLs are ignored). */
|
|
2646
|
+
src?: string;
|
|
2647
|
+
/** Turns the host and size into an image URL, or null for the letter avatar. Wins over
|
|
2648
|
+
* configureFavicons. Without a `src`, a `resolve` or a configured resolver, no request is made. */
|
|
2649
|
+
resolve?: FaviconResolver;
|
|
2650
|
+
ref?: Ref<HTMLElement>;
|
|
2651
|
+
}
|
|
2652
|
+
/** A site's favicon, or a colored letter avatar while it loads or when it cannot. Decorative.
|
|
2653
|
+
* Out of the box it makes no network request and shows the letter avatar: pass `src` or
|
|
2654
|
+
* `resolve`, or call `configureFavicons({ resolve: googleFavicon })` once. */
|
|
2655
|
+
declare function Favicon({ url, size, label, src, resolve, className, style, ref, ...rest }: FaviconProps): react.JSX.Element;
|
|
2053
2656
|
type LinkCardAccent = `chart-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}` | 'accent';
|
|
2054
|
-
interface LinkCardProps {
|
|
2055
|
-
/** Where the card goes.
|
|
2657
|
+
interface LinkCardProps extends Omit<ComponentPropsWithoutRef<'a'>, 'title' | 'href' | 'children'> {
|
|
2658
|
+
/** Where the card goes. A URL that is not safe (javascript:, data:) makes the card
|
|
2659
|
+
* unavailable, like `disabled`. */
|
|
2056
2660
|
href: string;
|
|
2057
2661
|
/** The name. */
|
|
2058
2662
|
title: string;
|
|
@@ -2060,6 +2664,9 @@ interface LinkCardProps {
|
|
|
2060
2664
|
blurb?: string;
|
|
2061
2665
|
/** A 20px icon or a Favicon, shown in a tinted tile. */
|
|
2062
2666
|
icon?: ReactNode;
|
|
2667
|
+
/** With no `icon`, shows the site's Favicon (from the page's configureFavicons resolver,
|
|
2668
|
+
* else a letter avatar) in the tile. */
|
|
2669
|
+
favicon?: boolean;
|
|
2063
2670
|
/** The tile color. Default 'accent'. */
|
|
2064
2671
|
accent?: LinkCardAccent;
|
|
2065
2672
|
/** A small detail line (card layout only). */
|
|
@@ -2078,10 +2685,11 @@ interface LinkCardProps {
|
|
|
2078
2685
|
/** Opens in a new tab. */
|
|
2079
2686
|
external?: boolean;
|
|
2080
2687
|
className?: string;
|
|
2688
|
+
ref?: Ref<HTMLElement>;
|
|
2081
2689
|
}
|
|
2082
2690
|
/** A big link to another page or app: icon tile, title and blurb. The whole card is the anchor. */
|
|
2083
|
-
declare function LinkCard({ href, title, blurb, icon, accent, meta, status, badge, disabled, layout, external, className, }: LinkCardProps): react.JSX.Element;
|
|
2084
|
-
interface AsyncPanelProps {
|
|
2691
|
+
declare function LinkCard({ href, title, blurb, icon, favicon, accent, meta, status, badge, disabled, layout, external, className, ref: forwardedRef, ...rest }: LinkCardProps): react.JSX.Element;
|
|
2692
|
+
interface AsyncPanelProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2085
2693
|
/** Which state to show. */
|
|
2086
2694
|
status: 'loading' | 'error' | 'empty' | 'ready';
|
|
2087
2695
|
/** The loading body. Default: SkeletonRows. */
|
|
@@ -2101,9 +2709,10 @@ interface AsyncPanelProps {
|
|
|
2101
2709
|
/** The content for status 'ready'. */
|
|
2102
2710
|
children?: ReactNode;
|
|
2103
2711
|
className?: string;
|
|
2712
|
+
ref?: Ref<HTMLDivElement>;
|
|
2104
2713
|
}
|
|
2105
2714
|
/** Shows a skeleton, an error, an empty state or its children, from one status value. */
|
|
2106
|
-
declare function AsyncPanel({ status, skeleton, error, empty, children, className }: AsyncPanelProps): react.JSX.Element;
|
|
2715
|
+
declare function AsyncPanel({ status, skeleton, error, empty, children, className, ref, ...rest }: AsyncPanelProps): react.JSX.Element;
|
|
2107
2716
|
|
|
2108
2717
|
/** A series color: one of the eight categorical chart colors, or a status/accent color. */
|
|
2109
2718
|
type ChartTone = 'chart-1' | 'chart-2' | 'chart-3' | 'chart-4' | 'chart-5' | 'chart-6' | 'chart-7' | 'chart-8' | 'ok' | 'loss' | 'accent';
|
|
@@ -2120,7 +2729,7 @@ interface LineSeries {
|
|
|
2120
2729
|
tone?: ChartTone;
|
|
2121
2730
|
points: LinePoint[];
|
|
2122
2731
|
}
|
|
2123
|
-
interface LineChartProps {
|
|
2732
|
+
interface LineChartProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2124
2733
|
/** A single series of points. Use this or `series`. */
|
|
2125
2734
|
data?: LinePoint[];
|
|
2126
2735
|
/** Several series sharing one x axis. */
|
|
@@ -2129,7 +2738,7 @@ interface LineChartProps {
|
|
|
2129
2738
|
height?: number;
|
|
2130
2739
|
/** Fill under the first series with a fading gradient of its color. */
|
|
2131
2740
|
area?: boolean;
|
|
2132
|
-
/** Formats y axis ticks and tooltip values. */
|
|
2741
|
+
/** Formats y axis ticks and tooltip values. Default: numbers in `locale`. */
|
|
2133
2742
|
yFormat?: (v: number) => string;
|
|
2134
2743
|
/** Formats x axis ticks and the tooltip heading. */
|
|
2135
2744
|
xFormat?: (v: number) => string;
|
|
@@ -2145,16 +2754,21 @@ interface LineChartProps {
|
|
|
2145
2754
|
label: string;
|
|
2146
2755
|
/** Show a skeleton of the same height. */
|
|
2147
2756
|
loading?: boolean;
|
|
2148
|
-
/** Shown when there are no points. Default "
|
|
2757
|
+
/** Shown when there are no points. Default: the "noData" string. */
|
|
2149
2758
|
empty?: ReactNode;
|
|
2759
|
+
/** The locale of the default axis numbers. Default: the provider's locale, else en-US. */
|
|
2760
|
+
locale?: string;
|
|
2150
2761
|
className?: string;
|
|
2762
|
+
ref?: Ref<HTMLDivElement>;
|
|
2151
2763
|
}
|
|
2152
2764
|
/** A dependency-free SVG line chart that fills its container's width. Gaps (null y)
|
|
2153
2765
|
* break the line. Hover, touch-drag or Left/Right keys move a crosshair with a
|
|
2154
2766
|
* tooltip; vertical swipes still scroll the page. A hidden table carries the data for
|
|
2155
|
-
* screen readers.
|
|
2156
|
-
|
|
2157
|
-
|
|
2767
|
+
* screen readers. Long series are reduced to at most two points per pixel column
|
|
2768
|
+
* (the lowest and highest of each), so spikes survive. In right-to-left layouts the
|
|
2769
|
+
* x axis runs right to left and the arrow keys follow. */
|
|
2770
|
+
declare function LineChart({ data, series, height, area, yFormat, xFormat, yTicks, xTicks, baseline, tone, label, loading, empty, locale, className, ref, ...rest }: LineChartProps): react.JSX.Element;
|
|
2771
|
+
interface BarChartProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2158
2772
|
/** One bar per entry, in order. */
|
|
2159
2773
|
data: {
|
|
2160
2774
|
label: string;
|
|
@@ -2164,7 +2778,7 @@ interface BarChartProps {
|
|
|
2164
2778
|
height?: number;
|
|
2165
2779
|
/** Bar color. Default chart-1. */
|
|
2166
2780
|
tone?: ChartTone;
|
|
2167
|
-
/** Formats values above the bars and in the caption. */
|
|
2781
|
+
/** Formats values above the bars and in the caption. Default: numbers in `locale`. */
|
|
2168
2782
|
valueFormat?: (v: number) => string;
|
|
2169
2783
|
/** 'always' prints every value above its bar; 'auto' (default) does so on touch
|
|
2170
2784
|
* screens only, where there is no hover. */
|
|
@@ -2173,13 +2787,19 @@ interface BarChartProps {
|
|
|
2173
2787
|
xTicks?: 'ends' | 'all';
|
|
2174
2788
|
/** Accessible name of the chart. */
|
|
2175
2789
|
label: string;
|
|
2790
|
+
/** Shown when there are no bars. Default: the "noData" string. */
|
|
2791
|
+
empty?: ReactNode;
|
|
2792
|
+
/** The locale of the default value format. Default: the provider's locale, else en-US. */
|
|
2793
|
+
locale?: string;
|
|
2176
2794
|
className?: string;
|
|
2795
|
+
ref?: Ref<HTMLDivElement>;
|
|
2177
2796
|
}
|
|
2178
2797
|
/** A dependency-free SVG bar chart that fills its container's width. Hover, tap or
|
|
2179
2798
|
* Left/Right keys select a bar and show "label: value" under the chart. A hidden table
|
|
2180
|
-
* carries the data for screen readers.
|
|
2181
|
-
|
|
2182
|
-
|
|
2799
|
+
* carries the data for screen readers. In right-to-left layouts the first bar is at the
|
|
2800
|
+
* right and the arrow keys follow. */
|
|
2801
|
+
declare function BarChart({ data, height, tone, valueFormat, showValues, xTicks, label, empty, locale, className, ref, ...rest }: BarChartProps): react.JSX.Element;
|
|
2802
|
+
interface RangeBarProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2183
2803
|
/** The track's lower end (e.g. the 52-week low). */
|
|
2184
2804
|
min: number;
|
|
2185
2805
|
/** The track's upper end. */
|
|
@@ -2190,11 +2810,17 @@ interface RangeBarProps {
|
|
|
2190
2810
|
high: number;
|
|
2191
2811
|
/** Marks a value (e.g. the current price) with a dot. */
|
|
2192
2812
|
current?: number;
|
|
2813
|
+
/** The accessible name. Default (English): "Range low to high, current x, within min to max". */
|
|
2814
|
+
label?: string;
|
|
2815
|
+
/** The locale of the numbers in the default name. Default: the provider's locale, else en-US. */
|
|
2816
|
+
locale?: string;
|
|
2193
2817
|
className?: string;
|
|
2818
|
+
ref?: Ref<HTMLDivElement>;
|
|
2194
2819
|
}
|
|
2195
2820
|
/** A thin range track with a highlighted low-to-high segment and an optional dot for
|
|
2196
|
-
* the current value: daily temperature ranges, a price's day range.
|
|
2197
|
-
|
|
2821
|
+
* the current value: daily temperature ranges, a price's day range. The track starts at
|
|
2822
|
+
* the start edge, so it mirrors in right-to-left layouts. */
|
|
2823
|
+
declare function RangeBar({ min, max, low, high, current, label, locale, className, ref, ...rest }: RangeBarProps): react.JSX.Element;
|
|
2198
2824
|
|
|
2199
2825
|
/** One row of the palette. */
|
|
2200
2826
|
interface CommandItem {
|
|
@@ -2210,7 +2836,8 @@ interface CommandItem {
|
|
|
2210
2836
|
keywords?: string[];
|
|
2211
2837
|
/** A 16-20px icon shown before the label. */
|
|
2212
2838
|
icon?: ReactNode;
|
|
2213
|
-
/** Navigate here on select (`location.assign`, or a new tab when `external`).
|
|
2839
|
+
/** Navigate here on select (`location.assign`, or a new tab when `external`). Passed through
|
|
2840
|
+
* `safeUrl`: a `javascript:` or `data:` URL does nothing (a dev warning names it). */
|
|
2214
2841
|
href?: string;
|
|
2215
2842
|
/** Open `href` in a new tab. */
|
|
2216
2843
|
external?: boolean;
|
|
@@ -2230,6 +2857,10 @@ interface CommandPaletteProps {
|
|
|
2230
2857
|
placeholder?: string;
|
|
2231
2858
|
/** Text shown when nothing matches. Default 'No results'. */
|
|
2232
2859
|
emptyText?: string;
|
|
2860
|
+
/** Screen-reader announcement of the result count. Default "3 results". */
|
|
2861
|
+
resultsLabel?: (count: number) => string;
|
|
2862
|
+
/** Accessible name of the "opens in a new tab" mark on external rows. Default 'opens in a new tab'. */
|
|
2863
|
+
externalLabel?: string;
|
|
2233
2864
|
/** Open with Ctrl/Cmd+K, and with `/` when focus is not in a field (default true). */
|
|
2234
2865
|
hotkey?: boolean;
|
|
2235
2866
|
/** Called on every keystroke with the new query. */
|
|
@@ -2242,7 +2873,7 @@ interface CommandPaletteProps {
|
|
|
2242
2873
|
/** Navigates after the layer that is closing has dropped its own history entry. Running
|
|
2243
2874
|
* `history.back()` (the layer's cleanup) right after `location.assign` would cancel the
|
|
2244
2875
|
* navigation, so wait for that pop to finish. Call it before closing the layer. */
|
|
2245
|
-
declare function navigateFromLayer(
|
|
2876
|
+
declare function navigateFromLayer(rawHref: string): void;
|
|
2246
2877
|
/**
|
|
2247
2878
|
* Registers the palette hotkeys: Ctrl/Cmd+K anywhere, and `/` when focus is not in a
|
|
2248
2879
|
* field. For apps that render their own trigger or palette.
|
|
@@ -2254,10 +2885,8 @@ declare function useCommandHotkey(open: () => void, enabled?: boolean): void;
|
|
|
2254
2885
|
/** Search-and-jump dialog. A full-height sheet with the field on top under 640px, a
|
|
2255
2886
|
* centered 560px panel from there up. Fuzzy matching (prefix, word start, substring,
|
|
2256
2887
|
* then subsequence), grouped rows, arrow keys, Enter, and Ctrl/Cmd+K and `/` hotkeys. */
|
|
2257
|
-
declare function CommandPalette({ open, onOpenChange, items, placeholder, emptyText, hotkey, onQuery, footer, onSubmitQuery, }: CommandPaletteProps): react.JSX.Element | null;
|
|
2888
|
+
declare function CommandPalette({ open, onOpenChange, items, placeholder, emptyText, resultsLabel, externalLabel, hotkey, onQuery, footer, onSubmitQuery, }: CommandPaletteProps): react.JSX.Element | null;
|
|
2258
2889
|
|
|
2259
|
-
/** True while the CSS media query matches. False on the server and before hydration. */
|
|
2260
|
-
declare function useMediaQuery(query: string): boolean;
|
|
2261
2890
|
type Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl';
|
|
2262
2891
|
/** Tailwind's breakpoints, in px. Phone = below sm; narrow = below md (cover screen and small tablets). */
|
|
2263
2892
|
declare const BREAKPOINTS: {
|
|
@@ -2268,6 +2897,9 @@ declare const BREAKPOINTS: {
|
|
|
2268
2897
|
};
|
|
2269
2898
|
declare const PHONE_QUERY = "(max-width: 639.98px)";
|
|
2270
2899
|
declare const NARROW_QUERY = "(max-width: 767.98px)";
|
|
2900
|
+
|
|
2901
|
+
/** True while the CSS media query matches. False on the server and in the first client render, then follows the query. */
|
|
2902
|
+
declare function useMediaQuery(query: string): boolean;
|
|
2271
2903
|
/** True below 640px (the Fold's cover screen, any phone held upright). */
|
|
2272
2904
|
declare function usePhone(): boolean;
|
|
2273
2905
|
/** True below 768px: where BottomNav shows and NavRail hides. */
|
|
@@ -2286,23 +2918,27 @@ declare function useNow(intervalMs?: number): number;
|
|
|
2286
2918
|
/**
|
|
2287
2919
|
* State kept in localStorage. JSON by default, the raw string with { raw: true }. Never
|
|
2288
2920
|
* throws (private mode, quota and bad JSON fall back to the initial value) and follows
|
|
2289
|
-
* changes from other tabs and from other hooks on the same key.
|
|
2921
|
+
* changes from other tabs (`storage` events) and from other hooks on the same key. The
|
|
2922
|
+
* server and the first client render return `initial`.
|
|
2290
2923
|
*/
|
|
2291
2924
|
declare function useLocalStorage<T>(key: string, initial: T, o?: {
|
|
2292
2925
|
raw?: boolean;
|
|
2293
2926
|
}): [T, (next: T | ((prev: T) => T)) => void];
|
|
2294
|
-
interface RelativeTimeProps {
|
|
2927
|
+
interface RelativeTimeProps extends Omit<ComponentPropsWithoutRef<'time'>, 'children' | 'dateTime' | 'style'> {
|
|
2295
2928
|
/** The moment: a Date, epoch milliseconds or a date string. */
|
|
2296
2929
|
value: Date | number | string;
|
|
2297
|
-
/** "3m ago" (short, default) or "3 minutes ago" (long). */
|
|
2930
|
+
/** "3m ago" (short, default) or "3 minutes ago" (long). This is the text style, so the inline `style` attribute is not accepted: use className. */
|
|
2298
2931
|
style?: 'short' | 'long';
|
|
2299
2932
|
/** How often the text refreshes, in milliseconds. Default 30000. */
|
|
2300
2933
|
refreshMs?: number;
|
|
2934
|
+
/** Language of the words. Default NishProvider locale, then setDefaultLocale() (en-US). */
|
|
2935
|
+
locale?: string;
|
|
2301
2936
|
/** Classes for the time element. */
|
|
2302
2937
|
className?: string;
|
|
2938
|
+
ref?: Ref<HTMLTimeElement>;
|
|
2303
2939
|
}
|
|
2304
2940
|
/** A self-updating "3m ago". The full date and time show on hover and in the dateTime attribute. */
|
|
2305
|
-
declare function RelativeTime({ value, style, refreshMs, className }: RelativeTimeProps): react.JSX.Element;
|
|
2941
|
+
declare function RelativeTime({ value, style: textStyle, refreshMs, locale, className, ref, ...rest }: RelativeTimeProps): react.JSX.Element;
|
|
2306
2942
|
|
|
2307
2943
|
/** True while the viewer asks for reduced motion. False on the server and before hydration. */
|
|
2308
2944
|
declare function usePrefersReducedMotion(): boolean;
|
|
@@ -2313,40 +2949,46 @@ interface FlowStepItem {
|
|
|
2313
2949
|
status: FlowStepStatus;
|
|
2314
2950
|
meta?: ReactNode;
|
|
2315
2951
|
}
|
|
2316
|
-
interface FlowStepsProps {
|
|
2952
|
+
interface FlowStepsProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2317
2953
|
steps: FlowStepItem[];
|
|
2318
2954
|
/** auto: horizontal when the container is at least 640px wide and there are at most 8 steps; else vertical. */
|
|
2319
2955
|
orientation?: 'auto' | 'vertical' | 'horizontal';
|
|
2320
2956
|
/** aria-label of the list. Default "Progress". */
|
|
2321
2957
|
label?: string;
|
|
2958
|
+
/** Screen-reader words after a finished or failed step. Default ", done" and ", failed". */
|
|
2959
|
+
statusLabels?: Partial<Record<'done' | 'failed', string>>;
|
|
2322
2960
|
className?: string;
|
|
2961
|
+
ref?: Ref<HTMLDivElement>;
|
|
2323
2962
|
}
|
|
2324
2963
|
/** A plan as a flow of steps: numbered nodes joined by connectors that fill as steps
|
|
2325
2964
|
* finish. The active step ripples, a finishing step draws its check, a failing one
|
|
2326
2965
|
* shakes, and when the last step finishes a sweep runs along the connectors. Vertical on
|
|
2327
2966
|
* narrow containers, horizontal from 640px (up to 8 steps). */
|
|
2328
|
-
declare function FlowSteps({ steps, orientation, label, className }: FlowStepsProps): react.JSX.Element;
|
|
2329
|
-
interface StepBarProps {
|
|
2967
|
+
declare function FlowSteps({ steps, orientation, label, statusLabels, className, ref, ...rest }: FlowStepsProps): react.JSX.Element;
|
|
2968
|
+
interface StepBarProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2330
2969
|
total: number;
|
|
2331
2970
|
done: number;
|
|
2332
2971
|
/** pulses the current segment */
|
|
2333
2972
|
active?: boolean;
|
|
2973
|
+
/** aria-label. Default "Progress". */
|
|
2334
2974
|
label?: string;
|
|
2335
2975
|
className?: string;
|
|
2976
|
+
ref?: Ref<HTMLDivElement>;
|
|
2336
2977
|
}
|
|
2337
2978
|
/** A compact progress bar of segments, one per step (a continuous bar above 12). Done
|
|
2338
2979
|
* segments fill in, the current one pulses while `active`. */
|
|
2339
|
-
declare function StepBar({ total, done, active, label, className }: StepBarProps): react.JSX.Element;
|
|
2340
|
-
interface TickerTextProps {
|
|
2980
|
+
declare function StepBar({ total, done, active, label, className, ref, ...rest }: StepBarProps): react.JSX.Element;
|
|
2981
|
+
interface TickerTextProps extends Omit<ComponentPropsWithoutRef<'span'>, 'children' | 'title'> {
|
|
2341
2982
|
text: string;
|
|
2342
2983
|
as?: 'span' | 'p' | 'div';
|
|
2343
2984
|
className?: string;
|
|
2985
|
+
ref?: Ref<HTMLElement>;
|
|
2344
2986
|
}
|
|
2345
2987
|
/** One line of text that swaps with a short slide when it changes: the old text rises and
|
|
2346
2988
|
* fades out while the new text comes up from below. Long text ends in an ellipsis. */
|
|
2347
|
-
declare function TickerText({ text, as, className }: TickerTextProps): react.JSX.Element;
|
|
2989
|
+
declare function TickerText({ text, as, className, ref, ...rest }: TickerTextProps): react.JSX.Element;
|
|
2348
2990
|
type AgentNodeState = 'queued' | 'running' | 'done' | 'failed';
|
|
2349
|
-
interface AgentNodeProps {
|
|
2991
|
+
interface AgentNodeProps extends Omit<ComponentPropsWithoutRef<'article'>, 'onClick' | 'children' | 'aria-label'> {
|
|
2350
2992
|
label: string;
|
|
2351
2993
|
state: AgentNodeState;
|
|
2352
2994
|
/** Short model name; opus, sonnet, haiku and fable get their own badge hue. */
|
|
@@ -2355,12 +2997,16 @@ interface AgentNodeProps {
|
|
|
2355
2997
|
/** Right-aligned small text, e.g. elapsed time. */
|
|
2356
2998
|
meta?: ReactNode;
|
|
2357
2999
|
onClick?: () => void;
|
|
3000
|
+
/** Words for the state in the accessible name ("label: Running"). Default Queued, Running, Done, Failed. */
|
|
3001
|
+
stateLabels?: Partial<Record<AgentNodeState, string>>;
|
|
2358
3002
|
className?: string;
|
|
3003
|
+
/** The card (an article, or a button with onClick). */
|
|
3004
|
+
ref?: Ref<HTMLElement>;
|
|
2359
3005
|
}
|
|
2360
3006
|
/** One agent or task as a card: state icon, label, model badge, a live activity line.
|
|
2361
3007
|
* A running agent has a comet of accent circling its border; finishing pops the check;
|
|
2362
3008
|
* failing shakes once. Pass `onClick` to make the card a button. */
|
|
2363
|
-
declare function AgentNode({ label, state, model, activity, meta, onClick, className }: AgentNodeProps): react.JSX.Element;
|
|
3009
|
+
declare function AgentNode({ label, state, model, activity, meta, onClick, stateLabels, className, ref: refProp, ...rest }: AgentNodeProps): react.JSX.Element;
|
|
2364
3010
|
interface WorkflowBoardPhase {
|
|
2365
3011
|
id: string;
|
|
2366
3012
|
title: string;
|
|
@@ -2372,17 +3018,22 @@ interface WorkflowBoardAgent extends Omit<AgentNodeProps, 'className' | 'onClick
|
|
|
2372
3018
|
/** phase id or title */
|
|
2373
3019
|
phase: string | null;
|
|
2374
3020
|
}
|
|
2375
|
-
interface WorkflowBoardProps {
|
|
3021
|
+
interface WorkflowBoardProps extends Omit<ComponentPropsWithoutRef<'section'>, 'children'> {
|
|
2376
3022
|
phases: WorkflowBoardPhase[];
|
|
2377
3023
|
agents: WorkflowBoardAgent[];
|
|
2378
3024
|
/** aria-label. Default "Workflow". */
|
|
2379
3025
|
label?: string;
|
|
3026
|
+
/** Title of the column for agents without a phase. Default "Other". */
|
|
3027
|
+
otherLabel?: string;
|
|
3028
|
+
/** Text of an empty phase. Default "Waiting". */
|
|
3029
|
+
waitingLabel?: string;
|
|
2380
3030
|
className?: string;
|
|
3031
|
+
ref?: Ref<HTMLElement>;
|
|
2381
3032
|
}
|
|
2382
3033
|
/** A workflow as columns of phases (stacked on narrow containers), each phase holding its
|
|
2383
3034
|
* agents as AgentNodes. A phase waits, glows while an agent runs and gets a check when
|
|
2384
3035
|
* all its agents finish; new agents rise in, staggered. */
|
|
2385
|
-
declare function WorkflowBoard({ phases, agents, label, className }: WorkflowBoardProps): react.JSX.Element;
|
|
3036
|
+
declare function WorkflowBoard({ phases, agents, label, otherLabel, waitingLabel, className, ref, ...rest }: WorkflowBoardProps): react.JSX.Element;
|
|
2386
3037
|
interface ActivityItem {
|
|
2387
3038
|
id: string;
|
|
2388
3039
|
at: number;
|
|
@@ -2390,20 +3041,23 @@ interface ActivityItem {
|
|
|
2390
3041
|
tone?: 'neutral' | 'accent' | 'ok' | 'warn' | 'loss';
|
|
2391
3042
|
source?: ReactNode;
|
|
2392
3043
|
}
|
|
2393
|
-
interface ActivityFeedProps {
|
|
3044
|
+
interface ActivityFeedProps extends Omit<ComponentPropsWithoutRef<'ol'>, 'children'> {
|
|
2394
3045
|
items: ActivityItem[];
|
|
2395
3046
|
/** default 50 */
|
|
2396
3047
|
max?: number;
|
|
2397
3048
|
now?: number;
|
|
2398
3049
|
/** default "Activity" */
|
|
2399
3050
|
label?: string;
|
|
3051
|
+
/** Shown when there are no items. Default "No activity yet". */
|
|
2400
3052
|
empty?: ReactNode;
|
|
2401
3053
|
className?: string;
|
|
3054
|
+
/** The list (a div holding the empty text when there are no items). */
|
|
3055
|
+
ref?: Ref<HTMLElement>;
|
|
2402
3056
|
}
|
|
2403
3057
|
/** A timeline of short updates, newest first. A new update opens its row, fades in and
|
|
2404
3058
|
* flashes the accent tint. Items present on the first render do not animate. */
|
|
2405
|
-
declare function ActivityFeed({ items, max, now, label, empty, className }: ActivityFeedProps): react.JSX.Element;
|
|
2406
|
-
interface AnimatedListProps<T> {
|
|
3059
|
+
declare function ActivityFeed({ items, max, now, label, empty, className, ref, ...rest }: ActivityFeedProps): react.JSX.Element;
|
|
3060
|
+
interface AnimatedListProps<T> extends Omit<ComponentPropsWithoutRef<'ul'>, 'children'> {
|
|
2407
3061
|
items: T[];
|
|
2408
3062
|
getKey: (item: T) => string;
|
|
2409
3063
|
children: (item: T, phase: 'enter' | 'idle' | 'exit') => ReactNode;
|
|
@@ -2412,148 +3066,13 @@ interface AnimatedListProps<T> {
|
|
|
2412
3066
|
as?: 'ul' | 'ol' | 'div';
|
|
2413
3067
|
className?: string;
|
|
2414
3068
|
itemClassName?: string;
|
|
3069
|
+
/** The list element. */
|
|
3070
|
+
ref?: Ref<HTMLElement>;
|
|
2415
3071
|
}
|
|
2416
3072
|
/** A list whose items animate: new ones rise in, removed ones fade and close the gap
|
|
2417
3073
|
* before they are dropped, and the rest slide to their new place (FLIP). The render
|
|
2418
3074
|
* function gets each item's phase. Under reduced motion changes are instant. */
|
|
2419
|
-
declare function AnimatedList<T>({ items, getKey, children, exitMs, as, className, itemClassName, }: AnimatedListProps<T>): react.JSX.Element;
|
|
2420
|
-
|
|
2421
|
-
type CanvasHue = 'indigo' | 'emerald' | 'amber' | 'lime' | 'rose' | 'sky' | 'violet' | 'teal';
|
|
2422
|
-
type CanvasNodeKind = 'ui' | 'service' | 'worker' | 'library' | 'infra' | 'data' | 'tool' | 'docs';
|
|
2423
|
-
interface CanvasNode {
|
|
2424
|
-
id: string;
|
|
2425
|
-
label: string;
|
|
2426
|
-
kind?: CanvasNodeKind;
|
|
2427
|
-
detail?: string;
|
|
2428
|
-
/** 0..1 afterglow */
|
|
2429
|
-
heat?: number;
|
|
2430
|
-
/** live work here now */
|
|
2431
|
-
active?: boolean;
|
|
2432
|
-
/** When the newest activity here happened, ms. Follow mode visits the newest first. */
|
|
2433
|
-
activeAt?: number;
|
|
2434
|
-
/** shown under an active node, max ~48 chars */
|
|
2435
|
-
note?: string;
|
|
2436
|
-
/** sessions/agents here */
|
|
2437
|
-
count?: number;
|
|
2438
|
-
}
|
|
2439
|
-
interface CanvasGroup {
|
|
2440
|
-
id: string;
|
|
2441
|
-
title: string;
|
|
2442
|
-
subtitle?: string;
|
|
2443
|
-
hue?: CanvasHue;
|
|
2444
|
-
/** Left-to-right layer in the "columns" layout; also orders groups inside a band. */
|
|
2445
|
-
column: number;
|
|
2446
|
-
/** Top-to-bottom band in the "bands" layout. Default: `column`. */
|
|
2447
|
-
band?: number;
|
|
2448
|
-
badge?: ReactNode;
|
|
2449
|
-
nodes: CanvasNode[];
|
|
2450
|
-
}
|
|
2451
|
-
interface CanvasEdge {
|
|
2452
|
-
id: string;
|
|
2453
|
-
/** node or group id */
|
|
2454
|
-
from: string;
|
|
2455
|
-
/** node or group id */
|
|
2456
|
-
to: string;
|
|
2457
|
-
/** Overrides the kind's line style with a dashed line. */
|
|
2458
|
-
dashed?: boolean;
|
|
2459
|
-
label?: string;
|
|
2460
|
-
/** A `CanvasEdgeKind` id: sets the line style and which legend toggle shows or hides it. */
|
|
2461
|
-
kind?: string;
|
|
2462
|
-
}
|
|
2463
|
-
/** One entry of the line legend. */
|
|
2464
|
-
interface CanvasEdgeKind {
|
|
2465
|
-
id: string;
|
|
2466
|
-
/** Legend text ("Traffic", "Deploys"). */
|
|
2467
|
-
label: string;
|
|
2468
|
-
/** Default "solid". */
|
|
2469
|
-
line?: 'solid' | 'dashed' | 'dotted';
|
|
2470
|
-
/** Hidden until the viewer turns it on in the legend. */
|
|
2471
|
-
hidden?: boolean;
|
|
2472
|
-
}
|
|
2473
|
-
/** "columns": layers left to right. "bands": bands top to bottom, each wrapping its groups into
|
|
2474
|
-
* rows. "auto": whichever shows the map biggest in the current viewport. */
|
|
2475
|
-
type CanvasLayoutMode = 'columns' | 'bands' | 'auto';
|
|
2476
|
-
interface SystemCanvasProps {
|
|
2477
|
-
groups: CanvasGroup[];
|
|
2478
|
-
edges: CanvasEdge[];
|
|
2479
|
-
/** Faint titles above each column ("Edge", "Infra", "Apps", ...), by column index. */
|
|
2480
|
-
columns?: string[];
|
|
2481
|
-
/** Titles of the bands in the "bands" layout, by band index. Falls back to `columns`. */
|
|
2482
|
-
bands?: string[];
|
|
2483
|
-
/** Default "auto". */
|
|
2484
|
-
layout?: CanvasLayoutMode;
|
|
2485
|
-
/** The line legend. Edges whose kind is hidden are left out of the layout and routing. */
|
|
2486
|
-
edgeKinds?: CanvasEdgeKind[];
|
|
2487
|
-
/** Follow mode: the view flies to where work is happening. Controlled when set. */
|
|
2488
|
-
follow?: boolean;
|
|
2489
|
-
onFollowChange?: (on: boolean) => void;
|
|
2490
|
-
/** Overview map in a corner on viewports 600 px wide or more. Default true. */
|
|
2491
|
-
minimap?: boolean;
|
|
2492
|
-
selected?: string | null;
|
|
2493
|
-
onSelect?: (id: string, type: 'node' | 'group') => void;
|
|
2494
|
-
/** CSS height of the viewport. Default "100%". */
|
|
2495
|
-
height?: string;
|
|
2496
|
-
/** aria-label. Default "System map". */
|
|
2497
|
-
label?: string;
|
|
2498
|
-
className?: string;
|
|
2499
|
-
}
|
|
2500
|
-
|
|
2501
|
-
interface CanvasLayout {
|
|
2502
|
-
mode: "columns" | "bands";
|
|
2503
|
-
width: number;
|
|
2504
|
-
height: number;
|
|
2505
|
-
/** World px above y = 0 taken by the headers: 36 in "columns" (titles sit above the cards), 0 in "bands" (titles sit inside). */
|
|
2506
|
-
titleRoom: number;
|
|
2507
|
-
/** Top-left of each column's ("columns") or band's ("bands") title, world px; `index` is the column or band value. */
|
|
2508
|
-
headers: {
|
|
2509
|
-
index: number;
|
|
2510
|
-
x: number;
|
|
2511
|
-
y: number;
|
|
2512
|
-
}[];
|
|
2513
|
-
groups: Record<string, {
|
|
2514
|
-
x: number;
|
|
2515
|
-
y: number;
|
|
2516
|
-
w: number;
|
|
2517
|
-
h: number;
|
|
2518
|
-
}>;
|
|
2519
|
-
nodes: Record<string, {
|
|
2520
|
-
x: number;
|
|
2521
|
-
y: number;
|
|
2522
|
-
w: number;
|
|
2523
|
-
h: number;
|
|
2524
|
-
}>;
|
|
2525
|
-
}
|
|
2526
|
-
/** Where every group and node sits, in world units (px at zoom 1). Pure and deterministic.
|
|
2527
|
-
*
|
|
2528
|
-
* "columns" (default): columns are the distinct `column` values in ascending order, groups
|
|
2529
|
-
* stack in the order given, nodes sit in a 2-column grid inside their group (1 column for a
|
|
2530
|
-
* group of one), and each column is centered against the tallest. The first sub-column starts
|
|
2531
|
-
* 60 px in and `width` includes 60 px after the last, which is room for the edge lanes
|
|
2532
|
-
* outside the cards.
|
|
2533
|
-
*
|
|
2534
|
-
* "bands": bands are the distinct `band ?? column` values in ascending order, stacked top to
|
|
2535
|
-
* bottom; each band wraps its groups (by `column`, then input order) into rows no wider than
|
|
2536
|
-
* `width`. The gaps between rows grow with the number of edge ends that need lanes there. */
|
|
2537
|
-
interface LayoutOptions {
|
|
2538
|
-
/** Default "columns". */
|
|
2539
|
-
mode?: "columns" | "bands";
|
|
2540
|
-
/** "bands" only: the widest a row of groups may get, world px (at least one group per row). */
|
|
2541
|
-
width?: number;
|
|
2542
|
-
/** "bands" only: used to size the gaps between rows for the edge lanes. */
|
|
2543
|
-
edges?: CanvasEdge[];
|
|
2544
|
-
columnGap?: number;
|
|
2545
|
-
rowGap?: number;
|
|
2546
|
-
}
|
|
2547
|
-
|
|
2548
|
-
interface RoutedEdge {
|
|
2549
|
-
id: string;
|
|
2550
|
-
/** The corners of the line, source port first. Every segment is horizontal or vertical. */
|
|
2551
|
-
points: [number, number][];
|
|
2552
|
-
/** The same line as an SVG path with rounded corners; also valid for CSS `offset-path`. */
|
|
2553
|
-
d: string;
|
|
2554
|
-
/** Direction of travel of the last segment: "right" in "columns", "down" in "bands". */
|
|
2555
|
-
dir: 'right' | 'down';
|
|
2556
|
-
}
|
|
3075
|
+
declare function AnimatedList<T>({ items, getKey, children, exitMs, as, className, itemClassName, ref, ...rest }: AnimatedListProps<T>): react.JSX.Element;
|
|
2557
3076
|
|
|
2558
3077
|
/** How loud an event is: `info` is listed only, `normal` is pushed, `urgent` is pushed even in quiet hours. */
|
|
2559
3078
|
type InboxSeverity = 'info' | 'normal' | 'urgent';
|
|
@@ -2685,7 +3204,48 @@ interface InboxListResponse {
|
|
|
2685
3204
|
}>;
|
|
2686
3205
|
}
|
|
2687
3206
|
|
|
2688
|
-
|
|
3207
|
+
/** Text the Inbox shows that has no key in `NishStrings`. Give any of them to `Inbox` as `labels`;
|
|
3208
|
+
* each one wins over its English default. */
|
|
3209
|
+
interface InboxLabels {
|
|
3210
|
+
/** Names of the severity dots. */
|
|
3211
|
+
urgent: string;
|
|
3212
|
+
normal: string;
|
|
3213
|
+
info: string;
|
|
3214
|
+
/** Snooze menu entries. */
|
|
3215
|
+
snooze1h: string;
|
|
3216
|
+
snooze4h: string;
|
|
3217
|
+
snoozeTomorrow: string;
|
|
3218
|
+
snoozeMonday: string;
|
|
3219
|
+
/** Button of a snoozed item. */
|
|
3220
|
+
unsnooze: string;
|
|
3221
|
+
/** Button of a handled item. */
|
|
3222
|
+
moveBack: string;
|
|
3223
|
+
/** "Mark all handled" button, and the confirm dialog's title. */
|
|
3224
|
+
markAllHandled: string;
|
|
3225
|
+
markAllTitle: (count: number) => string;
|
|
3226
|
+
/** The "All" chip of the source filter. */
|
|
3227
|
+
all: string;
|
|
3228
|
+
loadMore: string;
|
|
3229
|
+
/** Collapses a long body. The expand button is the `more` string. */
|
|
3230
|
+
less: string;
|
|
3231
|
+
/** "Until 14:00" under a snoozed item. */
|
|
3232
|
+
until: (when: string) => string;
|
|
3233
|
+
/** "Handled 2 hours ago" under a handled item, then optionally the suffix for who handled it. */
|
|
3234
|
+
handledAgo: (when: string) => string;
|
|
3235
|
+
handledByApp: string;
|
|
3236
|
+
handledAutomatically: string;
|
|
3237
|
+
/** "Retry ran 14:02" and "Retry failed 14:02 · HTTP 500". `why` is null when nothing is known. */
|
|
3238
|
+
actionRan: (label: string, at: string) => string;
|
|
3239
|
+
actionFailed: (label: string, at: string, why: string | null) => string;
|
|
3240
|
+
/** The empty list of each view; `source` is the name of the filtered source, or null. */
|
|
3241
|
+
emptyOpen: (source: string | null) => string;
|
|
3242
|
+
emptySnoozed: (source: string | null) => string;
|
|
3243
|
+
emptyHandled: (source: string | null) => string;
|
|
3244
|
+
}
|
|
3245
|
+
declare const DEFAULT_INBOX_LABELS: InboxLabels;
|
|
3246
|
+
|
|
3247
|
+
interface InboxProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'onChange'> {
|
|
3248
|
+
ref?: Ref<HTMLElement>;
|
|
2689
3249
|
/** The items of the current view, newest activity first. */
|
|
2690
3250
|
items: InboxItem[];
|
|
2691
3251
|
/** Which list is showing: open, snoozed or handled. */
|
|
@@ -2737,13 +3297,15 @@ interface InboxProps {
|
|
|
2737
3297
|
selectedId?: number | null;
|
|
2738
3298
|
/** Display names per source id. Default INBOX_SOURCE_LABELS; unknown ids show as they are. */
|
|
2739
3299
|
sourceLabels?: Record<string, string>;
|
|
3300
|
+
/** Text that has no key in the provider's strings (snooze options, messages). Each wins over its English default. */
|
|
3301
|
+
labels?: Partial<InboxLabels>;
|
|
2740
3302
|
/** Classes for the card. */
|
|
2741
3303
|
className?: string;
|
|
2742
3304
|
}
|
|
2743
3305
|
/** One inbox for events from every app: Open, Snoozed and Handled views, a source filter, and per-item
|
|
2744
3306
|
* handle, snooze and undo actions. The page owns the data and the calls; this component only renders
|
|
2745
3307
|
* and reports what was picked. Rows wrap at phone widths and the actions collapse into one menu under 480px. */
|
|
2746
|
-
declare function Inbox({ items, view, onViewChange, counts, sources, source, onSourceChange, onHandle, onUnhandle, onSnooze, onUnsnooze, onHandleAll, onAction, loading, error, onRetry, hasMore, onLoadMore, loadingMore, selectedId, sourceLabels, className, }: InboxProps): react.JSX.Element;
|
|
3308
|
+
declare function Inbox({ items, view, onViewChange, counts, sources, source, onSourceChange, onHandle, onUnhandle, onSnooze, onUnsnooze, onHandleAll, onAction, loading, error, onRetry, hasMore, onLoadMore, loadingMore, selectedId, sourceLabels, labels: labelOverrides, className, ref, ...rest }: InboxProps): react.JSX.Element;
|
|
2747
3309
|
|
|
2748
3310
|
interface AppShellSidebar {
|
|
2749
3311
|
/** Controlled collapsed state; pair it with onCollapsedChange. */
|
|
@@ -2770,7 +3332,8 @@ interface AppShellProps {
|
|
|
2770
3332
|
brand?: ReactNode;
|
|
2771
3333
|
/** Home link on the icon and name. Default "/". */
|
|
2772
3334
|
homeHref?: string;
|
|
2773
|
-
|
|
3335
|
+
/** A pill at the start of the header that links back to a hub site ("← nish.software"). Default false: no pill. The nish.software apps pass `{ href: 'https://nish.software', label: 'nish.software' }`. */
|
|
3336
|
+
hub?: AppHeaderHub | false;
|
|
2774
3337
|
/** Every destination, in order. All show in the rail and the desktop header nav (or the sidebar); the BottomNav shows the first `primary` and puts the rest in a MoreSheet. Empty or left out, the shell has no nav at all (no tabs, rail, sidebar, BottomNav or sheet): the signed-out frame. */
|
|
2775
3338
|
nav?: NavItem[];
|
|
2776
3339
|
/** How many items the BottomNav shows before "More". Default 4; when nav.length <= 5 all fit and there is no More. */
|
|
@@ -2778,6 +3341,10 @@ interface AppShellProps {
|
|
|
2778
3341
|
/** Extra MoreSheet-only items (settings, sign out) shown after the overflow nav items. From md up they sit in a "More" menu in the header. Give them `onSelect`: the menu runs it, and only follows `href` (a full page load) when there is no `onSelect`. */
|
|
2779
3342
|
moreItems?: NavItem[];
|
|
2780
3343
|
renderLink?: RenderLink;
|
|
3344
|
+
/** Names the nav landmark (header tabs, rail, sidebar nav and BottomNav; only one shows at a time). Default: the provider's `sections` string. */
|
|
3345
|
+
navLabel?: string;
|
|
3346
|
+
/** id of the `main` element and target of the skip link. Default "nish-main"; give each shell on a page its own. */
|
|
3347
|
+
mainId?: string;
|
|
2781
3348
|
/** Header buttons before the theme toggle. */
|
|
2782
3349
|
actions?: ReactNode;
|
|
2783
3350
|
/** Replaces the header's ThemeToggle; false hides it. */
|
|
@@ -2811,7 +3378,7 @@ interface AppShellProps {
|
|
|
2811
3378
|
* Under 768px the BottomNav shows, from 768px the rail, from 1024px tabs in the header (or
|
|
2812
3379
|
* the sidebar). With no nav it is the signed-out frame: header, banners and page only.
|
|
2813
3380
|
*/
|
|
2814
|
-
declare function AppShell({ name, icon, brand, homeHref,
|
|
3381
|
+
declare function AppShell({ name, icon, brand, homeHref, hub, nav: navProp, primary, moreItems: moreItemsProp, renderLink, navLabel: navLabelProp, mainId, actions, themeToggle, railFooter, loading, connection, banner, sidebar, container, toaster, errorBoundary, resetKey, children, }: AppShellProps): react.JSX.Element;
|
|
2815
3382
|
|
|
2816
3383
|
declare class ApiError extends Error {
|
|
2817
3384
|
/** HTTP status; 0 = network failure or abort-by-timeout. */
|
|
@@ -2840,15 +3407,21 @@ interface ApiConfig {
|
|
|
2840
3407
|
baseUrl?: string;
|
|
2841
3408
|
/** Called (once per response) for any 401 before the error is thrown. */
|
|
2842
3409
|
onUnauthorized?: (err: ApiError) => void;
|
|
2843
|
-
/** Extra headers on every request (an auth token for an Electron app).
|
|
3410
|
+
/** Extra headers on every request (an auth token for an Electron app). Sent only to
|
|
3411
|
+
* same-origin URLs (and to `baseUrl`'s origin) unless `headersFor` allows the URL. */
|
|
2844
3412
|
headers?: () => Record<string, string>;
|
|
3413
|
+
/** Return true to send the `headers()` to this (cross-origin) URL too. Called with the
|
|
3414
|
+
* request URL; never called for a same-origin URL, which always gets them. */
|
|
3415
|
+
headersFor?: (url: string) => boolean;
|
|
2845
3416
|
}
|
|
2846
3417
|
/** Merges into the module-level config used by every apiFetch call. */
|
|
2847
3418
|
declare function configureApi(c: ApiConfig): void;
|
|
2848
3419
|
/** fetch with JSON in and out, a timeout, and a typed ApiError for every failure. */
|
|
2849
3420
|
declare function apiFetch<T = unknown>(path: string, o?: ApiFetchOptions): Promise<T>;
|
|
3421
|
+
|
|
2850
3422
|
interface UseResourceOptions<T> {
|
|
2851
|
-
/** Poll every N ms while the tab is visible. Off by default.
|
|
3423
|
+
/** Poll every N ms while the tab is visible. Off by default. After a failed load the wait doubles per
|
|
3424
|
+
* failure (with up to 10% jitter) up to 5 minutes, and returns to N ms after the next success. */
|
|
2852
3425
|
intervalMs?: number;
|
|
2853
3426
|
/** false skips fetching (dependent queries). Default true. */
|
|
2854
3427
|
enabled?: boolean;
|
|
@@ -2873,9 +3446,10 @@ interface Resource<T> {
|
|
|
2873
3446
|
updatedAt: number | undefined;
|
|
2874
3447
|
/** With intervalMs: true when the last success is older than 3 intervals. Always false without intervalMs. */
|
|
2875
3448
|
stale: boolean;
|
|
2876
|
-
/** Refetch now. Resolves when done; never rejects. */
|
|
3449
|
+
/** Refetch now (never joins a request that is already running). Resolves when done; never rejects. */
|
|
2877
3450
|
reload: () => Promise<void>;
|
|
2878
|
-
/** Replace data locally (optimistic update). A function gets the previous data.
|
|
3451
|
+
/** Replace data locally (optimistic update). A function gets the previous data. A response that was
|
|
3452
|
+
* requested before the mutate and arrives after it does not overwrite it. */
|
|
2879
3453
|
mutate: (next: T | ((prev: T | undefined) => T)) => void;
|
|
2880
3454
|
}
|
|
2881
3455
|
/** key: a string identifying the request (the URL); null disables. fetcher defaults to apiFetch(key, { signal }). */
|
|
@@ -2894,39 +3468,31 @@ interface AppErrorBoundaryProps {
|
|
|
2894
3468
|
}) => void;
|
|
2895
3469
|
/** When any value changes, a shown error resets (pass [location.pathname] to reset on navigation). */
|
|
2896
3470
|
resetKeys?: unknown[];
|
|
3471
|
+
/** Show the error message and stack in the default fallback. Default: only outside production
|
|
3472
|
+
* (`process.env.NODE_ENV !== 'production'`), so end users never see internals. */
|
|
3473
|
+
showDetails?: boolean;
|
|
2897
3474
|
}
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
/** Catches render errors below it and shows a themed fallback with a way to recover. */
|
|
2902
|
-
declare class AppErrorBoundary extends Component<AppErrorBoundaryProps, State> {
|
|
2903
|
-
state: State;
|
|
2904
|
-
static getDerivedStateFromError(error: unknown): State;
|
|
2905
|
-
componentDidCatch(error: Error, info: {
|
|
2906
|
-
componentStack?: string | null;
|
|
2907
|
-
}): void;
|
|
2908
|
-
componentDidUpdate(prev: AppErrorBoundaryProps): void;
|
|
2909
|
-
reset: () => void;
|
|
2910
|
-
render(): ReactNode;
|
|
2911
|
-
}
|
|
3475
|
+
/** Catches render errors below it and shows a themed fallback with a way to recover. The
|
|
3476
|
+
* default fallback shows the message and stack only outside production or with `showDetails`. */
|
|
3477
|
+
declare function AppErrorBoundary(props: AppErrorBoundaryProps): react.JSX.Element;
|
|
2912
3478
|
|
|
2913
3479
|
interface FilterSheetProps {
|
|
2914
3480
|
open: boolean;
|
|
2915
3481
|
onClose: () => void;
|
|
2916
|
-
/** Heading of the sheet. Default "Filters". */
|
|
3482
|
+
/** Heading of the sheet. Default: the `filters` string ("Filters"). */
|
|
2917
3483
|
title?: string;
|
|
2918
3484
|
children: ReactNode;
|
|
2919
3485
|
/** Shows a ghost "Clear" button in the footer. */
|
|
2920
3486
|
onClear?: () => void;
|
|
2921
3487
|
/** Disables Clear while it is 0. */
|
|
2922
3488
|
activeCount?: number;
|
|
2923
|
-
/** Text of the primary footer button, e.g. "Show 42 results". Default "Done". */
|
|
3489
|
+
/** Text of the primary footer button, e.g. "Show 42 results". Default: the `done` string ("Done"). */
|
|
2924
3490
|
resultLabel?: string;
|
|
2925
3491
|
}
|
|
2926
3492
|
/** A bottom sheet for the filter controls of a FilterBar on a phone. Footer: Clear and a
|
|
2927
3493
|
* primary button that closes the sheet. */
|
|
2928
3494
|
declare function FilterSheet({ open, onClose, title, children, onClear, activeCount, resultLabel }: FilterSheetProps): react.JSX.Element | null;
|
|
2929
|
-
interface FilterBarProps {
|
|
3495
|
+
interface FilterBarProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {
|
|
2930
3496
|
/** Search box value and change handler. Leave out for no search box. */
|
|
2931
3497
|
search?: {
|
|
2932
3498
|
value: string;
|
|
@@ -2944,7 +3510,7 @@ interface FilterBarProps {
|
|
|
2944
3510
|
trailing?: ReactNode;
|
|
2945
3511
|
/** Sticks under the header (top: var(--nish-header-h)). Default false. */
|
|
2946
3512
|
sticky?: boolean;
|
|
2947
|
-
/** Title of the phone sheet. Default "Filters". */
|
|
3513
|
+
/** Title of the phone sheet. Default: the `filters` string ("Filters"). */
|
|
2948
3514
|
sheetTitle?: string;
|
|
2949
3515
|
/** Below this breakpoint the children move into the FilterSheet. Default 'md' (768); 'lg' (1024) for wide filter sets. */
|
|
2950
3516
|
sheetBelow?: 'md' | 'lg';
|
|
@@ -2954,7 +3520,7 @@ interface FilterBarProps {
|
|
|
2954
3520
|
}
|
|
2955
3521
|
/** The search and filter row of a list page. From md up the controls sit inline; below md
|
|
2956
3522
|
* they move into a bottom sheet behind a Filters button that shows how many are on. */
|
|
2957
|
-
declare function FilterBar({ search, children, activeCount, onClear, trailing, sticky, sheetTitle, sheetBelow, summary, className, }: FilterBarProps): react.JSX.Element;
|
|
3523
|
+
declare function FilterBar({ search, children, activeCount, onClear, trailing, sticky, sheetTitle, sheetBelow, summary, className, ref, ...rest }: FilterBarProps): react.JSX.Element;
|
|
2958
3524
|
|
|
2959
3525
|
/** Where useUrlState reads and writes the query string. */
|
|
2960
3526
|
interface UrlStateAdapter {
|
|
@@ -2981,7 +3547,7 @@ declare function useUrlState<S extends UrlStateShape>(defaults: S, o?: {
|
|
|
2981
3547
|
comma?: boolean | readonly (keyof S & string)[];
|
|
2982
3548
|
}): [S, (patch: Partial<S> | ((prev: S) => Partial<S>)) => void, () => void];
|
|
2983
3549
|
|
|
2984
|
-
interface SettingsSectionProps {
|
|
3550
|
+
interface SettingsSectionProps extends Omit<ComponentPropsWithRef<'section'>, 'title' | 'children'> {
|
|
2985
3551
|
title: ReactNode;
|
|
2986
3552
|
description?: ReactNode;
|
|
2987
3553
|
id?: string;
|
|
@@ -2994,8 +3560,8 @@ interface SettingsSectionProps {
|
|
|
2994
3560
|
className?: string;
|
|
2995
3561
|
}
|
|
2996
3562
|
/** A titled group of setting rows in one unpadded Card, rows divided by a line. */
|
|
2997
|
-
declare function SettingsSection({ title, description, id, actions, compact, children, className }: SettingsSectionProps): react.JSX.Element;
|
|
2998
|
-
interface SettingRowProps {
|
|
3563
|
+
declare function SettingsSection({ title, description, id, actions, compact, children, className, ref, ...rest }: SettingsSectionProps): react.JSX.Element;
|
|
3564
|
+
interface SettingRowProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {
|
|
2999
3565
|
label: ReactNode;
|
|
3000
3566
|
description?: ReactNode;
|
|
3001
3567
|
/** The control (Switch, Select, NumberField, Button). */
|
|
@@ -3015,7 +3581,7 @@ interface SettingRowProps {
|
|
|
3015
3581
|
className?: string;
|
|
3016
3582
|
}
|
|
3017
3583
|
/** One label + control row inside a SettingsSection. */
|
|
3018
|
-
declare function SettingRow({ label, description, children, htmlFor, stacked, inline, compact: compactProp, status, statusTone, className, }: SettingRowProps): react.JSX.Element;
|
|
3584
|
+
declare function SettingRow({ label, description, children, htmlFor, stacked, inline, compact: compactProp, status, statusTone, className, ref, ...rest }: SettingRowProps): react.JSX.Element;
|
|
3019
3585
|
type SaveStatus = 'idle' | 'saving' | 'saved' | 'error';
|
|
3020
3586
|
/** Tracks one save: run(promise) → 'saving' → 'saved' for 1500ms (or 'error' for 3000ms, with the message) → 'idle'.
|
|
3021
3587
|
* `label` is the text for SettingRow.status: "Saving…", "Saved", the error message, or null. Rethrows nothing. */
|
|
@@ -3026,7 +3592,8 @@ declare function useSaveStatus(): {
|
|
|
3026
3592
|
tone: 'muted' | 'ok' | 'error';
|
|
3027
3593
|
run: <T>(p: Promise<T>) => Promise<T | undefined>;
|
|
3028
3594
|
};
|
|
3029
|
-
interface NumberFieldProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'defaultValue'> {
|
|
3595
|
+
interface NumberFieldProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'defaultValue' | 'ref'> {
|
|
3596
|
+
ref?: Ref<HTMLInputElement>;
|
|
3030
3597
|
value: number | null;
|
|
3031
3598
|
/** Called on blur and on Enter with the parsed, clamped value, only when it differs from `value`. May return a promise: the field shows a spinner state and, on rejection, restores the old value and sets aria-invalid with the error message under it. */
|
|
3032
3599
|
onCommit: (next: number | null) => void | Promise<void>;
|
|
@@ -3041,7 +3608,7 @@ interface NumberFieldProps extends Omit<InputProps, 'value' | 'onChange' | 'type
|
|
|
3041
3608
|
precision?: number;
|
|
3042
3609
|
}
|
|
3043
3610
|
/** A numeric setting that saves when you leave the field or press Enter. */
|
|
3044
|
-
declare
|
|
3611
|
+
declare function NumberField({ value, onCommit, min, max, step, nullable, suffix, precision, className, onBlur, onKeyDown, id, invalid, 'aria-describedby': describedBy, ref, ...rest }: NumberFieldProps): react.JSX.Element;
|
|
3045
3612
|
|
|
3046
3613
|
/** A service token as the settings page sees it: never the hash. */
|
|
3047
3614
|
interface ServiceTokenView {
|
|
@@ -3069,22 +3636,31 @@ interface UseServiceTokens {
|
|
|
3069
3636
|
/** Loads the app's service tokens from `url` (GET) and revokes one with POST `${url}/<id>/revoke`.
|
|
3070
3637
|
* The server side is `mountServiceTokenRoutes` from `@nish/ui/server/hono`. */
|
|
3071
3638
|
declare function useServiceTokens(url?: string): UseServiceTokens;
|
|
3072
|
-
interface ServiceTokensSectionProps {
|
|
3639
|
+
interface ServiceTokensSectionProps extends Omit<ComponentPropsWithRef<"section">, "title" | "children"> {
|
|
3073
3640
|
/** undefined = loading. */
|
|
3074
3641
|
tokens: ServiceTokenView[] | undefined;
|
|
3075
3642
|
error?: string | null;
|
|
3076
3643
|
onRetry?: () => void;
|
|
3077
3644
|
/** Revokes the token. Reject to keep the dialog open with the error. */
|
|
3078
3645
|
onRevoke: (id: string) => Promise<void>;
|
|
3079
|
-
/** Default "Service tokens". */
|
|
3646
|
+
/** Default: the `serviceTokens` string ("Service tokens"). */
|
|
3080
3647
|
title?: ReactNode;
|
|
3648
|
+
/** Default: the `serviceTokensIntro` string. */
|
|
3081
3649
|
description?: ReactNode;
|
|
3082
3650
|
/** Anchor id on the section. Default "service-tokens". */
|
|
3083
3651
|
id?: string;
|
|
3084
3652
|
className?: string;
|
|
3653
|
+
/** Shown when the list is empty. Default "No service tokens. No machine client can read this app." */
|
|
3654
|
+
emptyMessage?: ReactNode;
|
|
3655
|
+
/** The body of the revoke confirmation. Default explains that the token stops working and cannot be restored. */
|
|
3656
|
+
revokeBody?: ReactNode;
|
|
3657
|
+
/** The "created <date>" part of a token's description. Default `created ${when}`. */
|
|
3658
|
+
createdLabel?: (when: string) => string;
|
|
3659
|
+
/** Added to the description of a token that comes from the SERVICE_TOKENS environment variable. Default "from SERVICE_TOKENS". */
|
|
3660
|
+
envSourceLabel?: string;
|
|
3085
3661
|
}
|
|
3086
3662
|
/** The settings block that lists an app's service tokens with a Revoke button each. */
|
|
3087
|
-
declare function ServiceTokensSection({ tokens, error, onRetry, onRevoke, title, description, id, className, }: ServiceTokensSectionProps): react.JSX.Element;
|
|
3663
|
+
declare function ServiceTokensSection({ tokens, error, onRetry, onRevoke, title: titleProp, description: descriptionProp, id, className, emptyMessage, revokeBody, createdLabel, envSourceLabel, ...rest }: ServiceTokensSectionProps): react.JSX.Element;
|
|
3088
3664
|
|
|
3089
3665
|
interface ComboboxOption {
|
|
3090
3666
|
value: string;
|
|
@@ -3093,11 +3669,19 @@ interface ComboboxOption {
|
|
|
3093
3669
|
hint?: string;
|
|
3094
3670
|
disabled?: boolean;
|
|
3095
3671
|
}
|
|
3096
|
-
interface ComboboxProps {
|
|
3672
|
+
interface ComboboxProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'children' | 'id' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'role'> {
|
|
3673
|
+
/** The text input (the combobox element). The remaining div attributes go to the wrapper. */
|
|
3674
|
+
ref?: Ref<HTMLInputElement>;
|
|
3097
3675
|
options: ComboboxOption[];
|
|
3098
|
-
/** The selected option's value, or the custom text; null when nothing is selected.
|
|
3099
|
-
|
|
3100
|
-
|
|
3676
|
+
/** The selected option's value, or the custom text; null when nothing is selected.
|
|
3677
|
+
* Leave it out and use `defaultValue` for an uncontrolled combobox. */
|
|
3678
|
+
value?: string | null;
|
|
3679
|
+
/** The starting value of an uncontrolled combobox. */
|
|
3680
|
+
defaultValue?: string | null;
|
|
3681
|
+
/** Called with the new value and the option it matches (null for custom text or a clear). */
|
|
3682
|
+
onChange?: (value: string | null, option: ComboboxOption | null) => void;
|
|
3683
|
+
/** Called with the new value only (the form-library friendly name). */
|
|
3684
|
+
onValueChange?: (value: string | null) => void;
|
|
3101
3685
|
/** Filtering. Default: case-insensitive substring on label and hint; show at most 50.
|
|
3102
3686
|
* With `onQueryChange` and no `filter`, options are shown as given (the server filtered them). */
|
|
3103
3687
|
filter?: (option: ComboboxOption, query: string) => boolean;
|
|
@@ -3106,21 +3690,44 @@ interface ComboboxProps {
|
|
|
3106
3690
|
placeholder?: string;
|
|
3107
3691
|
/** Accessible name when there is no visible <label htmlFor={id}>. */
|
|
3108
3692
|
'aria-label'?: string;
|
|
3693
|
+
/** Names the combobox by another element's id. */
|
|
3694
|
+
'aria-labelledby'?: string;
|
|
3695
|
+
/** Ids of help or error text; reaches the input (Field sets it). */
|
|
3696
|
+
'aria-describedby'?: string;
|
|
3697
|
+
/** Reaches the input (Field sets it on error). */
|
|
3698
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
3699
|
+
/** Same as aria-invalid="true". */
|
|
3700
|
+
invalid?: boolean;
|
|
3701
|
+
/** The id of the text input, so a `<label htmlFor>` and Field reach it. */
|
|
3109
3702
|
id?: string;
|
|
3703
|
+
/** Field name for a native form. A hidden input carries the selected value (the typed
|
|
3704
|
+
* text is not submitted). */
|
|
3705
|
+
name?: string;
|
|
3706
|
+
/** The id of the `<form>` the hidden input belongs to, when it is not an ancestor. */
|
|
3707
|
+
form?: string;
|
|
3708
|
+
/** Marks the combobox required (`required` and `aria-required` on the input). */
|
|
3709
|
+
required?: boolean;
|
|
3110
3710
|
disabled?: boolean;
|
|
3111
|
-
/** Shown when nothing matches. Default "No matches". */
|
|
3711
|
+
/** Shown when nothing matches. Default "No matches" (NishProvider strings). */
|
|
3112
3712
|
emptyText?: string;
|
|
3113
3713
|
/** Async options: called (debounced 200ms) with the query; while `loading` shows a Spinner row "Searching…". */
|
|
3114
3714
|
onQueryChange?: (q: string) => void;
|
|
3115
3715
|
loading?: boolean;
|
|
3116
3716
|
/** md h-9 (default) or sm h-8. Both grow to 44px on touch screens. */
|
|
3117
3717
|
size?: 'sm' | 'md';
|
|
3718
|
+
/** Accessible name of the clear button. Default "Clear" (NishProvider strings). */
|
|
3719
|
+
clearLabel?: string;
|
|
3720
|
+
/** The loading row and its announcement. Default "Searching…" (NishProvider strings). */
|
|
3721
|
+
loadingText?: string;
|
|
3722
|
+
/** The polite announcement of the result count. Default "3 results" / "1 result". */
|
|
3723
|
+
resultsText?: (count: number) => string;
|
|
3118
3724
|
className?: string;
|
|
3119
3725
|
}
|
|
3120
3726
|
/** A text input with a listbox of suggestions (ARIA 1.2 combobox). Pick from the options,
|
|
3121
3727
|
* or with `allowCustom` commit what was typed. The list sits under the input and works
|
|
3122
|
-
* inside a Modal or Drawer.
|
|
3123
|
-
|
|
3728
|
+
* inside a Modal or Drawer. `ref`, `id`, `aria-*`, `name` and `required` belong to the
|
|
3729
|
+
* input; `className` and other attributes go to the wrapper. */
|
|
3730
|
+
declare function Combobox({ ref, options, value: valueProp, defaultValue, onChange, onValueChange, filter, allowCustom, placeholder, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, invalid, id, name, form, required, disabled, emptyText, onQueryChange, loading, size, clearLabel, loadingText, resultsText, className, ...rest }: ComboboxProps): react.JSX.Element;
|
|
3124
3731
|
|
|
3125
3732
|
/** The handful of icons the shared components need, inlined so the package does not
|
|
3126
3733
|
* pin apps to one lucide-react version. 24px grid, 2px stroke, lucide geometry. */
|
|
@@ -3191,6 +3798,19 @@ declare function swapSlots(slots: string[], a: number, b: number): string[];
|
|
|
3191
3798
|
declare function narrowLayout(count: 1 | 2, n: NarrowLayout, aspect: number): LayoutNode;
|
|
3192
3799
|
declare function isValidLayout(node: LayoutNode | null, count: number): boolean;
|
|
3193
3800
|
|
|
3801
|
+
interface LayoutPresetOption {
|
|
3802
|
+
/** The value passed to `onChange`. */
|
|
3803
|
+
id: string;
|
|
3804
|
+
/** The visible name under the icon. */
|
|
3805
|
+
label: string;
|
|
3806
|
+
/** A short explanation, shown in a tooltip and read as part of the accessible name. */
|
|
3807
|
+
hint: string;
|
|
3808
|
+
/** The layout the icon draws. */
|
|
3809
|
+
node: LayoutNode;
|
|
3810
|
+
}
|
|
3811
|
+
/** The preset options for a pane count, from `presetsFor`. */
|
|
3812
|
+
declare function presetOptions(count: 1 | 2 | 3 | 4): LayoutPresetOption[];
|
|
3813
|
+
|
|
3194
3814
|
interface SplitDividersProps {
|
|
3195
3815
|
/** The layout being drawn. For a narrow screen, build it with `narrowLayout`. */
|
|
3196
3816
|
layout: LayoutNode;
|
|
@@ -3214,15 +3834,22 @@ interface SplitDividersProps {
|
|
|
3214
3834
|
* area stays off a pane bar shown there. Default 0.
|
|
3215
3835
|
*/
|
|
3216
3836
|
barInset?: number;
|
|
3837
|
+
/** Set when the area is mirrored (right-to-left): positions are measured from the right edge,
|
|
3838
|
+
* a drag to the right shrinks the first pane, and ArrowLeft grows it. `SplitStage` sets this. */
|
|
3839
|
+
rtl?: boolean;
|
|
3840
|
+
/** The DOM id of the pane in a slot, so each divider can list the panes it resizes in `aria-controls`.
|
|
3841
|
+
* `SplitStage` passes it. */
|
|
3842
|
+
paneId?(slot: number): string | undefined;
|
|
3217
3843
|
}
|
|
3218
3844
|
/**
|
|
3219
3845
|
* Drag handles between panes. Each is a keyboard-focusable separator: arrow keys move it 2%,
|
|
3220
|
-
*
|
|
3846
|
+
* Home and End move it to the smallest and largest pane size, Enter or a double-click resets
|
|
3847
|
+
* that split to equal sizes. With several handles in one direction, their names carry a number. The hit area is 24px, 44px on touch
|
|
3221
3848
|
* screens; a thin accent bar shows on hover, focus and drag. Place it inside a `relative` box
|
|
3222
3849
|
* that is `w` by `h` (`SplitStage` does).
|
|
3223
3850
|
*/
|
|
3224
|
-
declare function SplitDividers({ layout, w, h, gap, onResize, onDragChange, minPane, barInset }: SplitDividersProps): react.JSX.Element;
|
|
3225
|
-
interface SplitStageProps {
|
|
3851
|
+
declare function SplitDividers({ layout, w, h, gap, onResize, onDragChange, minPane, barInset, rtl, paneId }: SplitDividersProps): react.JSX.Element;
|
|
3852
|
+
interface SplitStageProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {
|
|
3226
3853
|
/** The layout tree; null renders no panes. Leaves cover slots 0..n-1. */
|
|
3227
3854
|
layout: LayoutNode | null;
|
|
3228
3855
|
/** Item ids in DOM order. Keep this order stable (for example, insertion order); never sort it by slot, or panes move in the DOM and iframes reload. */
|
|
@@ -3266,8 +3893,8 @@ interface SplitStageProps {
|
|
|
3266
3893
|
* style values and never move a DOM node (a moved iframe reloads). Give the stage a size from
|
|
3267
3894
|
* its parent (for example `flex-1 min-h-0`); it measures itself.
|
|
3268
3895
|
*/
|
|
3269
|
-
declare function SplitStage({ layout, items, slots, gap, resizable, onLayoutChange, renderPane, onSize, dragging, animate, minPane, barInset, children, className, }: SplitStageProps): react.JSX.Element;
|
|
3270
|
-
interface LayoutPresetIconProps {
|
|
3896
|
+
declare function SplitStage({ layout, items, slots, gap, resizable, onLayoutChange, renderPane, onSize, dragging, animate, minPane, barInset, children, className, ref: forwardedRef, ...rest }: SplitStageProps): react.JSX.Element;
|
|
3897
|
+
interface LayoutPresetIconProps extends Omit<ComponentPropsWithRef<'svg'>, 'width' | 'height' | 'children'> {
|
|
3271
3898
|
/** The layout to draw: one rounded rectangle per pane. */
|
|
3272
3899
|
node: LayoutNode;
|
|
3273
3900
|
/** Width of the drawing in px (default 56). */
|
|
@@ -3277,18 +3904,8 @@ interface LayoutPresetIconProps {
|
|
|
3277
3904
|
className?: string;
|
|
3278
3905
|
}
|
|
3279
3906
|
/** A small drawing of a layout in the current text color. Decorative: name it with a label beside it. */
|
|
3280
|
-
declare function LayoutPresetIcon({ node, width, height, className }: LayoutPresetIconProps): react.JSX.Element;
|
|
3281
|
-
interface
|
|
3282
|
-
/** The value passed to `onChange`. */
|
|
3283
|
-
id: string;
|
|
3284
|
-
/** The visible name under the icon. */
|
|
3285
|
-
label: string;
|
|
3286
|
-
/** A short explanation, shown in a tooltip and read as part of the accessible name. */
|
|
3287
|
-
hint: string;
|
|
3288
|
-
/** The layout the icon draws. */
|
|
3289
|
-
node: LayoutNode;
|
|
3290
|
-
}
|
|
3291
|
-
interface LayoutPresetPickerProps {
|
|
3907
|
+
declare function LayoutPresetIcon({ node, width, height, className, ref, ...rest }: LayoutPresetIconProps): react.JSX.Element;
|
|
3908
|
+
interface LayoutPresetPickerProps extends Omit<ComponentPropsWithRef<'div'>, 'onChange' | 'children'> {
|
|
3292
3909
|
/** One radio per option. */
|
|
3293
3910
|
options: LayoutPresetOption[];
|
|
3294
3911
|
/** The id of the chosen option, or null when the layout is custom (for example after a resize). */
|
|
@@ -3303,18 +3920,16 @@ interface LayoutPresetPickerProps {
|
|
|
3303
3920
|
overlay?: boolean;
|
|
3304
3921
|
/** Extra classes for the bar, for example an inset like `pr-52`. */
|
|
3305
3922
|
className?: string;
|
|
3306
|
-
/** Name of the radio group for screen readers (
|
|
3923
|
+
/** Name of the radio group for screen readers. Default: the `layoutPresets` string ("Layout presets"). */
|
|
3307
3924
|
label?: string;
|
|
3308
3925
|
}
|
|
3309
|
-
/** The preset options for a pane count, from `presetsFor`. */
|
|
3310
|
-
declare function presetOptions(count: 1 | 2 | 3 | 4): LayoutPresetOption[];
|
|
3311
3926
|
/** A bar of layout presets: one icon radio per option in a scrolling row, with a tooltip hint on each. */
|
|
3312
|
-
declare function LayoutPresetPicker({ options, value, onChange, actions, note, overlay, className, label, }: LayoutPresetPickerProps): react.JSX.Element;
|
|
3927
|
+
declare function LayoutPresetPicker({ options, value, onChange, actions, note, overlay, className, label: labelProp, ref, ...rest }: LayoutPresetPickerProps): react.JSX.Element;
|
|
3313
3928
|
|
|
3314
3929
|
type MediaThumbShape = 'wide' | 'round' | 'square';
|
|
3315
3930
|
type MediaThumbSize = 'sm' | 'md';
|
|
3316
|
-
interface MediaThumbProps {
|
|
3317
|
-
/** The image URL.
|
|
3931
|
+
interface MediaThumbProps extends Omit<ComponentPropsWithoutRef<'span'>, 'children'> {
|
|
3932
|
+
/** The image URL. Relative, http(s) URLs load; javascript:, data: and other schemes show the fallback. */
|
|
3318
3933
|
src?: string;
|
|
3319
3934
|
/** wide: 16:9 (64x36, or 96x54 at md). round and square: 36px, or 48px at md. */
|
|
3320
3935
|
shape?: MediaThumbShape;
|
|
@@ -3325,11 +3940,12 @@ interface MediaThumbProps {
|
|
|
3325
3940
|
/** Alternative text. Empty by default: the row's title already names the item. */
|
|
3326
3941
|
alt?: string;
|
|
3327
3942
|
className?: string;
|
|
3943
|
+
ref?: Ref<HTMLSpanElement>;
|
|
3328
3944
|
}
|
|
3329
3945
|
/** A thumbnail in a fixed box: 16:9, round or square, lazy-loaded, with a fallback fill. */
|
|
3330
|
-
declare function MediaThumb({ src, shape, size, fallback, alt, className }: MediaThumbProps): react.JSX.Element;
|
|
3331
|
-
interface MediaRowProps {
|
|
3332
|
-
/** The image URL (
|
|
3946
|
+
declare function MediaThumb({ src, shape, size, fallback, alt, className, ref, ...rest }: MediaThumbProps): react.JSX.Element;
|
|
3947
|
+
interface MediaRowProps extends Omit<ComponentPropsWithoutRef<'li'>, 'title' | 'onClick' | 'children' | 'className'> {
|
|
3948
|
+
/** The image URL (relative or http(s); other schemes show the fallback). */
|
|
3333
3949
|
thumbnailUrl?: string;
|
|
3334
3950
|
/** wide (16:9, default), round (channels) or square. */
|
|
3335
3951
|
thumbShape?: MediaThumbShape;
|
|
@@ -3345,6 +3961,10 @@ interface MediaRowProps {
|
|
|
3345
3961
|
detail?: ReactNode;
|
|
3346
3962
|
/** true shows a Live badge, false an Offline badge, undefined none. */
|
|
3347
3963
|
live?: boolean;
|
|
3964
|
+
/** The Live badge text. Default: the "live" string. */
|
|
3965
|
+
liveLabel?: string;
|
|
3966
|
+
/** The Offline badge text. Default: the "offlineBadge" string. */
|
|
3967
|
+
offlineLabel?: string;
|
|
3348
3968
|
/** Extra badges after the live one ("On screen"). */
|
|
3349
3969
|
badges?: ReactNode;
|
|
3350
3970
|
/** A control or element at the far right, after the badges. */
|
|
@@ -3362,11 +3982,13 @@ interface MediaRowProps {
|
|
|
3362
3982
|
/** The wrapper element. Default 'li'; pass 'div' outside a list. */
|
|
3363
3983
|
as?: 'li' | 'div';
|
|
3364
3984
|
className?: string;
|
|
3985
|
+
/** The wrapper element. */
|
|
3986
|
+
ref?: Ref<HTMLElement>;
|
|
3365
3987
|
}
|
|
3366
3988
|
/** A result row: thumbnail, two-line title, meta and detail, with Live/Offline and other badges. */
|
|
3367
|
-
declare function MediaRow({ thumbnailUrl, thumbShape, thumbSize, fallback, title, meta, detail, live, badges, trailing, chevron, dense, compact, onClick, href, as, className, }: MediaRowProps): react.JSX.Element;
|
|
3368
|
-
interface MediaChipProps {
|
|
3369
|
-
/** The image URL (
|
|
3989
|
+
declare function MediaRow({ thumbnailUrl, thumbShape, thumbSize, fallback, title, meta, detail, live, liveLabel, offlineLabel, badges, trailing, chevron, dense, compact, onClick, href, as, className, ref, ...rest }: MediaRowProps): react.JSX.Element;
|
|
3990
|
+
interface MediaChipProps extends Omit<ComponentPropsWithoutRef<'button'>, 'onClick' | 'children' | 'type'> {
|
|
3991
|
+
/** The image URL (relative or http(s); other schemes show no image). */
|
|
3370
3992
|
thumbnailUrl?: string;
|
|
3371
3993
|
/** The label; truncates. */
|
|
3372
3994
|
label: string;
|
|
@@ -3375,9 +3997,406 @@ interface MediaChipProps {
|
|
|
3375
3997
|
/** A second, never-truncated word after the label ("Bring back"). */
|
|
3376
3998
|
action?: string;
|
|
3377
3999
|
className?: string;
|
|
4000
|
+
ref?: Ref<HTMLButtonElement>;
|
|
3378
4001
|
}
|
|
3379
4002
|
/** A pill button with a 16:9 thumbnail and a label, 44px tall: a recent item or a hidden pane to bring back. */
|
|
3380
|
-
declare function MediaChip({ thumbnailUrl, label, onClick, action, className }: MediaChipProps): react.JSX.Element;
|
|
4003
|
+
declare function MediaChip({ thumbnailUrl, label, onClick, action, className, ref, ...rest }: MediaChipProps): react.JSX.Element;
|
|
4004
|
+
|
|
4005
|
+
interface RadioOption {
|
|
4006
|
+
value: string;
|
|
4007
|
+
label: ReactNode;
|
|
4008
|
+
/** A quieter line under the label, linked by aria-describedby. */
|
|
4009
|
+
description?: ReactNode;
|
|
4010
|
+
disabled?: boolean;
|
|
4011
|
+
}
|
|
4012
|
+
interface RadioGroupProps extends Omit<ComponentPropsWithoutRef<'div'>, 'defaultValue' | 'onChange'> {
|
|
4013
|
+
/** The selected value (controlled). */
|
|
4014
|
+
value?: string;
|
|
4015
|
+
/** The initially selected value (uncontrolled). */
|
|
4016
|
+
defaultValue?: string;
|
|
4017
|
+
/** Called with the new value when the selection changes. */
|
|
4018
|
+
onValueChange?: (value: string) => void;
|
|
4019
|
+
/** The form field name every radio posts under. Defaults to a generated name, so the
|
|
4020
|
+
* radios always form one native group. */
|
|
4021
|
+
name?: string;
|
|
4022
|
+
/** Radios to render from data. Use `<Radio>` children instead for custom layouts. */
|
|
4023
|
+
options?: RadioOption[];
|
|
4024
|
+
/** vertical (default) stacks the radios; horizontal lays them in a wrapping row. */
|
|
4025
|
+
orientation?: 'vertical' | 'horizontal';
|
|
4026
|
+
/** Disables every radio. */
|
|
4027
|
+
disabled?: boolean;
|
|
4028
|
+
/** Marks the group required (aria-required, and native validation on the inputs). */
|
|
4029
|
+
required?: boolean;
|
|
4030
|
+
/** Red radios and aria-invalid. Field sets it from its `error`. */
|
|
4031
|
+
invalid?: boolean;
|
|
4032
|
+
/** `<Radio>` children, used when `options` is not given. */
|
|
4033
|
+
children?: ReactNode;
|
|
4034
|
+
/** The `role="radiogroup"` element. */
|
|
4035
|
+
ref?: Ref<HTMLDivElement>;
|
|
4036
|
+
}
|
|
4037
|
+
/** A group of native radio buttons. Posts in FormData, works with react-hook-form's
|
|
4038
|
+
* `register` (leave `value` out and put `register(...)` on each `<Radio>`), and follows the
|
|
4039
|
+
* APG radio group keyboard model: the arrows move and select, mirrored in right-to-left. */
|
|
4040
|
+
declare function RadioGroup({ value, defaultValue, onValueChange, name, options, orientation, disabled, required, invalid, className, children, ref, id, onKeyDown, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-invalid': ariaInvalid, ...rest }: RadioGroupProps): react.JSX.Element;
|
|
4041
|
+
interface RadioProps extends Omit<ComponentPropsWithoutRef<'input'>, 'type' | 'value' | 'checked' | 'defaultChecked' | 'size' | 'children' | 'className'> {
|
|
4042
|
+
/** The value this radio posts and selects. */
|
|
4043
|
+
value: string;
|
|
4044
|
+
/** The visible label. Clicking it selects the radio. Without one, pass aria-label. */
|
|
4045
|
+
label?: ReactNode;
|
|
4046
|
+
/** A quieter line under the label, linked by aria-describedby. */
|
|
4047
|
+
description?: ReactNode;
|
|
4048
|
+
/** Classes for the label row. */
|
|
4049
|
+
className?: string;
|
|
4050
|
+
/** The native `<input type="radio">` (so `register(...)` from react-hook-form can attach). */
|
|
4051
|
+
ref?: Ref<HTMLInputElement>;
|
|
4052
|
+
}
|
|
4053
|
+
/** One radio inside a RadioGroup: a native input, a drawn circle, a label and an optional
|
|
4054
|
+
* description. The whole row is a 44px target on touch screens. */
|
|
4055
|
+
declare function Radio({ value, label, description, className, disabled, required, name, onChange, ref, ...rest }: RadioProps): react.JSX.Element;
|
|
4056
|
+
|
|
4057
|
+
type SliderValue = number | [number, number];
|
|
4058
|
+
interface SliderProps<V extends SliderValue = number> extends Omit<ComponentPropsWithoutRef<'div'>, 'defaultValue' | 'onChange'> {
|
|
4059
|
+
/** The value (controlled): a number, or `[low, high]` for a range with two thumbs. */
|
|
4060
|
+
value?: V;
|
|
4061
|
+
/** The initial value (uncontrolled). A pair makes it a range. Default: `min`. */
|
|
4062
|
+
defaultValue?: V;
|
|
4063
|
+
/** Called on every change while dragging or pressing keys. */
|
|
4064
|
+
onValueChange?: (value: V) => void;
|
|
4065
|
+
/** Called when a drag ends or a key press changes the value: the moment to save. */
|
|
4066
|
+
onValueCommit?: (value: V) => void;
|
|
4067
|
+
/** Smallest value. Default 0. */
|
|
4068
|
+
min?: number;
|
|
4069
|
+
/** Largest value. Default 100. */
|
|
4070
|
+
max?: number;
|
|
4071
|
+
/** Step between values. Default 1. */
|
|
4072
|
+
step?: number;
|
|
4073
|
+
/** Posts the value in a form (a range posts the name twice: low, then high). */
|
|
4074
|
+
name?: string;
|
|
4075
|
+
/** Turns off dragging and keys, and leaves the value out of the form. */
|
|
4076
|
+
disabled?: boolean;
|
|
4077
|
+
/** Red styling and data-invalid. Field sets it from its `error`. */
|
|
4078
|
+
invalid?: boolean;
|
|
4079
|
+
/** Turns a value into the text screen readers announce (`aria-valuetext`): "$40", "3 days". */
|
|
4080
|
+
formatValue?: (value: number, thumb: number) => string;
|
|
4081
|
+
/** The element that holds the track. */
|
|
4082
|
+
ref?: Ref<HTMLDivElement>;
|
|
4083
|
+
}
|
|
4084
|
+
/** A single-value or range slider. Each thumb is `role="slider"` with arrows, PageUp/PageDown,
|
|
4085
|
+
* Home and End; pointer drag works on the whole track; right-to-left mirrors the direction.
|
|
4086
|
+
* Hidden inputs post the value(s) in a form. */
|
|
4087
|
+
declare function Slider<V extends SliderValue = number>({ value, defaultValue, onValueChange, onValueCommit, min, max, step, name, disabled, invalid, formatValue, className, ref, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, ...rest }: SliderProps<V>): react.JSX.Element;
|
|
4088
|
+
|
|
4089
|
+
interface TagInputProps extends Omit<ComponentPropsWithoutRef<'div'>, 'defaultValue' | 'onChange' | 'children' | 'placeholder'> {
|
|
4090
|
+
/** The tags (controlled). */
|
|
4091
|
+
value?: string[];
|
|
4092
|
+
/** The initial tags (uncontrolled). */
|
|
4093
|
+
defaultValue?: string[];
|
|
4094
|
+
/** Called with the new list when a tag is added or removed. */
|
|
4095
|
+
onValueChange?: (value: string[]) => void;
|
|
4096
|
+
/** Posts every tag in a form, one hidden input per tag under this name. */
|
|
4097
|
+
name?: string;
|
|
4098
|
+
/** Shown in the text box while there are no tags. */
|
|
4099
|
+
placeholder?: string;
|
|
4100
|
+
/** No more than this many tags can be added. */
|
|
4101
|
+
maxTags?: number;
|
|
4102
|
+
/** Return an error message to refuse a tag (it stays in the text box, and the message shows
|
|
4103
|
+
* under the field), or null to accept it. */
|
|
4104
|
+
validate?: (tag: string) => string | null;
|
|
4105
|
+
/** A list of tags to pick from, filtered as the reader types (combobox pattern). Free
|
|
4106
|
+
* text is still accepted. */
|
|
4107
|
+
suggestions?: string[];
|
|
4108
|
+
disabled?: boolean;
|
|
4109
|
+
/** Required on the text box (native validation is off while it holds nothing but tags; use
|
|
4110
|
+
* your form library for "at least one tag"). */
|
|
4111
|
+
required?: boolean;
|
|
4112
|
+
/** Red border and aria-invalid on the text box. Field sets it from its `error`. */
|
|
4113
|
+
invalid?: boolean;
|
|
4114
|
+
/** md (default) or sm, as for Input. */
|
|
4115
|
+
size?: 'sm' | 'md';
|
|
4116
|
+
/** The text `<input>`. */
|
|
4117
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
4118
|
+
/** The bordered box that holds the tags and the text box. `id`, `aria-label`, `aria-labelledby`,
|
|
4119
|
+
* `aria-describedby` and `aria-invalid` go to the text box instead, so a Field label reaches it. */
|
|
4120
|
+
ref?: Ref<HTMLDivElement>;
|
|
4121
|
+
}
|
|
4122
|
+
/** A text box that turns what you type into removable tags. Enter and comma add a tag, pasting
|
|
4123
|
+
* a list splits it, Backspace on an empty box removes the last tag. Each tag posts as its own
|
|
4124
|
+
* hidden input. */
|
|
4125
|
+
declare function TagInput({ value, defaultValue, onValueChange, name, placeholder, maxTags, validate, suggestions, disabled, required, invalid, size, className, ref, inputRef, id, onClick, onBlur, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...rest }: TagInputProps): react.JSX.Element;
|
|
4126
|
+
|
|
4127
|
+
interface RejectedFile {
|
|
4128
|
+
file: File;
|
|
4129
|
+
/** type: not in `accept`. size: over `maxSize`. count: over `maxFiles` (or a second file when not `multiple`). */
|
|
4130
|
+
reason: 'type' | 'size' | 'count';
|
|
4131
|
+
}
|
|
4132
|
+
interface FileDropzoneProps extends Omit<ComponentPropsWithoutRef<'div'>, 'onChange' | 'children' | 'defaultValue'> {
|
|
4133
|
+
/** What the picker offers and the zone accepts: ".pdf,image/*" (the native `accept` syntax). */
|
|
4134
|
+
accept?: string;
|
|
4135
|
+
/** Allow several files. Without it a new pick replaces the old one. */
|
|
4136
|
+
multiple?: boolean;
|
|
4137
|
+
/** Largest file in bytes. Bigger files are rejected with reason "size". */
|
|
4138
|
+
maxSize?: number;
|
|
4139
|
+
/** Most files held at once (with `multiple`). Extra files are rejected with reason "count". */
|
|
4140
|
+
maxFiles?: number;
|
|
4141
|
+
/** Called whenever the list changes, with the files now held and the files just refused. */
|
|
4142
|
+
onFilesChange?: (files: File[], rejected: RejectedFile[]) => void;
|
|
4143
|
+
/** The field name of the real `<input type="file">`, so the form posts the files. */
|
|
4144
|
+
name?: string;
|
|
4145
|
+
disabled?: boolean;
|
|
4146
|
+
required?: boolean;
|
|
4147
|
+
/** Red border. Field sets it from its `error`. */
|
|
4148
|
+
invalid?: boolean;
|
|
4149
|
+
/** Replaces the default "Drop files here or browse" text. */
|
|
4150
|
+
label?: ReactNode;
|
|
4151
|
+
/** The bordered zone's root. `data-state` is "dragging" while files are dragged over it, else "idle".
|
|
4152
|
+
* `id`, `aria-label`, `aria-labelledby`, `aria-describedby` and `aria-invalid` go to the file
|
|
4153
|
+
* input, so a Field label reaches it. */
|
|
4154
|
+
ref?: Ref<HTMLDivElement>;
|
|
4155
|
+
}
|
|
4156
|
+
/** A drop zone around a real `<input type="file">`: click, Enter or Space opens the picker, files
|
|
4157
|
+
* can be dropped, and the held files are listed with a remove button each. */
|
|
4158
|
+
declare function FileDropzone({ accept, multiple, maxSize, maxFiles, onFilesChange, name, disabled, required, invalid, label, className, ref, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, ...rest }: FileDropzoneProps): react.JSX.Element;
|
|
4159
|
+
|
|
4160
|
+
type Slot = number | 'dots-start' | 'dots-end';
|
|
4161
|
+
/** The page numbers and ellipses to show: the same count of slots wherever the current page is,
|
|
4162
|
+
* so the row does not change width as you page. */
|
|
4163
|
+
declare function paginationRange(page: number, pageCount: number, siblings?: number, boundaries?: number): Slot[];
|
|
4164
|
+
|
|
4165
|
+
type PaginationSize = 'sm' | 'md';
|
|
4166
|
+
/** What `renderLink` receives for a page, previous or next control: spread it on the router link. */
|
|
4167
|
+
interface PaginationLinkProps {
|
|
4168
|
+
/** The classes of the control (size, current and hover looks). */
|
|
4169
|
+
className: string;
|
|
4170
|
+
/** "Page 3", "Previous page" or "Next page". */
|
|
4171
|
+
'aria-label': string;
|
|
4172
|
+
/** "page" on the current page. */
|
|
4173
|
+
'aria-current'?: 'page';
|
|
4174
|
+
/** "active" on the current page, "inactive" otherwise. */
|
|
4175
|
+
'data-state': 'active' | 'inactive';
|
|
4176
|
+
/** The page number or the arrow. */
|
|
4177
|
+
children: ReactNode;
|
|
4178
|
+
/** Keeps the page state in step; the router still navigates. */
|
|
4179
|
+
onClick: (event: MouseEvent<HTMLElement>) => void;
|
|
4180
|
+
}
|
|
4181
|
+
interface PaginationProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'onChange' | 'children' | 'defaultValue'> {
|
|
4182
|
+
/** The current page, 1-based. Pass it to control the component. */
|
|
4183
|
+
page?: number;
|
|
4184
|
+
/** The first page when uncontrolled (default 1). */
|
|
4185
|
+
defaultPage?: number;
|
|
4186
|
+
/** Called with the new page (1-based) when the user picks one. */
|
|
4187
|
+
onPageChange?: (page: number) => void;
|
|
4188
|
+
/** How many pages there are. */
|
|
4189
|
+
pageCount: number;
|
|
4190
|
+
/** Pages shown on each side of the current one (default 1). */
|
|
4191
|
+
siblings?: number;
|
|
4192
|
+
/** Pages always shown at the start and at the end (default 1). */
|
|
4193
|
+
boundaries?: number;
|
|
4194
|
+
/** sm (32px) or md (36px, default). Every control is 44px on touch screens. */
|
|
4195
|
+
size?: PaginationSize;
|
|
4196
|
+
/** Renders each control as a router link: `(page, props) => <Link to={`?page=${page}`} {...props} />`. */
|
|
4197
|
+
renderLink?: (page: number, props: PaginationLinkProps) => ReactNode;
|
|
4198
|
+
/** Forces the compact "Page 3 of 10" form (true) or the full list (false). Unset: compact under 400px container width. */
|
|
4199
|
+
compact?: boolean;
|
|
4200
|
+
/** Disables every control. */
|
|
4201
|
+
disabled?: boolean;
|
|
4202
|
+
/** The nav landmark label. Default: `paginationLabel` from NishProvider strings. */
|
|
4203
|
+
label?: string;
|
|
4204
|
+
/** The previous control's label. Default: `previousPage` from the strings. */
|
|
4205
|
+
previousLabel?: string;
|
|
4206
|
+
/** The next control's label. Default: `nextPage` from the strings. */
|
|
4207
|
+
nextLabel?: string;
|
|
4208
|
+
/** Label of one page button. Default: `pageLabel` from the strings. */
|
|
4209
|
+
pageLabel?: (page: number) => string;
|
|
4210
|
+
/** The compact text. Default: "Page 3 of 10" (English; pass your own for other languages). */
|
|
4211
|
+
compactLabel?: (page: number, pageCount: number) => string;
|
|
4212
|
+
ref?: Ref<HTMLElement>;
|
|
4213
|
+
}
|
|
4214
|
+
/** Page navigation: numbered pages with ellipses, previous and next, a nav landmark and
|
|
4215
|
+
* aria-current on the current page. Under 400px of its own width it shows "Page 3 of 10"
|
|
4216
|
+
* with previous and next. Use renderLink so each control is a router link. */
|
|
4217
|
+
declare function Pagination({ page: pageProp, defaultPage, onPageChange, pageCount, siblings, boundaries, size, renderLink, compact: compactProp, disabled, label, previousLabel, nextLabel, pageLabel, compactLabel, className, ref, ...rest }: PaginationProps): react.JSX.Element | null;
|
|
4218
|
+
|
|
4219
|
+
interface BreadcrumbItem {
|
|
4220
|
+
/** The crumb's text. */
|
|
4221
|
+
label: ReactNode;
|
|
4222
|
+
/** Where the crumb goes. Passed through `safeUrl`: a `javascript:` URL renders as plain text. */
|
|
4223
|
+
href?: string;
|
|
4224
|
+
/** Runs on click. With `href` it runs before the link navigates; alone it makes a button. */
|
|
4225
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
4226
|
+
}
|
|
4227
|
+
/** What `renderLink` receives for a crumb: spread it on the router link. */
|
|
4228
|
+
interface BreadcrumbLinkProps {
|
|
4229
|
+
className: string;
|
|
4230
|
+
/** The href after `safeUrl`. */
|
|
4231
|
+
href: string;
|
|
4232
|
+
children: ReactNode;
|
|
4233
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
4234
|
+
}
|
|
4235
|
+
interface BreadcrumbsProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'children'> {
|
|
4236
|
+
/** The trail, root first. The last item is the current page. Use this or children. */
|
|
4237
|
+
items?: BreadcrumbItem[];
|
|
4238
|
+
/** Ready-made crumbs (links, spans), root first, when `items` does not fit. These are never collapsed. */
|
|
4239
|
+
children?: ReactNode;
|
|
4240
|
+
/** Renders a crumb with a href as a router link: `(item, props) => <Link to={props.href} {...props} />`. */
|
|
4241
|
+
renderLink?: (item: BreadcrumbItem, props: BreadcrumbLinkProps) => ReactNode;
|
|
4242
|
+
/** The separator between crumbs. Default: a chevron that mirrors in RTL. */
|
|
4243
|
+
separator?: ReactNode;
|
|
4244
|
+
/** More crumbs than this collapse the middle ones into a "…" menu (default 4). */
|
|
4245
|
+
maxItems?: number;
|
|
4246
|
+
/** auto (default): collapse only under 640px of container width. always: whenever there are more than maxItems. never: show every crumb. */
|
|
4247
|
+
collapse?: 'auto' | 'always' | 'never';
|
|
4248
|
+
/** The nav landmark label. Default: `breadcrumbs` from NishProvider strings. */
|
|
4249
|
+
label?: string;
|
|
4250
|
+
/** The label of the "…" button. Default: `more` from the strings. */
|
|
4251
|
+
moreLabel?: string;
|
|
4252
|
+
ref?: Ref<HTMLElement>;
|
|
4253
|
+
}
|
|
4254
|
+
/** A trail of where the page sits: links, a chevron between them and aria-current="page" on the
|
|
4255
|
+
* last crumb. A long trail collapses its middle crumbs into a "…" menu on narrow containers. */
|
|
4256
|
+
declare function Breadcrumbs({ items, children, renderLink, separator, maxItems, collapse, label, moreLabel, className, ref, ...rest }: BreadcrumbsProps): react.JSX.Element;
|
|
4257
|
+
|
|
4258
|
+
type AccordionHeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
4259
|
+
interface AccordionBase extends Omit<ComponentPropsWithoutRef<'div'>, 'defaultValue' | 'onChange'> {
|
|
4260
|
+
/** The AccordionItems. */
|
|
4261
|
+
children: ReactNode;
|
|
4262
|
+
/** The heading level of every item's header (default 3), so the page outline stays right. */
|
|
4263
|
+
headingLevel?: AccordionHeadingLevel;
|
|
4264
|
+
/** Disables every item. */
|
|
4265
|
+
disabled?: boolean;
|
|
4266
|
+
/** Names the group for screen readers. Default: `accordion` from NishProvider strings. */
|
|
4267
|
+
label?: string;
|
|
4268
|
+
ref?: Ref<HTMLDivElement>;
|
|
4269
|
+
}
|
|
4270
|
+
interface AccordionSingleProps extends AccordionBase {
|
|
4271
|
+
/** One item open at a time. */
|
|
4272
|
+
type?: 'single';
|
|
4273
|
+
/** The open item's value ('' for none). Pass it to control the component. */
|
|
4274
|
+
value?: string;
|
|
4275
|
+
/** The open item when uncontrolled ('' or unset for none). */
|
|
4276
|
+
defaultValue?: string;
|
|
4277
|
+
/** Called with the open item's value, or '' when the open item is closed. */
|
|
4278
|
+
onValueChange?: (value: string) => void;
|
|
4279
|
+
/** Lets the open item close (default false: one item stays open once opened). */
|
|
4280
|
+
collapsible?: boolean;
|
|
4281
|
+
}
|
|
4282
|
+
interface AccordionMultipleProps extends AccordionBase {
|
|
4283
|
+
/** Any number of items open at once. */
|
|
4284
|
+
type: 'multiple';
|
|
4285
|
+
/** The open items' values. Pass it to control the component. */
|
|
4286
|
+
value?: string[];
|
|
4287
|
+
/** The open items when uncontrolled. */
|
|
4288
|
+
defaultValue?: string[];
|
|
4289
|
+
/** Called with the open items' values. */
|
|
4290
|
+
onValueChange?: (value: string[]) => void;
|
|
4291
|
+
collapsible?: never;
|
|
4292
|
+
}
|
|
4293
|
+
type AccordionProps = AccordionSingleProps | AccordionMultipleProps;
|
|
4294
|
+
/** A stack of headers that each open and close a panel. Items in `type="single"` close each
|
|
4295
|
+
* other; `type="multiple"` leaves them independent. The arrow keys move between the headers. */
|
|
4296
|
+
declare function Accordion(props: AccordionProps): react.JSX.Element;
|
|
4297
|
+
interface AccordionItemProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title'> {
|
|
4298
|
+
/** Identifies the item in the Accordion's value. */
|
|
4299
|
+
value: string;
|
|
4300
|
+
/** The header's content. */
|
|
4301
|
+
title: ReactNode;
|
|
4302
|
+
/** The panel's content. */
|
|
4303
|
+
children: ReactNode;
|
|
4304
|
+
/** Shown but not toggleable; the arrow keys skip it. */
|
|
4305
|
+
disabled?: boolean;
|
|
4306
|
+
ref?: Ref<HTMLDivElement>;
|
|
4307
|
+
}
|
|
4308
|
+
/** One header and its panel inside an Accordion. */
|
|
4309
|
+
declare function AccordionItem({ value, title, children, disabled: disabledProp, className, ref, ...rest }: AccordionItemProps): react.JSX.Element;
|
|
4310
|
+
|
|
4311
|
+
interface SeparatorProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
4312
|
+
/** horizontal (default) draws a rule across; vertical draws one down inside a flex row. */
|
|
4313
|
+
orientation?: 'horizontal' | 'vertical';
|
|
4314
|
+
/** Purely visual: the separator is hidden from assistive technology (role="none"). Default true. Pass false to expose role="separator". */
|
|
4315
|
+
decorative?: boolean;
|
|
4316
|
+
/** Text centered on a horizontal rule ("or", "Today"). */
|
|
4317
|
+
label?: ReactNode;
|
|
4318
|
+
ref?: Ref<HTMLDivElement>;
|
|
4319
|
+
}
|
|
4320
|
+
/** A thin rule between groups of content, optionally with a label in the middle. */
|
|
4321
|
+
declare function Separator({ orientation, decorative, label, className, ref, ...rest }: SeparatorProps): react.JSX.Element;
|
|
4322
|
+
|
|
4323
|
+
/** Index 0 to 7 of the hue a name gets: the same name always maps to the same hue. */
|
|
4324
|
+
declare function avatarHueIndex(name: string): number;
|
|
4325
|
+
/** Up to two initials: first letters of the first and last words. */
|
|
4326
|
+
declare function avatarInitials(name: string): string;
|
|
4327
|
+
|
|
4328
|
+
type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4329
|
+
type AvatarShape = 'circle' | 'square';
|
|
4330
|
+
interface AvatarProps extends Omit<ComponentPropsWithoutRef<'span'>, 'children'> {
|
|
4331
|
+
/** Image URL. Unsafe URLs (javascript:, data:) are ignored and the initials show. */
|
|
4332
|
+
src?: string | null;
|
|
4333
|
+
/** The person or thing. Gives the initials and the color, and is the default alt text. */
|
|
4334
|
+
name?: string;
|
|
4335
|
+
/** Alt text for the image. Default: name. Pass an empty string when the name is written next to it. */
|
|
4336
|
+
alt?: string;
|
|
4337
|
+
/** xs 24px, sm 32px, md 40px (default), lg 48px, xl 64px. */
|
|
4338
|
+
size?: AvatarSize;
|
|
4339
|
+
/** circle (default) or square with rounded corners. */
|
|
4340
|
+
shape?: AvatarShape;
|
|
4341
|
+
/** A status dot at the bottom corner. Give it text elsewhere; color is never the only signal. */
|
|
4342
|
+
status?: StatusTone;
|
|
4343
|
+
/** The root element. */
|
|
4344
|
+
ref?: Ref<HTMLSpanElement>;
|
|
4345
|
+
}
|
|
4346
|
+
/** A person or entity: their image, or initials on a color taken from their name. */
|
|
4347
|
+
declare function Avatar({ src, name, alt, size, shape, status, className, ref, ...rest }: AvatarProps): react.JSX.Element;
|
|
4348
|
+
interface AvatarGroupProps extends ComponentPropsWithoutRef<'div'> {
|
|
4349
|
+
/** Avatars shown before the "+N" overflow badge. Default: all. */
|
|
4350
|
+
max?: number;
|
|
4351
|
+
/** Size for every avatar that does not set its own. Default md. */
|
|
4352
|
+
size?: AvatarSize;
|
|
4353
|
+
/** Shape for every avatar that does not set its own. */
|
|
4354
|
+
shape?: AvatarShape;
|
|
4355
|
+
/** The Avatars. */
|
|
4356
|
+
children?: ReactNode;
|
|
4357
|
+
/** The root element. */
|
|
4358
|
+
ref?: Ref<HTMLDivElement>;
|
|
4359
|
+
}
|
|
4360
|
+
/** Overlapping avatars, with a "+N" badge for the ones past `max`. */
|
|
4361
|
+
declare function AvatarGroup({ max, size, shape, children, className, ref, ...rest }: AvatarGroupProps): react.JSX.Element;
|
|
4362
|
+
|
|
4363
|
+
type ProgressTone = 'accent' | 'ok' | 'warn' | 'loss' | 'info' | 'neutral';
|
|
4364
|
+
declare const THICK: {
|
|
4365
|
+
readonly xs: "h-1";
|
|
4366
|
+
readonly sm: "h-1.5";
|
|
4367
|
+
readonly md: "h-2.5";
|
|
4368
|
+
readonly lg: "h-4";
|
|
4369
|
+
};
|
|
4370
|
+
interface ProgressProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
4371
|
+
/** Current value from 0 to max. Null (or omitted) shows an indeterminate bar. */
|
|
4372
|
+
value?: number | null;
|
|
4373
|
+
/** The value that means done. Default 100. */
|
|
4374
|
+
max?: number;
|
|
4375
|
+
/** Fill color. Default accent. */
|
|
4376
|
+
tone?: ProgressTone;
|
|
4377
|
+
/** Bar thickness: xs 4px, sm 6px (default), md 10px, lg 16px. */
|
|
4378
|
+
size?: keyof typeof THICK;
|
|
4379
|
+
/** A visible label above the bar. It also names the bar for screen readers. */
|
|
4380
|
+
label?: ReactNode;
|
|
4381
|
+
/** Shows the formatted value beside the label. */
|
|
4382
|
+
showValue?: boolean;
|
|
4383
|
+
/** Turns the value into the text screen readers (and showValue) use. Default: a rounded percent. */
|
|
4384
|
+
formatValue?: (value: number, max: number) => string;
|
|
4385
|
+
/** The wrapper element; the ARIA progressbar is the bar inside it. */
|
|
4386
|
+
ref?: Ref<HTMLDivElement>;
|
|
4387
|
+
}
|
|
4388
|
+
/** A progress bar for work that finishes: determinate with a value, indeterminate without. */
|
|
4389
|
+
declare function Progress({ value, max, tone, size, label, showValue, formatValue, className, ref, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, ...rest }: ProgressProps): react.JSX.Element;
|
|
4390
|
+
|
|
4391
|
+
interface VisuallyHiddenProps extends ComponentPropsWithoutRef<'span'> {
|
|
4392
|
+
/** The element to render. Default span; use div for block content. */
|
|
4393
|
+
as?: 'span' | 'div';
|
|
4394
|
+
/** The root element. */
|
|
4395
|
+
ref?: Ref<HTMLElement>;
|
|
4396
|
+
}
|
|
4397
|
+
/** Text that screen readers read and sighted users do not see. Uses inline styles, so it works
|
|
4398
|
+
* without Tailwind or any stylesheet. A `style` prop is merged after the hiding styles. */
|
|
4399
|
+
declare function VisuallyHidden({ as, style, ref, ...rest }: VisuallyHiddenProps): react.JSX.Element;
|
|
3381
4400
|
|
|
3382
|
-
export { ActivityFeed, AgentNode, AnimatedList, ApiError, AppErrorBoundary, AppHeader, AppShell, AsyncPanel, BREAKPOINTS, Badge, BarChart, BellIcon, BottomNav, Button, COLOR_ROLES, Callout, Card, CardHeader, CardListSkeleton, ChartLegend, CheckIcon, Checkbox, Chip, ChipGroup, ClockIcon, Combobox, CommandPalette, ConfirmDialog, ConnectionBanner, CopyButton, DEFAULT_THEME, Disclosure, Drawer, DropdownMenu, EmptyState, ErrorState, Favicon, Field, FieldGroup, FilterBar, FilterSheet, FlowSteps, HUE_ROLES, INBOX_ACTION_HEADER, INBOX_ACTION_TIMEOUT_MS, INBOX_DEFAULT_SETTINGS, INBOX_SOURCE_LABELS, IconButton, Inbox, Input, Kbd, KeyValueList, Label, LayoutPresetIcon, LayoutPresetPicker, LineChart, LinkCard, ListRow, LoadingBar, MAX_PANES, MediaChip, MediaRow, MediaThumb, MenuItem, MenuLabel, MenuSeparator, MenuSubHeader, Meter, Modal, MoreIcon, MoreSheet, NARROW_BREAKPOINT, NARROW_MAX, NARROW_QUERY, NavRail, NumberField, PHONE_QUERY, PRESETS, PageContainer, PageHeader, Popover, RangeBar, RelativeTime, ResponsiveTable, SCALE, SHADOWS, SOFT_ROLES, ScrollRow, SearchInput, SectionHeader, SectionNav, Segmented, Select, ServiceTokensSection, SettingRow, SettingsIcon, SettingsSection, Skeleton, SkeletonCard, SkeletonLines, SkeletonRows, Sparkline, Spinner, SplitDividers, SplitStage, Stat, StatGrid, StatGridSkeleton, StatusDot, StepBar, StickyActionBar, StickyBar, Switch, THEMES, TOGGLE_ORDER, TabPanel, Table, TableWrap, Tabs, Td, Textarea, Th, ThemeToggle, TickerText, Toaster, Tooltip, Tr, WorkflowBoard, addSlot, apiFetch, applyTheme, badgeClass, buttonClass, cardClass, chipClass, cn, computeDividers, computeRects, configureApi, confirmDialog, copyText, countLeaves, cycleTheme, defaultPreset, dismissToast, equalize, fieldClass, getThemeChoice, iconButtonClass, initTheme, isThemeName, isValidLayout, linkClass, locationAdapter, menuItemClass, mountChecklist, mountHeightVar, mountScrollspy, mountStuck, mountThemeToggle, mountTooltips, narrowLayout, navigateFromLayer, onThemeChange, openSheet, presetOptions, presetsFor, readToken, registerThemes, removeSlot, resizeAt, resolveTheme, revealClass, schemeOf, setThemeChoice, showToast, signTone, swapSlots, tabClass, tableClass, toast, toneFor, useBreakpoint, useCommandHotkey, useDocumentTitle, useHeightVar, useLocalStorage, useMediaQuery, useNarrow, useNow, useOnline, usePhone, usePrefersReducedMotion, useResource, useSaveStatus, useScrollEdges, useScrollSpy, useServiceTokens, useStuck, useTheme, useToast, useUrlState };
|
|
3383
|
-
export type { ActivityFeedProps, ActivityItem, AgentNodeProps, AgentNodeState, AnimatedListProps, ApiConfig, ApiFetchOptions, AppErrorBoundaryProps, AppHeaderProps, AppShellProps, AppShellSidebar, AsyncPanelProps,
|
|
4401
|
+
export { Accordion, AccordionItem, ActivityFeed, AgentNode, AnimatedList, ApiError, AppErrorBoundary, AppHeader, AppShell, AsyncPanel, Avatar, AvatarGroup, BREAKPOINTS, Badge, BarChart, BellIcon, BottomNav, Breadcrumbs, Button, COLOR_ROLES, Callout, Card, CardHeader, CardListSkeleton, ChartLegend, CheckIcon, Checkbox, Chip, ChipGroup, ClockIcon, Combobox, CommandPalette, ConfirmDialog, ConnectionBanner, CopyButton, DEFAULT_INBOX_LABELS, DEFAULT_STRINGS, DEFAULT_THEME, Disclosure, Drawer, DropdownMenu, EmptyState, ErrorState, Favicon, Field, FieldGroup, FileDropzone, FilterBar, FilterSheet, FlowSteps, HUE_ROLES, INBOX_ACTION_HEADER, INBOX_ACTION_TIMEOUT_MS, INBOX_DEFAULT_SETTINGS, INBOX_SOURCE_LABELS, IconButton, Inbox, Input, Kbd, KeyValueList, Label, LayoutPresetIcon, LayoutPresetPicker, LineChart, LinkCard, ListRow, LoadingBar, MAX_PANES, MediaChip, MediaRow, MediaThumb, MenuItem, MenuLabel, MenuSeparator, MenuSubHeader, Meter, Modal, MoreIcon, MoreSheet, NARROW_BREAKPOINT, NARROW_MAX, NARROW_QUERY, NavRail, NishProvider, NumberField, PHONE_QUERY, PRESETS, PageContainer, PageHeader, Pagination, Popover, Portal, Progress, Radio, RadioGroup, RangeBar, RelativeTime, ResponsiveTable, SCALE, SHADOWS, SOFT_ROLES, ScrollRow, SearchInput, SectionHeader, SectionNav, Segmented, Select, Separator, ServiceTokensSection, SettingRow, SettingsIcon, SettingsSection, Skeleton, SkeletonCard, SkeletonLines, SkeletonRows, Slider, Sparkline, Spinner, SplitDividers, SplitStage, Stat, StatGrid, StatGridSkeleton, StatusDot, StepBar, StickyActionBar, StickyBar, Switch, THEMES, TOGGLE_ORDER, TabPanel, Table, TableWrap, Tabs, TagInput, Td, Textarea, Th, ThemeToggle, TickerText, Toaster, Tooltip, Tr, VERSION, VisuallyHidden, WorkflowBoard, addSlot, apiFetch, applyTheme, avatarHueIndex, avatarInitials, badgeClass, buttonClass, cardClass, chipClass, cn, computeDividers, computeRects, configureApi, configureFavicons, confirmDialog, copyText, countLeaves, cycleTheme, defaultPreset, dismissToast, equalize, fieldClass, getDefaultLocale, getThemeChoice, googleFavicon, iconButtonClass, initTheme, isRtl, isThemeName, isValidLayout, linkClass, locationAdapter, menuItemClass, mountChecklist, mountHeightVar, mountScrollspy, mountStuck, mountThemeToggle, mountTooltips, narrowLayout, navigateFromLayer, onThemeChange, openSheet, paginationRange, presetOptions, presetsFor, readToken, registerThemes, removeSlot, resizeAt, resolveTheme, revealClass, safeUrl, schemeOf, setDefaultLocale, setThemeChoice, showToast, signTone, swapSlots, tabClass, tableClass, toast, toneFor, useBreakpoint, useCommandHotkey, useDocumentTitle, useHeightVar, useIsClient, useIsoLayoutEffect, useLocalStorage, useMediaQuery, useNarrow, useNishConfig, useNishStrings, useNow, useOnline, usePhone, usePrefersReducedMotion, useResource, useSaveStatus, useScrollEdges, useScrollSpy, useServiceTokens, useStuck, useTheme, useToast, useUrlState };
|
|
4402
|
+
export type { AccordionHeadingLevel, AccordionItemProps, AccordionMultipleProps, AccordionProps, AccordionSingleProps, ActivityFeedProps, ActivityItem, AgentNodeProps, AgentNodeState, AgoOptions, AnimatedListProps, ApiConfig, ApiFetchOptions, AppErrorBoundaryProps, AppHeaderHub, AppHeaderProps, AppShellProps, AppShellSidebar, AsyncPanelProps, AvatarGroupProps, AvatarProps, AvatarShape, AvatarSize, BadgeClassOptions, BadgeHue, BadgeProps, BadgeTone, BarChartProps, BottomNavProps, BreadcrumbItem, BreadcrumbLinkProps, BreadcrumbsProps, Breakpoint, ButtonClassOptions, ButtonProps, ButtonSize, ButtonVariant, CalloutProps, CalloutTone, CardClassOptions, CardElement, CardHeaderProps, CardListSkeletonProps, CardPadding, CardProps, ChartLegendItem, ChartLegendProps, ChartLegendTone, ChartTone, CheckboxProps, ChipClassOptions, ChipGroupProps, ChipProps, ChipVariant, Column, ComboboxOption, ComboboxProps, CommandItem, CommandPaletteProps, ConfirmDialogOptions, ConfirmDialogProps, ConnectionBannerProps, CopyButtonProps, DateOptions, DisclosureProps, Divider, DrawerProps, DropdownMenuProps, EmptyStateProps, ErrorStateProps, FaviconProps, FaviconResolver, FieldClassOptions, FieldGroupProps, FieldProps, FieldSize, FileDropzoneProps, FilterBarProps, FilterSheetProps, FlowStepItem, FlowStepStatus, FlowStepsProps, IconButtonClassOptions, IconButtonProps, IconButtonSize, IconButtonVariant, InboxAction, InboxActionCall, InboxActionResult, InboxItem, InboxLabels, InboxListResponse, InboxProps, InboxSettings, InboxSeverity, InboxView, InputProps, KbdProps, KeyValueItem, KeyValueListProps, LabelProps, LayoutNode, LayoutPresetIconProps, LayoutPresetOption, LayoutPresetPickerProps, LineChartProps, LinePoint, LineSeries, LinkCardAccent, LinkCardProps, LinkClassOptions, ListRowProps, LoadingBarProps, LocaleOptions, MediaChipProps, MediaRowProps, MediaThumbProps, MediaThumbShape, MediaThumbSize, MenuItemClassOptions, MenuItemProps, MenuSubHeaderProps, MeterProps, MeterTone, ModalProps, MoreSheetProps, MountScrollspyOptions, MountThemeToggleOptions, NarrowLayout, NavItem, NavRailProps, NishConfig, NishProviderProps, NishStrings, NumberFieldProps, PageContainerProps, PageHeaderProps, PaginationLinkProps, PaginationProps, PaginationSize, PopoverCloseReason, PopoverProps, PortalProps, Preset, ProgressProps, ProgressTone, RadioGroupProps, RadioOption, RadioProps, RangeBarProps, Rect, RejectedFile, RelativeTimeProps, RenderLink, Resource, ResponsiveTableProps, SaveStatus, ScrollRowProps, SearchInputProps, SectionHeaderProps, SectionNavItem, SectionNavProps, SegmentedOption, SegmentedProps, SegmentedTone, SelectProps, SeparatorProps, ServiceTokenListResponse, ServiceTokenView, ServiceTokensSectionProps, SettingRowProps, SettingsSectionProps, ShowToastOptions, SkeletonCardProps, SkeletonLinesProps, SkeletonProps, SkeletonRowsProps, SliderProps, SliderValue, Sort, SortText, SparklineProps, SparklineTone, SpinnerProps, SplitDividersProps, SplitStageProps, StatGridProps, StatGridSkeletonProps, StatProps, StaticToastTone, StatusDotProps, StatusTone, StepBarProps, StickyActionBarProps, StickyBarProps, SwitchProps, TabItem, TabPanelProps, TableProps, TableWrapProps, TabsBreakpoint, TabsProps, TabsSize, TabsVariant, TagInputProps, TdProps, TextareaProps, ThProps, ThemeChoice, ThemeName, ThemePreset, ThemeState, ThemeToggleLabels, ThemeToggleProps, TickerTextProps, ToastAction, ToastItem, ToastOptions, ToastPromiseMessages, ToastTone, ToasterProps, TooltipProps, TrProps, UrlStateAdapter, UrlStateShape, UseResourceOptions, VisuallyHiddenProps, WorkflowBoardAgent, WorkflowBoardPhase, WorkflowBoardProps };
|