nish-ui 1.8.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +223 -61
- 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 +124 -2
- package/dist/elements-charts.js +131 -1
- package/dist/elements-data.d.ts +166 -2
- package/dist/elements-data.js +46 -1
- 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 +1447 -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 +1689 -667
- package/dist/nish-components.css +4701 -3169
- 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 +246 -4
- package/dist/theme.global.js +357 -90
- package/dist/theme.js +338 -68
- 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';
|
|
@@ -172,6 +423,9 @@ interface MountScrollspyOptions {
|
|
|
172
423
|
/** Pixels from the top of the viewport where a section counts as current. Default: the
|
|
173
424
|
* `--nish-header-h` variable plus the nav's own height plus 8. */
|
|
174
425
|
offset?: number;
|
|
426
|
+
/** Publish the nav's height as `--nish-sticky-extra`. Default true; a non-sticky nav passes
|
|
427
|
+
* false so it does not touch a value another sticky nav publishes. */
|
|
428
|
+
height?: boolean;
|
|
175
429
|
}
|
|
176
430
|
/** Scrollspy for a `.nish-subnav`: each `a[href^="#"]` maps to the element with that id.
|
|
177
431
|
* The link whose section is current gets `aria-current="true"` (the last section whose top
|
|
@@ -190,6 +444,63 @@ declare function mountChecklist(list: HTMLElement): () => void;
|
|
|
190
444
|
/** For pages without a framework: apply now and start syncing. */
|
|
191
445
|
declare function initTheme(): ThemeName;
|
|
192
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
|
+
|
|
193
504
|
type ButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger' | 'soft' | 'subtle' | 'link';
|
|
194
505
|
type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
195
506
|
interface ButtonClassOptions {
|
|
@@ -219,28 +530,6 @@ declare function linkClass({ tone, inline, className }?: LinkClassOptions): stri
|
|
|
219
530
|
/** Classes that hide a row action until its row is hovered or focused, and always show
|
|
220
531
|
* it on touch screens (there is no hover). Put `group` on the row. */
|
|
221
532
|
declare function revealClass(className?: string): string;
|
|
222
|
-
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
223
|
-
/** primary: the one main action in a view. secondary: everything else. ghost:
|
|
224
|
-
* toolbars and quiet actions. danger: destructive actions. soft: an accent action
|
|
225
|
-
* that is not the main one (replaces "accent outline" buttons). subtle: a filled,
|
|
226
|
-
* quiet button for dense toolbars and chips on a surface. link: looks like a text
|
|
227
|
-
* link and sits inline in text (no height or padding; on touch screens an invisible
|
|
228
|
-
* 44px hit area, unless `inline`). */
|
|
229
|
-
variant?: ButtonVariant;
|
|
230
|
-
/** xs for dense tool rows (24px), sm for dense rows and toolbars, lg for a page's
|
|
231
|
-
* main call to action. xs, sm and md grow to 44px on touch screens. */
|
|
232
|
-
size?: ButtonSize;
|
|
233
|
-
/** Link variant only: skip the 44px touch hit area, for a link inside running text. */
|
|
234
|
-
inline?: boolean;
|
|
235
|
-
/** Shows a spinner and disables the button. */
|
|
236
|
-
loading?: boolean;
|
|
237
|
-
/** Icon before the label (16px for md and lg, 12–14px for xs and sm). Replaced by the
|
|
238
|
-
* spinner while loading. */
|
|
239
|
-
icon?: ReactNode;
|
|
240
|
-
}
|
|
241
|
-
/** The standard button. Defaults to type="button", so it never submits a form by
|
|
242
|
-
* accident; pass type="submit" for the one that should. */
|
|
243
|
-
declare const Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
244
533
|
type IconButtonSize = '2xs' | 'xs' | 'sm' | 'md';
|
|
245
534
|
type IconButtonVariant = 'ghost' | 'subtle' | 'soft';
|
|
246
535
|
interface IconButtonClassOptions {
|
|
@@ -258,23 +547,6 @@ interface IconButtonClassOptions {
|
|
|
258
547
|
/** The classes `<IconButton>` renders. Use it on an icon-only `<a>` or router `<Link>`,
|
|
259
548
|
* and give that element an aria-label. */
|
|
260
549
|
declare function iconButtonClass({ size, variant, tone, active, className, }?: IconButtonClassOptions): string;
|
|
261
|
-
interface IconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
262
|
-
/** Required: an icon-only button needs a name for screen readers and tooltips. It is
|
|
263
|
-
* also the title, so tests that query by title keep working. */
|
|
264
|
-
label: string;
|
|
265
|
-
/** 2xs: 20px (row-level reveal actions, 22px widget title bars), xs: 24px (dense
|
|
266
|
-
* headers), sm: 28px, md: 36px. All grow to 44px on touch screens. */
|
|
267
|
-
size?: IconButtonSize;
|
|
268
|
-
/** Pressed state for toggles (sets aria-pressed). */
|
|
269
|
-
active?: boolean;
|
|
270
|
-
/** ghost: no fill until hover (default). subtle: a quiet filled square for toolbars on
|
|
271
|
-
* a surface. soft: an accent tint for the highlighted action. */
|
|
272
|
-
variant?: IconButtonVariant;
|
|
273
|
-
/** danger: hover and pressed turn loss-red, for delete and remove actions. */
|
|
274
|
-
tone?: 'neutral' | 'danger';
|
|
275
|
-
}
|
|
276
|
-
/** A square button holding only an icon, with its label as aria-label and title. */
|
|
277
|
-
declare const IconButton: react.ForwardRefExoticComponent<IconButtonProps & react.RefAttributes<HTMLButtonElement>>;
|
|
278
550
|
type CardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
279
551
|
type CardElement = 'div' | 'section' | 'article' | 'aside' | 'li';
|
|
280
552
|
interface CardClassOptions {
|
|
@@ -293,13 +565,90 @@ interface CardClassOptions {
|
|
|
293
565
|
/** The classes `<Card>` renders. Use it on a router `<Link>` or `<a>` that is a whole
|
|
294
566
|
* card: `<Link className={cardClass({ interactive: true })}>`. */
|
|
295
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;
|
|
296
643
|
interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
644
|
+
/** The header row element. */
|
|
645
|
+
ref?: Ref<HTMLDivElement>;
|
|
297
646
|
/** The card's heading. */
|
|
298
647
|
title: ReactNode;
|
|
299
648
|
/** A quieter line under the title. */
|
|
300
649
|
description?: ReactNode;
|
|
301
|
-
/**
|
|
302
|
-
* 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. */
|
|
303
652
|
action?: ReactNode;
|
|
304
653
|
/** A small icon before the title (16px). */
|
|
305
654
|
icon?: ReactNode;
|
|
@@ -312,8 +661,10 @@ interface CardHeaderProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>
|
|
|
312
661
|
titleId?: string;
|
|
313
662
|
}
|
|
314
663
|
/** The header row of a card: title, optional description and icon, and an action slot. */
|
|
315
|
-
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;
|
|
316
665
|
interface CardProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
666
|
+
/** The card element (whatever `as` renders). */
|
|
667
|
+
ref?: Ref<HTMLElement>;
|
|
317
668
|
/** The element to render. Use section or article for a titled region, li inside a list. */
|
|
318
669
|
as?: CardElement;
|
|
319
670
|
/** Inner padding: sm p-3, md p-4 (p-5 from 640px; the default), lg p-6, none for
|
|
@@ -332,35 +683,19 @@ interface CardProps extends Omit<HTMLAttributes<HTMLElement>, 'title'> {
|
|
|
332
683
|
title?: ReactNode;
|
|
333
684
|
/** The header's description; only with title. */
|
|
334
685
|
description?: ReactNode;
|
|
335
|
-
/** The header's
|
|
686
|
+
/** The header's end-aligned action slot; only with title. */
|
|
336
687
|
action?: ReactNode;
|
|
337
688
|
}
|
|
338
689
|
/** The surface panel every widget, table and form sits in. */
|
|
339
|
-
declare
|
|
340
|
-
type BadgeTone = 'neutral' | 'accent' | 'ok' | 'loss' | 'warn' | 'info' | 'on-accent';
|
|
341
|
-
type Tone = BadgeTone;
|
|
342
|
-
type BadgeHue = 'emerald' | 'indigo' | 'amber' | 'lime' | 'rose' | 'sky' | 'violet' | 'teal';
|
|
343
|
-
interface BadgeClassOptions {
|
|
344
|
-
/** Same tones as Badge. Default "neutral". */
|
|
345
|
-
tone?: Tone;
|
|
346
|
-
/** Same hues as Badge; overrides tone. */
|
|
347
|
-
hue?: BadgeHue;
|
|
348
|
-
/** Same sizes as Badge. Default "sm". */
|
|
349
|
-
size?: 'xs' | 'sm';
|
|
350
|
-
/** Same variants as Badge. Default "pill". */
|
|
351
|
-
variant?: 'pill' | 'tag';
|
|
352
|
-
/** Extra classes, merged last. */
|
|
353
|
-
className?: string;
|
|
354
|
-
}
|
|
355
|
-
/** The classes `<Badge>` renders (without the dot), for a badge-shaped link or a
|
|
356
|
-
* label inside a third-party renderer. */
|
|
357
|
-
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;
|
|
358
691
|
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
692
|
+
/** The badge element. */
|
|
693
|
+
ref?: Ref<HTMLSpanElement>;
|
|
359
694
|
/** Text on its own soft tint; every tone clears 4.5:1 in every theme. on-accent: a
|
|
360
695
|
* small label inside a solid accent fill (a primary Button, an accent link), in the
|
|
361
696
|
* on-accent color over a 20% on-accent tint. It has no hover state; pair a short
|
|
362
697
|
* label with sr-only text that says what it means. */
|
|
363
|
-
tone?:
|
|
698
|
+
tone?: BadgeTone;
|
|
364
699
|
/** A color with no meaning (stores, categories, tags): the hue's soft tint with hi
|
|
365
700
|
* text, so it reads in every theme. Overrides tone. */
|
|
366
701
|
hue?: BadgeHue;
|
|
@@ -374,39 +709,32 @@ interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
374
709
|
dot?: boolean;
|
|
375
710
|
}
|
|
376
711
|
/** A small status pill: counts, states, tags. */
|
|
377
|
-
declare function Badge({ tone, hue, size, variant, dot, className, children, ...rest }: BadgeProps): react.JSX.Element;
|
|
378
|
-
type FieldSize = 'xs' | 'sm' | 'md';
|
|
379
|
-
interface FieldClassOptions {
|
|
380
|
-
/** md h-9 (default), sm h-8, xs h-7. All grow to 44px on touch screens. */
|
|
381
|
-
size?: FieldSize;
|
|
382
|
-
/** The red invalid border, for elements that do not set aria-invalid themselves. */
|
|
383
|
-
invalid?: boolean;
|
|
384
|
-
/** Extra classes, merged last. */
|
|
385
|
-
className?: string;
|
|
386
|
-
}
|
|
387
|
-
/** The classes `<Input>` renders: the shared field look at a size. Use it for a one-off
|
|
388
|
-
* control (a date input, a contenteditable) instead of copying a class string. */
|
|
389
|
-
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;
|
|
390
713
|
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
714
|
+
/** The input element (not the wrapper, when there are slots). */
|
|
715
|
+
ref?: Ref<HTMLInputElement>;
|
|
391
716
|
/** Red border and aria-invalid. Pair it with an error message tied by aria-describedby. */
|
|
392
717
|
invalid?: boolean;
|
|
393
718
|
/** md h-9 (default), sm h-8 with 12px text, xs h-7 with 11px text. Touch screens
|
|
394
719
|
* always get 16px text and a 44px height. (Replaces the native size attribute; set a width with
|
|
395
720
|
* className instead.) */
|
|
396
721
|
size?: FieldSize;
|
|
397
|
-
/** A decorative slot inside the
|
|
398
|
-
* 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. */
|
|
399
724
|
leading?: ReactNode;
|
|
400
|
-
/** A slot inside the
|
|
725
|
+
/** A slot inside the end edge that may be interactive: a clear IconButton, a unit
|
|
401
726
|
* suffix. */
|
|
402
727
|
trailing?: ReactNode;
|
|
403
728
|
/** Classes for the wrapper span that holds the slots (only rendered with leading or
|
|
404
729
|
* trailing). className stays on the input. */
|
|
405
730
|
wrapperClassName?: string;
|
|
406
731
|
}
|
|
407
|
-
/** Text input. 16px text on touch screens so iOS does not zoom the page on focus.
|
|
408
|
-
|
|
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;
|
|
409
735
|
interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
736
|
+
/** The select element (not the wrapper). */
|
|
737
|
+
ref?: Ref<HTMLSelectElement>;
|
|
410
738
|
/** Red border and aria-invalid. */
|
|
411
739
|
invalid?: boolean;
|
|
412
740
|
/** md h-9 (default), sm h-8, xs h-7, the same as Input. Touch screens get 16px text
|
|
@@ -416,12 +744,38 @@ interface SelectProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'siz
|
|
|
416
744
|
* use this instead of reaching in with [&>select]:… */
|
|
417
745
|
selectClassName?: string;
|
|
418
746
|
}
|
|
419
|
-
/** Native select (keeps the platform picker on phones) with the shared field look.
|
|
420
|
-
|
|
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
|
+
}
|
|
421
755
|
/** Small uppercase label for form fields and section headings. */
|
|
422
|
-
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';
|
|
423
775
|
|
|
424
776
|
interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
777
|
+
/** The textarea element. */
|
|
778
|
+
ref?: Ref<HTMLTextAreaElement>;
|
|
425
779
|
/** Red border and aria-invalid. Pair it with an error message tied by aria-describedby
|
|
426
780
|
* (Field does both for you). */
|
|
427
781
|
invalid?: boolean;
|
|
@@ -437,31 +791,55 @@ interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
|
437
791
|
}
|
|
438
792
|
/** Multi-line text with the shared field look. 16px text on touch screens (no iOS zoom); the
|
|
439
793
|
* reader can resize it vertically, or it grows with its content when autoGrow is set. */
|
|
440
|
-
declare
|
|
794
|
+
declare function Textarea({ ref, invalid, size, autoGrow, className, rows, value, onInput, ...rest }: TextareaProps): react.JSX.Element;
|
|
441
795
|
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'> {
|
|
796
|
+
/** The checkbox input. */
|
|
797
|
+
ref?: Ref<HTMLInputElement>;
|
|
442
798
|
/** Text beside the box; clicking it toggles the box. Optional when the box has an
|
|
443
799
|
* aria-label instead (a table row's select box). */
|
|
444
800
|
label?: ReactNode;
|
|
445
|
-
/** 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. */
|
|
446
803
|
hint?: ReactNode;
|
|
447
804
|
/** The "some but not all" state of a select-all box. Set through the DOM property, so
|
|
448
805
|
* screen readers announce it as mixed. Clicking still toggles `checked`. */
|
|
449
806
|
indeterminate?: boolean;
|
|
450
807
|
/** A right-aligned slot on the same row (a price, a count). The row then fills its
|
|
451
|
-
* container's width. */
|
|
808
|
+
* container's width. Described by, not part of, the box's name. */
|
|
452
809
|
trailing?: ReactNode;
|
|
453
810
|
/** md: 16px box, 14px text. sm: 14px box, 12px text for dense lists. The row is the
|
|
454
811
|
* 44px tap target on touch screens either way. */
|
|
455
812
|
size?: 'sm' | 'md';
|
|
813
|
+
/** Red border and aria-invalid. Field sets it for you. */
|
|
814
|
+
invalid?: boolean;
|
|
456
815
|
}
|
|
457
816
|
/** A checkbox with its label. The box is drawn from theme roles (its unchecked border
|
|
458
|
-
* reads in light themes too), and the whole row is the 44px tap target on touch.
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
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;
|
|
465
843
|
/** Visible label, linked to the switch by aria-labelledby. Clicking it toggles too.
|
|
466
844
|
* Without one, pass aria-label or aria-labelledby. */
|
|
467
845
|
label?: ReactNode;
|
|
@@ -475,19 +853,26 @@ interface SwitchProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onC
|
|
|
475
853
|
labelSide?: 'start' | 'end';
|
|
476
854
|
}
|
|
477
855
|
/** An on/off switch that takes effect immediately (a setting, not a form choice that
|
|
478
|
-
* waits for Save; use Checkbox for that). A `<button role="switch" aria-checked
|
|
479
|
-
|
|
480
|
-
|
|
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>;
|
|
481
863
|
/** The visible label, in sentence case ("Email address"). Rendered as a real <label>
|
|
482
864
|
* tied to the control. */
|
|
483
865
|
label: ReactNode;
|
|
484
866
|
/** Help text under the control, tied by aria-describedby. Hidden while an error shows. */
|
|
485
867
|
hint?: ReactNode;
|
|
486
868
|
/** Error message under the control, announced (role="alert") and tied by
|
|
487
|
-
* aria-describedby. Also sets
|
|
869
|
+
* aria-describedby. Also sets aria-invalid on the control. */
|
|
488
870
|
error?: ReactNode;
|
|
489
871
|
/** Shows a quiet "Optional" tag after the label. */
|
|
490
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;
|
|
491
876
|
/** The control's id. Leave it out and Field gives the control one (or uses the id the
|
|
492
877
|
* control already has). */
|
|
493
878
|
htmlFor?: string;
|
|
@@ -496,14 +881,16 @@ interface FieldProps {
|
|
|
496
881
|
layout?: 'stack' | 'inline';
|
|
497
882
|
/** Width of the label column in the inline layout. Any CSS length; default 7rem. */
|
|
498
883
|
labelWidth?: string;
|
|
499
|
-
/** One control: Input, Select, Textarea, SearchInput
|
|
884
|
+
/** One control: Input, Select, Textarea, SearchInput, Checkbox, Switch, Combobox,
|
|
885
|
+
* Segmented or a native element. */
|
|
500
886
|
children: ReactNode;
|
|
501
|
-
className?: string;
|
|
502
887
|
}
|
|
503
888
|
/** A labelled form row: label, one control, and its hint or error, all wired up for
|
|
504
|
-
* screen readers (id, aria-describedby, aria-invalid). */
|
|
505
|
-
declare function Field({ label, hint, error, optional, htmlFor, layout, labelWidth, children, className }: FieldProps): react.JSX.Element;
|
|
506
|
-
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>;
|
|
507
894
|
/** The group's visible name, in sentence case ("Work mode"). Rendered as the
|
|
508
895
|
* fieldset's <legend>, styled like Field's stack label. */
|
|
509
896
|
label: ReactNode;
|
|
@@ -521,12 +908,16 @@ interface FieldGroupProps extends Omit<HTMLAttributes<HTMLFieldSetElement>, 'chi
|
|
|
521
908
|
/** Field for a group of controls: a <fieldset> whose <legend> looks like Field's label,
|
|
522
909
|
* with the hint or error tied to the whole group. Use Field when there is exactly one
|
|
523
910
|
* control to label. */
|
|
524
|
-
declare function FieldGroup({ label, hint, error, optional, className, children, ...rest }: FieldGroupProps): react.JSX.Element;
|
|
525
|
-
interface SearchInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'size' | 'type'> {
|
|
526
|
-
/** The
|
|
527
|
-
|
|
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;
|
|
528
919
|
/** Called with the new query on typing, on Clear and on Escape. */
|
|
529
|
-
onChange
|
|
920
|
+
onChange?: (value: string, event?: ChangeEvent<HTMLInputElement>) => void;
|
|
530
921
|
/** Also called after Clear or Escape empties the field (e.g. to reset results). */
|
|
531
922
|
onClear?: () => void;
|
|
532
923
|
/** md: 36px, sm: 32px, xs: 28px (dense toolbars). All 44px with 16px text on touch screens. */
|
|
@@ -540,27 +931,17 @@ interface SearchInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, '
|
|
|
540
931
|
className?: string;
|
|
541
932
|
/** Class for the <input> itself. */
|
|
542
933
|
inputClassName?: string;
|
|
934
|
+
/** Accessible name of the Clear button. Default from NishProvider strings ("Clear search"). */
|
|
935
|
+
clearLabel?: string;
|
|
543
936
|
}
|
|
544
937
|
/** A search field: leading search icon, a Clear button while it has a value, and
|
|
545
|
-
* Escape to clear. type="search" with the Search key on phone keyboards.
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
interface ChipClassOptions {
|
|
549
|
-
/** The pressed (on) look of a toggle chip: the accent tint. On a link, set
|
|
550
|
-
* aria-current="page" for the active one (links take aria-current, not aria-pressed). */
|
|
551
|
-
pressed?: boolean;
|
|
552
|
-
/** Same variants as Chip. Default "toggle". */
|
|
553
|
-
variant?: ChipVariant;
|
|
554
|
-
/** md: 32px (default), sm: 28px. Both reach 44px on touch screens. */
|
|
555
|
-
size?: 'sm' | 'md';
|
|
556
|
-
/** Extra classes, merged last. */
|
|
557
|
-
className?: string;
|
|
558
|
-
}
|
|
559
|
-
/** The classes `<Chip>` renders, for router links and anchors that look like chips:
|
|
560
|
-
* `<Link className={chipClass({ pressed: active })} aria-current={active ? 'page' : undefined}>`.
|
|
561
|
-
* Mirrors .nish-chip in nish-components.css. */
|
|
562
|
-
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;
|
|
563
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>;
|
|
564
945
|
/** toggle: an on/off filter (`aria-pressed`). suggestion: a dashed "+ add this" chip.
|
|
565
946
|
* tag: a static label (a <span>) with an optional remove button. */
|
|
566
947
|
variant?: ChipVariant;
|
|
@@ -569,7 +950,7 @@ interface ChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
569
950
|
/** Tag chips only: shows a remove button that calls this. */
|
|
570
951
|
onRemove?: () => void;
|
|
571
952
|
/** Accessible name of the remove button. Default "Remove <children>" when the chip's
|
|
572
|
-
* text is a plain string, else "Remove". */
|
|
953
|
+
* text is a plain string, else "Remove" (from NishProvider strings). */
|
|
573
954
|
removeLabel?: string;
|
|
574
955
|
/** Leading icon (14px for sm, 16px for md). Suggestion chips show "+" when unset. */
|
|
575
956
|
icon?: ReactNode;
|
|
@@ -580,21 +961,22 @@ interface ChipProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
|
580
961
|
}
|
|
581
962
|
/** A compact pill for multi-select filters (toggle), quick suggestions and removable
|
|
582
963
|
* tags. For one choice among several, use Segmented instead. */
|
|
583
|
-
declare
|
|
964
|
+
declare function Chip({ ref, variant, pressed, onRemove, removeLabel, icon, trailing, size, className, children, type, ...rest }: ChipProps): react.JSX.Element;
|
|
584
965
|
interface ChipGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
966
|
+
/** The wrapper element. */
|
|
967
|
+
ref?: Ref<HTMLDivElement>;
|
|
585
968
|
/** Names the group for screen readers: "Filter by status". */
|
|
586
969
|
label: string;
|
|
587
970
|
/** On phones, one row that scrolls sideways instead of wrapping. */
|
|
588
971
|
scroll?: boolean;
|
|
589
972
|
children: ReactNode;
|
|
590
973
|
}
|
|
591
|
-
/** A labelled row of Chips (role="group"). Wraps by default.
|
|
592
|
-
|
|
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;
|
|
593
977
|
|
|
594
978
|
type TabsVariant = 'underline' | 'pill';
|
|
595
979
|
type TabsSize = 'xs' | 'sm' | 'md';
|
|
596
|
-
/** The breakpoint from which responsive tabs show every panel at once. */
|
|
597
|
-
type TabsBreakpoint = 'md' | 'lg';
|
|
598
980
|
/** The look of one tab, for router links that act as tabs:
|
|
599
981
|
* `<NavLink className={({ isActive }) => tabClass({ active: isActive })}>`. Router links
|
|
600
982
|
* are navigation, not ARIA tabs: they take aria-current="page", not role="tab". */
|
|
@@ -610,6 +992,9 @@ declare function tabClass(o: {
|
|
|
610
992
|
/** Extra classes, merged last. */
|
|
611
993
|
className?: string;
|
|
612
994
|
}): string;
|
|
995
|
+
|
|
996
|
+
/** The breakpoint from which responsive tabs show every panel at once. */
|
|
997
|
+
type TabsBreakpoint = 'md' | 'lg';
|
|
613
998
|
interface TabItem {
|
|
614
999
|
value: string;
|
|
615
1000
|
label: ReactNode;
|
|
@@ -620,11 +1005,15 @@ interface TabItem {
|
|
|
620
1005
|
/** Shown but not selectable; the arrow keys skip it. */
|
|
621
1006
|
disabled?: boolean;
|
|
622
1007
|
}
|
|
623
|
-
interface TabsProps {
|
|
624
|
-
/** The selected tab's value.
|
|
625
|
-
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;
|
|
626
1013
|
/** Called with the new value on click and on arrow keys (selection follows focus). */
|
|
627
|
-
|
|
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;
|
|
628
1017
|
items: TabItem[];
|
|
629
1018
|
/** Names the tab list for screen readers: "Job sections". */
|
|
630
1019
|
label: string;
|
|
@@ -650,11 +1039,14 @@ interface TabsProps {
|
|
|
650
1039
|
children?: ReactNode;
|
|
651
1040
|
/** Class for the tab list. */
|
|
652
1041
|
className?: string;
|
|
1042
|
+
/** The tab list element. */
|
|
1043
|
+
ref?: Ref<HTMLDivElement>;
|
|
653
1044
|
}
|
|
654
1045
|
/** Tabs that switch between panels in place: the full ARIA tabs pattern (tablist, tab
|
|
655
|
-
* with aria-selected and aria-controls, arrow keys
|
|
656
|
-
*
|
|
657
|
-
|
|
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;
|
|
658
1050
|
interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
659
1051
|
/** The tab value this panel belongs to. */
|
|
660
1052
|
value: string;
|
|
@@ -670,87 +1062,104 @@ interface TabPanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
670
1062
|
* a scroll position or a draft survives switching tabs. */
|
|
671
1063
|
keepMounted?: boolean;
|
|
672
1064
|
children?: ReactNode;
|
|
1065
|
+
ref?: Ref<HTMLDivElement>;
|
|
673
1066
|
}
|
|
674
1067
|
/** The content for one tab: role="tabpanel", labelled by its tab, hidden unless its tab
|
|
675
1068
|
* is selected. Render it as a child of Tabs, or pass idBase and active. */
|
|
676
|
-
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;
|
|
677
1070
|
|
|
678
|
-
|
|
679
|
-
declare function Skeleton({ className, style, }: {
|
|
1071
|
+
interface SkeletonProps extends ComponentPropsWithoutRef<'div'> {
|
|
680
1072
|
/** Size and shape: h-4 w-2/5, size-9 rounded-full, … */
|
|
681
1073
|
className?: string;
|
|
682
1074
|
/** For sizes known only at runtime, e.g. { height: chartHeight }. */
|
|
683
|
-
style?:
|
|
684
|
-
|
|
685
|
-
|
|
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'> {
|
|
686
1081
|
/** How many rows. Default 5. */
|
|
687
1082
|
rows?: number;
|
|
688
1083
|
/** Height of each row: pixels or any CSS length. Default 56. */
|
|
689
1084
|
height?: number | string;
|
|
690
1085
|
/** Space between rows: sm 6px, md 10px (default). */
|
|
691
1086
|
gap?: 'sm' | 'md';
|
|
692
|
-
/** Accessible name of the loading region. Default "Loading". */
|
|
1087
|
+
/** Accessible name of the loading region, read out as hidden text. Default "Loading". */
|
|
693
1088
|
label?: string;
|
|
694
1089
|
/** Classes for the column (padding, margins). */
|
|
695
1090
|
className?: string;
|
|
696
1091
|
/** Classes for every row, e.g. "h-16" instead of height, or "rounded-lg". */
|
|
697
1092
|
rowClassName?: string;
|
|
1093
|
+
ref?: Ref<HTMLDivElement>;
|
|
698
1094
|
}
|
|
699
1095
|
/** A column of full-width, card-shaped shimmer rows (rounded-xl) while a list or table
|
|
700
|
-
* loads, announced once (role="status"
|
|
701
|
-
* card body's text lines, use SkeletonLines. */
|
|
702
|
-
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;
|
|
703
1099
|
declare const SPINNER_SIZE: {
|
|
704
1100
|
readonly xs: 12;
|
|
705
1101
|
readonly sm: 14;
|
|
706
1102
|
readonly md: 16;
|
|
707
1103
|
readonly lg: 24;
|
|
708
1104
|
};
|
|
709
|
-
interface SpinnerProps {
|
|
1105
|
+
interface SpinnerProps extends Omit<ComponentPropsWithoutRef<'span'>, 'children'> {
|
|
710
1106
|
/** xs 12px, sm 14px, md 16px (default), lg 24px. */
|
|
711
1107
|
size?: keyof typeof SPINNER_SIZE;
|
|
712
1108
|
/** Announces the spinner (role="status") with this accessible name, e.g.
|
|
713
|
-
* "Loading jobs". Without it the spinner is decorative
|
|
714
|
-
* 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. */
|
|
715
1111
|
label?: string;
|
|
716
1112
|
/** Color and spacing. The spinner draws in currentColor. */
|
|
717
1113
|
className?: string;
|
|
1114
|
+
ref?: Ref<HTMLSpanElement>;
|
|
718
1115
|
}
|
|
719
1116
|
/** A spinning loader in the current text color: the one spinner every app uses,
|
|
720
1117
|
* instead of hand-rolled border spinners. */
|
|
721
|
-
declare function Spinner({ size, label, className }: SpinnerProps): react.JSX.Element;
|
|
722
|
-
|
|
723
|
-
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'> {
|
|
724
1120
|
/** Body lines under the heading bar. */
|
|
725
1121
|
lines?: number;
|
|
726
1122
|
className?: string;
|
|
727
|
-
|
|
728
|
-
|
|
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'> {
|
|
729
1131
|
/** Text lines under the title bar. Default 3. */
|
|
730
1132
|
lines?: number;
|
|
731
1133
|
/** A media block above the text: square (96px), wide (16:9) or none (default). */
|
|
732
1134
|
media?: 'square' | 'wide' | 'none';
|
|
733
1135
|
className?: string;
|
|
1136
|
+
ref?: Ref<HTMLDivElement>;
|
|
734
1137
|
}
|
|
735
1138
|
/** A card-shaped shimmer for one loading card: optional media, a title bar and text lines. */
|
|
736
|
-
declare function SkeletonCard({ lines, media, className }: SkeletonCardProps): react.JSX.Element;
|
|
737
|
-
interface StatGridSkeletonProps {
|
|
1139
|
+
declare function SkeletonCard({ lines, media, className, ref, ...rest }: SkeletonCardProps): react.JSX.Element;
|
|
1140
|
+
interface StatGridSkeletonProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
738
1141
|
/** How many tiles. Default 4. */
|
|
739
1142
|
count?: number;
|
|
740
1143
|
className?: string;
|
|
1144
|
+
/** Accessible name of the loading region. Default "Loading". */
|
|
1145
|
+
label?: string;
|
|
1146
|
+
ref?: Ref<HTMLDivElement>;
|
|
741
1147
|
}
|
|
742
1148
|
/** Shimmer tiles that match a StatGrid (2 columns, 4 from md) while its numbers load. */
|
|
743
|
-
declare function StatGridSkeleton({ count, className }: StatGridSkeletonProps): react.JSX.Element;
|
|
744
|
-
interface CardListSkeletonProps {
|
|
1149
|
+
declare function StatGridSkeleton({ count, className, label, ref, ...rest }: StatGridSkeletonProps): react.JSX.Element;
|
|
1150
|
+
interface CardListSkeletonProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
745
1151
|
/** How many cards. Default 3. */
|
|
746
1152
|
count?: number;
|
|
747
1153
|
/** Text lines in each card. Default 2. */
|
|
748
1154
|
lines?: number;
|
|
749
1155
|
className?: string;
|
|
1156
|
+
/** Accessible name of the loading region. Default "Loading". */
|
|
1157
|
+
label?: string;
|
|
1158
|
+
ref?: Ref<HTMLDivElement>;
|
|
750
1159
|
}
|
|
751
1160
|
/** A stack of shimmer cards while a card list loads, announced once (role="status"). */
|
|
752
|
-
declare function CardListSkeleton({ count, lines, className }: CardListSkeletonProps): react.JSX.Element;
|
|
753
|
-
interface EmptyStateProps {
|
|
1161
|
+
declare function CardListSkeleton({ count, lines, className, label, ref, ...rest }: CardListSkeletonProps): react.JSX.Element;
|
|
1162
|
+
interface EmptyStateProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title'> {
|
|
754
1163
|
/** A 28px line icon, shown in the ghost color. */
|
|
755
1164
|
icon?: ReactNode;
|
|
756
1165
|
/** What is empty, in a few words: "No price drops yet". */
|
|
@@ -762,22 +1171,26 @@ interface EmptyStateProps {
|
|
|
762
1171
|
/** compact: no border, fills a widget body. Default: dashed box on a page. */
|
|
763
1172
|
compact?: boolean;
|
|
764
1173
|
className?: string;
|
|
1174
|
+
ref?: Ref<HTMLDivElement>;
|
|
765
1175
|
}
|
|
766
1176
|
/** What a list, table or widget shows when there is nothing in it yet. */
|
|
767
|
-
declare function EmptyState({ icon, title, detail, action, compact, className }: EmptyStateProps): react.JSX.Element;
|
|
768
|
-
interface ErrorStateProps {
|
|
769
|
-
/** 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". */
|
|
770
1180
|
message?: ReactNode;
|
|
771
1181
|
/** Shows a Retry button when given. */
|
|
772
1182
|
onRetry?: () => void;
|
|
1183
|
+
/** Text of the Retry button. Default "Retry". */
|
|
1184
|
+
retryLabel?: string;
|
|
773
1185
|
/** Spinner on the Retry button while the retry runs. */
|
|
774
1186
|
retrying?: boolean;
|
|
775
1187
|
/** No box: fills a widget body. Default: a tinted box on a page. */
|
|
776
1188
|
compact?: boolean;
|
|
777
1189
|
className?: string;
|
|
1190
|
+
ref?: Ref<HTMLDivElement>;
|
|
778
1191
|
}
|
|
779
1192
|
/** A failed load, announced to screen readers (role="alert"), with an optional Retry. */
|
|
780
|
-
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;
|
|
781
1194
|
|
|
782
1195
|
type ToastTone = 'success' | 'error' | 'warn' | 'info';
|
|
783
1196
|
/** A button inside a toast, such as Undo. */
|
|
@@ -794,7 +1207,8 @@ interface ToastOptions {
|
|
|
794
1207
|
* onClick and then dismisses the toast. */
|
|
795
1208
|
action?: ToastAction;
|
|
796
1209
|
/** Milliseconds before it dismisses itself, or 'sticky' to stay until dismissed.
|
|
797
|
-
* 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
|
|
798
1212
|
* hovered or holds focus. */
|
|
799
1213
|
duration?: number | 'sticky';
|
|
800
1214
|
/** A slot name. A new toast with the same id replaces the old one instead of
|
|
@@ -818,18 +1232,29 @@ interface ToastItem {
|
|
|
818
1232
|
/** Remove a toast now, by the id toast() returned. */
|
|
819
1233
|
declare function dismissToast(id: number): void;
|
|
820
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
|
+
}
|
|
821
1242
|
type ToastFn = ToastCall & {
|
|
822
1243
|
success: ToastCall;
|
|
823
1244
|
error: ToastCall;
|
|
824
1245
|
warn: ToastCall;
|
|
825
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>;
|
|
826
1250
|
};
|
|
827
1251
|
/** toast('Saved'), toast.error('Could not save', detail), or
|
|
828
|
-
* 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(). */
|
|
829
1254
|
declare const toast: ToastFn;
|
|
830
1255
|
/** Same API as a hook, for code that prefers one. */
|
|
831
1256
|
declare function useToast(): ToastFn;
|
|
832
|
-
interface ToasterProps {
|
|
1257
|
+
interface ToasterProps extends Omit<ComponentPropsWithoutRef<'div'>, 'className' | 'children'> {
|
|
833
1258
|
/** Extra classes for the stack, e.g. to lift it above a bottom nav: sm:bottom-20. */
|
|
834
1259
|
className?: string;
|
|
835
1260
|
/** Distance from the bottom of the screen on phones (under 640px, or up to
|
|
@@ -842,18 +1267,44 @@ interface ToasterProps {
|
|
|
842
1267
|
* the bar. From sm the stack still moves to the bottom right; between sm and this
|
|
843
1268
|
* breakpoint it keeps the offset. */
|
|
844
1269
|
offsetUntil?: 'sm' | 'md' | 'lg';
|
|
1270
|
+
/** The stack's root element. */
|
|
1271
|
+
ref?: Ref<HTMLDivElement>;
|
|
845
1272
|
}
|
|
846
1273
|
/** The toast stack: bottom-center full width on phones, bottom-right on wider screens.
|
|
847
1274
|
* It sits above any bottom bar through --nish-bottom-inset, and moves to the top of
|
|
848
1275
|
* the screen on phones while a sheet or dialog is open (html[data-nish-layer-open]). */
|
|
849
|
-
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;
|
|
850
1293
|
|
|
851
|
-
interface ModalProps {
|
|
1294
|
+
interface ModalProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title' | 'children' | 'className'> {
|
|
852
1295
|
/** Heading of the dialog; also its accessible name. Optional only when `header`
|
|
853
1296
|
* replaces the title row (then pass `aria-label`). */
|
|
854
1297
|
title?: ReactNode;
|
|
855
|
-
/** Called on Escape, a backdrop click and the close button. Unmount the modal here
|
|
856
|
-
|
|
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;
|
|
857
1308
|
/** The body. It scrolls when taller than the screen. */
|
|
858
1309
|
children: ReactNode;
|
|
859
1310
|
/** md: compact dialogs (default). lg / xl: wide content like guides and editors.
|
|
@@ -887,19 +1338,30 @@ interface ModalProps {
|
|
|
887
1338
|
* dialog open with no exit animation, e.g. while a form holds invalid input; show
|
|
888
1339
|
* the reason yourself. */
|
|
889
1340
|
canClose?: () => boolean;
|
|
1341
|
+
/** Classes for the dialog panel. */
|
|
890
1342
|
className?: string;
|
|
1343
|
+
/** The dialog panel (role="dialog"). */
|
|
1344
|
+
ref?: Ref<HTMLDivElement>;
|
|
891
1345
|
}
|
|
892
1346
|
/** Dialog: centered panel on wide screens, bottom sheet under 640px. Closes on
|
|
893
1347
|
* Escape and backdrop click, traps Tab inside, returns focus to the opener, and
|
|
894
|
-
* locks page scroll (on both <html> and <body>) while open.
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
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;
|
|
899
1355
|
/** A line under the title (counts, status, timestamps). */
|
|
900
1356
|
subtitle?: ReactNode;
|
|
901
|
-
/** Called on Escape, a scrim click and the close button. Unmount the drawer here
|
|
902
|
-
|
|
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;
|
|
903
1365
|
/** right (default) and left: a full-height panel from that edge. bottom: a sheet
|
|
904
1366
|
* from the bottom edge at every width. */
|
|
905
1367
|
side?: 'right' | 'left' | 'bottom';
|
|
@@ -929,19 +1391,22 @@ interface DrawerProps {
|
|
|
929
1391
|
children: ReactNode;
|
|
930
1392
|
/** Classes for the panel. */
|
|
931
1393
|
className?: string;
|
|
1394
|
+
/** The drawer panel (role="dialog"). */
|
|
1395
|
+
ref?: Ref<HTMLDivElement>;
|
|
932
1396
|
}
|
|
933
1397
|
/** A panel that slides in from an edge: notifications, an assistant, filters, a phone
|
|
934
1398
|
* "More" sheet. It is a modal dialog: it traps Tab, closes on Escape and a scrim
|
|
935
|
-
* click, returns focus to the opener and locks page scroll.
|
|
936
|
-
|
|
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;
|
|
937
1402
|
interface ConfirmDialogProps {
|
|
938
1403
|
/** The question, e.g. "Delete this tracker?". Also the dialog's name. */
|
|
939
1404
|
title: ReactNode;
|
|
940
|
-
/** 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. */
|
|
941
1406
|
body?: ReactNode;
|
|
942
1407
|
/** The confirm button's label: a verb that names the action ("Delete", "Archive"). */
|
|
943
1408
|
confirmLabel: string;
|
|
944
|
-
/** The cancel button's label. Default "Cancel". */
|
|
1409
|
+
/** The cancel button's label. Default "Cancel" (or the provider's `cancel` string). */
|
|
945
1410
|
cancelLabel?: string;
|
|
946
1411
|
/** danger (default): a red confirm button, and focus starts on Cancel. primary: an
|
|
947
1412
|
* accent confirm button that takes the first focus. */
|
|
@@ -951,17 +1416,24 @@ interface ConfirmDialogProps {
|
|
|
951
1416
|
pending?: boolean;
|
|
952
1417
|
/** Runs the action. Close the dialog (unmount it) when it is done. */
|
|
953
1418
|
onConfirm: () => void;
|
|
954
|
-
/** Called on Cancel, Escape and a backdrop click. Unmount the dialog here
|
|
955
|
-
|
|
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;
|
|
956
1427
|
}
|
|
957
1428
|
/** A yes-or-no question before an action, in place of `window.confirm`: a small
|
|
958
|
-
* Modal with Cancel and a confirm button. */
|
|
959
|
-
declare function ConfirmDialog({ title, body, confirmLabel, cancelLabel, tone, pending, onConfirm, onCancel, }: ConfirmDialogProps): react.JSX.Element;
|
|
960
|
-
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'> {
|
|
961
1432
|
/** What the tooltip says. Keep it to a sentence or two. */
|
|
962
1433
|
tip: ReactNode;
|
|
963
|
-
/** The trigger.
|
|
964
|
-
*
|
|
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. */
|
|
965
1437
|
children: ReactNode;
|
|
966
1438
|
className?: string;
|
|
967
1439
|
/** Preferred side; flips to the opposite one when there is no room. `right` suits
|
|
@@ -970,20 +1442,25 @@ interface TooltipProps {
|
|
|
970
1442
|
/** Element used for the trigger. Pass `tr` inside tables, where a span would be
|
|
971
1443
|
* invalid markup and get hoisted out of the table by the parser. */
|
|
972
1444
|
as?: 'span' | 'tr';
|
|
973
|
-
/** 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
|
|
974
1447
|
* as 60 chart bars, and make the value reachable another way. */
|
|
975
1448
|
focusable?: boolean;
|
|
976
1449
|
/** default: the trigger keeps its own look. hint: a dotted underline and a help
|
|
977
1450
|
* cursor, for a term whose meaning the tip explains. */
|
|
978
1451
|
variant?: 'default' | 'hint';
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
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;
|
|
984
1461
|
/** Why a Popover or DropdownMenu closed itself: Escape, a press outside, or Tab out. */
|
|
985
1462
|
type PopoverCloseReason = 'escape' | 'outside' | 'tab';
|
|
986
|
-
interface PopoverProps {
|
|
1463
|
+
interface PopoverProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className'> {
|
|
987
1464
|
/** Whether the panel shows. The popover is controlled: pair it with `onOpenChange`. */
|
|
988
1465
|
open: boolean;
|
|
989
1466
|
/** Called with false on Escape, a press outside, and Tab out of the panel. The second
|
|
@@ -998,7 +1475,8 @@ interface PopoverProps {
|
|
|
998
1475
|
anchor: RefObject<HTMLElement | null>;
|
|
999
1476
|
/** Preferred side; flips when there is no room. Default bottom. */
|
|
1000
1477
|
side?: 'top' | 'bottom';
|
|
1001
|
-
/** 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. */
|
|
1002
1480
|
align?: 'start' | 'center' | 'end';
|
|
1003
1481
|
/** Panel width: a number of pixels or any CSS length. Default: fits the content. */
|
|
1004
1482
|
width?: number | string;
|
|
@@ -1007,16 +1485,20 @@ interface PopoverProps {
|
|
|
1007
1485
|
/** Classes for the panel (e.g. `p-0`, or `app-region-no-drag` in Electron apps). */
|
|
1008
1486
|
className?: string;
|
|
1009
1487
|
children: ReactNode;
|
|
1488
|
+
/** The popover panel (role="dialog"). */
|
|
1489
|
+
ref?: Ref<HTMLDivElement>;
|
|
1010
1490
|
}
|
|
1011
1491
|
/** A non-modal floating panel anchored to an element: filters, a color picker, a
|
|
1012
1492
|
* details card. Portaled (so no parent clips it), flipped and clamped to the screen.
|
|
1013
|
-
* Escape and a press outside close it; focus returns to the anchor.
|
|
1014
|
-
|
|
1015
|
-
|
|
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'> {
|
|
1016
1497
|
/** The button that opens the menu (a Button or IconButton). It gets aria-haspopup,
|
|
1017
1498
|
* aria-expanded and aria-controls, opens on click, and on ArrowDown / ArrowUp. */
|
|
1018
1499
|
trigger: ReactElement;
|
|
1019
|
-
/** 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. */
|
|
1020
1502
|
align?: 'start' | 'center' | 'end';
|
|
1021
1503
|
/** Preferred side; flips when there is no room. Default bottom. */
|
|
1022
1504
|
side?: 'top' | 'bottom';
|
|
@@ -1035,30 +1517,18 @@ interface DropdownMenuProps {
|
|
|
1035
1517
|
/** `'sm'`: under 640px the menu opens as a bottom sheet with 48px rows instead of a
|
|
1036
1518
|
* floating panel. Default false (always a floating panel). */
|
|
1037
1519
|
sheetBelow?: 'sm' | false;
|
|
1038
|
-
/** 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). */
|
|
1039
1522
|
sheetTitle?: string;
|
|
1040
1523
|
/** Classes for the menu panel (e.g. a width, or `app-region-no-drag`). */
|
|
1041
1524
|
className?: string;
|
|
1525
|
+
/** The menu panel (role="menu"). */
|
|
1526
|
+
ref?: Ref<HTMLDivElement>;
|
|
1042
1527
|
}
|
|
1043
1528
|
/** A menu of actions behind a button: role="menu" with arrow keys, Home and End,
|
|
1044
1529
|
* Escape, Tab to leave, and focus back on the trigger when it closes. */
|
|
1045
|
-
declare function DropdownMenu({ trigger, align, side, children, open: openProp, onOpenChange, defaultOpen, 'aria-label': ariaLabel, sheetBelow, sheetTitle, className, }: DropdownMenuProps): react.JSX.Element;
|
|
1046
|
-
interface
|
|
1047
|
-
/** The current choice: the highlighted look (set aria-current on the row too). */
|
|
1048
|
-
active?: boolean;
|
|
1049
|
-
/** A destructive action: loss-colored text and hover. */
|
|
1050
|
-
danger?: boolean;
|
|
1051
|
-
/** The disabled look (set disabled or aria-disabled on the row too). */
|
|
1052
|
-
disabled?: boolean;
|
|
1053
|
-
/** Extra classes, merged last. */
|
|
1054
|
-
className?: string;
|
|
1055
|
-
}
|
|
1056
|
-
/** The classes `<MenuItem>` renders, for menu-looking rows that are not in a
|
|
1057
|
-
* DropdownMenu: tabbable buttons in a Popover panel that also holds IconButtons,
|
|
1058
|
-
* inputs or color pickers. The rows keep their own roles (plain buttons, Tab order);
|
|
1059
|
-
* hover and keyboard focus get the same highlight as MenuItem. */
|
|
1060
|
-
declare function menuItemClass({ active, danger, disabled, className }?: MenuItemClassOptions): string;
|
|
1061
|
-
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'> {
|
|
1062
1532
|
/** Leading icon (14px reads best). */
|
|
1063
1533
|
icon?: ReactNode;
|
|
1064
1534
|
/** Right-aligned extra: a shortcut (Kbd), a count or a chevron. */
|
|
@@ -1076,32 +1546,84 @@ interface MenuItemProps {
|
|
|
1076
1546
|
/** Classes for the row. */
|
|
1077
1547
|
className?: string;
|
|
1078
1548
|
children: ReactNode;
|
|
1549
|
+
/** The row's button. */
|
|
1550
|
+
ref?: Ref<HTMLButtonElement>;
|
|
1079
1551
|
}
|
|
1080
1552
|
/** One action in a DropdownMenu. */
|
|
1081
|
-
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;
|
|
1082
1554
|
/** A small heading over a group of MenuItems. Not focusable. */
|
|
1083
|
-
declare function MenuLabel({ children, className }: {
|
|
1084
|
-
children: ReactNode;
|
|
1555
|
+
declare function MenuLabel({ children, className, ref, ...rest }: Omit<ComponentPropsWithoutRef<'div'>, 'className' | 'role'> & {
|
|
1085
1556
|
className?: string;
|
|
1557
|
+
ref?: Ref<HTMLDivElement>;
|
|
1086
1558
|
}): react.JSX.Element;
|
|
1087
1559
|
/** A thin line between groups of MenuItems. */
|
|
1088
|
-
declare function MenuSeparator({ className }: {
|
|
1560
|
+
declare function MenuSeparator({ className, ref, ...rest }: Omit<ComponentPropsWithoutRef<'div'>, 'className' | 'role' | 'children'> & {
|
|
1089
1561
|
className?: string;
|
|
1562
|
+
ref?: Ref<HTMLDivElement>;
|
|
1090
1563
|
}): react.JSX.Element;
|
|
1091
|
-
interface MenuSubHeaderProps {
|
|
1092
|
-
/** 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. */
|
|
1093
1567
|
onBack: () => void;
|
|
1094
1568
|
/** The submenu's title. */
|
|
1095
1569
|
children: ReactNode;
|
|
1096
1570
|
className?: string;
|
|
1571
|
+
/** The header's button. */
|
|
1572
|
+
ref?: Ref<HTMLButtonElement>;
|
|
1097
1573
|
}
|
|
1098
1574
|
/** The first row of a submenu view shown in place: a back arrow and the view's title. */
|
|
1099
|
-
declare function MenuSubHeader({ onBack, children, className }: MenuSubHeaderProps): react.JSX.Element;
|
|
1575
|
+
declare function MenuSubHeader({ onBack, children, className, ref, onKeyDown, ...rest }: MenuSubHeaderProps): react.JSX.Element;
|
|
1100
1576
|
|
|
1101
1577
|
/** Status tones shared by the display components. */
|
|
1102
1578
|
type StatusTone = 'ok' | 'warn' | 'loss' | 'info' | 'accent' | 'neutral';
|
|
1103
1579
|
type CalloutTone = 'neutral' | 'accent' | 'info' | 'ok' | 'warn' | 'loss';
|
|
1104
|
-
|
|
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>;
|
|
1105
1627
|
/** What kind of notice: info and accent for news, ok for success, warn for something to
|
|
1106
1628
|
* check, loss for a failure. neutral is a plain grey note. */
|
|
1107
1629
|
tone?: CalloutTone;
|
|
@@ -1115,6 +1637,8 @@ interface CalloutProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'o
|
|
|
1115
1637
|
action?: ReactNode;
|
|
1116
1638
|
/** Adds a Dismiss button that calls this. */
|
|
1117
1639
|
onDismiss?: () => void;
|
|
1640
|
+
/** Accessible name of the dismiss button. Default: the provider's `dismiss` string. */
|
|
1641
|
+
dismissLabel?: string;
|
|
1118
1642
|
/** box: a rounded tinted box in the flow (default). bar: full width with square
|
|
1119
1643
|
* corners and no side borders, for a sticky page-level alert. */
|
|
1120
1644
|
variant?: 'box' | 'bar';
|
|
@@ -1129,7 +1653,9 @@ interface CalloutProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'o
|
|
|
1129
1653
|
/** Limits the body to 1, 2 or 3 lines with an ellipsis, instead of growing. */
|
|
1130
1654
|
clamp?: 1 | 2 | 3;
|
|
1131
1655
|
/** Makes the icon, title and text one link (at least 44px tall) with a trailing
|
|
1132
|
-
* 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. */
|
|
1133
1659
|
href?: string;
|
|
1134
1660
|
/** Like href, but a button. */
|
|
1135
1661
|
onClick?: () => void;
|
|
@@ -1139,14 +1665,10 @@ interface CalloutProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'o
|
|
|
1139
1665
|
/** An inline notice: a tinted box with an icon, an optional title, text and an action.
|
|
1140
1666
|
* variant="bar" is opaque, so it can stick under the header without content showing
|
|
1141
1667
|
* through. */
|
|
1142
|
-
declare function Callout({ tone, icon, title, children, action, onDismiss, variant, compact, live, sticky, clamp, href, onClick, count, className, ...rest }: CalloutProps): react.JSX.Element;
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
readonly md: "size-2.5";
|
|
1147
|
-
readonly lg: "size-3.5";
|
|
1148
|
-
};
|
|
1149
|
-
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>;
|
|
1150
1672
|
/** ok, warn, loss and info use the status fills; accent the accent; neutral the ghost grey. */
|
|
1151
1673
|
tone: StatusTone;
|
|
1152
1674
|
/** xs 6px, sm 8px (default), md 10px, lg 14px. */
|
|
@@ -1158,20 +1680,13 @@ interface StatusDotProps {
|
|
|
1158
1680
|
/** The accessible name read by screen readers ("Up", "Degraded"; role="img"). Without it the
|
|
1159
1681
|
* dot is aria-hidden, so always pair it with visible text then. */
|
|
1160
1682
|
label?: string;
|
|
1161
|
-
className?: string;
|
|
1162
1683
|
}
|
|
1163
1684
|
/** A small round status mark. Color is never the only signal: give it a label or
|
|
1164
|
-
* put text beside it. */
|
|
1165
|
-
declare function StatusDot({ tone, size, pulse, halo, label, className }: StatusDotProps): react.JSX.Element;
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
declare const STAT_VALUE_SIZE: {
|
|
1170
|
-
readonly sm: "text-base";
|
|
1171
|
-
readonly md: "text-xl";
|
|
1172
|
-
readonly lg: "text-2xl";
|
|
1173
|
-
};
|
|
1174
|
-
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>;
|
|
1175
1690
|
/** What the number is: "Open positions", "Uptime (30d)". */
|
|
1176
1691
|
label: ReactNode;
|
|
1177
1692
|
/** The number, already formatted ("$12,480", "99.95%"). */
|
|
@@ -1189,25 +1704,13 @@ interface StatProps {
|
|
|
1189
1704
|
variant?: 'card' | 'inset' | 'plain';
|
|
1190
1705
|
/** Skeleton bars of the same size instead of the value and sub. */
|
|
1191
1706
|
loading?: boolean;
|
|
1192
|
-
className?: string;
|
|
1193
1707
|
}
|
|
1194
1708
|
/** One labelled number. Inside a StatGrid it is a row of the grid's <dl>; on its own it
|
|
1195
1709
|
* renders its own <dl>. */
|
|
1196
|
-
declare function Stat({ label, value, sub, tone, tip, size, variant, loading, className, }: StatProps): react.JSX.Element;
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
readonly 3: "grid-cols-3";
|
|
1201
|
-
readonly 4: "grid-cols-4";
|
|
1202
|
-
};
|
|
1203
|
-
declare const GRID_MD: {
|
|
1204
|
-
readonly 2: "md:grid-cols-2";
|
|
1205
|
-
readonly 3: "md:grid-cols-3";
|
|
1206
|
-
readonly 4: "md:grid-cols-4";
|
|
1207
|
-
readonly 5: "md:grid-cols-5";
|
|
1208
|
-
readonly 6: "md:grid-cols-6";
|
|
1209
|
-
};
|
|
1210
|
-
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>;
|
|
1211
1714
|
/** Columns on phones (base, default 2) and from 768px (md, default 4). */
|
|
1212
1715
|
cols?: {
|
|
1213
1716
|
base?: keyof typeof GRID_BASE;
|
|
@@ -1215,25 +1718,12 @@ interface StatGridProps {
|
|
|
1215
1718
|
};
|
|
1216
1719
|
/** Stat elements. */
|
|
1217
1720
|
children: ReactNode;
|
|
1218
|
-
className?: string;
|
|
1219
1721
|
}
|
|
1220
1722
|
/** A responsive grid of Stats, rendered as one <dl>. */
|
|
1221
|
-
declare function StatGrid({ cols, children, className }: StatGridProps): react.JSX.Element;
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
declare function toneFor(value: number, t: {
|
|
1226
|
-
warn: number;
|
|
1227
|
-
loss: number;
|
|
1228
|
-
}): 'ok' | 'warn' | 'loss';
|
|
1229
|
-
type ChartTone$1 = `chart-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}`;
|
|
1230
|
-
type MeterTone = 'accent' | 'ok' | 'warn' | 'loss' | 'info' | 'neutral' | ChartTone$1;
|
|
1231
|
-
declare const METER_THICK: {
|
|
1232
|
-
readonly xs: "h-1";
|
|
1233
|
-
readonly sm: "h-1.5";
|
|
1234
|
-
readonly md: "h-2.5";
|
|
1235
|
-
};
|
|
1236
|
-
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>;
|
|
1237
1727
|
/** The current value, between min and max (clamped). */
|
|
1238
1728
|
value: number;
|
|
1239
1729
|
/** Default 0. */
|
|
@@ -1261,12 +1751,14 @@ interface MeterProps {
|
|
|
1261
1751
|
kind?: 'meter' | 'progress';
|
|
1262
1752
|
/** Shows the rounded percentage beside a horizontal bar. */
|
|
1263
1753
|
showValue?: boolean;
|
|
1264
|
-
className?: string;
|
|
1265
1754
|
}
|
|
1266
|
-
/** A thin bar showing how full something is: disk, quota, progress, a score.
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
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>;
|
|
1270
1762
|
/** The series, oldest first. null leaves a gap (a missed check, a closed market). */
|
|
1271
1763
|
values: (number | null)[];
|
|
1272
1764
|
/** Accessible name, ideally with the trend: "Response time, last 24 hours, 120 to 180 ms". */
|
|
@@ -1283,12 +1775,14 @@ interface SparklineProps {
|
|
|
1283
1775
|
min?: number;
|
|
1284
1776
|
/** Top of the scale. Default: the largest value. */
|
|
1285
1777
|
max?: number;
|
|
1286
|
-
className?: string;
|
|
1287
1778
|
}
|
|
1288
1779
|
/** A tiny line chart with no axes, for a trend beside a number. Plain SVG, no chart
|
|
1289
|
-
* library. Gaps at nulls; a flat dashed line when there is no data.
|
|
1290
|
-
|
|
1291
|
-
|
|
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>;
|
|
1292
1786
|
/** The always-visible row that opens and closes it. */
|
|
1293
1787
|
summary: ReactNode;
|
|
1294
1788
|
/** What it reveals. */
|
|
@@ -1301,23 +1795,33 @@ interface DisclosureProps {
|
|
|
1301
1795
|
onOpenChange?: (open: boolean) => void;
|
|
1302
1796
|
/** plain: a bare row (default). card: a bordered surface box. */
|
|
1303
1797
|
variant?: 'plain' | 'card';
|
|
1304
|
-
className?: string;
|
|
1305
1798
|
}
|
|
1306
1799
|
/** Show-more on native <details>/<summary>: keyboard and find-in-page work for free,
|
|
1307
|
-
* with a chevron that turns when open. */
|
|
1308
|
-
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
|
+
}
|
|
1309
1806
|
/** A keyboard key or shortcut, e.g. <Kbd>⌘K</Kbd>. */
|
|
1310
|
-
declare function Kbd({ className, ...rest }:
|
|
1311
|
-
/** Copies text to the clipboard. Uses the Clipboard API
|
|
1312
|
-
*
|
|
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. */
|
|
1313
1812
|
declare function copyText(text: string): Promise<boolean>;
|
|
1314
|
-
interface CopyButtonProps {
|
|
1813
|
+
interface CopyButtonProps extends Omit<ComponentPropsWithoutRef<'button'>, 'onCopy' | 'onClick' | 'children' | 'type'> {
|
|
1814
|
+
/** The button element. */
|
|
1815
|
+
ref?: Ref<HTMLButtonElement>;
|
|
1315
1816
|
/** What lands on the clipboard. */
|
|
1316
1817
|
text: string;
|
|
1317
|
-
/** 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"). */
|
|
1318
1819
|
label?: string;
|
|
1319
|
-
/** 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. */
|
|
1320
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;
|
|
1321
1825
|
/** A square IconButton instead of a labelled Button. */
|
|
1322
1826
|
iconOnly?: boolean;
|
|
1323
1827
|
/** Button size (or IconButton size when iconOnly). Default sm. */
|
|
@@ -1326,11 +1830,14 @@ interface CopyButtonProps {
|
|
|
1326
1830
|
variant?: ButtonProps['variant'];
|
|
1327
1831
|
/** Called after each copy attempt with whether it worked. */
|
|
1328
1832
|
onCopy?: (ok: boolean) => void;
|
|
1329
|
-
className?: string;
|
|
1330
1833
|
}
|
|
1331
|
-
/** Copies text with one click, shows "Copied" for 1.5s and tells screen readers.
|
|
1332
|
-
|
|
1333
|
-
|
|
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>;
|
|
1334
1841
|
/** The page's title. */
|
|
1335
1842
|
title: ReactNode;
|
|
1336
1843
|
/** One sentence under the title. */
|
|
@@ -1350,12 +1857,22 @@ interface PageHeaderProps {
|
|
|
1350
1857
|
/** Sticky only: under 640px, once stuck, hide the description and show the title as
|
|
1351
1858
|
* one truncated line, so the bar stays short. Default true. */
|
|
1352
1859
|
collapseWhenStuck?: boolean;
|
|
1353
|
-
className?: string;
|
|
1354
1860
|
}
|
|
1355
1861
|
/** The title block at the top of a page: optional back link and eyebrow, the title,
|
|
1356
1862
|
* a description and actions. */
|
|
1357
|
-
declare function PageHeader({ title, description, eyebrow, back, actions, as: H, sticky, collapseWhenStuck, className, }: PageHeaderProps): react.JSX.Element;
|
|
1358
|
-
|
|
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>;
|
|
1359
1876
|
/** The app's name, shown as the wordmark. */
|
|
1360
1877
|
name: ReactNode;
|
|
1361
1878
|
/** An icon before the name, drawn in the accent color. */
|
|
@@ -1364,8 +1881,10 @@ interface AppHeaderProps {
|
|
|
1364
1881
|
* switcher, a wordmark with a subtitle). It is not wrapped in a link; `name` stays for
|
|
1365
1882
|
* screen readers. */
|
|
1366
1883
|
brand?: ReactNode;
|
|
1367
|
-
/**
|
|
1368
|
-
|
|
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;
|
|
1369
1888
|
/** Buttons before the theme toggle. */
|
|
1370
1889
|
actions?: ReactNode;
|
|
1371
1890
|
/** A second row of nav links (use tabClass on each, aria-current on the active one). */
|
|
@@ -1381,8 +1900,8 @@ interface AppHeaderProps {
|
|
|
1381
1900
|
/** Under 640px show only the icon; the name stays for screen readers, so the pill,
|
|
1382
1901
|
* actions and theme toggle fit on one row. Needs an icon. */
|
|
1383
1902
|
hideNameBelow?: 'sm';
|
|
1384
|
-
/** Names the nav row's <nav> landmark
|
|
1385
|
-
*
|
|
1903
|
+
/** Names the nav row's <nav> landmark. Default: the provider's `sections` string. Give
|
|
1904
|
+
* each nav on a page its own name. */
|
|
1386
1905
|
navLabel?: string;
|
|
1387
1906
|
/** Under 480px the hub pill shrinks to its arrow (.nish-pill-link--compact), for
|
|
1388
1907
|
* headers with a long name. */
|
|
@@ -1393,13 +1912,14 @@ interface AppHeaderProps {
|
|
|
1393
1912
|
/** Extra MenuItems. From 640px they render after `actions`; under 640px they collapse
|
|
1394
1913
|
* into a "More actions" kebab menu, so the row never wraps. */
|
|
1395
1914
|
overflowActions?: ReactNode;
|
|
1396
|
-
className?: string;
|
|
1397
1915
|
}
|
|
1398
|
-
/** The shared app header:
|
|
1916
|
+
/** The shared app header: an optional hub pill, the wordmark, actions and the theme toggle,
|
|
1399
1917
|
* with an optional nav row. Opaque by default (glass is opt-in), safe-area aware. A
|
|
1400
1918
|
* sticky header publishes its height as `--nish-header-h` for the rest of the layout. */
|
|
1401
|
-
declare function AppHeader({ name, icon, brand,
|
|
1402
|
-
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>;
|
|
1403
1923
|
/** The section's title. */
|
|
1404
1924
|
title: ReactNode;
|
|
1405
1925
|
/** id for the heading, so the section can point aria-labelledby at it. */
|
|
@@ -1410,11 +1930,10 @@ interface SectionHeaderProps {
|
|
|
1410
1930
|
meta?: ReactNode;
|
|
1411
1931
|
/** A control on the right, after meta (a Button, a Segmented, a link). */
|
|
1412
1932
|
action?: ReactNode;
|
|
1413
|
-
className?: string;
|
|
1414
1933
|
}
|
|
1415
1934
|
/** The heading row of a section inside a page: the title, with optional meta text
|
|
1416
1935
|
* and an action on the right. Smaller than PageHeader, larger than CardHeader. */
|
|
1417
|
-
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;
|
|
1418
1937
|
interface KeyValueItem {
|
|
1419
1938
|
/** React key; unique in the list. */
|
|
1420
1939
|
key: string;
|
|
@@ -1429,59 +1948,59 @@ interface KeyValueItem {
|
|
|
1429
1948
|
* - `'words'`: prose (a phrase-long status or error). Both cells wrap at word breaks,
|
|
1430
1949
|
* labels first: the label keeps its one-line width up to 60% of the row
|
|
1431
1950
|
* (`shrink-0 max-w-[calc(60%-0.75rem)]`), so a short label never wraps one word per
|
|
1432
|
-
* 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
|
|
1433
1952
|
* word splits only when it alone is wider than its cell (`overflow-wrap: anywhere`).
|
|
1434
1953
|
* Without `wrap` the value keeps its full width, so keep it short. */
|
|
1435
1954
|
wrap?: boolean | 'anywhere' | 'words';
|
|
1436
1955
|
}
|
|
1437
|
-
interface KeyValueListProps {
|
|
1956
|
+
interface KeyValueListProps extends Omit<ComponentPropsWithoutRef<'ul'>, 'children'> {
|
|
1957
|
+
/** The `ul` or `dl` element. */
|
|
1958
|
+
ref?: Ref<HTMLElement>;
|
|
1438
1959
|
items: KeyValueItem[];
|
|
1439
1960
|
/** Rows 32px tall instead of 44px, for dense panels. */
|
|
1440
1961
|
dense?: boolean;
|
|
1441
1962
|
/** ul: a list of rows (default). dl: a description list with dt and dd, for label
|
|
1442
1963
|
* and value pairs that read as "name: value". */
|
|
1443
1964
|
as?: 'ul' | 'dl';
|
|
1444
|
-
className?: string;
|
|
1445
1965
|
}
|
|
1446
1966
|
/** Label and value rows with dividers: services and their status, runner details,
|
|
1447
1967
|
* vitals. Each row is at least 44px tall (32px dense); an item with `wrap` lets its row
|
|
1448
1968
|
* wrap and grow: `true`/`'anywhere'` for a path or URL, `'words'` for prose. */
|
|
1449
|
-
declare function KeyValueList({ items, dense, as, className }: KeyValueListProps): react.JSX.Element;
|
|
1450
|
-
type ChartLegendTone = ChartTone$1 | 'accent' | 'ok' | 'warn' | 'loss' | 'info';
|
|
1969
|
+
declare function KeyValueList({ items, dense, as, className, ref, ...rest }: KeyValueListProps): react.JSX.Element;
|
|
1451
1970
|
interface ChartLegendItem {
|
|
1452
1971
|
/** The series name. */
|
|
1453
1972
|
label: string;
|
|
1454
1973
|
/** The series color, the same role the chart draws it in. */
|
|
1455
1974
|
tone: ChartLegendTone;
|
|
1456
1975
|
}
|
|
1457
|
-
interface ChartLegendProps {
|
|
1976
|
+
interface ChartLegendProps extends Omit<ComponentPropsWithoutRef<'ul'>, 'children'> {
|
|
1977
|
+
/** The `ul` element. */
|
|
1978
|
+
ref?: Ref<HTMLUListElement>;
|
|
1458
1979
|
items: ChartLegendItem[];
|
|
1459
1980
|
/** line: a short 3px x 10px stroke, for line charts (default). dot: an 8px dot, for
|
|
1460
1981
|
* bars and points. */
|
|
1461
1982
|
marker?: 'line' | 'dot';
|
|
1462
|
-
/** Accessible name of the list. Default
|
|
1983
|
+
/** Accessible name of the list. Default: the provider's `legend` string. */
|
|
1463
1984
|
label?: string;
|
|
1464
|
-
className?: string;
|
|
1465
1985
|
}
|
|
1466
1986
|
/** The key for a multi-series chart (uPlot and canvas charts draw none of their own):
|
|
1467
1987
|
* each series' color mark and name. The marks are decorative; the names carry it. */
|
|
1468
|
-
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;
|
|
1469
1989
|
|
|
1470
|
-
type
|
|
1471
|
-
type RowTone = 'ok' | 'warn' | 'loss';
|
|
1990
|
+
type RowTone$1 = 'ok' | 'warn' | 'loss';
|
|
1472
1991
|
/** The table recipes as strings, for renderers that take classes (TanStack Table cells,
|
|
1473
|
-
* static markup). The components
|
|
1992
|
+
* static markup). The components in table.tsx use exactly these. */
|
|
1474
1993
|
declare const tableClass: {
|
|
1475
1994
|
/** The scroll box around the table. */
|
|
1476
|
-
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";
|
|
1477
1996
|
/** Add to wrap for a header that stays put while the body scrolls (give wrap a max height). */
|
|
1478
|
-
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";
|
|
1479
1998
|
/** The <table>. */
|
|
1480
1999
|
readonly table: "w-full border-collapse text-sm tabular-nums text-th-hi2";
|
|
1481
2000
|
/** Add to table for striped rows. */
|
|
1482
2001
|
readonly zebra: "[&_tbody>tr:nth-child(even)]:bg-th-elevated/50";
|
|
1483
2002
|
/** A header cell (add padY.normal or padY.dense). */
|
|
1484
|
-
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";
|
|
1485
2004
|
/** A body cell (add padY.normal or padY.dense). */
|
|
1486
2005
|
readonly td: "px-3 align-middle";
|
|
1487
2006
|
/** Vertical cell padding: normal or dense. */
|
|
@@ -1494,11 +2013,25 @@ declare const tableClass: {
|
|
|
1494
2013
|
/** Add to tr for a clickable row. */
|
|
1495
2014
|
readonly trInteractive: "cursor-pointer transition-colors hover:bg-th-elevated focus-within:bg-th-elevated";
|
|
1496
2015
|
/** Add to th or td for a right-aligned number column. */
|
|
1497
|
-
readonly numeric: "whitespace-nowrap text-
|
|
2016
|
+
readonly numeric: "whitespace-nowrap text-end tabular-nums";
|
|
1498
2017
|
/** Add to tr for a status edge. */
|
|
1499
|
-
readonly tone: Record<RowTone, string>;
|
|
2018
|
+
readonly tone: Record<RowTone$1, string>;
|
|
1500
2019
|
};
|
|
1501
|
-
|
|
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'> {
|
|
1502
2035
|
/** The table's minimum width (e.g. 640 or '40rem'); narrower screens scroll sideways
|
|
1503
2036
|
* inside the box instead of squeezing columns. */
|
|
1504
2037
|
minWidth?: number | string;
|
|
@@ -1508,13 +2041,17 @@ interface TableWrapProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
1508
2041
|
stickyHeader?: boolean;
|
|
1509
2042
|
/** Fades the left and right edges while there is more to scroll sideways. Default true. */
|
|
1510
2043
|
fade?: boolean;
|
|
1511
|
-
/** 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
|
|
1512
2045
|
* scrolls sideways, with an edge shadow once it has scrolled. */
|
|
1513
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;
|
|
1514
2050
|
}
|
|
1515
|
-
/** The bordered scroll box a table sits in. Use it instead of a Card for tables.
|
|
1516
|
-
|
|
1517
|
-
|
|
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'> {
|
|
1518
2055
|
/** Tighter rows (6px vertical padding instead of 10px) for dense data. */
|
|
1519
2056
|
dense?: boolean;
|
|
1520
2057
|
/** Striped body rows. */
|
|
@@ -1522,8 +2059,9 @@ interface TableProps extends TableHTMLAttributes<HTMLTableElement> {
|
|
|
1522
2059
|
}
|
|
1523
2060
|
/** A full-width table with tabular numbers. Put it in a TableWrap. */
|
|
1524
2061
|
declare function Table({ dense, zebra, className, ...rest }: TableProps): react.JSX.Element;
|
|
1525
|
-
interface ThProps extends Omit<
|
|
1526
|
-
/** 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). */
|
|
1527
2065
|
align?: Align;
|
|
1528
2066
|
/** A number column: right-aligned with tabular figures. */
|
|
1529
2067
|
numeric?: boolean;
|
|
@@ -1535,8 +2073,9 @@ interface ThProps extends Omit<ThHTMLAttributes<HTMLTableCellElement>, 'align'>
|
|
|
1535
2073
|
}
|
|
1536
2074
|
/** A header cell. With onSort it holds a sort button and reports aria-sort. */
|
|
1537
2075
|
declare function Th({ align, numeric, sort, onSort, className, children, scope, ...rest }: ThProps): react.JSX.Element;
|
|
1538
|
-
interface TdProps extends Omit<
|
|
1539
|
-
/** 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). */
|
|
1540
2079
|
align?: Align;
|
|
1541
2080
|
/** A number column: right-aligned with tabular figures, never wrapping. */
|
|
1542
2081
|
numeric?: boolean;
|
|
@@ -1545,8 +2084,8 @@ interface TdProps extends Omit<TdHTMLAttributes<HTMLTableCellElement>, 'align'>
|
|
|
1545
2084
|
}
|
|
1546
2085
|
/** A body cell. */
|
|
1547
2086
|
declare function Td({ align, numeric, nowrap, className, ...rest }: TdProps): react.JSX.Element;
|
|
1548
|
-
interface TrProps extends
|
|
1549
|
-
/** 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. */
|
|
1550
2089
|
tone?: RowTone;
|
|
1551
2090
|
/** Hover and focus-within highlight for a clickable row. Put a real link or button
|
|
1552
2091
|
* in the row as well, so keyboard users can reach it. */
|
|
@@ -1570,7 +2109,9 @@ interface ThemeState {
|
|
|
1570
2109
|
setChoice: (choice: ThemeChoice) => void;
|
|
1571
2110
|
}
|
|
1572
2111
|
/** The current theme choice and what it renders as, kept in sync across tabs and
|
|
1573
|
-
* 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. */
|
|
1574
2115
|
declare function useTheme(): ThemeState;
|
|
1575
2116
|
interface ThemeToggleProps {
|
|
1576
2117
|
/** Also offer the extra presets (slate, terminal, …) in a select. */
|
|
@@ -1598,12 +2139,17 @@ interface ThemeToggleProps {
|
|
|
1598
2139
|
* width, for a drawer or settings page that has the room. */
|
|
1599
2140
|
collapse?: 'sm' | 'never';
|
|
1600
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>;
|
|
1601
2147
|
}
|
|
1602
2148
|
/** System / Light / Dark as a Segmented radio group, optionally with a preset picker,
|
|
1603
|
-
* or one cycling icon button when compact.
|
|
1604
|
-
|
|
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;
|
|
1605
2152
|
|
|
1606
|
-
type SegmentedTone = 'accent' | 'warn' | 'loss';
|
|
1607
2153
|
interface SegmentedOption<T extends string> {
|
|
1608
2154
|
value: T;
|
|
1609
2155
|
label: ReactNode;
|
|
@@ -1623,13 +2169,28 @@ interface SegmentedOption<T extends string> {
|
|
|
1623
2169
|
/** Shown but not selectable; the arrow keys skip it. */
|
|
1624
2170
|
disabled?: boolean;
|
|
1625
2171
|
}
|
|
1626
|
-
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>;
|
|
1627
2175
|
/** Name of the whole group for screen readers: "Chart range". */
|
|
1628
2176
|
label: string;
|
|
1629
2177
|
options: SegmentedOption<T>[];
|
|
1630
|
-
/** The selected value; a value not among the options
|
|
1631
|
-
|
|
1632
|
-
|
|
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;
|
|
1633
2194
|
/** xs: 24px for dense widget headers. sm: 28px (default). md: 32px. All grow to 44px
|
|
1634
2195
|
* on touch screens. */
|
|
1635
2196
|
size?: 'xs' | 'sm' | 'md';
|
|
@@ -1647,7 +2208,7 @@ interface SegmentedProps<T extends string> {
|
|
|
1647
2208
|
* radio group. The selected option gets the accent tint and ring, so it reads at a
|
|
1648
2209
|
* glance in light themes too. Arrow keys, Home and End move the choice and the focus,
|
|
1649
2210
|
* like a native radio group. For multi-select toggles use ChipGroup and Chip. */
|
|
1650
|
-
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;
|
|
1651
2212
|
|
|
1652
2213
|
/**
|
|
1653
2214
|
* Publishes an element's height as a CSS variable on `<html>` (the layout contract:
|
|
@@ -1688,7 +2249,8 @@ interface NavItem {
|
|
|
1688
2249
|
label: string;
|
|
1689
2250
|
/** A 20-24px SVG icon drawn in currentColor. */
|
|
1690
2251
|
icon: ReactNode;
|
|
1691
|
-
/** 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. */
|
|
1692
2254
|
href?: string;
|
|
1693
2255
|
/** Rendered as a `<button>` when there is no href. Also called when an `<a>` is clicked. */
|
|
1694
2256
|
onSelect?: () => void;
|
|
@@ -1705,17 +2267,21 @@ type RenderLink = (item: NavItem, props: {
|
|
|
1705
2267
|
className: string;
|
|
1706
2268
|
children: ReactNode;
|
|
1707
2269
|
'aria-current'?: 'page';
|
|
2270
|
+
'data-state'?: 'active' | 'inactive';
|
|
1708
2271
|
onClick?: () => void;
|
|
1709
2272
|
/** true when rendered inside a sheet: pass it to the router's `<Link replace>` so the
|
|
1710
2273
|
* navigation replaces the sheet's own history entry instead of stacking on it. */
|
|
1711
2274
|
replace?: boolean;
|
|
1712
2275
|
}) => ReactElement;
|
|
1713
2276
|
type NavBreakpoint = 'md' | 'lg';
|
|
1714
|
-
interface BottomNavProps {
|
|
2277
|
+
interface BottomNavProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'children'> {
|
|
2278
|
+
/** The `nav` element. */
|
|
2279
|
+
ref?: Ref<HTMLElement>;
|
|
1715
2280
|
/** The destinations. Four or five fit a 360px screen; put the rest behind `more`. */
|
|
1716
2281
|
items: NavItem[];
|
|
1717
2282
|
/** A last "More" button that opens a MoreSheet. You own the sheet's open state. */
|
|
1718
2283
|
more?: {
|
|
2284
|
+
/** Default: the provider's `more` string. */
|
|
1719
2285
|
label?: string;
|
|
1720
2286
|
icon?: ReactNode;
|
|
1721
2287
|
/** Highlight the button, e.g. when the current page lives inside the sheet. */
|
|
@@ -1727,25 +2293,25 @@ interface BottomNavProps {
|
|
|
1727
2293
|
trailing?: ReactNode;
|
|
1728
2294
|
/** The breakpoint from which the bar is hidden (default md, 768px). */
|
|
1729
2295
|
hideFrom?: NavBreakpoint;
|
|
1730
|
-
/** Names the nav landmark. Default
|
|
2296
|
+
/** Names the nav landmark. Default: the provider's `sections` string. */
|
|
1731
2297
|
label?: string;
|
|
1732
2298
|
/** Renders router links instead of plain anchors. */
|
|
1733
2299
|
renderLink?: RenderLink;
|
|
1734
|
-
className?: string;
|
|
1735
2300
|
}
|
|
1736
2301
|
/** A phone tab bar fixed to the bottom of the screen: icon over label, the current page
|
|
1737
2302
|
* tinted, safe-area padding and 56px targets. It publishes its height as
|
|
1738
2303
|
* `--nish-bottom-nav-h` while it is visible, so Toaster, StickyActionBar and page
|
|
1739
2304
|
* padding make room for it. Hidden from `hideFrom` up (pair it with NavRail or a sidebar). */
|
|
1740
|
-
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;
|
|
1741
2306
|
interface MoreSheetProps {
|
|
1742
2307
|
open: boolean;
|
|
1743
2308
|
/** Called on Escape, a scrim click, the swipe, Android back and after a row is chosen. */
|
|
1744
2309
|
onClose: () => void;
|
|
1745
2310
|
items: NavItem[];
|
|
1746
|
-
/** Default
|
|
2311
|
+
/** Default: the provider's `more` string. */
|
|
1747
2312
|
title?: string;
|
|
1748
|
-
/** 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. */
|
|
1749
2315
|
footer?: ReactNode;
|
|
1750
2316
|
renderLink?: RenderLink;
|
|
1751
2317
|
}
|
|
@@ -1753,7 +2319,9 @@ interface MoreSheetProps {
|
|
|
1753
2319
|
* so the bar stays visible and tappable. Rows are 52px with an icon, a label and a
|
|
1754
2320
|
* one-line hint. Choosing a row navigates and closes the sheet. */
|
|
1755
2321
|
declare function MoreSheet({ open, onClose, items, title, footer, renderLink }: MoreSheetProps): react.JSX.Element | null;
|
|
1756
|
-
interface NavRailProps {
|
|
2322
|
+
interface NavRailProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'children'> {
|
|
2323
|
+
/** The `nav` element. */
|
|
2324
|
+
ref?: Ref<HTMLElement>;
|
|
1757
2325
|
items: NavItem[];
|
|
1758
2326
|
/** A second group under the items, after a divider (settings, search). */
|
|
1759
2327
|
tools?: ReactNode;
|
|
@@ -1763,16 +2331,17 @@ interface NavRailProps {
|
|
|
1763
2331
|
showFrom?: 'sm' | 'md' | 'lg';
|
|
1764
2332
|
/** The breakpoint from which it hides again (default lg, 1024px); pass false to keep it. */
|
|
1765
2333
|
hideFrom?: 'md' | 'lg' | 'xl' | false;
|
|
1766
|
-
/** Names the nav landmark. Default
|
|
2334
|
+
/** Names the nav landmark. Default: the provider's `sections` string. */
|
|
1767
2335
|
label?: string;
|
|
1768
2336
|
renderLink?: RenderLink;
|
|
1769
|
-
className?: string;
|
|
1770
2337
|
}
|
|
1771
2338
|
/** A 72px icon rail for the unfolded and tablet range between the phone BottomNav and a
|
|
1772
2339
|
* full sidebar: each destination is an icon in a pill over an 11px label. The `hint`
|
|
1773
2340
|
* shows as a tooltip on mouse hover and keyboard focus. */
|
|
1774
|
-
declare function NavRail({ items, tools, footer, showFrom, hideFrom, label, renderLink, className }: NavRailProps): react.JSX.Element;
|
|
1775
|
-
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>;
|
|
1776
2345
|
children: ReactNode;
|
|
1777
2346
|
/** Let the row run to the screen edges inside a padded page. */
|
|
1778
2347
|
bleed?: boolean;
|
|
@@ -1784,12 +2353,11 @@ interface ScrollRowProps {
|
|
|
1784
2353
|
as?: 'div' | 'ul' | 'ol' | 'nav';
|
|
1785
2354
|
/** Accessible name of the row (`aria-label`). */
|
|
1786
2355
|
label?: string;
|
|
1787
|
-
className?: string;
|
|
1788
2356
|
}
|
|
1789
2357
|
/** A single horizontally scrolling row (chips, filters, tabs) with edge fades and no
|
|
1790
2358
|
* scrollbar. The pressed, selected or current child is scrolled into view when it
|
|
1791
2359
|
* changes. */
|
|
1792
|
-
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;
|
|
1793
2361
|
/** The id of the section crossing the middle band of the viewport: the last one that
|
|
1794
2362
|
* entered it. At the very top of the page, or before any section has been seen, it is
|
|
1795
2363
|
* the first id. Sections are looked up with `document.getElementById`.
|
|
@@ -1808,7 +2376,9 @@ interface SectionNavItem {
|
|
|
1808
2376
|
/** A count after the label. */
|
|
1809
2377
|
count?: number;
|
|
1810
2378
|
}
|
|
1811
|
-
interface SectionNavProps {
|
|
2379
|
+
interface SectionNavProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'children' | 'onSelect'> {
|
|
2380
|
+
/** The `nav` element. */
|
|
2381
|
+
ref?: Ref<HTMLElement>;
|
|
1812
2382
|
items: SectionNavItem[];
|
|
1813
2383
|
/** Stick under the app header (default true). */
|
|
1814
2384
|
sticky?: boolean;
|
|
@@ -1817,17 +2387,19 @@ interface SectionNavProps {
|
|
|
1817
2387
|
/** Write `#id` with history.replaceState on click (default true). Pass false in apps that
|
|
1818
2388
|
* use hash routing. */
|
|
1819
2389
|
updateHash?: boolean;
|
|
1820
|
-
/** 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. */
|
|
1821
2392
|
label?: string;
|
|
1822
|
-
className?: string;
|
|
1823
2393
|
}
|
|
1824
2394
|
/** A row of jump chips for a long page. The chip of the section being read is marked
|
|
1825
2395
|
* (`aria-current="true"`) and kept in view; clicking one scrolls to its section. Give the
|
|
1826
2396
|
* sections the `nish-scroll-target` class so they stop below the sticky bars. It publishes
|
|
1827
|
-
* its own height as `--nish-sticky-extra`. */
|
|
1828
|
-
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;
|
|
1829
2399
|
|
|
1830
|
-
interface StickyBarProps {
|
|
2400
|
+
interface StickyBarProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2401
|
+
/** The bar element. */
|
|
2402
|
+
ref?: Ref<HTMLElement>;
|
|
1831
2403
|
/** The bar's content: a filter row, a toolbar, a SectionNav. */
|
|
1832
2404
|
children?: ReactNode;
|
|
1833
2405
|
/** CSS `top` offset. Defaults to just under the app header (`var(--nish-header-h, 0px)`). */
|
|
@@ -1836,55 +2408,62 @@ interface StickyBarProps {
|
|
|
1836
2408
|
elevate?: boolean;
|
|
1837
2409
|
/** The element to render. Default `div`. */
|
|
1838
2410
|
as?: ElementType;
|
|
1839
|
-
className?: string;
|
|
1840
2411
|
}
|
|
1841
2412
|
/**
|
|
1842
2413
|
* A bar that sticks under the app header while the page scrolls. Opaque, and its
|
|
1843
2414
|
* background reaches the screen edges (it bleeds through the page gutter). Publishes its
|
|
1844
2415
|
* height as `--nish-sticky-extra` while mounted, so anchor links scroll clear of it.
|
|
1845
2416
|
*/
|
|
1846
|
-
declare function StickyBar({ children, top, elevate, as, className }: StickyBarProps): react.JSX.Element;
|
|
1847
|
-
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>;
|
|
1848
2421
|
/** Shows the bar. Closed, it renders nothing and publishes no height. */
|
|
1849
2422
|
open: boolean;
|
|
1850
|
-
/** Short text
|
|
2423
|
+
/** Short text at the start, e.g. "3 changes". Truncates to one line. */
|
|
1851
2424
|
message?: ReactNode;
|
|
1852
2425
|
/** The main action, usually a primary Button. */
|
|
1853
2426
|
primary: ReactNode;
|
|
1854
2427
|
/** A second action, usually a ghost or secondary Button (Discard, Cancel). */
|
|
1855
2428
|
secondary?: ReactNode;
|
|
1856
|
-
/** Accessible name of the region. Default
|
|
2429
|
+
/** Accessible name of the region. Default: the provider's `actions` string. */
|
|
1857
2430
|
label?: string;
|
|
1858
|
-
className?: string;
|
|
1859
2431
|
}
|
|
1860
2432
|
/**
|
|
1861
2433
|
* A bar fixed to the bottom of the screen for the actions of an unsaved form or a
|
|
1862
2434
|
* selection. Sits above a BottomNav when there is one, and publishes `--nish-bottom-bar-h`
|
|
1863
2435
|
* while open so page padding and toasts clear it. From sm it floats as a pill at the
|
|
1864
|
-
* bottom
|
|
2436
|
+
* bottom end.
|
|
1865
2437
|
*/
|
|
1866
|
-
declare function StickyActionBar({ open, message, primary, secondary, label, className }: StickyActionBarProps): react.JSX.Element | null;
|
|
1867
|
-
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>;
|
|
1868
2442
|
/** True while something loads (a route change, a refetch). */
|
|
1869
2443
|
active: boolean;
|
|
1870
2444
|
/** Waits this long before showing, so quick loads never flash a bar. Default 200. */
|
|
1871
2445
|
delayMs?: number;
|
|
1872
2446
|
/** CSS `top`. Defaults to just under the app header. */
|
|
1873
2447
|
top?: string;
|
|
1874
|
-
|
|
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;
|
|
1875
2452
|
}
|
|
1876
2453
|
/**
|
|
1877
2454
|
* A thin indeterminate progress bar fixed under the app header. Appears only after
|
|
1878
2455
|
* `delayMs` of being active. With reduced motion it is a static partial bar.
|
|
1879
2456
|
*/
|
|
1880
|
-
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;
|
|
1881
2458
|
declare const CONTAINER_SIZE: {
|
|
1882
2459
|
readonly narrow: "max-w-2xl";
|
|
1883
2460
|
readonly default: "max-w-4xl";
|
|
1884
2461
|
readonly wide: "max-w-7xl";
|
|
1885
2462
|
readonly full: "max-w-none";
|
|
1886
2463
|
};
|
|
1887
|
-
interface PageContainerProps {
|
|
2464
|
+
interface PageContainerProps extends Omit<ComponentPropsWithoutRef<'main'>, 'children'> {
|
|
2465
|
+
/** The container element. */
|
|
2466
|
+
ref?: Ref<HTMLElement>;
|
|
1888
2467
|
/** Max width: narrow 42rem, default 56rem, wide 80rem, full none. */
|
|
1889
2468
|
size?: keyof typeof CONTAINER_SIZE;
|
|
1890
2469
|
children?: ReactNode;
|
|
@@ -1892,16 +2471,18 @@ interface PageContainerProps {
|
|
|
1892
2471
|
padBottom?: boolean;
|
|
1893
2472
|
/** The element to render. Default `main`. */
|
|
1894
2473
|
as?: ElementType;
|
|
1895
|
-
className?: string;
|
|
1896
2474
|
}
|
|
1897
2475
|
/**
|
|
1898
2476
|
* The page's content column: centered, with the shared side gutter and vertical padding,
|
|
1899
2477
|
* and bottom padding that keeps the last row clear of fixed bottom bars.
|
|
1900
2478
|
*/
|
|
1901
|
-
declare function PageContainer({ size, children, padBottom, as, className }: PageContainerProps): react.JSX.Element;
|
|
1902
|
-
/** 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. */
|
|
1903
2482
|
declare function useOnline(): boolean;
|
|
1904
|
-
interface ConnectionBannerProps {
|
|
2483
|
+
interface ConnectionBannerProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'title' | 'onClick'> {
|
|
2484
|
+
/** The banner's root element. */
|
|
2485
|
+
ref?: Ref<HTMLDivElement>;
|
|
1905
2486
|
/** A URL to probe with `fetch` (cache: no-store). When it fails or returns a non-2xx
|
|
1906
2487
|
* status the banner shows. Leave out to react to the browser's online/offline state only. */
|
|
1907
2488
|
healthUrl?: string;
|
|
@@ -1909,8 +2490,10 @@ interface ConnectionBannerProps {
|
|
|
1909
2490
|
intervalMs?: number;
|
|
1910
2491
|
/** Shown when the probe fails. Default "Can't reach the server". */
|
|
1911
2492
|
message?: string;
|
|
1912
|
-
/** Shown when the browser is offline. Default
|
|
2493
|
+
/** Shown when the browser is offline. Default: the provider's `offline` string. */
|
|
1913
2494
|
offlineMessage?: string;
|
|
2495
|
+
/** Retry button text. Default: the provider's `retry` string. */
|
|
2496
|
+
retryLabel?: string;
|
|
1914
2497
|
/** Called after the Retry button re-probes. */
|
|
1915
2498
|
onRetry?: () => void;
|
|
1916
2499
|
}
|
|
@@ -1919,7 +2502,7 @@ interface ConnectionBannerProps {
|
|
|
1919
2502
|
* `healthUrl`, probes the server with backoff (and right away when the browser comes back
|
|
1920
2503
|
* online or the tab becomes visible). Renders nothing while everything is reachable.
|
|
1921
2504
|
*/
|
|
1922
|
-
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;
|
|
1923
2506
|
|
|
1924
2507
|
/** One column of a ResponsiveTable. */
|
|
1925
2508
|
interface Column<T> {
|
|
@@ -1948,10 +2531,18 @@ type Sort = {
|
|
|
1948
2531
|
dir: 'asc' | 'desc';
|
|
1949
2532
|
} | null;
|
|
1950
2533
|
type CardsBelow = 'sm' | 'md' | 'lg';
|
|
1951
|
-
|
|
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'> {
|
|
1952
2542
|
/** The data. */
|
|
1953
2543
|
rows: T[];
|
|
1954
|
-
/** 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. */
|
|
1955
2546
|
columns: Column<T>[];
|
|
1956
2547
|
/** A stable key for a row. */
|
|
1957
2548
|
rowKey: (row: T) => string;
|
|
@@ -1959,13 +2550,14 @@ interface ResponsiveTableProps<T> {
|
|
|
1959
2550
|
cardsBelow?: CardsBelow;
|
|
1960
2551
|
/** Called when a row (or card) is activated by click, Enter or Space. */
|
|
1961
2552
|
onRowClick?: (row: T) => void;
|
|
1962
|
-
/** 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. */
|
|
1963
2555
|
rowHref?: (row: T) => string;
|
|
1964
2556
|
/** Called with the URL when a row is activated by click or key, so a router can navigate
|
|
1965
2557
|
* without a page reload. Without it the table assigns `location`. Card links stay real
|
|
1966
2558
|
* anchors. */
|
|
1967
2559
|
onNavigate?: (href: string) => void;
|
|
1968
|
-
/** A 3px
|
|
2560
|
+
/** A 3px edge at the start of a row: ok, warn or loss. Say the status in a cell too. */
|
|
1969
2561
|
rowTone?: (row: T) => 'ok' | 'warn' | 'loss' | undefined;
|
|
1970
2562
|
/** The current sort, when you control it. */
|
|
1971
2563
|
sort?: Sort;
|
|
@@ -1982,7 +2574,7 @@ interface ResponsiveTableProps<T> {
|
|
|
1982
2574
|
stickyFirstColumn?: boolean;
|
|
1983
2575
|
/** Shows skeleton rows (table) or skeleton cards instead of the data. */
|
|
1984
2576
|
loading?: boolean;
|
|
1985
|
-
/** Shown when there are no rows. Default: "
|
|
2577
|
+
/** Shown when there are no rows. Default: the "nothingHere" string. */
|
|
1986
2578
|
empty?: ReactNode;
|
|
1987
2579
|
/** Shows an ErrorState instead of the data. */
|
|
1988
2580
|
error?: {
|
|
@@ -1993,15 +2585,19 @@ interface ResponsiveTableProps<T> {
|
|
|
1993
2585
|
label: string;
|
|
1994
2586
|
/** Renders a whole card yourself (inside the card's button or link). */
|
|
1995
2587
|
renderCard?: (row: T) => ReactNode;
|
|
2588
|
+
/** Replaces the English sort announcement and direction-button label. */
|
|
2589
|
+
sortText?: SortText;
|
|
1996
2590
|
className?: string;
|
|
2591
|
+
ref?: Ref<HTMLDivElement>;
|
|
1997
2592
|
}
|
|
1998
2593
|
/**
|
|
1999
2594
|
* A table on wide screens and a list of cards on phones, from one column definition.
|
|
2000
2595
|
* Sortable headers (and a sort menu in card mode), clickable or linked rows, a status
|
|
2001
|
-
* 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.
|
|
2002
2598
|
*/
|
|
2003
|
-
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;
|
|
2004
|
-
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'> {
|
|
2005
2601
|
/** A leading icon or avatar (kept at its size). */
|
|
2006
2602
|
icon?: ReactNode;
|
|
2007
2603
|
/** The main line; truncates, or wraps to two lines with `titleLines={2}`. */
|
|
@@ -2014,7 +2610,7 @@ interface ListRowProps {
|
|
|
2014
2610
|
meta?: ReactNode;
|
|
2015
2611
|
/** A control or badge at the far right (outside the meta). */
|
|
2016
2612
|
trailing?: ReactNode;
|
|
2017
|
-
/** 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. */
|
|
2018
2614
|
href?: string;
|
|
2019
2615
|
/** Makes the whole row a button. */
|
|
2020
2616
|
onClick?: () => void;
|
|
@@ -2030,26 +2626,37 @@ interface ListRowProps {
|
|
|
2030
2626
|
compact?: boolean;
|
|
2031
2627
|
/** Opens the link in a new tab with an external icon. */
|
|
2032
2628
|
external?: boolean;
|
|
2629
|
+
/** Classes for the row itself (the link, button or box inside the wrapper). */
|
|
2033
2630
|
className?: string;
|
|
2034
2631
|
/** The wrapper element. Default 'li'; pass 'div' outside a list. */
|
|
2035
2632
|
as?: 'li' | 'div';
|
|
2633
|
+
/** The wrapper element. */
|
|
2634
|
+
ref?: Ref<HTMLElement>;
|
|
2036
2635
|
}
|
|
2037
2636
|
/** A list row: icon, title, subtitle, meta and a chevron, where the whole row is the link or button. */
|
|
2038
|
-
declare function ListRow({ icon, title, titleLines, subtitle, meta, trailing, href, onClick, active, tone, chevron, dense, compact, external, className, as:
|
|
2039
|
-
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'> {
|
|
2040
2639
|
/** The site's address; only the host is used. */
|
|
2041
2640
|
url: string;
|
|
2042
2641
|
/** Width and height in px. Default 16. */
|
|
2043
2642
|
size?: number;
|
|
2044
2643
|
/** The text whose first letter fills the fallback avatar. Default: the host name. */
|
|
2045
2644
|
label?: string;
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
/**
|
|
2049
|
-
|
|
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;
|
|
2050
2656
|
type LinkCardAccent = `chart-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}` | 'accent';
|
|
2051
|
-
interface LinkCardProps {
|
|
2052
|
-
/** 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`. */
|
|
2053
2660
|
href: string;
|
|
2054
2661
|
/** The name. */
|
|
2055
2662
|
title: string;
|
|
@@ -2057,6 +2664,9 @@ interface LinkCardProps {
|
|
|
2057
2664
|
blurb?: string;
|
|
2058
2665
|
/** A 20px icon or a Favicon, shown in a tinted tile. */
|
|
2059
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;
|
|
2060
2670
|
/** The tile color. Default 'accent'. */
|
|
2061
2671
|
accent?: LinkCardAccent;
|
|
2062
2672
|
/** A small detail line (card layout only). */
|
|
@@ -2075,10 +2685,11 @@ interface LinkCardProps {
|
|
|
2075
2685
|
/** Opens in a new tab. */
|
|
2076
2686
|
external?: boolean;
|
|
2077
2687
|
className?: string;
|
|
2688
|
+
ref?: Ref<HTMLElement>;
|
|
2078
2689
|
}
|
|
2079
2690
|
/** A big link to another page or app: icon tile, title and blurb. The whole card is the anchor. */
|
|
2080
|
-
declare function LinkCard({ href, title, blurb, icon, accent, meta, status, badge, disabled, layout, external, className, }: LinkCardProps): react.JSX.Element;
|
|
2081
|
-
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'> {
|
|
2082
2693
|
/** Which state to show. */
|
|
2083
2694
|
status: 'loading' | 'error' | 'empty' | 'ready';
|
|
2084
2695
|
/** The loading body. Default: SkeletonRows. */
|
|
@@ -2098,9 +2709,10 @@ interface AsyncPanelProps {
|
|
|
2098
2709
|
/** The content for status 'ready'. */
|
|
2099
2710
|
children?: ReactNode;
|
|
2100
2711
|
className?: string;
|
|
2712
|
+
ref?: Ref<HTMLDivElement>;
|
|
2101
2713
|
}
|
|
2102
2714
|
/** Shows a skeleton, an error, an empty state or its children, from one status value. */
|
|
2103
|
-
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;
|
|
2104
2716
|
|
|
2105
2717
|
/** A series color: one of the eight categorical chart colors, or a status/accent color. */
|
|
2106
2718
|
type ChartTone = 'chart-1' | 'chart-2' | 'chart-3' | 'chart-4' | 'chart-5' | 'chart-6' | 'chart-7' | 'chart-8' | 'ok' | 'loss' | 'accent';
|
|
@@ -2117,7 +2729,7 @@ interface LineSeries {
|
|
|
2117
2729
|
tone?: ChartTone;
|
|
2118
2730
|
points: LinePoint[];
|
|
2119
2731
|
}
|
|
2120
|
-
interface LineChartProps {
|
|
2732
|
+
interface LineChartProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2121
2733
|
/** A single series of points. Use this or `series`. */
|
|
2122
2734
|
data?: LinePoint[];
|
|
2123
2735
|
/** Several series sharing one x axis. */
|
|
@@ -2126,7 +2738,7 @@ interface LineChartProps {
|
|
|
2126
2738
|
height?: number;
|
|
2127
2739
|
/** Fill under the first series with a fading gradient of its color. */
|
|
2128
2740
|
area?: boolean;
|
|
2129
|
-
/** Formats y axis ticks and tooltip values. */
|
|
2741
|
+
/** Formats y axis ticks and tooltip values. Default: numbers in `locale`. */
|
|
2130
2742
|
yFormat?: (v: number) => string;
|
|
2131
2743
|
/** Formats x axis ticks and the tooltip heading. */
|
|
2132
2744
|
xFormat?: (v: number) => string;
|
|
@@ -2142,16 +2754,21 @@ interface LineChartProps {
|
|
|
2142
2754
|
label: string;
|
|
2143
2755
|
/** Show a skeleton of the same height. */
|
|
2144
2756
|
loading?: boolean;
|
|
2145
|
-
/** Shown when there are no points. Default "
|
|
2757
|
+
/** Shown when there are no points. Default: the "noData" string. */
|
|
2146
2758
|
empty?: ReactNode;
|
|
2759
|
+
/** The locale of the default axis numbers. Default: the provider's locale, else en-US. */
|
|
2760
|
+
locale?: string;
|
|
2147
2761
|
className?: string;
|
|
2762
|
+
ref?: Ref<HTMLDivElement>;
|
|
2148
2763
|
}
|
|
2149
2764
|
/** A dependency-free SVG line chart that fills its container's width. Gaps (null y)
|
|
2150
2765
|
* break the line. Hover, touch-drag or Left/Right keys move a crosshair with a
|
|
2151
2766
|
* tooltip; vertical swipes still scroll the page. A hidden table carries the data for
|
|
2152
|
-
* screen readers.
|
|
2153
|
-
|
|
2154
|
-
|
|
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'> {
|
|
2155
2772
|
/** One bar per entry, in order. */
|
|
2156
2773
|
data: {
|
|
2157
2774
|
label: string;
|
|
@@ -2161,7 +2778,7 @@ interface BarChartProps {
|
|
|
2161
2778
|
height?: number;
|
|
2162
2779
|
/** Bar color. Default chart-1. */
|
|
2163
2780
|
tone?: ChartTone;
|
|
2164
|
-
/** Formats values above the bars and in the caption. */
|
|
2781
|
+
/** Formats values above the bars and in the caption. Default: numbers in `locale`. */
|
|
2165
2782
|
valueFormat?: (v: number) => string;
|
|
2166
2783
|
/** 'always' prints every value above its bar; 'auto' (default) does so on touch
|
|
2167
2784
|
* screens only, where there is no hover. */
|
|
@@ -2170,13 +2787,19 @@ interface BarChartProps {
|
|
|
2170
2787
|
xTicks?: 'ends' | 'all';
|
|
2171
2788
|
/** Accessible name of the chart. */
|
|
2172
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;
|
|
2173
2794
|
className?: string;
|
|
2795
|
+
ref?: Ref<HTMLDivElement>;
|
|
2174
2796
|
}
|
|
2175
2797
|
/** A dependency-free SVG bar chart that fills its container's width. Hover, tap or
|
|
2176
2798
|
* Left/Right keys select a bar and show "label: value" under the chart. A hidden table
|
|
2177
|
-
* carries the data for screen readers.
|
|
2178
|
-
|
|
2179
|
-
|
|
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'> {
|
|
2180
2803
|
/** The track's lower end (e.g. the 52-week low). */
|
|
2181
2804
|
min: number;
|
|
2182
2805
|
/** The track's upper end. */
|
|
@@ -2187,11 +2810,17 @@ interface RangeBarProps {
|
|
|
2187
2810
|
high: number;
|
|
2188
2811
|
/** Marks a value (e.g. the current price) with a dot. */
|
|
2189
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;
|
|
2190
2817
|
className?: string;
|
|
2818
|
+
ref?: Ref<HTMLDivElement>;
|
|
2191
2819
|
}
|
|
2192
2820
|
/** A thin range track with a highlighted low-to-high segment and an optional dot for
|
|
2193
|
-
* the current value: daily temperature ranges, a price's day range.
|
|
2194
|
-
|
|
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;
|
|
2195
2824
|
|
|
2196
2825
|
/** One row of the palette. */
|
|
2197
2826
|
interface CommandItem {
|
|
@@ -2207,7 +2836,8 @@ interface CommandItem {
|
|
|
2207
2836
|
keywords?: string[];
|
|
2208
2837
|
/** A 16-20px icon shown before the label. */
|
|
2209
2838
|
icon?: ReactNode;
|
|
2210
|
-
/** 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). */
|
|
2211
2841
|
href?: string;
|
|
2212
2842
|
/** Open `href` in a new tab. */
|
|
2213
2843
|
external?: boolean;
|
|
@@ -2227,6 +2857,10 @@ interface CommandPaletteProps {
|
|
|
2227
2857
|
placeholder?: string;
|
|
2228
2858
|
/** Text shown when nothing matches. Default 'No results'. */
|
|
2229
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;
|
|
2230
2864
|
/** Open with Ctrl/Cmd+K, and with `/` when focus is not in a field (default true). */
|
|
2231
2865
|
hotkey?: boolean;
|
|
2232
2866
|
/** Called on every keystroke with the new query. */
|
|
@@ -2239,7 +2873,7 @@ interface CommandPaletteProps {
|
|
|
2239
2873
|
/** Navigates after the layer that is closing has dropped its own history entry. Running
|
|
2240
2874
|
* `history.back()` (the layer's cleanup) right after `location.assign` would cancel the
|
|
2241
2875
|
* navigation, so wait for that pop to finish. Call it before closing the layer. */
|
|
2242
|
-
declare function navigateFromLayer(
|
|
2876
|
+
declare function navigateFromLayer(rawHref: string): void;
|
|
2243
2877
|
/**
|
|
2244
2878
|
* Registers the palette hotkeys: Ctrl/Cmd+K anywhere, and `/` when focus is not in a
|
|
2245
2879
|
* field. For apps that render their own trigger or palette.
|
|
@@ -2251,10 +2885,8 @@ declare function useCommandHotkey(open: () => void, enabled?: boolean): void;
|
|
|
2251
2885
|
/** Search-and-jump dialog. A full-height sheet with the field on top under 640px, a
|
|
2252
2886
|
* centered 560px panel from there up. Fuzzy matching (prefix, word start, substring,
|
|
2253
2887
|
* then subsequence), grouped rows, arrow keys, Enter, and Ctrl/Cmd+K and `/` hotkeys. */
|
|
2254
|
-
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;
|
|
2255
2889
|
|
|
2256
|
-
/** True while the CSS media query matches. False on the server and before hydration. */
|
|
2257
|
-
declare function useMediaQuery(query: string): boolean;
|
|
2258
2890
|
type Breakpoint = 'base' | 'sm' | 'md' | 'lg' | 'xl';
|
|
2259
2891
|
/** Tailwind's breakpoints, in px. Phone = below sm; narrow = below md (cover screen and small tablets). */
|
|
2260
2892
|
declare const BREAKPOINTS: {
|
|
@@ -2265,6 +2897,9 @@ declare const BREAKPOINTS: {
|
|
|
2265
2897
|
};
|
|
2266
2898
|
declare const PHONE_QUERY = "(max-width: 639.98px)";
|
|
2267
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;
|
|
2268
2903
|
/** True below 640px (the Fold's cover screen, any phone held upright). */
|
|
2269
2904
|
declare function usePhone(): boolean;
|
|
2270
2905
|
/** True below 768px: where BottomNav shows and NavRail hides. */
|
|
@@ -2283,23 +2918,27 @@ declare function useNow(intervalMs?: number): number;
|
|
|
2283
2918
|
/**
|
|
2284
2919
|
* State kept in localStorage. JSON by default, the raw string with { raw: true }. Never
|
|
2285
2920
|
* throws (private mode, quota and bad JSON fall back to the initial value) and follows
|
|
2286
|
-
* 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`.
|
|
2287
2923
|
*/
|
|
2288
2924
|
declare function useLocalStorage<T>(key: string, initial: T, o?: {
|
|
2289
2925
|
raw?: boolean;
|
|
2290
2926
|
}): [T, (next: T | ((prev: T) => T)) => void];
|
|
2291
|
-
interface RelativeTimeProps {
|
|
2927
|
+
interface RelativeTimeProps extends Omit<ComponentPropsWithoutRef<'time'>, 'children' | 'dateTime' | 'style'> {
|
|
2292
2928
|
/** The moment: a Date, epoch milliseconds or a date string. */
|
|
2293
2929
|
value: Date | number | string;
|
|
2294
|
-
/** "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. */
|
|
2295
2931
|
style?: 'short' | 'long';
|
|
2296
2932
|
/** How often the text refreshes, in milliseconds. Default 30000. */
|
|
2297
2933
|
refreshMs?: number;
|
|
2934
|
+
/** Language of the words. Default NishProvider locale, then setDefaultLocale() (en-US). */
|
|
2935
|
+
locale?: string;
|
|
2298
2936
|
/** Classes for the time element. */
|
|
2299
2937
|
className?: string;
|
|
2938
|
+
ref?: Ref<HTMLTimeElement>;
|
|
2300
2939
|
}
|
|
2301
2940
|
/** A self-updating "3m ago". The full date and time show on hover and in the dateTime attribute. */
|
|
2302
|
-
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;
|
|
2303
2942
|
|
|
2304
2943
|
/** True while the viewer asks for reduced motion. False on the server and before hydration. */
|
|
2305
2944
|
declare function usePrefersReducedMotion(): boolean;
|
|
@@ -2310,40 +2949,46 @@ interface FlowStepItem {
|
|
|
2310
2949
|
status: FlowStepStatus;
|
|
2311
2950
|
meta?: ReactNode;
|
|
2312
2951
|
}
|
|
2313
|
-
interface FlowStepsProps {
|
|
2952
|
+
interface FlowStepsProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2314
2953
|
steps: FlowStepItem[];
|
|
2315
2954
|
/** auto: horizontal when the container is at least 640px wide and there are at most 8 steps; else vertical. */
|
|
2316
2955
|
orientation?: 'auto' | 'vertical' | 'horizontal';
|
|
2317
2956
|
/** aria-label of the list. Default "Progress". */
|
|
2318
2957
|
label?: string;
|
|
2958
|
+
/** Screen-reader words after a finished or failed step. Default ", done" and ", failed". */
|
|
2959
|
+
statusLabels?: Partial<Record<'done' | 'failed', string>>;
|
|
2319
2960
|
className?: string;
|
|
2961
|
+
ref?: Ref<HTMLDivElement>;
|
|
2320
2962
|
}
|
|
2321
2963
|
/** A plan as a flow of steps: numbered nodes joined by connectors that fill as steps
|
|
2322
2964
|
* finish. The active step ripples, a finishing step draws its check, a failing one
|
|
2323
2965
|
* shakes, and when the last step finishes a sweep runs along the connectors. Vertical on
|
|
2324
2966
|
* narrow containers, horizontal from 640px (up to 8 steps). */
|
|
2325
|
-
declare function FlowSteps({ steps, orientation, label, className }: FlowStepsProps): react.JSX.Element;
|
|
2326
|
-
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'> {
|
|
2327
2969
|
total: number;
|
|
2328
2970
|
done: number;
|
|
2329
2971
|
/** pulses the current segment */
|
|
2330
2972
|
active?: boolean;
|
|
2973
|
+
/** aria-label. Default "Progress". */
|
|
2331
2974
|
label?: string;
|
|
2332
2975
|
className?: string;
|
|
2976
|
+
ref?: Ref<HTMLDivElement>;
|
|
2333
2977
|
}
|
|
2334
2978
|
/** A compact progress bar of segments, one per step (a continuous bar above 12). Done
|
|
2335
2979
|
* segments fill in, the current one pulses while `active`. */
|
|
2336
|
-
declare function StepBar({ total, done, active, label, className }: StepBarProps): react.JSX.Element;
|
|
2337
|
-
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'> {
|
|
2338
2982
|
text: string;
|
|
2339
2983
|
as?: 'span' | 'p' | 'div';
|
|
2340
2984
|
className?: string;
|
|
2985
|
+
ref?: Ref<HTMLElement>;
|
|
2341
2986
|
}
|
|
2342
2987
|
/** One line of text that swaps with a short slide when it changes: the old text rises and
|
|
2343
2988
|
* fades out while the new text comes up from below. Long text ends in an ellipsis. */
|
|
2344
|
-
declare function TickerText({ text, as, className }: TickerTextProps): react.JSX.Element;
|
|
2989
|
+
declare function TickerText({ text, as, className, ref, ...rest }: TickerTextProps): react.JSX.Element;
|
|
2345
2990
|
type AgentNodeState = 'queued' | 'running' | 'done' | 'failed';
|
|
2346
|
-
interface AgentNodeProps {
|
|
2991
|
+
interface AgentNodeProps extends Omit<ComponentPropsWithoutRef<'article'>, 'onClick' | 'children' | 'aria-label'> {
|
|
2347
2992
|
label: string;
|
|
2348
2993
|
state: AgentNodeState;
|
|
2349
2994
|
/** Short model name; opus, sonnet, haiku and fable get their own badge hue. */
|
|
@@ -2352,12 +2997,16 @@ interface AgentNodeProps {
|
|
|
2352
2997
|
/** Right-aligned small text, e.g. elapsed time. */
|
|
2353
2998
|
meta?: ReactNode;
|
|
2354
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>>;
|
|
2355
3002
|
className?: string;
|
|
3003
|
+
/** The card (an article, or a button with onClick). */
|
|
3004
|
+
ref?: Ref<HTMLElement>;
|
|
2356
3005
|
}
|
|
2357
3006
|
/** One agent or task as a card: state icon, label, model badge, a live activity line.
|
|
2358
3007
|
* A running agent has a comet of accent circling its border; finishing pops the check;
|
|
2359
3008
|
* failing shakes once. Pass `onClick` to make the card a button. */
|
|
2360
|
-
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;
|
|
2361
3010
|
interface WorkflowBoardPhase {
|
|
2362
3011
|
id: string;
|
|
2363
3012
|
title: string;
|
|
@@ -2369,17 +3018,22 @@ interface WorkflowBoardAgent extends Omit<AgentNodeProps, 'className' | 'onClick
|
|
|
2369
3018
|
/** phase id or title */
|
|
2370
3019
|
phase: string | null;
|
|
2371
3020
|
}
|
|
2372
|
-
interface WorkflowBoardProps {
|
|
3021
|
+
interface WorkflowBoardProps extends Omit<ComponentPropsWithoutRef<'section'>, 'children'> {
|
|
2373
3022
|
phases: WorkflowBoardPhase[];
|
|
2374
3023
|
agents: WorkflowBoardAgent[];
|
|
2375
3024
|
/** aria-label. Default "Workflow". */
|
|
2376
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;
|
|
2377
3030
|
className?: string;
|
|
3031
|
+
ref?: Ref<HTMLElement>;
|
|
2378
3032
|
}
|
|
2379
3033
|
/** A workflow as columns of phases (stacked on narrow containers), each phase holding its
|
|
2380
3034
|
* agents as AgentNodes. A phase waits, glows while an agent runs and gets a check when
|
|
2381
3035
|
* all its agents finish; new agents rise in, staggered. */
|
|
2382
|
-
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;
|
|
2383
3037
|
interface ActivityItem {
|
|
2384
3038
|
id: string;
|
|
2385
3039
|
at: number;
|
|
@@ -2387,20 +3041,23 @@ interface ActivityItem {
|
|
|
2387
3041
|
tone?: 'neutral' | 'accent' | 'ok' | 'warn' | 'loss';
|
|
2388
3042
|
source?: ReactNode;
|
|
2389
3043
|
}
|
|
2390
|
-
interface ActivityFeedProps {
|
|
3044
|
+
interface ActivityFeedProps extends Omit<ComponentPropsWithoutRef<'ol'>, 'children'> {
|
|
2391
3045
|
items: ActivityItem[];
|
|
2392
3046
|
/** default 50 */
|
|
2393
3047
|
max?: number;
|
|
2394
3048
|
now?: number;
|
|
2395
3049
|
/** default "Activity" */
|
|
2396
3050
|
label?: string;
|
|
3051
|
+
/** Shown when there are no items. Default "No activity yet". */
|
|
2397
3052
|
empty?: ReactNode;
|
|
2398
3053
|
className?: string;
|
|
3054
|
+
/** The list (a div holding the empty text when there are no items). */
|
|
3055
|
+
ref?: Ref<HTMLElement>;
|
|
2399
3056
|
}
|
|
2400
3057
|
/** A timeline of short updates, newest first. A new update opens its row, fades in and
|
|
2401
3058
|
* flashes the accent tint. Items present on the first render do not animate. */
|
|
2402
|
-
declare function ActivityFeed({ items, max, now, label, empty, className }: ActivityFeedProps): react.JSX.Element;
|
|
2403
|
-
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'> {
|
|
2404
3061
|
items: T[];
|
|
2405
3062
|
getKey: (item: T) => string;
|
|
2406
3063
|
children: (item: T, phase: 'enter' | 'idle' | 'exit') => ReactNode;
|
|
@@ -2409,148 +3066,13 @@ interface AnimatedListProps<T> {
|
|
|
2409
3066
|
as?: 'ul' | 'ol' | 'div';
|
|
2410
3067
|
className?: string;
|
|
2411
3068
|
itemClassName?: string;
|
|
3069
|
+
/** The list element. */
|
|
3070
|
+
ref?: Ref<HTMLElement>;
|
|
2412
3071
|
}
|
|
2413
3072
|
/** A list whose items animate: new ones rise in, removed ones fade and close the gap
|
|
2414
3073
|
* before they are dropped, and the rest slide to their new place (FLIP). The render
|
|
2415
3074
|
* function gets each item's phase. Under reduced motion changes are instant. */
|
|
2416
|
-
declare function AnimatedList<T>({ items, getKey, children, exitMs, as, className, itemClassName, }: AnimatedListProps<T>): react.JSX.Element;
|
|
2417
|
-
|
|
2418
|
-
type CanvasHue = 'indigo' | 'emerald' | 'amber' | 'lime' | 'rose' | 'sky' | 'violet' | 'teal';
|
|
2419
|
-
type CanvasNodeKind = 'ui' | 'service' | 'worker' | 'library' | 'infra' | 'data' | 'tool' | 'docs';
|
|
2420
|
-
interface CanvasNode {
|
|
2421
|
-
id: string;
|
|
2422
|
-
label: string;
|
|
2423
|
-
kind?: CanvasNodeKind;
|
|
2424
|
-
detail?: string;
|
|
2425
|
-
/** 0..1 afterglow */
|
|
2426
|
-
heat?: number;
|
|
2427
|
-
/** live work here now */
|
|
2428
|
-
active?: boolean;
|
|
2429
|
-
/** When the newest activity here happened, ms. Follow mode visits the newest first. */
|
|
2430
|
-
activeAt?: number;
|
|
2431
|
-
/** shown under an active node, max ~48 chars */
|
|
2432
|
-
note?: string;
|
|
2433
|
-
/** sessions/agents here */
|
|
2434
|
-
count?: number;
|
|
2435
|
-
}
|
|
2436
|
-
interface CanvasGroup {
|
|
2437
|
-
id: string;
|
|
2438
|
-
title: string;
|
|
2439
|
-
subtitle?: string;
|
|
2440
|
-
hue?: CanvasHue;
|
|
2441
|
-
/** Left-to-right layer in the "columns" layout; also orders groups inside a band. */
|
|
2442
|
-
column: number;
|
|
2443
|
-
/** Top-to-bottom band in the "bands" layout. Default: `column`. */
|
|
2444
|
-
band?: number;
|
|
2445
|
-
badge?: ReactNode;
|
|
2446
|
-
nodes: CanvasNode[];
|
|
2447
|
-
}
|
|
2448
|
-
interface CanvasEdge {
|
|
2449
|
-
id: string;
|
|
2450
|
-
/** node or group id */
|
|
2451
|
-
from: string;
|
|
2452
|
-
/** node or group id */
|
|
2453
|
-
to: string;
|
|
2454
|
-
/** Overrides the kind's line style with a dashed line. */
|
|
2455
|
-
dashed?: boolean;
|
|
2456
|
-
label?: string;
|
|
2457
|
-
/** A `CanvasEdgeKind` id: sets the line style and which legend toggle shows or hides it. */
|
|
2458
|
-
kind?: string;
|
|
2459
|
-
}
|
|
2460
|
-
/** One entry of the line legend. */
|
|
2461
|
-
interface CanvasEdgeKind {
|
|
2462
|
-
id: string;
|
|
2463
|
-
/** Legend text ("Traffic", "Deploys"). */
|
|
2464
|
-
label: string;
|
|
2465
|
-
/** Default "solid". */
|
|
2466
|
-
line?: 'solid' | 'dashed' | 'dotted';
|
|
2467
|
-
/** Hidden until the viewer turns it on in the legend. */
|
|
2468
|
-
hidden?: boolean;
|
|
2469
|
-
}
|
|
2470
|
-
/** "columns": layers left to right. "bands": bands top to bottom, each wrapping its groups into
|
|
2471
|
-
* rows. "auto": whichever shows the map biggest in the current viewport. */
|
|
2472
|
-
type CanvasLayoutMode = 'columns' | 'bands' | 'auto';
|
|
2473
|
-
interface SystemCanvasProps {
|
|
2474
|
-
groups: CanvasGroup[];
|
|
2475
|
-
edges: CanvasEdge[];
|
|
2476
|
-
/** Faint titles above each column ("Edge", "Infra", "Apps", ...), by column index. */
|
|
2477
|
-
columns?: string[];
|
|
2478
|
-
/** Titles of the bands in the "bands" layout, by band index. Falls back to `columns`. */
|
|
2479
|
-
bands?: string[];
|
|
2480
|
-
/** Default "auto". */
|
|
2481
|
-
layout?: CanvasLayoutMode;
|
|
2482
|
-
/** The line legend. Edges whose kind is hidden are left out of the layout and routing. */
|
|
2483
|
-
edgeKinds?: CanvasEdgeKind[];
|
|
2484
|
-
/** Follow mode: the view flies to where work is happening. Controlled when set. */
|
|
2485
|
-
follow?: boolean;
|
|
2486
|
-
onFollowChange?: (on: boolean) => void;
|
|
2487
|
-
/** Overview map in a corner on viewports 600 px wide or more. Default true. */
|
|
2488
|
-
minimap?: boolean;
|
|
2489
|
-
selected?: string | null;
|
|
2490
|
-
onSelect?: (id: string, type: 'node' | 'group') => void;
|
|
2491
|
-
/** CSS height of the viewport. Default "100%". */
|
|
2492
|
-
height?: string;
|
|
2493
|
-
/** aria-label. Default "System map". */
|
|
2494
|
-
label?: string;
|
|
2495
|
-
className?: string;
|
|
2496
|
-
}
|
|
2497
|
-
|
|
2498
|
-
interface CanvasLayout {
|
|
2499
|
-
mode: "columns" | "bands";
|
|
2500
|
-
width: number;
|
|
2501
|
-
height: number;
|
|
2502
|
-
/** World px above y = 0 taken by the headers: 36 in "columns" (titles sit above the cards), 0 in "bands" (titles sit inside). */
|
|
2503
|
-
titleRoom: number;
|
|
2504
|
-
/** Top-left of each column's ("columns") or band's ("bands") title, world px; `index` is the column or band value. */
|
|
2505
|
-
headers: {
|
|
2506
|
-
index: number;
|
|
2507
|
-
x: number;
|
|
2508
|
-
y: number;
|
|
2509
|
-
}[];
|
|
2510
|
-
groups: Record<string, {
|
|
2511
|
-
x: number;
|
|
2512
|
-
y: number;
|
|
2513
|
-
w: number;
|
|
2514
|
-
h: number;
|
|
2515
|
-
}>;
|
|
2516
|
-
nodes: Record<string, {
|
|
2517
|
-
x: number;
|
|
2518
|
-
y: number;
|
|
2519
|
-
w: number;
|
|
2520
|
-
h: number;
|
|
2521
|
-
}>;
|
|
2522
|
-
}
|
|
2523
|
-
/** Where every group and node sits, in world units (px at zoom 1). Pure and deterministic.
|
|
2524
|
-
*
|
|
2525
|
-
* "columns" (default): columns are the distinct `column` values in ascending order, groups
|
|
2526
|
-
* stack in the order given, nodes sit in a 2-column grid inside their group (1 column for a
|
|
2527
|
-
* group of one), and each column is centered against the tallest. The first sub-column starts
|
|
2528
|
-
* 60 px in and `width` includes 60 px after the last, which is room for the edge lanes
|
|
2529
|
-
* outside the cards.
|
|
2530
|
-
*
|
|
2531
|
-
* "bands": bands are the distinct `band ?? column` values in ascending order, stacked top to
|
|
2532
|
-
* bottom; each band wraps its groups (by `column`, then input order) into rows no wider than
|
|
2533
|
-
* `width`. The gaps between rows grow with the number of edge ends that need lanes there. */
|
|
2534
|
-
interface LayoutOptions {
|
|
2535
|
-
/** Default "columns". */
|
|
2536
|
-
mode?: "columns" | "bands";
|
|
2537
|
-
/** "bands" only: the widest a row of groups may get, world px (at least one group per row). */
|
|
2538
|
-
width?: number;
|
|
2539
|
-
/** "bands" only: used to size the gaps between rows for the edge lanes. */
|
|
2540
|
-
edges?: CanvasEdge[];
|
|
2541
|
-
columnGap?: number;
|
|
2542
|
-
rowGap?: number;
|
|
2543
|
-
}
|
|
2544
|
-
|
|
2545
|
-
interface RoutedEdge {
|
|
2546
|
-
id: string;
|
|
2547
|
-
/** The corners of the line, source port first. Every segment is horizontal or vertical. */
|
|
2548
|
-
points: [number, number][];
|
|
2549
|
-
/** The same line as an SVG path with rounded corners; also valid for CSS `offset-path`. */
|
|
2550
|
-
d: string;
|
|
2551
|
-
/** Direction of travel of the last segment: "right" in "columns", "down" in "bands". */
|
|
2552
|
-
dir: 'right' | 'down';
|
|
2553
|
-
}
|
|
3075
|
+
declare function AnimatedList<T>({ items, getKey, children, exitMs, as, className, itemClassName, ref, ...rest }: AnimatedListProps<T>): react.JSX.Element;
|
|
2554
3076
|
|
|
2555
3077
|
/** How loud an event is: `info` is listed only, `normal` is pushed, `urgent` is pushed even in quiet hours. */
|
|
2556
3078
|
type InboxSeverity = 'info' | 'normal' | 'urgent';
|
|
@@ -2682,7 +3204,48 @@ interface InboxListResponse {
|
|
|
2682
3204
|
}>;
|
|
2683
3205
|
}
|
|
2684
3206
|
|
|
2685
|
-
|
|
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>;
|
|
2686
3249
|
/** The items of the current view, newest activity first. */
|
|
2687
3250
|
items: InboxItem[];
|
|
2688
3251
|
/** Which list is showing: open, snoozed or handled. */
|
|
@@ -2734,13 +3297,15 @@ interface InboxProps {
|
|
|
2734
3297
|
selectedId?: number | null;
|
|
2735
3298
|
/** Display names per source id. Default INBOX_SOURCE_LABELS; unknown ids show as they are. */
|
|
2736
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>;
|
|
2737
3302
|
/** Classes for the card. */
|
|
2738
3303
|
className?: string;
|
|
2739
3304
|
}
|
|
2740
3305
|
/** One inbox for events from every app: Open, Snoozed and Handled views, a source filter, and per-item
|
|
2741
3306
|
* handle, snooze and undo actions. The page owns the data and the calls; this component only renders
|
|
2742
3307
|
* and reports what was picked. Rows wrap at phone widths and the actions collapse into one menu under 480px. */
|
|
2743
|
-
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;
|
|
2744
3309
|
|
|
2745
3310
|
interface AppShellSidebar {
|
|
2746
3311
|
/** Controlled collapsed state; pair it with onCollapsedChange. */
|
|
@@ -2767,7 +3332,8 @@ interface AppShellProps {
|
|
|
2767
3332
|
brand?: ReactNode;
|
|
2768
3333
|
/** Home link on the icon and name. Default "/". */
|
|
2769
3334
|
homeHref?: string;
|
|
2770
|
-
|
|
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;
|
|
2771
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. */
|
|
2772
3338
|
nav?: NavItem[];
|
|
2773
3339
|
/** How many items the BottomNav shows before "More". Default 4; when nav.length <= 5 all fit and there is no More. */
|
|
@@ -2775,6 +3341,10 @@ interface AppShellProps {
|
|
|
2775
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`. */
|
|
2776
3342
|
moreItems?: NavItem[];
|
|
2777
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;
|
|
2778
3348
|
/** Header buttons before the theme toggle. */
|
|
2779
3349
|
actions?: ReactNode;
|
|
2780
3350
|
/** Replaces the header's ThemeToggle; false hides it. */
|
|
@@ -2808,7 +3378,7 @@ interface AppShellProps {
|
|
|
2808
3378
|
* Under 768px the BottomNav shows, from 768px the rail, from 1024px tabs in the header (or
|
|
2809
3379
|
* the sidebar). With no nav it is the signed-out frame: header, banners and page only.
|
|
2810
3380
|
*/
|
|
2811
|
-
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;
|
|
2812
3382
|
|
|
2813
3383
|
declare class ApiError extends Error {
|
|
2814
3384
|
/** HTTP status; 0 = network failure or abort-by-timeout. */
|
|
@@ -2837,15 +3407,21 @@ interface ApiConfig {
|
|
|
2837
3407
|
baseUrl?: string;
|
|
2838
3408
|
/** Called (once per response) for any 401 before the error is thrown. */
|
|
2839
3409
|
onUnauthorized?: (err: ApiError) => void;
|
|
2840
|
-
/** 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. */
|
|
2841
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;
|
|
2842
3416
|
}
|
|
2843
3417
|
/** Merges into the module-level config used by every apiFetch call. */
|
|
2844
3418
|
declare function configureApi(c: ApiConfig): void;
|
|
2845
3419
|
/** fetch with JSON in and out, a timeout, and a typed ApiError for every failure. */
|
|
2846
3420
|
declare function apiFetch<T = unknown>(path: string, o?: ApiFetchOptions): Promise<T>;
|
|
3421
|
+
|
|
2847
3422
|
interface UseResourceOptions<T> {
|
|
2848
|
-
/** 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. */
|
|
2849
3425
|
intervalMs?: number;
|
|
2850
3426
|
/** false skips fetching (dependent queries). Default true. */
|
|
2851
3427
|
enabled?: boolean;
|
|
@@ -2870,9 +3446,10 @@ interface Resource<T> {
|
|
|
2870
3446
|
updatedAt: number | undefined;
|
|
2871
3447
|
/** With intervalMs: true when the last success is older than 3 intervals. Always false without intervalMs. */
|
|
2872
3448
|
stale: boolean;
|
|
2873
|
-
/** Refetch now. Resolves when done; never rejects. */
|
|
3449
|
+
/** Refetch now (never joins a request that is already running). Resolves when done; never rejects. */
|
|
2874
3450
|
reload: () => Promise<void>;
|
|
2875
|
-
/** 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. */
|
|
2876
3453
|
mutate: (next: T | ((prev: T | undefined) => T)) => void;
|
|
2877
3454
|
}
|
|
2878
3455
|
/** key: a string identifying the request (the URL); null disables. fetcher defaults to apiFetch(key, { signal }). */
|
|
@@ -2891,39 +3468,31 @@ interface AppErrorBoundaryProps {
|
|
|
2891
3468
|
}) => void;
|
|
2892
3469
|
/** When any value changes, a shown error resets (pass [location.pathname] to reset on navigation). */
|
|
2893
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;
|
|
2894
3474
|
}
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
/** Catches render errors below it and shows a themed fallback with a way to recover. */
|
|
2899
|
-
declare class AppErrorBoundary extends Component<AppErrorBoundaryProps, State> {
|
|
2900
|
-
state: State;
|
|
2901
|
-
static getDerivedStateFromError(error: unknown): State;
|
|
2902
|
-
componentDidCatch(error: Error, info: {
|
|
2903
|
-
componentStack?: string | null;
|
|
2904
|
-
}): void;
|
|
2905
|
-
componentDidUpdate(prev: AppErrorBoundaryProps): void;
|
|
2906
|
-
reset: () => void;
|
|
2907
|
-
render(): ReactNode;
|
|
2908
|
-
}
|
|
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;
|
|
2909
3478
|
|
|
2910
3479
|
interface FilterSheetProps {
|
|
2911
3480
|
open: boolean;
|
|
2912
3481
|
onClose: () => void;
|
|
2913
|
-
/** Heading of the sheet. Default "Filters". */
|
|
3482
|
+
/** Heading of the sheet. Default: the `filters` string ("Filters"). */
|
|
2914
3483
|
title?: string;
|
|
2915
3484
|
children: ReactNode;
|
|
2916
3485
|
/** Shows a ghost "Clear" button in the footer. */
|
|
2917
3486
|
onClear?: () => void;
|
|
2918
3487
|
/** Disables Clear while it is 0. */
|
|
2919
3488
|
activeCount?: number;
|
|
2920
|
-
/** 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"). */
|
|
2921
3490
|
resultLabel?: string;
|
|
2922
3491
|
}
|
|
2923
3492
|
/** A bottom sheet for the filter controls of a FilterBar on a phone. Footer: Clear and a
|
|
2924
3493
|
* primary button that closes the sheet. */
|
|
2925
3494
|
declare function FilterSheet({ open, onClose, title, children, onClear, activeCount, resultLabel }: FilterSheetProps): react.JSX.Element | null;
|
|
2926
|
-
interface FilterBarProps {
|
|
3495
|
+
interface FilterBarProps extends Omit<ComponentPropsWithRef<'div'>, 'children'> {
|
|
2927
3496
|
/** Search box value and change handler. Leave out for no search box. */
|
|
2928
3497
|
search?: {
|
|
2929
3498
|
value: string;
|
|
@@ -2941,7 +3510,7 @@ interface FilterBarProps {
|
|
|
2941
3510
|
trailing?: ReactNode;
|
|
2942
3511
|
/** Sticks under the header (top: var(--nish-header-h)). Default false. */
|
|
2943
3512
|
sticky?: boolean;
|
|
2944
|
-
/** Title of the phone sheet. Default "Filters". */
|
|
3513
|
+
/** Title of the phone sheet. Default: the `filters` string ("Filters"). */
|
|
2945
3514
|
sheetTitle?: string;
|
|
2946
3515
|
/** Below this breakpoint the children move into the FilterSheet. Default 'md' (768); 'lg' (1024) for wide filter sets. */
|
|
2947
3516
|
sheetBelow?: 'md' | 'lg';
|
|
@@ -2951,7 +3520,7 @@ interface FilterBarProps {
|
|
|
2951
3520
|
}
|
|
2952
3521
|
/** The search and filter row of a list page. From md up the controls sit inline; below md
|
|
2953
3522
|
* they move into a bottom sheet behind a Filters button that shows how many are on. */
|
|
2954
|
-
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;
|
|
2955
3524
|
|
|
2956
3525
|
/** Where useUrlState reads and writes the query string. */
|
|
2957
3526
|
interface UrlStateAdapter {
|
|
@@ -2978,7 +3547,7 @@ declare function useUrlState<S extends UrlStateShape>(defaults: S, o?: {
|
|
|
2978
3547
|
comma?: boolean | readonly (keyof S & string)[];
|
|
2979
3548
|
}): [S, (patch: Partial<S> | ((prev: S) => Partial<S>)) => void, () => void];
|
|
2980
3549
|
|
|
2981
|
-
interface SettingsSectionProps {
|
|
3550
|
+
interface SettingsSectionProps extends Omit<ComponentPropsWithRef<'section'>, 'title' | 'children'> {
|
|
2982
3551
|
title: ReactNode;
|
|
2983
3552
|
description?: ReactNode;
|
|
2984
3553
|
id?: string;
|
|
@@ -2991,8 +3560,8 @@ interface SettingsSectionProps {
|
|
|
2991
3560
|
className?: string;
|
|
2992
3561
|
}
|
|
2993
3562
|
/** A titled group of setting rows in one unpadded Card, rows divided by a line. */
|
|
2994
|
-
declare function SettingsSection({ title, description, id, actions, compact, children, className }: SettingsSectionProps): react.JSX.Element;
|
|
2995
|
-
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'> {
|
|
2996
3565
|
label: ReactNode;
|
|
2997
3566
|
description?: ReactNode;
|
|
2998
3567
|
/** The control (Switch, Select, NumberField, Button). */
|
|
@@ -3012,7 +3581,7 @@ interface SettingRowProps {
|
|
|
3012
3581
|
className?: string;
|
|
3013
3582
|
}
|
|
3014
3583
|
/** One label + control row inside a SettingsSection. */
|
|
3015
|
-
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;
|
|
3016
3585
|
type SaveStatus = 'idle' | 'saving' | 'saved' | 'error';
|
|
3017
3586
|
/** Tracks one save: run(promise) → 'saving' → 'saved' for 1500ms (or 'error' for 3000ms, with the message) → 'idle'.
|
|
3018
3587
|
* `label` is the text for SettingRow.status: "Saving…", "Saved", the error message, or null. Rethrows nothing. */
|
|
@@ -3023,7 +3592,8 @@ declare function useSaveStatus(): {
|
|
|
3023
3592
|
tone: 'muted' | 'ok' | 'error';
|
|
3024
3593
|
run: <T>(p: Promise<T>) => Promise<T | undefined>;
|
|
3025
3594
|
};
|
|
3026
|
-
interface NumberFieldProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'defaultValue'> {
|
|
3595
|
+
interface NumberFieldProps extends Omit<InputProps, 'value' | 'onChange' | 'type' | 'defaultValue' | 'ref'> {
|
|
3596
|
+
ref?: Ref<HTMLInputElement>;
|
|
3027
3597
|
value: number | null;
|
|
3028
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. */
|
|
3029
3599
|
onCommit: (next: number | null) => void | Promise<void>;
|
|
@@ -3038,7 +3608,7 @@ interface NumberFieldProps extends Omit<InputProps, 'value' | 'onChange' | 'type
|
|
|
3038
3608
|
precision?: number;
|
|
3039
3609
|
}
|
|
3040
3610
|
/** A numeric setting that saves when you leave the field or press Enter. */
|
|
3041
|
-
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;
|
|
3042
3612
|
|
|
3043
3613
|
/** A service token as the settings page sees it: never the hash. */
|
|
3044
3614
|
interface ServiceTokenView {
|
|
@@ -3066,22 +3636,31 @@ interface UseServiceTokens {
|
|
|
3066
3636
|
/** Loads the app's service tokens from `url` (GET) and revokes one with POST `${url}/<id>/revoke`.
|
|
3067
3637
|
* The server side is `mountServiceTokenRoutes` from `@nish/ui/server/hono`. */
|
|
3068
3638
|
declare function useServiceTokens(url?: string): UseServiceTokens;
|
|
3069
|
-
interface ServiceTokensSectionProps {
|
|
3639
|
+
interface ServiceTokensSectionProps extends Omit<ComponentPropsWithRef<"section">, "title" | "children"> {
|
|
3070
3640
|
/** undefined = loading. */
|
|
3071
3641
|
tokens: ServiceTokenView[] | undefined;
|
|
3072
3642
|
error?: string | null;
|
|
3073
3643
|
onRetry?: () => void;
|
|
3074
3644
|
/** Revokes the token. Reject to keep the dialog open with the error. */
|
|
3075
3645
|
onRevoke: (id: string) => Promise<void>;
|
|
3076
|
-
/** Default "Service tokens". */
|
|
3646
|
+
/** Default: the `serviceTokens` string ("Service tokens"). */
|
|
3077
3647
|
title?: ReactNode;
|
|
3648
|
+
/** Default: the `serviceTokensIntro` string. */
|
|
3078
3649
|
description?: ReactNode;
|
|
3079
3650
|
/** Anchor id on the section. Default "service-tokens". */
|
|
3080
3651
|
id?: string;
|
|
3081
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;
|
|
3082
3661
|
}
|
|
3083
3662
|
/** The settings block that lists an app's service tokens with a Revoke button each. */
|
|
3084
|
-
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;
|
|
3085
3664
|
|
|
3086
3665
|
interface ComboboxOption {
|
|
3087
3666
|
value: string;
|
|
@@ -3090,11 +3669,19 @@ interface ComboboxOption {
|
|
|
3090
3669
|
hint?: string;
|
|
3091
3670
|
disabled?: boolean;
|
|
3092
3671
|
}
|
|
3093
|
-
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>;
|
|
3094
3675
|
options: ComboboxOption[];
|
|
3095
|
-
/** The selected option's value, or the custom text; null when nothing is selected.
|
|
3096
|
-
|
|
3097
|
-
|
|
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;
|
|
3098
3685
|
/** Filtering. Default: case-insensitive substring on label and hint; show at most 50.
|
|
3099
3686
|
* With `onQueryChange` and no `filter`, options are shown as given (the server filtered them). */
|
|
3100
3687
|
filter?: (option: ComboboxOption, query: string) => boolean;
|
|
@@ -3103,21 +3690,44 @@ interface ComboboxProps {
|
|
|
3103
3690
|
placeholder?: string;
|
|
3104
3691
|
/** Accessible name when there is no visible <label htmlFor={id}>. */
|
|
3105
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. */
|
|
3106
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;
|
|
3107
3710
|
disabled?: boolean;
|
|
3108
|
-
/** Shown when nothing matches. Default "No matches". */
|
|
3711
|
+
/** Shown when nothing matches. Default "No matches" (NishProvider strings). */
|
|
3109
3712
|
emptyText?: string;
|
|
3110
3713
|
/** Async options: called (debounced 200ms) with the query; while `loading` shows a Spinner row "Searching…". */
|
|
3111
3714
|
onQueryChange?: (q: string) => void;
|
|
3112
3715
|
loading?: boolean;
|
|
3113
3716
|
/** md h-9 (default) or sm h-8. Both grow to 44px on touch screens. */
|
|
3114
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;
|
|
3115
3724
|
className?: string;
|
|
3116
3725
|
}
|
|
3117
3726
|
/** A text input with a listbox of suggestions (ARIA 1.2 combobox). Pick from the options,
|
|
3118
3727
|
* or with `allowCustom` commit what was typed. The list sits under the input and works
|
|
3119
|
-
* inside a Modal or Drawer.
|
|
3120
|
-
|
|
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;
|
|
3121
3731
|
|
|
3122
3732
|
/** The handful of icons the shared components need, inlined so the package does not
|
|
3123
3733
|
* pin apps to one lucide-react version. 24px grid, 2px stroke, lucide geometry. */
|
|
@@ -3188,6 +3798,19 @@ declare function swapSlots(slots: string[], a: number, b: number): string[];
|
|
|
3188
3798
|
declare function narrowLayout(count: 1 | 2, n: NarrowLayout, aspect: number): LayoutNode;
|
|
3189
3799
|
declare function isValidLayout(node: LayoutNode | null, count: number): boolean;
|
|
3190
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
|
+
|
|
3191
3814
|
interface SplitDividersProps {
|
|
3192
3815
|
/** The layout being drawn. For a narrow screen, build it with `narrowLayout`. */
|
|
3193
3816
|
layout: LayoutNode;
|
|
@@ -3211,15 +3834,22 @@ interface SplitDividersProps {
|
|
|
3211
3834
|
* area stays off a pane bar shown there. Default 0.
|
|
3212
3835
|
*/
|
|
3213
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;
|
|
3214
3843
|
}
|
|
3215
3844
|
/**
|
|
3216
3845
|
* Drag handles between panes. Each is a keyboard-focusable separator: arrow keys move it 2%,
|
|
3217
|
-
*
|
|
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
|
|
3218
3848
|
* screens; a thin accent bar shows on hover, focus and drag. Place it inside a `relative` box
|
|
3219
3849
|
* that is `w` by `h` (`SplitStage` does).
|
|
3220
3850
|
*/
|
|
3221
|
-
declare function SplitDividers({ layout, w, h, gap, onResize, onDragChange, minPane, barInset }: SplitDividersProps): react.JSX.Element;
|
|
3222
|
-
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'> {
|
|
3223
3853
|
/** The layout tree; null renders no panes. Leaves cover slots 0..n-1. */
|
|
3224
3854
|
layout: LayoutNode | null;
|
|
3225
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. */
|
|
@@ -3263,8 +3893,8 @@ interface SplitStageProps {
|
|
|
3263
3893
|
* style values and never move a DOM node (a moved iframe reloads). Give the stage a size from
|
|
3264
3894
|
* its parent (for example `flex-1 min-h-0`); it measures itself.
|
|
3265
3895
|
*/
|
|
3266
|
-
declare function SplitStage({ layout, items, slots, gap, resizable, onLayoutChange, renderPane, onSize, dragging, animate, minPane, barInset, children, className, }: SplitStageProps): react.JSX.Element;
|
|
3267
|
-
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'> {
|
|
3268
3898
|
/** The layout to draw: one rounded rectangle per pane. */
|
|
3269
3899
|
node: LayoutNode;
|
|
3270
3900
|
/** Width of the drawing in px (default 56). */
|
|
@@ -3274,18 +3904,8 @@ interface LayoutPresetIconProps {
|
|
|
3274
3904
|
className?: string;
|
|
3275
3905
|
}
|
|
3276
3906
|
/** A small drawing of a layout in the current text color. Decorative: name it with a label beside it. */
|
|
3277
|
-
declare function LayoutPresetIcon({ node, width, height, className }: LayoutPresetIconProps): react.JSX.Element;
|
|
3278
|
-
interface
|
|
3279
|
-
/** The value passed to `onChange`. */
|
|
3280
|
-
id: string;
|
|
3281
|
-
/** The visible name under the icon. */
|
|
3282
|
-
label: string;
|
|
3283
|
-
/** A short explanation, shown in a tooltip and read as part of the accessible name. */
|
|
3284
|
-
hint: string;
|
|
3285
|
-
/** The layout the icon draws. */
|
|
3286
|
-
node: LayoutNode;
|
|
3287
|
-
}
|
|
3288
|
-
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'> {
|
|
3289
3909
|
/** One radio per option. */
|
|
3290
3910
|
options: LayoutPresetOption[];
|
|
3291
3911
|
/** The id of the chosen option, or null when the layout is custom (for example after a resize). */
|
|
@@ -3300,18 +3920,16 @@ interface LayoutPresetPickerProps {
|
|
|
3300
3920
|
overlay?: boolean;
|
|
3301
3921
|
/** Extra classes for the bar, for example an inset like `pr-52`. */
|
|
3302
3922
|
className?: string;
|
|
3303
|
-
/** Name of the radio group for screen readers (
|
|
3923
|
+
/** Name of the radio group for screen readers. Default: the `layoutPresets` string ("Layout presets"). */
|
|
3304
3924
|
label?: string;
|
|
3305
3925
|
}
|
|
3306
|
-
/** The preset options for a pane count, from `presetsFor`. */
|
|
3307
|
-
declare function presetOptions(count: 1 | 2 | 3 | 4): LayoutPresetOption[];
|
|
3308
3926
|
/** A bar of layout presets: one icon radio per option in a scrolling row, with a tooltip hint on each. */
|
|
3309
|
-
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;
|
|
3310
3928
|
|
|
3311
3929
|
type MediaThumbShape = 'wide' | 'round' | 'square';
|
|
3312
3930
|
type MediaThumbSize = 'sm' | 'md';
|
|
3313
|
-
interface MediaThumbProps {
|
|
3314
|
-
/** 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. */
|
|
3315
3933
|
src?: string;
|
|
3316
3934
|
/** wide: 16:9 (64x36, or 96x54 at md). round and square: 36px, or 48px at md. */
|
|
3317
3935
|
shape?: MediaThumbShape;
|
|
@@ -3322,11 +3940,12 @@ interface MediaThumbProps {
|
|
|
3322
3940
|
/** Alternative text. Empty by default: the row's title already names the item. */
|
|
3323
3941
|
alt?: string;
|
|
3324
3942
|
className?: string;
|
|
3943
|
+
ref?: Ref<HTMLSpanElement>;
|
|
3325
3944
|
}
|
|
3326
3945
|
/** A thumbnail in a fixed box: 16:9, round or square, lazy-loaded, with a fallback fill. */
|
|
3327
|
-
declare function MediaThumb({ src, shape, size, fallback, alt, className }: MediaThumbProps): react.JSX.Element;
|
|
3328
|
-
interface MediaRowProps {
|
|
3329
|
-
/** 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). */
|
|
3330
3949
|
thumbnailUrl?: string;
|
|
3331
3950
|
/** wide (16:9, default), round (channels) or square. */
|
|
3332
3951
|
thumbShape?: MediaThumbShape;
|
|
@@ -3342,6 +3961,10 @@ interface MediaRowProps {
|
|
|
3342
3961
|
detail?: ReactNode;
|
|
3343
3962
|
/** true shows a Live badge, false an Offline badge, undefined none. */
|
|
3344
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;
|
|
3345
3968
|
/** Extra badges after the live one ("On screen"). */
|
|
3346
3969
|
badges?: ReactNode;
|
|
3347
3970
|
/** A control or element at the far right, after the badges. */
|
|
@@ -3359,11 +3982,13 @@ interface MediaRowProps {
|
|
|
3359
3982
|
/** The wrapper element. Default 'li'; pass 'div' outside a list. */
|
|
3360
3983
|
as?: 'li' | 'div';
|
|
3361
3984
|
className?: string;
|
|
3985
|
+
/** The wrapper element. */
|
|
3986
|
+
ref?: Ref<HTMLElement>;
|
|
3362
3987
|
}
|
|
3363
3988
|
/** A result row: thumbnail, two-line title, meta and detail, with Live/Offline and other badges. */
|
|
3364
|
-
declare function MediaRow({ thumbnailUrl, thumbShape, thumbSize, fallback, title, meta, detail, live, badges, trailing, chevron, dense, compact, onClick, href, as, className, }: MediaRowProps): react.JSX.Element;
|
|
3365
|
-
interface MediaChipProps {
|
|
3366
|
-
/** 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). */
|
|
3367
3992
|
thumbnailUrl?: string;
|
|
3368
3993
|
/** The label; truncates. */
|
|
3369
3994
|
label: string;
|
|
@@ -3372,9 +3997,406 @@ interface MediaChipProps {
|
|
|
3372
3997
|
/** A second, never-truncated word after the label ("Bring back"). */
|
|
3373
3998
|
action?: string;
|
|
3374
3999
|
className?: string;
|
|
4000
|
+
ref?: Ref<HTMLButtonElement>;
|
|
3375
4001
|
}
|
|
3376
4002
|
/** A pill button with a 16:9 thumbnail and a label, 44px tall: a recent item or a hidden pane to bring back. */
|
|
3377
|
-
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;
|
|
3378
4400
|
|
|
3379
|
-
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 };
|
|
3380
|
-
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 };
|