@coolms/ui-react 0.0.0-stage → 0.1.0-alpha.10

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 ADDED
@@ -0,0 +1,154 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@coolms/ui-react` are listed here. Versions follow [semantic versioning](https://semver.org/).
4
+
5
+ ## 0.1.0-alpha.10 (2026-11-10)
6
+
7
+ The row of actions at the top of a pane, drawn from the server's action nodes.
8
+
9
+ - `ContextMenu` takes `focus`, the item focused as it opens; `PaneToolbar`'s More opens its menu on the last item with Up.
10
+ - `PaneToolbar`, the contract's `pane-toolbar` (design-tokens develop): the one row of actions at the top of a pane, the
11
+ same height in every pane. It draws the actions it is given, as the server's action nodes give them (id, label, icon,
12
+ group, overflow priority, danger, disabled), and says which was chosen by its id. As the pane narrows every label
13
+ hides at once, then actions go behind More by their overflow priority, never one alone, a priority's actions together.
14
+ One Tab stop, a status at the end.
15
+ - Icons `forward` and `refresh`.
16
+
17
+ ## 0.1.0-alpha.9 (2026-11-09)
18
+
19
+ A quick reply that carries its own controls and decides when it may be sent.
20
+
21
+ - `Composer` takes `leading`, a quick reply's own controls at the start of its last row before Send, and `canSend`,
22
+ which decides whether Send sends in place of the text being non-empty.
23
+
24
+ ## 0.1.0-alpha.8 (2026-11-09)
25
+
26
+ Choosing files a person already has, and a file viewer that keeps to the screen.
27
+
28
+ - Added: `FilePicker`, for choosing files that already exist in the person's spaces, such as Drive, to attach them
29
+ without downloading and uploading them again (contract component `file-picker`). The kit knows no API: the host
30
+ gives the spaces, lists a folder page by page (`list(space, path, cursor?)`), and receives the chosen entries with
31
+ the space and path each was chosen in.
32
+ - The selection holds across folders and spaces; the footer counts all of it, and a chip lists it, with Remove and
33
+ Clear.
34
+ - An optional `budget` (`usedBytes`, `limitBytes`, `cost`) is counted here: what is left after the selection, and
35
+ a file that would go over is disabled with the host's words for it. `disabledReason` adds the host's own reasons.
36
+ Attach is disabled with nothing chosen and while over.
37
+ - A listbox with aria-multiselectable: Up, Down, Home and End move, Enter opens a folder, Space ticks a file,
38
+ Backspace goes up, Escape cancels. The breadcrumb is a navigation landmark. A page further is asked for near the
39
+ end of the list.
40
+ - Loading, empty and error with Retry through `State`; a folder the person may not open (`FilePickerDenied` from
41
+ `list`) is denied in place, the dialog staying open.
42
+ - A dialog of fixed height on a wide screen; the whole screen on a phone, its foot kept at the bottom.
43
+ - `kit.contract.json` does not declare it yet: no released design-tokens version has the entry.
44
+ - Fixed: the file viewer is never wider than the screen. A viewer bar wider than a phone widened the whole overlay;
45
+ now the overlay is one column the screen's width, and the bar scrolls sideways in its place, its controls centred
46
+ while they fit.
47
+ - `Modal` takes `initialFocus`, what takes the focus on opening when it is not the body's first control, and
48
+ `className`, for a component drawn in it that has a layout of its own.
49
+
50
+ ## 0.1.0-alpha.7 (2026-11-08)
51
+
52
+ An icon of its own for the important folder.
53
+
54
+ - Added: the `important` icon, a marker shaped as a label's chevron, for a mail client's important folder. The bell
55
+ stays for notifications alone. The demo's mail folders show it after Starred.
56
+
57
+ ## 0.1.0-alpha.6 (2026-11-08)
58
+
59
+ A file opens over the page, and every place that waits, finds nothing or is refused says so in one way.
60
+
61
+ - Added: `FileViewer`, the overlay a file's adapter goes inside. It draws no file itself.
62
+ - The top bar has Close, the type badge and the name, then the caller's actions (Download, Print, Open separately),
63
+ in a menu on a phone. Edit is there only when the caller passes it.
64
+ - Close leaves the viewer, asking the caller first when there is unsaved work; Done returns from editing.
65
+ Escape closes only while viewing.
66
+ - Focus starts on Close, stays among what is drawn, and returns to what opened the viewer. The page behind does not
67
+ scroll.
68
+ - Arrows, swipes and side buttons move through a set of files. A field, an editor, or anything marked
69
+ `data-viewer-keys` or `data-viewer-gestures` keeps its keys and gestures. A key held with Ctrl, Cmd or Alt is left
70
+ to the browser.
71
+ - Plus, minus and 0 call `onZoom`. The viewer bar, thumbnails and strip hold what the adapter gives.
72
+ - `download`, `print` and `open-separately` join the icons.
73
+ - `kit.contract.json` does not declare it yet: design-tokens v0.7.1 has no entry for it.
74
+ - Added: `State`, for loading, empty, error and denied, at a page's, a card's or a line's size, with the caller's
75
+ title, description and action. Loading shows nothing until `STATE_DELAY_MS` (the `state-delay` token) has passed.
76
+ `elevation-required` is declared not offered, since this kit's clients never elevate.
77
+ - Changed: the kit is checked against design-tokens v0.7.1, from v0.7.0.
78
+
79
+ ## 0.1.0-alpha.5 (2026-11-04)
80
+
81
+ A field is drawn once.
82
+
83
+ - Fixed: `SignInForm`'s inputs carried the class of a field's frame, `cms-field`, so their box (a border, a fixed
84
+ 44px height, padding and a background) fell on the frame of every `TextField`, `Select` and `Toggle` too: each field
85
+ drew two boxes, and its help text ran over the next label. The sign-in inputs are now `cms-signin-form__input`, and
86
+ the frame is a column of label, box and help only. A page that styled the sign-in inputs as `.cms-field` styles
87
+ them as `.cms-signin-form__input`.
88
+
89
+ ## 0.1.0-alpha.4 (2026-11-02)
90
+
91
+ The kit's words come from the app, and the composer leaves an input method's Enter alone.
92
+
93
+ - Added: every word a component says can be given in the app's language, English where it is not.
94
+ - `labels` on `IncomingCall`, `CallPanel` and `CallBar` (`CallLabels`, defaults `CALL_LABELS`);
95
+ - `labels` on `SignInForm` (`SignInLabels`, `SIGN_IN_LABELS`) and `MailRow` (`MailRowLabels`, `MAIL_ROW_LABELS`);
96
+ - `railLabel` on `AppShell`, `readLabel` on `ChatBubble`, `attachLabel` on `Composer`, `closeLabel` on `Modal`
97
+ and `ConfirmDialog`, `dismissLabel` on `Toast` and `retryLabel` on `ErrorBanner`.
98
+ The words that name someone or something take it as an argument (`onCallWith(name)`), so a language can place it.
99
+ - Changed: `AppShell`'s main area is a column: a section in it can fill the height (`flex: 1`), and a lone child does.
100
+ - Fixed: `Composer` no longer sends on Enter while an input method is composing (`isComposing`, or the composing key
101
+ 229 on browsers that do not set it). Typing Chinese, Japanese or Korean, Enter confirms the text.
102
+
103
+ ## 0.1.0-alpha.3 (2026-10-30)
104
+
105
+ The Workspace's components, on design-tokens 0.6.0.
106
+
107
+ - Added: `AppShell` (the dark rail of sections with counts, the top bar with the server, search and account),
108
+ `SearchField`, `Badge`, `FilterChips` (a radio group of pills), `SplitPanes` (two or three labelled panes),
109
+ `MailRow`, `ChatBubble`, `Composer` (chat and quick reply), `IncomingCall`, `CallPanel`, `CallBar`, `SignInLayout`
110
+ and `SignInForm`, and `Icon` with its set of 29 icons.
111
+ - Responsive by design, on the layout's tokens: desktop from 1200px (the full rail, three panes), tablet from 600px
112
+ (an icons-only rail with each section's name as its tooltip, two panes), phone below 600px (a bottom tab bar, one
113
+ pane at a time). `SplitPanes` takes `active`, the pane the person is in, and `back`, a link to the pane before
114
+ it, shown where that pane is hidden; with the selection in the address, the browser's Back agrees. Sign-in fits
115
+ every width, and every control is at least 44px at tablet and phone widths.
116
+ - A navy button keeps a visible 1px edge in dark (`button-chrome-border`).
117
+ - Changed: `Avatar` takes one of six tints from the name (`tintOf`), the same name always the same tint.
118
+ - Added: Inter (`./fonts.css`, SIL Open Font License 1.1) and the token file with the Workspace tokens, both from
119
+ design-tokens 0.6.0, as the lock records.
120
+ - The demo gains a Workspace page per screen (Mail, Chat, Calls, Sign in), light and dark: `demo/workspace.html`.
121
+ Mail shows the mailbox's folders as a tree, never labels. Each screen's place is in its address (`#mail/2` is
122
+ Mail with its third message open).
123
+ - Checks: `check-breakpoints` (every media query width is a breakpoint token) and `check-layout` (every demo screen
124
+ at 1440, 1024, 768 and 390px, light and dark, in headless Chrome: nothing passes the edge or scrolls sideways,
125
+ and no control at touch widths is under 44px).
126
+
127
+ ## 0.1.0-alpha.2 (2026-10-28)
128
+
129
+ The token file is CSS a browser keeps whole.
130
+
131
+ - Fixed: `tokens.css` was a copy of `coolms/design-tokens`' SCSS file. Its first line, a `//` comment, is a comment in
132
+ SCSS but not in CSS, so a browser dropped the whole light `:root` block behind it: in the light theme every
133
+ `--cms-*` token was undefined and the components lost their colours, spacing and radii. It is now a copy of
134
+ `dist/coolms-tokens.css`, the same blocks with a CSS comment header, from `coolms/design-tokens` v0.5.0, pinned in
135
+ `design-tokens.lock.json` with the tag's commit.
136
+ - Added: `tools/check-css.mjs`, copied from v0.5.0 and pinned the same way, runs on the token file in
137
+ `tokens:check`; `tools/check-css-teeth.mjs` makes sure it still fails a `//` header and a missing file.
138
+ - Changed: the README's install line names no version (it named 0.1.0-alpha.1), and says to use 0.1.0-alpha.2 or
139
+ later.
140
+
141
+ ## 0.1.0-alpha.1 (2026-10-23)
142
+
143
+ The first pre-release. Published from `develop` at 91f0db3, which has no tag; the package already carries
144
+ `design-tokens.lock.json` (#1).
145
+
146
+ - The 15 components of the CoolMS UI contract, each in every state the contract names. `elevation-required` is not
147
+ offered.
148
+ - Server helpers for the contract's reactions R1 to R6: `offerFor`, `readRefusal`, `useReread`, `readConflict` and
149
+ `needsClientUpdate`.
150
+ - `kit.css`, styled only with `--cms-*` tokens.
151
+ - The token file, the UI contract and its checker, all copied from `coolms/design-tokens` v0.4.0 and pinned in
152
+ `design-tokens.lock.json`.
153
+ - A published build: one ES module plus type declarations. React is left to the application.
154
+ - A demo page with every state, in light and dark.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dmitry Popov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,100 @@
1
- # Temporary Holding Version
1
+ # @coolms/ui-react
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The CoolMS UI kit for React: the components of the CoolMS UI contract, styled by the CoolMS design tokens.
4
+
5
+ The same contract is implemented for Angular by [`@coolms/ui-angular`](https://github.com/coolms/ui-angular). Two
6
+ clients built on different kits may look different; they may not disagree about what the server said. This kit's
7
+ server helpers are how a React client reads it.
8
+
9
+ > **Pre-release.** Every version so far is an alpha (`0.1.0-alpha.N`). npm marks a package's first published
10
+ > version `latest` whatever its tag, so a plain `npm install @coolms/ui-react` installs an alpha too. Names, props
11
+ > and states may still change between alphas; pin an exact version.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install @coolms/ui-react@VERSION
17
+ ```
18
+
19
+ Replace `VERSION` with the exact version you test with, and pin it; the versions are listed on npm. Use
20
+ `0.1.0-alpha.2` or later: in `0.1.0-alpha.1` the token file's first line is not CSS, so a browser drops its light
21
+ theme and the components lose their colours, spacing and radii.
22
+
23
+ React 19.2 or later is a peer dependency.
24
+
25
+ ```tsx
26
+ import '@coolms/ui-react/tokens.css';
27
+ import '@coolms/ui-react/kit.css';
28
+ import { Button, List, ContextMenu, offerFor } from '@coolms/ui-react';
29
+ ```
30
+
31
+ Dark mode is the token file's: set `data-theme="dark"` on the root element.
32
+
33
+ ## Components
34
+
35
+ The contract lives in [`coolms/design-tokens`](https://github.com/coolms/design-tokens), beside the tokens, so every
36
+ CoolMS UI kit checks against one source. This kit copies it at a tag, and `design-tokens.lock.json` pins each copy.
37
+
38
+ Every component of `contract/components.json`, each rendering every state the contract names:
39
+
40
+ | Contract | Component | States |
41
+ | --- | --- | --- |
42
+ | button | `Button` | default, primary, danger, disabled, busy, locked |
43
+ | text-field | `TextField` | default, focused, disabled, read-only, invalid, pinned |
44
+ | select | `Select` | default, disabled, read-only, invalid, empty-list |
45
+ | toggle | `Toggle` | on, off, disabled, read-only |
46
+ | modal | `Modal` | open, closing, dirty |
47
+ | confirm-dialog | `ConfirmDialog` | default, danger, discard-changes |
48
+ | toast | `Toast`, `ToastRegion` | success, error, info, with-action |
49
+ | loading | `Loading` | inline, block |
50
+ | empty-state | `EmptyState` | default, with-action |
51
+ | error-banner | `ErrorBanner` | default, with-retry |
52
+ | page-header | `PageHeader` | default, with-actions, with-back-link |
53
+ | tab-strip | `TabStrip` | default, active, with-count |
54
+ | list | `List` | loading, empty, populated, selected, error |
55
+ | avatar | `Avatar` | picture, initials, presence |
56
+ | context-menu | `ContextMenu` | open, item-danger, item-locked, item-refused |
57
+
58
+ `elevation-required` is not offered: this kit's clients never elevate, so an action the server answers `elevate` is
59
+ not offered at all.
60
+
61
+ ## Reading the server
62
+
63
+ `contract/server-states.json` lists every state the server decides and how every client reacts to it. The helpers:
64
+
65
+ | Reaction | Helper |
66
+ | --- | --- |
67
+ | An action is offered from the subject's capabilities map; an unknown answer is denied (R3, R4) | `offerFor(answer, { elevates })` |
68
+ | A 403 is the last word; elevation-required is told apart from a refusal (R2) | `readRefusal(status, headers, body, { elevates })` |
69
+ | State that expires is read again, not remembered (R1) | `useReread(read)`, `rereadAll()` |
70
+ | A versioned write that answers 412 changed nothing (R5) | `readConflict(status)` |
71
+ | A server that refuses this client's version is not used further (R6) | `needsClientUpdate(...)` |
72
+
73
+ A context menu and an action bar take the same list of items, each with its `offerFor` answer, so they cannot
74
+ disagree.
75
+
76
+ ## Checks
77
+
78
+ ```bash
79
+ npm run verify
80
+ ```
81
+
82
+ runs, in order:
83
+
84
+ - `tokens:check`: the token file, the contract and the checkers are the copies `design-tokens.lock.json` pins; the
85
+ token file is CSS a browser keeps whole, and the check still fails a `//` header; and every token `kit.css` reads is
86
+ defined.
87
+ - `check`: `kit.contract.json` covers the contract, and the components and files it names exist.
88
+ - `typecheck` and `test`.
89
+ - `build`, then `check:built`: the published module loads, exports every declared component, and every target the
90
+ package's `exports` map promises exists.
91
+ - `demo:build`.
92
+
93
+ CI also checks the lock against `coolms/design-tokens` itself: the tag names the lock's commit, and each file there
94
+ hashes as the lock says.
95
+
96
+ `npm run demo` serves a page with every component in every state, in light and dark.
97
+
98
+ ## Licence
99
+
100
+ MIT
@@ -0,0 +1,47 @@
1
+ {
2
+ "repository": "coolms/design-tokens",
3
+ "tag": "v0.7.1",
4
+ "commit": "0167cfcaf665e4f785910e7c309ef18fedf61c52",
5
+ "files": {
6
+ "dist/coolms-tokens.css": {
7
+ "to": "src/tokens/coolms-tokens.css",
8
+ "sha256": "e0b01973324f21b32dc89907d379f3380c47f740e152e471ea4287efee652cc0"
9
+ },
10
+ "contract/components.json": {
11
+ "to": "contract/components.json",
12
+ "sha256": "61c8d3610cdf9a7685576d8ab891f3be8d3b55bc73716172da15e2ca8b889bd0"
13
+ },
14
+ "contract/server-states.json": {
15
+ "to": "contract/server-states.json",
16
+ "sha256": "c8332421aee691374188e2cddfb4f9a7eba1a7d8044309cbc63aeb63467b1562"
17
+ },
18
+ "tools/check-kit.mjs": {
19
+ "to": "tools/check-kit.mjs",
20
+ "sha256": "c48ac67d267aec11698ab362a8095a355eea8c8775c313d4261be2c60b65d0bb"
21
+ },
22
+ "tools/check-css.mjs": {
23
+ "to": "tools/check-css.mjs",
24
+ "sha256": "231ca006b6e949f9882c98186527e2a974efb5acd60bfb8d05a37d82eae6a678"
25
+ },
26
+ "fonts/inter.css": {
27
+ "to": "src/fonts/inter.css",
28
+ "sha256": "78bea3ce5f8e0209ec80162fd692c138a5628ae37c69b2362a49ba755540b2b1"
29
+ },
30
+ "fonts/inter-latin.woff2": {
31
+ "to": "src/fonts/inter-latin.woff2",
32
+ "sha256": "3100e775e8616cd2611beecfa23a4263d7037586789b43f035236a2e6fbd4c62"
33
+ },
34
+ "fonts/inter-latin-ext.woff2": {
35
+ "to": "src/fonts/inter-latin-ext.woff2",
36
+ "sha256": "34b9c504cab7a73e37b746343a449132e56cf7b5481af2cb81dc74dcff25c956"
37
+ },
38
+ "fonts/inter-cyrillic.woff2": {
39
+ "to": "src/fonts/inter-cyrillic.woff2",
40
+ "sha256": "71d5ee93cc1e9f1d520a3a8b66456de18c7879d8df09d57fcd2eaff75fef0075"
41
+ },
42
+ "fonts/OFL.txt": {
43
+ "to": "src/fonts/OFL.txt",
44
+ "sha256": "262481e844521b326f5ecd053e59b98c8b2da78c8ee1bdbb6e8174305e54935a"
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,22 @@
1
+ import type { ButtonHTMLAttributes, ReactNode } from 'react';
2
+ export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> {
3
+ /** secondary (the default), primary -- one per view -- or danger, for an action that destroys or cannot be undone. */
4
+ readonly variant?: 'secondary' | 'primary' | 'danger';
5
+ /** The action is running: the button keeps its place, says so, and cannot be pressed twice. */
6
+ readonly busy?: boolean;
7
+ /** What the button says while busy; defaults to its own label. */
8
+ readonly busyLabel?: ReactNode;
9
+ /** Allowed once the session is elevated: drawn with a lock; what pressing it does is the caller's. */
10
+ readonly locked?: boolean;
11
+ /** Why it is locked, for its tooltip and a screen reader. */
12
+ readonly lockedReason?: string;
13
+ /** A glyph or icon before the label. */
14
+ readonly icon?: ReactNode;
15
+ readonly children: ReactNode;
16
+ }
17
+ /**
18
+ * An action (contract component `button`: default, primary, danger, disabled, busy, locked). A busy button is not
19
+ * disabled to assistive technology's eyes alone: `aria-busy` says why it does nothing now. A locked one stays
20
+ * pressable -- the press is how the person asks for elevation -- and names why it is locked.
21
+ */
22
+ export declare function Button({ variant, busy, busyLabel, locked, lockedReason, icon, disabled, className, children, type, title, ...rest }: ButtonProps): ReactNode;
@@ -0,0 +1,71 @@
1
+ import type { ReactNode } from 'react';
2
+ /** The words a call's components say, in the app's language; English by default. */
3
+ export interface CallLabels {
4
+ readonly incomingAudio: string;
5
+ readonly incomingVideo: string;
6
+ /** The incoming card's name for a screen reader: what is ringing, and who calls. */
7
+ readonly incomingFrom: (what: string, name: string) => string;
8
+ readonly accept: string;
9
+ readonly decline: string;
10
+ readonly callWith: (name: string) => string;
11
+ readonly callTime: (duration: string) => string;
12
+ readonly goodConnection: string;
13
+ readonly poorConnection: string;
14
+ readonly you: string;
15
+ readonly speaking: string;
16
+ readonly mute: string;
17
+ readonly unmute: string;
18
+ readonly speaker: string;
19
+ readonly addPerson: string;
20
+ readonly chat: string;
21
+ readonly hangUp: string;
22
+ readonly onCallWith: (name: string) => string;
23
+ readonly returnToCall: string;
24
+ }
25
+ export declare const CALL_LABELS: CallLabels;
26
+ export interface IncomingCallProps {
27
+ /** Who is calling. */
28
+ readonly name: string;
29
+ readonly media: 'audio' | 'video';
30
+ readonly onAccept: () => void;
31
+ readonly onDecline: () => void;
32
+ /** Its words, in the app's language; each left out is English. */
33
+ readonly labels?: Partial<CallLabels>;
34
+ }
35
+ /** A call ringing on this device: who, and Accept or Decline. An alert dialog, so a screen reader announces it. */
36
+ export declare function IncomingCall({ name, media, onAccept, onDecline, labels }: IncomingCallProps): ReactNode;
37
+ export interface CallPanelProps {
38
+ readonly name: string;
39
+ /** How long the call has lasted ("04:12"). */
40
+ readonly duration: string;
41
+ /** What the call's statistics say of the connection. */
42
+ readonly connection: 'good' | 'poor';
43
+ /** This account, in the call: its name and whether it is speaking. */
44
+ readonly you: {
45
+ readonly name: string;
46
+ readonly speaking: boolean;
47
+ };
48
+ readonly muted: boolean;
49
+ readonly speaker: boolean;
50
+ readonly onToggleMute: () => void;
51
+ readonly onToggleSpeaker: () => void;
52
+ readonly onAddPerson?: () => void;
53
+ readonly onChat?: () => void;
54
+ readonly onHangUp: () => void;
55
+ /** Its words, in the app's language; each left out is English. */
56
+ readonly labels?: Partial<CallLabels>;
57
+ }
58
+ /** A call in progress: who, how long, how the connection is, and its controls. */
59
+ export declare function CallPanel({ name, duration, connection, you, muted, speaker, onToggleMute, onToggleSpeaker, onAddPerson, onChat, onHangUp, labels }: CallPanelProps): ReactNode;
60
+ export interface CallBarProps {
61
+ readonly name: string;
62
+ readonly duration: string;
63
+ readonly muted: boolean;
64
+ readonly onToggleMute: () => void;
65
+ readonly onReturn: () => void;
66
+ readonly onHangUp: () => void;
67
+ /** Its words, in the app's language; each left out is English. */
68
+ readonly labels?: Partial<CallLabels>;
69
+ }
70
+ /** The call, kept in view while another section is open: who, how long, mute, back to it, hang up. */
71
+ export declare function CallBar({ name, duration, muted, onToggleMute, onReturn, onHangUp, labels }: CallBarProps): ReactNode;
@@ -0,0 +1,64 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { Offer } from '../server/capability';
3
+ export interface ListRow {
4
+ readonly id: string;
5
+ readonly primary: ReactNode;
6
+ readonly secondary?: ReactNode;
7
+ /** Leading visual: an Avatar, an icon. */
8
+ readonly lead?: ReactNode;
9
+ /** Trailing text: a date, a size. */
10
+ readonly meta?: ReactNode;
11
+ }
12
+ export interface ListProps {
13
+ /** What the rows are, for a screen reader ("Messages"). */
14
+ readonly label: string;
15
+ /** null while the first read runs. */
16
+ readonly rows: readonly ListRow[] | null;
17
+ /** The read failed: why, in the person's words. Wins over rows. */
18
+ readonly error?: ReactNode;
19
+ readonly onRetry?: () => void;
20
+ readonly loadingText?: ReactNode;
21
+ readonly emptyTitle?: ReactNode;
22
+ readonly emptyHint?: ReactNode;
23
+ readonly selected?: string | null;
24
+ /** A press opens the row. */
25
+ readonly onOpen?: (id: string) => void;
26
+ /** Right-click or the context-menu key on a row: the page opens its ContextMenu at the point. */
27
+ readonly onRowMenu?: (id: string, at: {
28
+ x: number;
29
+ y: number;
30
+ }) => void;
31
+ }
32
+ /**
33
+ * Rows of objects, each opened by a press; a row's other actions in its menu (contract component `list`: loading,
34
+ * empty, populated, selected, error). Up and Down move between rows; Enter opens one.
35
+ */
36
+ export declare function List({ label, rows, error, onRetry, loadingText, emptyTitle, emptyHint, selected, onOpen, onRowMenu }: ListProps): ReactNode;
37
+ export interface MenuItem {
38
+ readonly id: string;
39
+ readonly label: ReactNode;
40
+ /** The server's answer for this action on this subject, read with offerFor (R3). Not offered = not drawn. */
41
+ readonly offer: Offer;
42
+ /** Destroys or cannot be undone. */
43
+ readonly danger?: boolean;
44
+ readonly onSelect: () => void;
45
+ }
46
+ export interface ContextMenuProps {
47
+ /** Where it opens; null = closed. */
48
+ readonly at: {
49
+ readonly x: number;
50
+ readonly y: number;
51
+ } | null;
52
+ /** Exactly the action bar's items for the selection -- the page passes the same list to both. */
53
+ readonly items: readonly MenuItem[];
54
+ readonly onClose: () => void;
55
+ readonly label?: string;
56
+ /** The item focused as it opens: the first, or the last (a menu button opened with Up). */
57
+ readonly focus?: 'first' | 'last';
58
+ }
59
+ /**
60
+ * The selected object's actions (contract component `context-menu`: open, item-danger, item-locked, item-refused).
61
+ * An item the server withheld is not drawn; a locked one carries its lock; a refused one is shown disabled with the
62
+ * server's refusal. Escape, a press outside, or a choice closes it, and focus goes back where it was.
63
+ */
64
+ export declare function ContextMenu({ at, items, onClose, label, focus }: ContextMenuProps): ReactNode;
@@ -0,0 +1,48 @@
1
+ import { type ReactNode, type RefObject } from 'react';
2
+ /** How long the closing state is drawn before the dialog leaves the page. */
3
+ export declare const MODAL_CLOSE_MS = 150;
4
+ export interface ModalProps {
5
+ readonly open: boolean;
6
+ readonly title: ReactNode;
7
+ /** Asked to close: Escape, the scrim, the close button. */
8
+ readonly onClose: () => void;
9
+ /**
10
+ * It holds unsaved work: Escape and the scrim do not close it; they call onDirtyClose, which asks the person
11
+ * (typically a discard-changes ConfirmDialog). The close button does the same.
12
+ */
13
+ readonly dirty?: boolean;
14
+ readonly onDirtyClose?: () => void;
15
+ readonly children: ReactNode;
16
+ /** The dialog's actions, at its foot. */
17
+ readonly footer?: ReactNode;
18
+ /** The close button's name, in the app's language ("Close"). */
19
+ readonly closeLabel?: string;
20
+ /** What takes the focus on opening, when it is not the body's first control (a list, say). */
21
+ readonly initialFocus?: RefObject<HTMLElement | null>;
22
+ /** A class for the dialog itself, for a component drawn in it that has a layout of its own. */
23
+ readonly className?: string;
24
+ }
25
+ /**
26
+ * A dialog over the page (contract component `modal`: open, closing, dirty). Focus moves into it on open and back to
27
+ * where it was on close; Tab stays inside while it is open.
28
+ */
29
+ export declare function Modal({ open, title, onClose, dirty, onDirtyClose, children, footer, closeLabel, initialFocus, className }: ModalProps): ReactNode;
30
+ export interface ConfirmDialogProps {
31
+ readonly open: boolean;
32
+ readonly title: ReactNode;
33
+ readonly message?: ReactNode;
34
+ /**
35
+ * default: a question; danger: the action destroys or cannot be undone -- its button is the danger one;
36
+ * discard-changes: leaving loses unsaved work -- "Discard changes" against "Keep editing".
37
+ */
38
+ readonly kind?: 'default' | 'danger' | 'discard-changes';
39
+ /** The confirming button names the outcome ("Delete 3 messages"), never "OK". */
40
+ readonly confirmLabel?: ReactNode;
41
+ readonly cancelLabel?: ReactNode;
42
+ /** The close button's name for a screen reader, in the app's language; "Close" where none is given. */
43
+ readonly closeLabel?: string;
44
+ readonly onConfirm: () => void;
45
+ readonly onCancel: () => void;
46
+ }
47
+ /** A question before a destructive or irreversible action (contract component `confirm-dialog`: default, danger, discard-changes). */
48
+ export declare function ConfirmDialog({ open, title, message, kind, confirmLabel, cancelLabel, closeLabel, onConfirm, onCancel }: ConfirmDialogProps): ReactNode;
@@ -0,0 +1,50 @@
1
+ import { type ReactNode } from 'react';
2
+ interface FieldFrame {
3
+ readonly label: ReactNode;
4
+ /** What the field is for, under it. */
5
+ readonly help?: ReactNode;
6
+ /** Why the value is not accepted; makes the field invalid. */
7
+ readonly error?: ReactNode;
8
+ readonly disabled?: boolean;
9
+ /** Shown, focusable and copyable, but not changed here. */
10
+ readonly readOnly?: boolean;
11
+ }
12
+ export interface TextFieldProps extends FieldFrame {
13
+ readonly value: string;
14
+ readonly onChange?: (value: string) => void;
15
+ readonly placeholder?: string;
16
+ readonly type?: 'text' | 'email' | 'url' | 'search' | 'tel' | 'password';
17
+ /**
18
+ * The value is set by the environment, not here (a pinned setting): shown read-only with why, the way the admin
19
+ * shows a key the deployment pins.
20
+ */
21
+ readonly pinned?: ReactNode;
22
+ readonly name?: string;
23
+ }
24
+ /** One line of text (contract component `text-field`: default, focused, disabled, read-only, invalid, pinned). */
25
+ export declare function TextField({ label, help, error, disabled, readOnly, pinned, value, onChange, placeholder, type, name }: TextFieldProps): ReactNode;
26
+ export interface SelectOption {
27
+ readonly value: string;
28
+ readonly label: string;
29
+ }
30
+ export interface SelectProps extends FieldFrame {
31
+ readonly value: string;
32
+ readonly options: readonly SelectOption[];
33
+ readonly onChange?: (value: string) => void;
34
+ /** What the field says when the list has nothing to choose from (contract state `empty-list`). */
35
+ readonly emptyText?: ReactNode;
36
+ readonly name?: string;
37
+ }
38
+ /** One choice from a list (contract component `select`: default, disabled, read-only, invalid, empty-list). */
39
+ export declare function Select({ label, help, error, disabled, readOnly, value, options, onChange, emptyText, name }: SelectProps): ReactNode;
40
+ export interface ToggleProps {
41
+ readonly label: ReactNode;
42
+ readonly checked: boolean;
43
+ readonly onChange?: (checked: boolean) => void;
44
+ readonly disabled?: boolean;
45
+ readonly readOnly?: boolean;
46
+ readonly help?: ReactNode;
47
+ }
48
+ /** On or off, the label on the same baseline (contract component `toggle`: on, off, disabled, read-only). */
49
+ export declare function Toggle({ label, checked, onChange, disabled, readOnly, help }: ToggleProps): ReactNode;
50
+ export {};