@jgb-solutions/kit 0.2.2 → 0.3.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/CHANGELOG.md +10 -0
- package/README.md +129 -3
- package/dist/admin/blocks/ActivityFeed.d.ts +20 -0
- package/dist/admin/blocks/BarChart.d.ts +26 -0
- package/dist/admin/blocks/ChartPoints.d.ts +24 -0
- package/dist/admin/blocks/DataTable.d.ts +58 -0
- package/dist/admin/blocks/Filters.d.ts +12 -0
- package/dist/admin/blocks/Hero.d.ts +22 -0
- package/dist/admin/blocks/LineChart.d.ts +24 -0
- package/dist/admin/blocks/Pagination.d.ts +30 -0
- package/dist/admin/blocks/Segmented.d.ts +15 -0
- package/dist/admin/blocks/Stat.d.ts +35 -0
- package/dist/admin/blocks/Status.d.ts +22 -0
- package/dist/admin/blocks/Tile.d.ts +20 -0
- package/dist/admin/blocks/sorting.d.ts +29 -0
- package/dist/admin/contrast.d.ts +12 -0
- package/dist/admin/forms/ConfirmDialog.d.ts +25 -0
- package/dist/admin/forms/Field.d.ts +48 -0
- package/dist/admin/forms/People.d.ts +28 -0
- package/dist/admin/forms/Toast.d.ts +17 -0
- package/dist/admin/icons.d.ts +31 -0
- package/dist/admin/index.d.ts +33 -0
- package/dist/admin/shell/AdminShell.d.ts +31 -0
- package/dist/admin/shell/Dock.d.ts +8 -0
- package/dist/admin/shell/PageHeader.d.ts +19 -0
- package/dist/admin/shell/Sidebar.d.ts +27 -0
- package/dist/admin/shell/ThemeToggle.d.ts +10 -0
- package/dist/admin/shell/nav.d.ts +33 -0
- package/dist/admin/styles.css +1677 -0
- package/dist/admin/theme.d.ts +30 -0
- package/dist/admin/ui/Avatar.d.ts +14 -0
- package/dist/admin/ui/Button.d.ts +19 -0
- package/dist/admin.d.ts +2 -0
- package/dist/admin.js +2168 -0
- package/dist/auth/expo.d.ts +6 -0
- package/dist/auth/expo.js +7 -8
- package/dist/auth/rules.d.ts +6 -2
- package/dist/auth/rules.js +2 -2
- package/dist/auth.js +2 -2
- package/package.json +36 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@jgb-solutions/kit`. Versions follow semver.
|
|
4
4
|
|
|
5
|
+
## 0.3.0
|
|
6
|
+
|
|
7
|
+
- `@jgb-solutions/kit/admin`: the admin panel kit, moved in from `@jgb-solutions/admin` 0.1.5 unchanged (the shell, data blocks with sortable columns and rows per page, forms, charts, the light/dark/system theme switch). Its stylesheet is `@jgb-solutions/kit/admin/styles.css`. To move: replace `@jgb-solutions/admin` with `@jgb-solutions/kit/admin` in imports (and `/styles.css`), then remove `@jgb-solutions/admin`.
|
|
8
|
+
- React and react-dom are optional peer dependencies: only `kit/admin` needs them. An app that imports `kit/access` or `kit/auth` bundles no admin or React code; `check:install` builds such an app and fails if it does.
|
|
9
|
+
- `sideEffects` lists CSS only, so bundlers drop any namespace an app doesn't import.
|
|
10
|
+
|
|
11
|
+
## 0.2.3
|
|
12
|
+
|
|
13
|
+
- `createMobileAuth({ randomId })` (`kit/auth/expo`): signing up without an email no longer needs a global `crypto`. React Native's Hermes has none, so `signUp` crashed there ("Property 'crypto' doesn't exist", found in the jgb-starter app template). Pass expo-crypto's `randomUUID`; it defaults to the runtime's `crypto.randomUUID` when present, and without either, `signUp` answers `NO_RANDOM_ID` instead of throwing. `placeholderEmail(randomId?)` takes the same function.
|
|
14
|
+
|
|
5
15
|
## 0.2.2
|
|
6
16
|
|
|
7
17
|
- Connecting Google while signed in (`/link-social`, `linkGoogle`) keeps every session of the account: the owner proved both sides, and signing their other devices out would be a bad surprise. A Google sign-in that joins a confirmed account still ends every session of that account. The hook tells them apart by who is signed in: a browser holding another account's session counts as a join. `afterAccountSaved(account, adapter, signedInUserId)` replaces 0.2.0's `keepSessionToken`, and `AccountAdapter` uses `findSession` instead of `listSessions` and `deleteSessions`.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @jgb-solutions/kit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
One package for JGB Solutions apps, in tree-shakable namespaces: the generic plumbing web apps need (Cloudflare Access, Better Auth) and the admin panel kit (`kit/admin`). An app bundles only the subpaths it imports: one using `kit/access` never ships admin or React code (`bun run check:install` proves it). ESM with TypeScript types, one subpath per module, MIT licensed. The modules run anywhere with Web Crypto and `fetch`: Bun, Node and Cloudflare Workers (`kit/auth/bun` on Bun only, `kit/auth/expo` in React Native, `kit/admin` in React 19 apps).
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
bun add @jgb-solutions/kit
|
|
@@ -119,11 +119,19 @@ const { withUser, requireUser, requireAdmin } = authMiddleware({
|
|
|
119
119
|
#### `kit/auth/expo`: the mobile app
|
|
120
120
|
|
|
121
121
|
```ts
|
|
122
|
+
import { randomUUID } from 'expo-crypto'
|
|
122
123
|
import * as SecureStore from 'expo-secure-store'
|
|
123
124
|
import * as Passkeys from 'react-native-passkeys'
|
|
124
125
|
import { createMobileAuth } from '@jgb-solutions/kit/auth/expo'
|
|
125
126
|
|
|
126
|
-
|
|
127
|
+
// randomId: Hermes has no global crypto; sign-up without an email needs one for its placeholder address.
|
|
128
|
+
export const auth = createMobileAuth({
|
|
129
|
+
origin: 'https://app.example.com',
|
|
130
|
+
storage: SecureStore,
|
|
131
|
+
tokenKey: 'example.session',
|
|
132
|
+
fetchMe,
|
|
133
|
+
randomId: randomUUID,
|
|
134
|
+
})
|
|
127
135
|
|
|
128
136
|
const session = useSyncExternalStore(auth.subscribe, auth.getSession)
|
|
129
137
|
await auth.signIn('maria', password) // or an email address
|
|
@@ -135,6 +143,122 @@ new RPCLink({ url, headers: auth.authHeaders }) // Bearer on every RPC call
|
|
|
135
143
|
|
|
136
144
|
Failures come back as codes (`INVALID_USERNAME_OR_PASSWORD`, `ACCOUNT_NOT_LINKED`, `GOOGLE_ALREADY_LINKED`, `TOO_MANY_REQUESTS`, `NETWORK`, `CANCELLED`…), and the app words them. The module has no dependencies: the app passes in its secure storage and passkey modules.
|
|
137
145
|
|
|
146
|
+
### `@jgb-solutions/kit/admin`: the admin panel (React 19)
|
|
147
|
+
|
|
148
|
+
The admin panel kit for JGB Solutions apps: a React shell, data blocks (sortable tables, rows per page), forms and SVG charts, styled once, accessible (WCAG 2.1 AA), phone-ready, light and dark. Each app builds its own pages from it. It was `@jgb-solutions/admin` until 0.1.5; from kit 0.3.0 it lives here (`import … from '@jgb-solutions/kit/admin'`).
|
|
149
|
+
|
|
150
|
+
#### What it is, and what it isn't
|
|
151
|
+
|
|
152
|
+
- **In:** the shell, navigation, data blocks, forms, actions and charts every admin needs.
|
|
153
|
+
- **Not in:** any app's pages, data, roles or rules. Components take data and callbacks; the app fetches, checks permissions on the server, and decides what happens. No business logic, secrets, app IDs or infrastructure details.
|
|
154
|
+
|
|
155
|
+
The look, "Bento + Daylight's details" (2026-11-24): rounded tiles of different sizes on a tinted canvas, a dark hero tile, a floating dark sidebar and a floating dock on phones, with a labelled sidebar, real table headers, an inline role picker and an activity feed.
|
|
156
|
+
|
|
157
|
+
#### Use
|
|
158
|
+
|
|
159
|
+
```sh
|
|
160
|
+
bun add @jgb-solutions/kit
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
React 19 is an optional peer dependency: only kit/admin needs it. Import the stylesheet once, and load the two fonts (or let the fallbacks stand in):
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
import '@jgb-solutions/kit/admin/styles.css'
|
|
167
|
+
import { AdminShell, PageHeader, Button, TopSearch, ThemeToggle, icons } from '@jgb-solutions/kit/admin'
|
|
168
|
+
// Fonts: Bricolage Grotesque (700, 800) and Figtree (400, 500, 600), from Google Fonts or self-hosted.
|
|
169
|
+
|
|
170
|
+
export function AdminLayout({ children }: { children: React.ReactNode }) {
|
|
171
|
+
return (
|
|
172
|
+
<AdminShell
|
|
173
|
+
app={{ name: 'Example', mark: 'E' }}
|
|
174
|
+
brand="#6b4ce6"
|
|
175
|
+
nav={[
|
|
176
|
+
{
|
|
177
|
+
label: 'Manage',
|
|
178
|
+
items: [
|
|
179
|
+
{ key: 'overview', label: 'Overview', href: '/admin', icon: <icons.home />, current: true },
|
|
180
|
+
{ key: 'users', label: 'Users', href: '/admin/users', icon: <icons.users />, count: 2481 },
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
{ placement: 'end', items: [{ key: 'settings', label: 'Settings', href: '/admin/settings', icon: <icons.gear /> }] },
|
|
184
|
+
]}
|
|
185
|
+
user={{ name: 'Maya Reyes', role: 'Admin' }}
|
|
186
|
+
// With a router, render its own link: renderLink={({ item, children, ...rest }) => <Link to={item.href} {...rest}>{children}</Link>}
|
|
187
|
+
>
|
|
188
|
+
{children}
|
|
189
|
+
</AdminShell>
|
|
190
|
+
)
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Every class is prefixed `ja-` and every token lives on `.ja-root` (AdminShell's element): the admin never restyles the rest of the app.
|
|
195
|
+
|
|
196
|
+
#### Components
|
|
197
|
+
|
|
198
|
+
##### Shell
|
|
199
|
+
|
|
200
|
+
- `AdminShell`: the frame. Desktop: the floating dark sidebar. At 760 px and below: a top bar (the app's mark, the theme switch, `mobileActions`) and the floating dock. Holds the theme and the app's brand colour.
|
|
201
|
+
- `brand`: a hex colour. Text on it (buttons, the current page) is white or ink, whichever reads better (`inkOn`).
|
|
202
|
+
- `nav`: sections of items (`key`, `label`, `href`, `icon`, optional `count`, `current`). Sections with `placement: 'end'` sit at the bottom.
|
|
203
|
+
- `dockItems`: the keys the phone's dock shows (at most 5; default the first 5).
|
|
204
|
+
- `renderLink`: renders a link with the app's router. Default `<a href>`.
|
|
205
|
+
- Theme: light, dark or the system's (default). Remembered in this browser, or controlled with `theme` and `onThemeChange` (e.g. kept in a cookie so the server renders it). Server rendering shows `defaultTheme` ("system": the CSS follows the system's dark mode with no script).
|
|
206
|
+
- `Sidebar`: collapses to an icon rail, remembered per browser. In the rail, labels become tooltips and stay the links' names; counts over 99 show as "99+".
|
|
207
|
+
- `Dock`: up to 5 items, icon over label.
|
|
208
|
+
- `PageHeader`: the page's one h1, a line of context, desktop-only `tools` (search, theme, notifications) and `actions` (one primary).
|
|
209
|
+
- `TopSearch`, `useAdminTheme()`.
|
|
210
|
+
- `ThemeToggle`: Light, Dark or Match system, a radio group. The phone's top bar has one; put another in the sidebar with `sidebarFooter={<ThemeToggle tone="night" />}` (names shown; one cycling button when the sidebar is collapsed).
|
|
211
|
+
|
|
212
|
+
##### Data blocks
|
|
213
|
+
|
|
214
|
+
- `Bento` and `Tile` (`span` of 12, `rowSpan`, `phoneSpan` of 2, `tone="plain" | "night" | "sun"`, optional `title` and `actions`); a titled tile is a region named by its title).
|
|
215
|
+
- `StatTile`: label, number, `delta` (up or down, coloured by whether it's good news), `note`, and a `Meter` or `AvatarStack` inside.
|
|
216
|
+
- `HeroChartTile`: the dark tile with the big number, its delta, a period switch (`SegmentedControl`) and a `LineChart`.
|
|
217
|
+
- `DataTable`: column headers, any cell (`PersonCell`, `StatusBadge`, `RowAction`…), rows that become cards on phones (each column's `phone` setting places it), skeleton rows while loading, an empty state that says what to do, and a one-second highlight for changed rows (`flash`). `FilterTabs` and `Pagination` sit around it (`Pagination` can offer "Rows per page" with `pageSize` and `onPageSize`; `PageSize` alone goes beside a keyset pager). Sortable columns: give a column `sort` (`compare: byText(...)` or `byNumber(...)`, `first: 'desc'` for numbers), keep the sort in the app (`sort`, `onSortChange`, e.g. in the URL), and pass `sortRows` when the table holds all the rows; for a long list, sort on the server and pass the page. Phones get a "Sort by" list.
|
|
218
|
+
- `ActivityFeed`: icon, sentence and time, grouped by day; loading and empty states.
|
|
219
|
+
- `LineChart`: one series, a fading fill, the last point marked, labels underneath, and a table of the values for screen readers.
|
|
220
|
+
|
|
221
|
+
##### Forms and actions
|
|
222
|
+
|
|
223
|
+
- `TextInput`, `TextArea`, `Select` (native), each with its `label`, `hint` and `error` tied to the control; `Field` does the same for any other control; an error is read out when it appears. Put a form inside a tile in `<form className="ja-form">`.
|
|
224
|
+
- `Checkbox`, and `Switch` for settings that apply at once (`role="switch"`).
|
|
225
|
+
- `ConfirmDialog`: the browser's own `<dialog>` (focus stays inside, Escape and the backdrop cancel, focus returns), a button that names the action ("Suspend Leo Martin"), destructive styling.
|
|
226
|
+
- `useToast()`: `toast.done('Suspended Leo Martin.')` (gone after 4 s) and `toast.error(…)` (stays until dismissed); above the dock on phones.
|
|
227
|
+
- `RolePicker`: an inline role select for a table row; roles listed in `confirm` ask first ("Make Ada Okafor an Admin?").
|
|
228
|
+
- `BanControl`: suspend with an optional reason, after a confirmation, or restore.
|
|
229
|
+
|
|
230
|
+
##### Charts (SVG, no chart library)
|
|
231
|
+
|
|
232
|
+
- `LineChart`: one series, a fading fill, the last point marked, labels underneath (`color="sun" | "brand"`).
|
|
233
|
+
- `BarChart`: one series, or two (this period and the last, with a legend).
|
|
234
|
+
- Both stretch to their tile, take an accessible `label`, and add a table of the values for screen readers.
|
|
235
|
+
|
|
236
|
+
##### Basics
|
|
237
|
+
|
|
238
|
+
- `Button` (`primary`, `quiet`, `danger`; `small`), `IconButton` (always named by `label`; optional `dot`).
|
|
239
|
+
- `Avatar`: a picture or initials, with a colour pair kept per name.
|
|
240
|
+
- `icons`: a small line-icon set (24×24, `currentColor`). Any other icon works as a ReactNode.
|
|
241
|
+
|
|
242
|
+
#### Design tokens
|
|
243
|
+
|
|
244
|
+
CSS custom properties on `.ja-root`, light by default, dark with `data-theme="dark"` or the system's dark mode. Apps set `--brand` (AdminShell's `brand`); the rest are the kit's.
|
|
245
|
+
|
|
246
|
+
| Token | Light | Dark | Use |
|
|
247
|
+
| ----------------------------- | --------------------------------- | --------------------------------- | -------------------------------------------------------------------- |
|
|
248
|
+
| `--brand` | the app's (example `#6b4ce6`) | same | current page, primary buttons, meters, links |
|
|
249
|
+
| `--brand-ink` | white or ink, picked for contrast | same | text on `--brand` |
|
|
250
|
+
| `--sun` / `--sun-ink` | `#ffc84a` / `#4a3500` | same | the kit's highlight: the hero chart line, one highlight tile, badges |
|
|
251
|
+
| `--canvas` | `#eceaf6` | `#121022` | page background |
|
|
252
|
+
| `--tile` / `--tile-sunk` | `#ffffff` / `#f6f5fb` | `#1c1930` / `#24203a` | tiles, inputs; rows and fields inside tiles |
|
|
253
|
+
| `--night` | `#1f1b33` | `#0d0b18` | sidebar, hero tile, dock, toasts |
|
|
254
|
+
| `--ink` / `--muted` | `#1c1930` / `#6b6785` | `#f1effa` / `#a39fbf` | text, secondary text |
|
|
255
|
+
| `--line` | `#e4e1f0` | `#2e2a47` | control borders |
|
|
256
|
+
| `--good` / `--warn` / `--bad` | `#158150` / `#946200` / `#b42318` | `#4cc38a` / `#f0b429` / `#ff7a6b` | status: active, invited, suspended; deltas |
|
|
257
|
+
|
|
258
|
+
Every text pair meets WCAG AA; `src/contrast.test.ts` checks them, and the E2E tests run axe in light and dark. Two values differ slightly from the approved mockup for that reason: `--muted` (`#6d6987` was 4.39:1 on the canvas) and `--good` (`#18915a` was 3.7:1 on rows).
|
|
259
|
+
|
|
260
|
+
Type: Bricolage Grotesque (700/800) for titles and numbers (`tabular-nums`), Figtree (400/500/600) for the rest. Sentence case everywhere. Shape: tiles 24 px (20 on phones), controls 12 px, pills. Motion only in answer to an action, and none with `prefers-reduced-motion`.
|
|
261
|
+
|
|
138
262
|
## What goes in, and what never goes in
|
|
139
263
|
|
|
140
264
|
**In:** generic plumbing that several apps need in the same shape, written once and tested: checking a signed token, parsing a header, a retry or rate-limit helper, a typed client for a public protocol. Every module:
|
|
@@ -155,7 +279,9 @@ Failures come back as codes (`INVALID_USERNAME_OR_PASSWORD`, `ACCOUNT_NOT_LINKED
|
|
|
155
279
|
|
|
156
280
|
## Developing
|
|
157
281
|
|
|
158
|
-
Bun only: `bun install`, `bun test`, `bun run typecheck` (`bun check`), `bun run format` (`bun fmt`), `bun run build` (one ESM file per export, plus `.d.ts` types), `bun run check:package`, `bun run check:install`.
|
|
282
|
+
Bun only: `bun install`, `bun run test`, `bun run typecheck` (`bun check`), `bun run format` (`bun fmt`), `bun run build` (one ESM file per export, plus `.d.ts` types), `bun run check:package`, `bun run check:install`.
|
|
283
|
+
|
|
284
|
+
kit/admin: `bun run playground` (every component with sample data, http://127.0.0.1:4400), `bun run test:e2e` (axe in light and dark, phone width and behaviour, against the playground), `bun run screenshots`.
|
|
159
285
|
|
|
160
286
|
A new module goes in `src/<name>.ts` (or `src/<group>/<name>.ts`) with its test next to it. It gets its own subpath in `package.json`'s `exports` (`./<name>` pointing at `./dist/<name>.js` and `./dist/<name>.d.ts`), and its allowed imports in `IMPORTS` in `scripts/check-package.ts`. A library it needs is an optional peer dependency, unless every module needs it.
|
|
161
287
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type Activity = {
|
|
3
|
+
id: string;
|
|
4
|
+
icon: ReactNode;
|
|
5
|
+
tone?: 'brand' | 'good' | 'warn' | 'bad' | undefined;
|
|
6
|
+
/** The sentence: who did what ("Jonas Lind published “Spring menu”"). */
|
|
7
|
+
text: ReactNode;
|
|
8
|
+
/** When, as people say it ("12 minutes ago"); `datetime` is the machine-readable time. */
|
|
9
|
+
time: string;
|
|
10
|
+
datetime?: string | undefined;
|
|
11
|
+
/** The day group it belongs to ("Today", "Yesterday"); consecutive items share one heading. */
|
|
12
|
+
day?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type ActivityFeedProps = {
|
|
15
|
+
items: Activity[];
|
|
16
|
+
loading?: boolean | undefined;
|
|
17
|
+
empty?: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
/** What happened lately: an icon, a sentence and a time, grouped by day. */
|
|
20
|
+
export declare function ActivityFeed({ items, loading, empty }: ActivityFeedProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type BarSeries = {
|
|
2
|
+
label: string;
|
|
3
|
+
values: number[];
|
|
4
|
+
};
|
|
5
|
+
export type BarChartProps = {
|
|
6
|
+
/** The category under each bar group ("Mon", "Tue"…). */
|
|
7
|
+
labels: string[];
|
|
8
|
+
/** One series, or two: this period first, the last one second (drawn lighter, beside it). */
|
|
9
|
+
series: [BarSeries] | [BarSeries, BarSeries];
|
|
10
|
+
/** What the chart shows, for screen readers ("Sign-ups per day, this week and last"). */
|
|
11
|
+
label: string;
|
|
12
|
+
height?: number;
|
|
13
|
+
format?: (value: number) => string;
|
|
14
|
+
};
|
|
15
|
+
/** Bars, rounded at the top, scaled from zero; equal gaps; the tallest value at the top. */
|
|
16
|
+
export declare function barLayout(groups: number, perGroup: number, width: number, gap?: number): {
|
|
17
|
+
group: number;
|
|
18
|
+
bar: number;
|
|
19
|
+
offset: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* One or two series as bars (this period against the last), with a legend for two and a table of
|
|
23
|
+
* the values for screen readers. Each group's values show on hover, and from the keyboard (Tab to
|
|
24
|
+
* the chart, then the arrow keys). SVG, no chart library; it stretches to its tile's width.
|
|
25
|
+
*/
|
|
26
|
+
export declare function BarChart({ labels, series, label, height, format }: BarChartProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/** Where the next point is after a key press, or null for keys the chart leaves alone. */
|
|
3
|
+
export declare function nextPoint(key: string, current: number, count: number): number | null;
|
|
4
|
+
export type ChartPointsProps = {
|
|
5
|
+
/** One accessible name per point or group ("Thu: 7,300"). */
|
|
6
|
+
names: string[];
|
|
7
|
+
/** Each point's centre, as a % of the plot's width. */
|
|
8
|
+
centers: number[];
|
|
9
|
+
/** The width of each hover area, as a % of the plot's width. */
|
|
10
|
+
width: number;
|
|
11
|
+
/** The point shown (hovered or focused), or null. */
|
|
12
|
+
active: number | null;
|
|
13
|
+
onActive: (index: number | null) => void;
|
|
14
|
+
/** The tooltip's top, as a % of the plot's height, for the active point. */
|
|
15
|
+
tipTop: (index: number) => number;
|
|
16
|
+
/** What the tooltip says for the active point. */
|
|
17
|
+
tip: (index: number) => ReactNode;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The values on hover and from the keyboard: one tab stop per chart, arrow keys (and Home, End)
|
|
21
|
+
* move between points, and a tooltip shows the active one. Each point is named for screen
|
|
22
|
+
* readers, and the chart's table of values stays for those who prefer it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ChartPoints({ names, centers, width, active, onActive, tipTop, tip }: ChartPointsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ColumnSort, type TableSort } from './sorting';
|
|
3
|
+
export type Column<Row> = {
|
|
4
|
+
key: string;
|
|
5
|
+
/** The column's header ("Person", "Role"). An empty one is still named for screen readers by `srHeader`. */
|
|
6
|
+
header: ReactNode;
|
|
7
|
+
srHeader?: string | undefined;
|
|
8
|
+
cell: (row: Row) => ReactNode;
|
|
9
|
+
align?: 'start' | 'end' | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* On phones each row is a card with two columns. `order` places the cell (lower first), `align`
|
|
12
|
+
* puts it on the right, `hidden` drops it, `full` takes the whole width.
|
|
13
|
+
*/
|
|
14
|
+
phone?: {
|
|
15
|
+
order?: number;
|
|
16
|
+
align?: 'start' | 'end';
|
|
17
|
+
hidden?: boolean;
|
|
18
|
+
full?: boolean;
|
|
19
|
+
} | undefined;
|
|
20
|
+
/** Makes the column sortable (with the table's `sort` and `onSortChange`). */
|
|
21
|
+
sort?: ColumnSort<Row> | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type DataTableProps<Row> = {
|
|
24
|
+
/** The table's accessible name ("Users"); the tile's heading usually says it too. */
|
|
25
|
+
label: string;
|
|
26
|
+
columns: Column<Row>[];
|
|
27
|
+
rows: Row[];
|
|
28
|
+
rowKey: (row: Row) => string;
|
|
29
|
+
/** Rows to highlight for a second after a change (by key). */
|
|
30
|
+
flash?: ReadonlySet<string> | undefined;
|
|
31
|
+
loading?: boolean | undefined;
|
|
32
|
+
/** Shown when there are no rows and nothing is loading: say what to do ("Clear the search."). */
|
|
33
|
+
empty?: ReactNode;
|
|
34
|
+
/** The sort the app keeps (e.g. in the URL): which column and which way. Shown on that header. */
|
|
35
|
+
sort?: TableSort | undefined;
|
|
36
|
+
/** Called with the new sort when a sortable header (or the phone's "Sort by") is used. */
|
|
37
|
+
onSortChange?: ((sort: TableSort) => void) | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The table sorts `rows` itself with the sorted column's `compare`: for when the app passes all the
|
|
40
|
+
* rows. Leave it off when the server sorts (a page of a long list).
|
|
41
|
+
*/
|
|
42
|
+
sortRows?: boolean | undefined;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Daylight's real table (column headers, row actions, inline cells) in Bento's rounded rows. Rows
|
|
46
|
+
* become cards on phones. Search, filters and pagination sit around it (FilterTabs, Pagination).
|
|
47
|
+
*/
|
|
48
|
+
export declare function DataTable<Row>({ label, columns, rows: given, rowKey, flash, loading, empty, sort, onSortChange, sortRows: sortHere, }: DataTableProps<Row>): import("react").JSX.Element;
|
|
49
|
+
/** A person in a table: avatar, name and a second line (email). */
|
|
50
|
+
export declare function PersonCell({ name, detail, avatar }: {
|
|
51
|
+
name: ReactNode;
|
|
52
|
+
detail?: ReactNode;
|
|
53
|
+
avatar: ReactNode;
|
|
54
|
+
}): import("react").JSX.Element;
|
|
55
|
+
/** A small action in a row ("Suspend", "Resend invite"). Its label should name the row in `aria-label` when the text alone doesn't. */
|
|
56
|
+
export declare function RowAction({ children, danger, ...rest }: React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
57
|
+
danger?: boolean;
|
|
58
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type FilterOption<V extends string> = {
|
|
2
|
+
value: V;
|
|
3
|
+
label: string;
|
|
4
|
+
count?: number | undefined;
|
|
5
|
+
};
|
|
6
|
+
/** Filter tabs above a table (All / Admins / Suspended): pressed buttons in a named group. */
|
|
7
|
+
export declare function FilterTabs<V extends string>({ label, options, value, onChange, }: {
|
|
8
|
+
label: string;
|
|
9
|
+
options: readonly FilterOption<V>[];
|
|
10
|
+
value: V;
|
|
11
|
+
onChange: (value: V) => void;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type ChartPoint } from './LineChart';
|
|
3
|
+
import { type SegmentedOption } from './Segmented';
|
|
4
|
+
import { type Delta } from './Stat';
|
|
5
|
+
import { type TileProps } from './Tile';
|
|
6
|
+
export type HeroChartTileProps<P extends string> = Omit<TileProps, 'title' | 'children' | 'tone'> & {
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
value: ReactNode;
|
|
9
|
+
delta?: Delta | undefined;
|
|
10
|
+
data: ChartPoint[];
|
|
11
|
+
/** What the chart shows, for screen readers ("Visits per day this week"). */
|
|
12
|
+
chartLabel: string;
|
|
13
|
+
/** The period switch (Day / Week / Month), when the app offers one. */
|
|
14
|
+
periods?: {
|
|
15
|
+
label: string;
|
|
16
|
+
options: readonly SegmentedOption<P>[];
|
|
17
|
+
value: P;
|
|
18
|
+
onChange: (value: P) => void;
|
|
19
|
+
} | undefined;
|
|
20
|
+
};
|
|
21
|
+
/** The page's main number: a dark tile with the number, its delta, a period switch and a line chart. */
|
|
22
|
+
export declare function HeroChartTile<P extends string>({ label, value, delta, data, chartLabel, periods, span, rowSpan, className, ...tile }: HeroChartTileProps<P>): import("react").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ChartPoint = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: number;
|
|
4
|
+
};
|
|
5
|
+
/** Points to SVG coordinates in a width × height box, highest value at the top (with headroom). */
|
|
6
|
+
export declare function scalePoints(values: number[], width: number, height: number, pad?: number): [number, number][];
|
|
7
|
+
/** A smooth path through the points (Catmull-Rom as cubic Béziers), never overshooting in x. */
|
|
8
|
+
export declare function smoothPath(points: [number, number][]): string;
|
|
9
|
+
export type LineChartProps = {
|
|
10
|
+
data: ChartPoint[];
|
|
11
|
+
/** What the chart shows, for screen readers ("Visits per day this week"). A table of the values follows it. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** The line's colour: the kit's sun (default, for the dark hero) or the brand. */
|
|
14
|
+
color?: 'sun' | 'brand';
|
|
15
|
+
height?: number;
|
|
16
|
+
/** How values read in the table for screen readers. */
|
|
17
|
+
format?: (value: number) => string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* One series as a smooth line with a fading fill and the last point marked, day labels underneath.
|
|
21
|
+
* Each value shows on hover, and from the keyboard (Tab to the chart, then the arrow keys).
|
|
22
|
+
* SVG, no chart library; it stretches to its tile's width.
|
|
23
|
+
*/
|
|
24
|
+
export declare function LineChart({ data, label, color, height, format }: LineChartProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** The rows-per-page choices a list offers by default. */
|
|
2
|
+
export declare const PAGE_SIZES: readonly [25, 50, 100, 200];
|
|
3
|
+
export type PageSizeProps = {
|
|
4
|
+
value: number;
|
|
5
|
+
onChange: (size: number) => void;
|
|
6
|
+
options?: readonly number[] | undefined;
|
|
7
|
+
label?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* "Rows per page": a native select. The app keeps the size (e.g. ?per=50 in the URL) and goes back to
|
|
11
|
+
* the first page when it changes. Sits in Pagination, or beside an app's own pager (keyset "Next page").
|
|
12
|
+
*/
|
|
13
|
+
export declare function PageSize({ value, onChange, options, label }: PageSizeProps): import("react").JSX.Element;
|
|
14
|
+
/** Which page numbers to show: the first, the last, and the current one's neighbours; null is a gap. */
|
|
15
|
+
export declare function pageWindow(page: number, pages: number): (number | null)[];
|
|
16
|
+
export type PaginationProps = {
|
|
17
|
+
page: number;
|
|
18
|
+
pages: number;
|
|
19
|
+
onPage: (page: number) => void;
|
|
20
|
+
/** "1–4 of 2,481 people": shown on desktop. */
|
|
21
|
+
summary?: string | undefined;
|
|
22
|
+
/** What is paged, for the navigation's name ("People pages"). */
|
|
23
|
+
label?: string | undefined;
|
|
24
|
+
/** Rows per page: with `onPageSize`, a "Rows per page" choice shows beside the pages. */
|
|
25
|
+
pageSize?: number | undefined;
|
|
26
|
+
onPageSize?: ((size: number) => void) | undefined;
|
|
27
|
+
pageSizes?: readonly number[] | undefined;
|
|
28
|
+
};
|
|
29
|
+
/** Page numbers with a next button; the current page is marked for screen readers. */
|
|
30
|
+
export declare function Pagination({ page, pages, onPage, summary, label, pageSize, onPageSize, pageSizes }: PaginationProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type SegmentedOption<V extends string> = {
|
|
2
|
+
value: V;
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* A few mutually exclusive choices in a pill (Day / Week / Month). Buttons with aria-pressed, in a
|
|
7
|
+
* named group: each press applies at once.
|
|
8
|
+
*/
|
|
9
|
+
export declare function SegmentedControl<V extends string>({ label, options, value, onChange, }: {
|
|
10
|
+
/** What the choice is about ("Period"). */
|
|
11
|
+
label: string;
|
|
12
|
+
options: readonly SegmentedOption<V>[];
|
|
13
|
+
value: V;
|
|
14
|
+
onChange: (value: V) => void;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type TileProps } from './Tile';
|
|
3
|
+
/** A change against the last period: "+12.4%", up or down, and whether that's good news. */
|
|
4
|
+
export type Delta = {
|
|
5
|
+
value: string;
|
|
6
|
+
direction: 'up' | 'down';
|
|
7
|
+
good?: boolean | undefined;
|
|
8
|
+
label?: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
/** "+12.4% on last week": coloured by whether the change is good (up isn't always good). */
|
|
11
|
+
export declare function DeltaText({ delta }: {
|
|
12
|
+
delta: Delta;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
14
|
+
/** A rounded bar: a share of something (0 to 1). Its label says what, for screen readers. */
|
|
15
|
+
export declare function Meter({ value, label }: {
|
|
16
|
+
value: number;
|
|
17
|
+
label: string;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
/** A few faces, then "+313": who is behind a number. */
|
|
20
|
+
export declare function AvatarStack({ names, more, label }: {
|
|
21
|
+
names: string[];
|
|
22
|
+
more?: number;
|
|
23
|
+
label: string;
|
|
24
|
+
}): import("react").JSX.Element;
|
|
25
|
+
export type StatTileProps = Omit<TileProps, 'title' | 'children'> & {
|
|
26
|
+
label: ReactNode;
|
|
27
|
+
value: ReactNode;
|
|
28
|
+
delta?: Delta | undefined;
|
|
29
|
+
/** A line under the number ("Busiest day: Thursday, 22 pages"). */
|
|
30
|
+
note?: ReactNode;
|
|
31
|
+
/** Something under the number: a Meter or an AvatarStack. */
|
|
32
|
+
children?: ReactNode;
|
|
33
|
+
};
|
|
34
|
+
/** A label, a big number, and its context: a delta, a note, a meter or faces. */
|
|
35
|
+
export declare function StatTile({ label, value, delta, note, children, span, ...tile }: StatTileProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type StatusTone = 'good' | 'warn' | 'bad' | 'neutral';
|
|
3
|
+
/** The usual people statuses, worded and coloured; any other status passes its own tone. */
|
|
4
|
+
export declare const PEOPLE_STATUS: {
|
|
5
|
+
readonly active: {
|
|
6
|
+
readonly label: "Active";
|
|
7
|
+
readonly tone: "good";
|
|
8
|
+
};
|
|
9
|
+
readonly invited: {
|
|
10
|
+
readonly label: "Invited";
|
|
11
|
+
readonly tone: "warn";
|
|
12
|
+
};
|
|
13
|
+
readonly suspended: {
|
|
14
|
+
readonly label: "Suspended";
|
|
15
|
+
readonly tone: "bad";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
/** A dot and a word in the status colour: "Active", "Invited", "Suspended". */
|
|
19
|
+
export declare function StatusBadge({ tone, children }: {
|
|
20
|
+
tone: StatusTone;
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
/** The bento grid: 12 columns on desktop, 2 on phones; tiles take spans. */
|
|
3
|
+
export declare function Bento({ children, className, ...rest }: HTMLAttributes<HTMLElement>): import("react").JSX.Element;
|
|
4
|
+
export type TileProps = Omit<HTMLAttributes<HTMLElement>, 'title'> & {
|
|
5
|
+
/** Columns out of 12 on desktop. */
|
|
6
|
+
span?: number;
|
|
7
|
+
/** Rows (the hero takes 2). */
|
|
8
|
+
rowSpan?: number;
|
|
9
|
+
/** Columns out of 2 on phones (default 2: full width). */
|
|
10
|
+
phoneSpan?: 1 | 2;
|
|
11
|
+
/** plain (white), night (the dark hero), or sun (one highlight tile per page). */
|
|
12
|
+
tone?: 'plain' | 'night' | 'sun';
|
|
13
|
+
/** The tile's heading (an h2). With `actions`, they share the tile's top row. */
|
|
14
|
+
title?: ReactNode;
|
|
15
|
+
actions?: ReactNode;
|
|
16
|
+
/** The element: "section" when it has a title, else "div". */
|
|
17
|
+
as?: 'section' | 'div' | 'article';
|
|
18
|
+
};
|
|
19
|
+
/** A rounded tile in the bento grid. */
|
|
20
|
+
export declare function Tile({ span, rowSpan, phoneSpan, tone, title, actions, as, style, children, className, ...rest }: TileProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Table sorting: which column, which way. The app keeps it (e.g. in the URL's search params). */
|
|
2
|
+
export type SortDirection = 'asc' | 'desc';
|
|
3
|
+
export type TableSort = {
|
|
4
|
+
key: string;
|
|
5
|
+
direction: SortDirection;
|
|
6
|
+
};
|
|
7
|
+
/** How a column sorts. */
|
|
8
|
+
export type ColumnSort<Row> = {
|
|
9
|
+
/** Compares two rows, ascending: needed when the table sorts the rows itself (`sortRows`). */
|
|
10
|
+
compare?: ((a: Row, b: Row) => number) | undefined;
|
|
11
|
+
/** The direction of a first click: "desc" for numbers people want biggest first. Default "asc". */
|
|
12
|
+
first?: SortDirection | undefined;
|
|
13
|
+
/** The column's name in the phone's "Sort by" list, when the header isn't plain text. */
|
|
14
|
+
label?: string | undefined;
|
|
15
|
+
/** How each direction reads there ("A to Z", "Most first"). Default "ascending" / "descending". */
|
|
16
|
+
ascLabel?: string | undefined;
|
|
17
|
+
descLabel?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
/** The sort after a click on a column's header: the other way on the sorted column, else its first direction. */
|
|
20
|
+
export declare function nextSort(current: TableSort | undefined, key: string, first?: SortDirection): TableSort;
|
|
21
|
+
/** The rows in the sort's order (a stable copy), with the column's `compare`; unchanged when there's none. */
|
|
22
|
+
export declare function sortRows<Row>(rows: readonly Row[], compare: ((a: Row, b: Row) => number) | undefined, direction: SortDirection): Row[];
|
|
23
|
+
/** Compares text the way people read it (case and accents aside, "item 2" before "item 10"). */
|
|
24
|
+
export declare const byText: <Row>(value: (row: Row) => string) => (a: Row, b: Row) => number;
|
|
25
|
+
/** Compares numbers; a missing one (null) counts as the smallest. */
|
|
26
|
+
export declare const byNumber: <Row>(value: (row: Row) => number | null) => (a: Row, b: Row) => number;
|
|
27
|
+
/** The phone's "Sort by" value for a sort, and back. */
|
|
28
|
+
export declare const sortValue: (sort: TableSort) => string;
|
|
29
|
+
export declare function parseSortValue(value: string): TableSort | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WCAG 2 contrast, for the app's brand colour: AdminShell checks it against the text drawn on it
|
|
3
|
+
* (buttons, the active nav item) and picks white or ink, whichever reads better.
|
|
4
|
+
*/
|
|
5
|
+
/** `#rgb` or `#rrggbb` as [r, g, b] in 0–255, or null. */
|
|
6
|
+
export declare function parseHex(color: string): [number, number, number] | null;
|
|
7
|
+
/** Relative luminance (WCAG 2.x). */
|
|
8
|
+
export declare function luminance([r, g, b]: [number, number, number]): number;
|
|
9
|
+
/** The contrast ratio of two hex colours (1 to 21), or null if either isn't a hex colour. */
|
|
10
|
+
export declare function contrastRatio(a: string, b: string): number | null;
|
|
11
|
+
/** White or the kit's ink, whichever reads better on `brand` (white when `brand` isn't a hex colour). */
|
|
12
|
+
export declare function inkOn(brand: string, light?: string, dark?: string): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type ConfirmDialogProps = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
/** The question ("Suspend Leo Martin?"). */
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
/** What will happen, in a sentence. */
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
/** The button that does it, naming the action ("Suspend Leo Martin"), never just "OK". */
|
|
9
|
+
confirmLabel: string;
|
|
10
|
+
cancelLabel?: string;
|
|
11
|
+
/** Destructive styling for the confirm button. */
|
|
12
|
+
danger?: boolean;
|
|
13
|
+
/** While the action runs: the buttons wait. */
|
|
14
|
+
busy?: boolean;
|
|
15
|
+
onConfirm: () => void;
|
|
16
|
+
onCancel: () => void;
|
|
17
|
+
/** Extra fields (a reason). */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A modal question before a risky action, on the browser's own <dialog>: focus stays inside it,
|
|
22
|
+
* Escape and the backdrop cancel, and focus returns to what opened it. It fades and scales in (off
|
|
23
|
+
* with reduced motion).
|
|
24
|
+
*/
|
|
25
|
+
export declare function ConfirmDialog({ open, title, description, confirmLabel, cancelLabel, danger, busy, onConfirm, onCancel, children, }: ConfirmDialogProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type InputHTMLAttributes, type ReactNode, type SelectHTMLAttributes, type TextareaHTMLAttributes } from 'react';
|
|
2
|
+
/** The ids a control needs to be tied to its label, hint and error. */
|
|
3
|
+
export type FieldIds = {
|
|
4
|
+
id: string;
|
|
5
|
+
'aria-describedby': string | undefined;
|
|
6
|
+
'aria-invalid': true | undefined;
|
|
7
|
+
};
|
|
8
|
+
export type FieldProps = {
|
|
9
|
+
label: ReactNode;
|
|
10
|
+
/** Help under the label: what to enter. */
|
|
11
|
+
hint?: ReactNode;
|
|
12
|
+
/** What's wrong and how to fix it ("Use at least 12 characters."). Shown in place of nothing, never as colour alone. */
|
|
13
|
+
error?: ReactNode;
|
|
14
|
+
/** Any control, given the ids that tie it to the label, hint and error. */
|
|
15
|
+
children: (ids: FieldIds) => ReactNode;
|
|
16
|
+
};
|
|
17
|
+
/** A label, the control, a hint and an error, tied together for screen readers. */
|
|
18
|
+
export declare function Field({ label, hint, error, children }: FieldProps): import("react").JSX.Element;
|
|
19
|
+
type Labelled = {
|
|
20
|
+
label: ReactNode;
|
|
21
|
+
hint?: ReactNode;
|
|
22
|
+
error?: ReactNode;
|
|
23
|
+
};
|
|
24
|
+
/** A text input with its label (any `type`: text, email, number, password…). */
|
|
25
|
+
export declare function TextInput({ label, hint, error, className, ...input }: Labelled & InputHTMLAttributes<HTMLInputElement>): import("react").JSX.Element;
|
|
26
|
+
export declare function TextArea({ label, hint, error, className, ...input }: Labelled & TextareaHTMLAttributes<HTMLTextAreaElement>): import("react").JSX.Element;
|
|
27
|
+
export type SelectOption = {
|
|
28
|
+
value: string;
|
|
29
|
+
label: string;
|
|
30
|
+
};
|
|
31
|
+
/** A native select (the phone's own picker), styled. */
|
|
32
|
+
export declare function Select({ label, hint, error, options, className, ...select }: Labelled & SelectHTMLAttributes<HTMLSelectElement> & {
|
|
33
|
+
options: readonly SelectOption[];
|
|
34
|
+
}): import("react").JSX.Element;
|
|
35
|
+
/** A checkbox with its label to the right, and an optional hint under it. */
|
|
36
|
+
export declare function Checkbox({ label, hint, className, ...input }: {
|
|
37
|
+
label: ReactNode;
|
|
38
|
+
hint?: ReactNode;
|
|
39
|
+
} & Omit<InputHTMLAttributes<HTMLInputElement>, 'type'>): import("react").JSX.Element;
|
|
40
|
+
/** An on/off setting that applies at once (role="switch"); its label says what it turns on. */
|
|
41
|
+
export declare function Switch({ label, hint, checked, onChange, disabled, }: {
|
|
42
|
+
label: ReactNode;
|
|
43
|
+
hint?: ReactNode;
|
|
44
|
+
checked: boolean;
|
|
45
|
+
onChange: (checked: boolean) => void;
|
|
46
|
+
disabled?: boolean;
|
|
47
|
+
}): import("react").JSX.Element;
|
|
48
|
+
export {};
|