nish-ui 2.0.2 → 2.1.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 +18 -8
- package/dist/chart.js +1 -1
- package/dist/elements-all.js +13 -13
- package/dist/elements-charts.js +1 -1
- package/dist/elements-data.js +1 -1
- package/dist/elements-forms.js +1 -1
- package/dist/elements.js +3 -3
- package/dist/esm/components/app-shell.js +145 -45
- package/dist/esm/components/breadcrumbs.js +1 -1
- package/dist/esm/components/calendar-classes.js +325 -0
- package/dist/esm/components/calendar.js +263 -0
- package/dist/esm/components/canvas/route.js +56 -20
- package/dist/esm/components/carousel-classes.js +27 -0
- package/dist/esm/components/carousel.js +317 -0
- package/dist/esm/components/command.js +2 -27
- package/dist/esm/components/context-menu.js +199 -0
- package/dist/esm/components/date-picker.js +208 -0
- package/dist/esm/components/display-classes.js +10 -13
- package/dist/esm/components/display.js +22 -19
- package/dist/esm/components/drawer.js +139 -0
- package/dist/esm/components/filters.js +1 -1
- package/dist/esm/components/flow.js +1 -1
- package/dist/esm/components/hover-card.js +221 -0
- package/dist/esm/components/icons.js +17 -0
- package/dist/esm/components/inbox.js +2 -1
- package/dist/esm/components/lazy-module.js +53 -0
- package/dist/esm/components/menu.js +344 -0
- package/dist/esm/components/modal.js +173 -0
- package/dist/esm/components/more-sheet.js +52 -0
- package/dist/esm/components/multi-select.js +420 -0
- package/dist/esm/components/nav-items.js +138 -0
- package/dist/esm/components/nav.js +13 -174
- package/dist/esm/components/navigate.js +33 -0
- package/dist/esm/components/overlay-core.js +221 -0
- package/dist/esm/components/overlay-dialog.js +255 -0
- package/dist/esm/components/overlay-position.js +163 -0
- package/dist/esm/components/overlay.js +7 -1441
- package/dist/esm/components/popover.js +92 -0
- package/dist/esm/components/segmented.js +2 -1
- package/dist/esm/components/split.js +1 -1
- package/dist/esm/components/strings.js +25 -0
- package/dist/esm/components/tooltip.js +177 -0
- package/dist/esm/components/tree-view-classes.js +57 -0
- package/dist/esm/components/tree-view.js +319 -0
- package/dist/esm/components/virtual-table.js +245 -0
- package/dist/esm/components/virtual.js +291 -0
- package/dist/esm/inbox.js +12 -0
- package/dist/esm/index.js +61 -2
- package/dist/esm/runtime.js +1 -1
- package/dist/esm/service-tokens.js +6 -0
- package/dist/esm/theme.js +2 -2
- package/dist/esm/virtual-range.js +73 -0
- package/dist/format.js +1 -1
- package/dist/inbox.d.ts +238 -0
- package/dist/index.d.ts +1030 -777
- package/dist/nish-components.css +2 -0
- package/dist/nish-components.min.css +1 -1
- package/dist/service-tokens.d.ts +60 -0
- package/dist/theme.d.ts +50 -0
- package/dist/theme.global.js +28 -3
- package/dist/theme.js +28 -3
- package/package.json +17 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, useLayoutEffect, HTMLAttributes, Ref, ButtonHTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes, FieldsetHTMLAttributes, ChangeEvent, MouseEvent, TextareaHTMLAttributes, ComponentPropsWithoutRef,
|
|
3
|
+
import { ReactNode, useLayoutEffect, HTMLAttributes, Ref, ButtonHTMLAttributes, InputHTMLAttributes, SelectHTMLAttributes, FieldsetHTMLAttributes, ChangeEvent, MouseEvent, TextareaHTMLAttributes, ComponentPropsWithoutRef, RefObject, ReactElement, ComponentProps, ElementType, ComponentPropsWithRef, SVGProps } from 'react';
|
|
4
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
|
+
export { DEFAULT_INBOX_LABELS, INBOX_ACTION_HEADER, INBOX_ACTION_TIMEOUT_MS, INBOX_DEFAULT_SETTINGS, INBOX_SOURCE_LABELS, Inbox, InboxAction, InboxActionCall, InboxActionResult, InboxItem, InboxLabels, InboxListResponse, InboxProps, InboxSettings, InboxSeverity, InboxView } from './inbox.js';
|
|
6
|
+
export { ServiceTokenListResponse, ServiceTokenView, ServiceTokensSection, ServiceTokensSectionProps, useServiceTokens } from './service-tokens.js';
|
|
5
7
|
|
|
6
8
|
/** Conditional Tailwind classes with conflict resolution. */
|
|
7
9
|
declare function cn(...inputs: ClassValue[]): string;
|
|
@@ -44,6 +46,10 @@ interface NishStrings {
|
|
|
44
46
|
menu: string;
|
|
45
47
|
/** DropdownMenu sub-menu header, read by screen readers before the parent label. */
|
|
46
48
|
back: string;
|
|
49
|
+
/** ContextMenu: the menu's accessible name when no menuLabel is given. */
|
|
50
|
+
contextMenu: string;
|
|
51
|
+
/** VirtualTable: live-region message after the sort changes (dir null when cleared). */
|
|
52
|
+
sortAnnounce: (header: string, dir: 'asc' | 'desc' | null) => string;
|
|
47
53
|
/** Toast, Callout: dismiss button. */
|
|
48
54
|
dismiss: string;
|
|
49
55
|
/** Callout: badge label for a repeat count. */
|
|
@@ -78,6 +84,52 @@ interface NishStrings {
|
|
|
78
84
|
clear: string;
|
|
79
85
|
/** Combobox: loading row. */
|
|
80
86
|
searching: string;
|
|
87
|
+
/** DatePicker: custom validity message for text that is not a date. */
|
|
88
|
+
invalidDate: string;
|
|
89
|
+
/** DatePicker: calendar button name while empty. */
|
|
90
|
+
chooseDate: string;
|
|
91
|
+
/** DatePicker: calendar button name once a date is set. */
|
|
92
|
+
changeDate: (date: string) => string;
|
|
93
|
+
/** Calendar: previous month button. */
|
|
94
|
+
previousMonth: string;
|
|
95
|
+
/** Calendar: next month button. */
|
|
96
|
+
nextMonth: string;
|
|
97
|
+
/** Calendar: month select name. */
|
|
98
|
+
month: string;
|
|
99
|
+
/** Calendar: year select name. */
|
|
100
|
+
year: string;
|
|
101
|
+
/** DatePicker: day token in the placeholder. */
|
|
102
|
+
dayToken: string;
|
|
103
|
+
/** DatePicker: month token in the placeholder. */
|
|
104
|
+
monthToken: string;
|
|
105
|
+
/** DatePicker: year token in the placeholder. */
|
|
106
|
+
yearToken: string;
|
|
107
|
+
/** MultiSelect: announcement after a value is added. */
|
|
108
|
+
optionAdded: (label: string) => string;
|
|
109
|
+
/** MultiSelect: announcement after a value is removed. */
|
|
110
|
+
optionRemoved: (label: string) => string;
|
|
111
|
+
/** MultiSelect: clear-all button. */
|
|
112
|
+
clearAll: string;
|
|
113
|
+
/** MultiSelect: announcement when the pick limit is reached. */
|
|
114
|
+
maxSelected: (max: number) => string;
|
|
115
|
+
/** Carousel: role description of the region. */
|
|
116
|
+
carouselRole: string;
|
|
117
|
+
/** Carousel: role description of each slide. */
|
|
118
|
+
slideRole: string;
|
|
119
|
+
/** Carousel: label of each slide. */
|
|
120
|
+
slideLabel: (n: number, count: number) => string;
|
|
121
|
+
/** Carousel: previous slide button. */
|
|
122
|
+
previousSlide: string;
|
|
123
|
+
/** Carousel: next slide button. */
|
|
124
|
+
nextSlide: string;
|
|
125
|
+
/** Carousel: slide picker dot name. */
|
|
126
|
+
goToSlide: (n: number) => string;
|
|
127
|
+
/** Carousel: label of the slide picker group. */
|
|
128
|
+
slidePicker: string;
|
|
129
|
+
/** Carousel: start auto-rotation button. */
|
|
130
|
+
startRotation: string;
|
|
131
|
+
/** Carousel: stop auto-rotation button. */
|
|
132
|
+
stopRotation: string;
|
|
81
133
|
/** CommandPalette: input placeholder. */
|
|
82
134
|
searchPlaceholder: string;
|
|
83
135
|
/** CommandPalette: nothing found. */
|
|
@@ -1275,22 +1327,6 @@ interface ToasterProps extends Omit<ComponentPropsWithoutRef<'div'>, 'className'
|
|
|
1275
1327
|
* the screen on phones while a sheet or dialog is open (html[data-nish-layer-open]). */
|
|
1276
1328
|
declare function Toaster({ className, offset, offsetUntil, style: userStyle, ref, ...rest }: ToasterProps): react.JSX.Element;
|
|
1277
1329
|
|
|
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;
|
|
1293
|
-
|
|
1294
1330
|
interface ModalProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title' | 'children' | 'className'> {
|
|
1295
1331
|
/** Heading of the dialog; also its accessible name. Optional only when `header`
|
|
1296
1332
|
* replaces the title row (then pass `aria-label`). */
|
|
@@ -1348,6 +1384,36 @@ interface ModalProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title' | 'ch
|
|
|
1348
1384
|
* locks page scroll (on both <html> and <body>) while open. Renders through a Portal:
|
|
1349
1385
|
* nothing on the server. */
|
|
1350
1386
|
declare function Modal({ open, ...props }: ModalProps): react.JSX.Element | null;
|
|
1387
|
+
interface ConfirmDialogProps {
|
|
1388
|
+
/** The question, e.g. "Delete this tracker?". Also the dialog's name. */
|
|
1389
|
+
title: ReactNode;
|
|
1390
|
+
/** What happens if they confirm. Keep it to a sentence or two. The dialog's description. */
|
|
1391
|
+
body?: ReactNode;
|
|
1392
|
+
/** The confirm button's label: a verb that names the action ("Delete", "Archive"). */
|
|
1393
|
+
confirmLabel: string;
|
|
1394
|
+
/** The cancel button's label. Default "Cancel" (or the provider's `cancel` string). */
|
|
1395
|
+
cancelLabel?: string;
|
|
1396
|
+
/** danger (default): a red confirm button, and focus starts on Cancel. primary: an
|
|
1397
|
+
* accent confirm button that takes the first focus. */
|
|
1398
|
+
tone?: 'danger' | 'primary';
|
|
1399
|
+
/** The action is running: the confirm button shows a spinner, and Cancel, Escape and
|
|
1400
|
+
* the backdrop are held off until it finishes. */
|
|
1401
|
+
pending?: boolean;
|
|
1402
|
+
/** Runs the action. Close the dialog (unmount it) when it is done. */
|
|
1403
|
+
onConfirm: () => void;
|
|
1404
|
+
/** Called on Cancel, Escape and a backdrop click. Unmount the dialog here (or set
|
|
1405
|
+
* `open` to false). Optional when `onOpenChange` is used. */
|
|
1406
|
+
onCancel?: () => void;
|
|
1407
|
+
/** Controlled open state. When given, the dialog renders only while it is true. When
|
|
1408
|
+
* omitted, a mounted ConfirmDialog is open. */
|
|
1409
|
+
open?: boolean;
|
|
1410
|
+
/** Called with false on Cancel, Escape and a backdrop click, together with `onCancel`. */
|
|
1411
|
+
onOpenChange?: (open: boolean) => void;
|
|
1412
|
+
}
|
|
1413
|
+
/** A yes-or-no question before an action, in place of `window.confirm`: a small
|
|
1414
|
+
* Modal (role="alertdialog") with Cancel and a confirm button. */
|
|
1415
|
+
declare function ConfirmDialog({ title, body, confirmLabel, cancelLabel, tone, pending, onConfirm, onCancel, open, onOpenChange, }: ConfirmDialogProps): react.JSX.Element;
|
|
1416
|
+
|
|
1351
1417
|
interface DrawerProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title' | 'children' | 'className'> {
|
|
1352
1418
|
/** Heading of the drawer; also its accessible name unless `aria-label` is set. Optional
|
|
1353
1419
|
* only when you pass `aria-label` or `aria-labelledby`. */
|
|
@@ -1399,35 +1465,10 @@ interface DrawerProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title' | 'c
|
|
|
1399
1465
|
* click, returns focus to the opener and locks page scroll. Renders through a Portal:
|
|
1400
1466
|
* nothing on the server. */
|
|
1401
1467
|
declare function Drawer({ open, ...props }: DrawerProps): react.JSX.Element | null;
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
body?: ReactNode;
|
|
1407
|
-
/** The confirm button's label: a verb that names the action ("Delete", "Archive"). */
|
|
1408
|
-
confirmLabel: string;
|
|
1409
|
-
/** The cancel button's label. Default "Cancel" (or the provider's `cancel` string). */
|
|
1410
|
-
cancelLabel?: string;
|
|
1411
|
-
/** danger (default): a red confirm button, and focus starts on Cancel. primary: an
|
|
1412
|
-
* accent confirm button that takes the first focus. */
|
|
1413
|
-
tone?: 'danger' | 'primary';
|
|
1414
|
-
/** The action is running: the confirm button shows a spinner, and Cancel, Escape and
|
|
1415
|
-
* the backdrop are held off until it finishes. */
|
|
1416
|
-
pending?: boolean;
|
|
1417
|
-
/** Runs the action. Close the dialog (unmount it) when it is done. */
|
|
1418
|
-
onConfirm: () => void;
|
|
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;
|
|
1427
|
-
}
|
|
1428
|
-
/** A yes-or-no question before an action, in place of `window.confirm`: a small
|
|
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;
|
|
1468
|
+
|
|
1469
|
+
/** Why a Popover or DropdownMenu closed itself: Escape, a press outside, or Tab out. */
|
|
1470
|
+
type PopoverCloseReason = 'escape' | 'outside' | 'tab';
|
|
1471
|
+
|
|
1431
1472
|
interface TooltipProps extends Omit<ComponentPropsWithoutRef<'span'>, 'children' | 'className'> {
|
|
1432
1473
|
/** What the tooltip says. Keep it to a sentence or two. */
|
|
1433
1474
|
tip: ReactNode;
|
|
@@ -1458,8 +1499,7 @@ interface TooltipProps extends Omit<ComponentPropsWithoutRef<'span'>, 'children'
|
|
|
1458
1499
|
* flipped and clamped to stay on screen. Escape dismisses it, and the pointer can move
|
|
1459
1500
|
* onto it (WCAG 1.4.13). */
|
|
1460
1501
|
declare function Tooltip({ tip, children, className, side, as, focusable, variant, ref, ...rest }: TooltipProps): react.JSX.Element;
|
|
1461
|
-
|
|
1462
|
-
type PopoverCloseReason = 'escape' | 'outside' | 'tab';
|
|
1502
|
+
|
|
1463
1503
|
interface PopoverProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className'> {
|
|
1464
1504
|
/** Whether the panel shows. The popover is controlled: pair it with `onOpenChange`. */
|
|
1465
1505
|
open: boolean;
|
|
@@ -1493,6 +1533,7 @@ interface PopoverProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'
|
|
|
1493
1533
|
* Escape and a press outside close it; focus returns to the anchor. Renders nothing on
|
|
1494
1534
|
* the server. */
|
|
1495
1535
|
declare function Popover({ open, onOpenChange, dismissOnOutside, anchor, side, align, width, 'aria-label': ariaLabel, className, children, ref, style, onKeyDown: userKeyDown, ...rest }: PopoverProps): react.ReactPortal | null;
|
|
1536
|
+
|
|
1496
1537
|
interface DropdownMenuProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className' | 'onChange'> {
|
|
1497
1538
|
/** The button that opens the menu (a Button or IconButton). It gets aria-haspopup,
|
|
1498
1539
|
* aria-expanded and aria-controls, opens on click, and on ArrowDown / ArrowUp. */
|
|
@@ -1574,41 +1615,49 @@ interface MenuSubHeaderProps extends Omit<ComponentPropsWithoutRef<'button'>, 'o
|
|
|
1574
1615
|
/** The first row of a submenu view shown in place: a back arrow and the view's title. */
|
|
1575
1616
|
declare function MenuSubHeader({ onBack, children, className, ref, onKeyDown, ...rest }: MenuSubHeaderProps): react.JSX.Element;
|
|
1576
1617
|
|
|
1618
|
+
interface MenuItemClassOptions {
|
|
1619
|
+
/** The current choice: the highlighted look (set aria-current on the row too). */
|
|
1620
|
+
active?: boolean;
|
|
1621
|
+
/** A destructive action: loss-colored text and hover. */
|
|
1622
|
+
danger?: boolean;
|
|
1623
|
+
/** The disabled look (set disabled or aria-disabled on the row too). */
|
|
1624
|
+
disabled?: boolean;
|
|
1625
|
+
/** Extra classes, merged last. */
|
|
1626
|
+
className?: string;
|
|
1627
|
+
}
|
|
1628
|
+
/** The classes `<MenuItem>` renders, for menu-looking rows that are not in a
|
|
1629
|
+
* DropdownMenu: tabbable buttons in a Popover panel that also holds IconButtons,
|
|
1630
|
+
* inputs or color pickers. The rows keep their own roles (plain buttons, Tab order);
|
|
1631
|
+
* hover and keyboard focus get the same highlight as MenuItem. */
|
|
1632
|
+
declare function menuItemClass({ active, danger, disabled, className }?: MenuItemClassOptions): string;
|
|
1633
|
+
|
|
1577
1634
|
/** Status tones shared by the display components. */
|
|
1578
1635
|
type StatusTone = 'ok' | 'warn' | 'loss' | 'info' | 'accent' | 'neutral';
|
|
1579
1636
|
type CalloutTone = 'neutral' | 'accent' | 'info' | 'ok' | 'warn' | 'loss';
|
|
1580
|
-
/**
|
|
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
|
-
|
|
1637
|
+
/** @internal */
|
|
1595
1638
|
declare const DOT_SIZE: {
|
|
1596
1639
|
readonly xs: "size-1.5";
|
|
1597
1640
|
readonly sm: "size-2";
|
|
1598
1641
|
readonly md: "size-2.5";
|
|
1599
1642
|
readonly lg: "size-3.5";
|
|
1600
1643
|
};
|
|
1644
|
+
/** ok for a positive number, loss for a negative one, neutral for zero or nothing.
|
|
1645
|
+
* Replaces `n >= 0 ? gain : loss` ternaries. */
|
|
1646
|
+
declare function signTone(n: number | null | undefined): 'ok' | 'loss' | 'neutral';
|
|
1647
|
+
/** @internal */
|
|
1601
1648
|
declare const STAT_VALUE_SIZE: {
|
|
1602
1649
|
readonly sm: "text-base";
|
|
1603
1650
|
readonly md: "text-xl";
|
|
1604
1651
|
readonly lg: "text-2xl";
|
|
1605
1652
|
};
|
|
1653
|
+
/** @internal */
|
|
1606
1654
|
declare const GRID_BASE: {
|
|
1607
1655
|
readonly 1: "grid-cols-1";
|
|
1608
1656
|
readonly 2: "grid-cols-2";
|
|
1609
1657
|
readonly 3: "grid-cols-3";
|
|
1610
1658
|
readonly 4: "grid-cols-4";
|
|
1611
1659
|
};
|
|
1660
|
+
/** @internal */
|
|
1612
1661
|
declare const GRID_MD: {
|
|
1613
1662
|
readonly 2: "md:grid-cols-2";
|
|
1614
1663
|
readonly 3: "md:grid-cols-3";
|
|
@@ -1616,11 +1665,24 @@ declare const GRID_MD: {
|
|
|
1616
1665
|
readonly 5: "md:grid-cols-5";
|
|
1617
1666
|
readonly 6: "md:grid-cols-6";
|
|
1618
1667
|
};
|
|
1668
|
+
/** ok, warn or loss for a value against two thresholds. When loss is above warn, higher
|
|
1669
|
+
* is worse (disk use: { warn: 75, loss: 90 }). When loss is below warn, lower is worse
|
|
1670
|
+
* (battery: { warn: 30, loss: 10 }). */
|
|
1671
|
+
declare function toneFor(value: number, t: {
|
|
1672
|
+
warn: number;
|
|
1673
|
+
loss: number;
|
|
1674
|
+
}): 'ok' | 'warn' | 'loss';
|
|
1675
|
+
type ChartTone$1 = `chart-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}`;
|
|
1676
|
+
type MeterTone = 'accent' | 'ok' | 'warn' | 'loss' | 'info' | 'neutral' | ChartTone$1;
|
|
1677
|
+
/** @internal */
|
|
1619
1678
|
declare const METER_THICK: {
|
|
1620
1679
|
readonly xs: "h-1";
|
|
1621
1680
|
readonly sm: "h-1.5";
|
|
1622
1681
|
readonly md: "h-2.5";
|
|
1623
1682
|
};
|
|
1683
|
+
type SparklineTone = ChartTone$1 | 'accent' | 'ok' | 'warn' | 'loss' | 'info';
|
|
1684
|
+
type ChartLegendTone = ChartTone$1 | 'accent' | 'ok' | 'warn' | 'loss' | 'info';
|
|
1685
|
+
|
|
1624
1686
|
interface CalloutProps extends Omit<ComponentPropsWithoutRef<'div'>, 'title' | 'onClick'> {
|
|
1625
1687
|
/** The root element. */
|
|
1626
1688
|
ref?: Ref<HTMLDivElement>;
|
|
@@ -2098,128 +2160,559 @@ interface TrProps extends ComponentProps<'tr'> {
|
|
|
2098
2160
|
/** A body row with a divider. */
|
|
2099
2161
|
declare function Tr({ tone, interactive, muted, className, ...rest }: TrProps): react.JSX.Element;
|
|
2100
2162
|
|
|
2101
|
-
|
|
2102
|
-
/** What was picked: 'system' or a theme name. */
|
|
2103
|
-
choice: ThemeChoice;
|
|
2104
|
-
/** What is rendering now. */
|
|
2105
|
-
theme: ThemeName;
|
|
2106
|
-
/** dark or light: what the rendering theme is based on. */
|
|
2107
|
-
scheme: 'dark' | 'light';
|
|
2108
|
-
/** Save a choice (cookie and localStorage) and apply it. */
|
|
2109
|
-
setChoice: (choice: ThemeChoice) => void;
|
|
2110
|
-
}
|
|
2111
|
-
/** The current theme choice and what it renders as, kept in sync across tabs and
|
|
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. */
|
|
2115
|
-
declare function useTheme(): ThemeState;
|
|
2116
|
-
interface ThemeToggleProps {
|
|
2117
|
-
/** Also offer the extra presets (slate, terminal, …) in a select. */
|
|
2118
|
-
presets?: boolean;
|
|
2119
|
-
/** Show "System", "Light" and "Dark" text beside the icons. */
|
|
2120
|
-
labels?: boolean;
|
|
2121
|
-
/** Fill the container's width, with equal-width segments. */
|
|
2122
|
-
block?: boolean;
|
|
2123
|
-
/** sm: 28px segments (default). md: 32px. Both grow to 44px on touch screens. */
|
|
2124
|
-
size?: 'sm' | 'md';
|
|
2125
|
-
/** One icon button that cycles System, Light, Dark and shows the current choice; for
|
|
2126
|
-
* collapsed sidebars and tight headers. Ignores labels, block and presets. */
|
|
2127
|
-
compact?: boolean;
|
|
2128
|
-
/** segmented: the System / Light / Dark radio group (default). pill: one cycling
|
|
2129
|
-
* button in a 44px pill with a line-strong border, to sit next to the hub pill in a
|
|
2130
|
-
* top bar (the React twin of .nish-theme-btn--pill). With labels, the pill also shows
|
|
2131
|
-
* the current choice as a word (.nish-theme-btn--labelled). Ignores block and presets. */
|
|
2132
|
-
variant?: 'segmented' | 'pill';
|
|
2133
|
-
/** What the segmented toggle shows below 640px. compact (default): the one cycling
|
|
2134
|
-
* button, so a phone header keeps to one row. segmented: the radio group at every
|
|
2135
|
-
* width. A block toggle is always segmented. */
|
|
2136
|
-
phone?: 'compact' | 'segmented';
|
|
2137
|
-
/** sm (default): the segmented toggle collapses to the cycling button below 640px (see
|
|
2138
|
-
* `phone`). never: it keeps the segmented control and the presets select at every
|
|
2139
|
-
* width, for a drawer or settings page that has the room. */
|
|
2140
|
-
collapse?: 'sm' | 'never';
|
|
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>;
|
|
2147
|
-
}
|
|
2148
|
-
/** System / Light / Dark as a Segmented radio group, optionally with a preset picker,
|
|
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;
|
|
2163
|
+
type ScrollAlign = 'auto' | 'start' | 'center' | 'end';
|
|
2152
2164
|
|
|
2153
|
-
interface
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
/**
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
/**
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
/**
|
|
2174
|
-
|
|
2175
|
-
/**
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
/**
|
|
2182
|
-
|
|
2183
|
-
/** Called with the
|
|
2184
|
-
|
|
2185
|
-
/**
|
|
2186
|
-
|
|
2187
|
-
/**
|
|
2188
|
-
|
|
2189
|
-
name
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
/** xs: 24px for dense widget headers. sm: 28px (default). md: 32px. All grow to 44px
|
|
2195
|
-
* on touch screens. */
|
|
2196
|
-
size?: 'xs' | 'sm' | 'md';
|
|
2197
|
-
/** Fill the container's width, with equal-width options. */
|
|
2198
|
-
block?: boolean;
|
|
2199
|
-
/** Too many options for the width: scroll (default) keeps one row that scrolls sideways
|
|
2200
|
-
* with edge fades and keeps the selected option in view; wrap lets the control grow
|
|
2201
|
-
* past its container as before. */
|
|
2202
|
-
overflow?: 'wrap' | 'scroll';
|
|
2203
|
-
/** @deprecated Alias of `block`; use `block`. Kept because the spec names it. */
|
|
2204
|
-
fullWidth?: boolean;
|
|
2165
|
+
interface ScrollToIndexOptions {
|
|
2166
|
+
/** Where the row lands: 'auto' (default) scrolls only as far as needed, or 'start', 'center', 'end'. */
|
|
2167
|
+
align?: ScrollAlign;
|
|
2168
|
+
/** 'auto' (default) jumps; 'smooth' animates. */
|
|
2169
|
+
behavior?: 'auto' | 'smooth';
|
|
2170
|
+
}
|
|
2171
|
+
interface VirtualListHandle {
|
|
2172
|
+
/** Scrolls so row `index` (clamped into range) shows. */
|
|
2173
|
+
scrollToIndex(index: number, options?: ScrollToIndexOptions): void;
|
|
2174
|
+
}
|
|
2175
|
+
interface VirtualListProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className'> {
|
|
2176
|
+
/** How many rows there are. */
|
|
2177
|
+
count: number;
|
|
2178
|
+
/** Renders row `index`. Keep it stable (useCallback): only the rendered rows call it. */
|
|
2179
|
+
renderItem: (index: number) => ReactNode;
|
|
2180
|
+
/** A stable key for row `index` (the row's id). Default: the index. Measured heights are kept per key. */
|
|
2181
|
+
itemKey?: (index: number) => string | number;
|
|
2182
|
+
/** Row height in px: a number for rows that are all the same height, or a function returning each
|
|
2183
|
+
* row's height (or estimate, with `measure`). Do not include `gap`. */
|
|
2184
|
+
itemSize: number | ((index: number) => number);
|
|
2185
|
+
/** Measures every rendered row and uses its real height (rows that wrap or expand). Default false. */
|
|
2186
|
+
measure?: boolean;
|
|
2187
|
+
/** Space between rows in px. Default 0. */
|
|
2188
|
+
gap?: number;
|
|
2189
|
+
/** Height of the list's own scroll box (px or any CSS length). Leave it out to scroll with the page. */
|
|
2190
|
+
height?: number | string;
|
|
2191
|
+
/** Rows rendered above and below the visible ones. Default 6. */
|
|
2192
|
+
overscan?: number;
|
|
2193
|
+
/** Rows rendered on the server and before the first measurement. Default 20. */
|
|
2194
|
+
initialCount?: number;
|
|
2195
|
+
/** Called with the rendered range (start included, end excluded) when it changes: load more when end nears count. */
|
|
2196
|
+
onRangeChange?: (start: number, end: number) => void;
|
|
2197
|
+
/** Shown instead of the list when count is 0. Default: nothing. */
|
|
2198
|
+
empty?: ReactNode;
|
|
2199
|
+
/** Receives { scrollToIndex }. */
|
|
2200
|
+
apiRef?: Ref<VirtualListHandle>;
|
|
2201
|
+
/** Accessible name of the list (role="list"). Give this or aria-labelledby. */
|
|
2202
|
+
'aria-label'?: string;
|
|
2203
|
+
/** Id of the element that names the list. */
|
|
2204
|
+
'aria-labelledby'?: string;
|
|
2205
|
+
/** Classes for the root (the scroll box when `height` is set). */
|
|
2205
2206
|
className?: string;
|
|
2207
|
+
/** Classes for each row wrapper. */
|
|
2208
|
+
itemClassName?: string;
|
|
2209
|
+
/** The root element. */
|
|
2210
|
+
ref?: Ref<HTMLDivElement>;
|
|
2206
2211
|
}
|
|
2207
|
-
/** A
|
|
2208
|
-
|
|
2209
|
-
* glance in light themes too. Arrow keys, Home and End move the choice and the focus,
|
|
2210
|
-
* like a native radio group. For multi-select toggles use ChipGroup and Chip. */
|
|
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;
|
|
2212
|
+
/** A long list that renders only the rows near the viewport, in its own scroll box or with the page. */
|
|
2213
|
+
declare function VirtualList({ count, renderItem, itemKey, itemSize, measure, gap, height, overscan, initialCount, onRangeChange, empty, apiRef, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, className, itemClassName, ref, style, ...rest }: VirtualListProps): react.JSX.Element;
|
|
2212
2214
|
|
|
2213
|
-
/**
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2215
|
+
/** One column of a ResponsiveTable. */
|
|
2216
|
+
interface Column<T> {
|
|
2217
|
+
/** Stable id; also the key of the sort. */
|
|
2218
|
+
key: string;
|
|
2219
|
+
/** The header text (also the label in cards and in the sort menu). */
|
|
2220
|
+
header: string;
|
|
2221
|
+
/** Renders the cell for a row. */
|
|
2222
|
+
cell: (row: T) => ReactNode;
|
|
2223
|
+
/** Makes the column sortable: the comparable value of a row. null sorts last. */
|
|
2224
|
+
sortValue?: (row: T) => string | number | null;
|
|
2225
|
+
/** A number column: right-aligned, tabular, no wrapping. */
|
|
2226
|
+
numeric?: boolean;
|
|
2227
|
+
/** In cards, this column is the title. */
|
|
2228
|
+
primary?: boolean;
|
|
2229
|
+
/** In cards, this column is the subtitle under the title. */
|
|
2230
|
+
secondary?: boolean;
|
|
2231
|
+
/** Hides the column in the table below this breakpoint. */
|
|
2232
|
+
hideBelow?: 'sm' | 'md' | 'lg';
|
|
2233
|
+
/** A CSS width for the header cell, e.g. '8rem'. */
|
|
2234
|
+
width?: string;
|
|
2235
|
+
}
|
|
2236
|
+
/** The sort of a ResponsiveTable: a column key and a direction, or null for none. */
|
|
2237
|
+
type Sort = {
|
|
2238
|
+
key: string;
|
|
2239
|
+
dir: 'asc' | 'desc';
|
|
2240
|
+
} | null;
|
|
2241
|
+
type CardsBelow = 'sm' | 'md' | 'lg';
|
|
2242
|
+
/** Words a ResponsiveTable says about sorting. English by default. */
|
|
2243
|
+
interface SortText {
|
|
2244
|
+
/** The live-region message after the sort changes (dir is null when it is cleared). */
|
|
2245
|
+
announce?: (header: string, dir: 'asc' | 'desc' | null) => string;
|
|
2246
|
+
/** The label of the card-mode direction button, given the current direction. */
|
|
2247
|
+
toggle?: (dir: 'asc' | 'desc' | null) => string;
|
|
2248
|
+
}
|
|
2249
|
+
interface ResponsiveTableProps<T> extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2250
|
+
/** The data. */
|
|
2251
|
+
rows: T[];
|
|
2252
|
+
/** The columns, in table order. Keep the array stable (module level or useMemo): rows only
|
|
2253
|
+
* skip re-rendering while it is the same array. Sorting does not depend on it. */
|
|
2254
|
+
columns: Column<T>[];
|
|
2255
|
+
/** A stable key for a row. */
|
|
2256
|
+
rowKey: (row: T) => string;
|
|
2257
|
+
/** Below this breakpoint the rows become cards. Default 'md'. */
|
|
2258
|
+
cardsBelow?: CardsBelow;
|
|
2259
|
+
/** Called when a row (or card) is activated by click, Enter or Space. */
|
|
2260
|
+
onRowClick?: (row: T) => void;
|
|
2261
|
+
/** Makes each row a link to this URL (cards become real anchors). A URL that is not safe
|
|
2262
|
+
* (javascript:, data:) is ignored: the row does not navigate. */
|
|
2263
|
+
rowHref?: (row: T) => string;
|
|
2264
|
+
/** Called with the URL when a row is activated by click or key, so a router can navigate
|
|
2265
|
+
* without a page reload. Without it the table assigns `location`. Card links stay real
|
|
2266
|
+
* anchors. */
|
|
2267
|
+
onNavigate?: (href: string) => void;
|
|
2268
|
+
/** A 3px edge at the start of a row: ok, warn or loss. Say the status in a cell too. */
|
|
2269
|
+
rowTone?: (row: T) => 'ok' | 'warn' | 'loss' | undefined;
|
|
2270
|
+
/** The current sort, when you control it. */
|
|
2271
|
+
sort?: Sort;
|
|
2272
|
+
/** Called with the next sort. With sort or onSortChange given you sort the rows
|
|
2273
|
+
* yourself; without them the table sorts by each column's sortValue. */
|
|
2274
|
+
onSortChange?: (sort: Sort) => void;
|
|
2275
|
+
/** The table's minimum width before it scrolls sideways. Default 640. */
|
|
2276
|
+
minWidth?: number | string;
|
|
2277
|
+
/** Keeps the header visible while the body scrolls (give maxHeight too). */
|
|
2278
|
+
stickyHeader?: boolean;
|
|
2279
|
+
/** Caps the table's height; the body scrolls inside. */
|
|
2280
|
+
maxHeight?: number | string;
|
|
2281
|
+
/** Pins the first column while the table scrolls sideways. */
|
|
2282
|
+
stickyFirstColumn?: boolean;
|
|
2283
|
+
/** Shows skeleton rows (table) or skeleton cards instead of the data. */
|
|
2284
|
+
loading?: boolean;
|
|
2285
|
+
/** Shown when there are no rows. Default: the "nothingHere" string. */
|
|
2286
|
+
empty?: ReactNode;
|
|
2287
|
+
/** Shows an ErrorState instead of the data. */
|
|
2288
|
+
error?: {
|
|
2289
|
+
message: string;
|
|
2290
|
+
onRetry?: () => void;
|
|
2291
|
+
} | null;
|
|
2292
|
+
/** The accessible name of the table and the card list. */
|
|
2293
|
+
label: string;
|
|
2294
|
+
/** Renders a whole card yourself (inside the card's button or link). */
|
|
2295
|
+
renderCard?: (row: T) => ReactNode;
|
|
2296
|
+
/** Replaces the English sort announcement and direction-button label. */
|
|
2297
|
+
sortText?: SortText;
|
|
2298
|
+
className?: string;
|
|
2299
|
+
ref?: Ref<HTMLDivElement>;
|
|
2300
|
+
}
|
|
2301
|
+
/**
|
|
2302
|
+
* A table on wide screens and a list of cards on phones, from one column definition.
|
|
2303
|
+
* Sortable headers (and a sort menu in card mode), clickable or linked rows, a status
|
|
2304
|
+
* edge per row, loading, empty and error states built in. A sort change is announced to
|
|
2305
|
+
* screen readers.
|
|
2306
|
+
*/
|
|
2307
|
+
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;
|
|
2308
|
+
interface ListRowProps extends Omit<ComponentPropsWithoutRef<'li'>, 'title' | 'onClick' | 'children' | 'className'> {
|
|
2309
|
+
/** A leading icon or avatar (kept at its size). */
|
|
2310
|
+
icon?: ReactNode;
|
|
2311
|
+
/** The main line; truncates, or wraps to two lines with `titleLines={2}`. */
|
|
2312
|
+
title: ReactNode;
|
|
2313
|
+
/** How many lines the title may use before it is cut off. Default 1 (truncates). */
|
|
2314
|
+
titleLines?: 1 | 2;
|
|
2315
|
+
/** A quieter line under the title; up to two lines. */
|
|
2316
|
+
subtitle?: ReactNode;
|
|
2317
|
+
/** A right-aligned detail: a date, an amount. */
|
|
2318
|
+
meta?: ReactNode;
|
|
2319
|
+
/** A control or badge at the far right (outside the meta). */
|
|
2320
|
+
trailing?: ReactNode;
|
|
2321
|
+
/** Makes the whole row a link. A URL that is not safe (javascript:, data:) makes it a plain row. */
|
|
2322
|
+
href?: string;
|
|
2323
|
+
/** Makes the whole row a button. */
|
|
2324
|
+
onClick?: () => void;
|
|
2325
|
+
/** The current item: accent tint and aria-current. */
|
|
2326
|
+
active?: boolean;
|
|
2327
|
+
/** danger: the title turns loss-red. */
|
|
2328
|
+
tone?: 'danger';
|
|
2329
|
+
/** Shows a chevron. On by default for a link. */
|
|
2330
|
+
chevron?: boolean;
|
|
2331
|
+
/** A 44px row instead of 52px. */
|
|
2332
|
+
dense?: boolean;
|
|
2333
|
+
/** Dense, with an 11px title and 10px subtitle and meta: for small widget tiles. Keeps the 44px target. */
|
|
2334
|
+
compact?: boolean;
|
|
2335
|
+
/** Opens the link in a new tab with an external icon. */
|
|
2336
|
+
external?: boolean;
|
|
2337
|
+
/** Classes for the row itself (the link, button or box inside the wrapper). */
|
|
2338
|
+
className?: string;
|
|
2339
|
+
/** The wrapper element. Default 'li'; pass 'div' outside a list. */
|
|
2340
|
+
as?: 'li' | 'div';
|
|
2341
|
+
/** The wrapper element. */
|
|
2342
|
+
ref?: Ref<HTMLElement>;
|
|
2343
|
+
}
|
|
2344
|
+
/** A list row: icon, title, subtitle, meta and a chevron, where the whole row is the link or button. */
|
|
2345
|
+
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;
|
|
2346
|
+
interface FaviconProps extends Omit<ComponentPropsWithoutRef<'img'>, 'src' | 'width' | 'height' | 'alt' | 'children' | 'loading' | 'referrerPolicy' | 'onLoad' | 'onError'> {
|
|
2347
|
+
/** The site's address; only the host is used. */
|
|
2348
|
+
url: string;
|
|
2349
|
+
/** Width and height in px. Default 16. */
|
|
2350
|
+
size?: number;
|
|
2351
|
+
/** The text whose first letter fills the fallback avatar. Default: the host name. */
|
|
2352
|
+
label?: string;
|
|
2353
|
+
/** An image to show for this site, used as is (https, http or relative; unsafe URLs are ignored). */
|
|
2354
|
+
src?: string;
|
|
2355
|
+
/** Turns the host and size into an image URL, or null for the letter avatar. Wins over
|
|
2356
|
+
* configureFavicons. Without a `src`, a `resolve` or a configured resolver, no request is made. */
|
|
2357
|
+
resolve?: FaviconResolver;
|
|
2358
|
+
ref?: Ref<HTMLElement>;
|
|
2359
|
+
}
|
|
2360
|
+
/** A site's favicon, or a colored letter avatar while it loads or when it cannot. Decorative.
|
|
2361
|
+
* Out of the box it makes no network request and shows the letter avatar: pass `src` or
|
|
2362
|
+
* `resolve`, or call `configureFavicons({ resolve: googleFavicon })` once. */
|
|
2363
|
+
declare function Favicon({ url, size, label, src, resolve, className, style, ref, ...rest }: FaviconProps): react.JSX.Element;
|
|
2364
|
+
type LinkCardAccent = `chart-${1 | 2 | 3 | 4 | 5 | 6 | 7 | 8}` | 'accent';
|
|
2365
|
+
interface LinkCardProps extends Omit<ComponentPropsWithoutRef<'a'>, 'title' | 'href' | 'children'> {
|
|
2366
|
+
/** Where the card goes. A URL that is not safe (javascript:, data:) makes the card
|
|
2367
|
+
* unavailable, like `disabled`. */
|
|
2368
|
+
href: string;
|
|
2369
|
+
/** The name. */
|
|
2370
|
+
title: string;
|
|
2371
|
+
/** A short description. */
|
|
2372
|
+
blurb?: string;
|
|
2373
|
+
/** A 20px icon or a Favicon, shown in a tinted tile. */
|
|
2374
|
+
icon?: ReactNode;
|
|
2375
|
+
/** With no `icon`, shows the site's Favicon (from the page's configureFavicons resolver,
|
|
2376
|
+
* else a letter avatar) in the tile. */
|
|
2377
|
+
favicon?: boolean;
|
|
2378
|
+
/** The tile color. Default 'accent'. */
|
|
2379
|
+
accent?: LinkCardAccent;
|
|
2380
|
+
/** A small detail line (card layout only). */
|
|
2381
|
+
meta?: ReactNode;
|
|
2382
|
+
/** A status dot and label. */
|
|
2383
|
+
status?: {
|
|
2384
|
+
tone: StatusTone;
|
|
2385
|
+
label: string;
|
|
2386
|
+
};
|
|
2387
|
+
/** Anything small at the top right: a Badge, a count. */
|
|
2388
|
+
badge?: ReactNode;
|
|
2389
|
+
/** Not available yet: dashed border, not a link. */
|
|
2390
|
+
disabled?: boolean;
|
|
2391
|
+
/** 'card' is a tile, 'row' a 64px row, 'auto' (default) a row until its parent is 600px wide. */
|
|
2392
|
+
layout?: 'auto' | 'card' | 'row';
|
|
2393
|
+
/** Opens in a new tab. */
|
|
2394
|
+
external?: boolean;
|
|
2395
|
+
className?: string;
|
|
2396
|
+
ref?: Ref<HTMLElement>;
|
|
2397
|
+
}
|
|
2398
|
+
/** A big link to another page or app: icon tile, title and blurb. The whole card is the anchor. */
|
|
2399
|
+
declare function LinkCard({ href, title, blurb, icon, favicon, accent, meta, status, badge, disabled, layout, external, className, ref: forwardedRef, ...rest }: LinkCardProps): react.JSX.Element;
|
|
2400
|
+
interface AsyncPanelProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2401
|
+
/** Which state to show. */
|
|
2402
|
+
status: 'loading' | 'error' | 'empty' | 'ready';
|
|
2403
|
+
/** The loading body. Default: SkeletonRows. */
|
|
2404
|
+
skeleton?: ReactNode;
|
|
2405
|
+
/** The error body. */
|
|
2406
|
+
error?: {
|
|
2407
|
+
title?: string;
|
|
2408
|
+
message: string;
|
|
2409
|
+
onRetry?: () => void;
|
|
2410
|
+
};
|
|
2411
|
+
/** The empty body. */
|
|
2412
|
+
empty?: {
|
|
2413
|
+
title: string;
|
|
2414
|
+
description?: string;
|
|
2415
|
+
action?: ReactNode;
|
|
2416
|
+
};
|
|
2417
|
+
/** The content for status 'ready'. */
|
|
2418
|
+
children?: ReactNode;
|
|
2419
|
+
className?: string;
|
|
2420
|
+
ref?: Ref<HTMLDivElement>;
|
|
2421
|
+
}
|
|
2422
|
+
/** Shows a skeleton, an error, an empty state or its children, from one status value. */
|
|
2423
|
+
declare function AsyncPanel({ status, skeleton, error, empty, children, className, ref, ...rest }: AsyncPanelProps): react.JSX.Element;
|
|
2424
|
+
|
|
2425
|
+
interface VirtualTableProps<T> extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className'> {
|
|
2426
|
+
/** The data. */
|
|
2427
|
+
rows: T[];
|
|
2428
|
+
/** The columns, in order (the ResponsiveTable Column type; primary and secondary are ignored). Keep the array stable. */
|
|
2429
|
+
columns: Column<T>[];
|
|
2430
|
+
/** A key for a row. Keep it stable (module-level or useCallback); it is read through a ref, so a new function each render does not rebuild the row offsets. */
|
|
2431
|
+
rowKey: (row: T) => string;
|
|
2432
|
+
/** The accessible name of the table and its scroll box. */
|
|
2433
|
+
label: string;
|
|
2434
|
+
/** Height of the scroll box (px or CSS length). Default 480. The box shrinks to fit fewer rows. */
|
|
2435
|
+
height?: number | string;
|
|
2436
|
+
/** Row height in px. Default 41 (33 when dense), or 44 when onRowClick is set so rows are touch targets. Fixed-height rows stay on one line and truncate; use measure for wrapping cells. */
|
|
2437
|
+
rowHeight?: number;
|
|
2438
|
+
/** Measures rendered rows and uses their real height (cells that wrap). rowHeight is then the estimate. */
|
|
2439
|
+
measure?: boolean;
|
|
2440
|
+
/** Tighter rows (6px vertical padding instead of 10px). */
|
|
2441
|
+
dense?: boolean;
|
|
2442
|
+
/** Striped rows (by row position, so they stay right while scrolling). */
|
|
2443
|
+
zebra?: boolean;
|
|
2444
|
+
/** The table's minimum width before it scrolls sideways. Default 640. */
|
|
2445
|
+
minWidth?: number | string;
|
|
2446
|
+
/** Pins the first column while the table scrolls sideways. */
|
|
2447
|
+
stickyFirstColumn?: boolean;
|
|
2448
|
+
/** The current sort, when you control it. */
|
|
2449
|
+
sort?: Sort;
|
|
2450
|
+
/** Called with the next sort. With sort or onSortChange given you sort the rows yourself; without
|
|
2451
|
+
* them the table sorts by each column's sortValue. */
|
|
2452
|
+
onSortChange?: (sort: Sort) => void;
|
|
2453
|
+
/** Called with the row and its index on click, Enter or Space. Makes rows focusable with arrow-key navigation. */
|
|
2454
|
+
onRowClick?: (row: T, index: number) => void;
|
|
2455
|
+
/** A 3px edge at the start of a row: ok, warn or loss. Say the status in a cell too. */
|
|
2456
|
+
rowTone?: (row: T) => 'ok' | 'warn' | 'loss' | undefined;
|
|
2457
|
+
/** Shows skeleton rows instead of the data. */
|
|
2458
|
+
loading?: boolean;
|
|
2459
|
+
/** Shown when there are no rows. Default: the "nothingHere" string. */
|
|
2460
|
+
empty?: ReactNode;
|
|
2461
|
+
/** Shows an ErrorState instead of the data. */
|
|
2462
|
+
error?: {
|
|
2463
|
+
message: string;
|
|
2464
|
+
onRetry?: () => void;
|
|
2465
|
+
} | null;
|
|
2466
|
+
/** Rows rendered above and below the visible ones. Default 8. */
|
|
2467
|
+
overscan?: number;
|
|
2468
|
+
/** Called with the rendered range when it changes. */
|
|
2469
|
+
onRangeChange?: (start: number, end: number) => void;
|
|
2470
|
+
/** Receives { scrollToIndex }. */
|
|
2471
|
+
apiRef?: Ref<VirtualListHandle>;
|
|
2472
|
+
/** Classes for the root. */
|
|
2473
|
+
className?: string;
|
|
2474
|
+
/** The root element. */
|
|
2475
|
+
ref?: Ref<HTMLDivElement>;
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* A table of thousands of rows that renders only what is on screen. The columns are the
|
|
2479
|
+
* ResponsiveTable ones: a sticky header, sorting, row tones, a pinned first column, and arrow-key
|
|
2480
|
+
* navigation between rows when they are clickable.
|
|
2481
|
+
*/
|
|
2482
|
+
declare function VirtualTable<T>({ rows, columns, rowKey, label, height, rowHeight, measure, dense, zebra, minWidth, stickyFirstColumn, sort, onSortChange, onRowClick, rowTone, loading, empty, error, overscan, onRangeChange, apiRef, className, ref, ...rest }: VirtualTableProps<T>): react.JSX.Element;
|
|
2483
|
+
|
|
2484
|
+
interface TreeNode {
|
|
2485
|
+
/** Unique in the whole tree; keys selection and expansion. */
|
|
2486
|
+
id: string;
|
|
2487
|
+
/** The row text (also what typing a letter jumps to). */
|
|
2488
|
+
label: string;
|
|
2489
|
+
/** Leading icon (16px reads best). */
|
|
2490
|
+
icon?: ReactNode;
|
|
2491
|
+
/** Right-aligned extra: a count or a badge. */
|
|
2492
|
+
trailing?: ReactNode;
|
|
2493
|
+
/** Child nodes. An empty array counts as a leaf. */
|
|
2494
|
+
children?: TreeNode[];
|
|
2495
|
+
/** Shown and focusable, but cannot be selected or activated. */
|
|
2496
|
+
disabled?: boolean;
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
interface TreeViewProps extends Omit<ComponentPropsWithoutRef<'ul'>, 'children' | 'className' | 'onSelect' | 'defaultValue'> {
|
|
2500
|
+
/** The root nodes. */
|
|
2501
|
+
items: TreeNode[];
|
|
2502
|
+
/** Ids of the open parents, when you control expansion. */
|
|
2503
|
+
expanded?: string[];
|
|
2504
|
+
/** Ids open on mount when uncontrolled. Default none. */
|
|
2505
|
+
defaultExpanded?: string[];
|
|
2506
|
+
/** Called with every open id after a node opens or closes. */
|
|
2507
|
+
onExpandedChange?: (expanded: string[]) => void;
|
|
2508
|
+
/** The selected id, when you control selection (null for none). */
|
|
2509
|
+
selected?: string | null;
|
|
2510
|
+
/** The id selected on mount when uncontrolled. Default none. */
|
|
2511
|
+
defaultSelected?: string | null;
|
|
2512
|
+
/** Called when a node is selected (click, Enter, Space). */
|
|
2513
|
+
onSelectedChange?: (id: string, node: TreeNode) => void;
|
|
2514
|
+
/** Called when a node is activated (click or Enter): navigate or open it here. */
|
|
2515
|
+
onActivate?: (node: TreeNode) => void;
|
|
2516
|
+
/** Whether nodes can be selected (aria-selected). Default true. false: activation only. */
|
|
2517
|
+
selectable?: boolean;
|
|
2518
|
+
/** A click or Enter on a parent also opens or closes it. Default true. false: only the chevron, the arrow keys and * do. */
|
|
2519
|
+
toggleOnSelect?: boolean;
|
|
2520
|
+
/** Accessible name of the tree. Give this or aria-labelledby. */
|
|
2521
|
+
'aria-label'?: string;
|
|
2522
|
+
/** Id of the element that names the tree. */
|
|
2523
|
+
'aria-labelledby'?: string;
|
|
2524
|
+
/** Classes for the tree (the ul). */
|
|
2525
|
+
className?: string;
|
|
2526
|
+
/** The tree element (role="tree"). */
|
|
2527
|
+
ref?: Ref<HTMLUListElement>;
|
|
2528
|
+
}
|
|
2529
|
+
/** A tree of nested items, like folders or a section outline, following the WAI-ARIA tree view pattern:
|
|
2530
|
+
* open and close branches, select one item, arrow keys, Home, End, type a letter to jump, * to open siblings. */
|
|
2531
|
+
declare function TreeView(props: TreeViewProps): react.JSX.Element;
|
|
2532
|
+
|
|
2533
|
+
interface ContextMenuProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'className'> {
|
|
2534
|
+
/** The area that opens the menu: right-click, a long press on touch screens, or Shift+F10 or the Menu key while focus is inside. */
|
|
2535
|
+
children: ReactNode;
|
|
2536
|
+
/** The menu rows (MenuItem, MenuLabel, MenuSeparator), or a function of the element that was pressed,
|
|
2537
|
+
* for one menu over many rows (read the row from target.closest('[data-id]')). Returning null keeps the menu closed. */
|
|
2538
|
+
menu: ReactNode | ((target: Element) => ReactNode);
|
|
2539
|
+
/** Controlled open state. Pair it with onOpenChange. */
|
|
2540
|
+
open?: boolean;
|
|
2541
|
+
/** Called when the menu opens or closes. When it closed itself the reason is 'escape', 'outside' or 'tab'. */
|
|
2542
|
+
onOpenChange?: (open: boolean, reason?: PopoverCloseReason) => void;
|
|
2543
|
+
/** Turns the custom menu off, so the browser's own menu shows. */
|
|
2544
|
+
disabled?: boolean;
|
|
2545
|
+
/** Accessible name of the menu. Default "Actions" (the provider's contextMenu string). */
|
|
2546
|
+
menuLabel?: string;
|
|
2547
|
+
/** 'sm' (default): under 640px the menu opens as a bottom sheet with 48px rows. false: always a floating menu. */
|
|
2548
|
+
sheetBelow?: 'sm' | false;
|
|
2549
|
+
/** Title of the bottom sheet. Default "Menu" (the provider's menu string). */
|
|
2550
|
+
sheetTitle?: string;
|
|
2551
|
+
/** Milliseconds a finger rests before the menu opens. Default 500. */
|
|
2552
|
+
longPressMs?: number;
|
|
2553
|
+
/** Classes for the menu panel. */
|
|
2554
|
+
menuClassName?: string;
|
|
2555
|
+
/** Classes for the area. */
|
|
2556
|
+
className?: string;
|
|
2557
|
+
/** The area element. */
|
|
2558
|
+
ref?: Ref<HTMLDivElement>;
|
|
2559
|
+
}
|
|
2560
|
+
/** A menu of actions for an area, opened by right-click, a touch long press, or Shift+F10 / the Menu key. */
|
|
2561
|
+
declare function ContextMenu({ children, menu, open: openProp, onOpenChange, disabled, menuLabel, sheetBelow, sheetTitle, longPressMs, menuClassName, className, ref, onContextMenu, onKeyDown, onPointerDown, onPointerMove, onPointerUp, onPointerCancel, onClickCapture, ...rest }: ContextMenuProps): react.JSX.Element;
|
|
2562
|
+
|
|
2563
|
+
interface HoverCardProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'content' | 'className'> {
|
|
2564
|
+
/** The trigger: one element, usually a link. It keeps its own click and keyboard behavior. */
|
|
2565
|
+
children: ReactElement;
|
|
2566
|
+
/** What the card shows: a preview of where the link goes. Touch screens never open it, so show the same thing there. */
|
|
2567
|
+
content: ReactNode;
|
|
2568
|
+
/** Preferred side; flips when there is no room. Default bottom. */
|
|
2569
|
+
side?: 'top' | 'bottom';
|
|
2570
|
+
/** Which edge of the trigger the card lines up with (mirrored in right-to-left layouts). Default center. */
|
|
2571
|
+
align?: 'start' | 'center' | 'end';
|
|
2572
|
+
/** Milliseconds the pointer rests on the trigger (or keyboard focus stays) before the card opens. Default 500. */
|
|
2573
|
+
openDelay?: number;
|
|
2574
|
+
/** Milliseconds after the pointer leaves the trigger and the card before it closes. Default 300. */
|
|
2575
|
+
closeDelay?: number;
|
|
2576
|
+
/** Controlled open state. Pair it with onOpenChange. */
|
|
2577
|
+
open?: boolean;
|
|
2578
|
+
/** Open on mount when uncontrolled (previews, tests). */
|
|
2579
|
+
defaultOpen?: boolean;
|
|
2580
|
+
/** Called when the card opens or closes. */
|
|
2581
|
+
onOpenChange?: (open: boolean) => void;
|
|
2582
|
+
/** Card width: px or any CSS length. Default 320, never wider than the screen minus 16px. */
|
|
2583
|
+
width?: number | string;
|
|
2584
|
+
/** Classes for the card. */
|
|
2585
|
+
className?: string;
|
|
2586
|
+
/** The card element. */
|
|
2587
|
+
ref?: Ref<HTMLDivElement>;
|
|
2588
|
+
}
|
|
2589
|
+
/** A preview card that opens after the pointer rests on a link or keyboard focus stays on it.
|
|
2590
|
+
* Dismissible (Escape), hoverable (the pointer can move onto the card) and persistent (it stays
|
|
2591
|
+
* until the pointer or focus leaves). Touch never opens it. Portaled like Tooltip. */
|
|
2592
|
+
declare function HoverCard({ children, content, side, align, openDelay, closeDelay, open: openProp, defaultOpen, onOpenChange, width, className, ref, style, onPointerEnter, onPointerLeave, ...rest }: HoverCardProps): react.JSX.Element;
|
|
2593
|
+
|
|
2594
|
+
interface ThemeState {
|
|
2595
|
+
/** What was picked: 'system' or a theme name. */
|
|
2596
|
+
choice: ThemeChoice;
|
|
2597
|
+
/** What is rendering now. */
|
|
2598
|
+
theme: ThemeName;
|
|
2599
|
+
/** dark or light: what the rendering theme is based on. */
|
|
2600
|
+
scheme: 'dark' | 'light';
|
|
2601
|
+
/** Save a choice (cookie and localStorage) and apply it. */
|
|
2602
|
+
setChoice: (choice: ThemeChoice) => void;
|
|
2603
|
+
}
|
|
2604
|
+
/** The current theme choice and what it renders as, kept in sync across tabs and
|
|
2605
|
+
* subdomains. Server render and hydration see { choice: 'system', theme: 'dark' }; the real
|
|
2606
|
+
* value follows right after. If a hydration pass wiped <html data-theme>, it is applied
|
|
2607
|
+
* again on mount. */
|
|
2608
|
+
declare function useTheme(): ThemeState;
|
|
2609
|
+
interface ThemeToggleProps {
|
|
2610
|
+
/** Also offer the extra presets (slate, terminal, …) in a select. */
|
|
2611
|
+
presets?: boolean;
|
|
2612
|
+
/** Show "System", "Light" and "Dark" text beside the icons. */
|
|
2613
|
+
labels?: boolean;
|
|
2614
|
+
/** Fill the container's width, with equal-width segments. */
|
|
2615
|
+
block?: boolean;
|
|
2616
|
+
/** sm: 28px segments (default). md: 32px. Both grow to 44px on touch screens. */
|
|
2617
|
+
size?: 'sm' | 'md';
|
|
2618
|
+
/** One icon button that cycles System, Light, Dark and shows the current choice; for
|
|
2619
|
+
* collapsed sidebars and tight headers. Ignores labels, block and presets. */
|
|
2620
|
+
compact?: boolean;
|
|
2621
|
+
/** segmented: the System / Light / Dark radio group (default). pill: one cycling
|
|
2622
|
+
* button in a 44px pill with a line-strong border, to sit next to the hub pill in a
|
|
2623
|
+
* top bar (the React twin of .nish-theme-btn--pill). With labels, the pill also shows
|
|
2624
|
+
* the current choice as a word (.nish-theme-btn--labelled). Ignores block and presets. */
|
|
2625
|
+
variant?: 'segmented' | 'pill';
|
|
2626
|
+
/** What the segmented toggle shows below 640px. compact (default): the one cycling
|
|
2627
|
+
* button, so a phone header keeps to one row. segmented: the radio group at every
|
|
2628
|
+
* width. A block toggle is always segmented. */
|
|
2629
|
+
phone?: 'compact' | 'segmented';
|
|
2630
|
+
/** sm (default): the segmented toggle collapses to the cycling button below 640px (see
|
|
2631
|
+
* `phone`). never: it keeps the segmented control and the presets select at every
|
|
2632
|
+
* width, for a drawer or settings page that has the room. */
|
|
2633
|
+
collapse?: 'sm' | 'never';
|
|
2634
|
+
className?: string;
|
|
2635
|
+
/** The words after a preset saved on another site in the button label: "Theme: Mocha (set on
|
|
2636
|
+
* another site). Switch to System". Default "set on another site". */
|
|
2637
|
+
elsewhereLabel?: string;
|
|
2638
|
+
/** The root element: the segmented group, or the button of the compact and pill variants. */
|
|
2639
|
+
ref?: Ref<HTMLElement>;
|
|
2640
|
+
}
|
|
2641
|
+
/** System / Light / Dark as a Segmented radio group, optionally with a preset picker,
|
|
2642
|
+
* or one cycling icon button when compact. Words come from `useNishStrings()`. Other props
|
|
2643
|
+
* (id, data-*, aria-*, style) go on the root element. */
|
|
2644
|
+
declare function ThemeToggle({ ref, presets, labels, block, size, compact, variant, phone, collapse, className, elsewhereLabel, ...rest }: ThemeToggleProps & Omit<HTMLAttributes<HTMLElement>, 'children' | 'onChange'>): react.JSX.Element;
|
|
2645
|
+
|
|
2646
|
+
interface SegmentedOption<T extends string> {
|
|
2647
|
+
value: T;
|
|
2648
|
+
label: ReactNode;
|
|
2649
|
+
/** Screen-reader name when the label is only an icon. */
|
|
2650
|
+
ariaLabel?: string;
|
|
2651
|
+
/** Hover tooltip (the native title) for a one-word hint on an icon-only option. Use
|
|
2652
|
+
* tip for anything longer. */
|
|
2653
|
+
title?: string;
|
|
2654
|
+
/** A tooltip that explains the option. It opens on mouse hover and on keyboard focus of
|
|
2655
|
+
* the radio itself (aria-describedby points at it while shown), so keyboard users get
|
|
2656
|
+
* it too; a tap or click selects and closes it. The radio stays the group's only Tab
|
|
2657
|
+
* stop. Replaces title. */
|
|
2658
|
+
tip?: ReactNode;
|
|
2659
|
+
/** The selected look: accent (default), or warn / loss for a choice that must read as
|
|
2660
|
+
* a warning while it is on (a "bypass permissions" mode). */
|
|
2661
|
+
tone?: SegmentedTone;
|
|
2662
|
+
/** Shown but not selectable; the arrow keys skip it. */
|
|
2663
|
+
disabled?: boolean;
|
|
2664
|
+
}
|
|
2665
|
+
interface SegmentedProps<T extends string> extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'children' | 'role' | 'dir'> {
|
|
2666
|
+
/** The radiogroup element. */
|
|
2667
|
+
ref?: Ref<HTMLDivElement>;
|
|
2668
|
+
/** Name of the whole group for screen readers: "Chart range". */
|
|
2669
|
+
label: string;
|
|
2670
|
+
options: SegmentedOption<T>[];
|
|
2671
|
+
/** The selected value, when you keep the state yourself; a value not among the options
|
|
2672
|
+
* leaves none selected. Leave it out and use `defaultValue` for an uncontrolled control. */
|
|
2673
|
+
value?: T | (string & {});
|
|
2674
|
+
/** The starting value of an uncontrolled control. */
|
|
2675
|
+
defaultValue?: T | (string & {});
|
|
2676
|
+
/** Called with the new value. Same as onValueChange; kept for existing code. */
|
|
2677
|
+
onChange?: (value: T) => void;
|
|
2678
|
+
/** Called with the new value (the form-library friendly name). */
|
|
2679
|
+
onValueChange?: (value: T) => void;
|
|
2680
|
+
/** Field name for a native form. Hidden radio inputs carry the selection, so FormData
|
|
2681
|
+
* and `<form action>` see it. */
|
|
2682
|
+
name?: string;
|
|
2683
|
+
/** The id of the `<form>` the hidden inputs belong to, when it is not an ancestor. */
|
|
2684
|
+
form?: string;
|
|
2685
|
+
/** Marks the group required (aria-required, and the hidden radios block an empty submit). */
|
|
2686
|
+
required?: boolean;
|
|
2687
|
+
/** xs: 24px for dense widget headers. sm: 28px (default). md: 32px. All grow to 44px
|
|
2688
|
+
* on touch screens. */
|
|
2689
|
+
size?: 'xs' | 'sm' | 'md';
|
|
2690
|
+
/** Fill the container's width, with equal-width options. */
|
|
2691
|
+
block?: boolean;
|
|
2692
|
+
/** Too many options for the width: scroll (default) keeps one row that scrolls sideways
|
|
2693
|
+
* with edge fades and keeps the selected option in view; wrap lets the control grow
|
|
2694
|
+
* past its container as before. */
|
|
2695
|
+
overflow?: 'wrap' | 'scroll';
|
|
2696
|
+
/** @deprecated Alias of `block`; use `block`. Kept because the spec names it. */
|
|
2697
|
+
fullWidth?: boolean;
|
|
2698
|
+
className?: string;
|
|
2699
|
+
}
|
|
2700
|
+
/** A small set of mutually exclusive choices shown side by side (24h / 7d / 30d): a
|
|
2701
|
+
* radio group. The selected option gets the accent tint and ring, so it reads at a
|
|
2702
|
+
* glance in light themes too. Arrow keys, Home and End move the choice and the focus,
|
|
2703
|
+
* like a native radio group. For multi-select toggles use ChipGroup and Chip. */
|
|
2704
|
+
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;
|
|
2705
|
+
|
|
2706
|
+
/**
|
|
2707
|
+
* Publishes an element's height as a CSS variable on `<html>` (the layout contract:
|
|
2708
|
+
* `--nish-header-h`, `--nish-bottom-nav-h`, `--nish-bottom-bar-h`, `--nish-sticky-extra`).
|
|
2709
|
+
* The variable is written on mount and on every resize, and removed on unmount, when
|
|
2710
|
+
* `enabled` turns false, and while the element is hidden (`display: none` measures 0).
|
|
2711
|
+
* When several bars publish the same variable the largest height wins.
|
|
2712
|
+
*
|
|
2713
|
+
* @param ref - The bar to measure.
|
|
2714
|
+
* @param name - The variable name, e.g. `'--nish-header-h'`.
|
|
2715
|
+
* @param enabled - Set false to publish nothing (a bar hidden above its breakpoint).
|
|
2223
2716
|
*/
|
|
2224
2717
|
declare function useHeightVar(ref: RefObject<HTMLElement | null>, name: string, enabled?: boolean): void;
|
|
2225
2718
|
/**
|
|
@@ -2259,6 +2752,9 @@ interface NavItem {
|
|
|
2259
2752
|
badge?: number | boolean;
|
|
2260
2753
|
/** One line of explanation: shown in MoreSheet rows and as the NavRail tooltip. */
|
|
2261
2754
|
hint?: string;
|
|
2755
|
+
/** A shorter label for the NavRail and the BottomNav, where the cell is narrow ("Engines" for "Engine
|
|
2756
|
+
* Compare"). The full label stays everywhere else and is the rail tooltip when there is no hint. */
|
|
2757
|
+
shortLabel?: string;
|
|
2262
2758
|
}
|
|
2263
2759
|
/** Renders a router link for an item (React Router's `<Link>` and so on). Spread the given
|
|
2264
2760
|
* props onto it: `className` carries the look, `children` the icon and label, and
|
|
@@ -2303,22 +2799,6 @@ interface BottomNavProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'children
|
|
|
2303
2799
|
* `--nish-bottom-nav-h` while it is visible, so Toaster, StickyActionBar and page
|
|
2304
2800
|
* padding make room for it. Hidden from `hideFrom` up (pair it with NavRail or a sidebar). */
|
|
2305
2801
|
declare function BottomNav({ items, more, trailing, hideFrom, label, renderLink, className, ref: refProp, ...rest }: BottomNavProps): react.JSX.Element;
|
|
2306
|
-
interface MoreSheetProps {
|
|
2307
|
-
open: boolean;
|
|
2308
|
-
/** Called on Escape, a scrim click, the swipe, Android back and after a row is chosen. */
|
|
2309
|
-
onClose: () => void;
|
|
2310
|
-
items: NavItem[];
|
|
2311
|
-
/** Default: the provider's `more` string. */
|
|
2312
|
-
title?: string;
|
|
2313
|
-
/** Pinned under the list. Defaults to a "Theme" row (the provider's `theme` string) with a
|
|
2314
|
-
* segmented ThemeToggle. */
|
|
2315
|
-
footer?: ReactNode;
|
|
2316
|
-
renderLink?: RenderLink;
|
|
2317
|
-
}
|
|
2318
|
-
/** The overflow sheet behind BottomNav's More button: a bottom Drawer lifted above the bar,
|
|
2319
|
-
* so the bar stays visible and tappable. Rows are 52px with an icon, a label and a
|
|
2320
|
-
* one-line hint. Choosing a row navigates and closes the sheet. */
|
|
2321
|
-
declare function MoreSheet({ open, onClose, items, title, footer, renderLink }: MoreSheetProps): react.JSX.Element | null;
|
|
2322
2802
|
interface NavRailProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'children'> {
|
|
2323
2803
|
/** The `nav` element. */
|
|
2324
2804
|
ref?: Ref<HTMLElement>;
|
|
@@ -2397,6 +2877,23 @@ interface SectionNavProps extends Omit<ComponentPropsWithoutRef<'nav'>, 'childre
|
|
|
2397
2877
|
* its own height as `--nish-sticky-extra`. Chips are 44px on coarse pointers. */
|
|
2398
2878
|
declare function SectionNav({ items, sticky, onSelect, updateHash, label, className, style, ref: refProp, ...rest }: SectionNavProps): react.JSX.Element;
|
|
2399
2879
|
|
|
2880
|
+
interface MoreSheetProps {
|
|
2881
|
+
open: boolean;
|
|
2882
|
+
/** Called on Escape, a scrim click, the swipe, Android back and after a row is chosen. */
|
|
2883
|
+
onClose: () => void;
|
|
2884
|
+
items: NavItem[];
|
|
2885
|
+
/** Default: the provider's `more` string. */
|
|
2886
|
+
title?: string;
|
|
2887
|
+
/** Pinned under the list. Defaults to a "Theme" row (the provider's `theme` string) with a
|
|
2888
|
+
* segmented ThemeToggle. */
|
|
2889
|
+
footer?: ReactNode;
|
|
2890
|
+
renderLink?: RenderLink;
|
|
2891
|
+
}
|
|
2892
|
+
/** The overflow sheet behind BottomNav's More button: a bottom Drawer lifted above the bar,
|
|
2893
|
+
* so the bar stays visible and tappable. Rows are 52px with an icon, a label and a
|
|
2894
|
+
* one-line hint. Choosing a row navigates and closes the sheet. */
|
|
2895
|
+
declare function MoreSheet({ open, onClose, items, title, footer, renderLink }: MoreSheetProps): react.JSX.Element | null;
|
|
2896
|
+
|
|
2400
2897
|
interface StickyBarProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2401
2898
|
/** The bar element. */
|
|
2402
2899
|
ref?: Ref<HTMLElement>;
|
|
@@ -2424,295 +2921,85 @@ interface StickyActionBarProps extends Omit<ComponentPropsWithoutRef<'div'>, 'ch
|
|
|
2424
2921
|
message?: ReactNode;
|
|
2425
2922
|
/** The main action, usually a primary Button. */
|
|
2426
2923
|
primary: ReactNode;
|
|
2427
|
-
/** A second action, usually a ghost or secondary Button (Discard, Cancel). */
|
|
2428
|
-
secondary?: ReactNode;
|
|
2429
|
-
/** Accessible name of the region. Default: the provider's `actions` string. */
|
|
2430
|
-
label?: string;
|
|
2431
|
-
}
|
|
2432
|
-
/**
|
|
2433
|
-
* A bar fixed to the bottom of the screen for the actions of an unsaved form or a
|
|
2434
|
-
* selection. Sits above a BottomNav when there is one, and publishes `--nish-bottom-bar-h`
|
|
2435
|
-
* while open so page padding and toasts clear it. From sm it floats as a pill at the
|
|
2436
|
-
* bottom end.
|
|
2437
|
-
*/
|
|
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>;
|
|
2442
|
-
/** True while something loads (a route change, a refetch). */
|
|
2443
|
-
active: boolean;
|
|
2444
|
-
/** Waits this long before showing, so quick loads never flash a bar. Default 200. */
|
|
2445
|
-
delayMs?: number;
|
|
2446
|
-
/** CSS `top`. Defaults to just under the app header. */
|
|
2447
|
-
top?: string;
|
|
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;
|
|
2452
|
-
}
|
|
2453
|
-
/**
|
|
2454
|
-
* A thin indeterminate progress bar fixed under the app header. Appears only after
|
|
2455
|
-
* `delayMs` of being active. With reduced motion it is a static partial bar.
|
|
2456
|
-
*/
|
|
2457
|
-
declare function LoadingBar({ active, delayMs, top, announce, className, style, ref, ...rest }: LoadingBarProps): react.JSX.Element;
|
|
2458
|
-
declare const CONTAINER_SIZE: {
|
|
2459
|
-
readonly narrow: "max-w-2xl";
|
|
2460
|
-
readonly default: "max-w-4xl";
|
|
2461
|
-
readonly wide: "max-w-7xl";
|
|
2462
|
-
readonly full: "max-w-none";
|
|
2463
|
-
};
|
|
2464
|
-
interface PageContainerProps extends Omit<ComponentPropsWithoutRef<'main'>, 'children'> {
|
|
2465
|
-
/** The container element. */
|
|
2466
|
-
ref?: Ref<HTMLElement>;
|
|
2467
|
-
/** Max width: narrow 42rem, default 56rem, wide 80rem, full none. */
|
|
2468
|
-
size?: keyof typeof CONTAINER_SIZE;
|
|
2469
|
-
children?: ReactNode;
|
|
2470
|
-
/** Adds bottom padding that clears a BottomNav and StickyActionBar. Default true. */
|
|
2471
|
-
padBottom?: boolean;
|
|
2472
|
-
/** The element to render. Default `main`. */
|
|
2473
|
-
as?: ElementType;
|
|
2474
|
-
}
|
|
2475
|
-
/**
|
|
2476
|
-
* The page's content column: centered, with the shared side gutter and vertical padding,
|
|
2477
|
-
* and bottom padding that keeps the last row clear of fixed bottom bars.
|
|
2478
|
-
*/
|
|
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. */
|
|
2482
|
-
declare function useOnline(): boolean;
|
|
2483
|
-
interface ConnectionBannerProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'title' | 'onClick'> {
|
|
2484
|
-
/** The banner's root element. */
|
|
2485
|
-
ref?: Ref<HTMLDivElement>;
|
|
2486
|
-
/** A URL to probe with `fetch` (cache: no-store). When it fails or returns a non-2xx
|
|
2487
|
-
* status the banner shows. Leave out to react to the browser's online/offline state only. */
|
|
2488
|
-
healthUrl?: string;
|
|
2489
|
-
/** Base interval between probes. After failures it doubles up to 4x. Default 30000. */
|
|
2490
|
-
intervalMs?: number;
|
|
2491
|
-
/** Shown when the probe fails. Default "Can't reach the server". */
|
|
2492
|
-
message?: string;
|
|
2493
|
-
/** Shown when the browser is offline. Default: the provider's `offline` string. */
|
|
2494
|
-
offlineMessage?: string;
|
|
2495
|
-
/** Retry button text. Default: the provider's `retry` string. */
|
|
2496
|
-
retryLabel?: string;
|
|
2497
|
-
/** Called after the Retry button re-probes. */
|
|
2498
|
-
onRetry?: () => void;
|
|
2499
|
-
}
|
|
2500
|
-
/**
|
|
2501
|
-
* A sticky warning bar for lost connectivity. Watches `navigator.onLine` and, with
|
|
2502
|
-
* `healthUrl`, probes the server with backoff (and right away when the browser comes back
|
|
2503
|
-
* online or the tab becomes visible). Renders nothing while everything is reachable.
|
|
2504
|
-
*/
|
|
2505
|
-
declare function ConnectionBanner({ healthUrl, intervalMs, message, offlineMessage, retryLabel, onRetry, ...rest }: ConnectionBannerProps): react.JSX.Element | null;
|
|
2506
|
-
|
|
2507
|
-
/** One column of a ResponsiveTable. */
|
|
2508
|
-
interface Column<T> {
|
|
2509
|
-
/** Stable id; also the key of the sort. */
|
|
2510
|
-
key: string;
|
|
2511
|
-
/** The header text (also the label in cards and in the sort menu). */
|
|
2512
|
-
header: string;
|
|
2513
|
-
/** Renders the cell for a row. */
|
|
2514
|
-
cell: (row: T) => ReactNode;
|
|
2515
|
-
/** Makes the column sortable: the comparable value of a row. null sorts last. */
|
|
2516
|
-
sortValue?: (row: T) => string | number | null;
|
|
2517
|
-
/** A number column: right-aligned, tabular, no wrapping. */
|
|
2518
|
-
numeric?: boolean;
|
|
2519
|
-
/** In cards, this column is the title. */
|
|
2520
|
-
primary?: boolean;
|
|
2521
|
-
/** In cards, this column is the subtitle under the title. */
|
|
2522
|
-
secondary?: boolean;
|
|
2523
|
-
/** Hides the column in the table below this breakpoint. */
|
|
2524
|
-
hideBelow?: 'sm' | 'md' | 'lg';
|
|
2525
|
-
/** A CSS width for the header cell, e.g. '8rem'. */
|
|
2526
|
-
width?: string;
|
|
2527
|
-
}
|
|
2528
|
-
/** The sort of a ResponsiveTable: a column key and a direction, or null for none. */
|
|
2529
|
-
type Sort = {
|
|
2530
|
-
key: string;
|
|
2531
|
-
dir: 'asc' | 'desc';
|
|
2532
|
-
} | null;
|
|
2533
|
-
type CardsBelow = 'sm' | 'md' | 'lg';
|
|
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'> {
|
|
2542
|
-
/** The data. */
|
|
2543
|
-
rows: T[];
|
|
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. */
|
|
2546
|
-
columns: Column<T>[];
|
|
2547
|
-
/** A stable key for a row. */
|
|
2548
|
-
rowKey: (row: T) => string;
|
|
2549
|
-
/** Below this breakpoint the rows become cards. Default 'md'. */
|
|
2550
|
-
cardsBelow?: CardsBelow;
|
|
2551
|
-
/** Called when a row (or card) is activated by click, Enter or Space. */
|
|
2552
|
-
onRowClick?: (row: T) => void;
|
|
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. */
|
|
2555
|
-
rowHref?: (row: T) => string;
|
|
2556
|
-
/** Called with the URL when a row is activated by click or key, so a router can navigate
|
|
2557
|
-
* without a page reload. Without it the table assigns `location`. Card links stay real
|
|
2558
|
-
* anchors. */
|
|
2559
|
-
onNavigate?: (href: string) => void;
|
|
2560
|
-
/** A 3px edge at the start of a row: ok, warn or loss. Say the status in a cell too. */
|
|
2561
|
-
rowTone?: (row: T) => 'ok' | 'warn' | 'loss' | undefined;
|
|
2562
|
-
/** The current sort, when you control it. */
|
|
2563
|
-
sort?: Sort;
|
|
2564
|
-
/** Called with the next sort. With sort or onSortChange given you sort the rows
|
|
2565
|
-
* yourself; without them the table sorts by each column's sortValue. */
|
|
2566
|
-
onSortChange?: (sort: Sort) => void;
|
|
2567
|
-
/** The table's minimum width before it scrolls sideways. Default 640. */
|
|
2568
|
-
minWidth?: number | string;
|
|
2569
|
-
/** Keeps the header visible while the body scrolls (give maxHeight too). */
|
|
2570
|
-
stickyHeader?: boolean;
|
|
2571
|
-
/** Caps the table's height; the body scrolls inside. */
|
|
2572
|
-
maxHeight?: number | string;
|
|
2573
|
-
/** Pins the first column while the table scrolls sideways. */
|
|
2574
|
-
stickyFirstColumn?: boolean;
|
|
2575
|
-
/** Shows skeleton rows (table) or skeleton cards instead of the data. */
|
|
2576
|
-
loading?: boolean;
|
|
2577
|
-
/** Shown when there are no rows. Default: the "nothingHere" string. */
|
|
2578
|
-
empty?: ReactNode;
|
|
2579
|
-
/** Shows an ErrorState instead of the data. */
|
|
2580
|
-
error?: {
|
|
2581
|
-
message: string;
|
|
2582
|
-
onRetry?: () => void;
|
|
2583
|
-
} | null;
|
|
2584
|
-
/** The accessible name of the table and the card list. */
|
|
2585
|
-
label: string;
|
|
2586
|
-
/** Renders a whole card yourself (inside the card's button or link). */
|
|
2587
|
-
renderCard?: (row: T) => ReactNode;
|
|
2588
|
-
/** Replaces the English sort announcement and direction-button label. */
|
|
2589
|
-
sortText?: SortText;
|
|
2590
|
-
className?: string;
|
|
2591
|
-
ref?: Ref<HTMLDivElement>;
|
|
2592
|
-
}
|
|
2593
|
-
/**
|
|
2594
|
-
* A table on wide screens and a list of cards on phones, from one column definition.
|
|
2595
|
-
* Sortable headers (and a sort menu in card mode), clickable or linked rows, a status
|
|
2596
|
-
* edge per row, loading, empty and error states built in. A sort change is announced to
|
|
2597
|
-
* screen readers.
|
|
2598
|
-
*/
|
|
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'> {
|
|
2601
|
-
/** A leading icon or avatar (kept at its size). */
|
|
2602
|
-
icon?: ReactNode;
|
|
2603
|
-
/** The main line; truncates, or wraps to two lines with `titleLines={2}`. */
|
|
2604
|
-
title: ReactNode;
|
|
2605
|
-
/** How many lines the title may use before it is cut off. Default 1 (truncates). */
|
|
2606
|
-
titleLines?: 1 | 2;
|
|
2607
|
-
/** A quieter line under the title; up to two lines. */
|
|
2608
|
-
subtitle?: ReactNode;
|
|
2609
|
-
/** A right-aligned detail: a date, an amount. */
|
|
2610
|
-
meta?: ReactNode;
|
|
2611
|
-
/** A control or badge at the far right (outside the meta). */
|
|
2612
|
-
trailing?: ReactNode;
|
|
2613
|
-
/** Makes the whole row a link. A URL that is not safe (javascript:, data:) makes it a plain row. */
|
|
2614
|
-
href?: string;
|
|
2615
|
-
/** Makes the whole row a button. */
|
|
2616
|
-
onClick?: () => void;
|
|
2617
|
-
/** The current item: accent tint and aria-current. */
|
|
2618
|
-
active?: boolean;
|
|
2619
|
-
/** danger: the title turns loss-red. */
|
|
2620
|
-
tone?: 'danger';
|
|
2621
|
-
/** Shows a chevron. On by default for a link. */
|
|
2622
|
-
chevron?: boolean;
|
|
2623
|
-
/** A 44px row instead of 52px. */
|
|
2624
|
-
dense?: boolean;
|
|
2625
|
-
/** Dense, with an 11px title and 10px subtitle and meta: for small widget tiles. Keeps the 44px target. */
|
|
2626
|
-
compact?: boolean;
|
|
2627
|
-
/** Opens the link in a new tab with an external icon. */
|
|
2628
|
-
external?: boolean;
|
|
2629
|
-
/** Classes for the row itself (the link, button or box inside the wrapper). */
|
|
2630
|
-
className?: string;
|
|
2631
|
-
/** The wrapper element. Default 'li'; pass 'div' outside a list. */
|
|
2632
|
-
as?: 'li' | 'div';
|
|
2633
|
-
/** The wrapper element. */
|
|
2634
|
-
ref?: Ref<HTMLElement>;
|
|
2635
|
-
}
|
|
2636
|
-
/** A list row: icon, title, subtitle, meta and a chevron, where the whole row is the link or button. */
|
|
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'> {
|
|
2639
|
-
/** The site's address; only the host is used. */
|
|
2640
|
-
url: string;
|
|
2641
|
-
/** Width and height in px. Default 16. */
|
|
2642
|
-
size?: number;
|
|
2643
|
-
/** The text whose first letter fills the fallback avatar. Default: the host name. */
|
|
2924
|
+
/** A second action, usually a ghost or secondary Button (Discard, Cancel). */
|
|
2925
|
+
secondary?: ReactNode;
|
|
2926
|
+
/** Accessible name of the region. Default: the provider's `actions` string. */
|
|
2644
2927
|
label?: string;
|
|
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
2928
|
}
|
|
2652
|
-
/**
|
|
2653
|
-
*
|
|
2654
|
-
*
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
/** A small detail line (card layout only). */
|
|
2673
|
-
meta?: ReactNode;
|
|
2674
|
-
/** A status dot and label. */
|
|
2675
|
-
status?: {
|
|
2676
|
-
tone: StatusTone;
|
|
2677
|
-
label: string;
|
|
2678
|
-
};
|
|
2679
|
-
/** Anything small at the top right: a Badge, a count. */
|
|
2680
|
-
badge?: ReactNode;
|
|
2681
|
-
/** Not available yet: dashed border, not a link. */
|
|
2682
|
-
disabled?: boolean;
|
|
2683
|
-
/** 'card' is a tile, 'row' a 64px row, 'auto' (default) a row until its parent is 600px wide. */
|
|
2684
|
-
layout?: 'auto' | 'card' | 'row';
|
|
2685
|
-
/** Opens in a new tab. */
|
|
2686
|
-
external?: boolean;
|
|
2687
|
-
className?: string;
|
|
2688
|
-
ref?: Ref<HTMLElement>;
|
|
2929
|
+
/**
|
|
2930
|
+
* A bar fixed to the bottom of the screen for the actions of an unsaved form or a
|
|
2931
|
+
* selection. Sits above a BottomNav when there is one, and publishes `--nish-bottom-bar-h`
|
|
2932
|
+
* while open so page padding and toasts clear it. From sm it floats as a pill at the
|
|
2933
|
+
* bottom end.
|
|
2934
|
+
*/
|
|
2935
|
+
declare function StickyActionBar({ open, message, primary, secondary, label, className, ref: refProp, ...rest }: StickyActionBarProps): react.JSX.Element | null;
|
|
2936
|
+
interface LoadingBarProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'> {
|
|
2937
|
+
/** The bar element (rendered after the delay). */
|
|
2938
|
+
ref?: Ref<HTMLDivElement>;
|
|
2939
|
+
/** True while something loads (a route change, a refetch). */
|
|
2940
|
+
active: boolean;
|
|
2941
|
+
/** Waits this long before showing, so quick loads never flash a bar. Default 200. */
|
|
2942
|
+
delayMs?: number;
|
|
2943
|
+
/** CSS `top`. Defaults to just under the app header. */
|
|
2944
|
+
top?: string;
|
|
2945
|
+
/** Text for screen readers ("Loading page…"). With it set, the bar renders a persistent
|
|
2946
|
+
* polite live region that holds the text while the bar shows (after `delayMs`) and is
|
|
2947
|
+
* emptied when loading ends, so the start is announced. Without it nothing is announced. */
|
|
2948
|
+
announce?: string;
|
|
2689
2949
|
}
|
|
2690
|
-
/**
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
description?: string;
|
|
2707
|
-
action?: ReactNode;
|
|
2708
|
-
};
|
|
2709
|
-
/** The content for status 'ready'. */
|
|
2950
|
+
/**
|
|
2951
|
+
* A thin indeterminate progress bar fixed under the app header. Appears only after
|
|
2952
|
+
* `delayMs` of being active. With reduced motion it is a static partial bar.
|
|
2953
|
+
*/
|
|
2954
|
+
declare function LoadingBar({ active, delayMs, top, announce, className, style, ref, ...rest }: LoadingBarProps): react.JSX.Element;
|
|
2955
|
+
declare const CONTAINER_SIZE: {
|
|
2956
|
+
readonly narrow: "max-w-2xl";
|
|
2957
|
+
readonly default: "max-w-4xl";
|
|
2958
|
+
readonly wide: "max-w-7xl";
|
|
2959
|
+
readonly full: "max-w-none";
|
|
2960
|
+
};
|
|
2961
|
+
interface PageContainerProps extends Omit<ComponentPropsWithoutRef<'main'>, 'children'> {
|
|
2962
|
+
/** The container element. */
|
|
2963
|
+
ref?: Ref<HTMLElement>;
|
|
2964
|
+
/** Max width: narrow 42rem, default 56rem, wide 80rem, full none. */
|
|
2965
|
+
size?: keyof typeof CONTAINER_SIZE;
|
|
2710
2966
|
children?: ReactNode;
|
|
2711
|
-
|
|
2967
|
+
/** Adds bottom padding that clears a BottomNav and StickyActionBar. Default true. */
|
|
2968
|
+
padBottom?: boolean;
|
|
2969
|
+
/** The element to render. Default `main`. */
|
|
2970
|
+
as?: ElementType;
|
|
2971
|
+
}
|
|
2972
|
+
/**
|
|
2973
|
+
* The page's content column: centered, with the shared side gutter and vertical padding,
|
|
2974
|
+
* and bottom padding that keeps the last row clear of fixed bottom bars.
|
|
2975
|
+
*/
|
|
2976
|
+
declare function PageContainer({ size, children, padBottom, as, className, ref, ...rest }: PageContainerProps): react.JSX.Element;
|
|
2977
|
+
/** Whether the browser reports a network connection (`navigator.onLine`). True on the server
|
|
2978
|
+
* and in the first client render. */
|
|
2979
|
+
declare function useOnline(): boolean;
|
|
2980
|
+
interface ConnectionBannerProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'title' | 'onClick'> {
|
|
2981
|
+
/** The banner's root element. */
|
|
2712
2982
|
ref?: Ref<HTMLDivElement>;
|
|
2983
|
+
/** A URL to probe with `fetch` (cache: no-store). When it fails or returns a non-2xx
|
|
2984
|
+
* status the banner shows. Leave out to react to the browser's online/offline state only. */
|
|
2985
|
+
healthUrl?: string;
|
|
2986
|
+
/** Base interval between probes. After failures it doubles up to 4x. Default 30000. */
|
|
2987
|
+
intervalMs?: number;
|
|
2988
|
+
/** Shown when the probe fails. Default "Can't reach the server". */
|
|
2989
|
+
message?: string;
|
|
2990
|
+
/** Shown when the browser is offline. Default: the provider's `offline` string. */
|
|
2991
|
+
offlineMessage?: string;
|
|
2992
|
+
/** Retry button text. Default: the provider's `retry` string. */
|
|
2993
|
+
retryLabel?: string;
|
|
2994
|
+
/** Called after the Retry button re-probes. */
|
|
2995
|
+
onRetry?: () => void;
|
|
2713
2996
|
}
|
|
2714
|
-
/**
|
|
2715
|
-
|
|
2997
|
+
/**
|
|
2998
|
+
* A sticky warning bar for lost connectivity. Watches `navigator.onLine` and, with
|
|
2999
|
+
* `healthUrl`, probes the server with backoff (and right away when the browser comes back
|
|
3000
|
+
* online or the tab becomes visible). Renders nothing while everything is reachable.
|
|
3001
|
+
*/
|
|
3002
|
+
declare function ConnectionBanner({ healthUrl, intervalMs, message, offlineMessage, retryLabel, onRetry, ...rest }: ConnectionBannerProps): react.JSX.Element | null;
|
|
2716
3003
|
|
|
2717
3004
|
/** A series color: one of the eight categorical chart colors, or a status/accent color. */
|
|
2718
3005
|
type ChartTone = 'chart-1' | 'chart-2' | 'chart-3' | 'chart-4' | 'chart-5' | 'chart-6' | 'chart-7' | 'chart-8' | 'ok' | 'loss' | 'accent';
|
|
@@ -2822,6 +3109,11 @@ interface RangeBarProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children'
|
|
|
2822
3109
|
* the start edge, so it mirrors in right-to-left layouts. */
|
|
2823
3110
|
declare function RangeBar({ min, max, low, high, current, label, locale, className, ref, ...rest }: RangeBarProps): react.JSX.Element;
|
|
2824
3111
|
|
|
3112
|
+
/** Navigates after the layer that is closing has dropped its own history entry. Running
|
|
3113
|
+
* `history.back()` (the layer's cleanup) right after `location.assign` would cancel the
|
|
3114
|
+
* navigation, so wait for that pop to finish. Call it before closing the layer. */
|
|
3115
|
+
declare function navigateFromLayer(rawHref: string): void;
|
|
3116
|
+
|
|
2825
3117
|
/** One row of the palette. */
|
|
2826
3118
|
interface CommandItem {
|
|
2827
3119
|
/** Stable key, unique within the list. */
|
|
@@ -2870,10 +3162,6 @@ interface CommandPaletteProps {
|
|
|
2870
3162
|
/** Called with the query when Enter is pressed and nothing matches (e.g. a web search). */
|
|
2871
3163
|
onSubmitQuery?: (q: string) => void;
|
|
2872
3164
|
}
|
|
2873
|
-
/** Navigates after the layer that is closing has dropped its own history entry. Running
|
|
2874
|
-
* `history.back()` (the layer's cleanup) right after `location.assign` would cancel the
|
|
2875
|
-
* navigation, so wait for that pop to finish. Call it before closing the layer. */
|
|
2876
|
-
declare function navigateFromLayer(rawHref: string): void;
|
|
2877
3165
|
/**
|
|
2878
3166
|
* Registers the palette hotkeys: Ctrl/Cmd+K anywhere, and `/` when focus is not in a
|
|
2879
3167
|
* field. For apps that render their own trigger or palette.
|
|
@@ -3075,239 +3363,6 @@ interface AnimatedListProps<T> extends Omit<ComponentPropsWithoutRef<'ul'>, 'chi
|
|
|
3075
3363
|
* function gets each item's phase. Under reduced motion changes are instant. */
|
|
3076
3364
|
declare function AnimatedList<T>({ items, getKey, children, exitMs, as, className, itemClassName, ref, ...rest }: AnimatedListProps<T>): react.JSX.Element;
|
|
3077
3365
|
|
|
3078
|
-
/** How loud an event is: `info` is listed only, `normal` is pushed, `urgent` is pushed even in quiet hours. */
|
|
3079
|
-
type InboxSeverity = 'info' | 'normal' | 'urgent';
|
|
3080
|
-
/** Which list the Inbox page shows. */
|
|
3081
|
-
type InboxView = 'open' | 'snoozed' | 'handled';
|
|
3082
|
-
/** Flat extra data attached to an event. */
|
|
3083
|
-
type InboxData = Record<string, string | number | boolean | null>;
|
|
3084
|
-
/** A button on an inbox item. Tapping it makes the inbox service POST an {@link InboxActionCall} to `target`,
|
|
3085
|
-
* server to server, and records the outcome on the item. */
|
|
3086
|
-
interface InboxAction {
|
|
3087
|
-
/** Unique within the event, matching /^[a-z0-9][a-z0-9-]{0,31}$/, for example 'retry' or 'approve'. */
|
|
3088
|
-
id: string;
|
|
3089
|
-
/** Button text, trimmed, 1-40 characters. Longer text is cut to 39 plus an ellipsis. */
|
|
3090
|
-
label: string;
|
|
3091
|
-
/** Always 'POST'. May be left out when sending. */
|
|
3092
|
-
method: 'POST';
|
|
3093
|
-
/** Loopback only: `http://127.0.0.1:<port>/path`, with an explicit port, no credentials and no #hash. Up to 2000 characters. */
|
|
3094
|
-
target: string;
|
|
3095
|
-
}
|
|
3096
|
-
/** The outcome of the last action run on an item. */
|
|
3097
|
-
interface InboxActionResult {
|
|
3098
|
-
/** Which action ran. */
|
|
3099
|
-
actionId: string;
|
|
3100
|
-
/** True when the target answered 2xx; the item is then handled by the user. */
|
|
3101
|
-
ok: boolean;
|
|
3102
|
-
/** The target's HTTP status, or null on a timeout or network error. */
|
|
3103
|
-
status: number | null;
|
|
3104
|
-
/** What went wrong, or null on success. */
|
|
3105
|
-
error: string | null;
|
|
3106
|
-
/** When it ran, ISO. */
|
|
3107
|
-
at: string;
|
|
3108
|
-
}
|
|
3109
|
-
/** The JSON body the inbox service POSTs to an action's target, with the header `X-Inbox-Action: 1`.
|
|
3110
|
-
* Answer 2xx within {@link INBOX_ACTION_TIMEOUT_MS} for success; anything else is recorded as a failure. */
|
|
3111
|
-
interface InboxActionCall {
|
|
3112
|
-
/** The inbox item's id. */
|
|
3113
|
-
itemId: number;
|
|
3114
|
-
/** Which action was tapped. */
|
|
3115
|
-
actionId: string;
|
|
3116
|
-
/** The item's source. */
|
|
3117
|
-
source: string;
|
|
3118
|
-
/** The item's kind. */
|
|
3119
|
-
kind: string;
|
|
3120
|
-
/** The item's dedupeKey, or null. */
|
|
3121
|
-
dedupeKey: string | null;
|
|
3122
|
-
/** The item's extra data, or null. */
|
|
3123
|
-
data: InboxData | null;
|
|
3124
|
-
}
|
|
3125
|
-
/** Header the inbox service sends on every action call, with the value '1'. */
|
|
3126
|
-
declare const INBOX_ACTION_HEADER = "X-Inbox-Action";
|
|
3127
|
-
/** How long the inbox service waits for an action's target before recording a timeout. */
|
|
3128
|
-
declare const INBOX_ACTION_TIMEOUT_MS = 8000;
|
|
3129
|
-
/** What the service returns to the page. Times are ISO strings. */
|
|
3130
|
-
interface InboxItem {
|
|
3131
|
-
/** Row id. */
|
|
3132
|
-
id: number;
|
|
3133
|
-
/** Which app sent it. */
|
|
3134
|
-
source: string;
|
|
3135
|
-
/** What happened. */
|
|
3136
|
-
kind: string;
|
|
3137
|
-
/** Headline. */
|
|
3138
|
-
title: string;
|
|
3139
|
-
/** Details, or null. */
|
|
3140
|
-
body: string | null;
|
|
3141
|
-
/** Link, or null. */
|
|
3142
|
-
url: string | null;
|
|
3143
|
-
/** Current severity (the highest seen while open). */
|
|
3144
|
-
severity: InboxSeverity;
|
|
3145
|
-
/** How many events merged into this item. */
|
|
3146
|
-
count: number;
|
|
3147
|
-
/** When the item was first created. */
|
|
3148
|
-
createdAt: string;
|
|
3149
|
-
/** When the item last changed. */
|
|
3150
|
-
updatedAt: string;
|
|
3151
|
-
/** When the latest event happened. */
|
|
3152
|
-
occurredAt: string;
|
|
3153
|
-
/** When the item was handled, or null while open. */
|
|
3154
|
-
handledAt: string | null;
|
|
3155
|
-
/** Who handled it, or null while open. */
|
|
3156
|
-
handledBy: 'user' | 'source' | 'expired' | null;
|
|
3157
|
-
/** When a snoozed item comes back, or null. */
|
|
3158
|
-
snoozedUntil: string | null;
|
|
3159
|
-
/** Extra data, or null. */
|
|
3160
|
-
data: InboxData | null;
|
|
3161
|
-
/** Buttons from the latest event. The service always sends this ([] when none); optional for older services. */
|
|
3162
|
-
actions?: InboxAction[];
|
|
3163
|
-
/** The last action run on this item, or null. */
|
|
3164
|
-
lastAction?: InboxActionResult | null;
|
|
3165
|
-
}
|
|
3166
|
-
/** Inbox settings, editable on the page. */
|
|
3167
|
-
interface InboxSettings {
|
|
3168
|
-
/** IANA time zone used for quiet hours and the digest. */
|
|
3169
|
-
timezone: string;
|
|
3170
|
-
/** Normal pushes are held between start and end; urgent ones still go. Times are 'HH:MM' 24h. */
|
|
3171
|
-
quietHours: {
|
|
3172
|
-
enabled: boolean;
|
|
3173
|
-
start: string;
|
|
3174
|
-
end: string;
|
|
3175
|
-
};
|
|
3176
|
-
/** One summary push a day at `time` ('HH:MM' 24h). */
|
|
3177
|
-
digest: {
|
|
3178
|
-
enabled: boolean;
|
|
3179
|
-
time: string;
|
|
3180
|
-
};
|
|
3181
|
-
/** Sources that never push. */
|
|
3182
|
-
mutedSources: string[];
|
|
3183
|
-
}
|
|
3184
|
-
/** Settings used until they are changed on the Inbox page. */
|
|
3185
|
-
declare const INBOX_DEFAULT_SETTINGS: InboxSettings;
|
|
3186
|
-
/** Display names for known sources; unknown ids show as-is. */
|
|
3187
|
-
declare const INBOX_SOURCE_LABELS: Record<string, string>;
|
|
3188
|
-
/** One page of the item list plus counts for the tabs and source filter. */
|
|
3189
|
-
interface InboxListResponse {
|
|
3190
|
-
/** Items in the requested view, newest first. */
|
|
3191
|
-
items: InboxItem[];
|
|
3192
|
-
/** Pass back to fetch the next page, or null at the end. */
|
|
3193
|
-
nextCursor: string | null;
|
|
3194
|
-
/** Item counts per view, and open items that are urgent. */
|
|
3195
|
-
counts: {
|
|
3196
|
-
open: number;
|
|
3197
|
-
snoozed: number;
|
|
3198
|
-
handled: number;
|
|
3199
|
-
urgent: number;
|
|
3200
|
-
};
|
|
3201
|
-
/** Every source with any item in the last 30 days, with its open count for the current view filter. */
|
|
3202
|
-
sources: Array<{
|
|
3203
|
-
id: string;
|
|
3204
|
-
open: number;
|
|
3205
|
-
}>;
|
|
3206
|
-
}
|
|
3207
|
-
|
|
3208
|
-
/** Text the Inbox shows that has no key in `NishStrings`. Give any of them to `Inbox` as `labels`;
|
|
3209
|
-
* each one wins over its English default. */
|
|
3210
|
-
interface InboxLabels {
|
|
3211
|
-
/** Names of the severity dots. */
|
|
3212
|
-
urgent: string;
|
|
3213
|
-
normal: string;
|
|
3214
|
-
info: string;
|
|
3215
|
-
/** Snooze menu entries. */
|
|
3216
|
-
snooze1h: string;
|
|
3217
|
-
snooze4h: string;
|
|
3218
|
-
snoozeTomorrow: string;
|
|
3219
|
-
snoozeMonday: string;
|
|
3220
|
-
/** Button of a snoozed item. */
|
|
3221
|
-
unsnooze: string;
|
|
3222
|
-
/** Button of a handled item. */
|
|
3223
|
-
moveBack: string;
|
|
3224
|
-
/** "Mark all handled" button, and the confirm dialog's title. */
|
|
3225
|
-
markAllHandled: string;
|
|
3226
|
-
markAllTitle: (count: number) => string;
|
|
3227
|
-
/** The "All" chip of the source filter. */
|
|
3228
|
-
all: string;
|
|
3229
|
-
loadMore: string;
|
|
3230
|
-
/** Collapses a long body. The expand button is the `more` string. */
|
|
3231
|
-
less: string;
|
|
3232
|
-
/** "Until 14:00" under a snoozed item. */
|
|
3233
|
-
until: (when: string) => string;
|
|
3234
|
-
/** "Handled 2 hours ago" under a handled item, then optionally the suffix for who handled it. */
|
|
3235
|
-
handledAgo: (when: string) => string;
|
|
3236
|
-
handledByApp: string;
|
|
3237
|
-
handledAutomatically: string;
|
|
3238
|
-
/** "Retry ran 14:02" and "Retry failed 14:02 · HTTP 500". `why` is null when nothing is known. */
|
|
3239
|
-
actionRan: (label: string, at: string) => string;
|
|
3240
|
-
actionFailed: (label: string, at: string, why: string | null) => string;
|
|
3241
|
-
/** The empty list of each view; `source` is the name of the filtered source, or null. */
|
|
3242
|
-
emptyOpen: (source: string | null) => string;
|
|
3243
|
-
emptySnoozed: (source: string | null) => string;
|
|
3244
|
-
emptyHandled: (source: string | null) => string;
|
|
3245
|
-
}
|
|
3246
|
-
declare const DEFAULT_INBOX_LABELS: InboxLabels;
|
|
3247
|
-
|
|
3248
|
-
interface InboxProps extends Omit<ComponentPropsWithoutRef<'div'>, 'children' | 'onChange'> {
|
|
3249
|
-
ref?: Ref<HTMLElement>;
|
|
3250
|
-
/** The items of the current view, newest activity first. */
|
|
3251
|
-
items: InboxItem[];
|
|
3252
|
-
/** Which list is showing: open, snoozed or handled. */
|
|
3253
|
-
view: InboxView;
|
|
3254
|
-
/** Called when a tab is picked. */
|
|
3255
|
-
onViewChange: (view: InboxView) => void;
|
|
3256
|
-
/** Totals for the tabs. Open and snoozed show as counts on their tabs. */
|
|
3257
|
-
counts: {
|
|
3258
|
-
open: number;
|
|
3259
|
-
snoozed: number;
|
|
3260
|
-
handled: number;
|
|
3261
|
-
};
|
|
3262
|
-
/** Sources for the filter chips, each with its open count. The filter row is hidden with one source or fewer. */
|
|
3263
|
-
sources: Array<{
|
|
3264
|
-
id: string;
|
|
3265
|
-
open: number;
|
|
3266
|
-
}>;
|
|
3267
|
-
/** The source the list is filtered to, or null for all. */
|
|
3268
|
-
source: string | null;
|
|
3269
|
-
/** Called when a source chip is picked; null means "All". */
|
|
3270
|
-
onSourceChange: (source: string | null) => void;
|
|
3271
|
-
/** Marks an item handled. */
|
|
3272
|
-
onHandle: (id: number) => void;
|
|
3273
|
-
/** Moves a handled item back to open. */
|
|
3274
|
-
onUnhandle: (id: number) => void;
|
|
3275
|
-
/** Snoozes an item until the given time. */
|
|
3276
|
-
onSnooze: (id: number, until: Date) => void;
|
|
3277
|
-
/** Brings a snoozed item back now. */
|
|
3278
|
-
onUnsnooze: (id: number) => void;
|
|
3279
|
-
/** Runs one of an item's actions (the inbox service's POST /api/items/:id/actions/:actionId). When given,
|
|
3280
|
-
* each item's actions show as buttons in the open and snoozed views. While the promise is pending that
|
|
3281
|
-
* button shows a spinner and the item's other actions are disabled. A rejection is ignored here; toast it. */
|
|
3282
|
-
onAction?: (itemId: number, actionId: string) => Promise<void>;
|
|
3283
|
-
/** Shows "Mark all handled" in the open view when given and there are items. A confirmation comes first. */
|
|
3284
|
-
onHandleAll?: () => void;
|
|
3285
|
-
/** First load: shows skeleton rows in place of the list. */
|
|
3286
|
-
loading?: boolean;
|
|
3287
|
-
/** A failed load: shows an ErrorState with this text as the body. */
|
|
3288
|
-
error?: string | null;
|
|
3289
|
-
/** Shows a Retry button on the error state. */
|
|
3290
|
-
onRetry?: () => void;
|
|
3291
|
-
/** More items exist after the last one: shows "Load more". */
|
|
3292
|
-
hasMore?: boolean;
|
|
3293
|
-
/** Called by "Load more". */
|
|
3294
|
-
onLoadMore?: () => void;
|
|
3295
|
-
/** "Load more" shows a spinner and is disabled while the next page loads. */
|
|
3296
|
-
loadingMore?: boolean;
|
|
3297
|
-
/** The item to highlight and scroll into view once (a link from a notification). */
|
|
3298
|
-
selectedId?: number | null;
|
|
3299
|
-
/** Display names per source id. Default INBOX_SOURCE_LABELS; unknown ids show as they are. */
|
|
3300
|
-
sourceLabels?: Record<string, string>;
|
|
3301
|
-
/** Text that has no key in the provider's strings (snooze options, messages). Each wins over its English default. */
|
|
3302
|
-
labels?: Partial<InboxLabels>;
|
|
3303
|
-
/** Classes for the card. */
|
|
3304
|
-
className?: string;
|
|
3305
|
-
}
|
|
3306
|
-
/** One inbox for events from every app: Open, Snoozed and Handled views, a source filter, and per-item
|
|
3307
|
-
* handle, snooze and undo actions. The page owns the data and the calls; this component only renders
|
|
3308
|
-
* and reports what was picked. Rows wrap at phone widths and the actions collapse into one menu under 480px. */
|
|
3309
|
-
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;
|
|
3310
|
-
|
|
3311
3366
|
interface AppShellSidebar {
|
|
3312
3367
|
/** Controlled collapsed state; pair it with onCollapsedChange. */
|
|
3313
3368
|
collapsed?: boolean;
|
|
@@ -3323,6 +3378,13 @@ interface AppShellSidebar {
|
|
|
3323
3378
|
/** Next to the collapse button at the bottom. Sidebar only: put anything people need on a
|
|
3324
3379
|
* phone in `actions` or `moreItems` too. */
|
|
3325
3380
|
footer?: ReactNode;
|
|
3381
|
+
/** From 1024px, hides the header and puts this brand at the top of the sidebar, under the hub pill.
|
|
3382
|
+
* The sidebar then also holds `actions` (after `tools`), the theme toggle and the More menu (in its foot).
|
|
3383
|
+
* Collapsed, a slim bar above the page shows the hub pill and the brand. A function gets the collapsed
|
|
3384
|
+
* state, for a shorter brand in the bar. Below 1024px the header is unchanged. */
|
|
3385
|
+
brand?: ReactNode | ((state: {
|
|
3386
|
+
collapsed: boolean;
|
|
3387
|
+
}) => ReactNode);
|
|
3326
3388
|
}
|
|
3327
3389
|
interface AppShellProps {
|
|
3328
3390
|
/** App name (wordmark) and icon for the header. */
|
|
@@ -3370,16 +3432,42 @@ interface AppShellProps {
|
|
|
3370
3432
|
errorBoundary?: boolean;
|
|
3371
3433
|
/** Changes reset the error boundary and close the MoreSheet (pass the pathname). */
|
|
3372
3434
|
resetKey?: string;
|
|
3435
|
+
/** adaptive (default): BottomNav under 768px, the rail to 1023px, then header tabs or the sidebar.
|
|
3436
|
+
* header: the nav stays as tabs on the header's second row at every width, with no BottomNav, rail,
|
|
3437
|
+
* sidebar or More sheet; moreItems go in the header More menu. For apps with two or three pages. */
|
|
3438
|
+
navMode?: 'adaptive' | 'header';
|
|
3439
|
+
/** The look of the header nav. underline (default): tabs on the header's second row. pill: from 1024px,
|
|
3440
|
+
* pills in the header row before `actions` (header mode keeps them on the second row). */
|
|
3441
|
+
tabs?: 'underline' | 'pill';
|
|
3442
|
+
/** Keys of the BottomNav items, in order, instead of the first `primary`. The other nav items go in the
|
|
3443
|
+
* More sheet, in nav order, before moreItems. Unknown keys are skipped with a dev warning. */
|
|
3444
|
+
bottomNav?: string[];
|
|
3445
|
+
/** false removes the header More menu, so moreItems are only in the phone More sheet. Then put those
|
|
3446
|
+
* actions in `actions` from 768px yourself, so none is phone-only. Default true. */
|
|
3447
|
+
moreMenu?: boolean;
|
|
3448
|
+
/** Classes for the header's inner rows (AppHeader innerClassName), e.g. "mx-auto max-w-7xl". */
|
|
3449
|
+
headerInnerClassName?: string;
|
|
3450
|
+
/** Classes merged into the PageContainer (a max width, a top padding). Ignored with container={false}. */
|
|
3451
|
+
containerClassName?: string;
|
|
3452
|
+
/** After the main landmark, in the same container: the page footer. Not rendered with fullHeight. */
|
|
3453
|
+
footer?: ReactNode;
|
|
3454
|
+
/** The main element gets exactly the height under the header and banners, as a flex column that does not
|
|
3455
|
+
* scroll, for a page that scrolls inside its own panes. container and footer are not used. */
|
|
3456
|
+
fullHeight?: boolean;
|
|
3457
|
+
/** While nav is empty (sign-in being checked), this many placeholder tabs in the header, so it keeps its
|
|
3458
|
+
* height. Shown where tabs show: from 1024px, or at every width with navMode="header". Default 0. */
|
|
3459
|
+
navPending?: number;
|
|
3373
3460
|
children: ReactNode;
|
|
3374
3461
|
}
|
|
3375
3462
|
/**
|
|
3376
|
-
* The app frame: skip link, header
|
|
3377
|
-
*
|
|
3378
|
-
* container, an error boundary and the Toaster, all from one `nav` list.
|
|
3379
|
-
*
|
|
3380
|
-
*
|
|
3463
|
+
* The app frame: skip link, header, loading bar, connection banner, the NavRail (768 to
|
|
3464
|
+
* 1023px), the BottomNav with a More sheet (under 768px, loaded on demand), the page
|
|
3465
|
+
* container, an error boundary and the Toaster, all from one `nav` list. Under 768px the
|
|
3466
|
+
* BottomNav shows, from 768px the rail, from 1024px tabs in the header or the sidebar;
|
|
3467
|
+
* navMode="header" keeps header tabs at every width. With no nav it is the signed-out frame:
|
|
3468
|
+
* header, banners and page only.
|
|
3381
3469
|
*/
|
|
3382
|
-
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;
|
|
3470
|
+
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, navMode, tabs, bottomNav, moreMenu: moreMenuProp, headerInnerClassName, containerClassName, footer, fullHeight, navPending, children, }: AppShellProps): react.JSX.Element;
|
|
3383
3471
|
|
|
3384
3472
|
declare class ApiError extends Error {
|
|
3385
3473
|
/** HTTP status; 0 = network failure or abort-by-timeout. */
|
|
@@ -3611,58 +3699,6 @@ interface NumberFieldProps extends Omit<InputProps, 'value' | 'onChange' | 'type
|
|
|
3611
3699
|
/** A numeric setting that saves when you leave the field or press Enter. */
|
|
3612
3700
|
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;
|
|
3613
3701
|
|
|
3614
|
-
/** A service token as the settings page sees it: never the hash. */
|
|
3615
|
-
interface ServiceTokenView {
|
|
3616
|
-
id: string;
|
|
3617
|
-
name: string;
|
|
3618
|
-
scopes: string[];
|
|
3619
|
-
created: string;
|
|
3620
|
-
source: 'file' | 'env';
|
|
3621
|
-
revoked: boolean;
|
|
3622
|
-
revokedAt?: string;
|
|
3623
|
-
}
|
|
3624
|
-
interface ServiceTokenListResponse {
|
|
3625
|
-
tokens: ServiceTokenView[];
|
|
3626
|
-
}
|
|
3627
|
-
|
|
3628
|
-
interface UseServiceTokens {
|
|
3629
|
-
/** undefined until the first load finishes. */
|
|
3630
|
-
tokens: ServiceTokenView[] | undefined;
|
|
3631
|
-
loading: boolean;
|
|
3632
|
-
error: string | null;
|
|
3633
|
-
reload: () => void;
|
|
3634
|
-
/** Revokes the token with this id and replaces `tokens` with the server's new list. Throws the ApiError on failure. */
|
|
3635
|
-
revoke: (id: string) => Promise<void>;
|
|
3636
|
-
}
|
|
3637
|
-
/** Loads the app's service tokens from `url` (GET) and revokes one with POST `${url}/<id>/revoke`.
|
|
3638
|
-
* The server side is `mountServiceTokenRoutes` from `@nish/ui/server/hono`. */
|
|
3639
|
-
declare function useServiceTokens(url?: string): UseServiceTokens;
|
|
3640
|
-
interface ServiceTokensSectionProps extends Omit<ComponentPropsWithRef<"section">, "title" | "children"> {
|
|
3641
|
-
/** undefined = loading. */
|
|
3642
|
-
tokens: ServiceTokenView[] | undefined;
|
|
3643
|
-
error?: string | null;
|
|
3644
|
-
onRetry?: () => void;
|
|
3645
|
-
/** Revokes the token. Reject to keep the dialog open with the error. */
|
|
3646
|
-
onRevoke: (id: string) => Promise<void>;
|
|
3647
|
-
/** Default: the `serviceTokens` string ("Service tokens"). */
|
|
3648
|
-
title?: ReactNode;
|
|
3649
|
-
/** Default: the `serviceTokensIntro` string. */
|
|
3650
|
-
description?: ReactNode;
|
|
3651
|
-
/** Anchor id on the section. Default "service-tokens". */
|
|
3652
|
-
id?: string;
|
|
3653
|
-
className?: string;
|
|
3654
|
-
/** Shown when the list is empty. Default "No service tokens. No machine client can read this app." */
|
|
3655
|
-
emptyMessage?: ReactNode;
|
|
3656
|
-
/** The body of the revoke confirmation. Default explains that the token stops working and cannot be restored. */
|
|
3657
|
-
revokeBody?: ReactNode;
|
|
3658
|
-
/** The "created <date>" part of a token's description. Default `created ${when}`. */
|
|
3659
|
-
createdLabel?: (when: string) => string;
|
|
3660
|
-
/** Added to the description of a token that comes from the SERVICE_TOKENS environment variable. Default "from SERVICE_TOKENS". */
|
|
3661
|
-
envSourceLabel?: string;
|
|
3662
|
-
}
|
|
3663
|
-
/** The settings block that lists an app's service tokens with a Revoke button each. */
|
|
3664
|
-
declare function ServiceTokensSection({ tokens, error, onRetry, onRevoke, title: titleProp, description: descriptionProp, id, className, emptyMessage, revokeBody, createdLabel, envSourceLabel, ...rest }: ServiceTokensSectionProps): react.JSX.Element;
|
|
3665
|
-
|
|
3666
3702
|
interface ComboboxOption {
|
|
3667
3703
|
value: string;
|
|
3668
3704
|
label: string;
|
|
@@ -3730,17 +3766,234 @@ interface ComboboxProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'
|
|
|
3730
3766
|
* input; `className` and other attributes go to the wrapper. */
|
|
3731
3767
|
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;
|
|
3732
3768
|
|
|
3769
|
+
type WeekDay = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
3770
|
+
|
|
3771
|
+
interface CalendarProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'children'> {
|
|
3772
|
+
/** The root element. */
|
|
3773
|
+
ref?: Ref<HTMLDivElement>;
|
|
3774
|
+
/** The picked day as YYYY-MM-DD (controlled), or null for none. */
|
|
3775
|
+
value?: string | null;
|
|
3776
|
+
/** The first picked day of an uncontrolled calendar. */
|
|
3777
|
+
defaultValue?: string | null;
|
|
3778
|
+
/** Called with the day the reader picks (YYYY-MM-DD). */
|
|
3779
|
+
onValueChange?: (value: string) => void;
|
|
3780
|
+
/** The month shown, as YYYY-MM (controlled). Pair with onMonthChange. */
|
|
3781
|
+
month?: string;
|
|
3782
|
+
/** The first month shown when uncontrolled. Default: the value's month, else this month. */
|
|
3783
|
+
defaultMonth?: string;
|
|
3784
|
+
/** Called with YYYY-MM when the shown month changes (buttons, keys, dropdowns). */
|
|
3785
|
+
onMonthChange?: (month: string) => void;
|
|
3786
|
+
/** Earliest day that can be picked (YYYY-MM-DD). */
|
|
3787
|
+
min?: string;
|
|
3788
|
+
/** Latest day that can be picked (YYYY-MM-DD). */
|
|
3789
|
+
max?: string;
|
|
3790
|
+
/** Return true to disable a day (YYYY-MM-DD), e.g. weekends. */
|
|
3791
|
+
isDateDisabled?: (date: string) => boolean;
|
|
3792
|
+
/** BCP 47 tag for month and weekday names. Default NishProvider locale, then setDefaultLocale() (en-US). */
|
|
3793
|
+
locale?: string;
|
|
3794
|
+
/** First column: 0 Sunday to 6 Saturday. Default from the locale's region. */
|
|
3795
|
+
weekStartsOn?: WeekDay;
|
|
3796
|
+
/** 'label' (default): the month name with previous and next buttons. 'dropdowns': month and year selects as well. */
|
|
3797
|
+
captionLayout?: 'label' | 'dropdowns';
|
|
3798
|
+
/** First year in the year select. Default min's year, else this year minus 100. */
|
|
3799
|
+
fromYear?: number;
|
|
3800
|
+
/** Last year in the year select. Default max's year, else this year plus 10. */
|
|
3801
|
+
toYear?: number;
|
|
3802
|
+
/** Focus the day that has the Tab stop when the calendar mounts (DatePicker sets it). */
|
|
3803
|
+
autoFocus?: boolean;
|
|
3804
|
+
/** Accessible name of the previous-month button. Default "Previous month". */
|
|
3805
|
+
previousMonthLabel?: string;
|
|
3806
|
+
/** Accessible name of the next-month button. Default "Next month". */
|
|
3807
|
+
nextMonthLabel?: string;
|
|
3808
|
+
}
|
|
3809
|
+
/** A month grid that picks one day. Arrow keys move by day and week, Page Up and Page Down by
|
|
3810
|
+
* month (with Shift, by year), Home and End to the ends of the week. Values are YYYY-MM-DD
|
|
3811
|
+
* strings, the same as `<input type="date">`. */
|
|
3812
|
+
declare function Calendar({ value, defaultValue, onValueChange, month: monthProp, defaultMonth, onMonthChange, min: minProp, max: maxProp, isDateDisabled, locale, weekStartsOn, captionLayout, fromYear, toYear, autoFocus, previousMonthLabel, nextMonthLabel, className, ref, ...rest }: CalendarProps): react.JSX.Element;
|
|
3813
|
+
|
|
3814
|
+
interface DatePickerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'children' | 'id' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'role'> {
|
|
3815
|
+
/** The text input. The remaining div attributes go to the wrapper. */
|
|
3816
|
+
ref?: Ref<HTMLInputElement>;
|
|
3817
|
+
/** The date as YYYY-MM-DD, or null for none (controlled). */
|
|
3818
|
+
value?: string | null;
|
|
3819
|
+
/** The starting date of an uncontrolled picker. */
|
|
3820
|
+
defaultValue?: string | null;
|
|
3821
|
+
/** Called with YYYY-MM-DD, or null when the field is cleared. */
|
|
3822
|
+
onValueChange?: (value: string | null) => void;
|
|
3823
|
+
/** Earliest date that can be picked or typed (YYYY-MM-DD). */
|
|
3824
|
+
min?: string;
|
|
3825
|
+
/** Latest date that can be picked or typed (YYYY-MM-DD). */
|
|
3826
|
+
max?: string;
|
|
3827
|
+
/** Return true to disable a date in the calendar and refuse it when typed. */
|
|
3828
|
+
isDateDisabled?: (date: string) => boolean;
|
|
3829
|
+
/** BCP 47 tag for the field format and the calendar. Default NishProvider locale, then setDefaultLocale(). */
|
|
3830
|
+
locale?: string;
|
|
3831
|
+
/** First column of the calendar: 0 Sunday to 6 Saturday. Default from the locale's region. */
|
|
3832
|
+
weekStartsOn?: WeekDay;
|
|
3833
|
+
/** Passed to the Calendar: 'dropdowns' adds month and year selects (birth dates). */
|
|
3834
|
+
captionLayout?: 'label' | 'dropdowns';
|
|
3835
|
+
/** Shown while empty. Default the locale's pattern, e.g. "MM/DD/YYYY". */
|
|
3836
|
+
placeholder?: string;
|
|
3837
|
+
/** Accessible name when there is no visible <label htmlFor={id}>. */
|
|
3838
|
+
'aria-label'?: string;
|
|
3839
|
+
/** Names the field by another element's id. */
|
|
3840
|
+
'aria-labelledby'?: string;
|
|
3841
|
+
/** Ids of help or error text; reaches the input (Field sets it). */
|
|
3842
|
+
'aria-describedby'?: string;
|
|
3843
|
+
/** Reaches the input (Field sets it on error). */
|
|
3844
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
3845
|
+
/** Same as aria-invalid="true". */
|
|
3846
|
+
invalid?: boolean;
|
|
3847
|
+
/** The id of the text input, so a <label htmlFor> and Field reach it. */
|
|
3848
|
+
id?: string;
|
|
3849
|
+
/** Field name for a native form: a hidden input posts YYYY-MM-DD. */
|
|
3850
|
+
name?: string;
|
|
3851
|
+
/** The id of the <form> the hidden input belongs to, when it is not an ancestor. */
|
|
3852
|
+
form?: string;
|
|
3853
|
+
/** Marks the field required. */
|
|
3854
|
+
required?: boolean;
|
|
3855
|
+
/** Turns off the text input and the calendar button. */
|
|
3856
|
+
disabled?: boolean;
|
|
3857
|
+
/** md h-9 (default) or sm h-8. Both grow to 44px on touch screens. */
|
|
3858
|
+
size?: 'sm' | 'md';
|
|
3859
|
+
/** Accessible name of the calendar button. Default "Choose date", or "Change date, <date>" once set. */
|
|
3860
|
+
calendarLabel?: string;
|
|
3861
|
+
/** Extra classes for the wrapper around the input and the calendar button. */
|
|
3862
|
+
className?: string;
|
|
3863
|
+
}
|
|
3864
|
+
/** A date field: type the date in the reader's own numeric order (or ISO), or pick it from a
|
|
3865
|
+
* Calendar in a Popover. The value is a YYYY-MM-DD string, like a native date input. `ref`,
|
|
3866
|
+
* `id`, `aria-*`, `name` and `required` belong to the input; `className` and other attributes
|
|
3867
|
+
* go to the wrapper. */
|
|
3868
|
+
declare function DatePicker({ ref, value: valueProp, defaultValue, onValueChange, min: minProp, max: maxProp, isDateDisabled, locale, weekStartsOn, captionLayout, placeholder, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, invalid, id, name, form, required, disabled, size, calendarLabel, className, ...rest }: DatePickerProps): react.JSX.Element;
|
|
3869
|
+
|
|
3870
|
+
interface MultiSelectProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'children' | 'id' | 'aria-label' | 'aria-labelledby' | 'aria-describedby' | 'aria-invalid' | 'role'> {
|
|
3871
|
+
/** The text input (the combobox element). The remaining div attributes go to the wrapper. */
|
|
3872
|
+
ref?: Ref<HTMLInputElement>;
|
|
3873
|
+
/** The choices: `{ value, label, disabled? }` objects, the same as Combobox. */
|
|
3874
|
+
options: ComboboxOption[];
|
|
3875
|
+
/** The picked values, in the order they were picked (controlled). */
|
|
3876
|
+
value?: string[];
|
|
3877
|
+
/** The starting values of an uncontrolled MultiSelect. */
|
|
3878
|
+
defaultValue?: string[];
|
|
3879
|
+
/** Called with the new list of values. */
|
|
3880
|
+
onValueChange?: (value: string[]) => void;
|
|
3881
|
+
/** Called with the new values and their options. */
|
|
3882
|
+
onChange?: (value: string[], options: ComboboxOption[]) => void;
|
|
3883
|
+
/** Filtering. Default: case-insensitive substring on label and hint; show at most 50.
|
|
3884
|
+
* With `onQueryChange` and no `filter`, options are shown as given (the server filtered them). */
|
|
3885
|
+
filter?: (option: ComboboxOption, query: string) => boolean;
|
|
3886
|
+
/** No more than this many values can be picked; the rest of the options are disabled. */
|
|
3887
|
+
maxSelected?: number;
|
|
3888
|
+
/** Shown in the text box while nothing is picked. */
|
|
3889
|
+
placeholder?: string;
|
|
3890
|
+
/** Accessible name of the text input. Give this, `aria-labelledby` or `id` with a Label. */
|
|
3891
|
+
'aria-label'?: string;
|
|
3892
|
+
/** The id of the element that names the text input. */
|
|
3893
|
+
'aria-labelledby'?: string;
|
|
3894
|
+
/** The id of the element that describes the text input (help or error text). */
|
|
3895
|
+
'aria-describedby'?: string;
|
|
3896
|
+
/** Marks the text input invalid and gives the box a red border. */
|
|
3897
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
3898
|
+
/** Same as aria-invalid="true". */
|
|
3899
|
+
invalid?: boolean;
|
|
3900
|
+
/** The id of the text input. */
|
|
3901
|
+
id?: string;
|
|
3902
|
+
/** Field name for a native form: one hidden input per picked value. */
|
|
3903
|
+
name?: string;
|
|
3904
|
+
/** The id of the <form> the hidden inputs belong to. */
|
|
3905
|
+
form?: string;
|
|
3906
|
+
/** Required while nothing is picked. */
|
|
3907
|
+
required?: boolean;
|
|
3908
|
+
/** Turns the field off: no typing, picking or removing tags. */
|
|
3909
|
+
disabled?: boolean;
|
|
3910
|
+
/** Shown when nothing matches. Default "No matches" (NishProvider strings). */
|
|
3911
|
+
emptyText?: string;
|
|
3912
|
+
/** Async options: called (debounced 200ms) with the query. */
|
|
3913
|
+
onQueryChange?: (q: string) => void;
|
|
3914
|
+
/** Shows a Spinner row "Searching…" while true. */
|
|
3915
|
+
loading?: boolean;
|
|
3916
|
+
/** The loading row and its announcement. Default "Searching…" (NishProvider strings). */
|
|
3917
|
+
loadingText?: string;
|
|
3918
|
+
/** The polite announcement of the result count. Default "3 results" / "1 result". */
|
|
3919
|
+
resultsText?: (count: number) => string;
|
|
3920
|
+
/** md (default) or sm. Both grow to 44px on touch screens. */
|
|
3921
|
+
size?: 'sm' | 'md';
|
|
3922
|
+
/** Accessible name of the clear-all button. Default "Clear all" (NishProvider strings). */
|
|
3923
|
+
clearLabel?: string;
|
|
3924
|
+
/** Extra classes for the wrapper around the field box and the list. */
|
|
3925
|
+
className?: string;
|
|
3926
|
+
}
|
|
3927
|
+
/** An editable combobox that picks several options. Picked values show as removable tags,
|
|
3928
|
+
* the list stays open after a pick, and every value posts as its own hidden input. `ref`,
|
|
3929
|
+
* `id`, `aria-*` and `required` belong to the text input; `className` and other attributes
|
|
3930
|
+
* go to the wrapper. */
|
|
3931
|
+
declare function MultiSelect({ ref, options, value: valueProp, defaultValue, onValueChange, onChange, filter, maxSelected, placeholder, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, 'aria-invalid': ariaInvalid, invalid, id, name, form, required, disabled, emptyText, onQueryChange, loading, loadingText, resultsText, size, clearLabel, className, ...rest }: MultiSelectProps): react.JSX.Element;
|
|
3932
|
+
|
|
3933
|
+
interface CarouselProps extends Omit<HTMLAttributes<HTMLElement>, 'children' | 'aria-label'> {
|
|
3934
|
+
/** The root <section>. */
|
|
3935
|
+
ref?: Ref<HTMLElement>;
|
|
3936
|
+
/** Required: names the carousel ("Featured trips"). */
|
|
3937
|
+
'aria-label': string;
|
|
3938
|
+
/** One child per slide. */
|
|
3939
|
+
children: ReactNode;
|
|
3940
|
+
/** The current slide (controlled), from 0. */
|
|
3941
|
+
index?: number;
|
|
3942
|
+
/** The first slide of an uncontrolled carousel. Default 0. */
|
|
3943
|
+
defaultIndex?: number;
|
|
3944
|
+
/** Called with the new index after a button, a key, a swipe or rotation. */
|
|
3945
|
+
onIndexChange?: (index: number) => void;
|
|
3946
|
+
/** Width of each slide, any CSS length. Default "100%"; "85%" shows the next slide peeking in. */
|
|
3947
|
+
slideWidth?: string;
|
|
3948
|
+
/** Previous at the first slide goes to the last, and next at the last goes to the first. Default false. */
|
|
3949
|
+
loop?: boolean;
|
|
3950
|
+
/** Rotate every this many milliseconds (at least 2000). Off by default. */
|
|
3951
|
+
autoPlay?: number;
|
|
3952
|
+
/** Dots to pick a slide. Default: shown when there are 7 slides or fewer, a "3 / 12" counter otherwise. */
|
|
3953
|
+
indicators?: boolean;
|
|
3954
|
+
/** Names each slide for screen readers. Default "1 of 5". */
|
|
3955
|
+
slideLabel?: (n: number, count: number) => string;
|
|
3956
|
+
/** Accessible name of the previous button. Default "Previous slide". */
|
|
3957
|
+
previousLabel?: string;
|
|
3958
|
+
/** Accessible name of the next button. Default "Next slide". */
|
|
3959
|
+
nextLabel?: string;
|
|
3960
|
+
/** Extra classes for the carousel root. */
|
|
3961
|
+
className?: string;
|
|
3962
|
+
}
|
|
3963
|
+
/** A scroll-snap carousel: swipe, previous and next buttons, slide dots, arrow keys and optional auto-rotation. */
|
|
3964
|
+
declare function Carousel({ 'aria-label': ariaLabel, children, index: indexProp, defaultIndex, onIndexChange, slideWidth, loop, autoPlay, indicators, slideLabel, previousLabel, nextLabel, className, ref, onPointerEnter, onPointerLeave, onFocus, onBlur, ...rest }: CarouselProps): react.JSX.Element;
|
|
3965
|
+
|
|
3733
3966
|
/** The handful of icons the shared components need, inlined so the package does not
|
|
3734
3967
|
* pin apps to one lucide-react version. 24px grid, 2px stroke, lucide geometry. */
|
|
3735
3968
|
type IconProps = SVGProps<SVGSVGElement> & {
|
|
3969
|
+
/** Width and height in px (default 16). The stroke stays 2px. */
|
|
3736
3970
|
size?: number;
|
|
3737
3971
|
};
|
|
3972
|
+
declare const XIcon: (p: IconProps) => react.JSX.Element;
|
|
3973
|
+
declare const CheckCircleIcon: (p: IconProps) => react.JSX.Element;
|
|
3974
|
+
declare const AlertTriangleIcon: (p: IconProps) => react.JSX.Element;
|
|
3975
|
+
declare const InfoIcon: (p: IconProps) => react.JSX.Element;
|
|
3976
|
+
declare const RotateIcon: (p: IconProps) => react.JSX.Element;
|
|
3977
|
+
declare const LoaderIcon: (p: IconProps) => react.JSX.Element;
|
|
3978
|
+
declare const SunIcon: (p: IconProps) => react.JSX.Element;
|
|
3979
|
+
declare const MoonIcon: (p: IconProps) => react.JSX.Element;
|
|
3980
|
+
declare const MonitorIcon: (p: IconProps) => react.JSX.Element;
|
|
3981
|
+
declare const ChevronDownIcon: (p: IconProps) => react.JSX.Element;
|
|
3738
3982
|
declare const CheckIcon: (p: IconProps) => react.JSX.Element;
|
|
3739
3983
|
declare const ClockIcon: (p: IconProps) => react.JSX.Element;
|
|
3740
3984
|
/** Three horizontal dots. */
|
|
3741
3985
|
declare const MoreIcon: (p: IconProps) => react.JSX.Element;
|
|
3742
3986
|
declare const BellIcon: (p: IconProps) => react.JSX.Element;
|
|
3743
3987
|
declare const SettingsIcon: (p: IconProps) => react.JSX.Element;
|
|
3988
|
+
/** A panel with its left column and an arrow pointing in: collapse a sidebar. */
|
|
3989
|
+
declare const PanelLeftCloseIcon: (p: IconProps) => react.JSX.Element;
|
|
3990
|
+
/** A panel with its left column and an arrow pointing out: expand a sidebar. */
|
|
3991
|
+
declare const PanelLeftOpenIcon: (p: IconProps) => react.JSX.Element;
|
|
3992
|
+
declare const ChevronLeftIcon: (p: IconProps) => react.JSX.Element;
|
|
3993
|
+
declare const ChevronRightIcon: (p: IconProps) => react.JSX.Element;
|
|
3994
|
+
declare const CalendarIcon: (p: IconProps) => react.JSX.Element;
|
|
3995
|
+
declare const PauseIcon: (p: IconProps) => react.JSX.Element;
|
|
3996
|
+
declare const PlayIcon: (p: IconProps) => react.JSX.Element;
|
|
3744
3997
|
|
|
3745
3998
|
type LayoutNode = {
|
|
3746
3999
|
type: "leaf";
|
|
@@ -4399,5 +4652,5 @@ interface VisuallyHiddenProps extends ComponentPropsWithoutRef<'span'> {
|
|
|
4399
4652
|
* without Tailwind or any stylesheet. A `style` prop is merged after the hiding styles. */
|
|
4400
4653
|
declare function VisuallyHidden({ as, style, ref, ...rest }: VisuallyHiddenProps): react.JSX.Element;
|
|
4401
4654
|
|
|
4402
|
-
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,
|
|
4403
|
-
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,
|
|
4655
|
+
export { Accordion, AccordionItem, ActivityFeed, AgentNode, AlertTriangleIcon, AnimatedList, ApiError, AppErrorBoundary, AppHeader, AppShell, AsyncPanel, Avatar, AvatarGroup, BREAKPOINTS, Badge, BarChart, BellIcon, BottomNav, Breadcrumbs, Button, COLOR_ROLES, Calendar, CalendarIcon, Callout, Card, CardHeader, CardListSkeleton, Carousel, ChartLegend, CheckCircleIcon, CheckIcon, Checkbox, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, Chip, ChipGroup, ClockIcon, Combobox, CommandPalette, ConfirmDialog, ConnectionBanner, ContextMenu, CopyButton, DEFAULT_STRINGS, DEFAULT_THEME, DatePicker, Disclosure, Drawer, DropdownMenu, EmptyState, ErrorState, Favicon, Field, FieldGroup, FileDropzone, FilterBar, FilterSheet, FlowSteps, HUE_ROLES, HoverCard, IconButton, InfoIcon, Input, Kbd, KeyValueList, Label, LayoutPresetIcon, LayoutPresetPicker, LineChart, LinkCard, ListRow, LoaderIcon, LoadingBar, MAX_PANES, MediaChip, MediaRow, MediaThumb, MenuItem, MenuLabel, MenuSeparator, MenuSubHeader, Meter, Modal, MonitorIcon, MoonIcon, MoreIcon, MoreSheet, MultiSelect, NARROW_BREAKPOINT, NARROW_MAX, NARROW_QUERY, NavRail, NishProvider, NumberField, PHONE_QUERY, PRESETS, PageContainer, PageHeader, Pagination, PanelLeftCloseIcon, PanelLeftOpenIcon, PauseIcon, PlayIcon, Popover, Portal, Progress, Radio, RadioGroup, RangeBar, RelativeTime, ResponsiveTable, RotateIcon, SCALE, SHADOWS, SOFT_ROLES, ScrollRow, SearchInput, SectionHeader, SectionNav, Segmented, Select, Separator, SettingRow, SettingsIcon, SettingsSection, Skeleton, SkeletonCard, SkeletonLines, SkeletonRows, Slider, Sparkline, Spinner, SplitDividers, SplitStage, Stat, StatGrid, StatGridSkeleton, StatusDot, StepBar, StickyActionBar, StickyBar, SunIcon, Switch, THEMES, TOGGLE_ORDER, TabPanel, Table, TableWrap, Tabs, TagInput, Td, Textarea, Th, ThemeToggle, TickerText, Toaster, Tooltip, Tr, TreeView, VERSION, VirtualList, VirtualTable, VisuallyHidden, WorkflowBoard, XIcon, 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, useStuck, useTheme, useToast, useUrlState };
|
|
4656
|
+
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, CalendarProps, CalloutProps, CalloutTone, CardClassOptions, CardElement, CardHeaderProps, CardListSkeletonProps, CardPadding, CardProps, CarouselProps, ChartLegendItem, ChartLegendProps, ChartLegendTone, ChartTone, CheckboxProps, ChipClassOptions, ChipGroupProps, ChipProps, ChipVariant, Column, ComboboxOption, ComboboxProps, CommandItem, CommandPaletteProps, ConfirmDialogOptions, ConfirmDialogProps, ConnectionBannerProps, ContextMenuProps, CopyButtonProps, DateOptions, DatePickerProps, DisclosureProps, Divider, DrawerProps, DropdownMenuProps, EmptyStateProps, ErrorStateProps, FaviconProps, FaviconResolver, FieldClassOptions, FieldGroupProps, FieldProps, FieldSize, FileDropzoneProps, FilterBarProps, FilterSheetProps, FlowStepItem, FlowStepStatus, FlowStepsProps, HoverCardProps, IconButtonClassOptions, IconButtonProps, IconButtonSize, IconButtonVariant, 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, MultiSelectProps, 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, ScrollAlign, ScrollRowProps, ScrollToIndexOptions, SearchInputProps, SectionHeaderProps, SectionNavItem, SectionNavProps, SegmentedOption, SegmentedProps, SegmentedTone, SelectProps, SeparatorProps, 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, TreeNode, TreeViewProps, UrlStateAdapter, UrlStateShape, UseResourceOptions, VirtualListHandle, VirtualListProps, VirtualTableProps, VisuallyHiddenProps, WeekDay, WorkflowBoardAgent, WorkflowBoardPhase, WorkflowBoardProps };
|