@coolms/ui-react 0.1.0-alpha.4 → 0.1.0-alpha.42
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 +379 -4
- package/design-tokens.lock.json +14 -6
- package/dist/components/Button.d.ts +6 -3
- package/dist/components/Call.d.ts +3 -1
- package/dist/components/Collections.d.ts +27 -7
- package/dist/components/Column.d.ts +21 -0
- package/dist/components/Dialogs.d.ts +6 -2
- package/dist/components/Fields.d.ts +59 -4
- package/dist/components/FilePicker.d.ts +91 -0
- package/dist/components/FileViewer.d.ts +106 -0
- package/dist/components/FilterMenu.d.ts +51 -0
- package/dist/components/Icon.d.ts +18 -1
- package/dist/components/ListHead.d.ts +15 -0
- package/dist/components/Notification.d.ts +38 -0
- package/dist/components/PaneToolbar.d.ts +83 -0
- package/dist/components/ScreenShell.d.ts +110 -0
- package/dist/components/SectionHeader.d.ts +95 -0
- package/dist/components/SignIn.d.ts +1 -1
- package/dist/components/Splitter.d.ts +38 -0
- package/dist/components/State.d.ts +38 -0
- package/dist/components/Status.d.ts +7 -2
- package/dist/components/Structure.d.ts +34 -4
- package/dist/components/Workspace.d.ts +84 -20
- package/dist/components/pull.d.ts +21 -0
- package/dist/components/tipDismissal.d.ts +14 -0
- package/dist/index.d.ts +27 -15
- package/dist/index.js +2531 -747
- package/kit.contract.json +15 -5
- package/package.json +10 -5
- package/src/kit.css +406 -45
- package/src/tokens/coolms-tokens.css +41 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type MenuItem } from './Collections.js';
|
|
3
|
+
import { type IconName } from './Icon.js';
|
|
4
|
+
import type { Offer } from '../server/capability.js';
|
|
5
|
+
/** The section's primary action: one action, or a split button whose menu lists the action's declared entries. */
|
|
6
|
+
export type SectionPrimary = {
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly icon: IconName;
|
|
9
|
+
readonly onPress: () => void;
|
|
10
|
+
readonly offer?: Offer;
|
|
11
|
+
} | {
|
|
12
|
+
readonly label: string;
|
|
13
|
+
readonly icon: IconName;
|
|
14
|
+
readonly onPress: () => void;
|
|
15
|
+
readonly offer?: Offer;
|
|
16
|
+
readonly menu: readonly MenuItem[];
|
|
17
|
+
/** The split menu button's accessible name. */
|
|
18
|
+
readonly menuLabel: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Where a drawn reason starts in its row, in px from the row's left: centred on its action when the row has room, moved
|
|
22
|
+
* only as far as keeps it inside the row.
|
|
23
|
+
*/
|
|
24
|
+
export declare function reasonLeft(anchorCentre: number, rowWidth: number, tipWidth: number): number;
|
|
25
|
+
/** One of the section's other declared actions: a button in row 1 while it fits. */
|
|
26
|
+
export interface SectionAction {
|
|
27
|
+
readonly id: string;
|
|
28
|
+
/** Its accessible name always, and its tooltip once it shows as its icon. */
|
|
29
|
+
readonly label: string;
|
|
30
|
+
/** Its icon by its Bootstrap Icons name, as the server names it; without one (or one the kit lacks) it keeps its label. */
|
|
31
|
+
readonly icon?: string;
|
|
32
|
+
/**
|
|
33
|
+
* When it gives way: lower first, actions sharing a number together; without one, after every numbered one, from
|
|
34
|
+
* the end of the row back. 0: menu only, in More at every width (a single one alone is a button at the row's end).
|
|
35
|
+
*/
|
|
36
|
+
readonly overflow?: number;
|
|
37
|
+
readonly danger?: boolean;
|
|
38
|
+
/** The server's answer (R3); not offered = not drawn; a refusal = shown disabled, with the server's sentence. */
|
|
39
|
+
readonly offer?: Offer;
|
|
40
|
+
readonly onPress: () => void;
|
|
41
|
+
}
|
|
42
|
+
/** A chip after the title: a slug, a state, a count. */
|
|
43
|
+
export interface SectionMeta {
|
|
44
|
+
readonly id: string;
|
|
45
|
+
/** The chip as the host draws it. */
|
|
46
|
+
readonly content: ReactNode;
|
|
47
|
+
/** Its whole text: its tooltip and accessible name once it is cut. */
|
|
48
|
+
readonly text: string;
|
|
49
|
+
/** The page says it elsewhere too: it may hide. Not set, it is the only place its fact appears and never hides. */
|
|
50
|
+
readonly elsewhere?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface SectionHeaderProps {
|
|
53
|
+
/** The section's declared title. */
|
|
54
|
+
readonly title: string;
|
|
55
|
+
/** An icon before the title. */
|
|
56
|
+
readonly icon?: IconName;
|
|
57
|
+
/** One line saying what the section is for, after the title; the first to hide. */
|
|
58
|
+
readonly description?: string;
|
|
59
|
+
/** Chips after the title. */
|
|
60
|
+
readonly meta?: readonly SectionMeta[];
|
|
61
|
+
/** Given only when the section declares one. */
|
|
62
|
+
readonly primary?: SectionPrimary;
|
|
63
|
+
/** The section's other declared actions, in the tree's order: buttons while they fit, then in More. */
|
|
64
|
+
readonly secondary?: readonly SectionAction[];
|
|
65
|
+
/**
|
|
66
|
+
* Deprecated, read as `secondary` for one release: other actions as menu items. They have no icon or priority of
|
|
67
|
+
* their own, so each keeps its label until it moves into More, from the end of the row back.
|
|
68
|
+
*/
|
|
69
|
+
readonly more?: readonly MenuItem[];
|
|
70
|
+
/** More's accessible name and tooltip, from the host's catalogue. */
|
|
71
|
+
readonly moreLabel: string;
|
|
72
|
+
/** Row 2: the section's context (a mailbox card, a list's name with its filter, breadcrumbs); with none, no row 2. */
|
|
73
|
+
readonly context?: ReactNode;
|
|
74
|
+
/** The header spans a one-column page. */
|
|
75
|
+
readonly fullWidth?: boolean;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The head of a section from tablet width up (contract component `section-header`: default, with-primary,
|
|
79
|
+
* with-primary-menu, with-more, with-secondary, secondary-icon, secondary-in-more, lone-menu-only, action-disabled,
|
|
80
|
+
* with-context, with-description, meta-hidden, meta-cut, primary-icon, primary-in-more, full-width).
|
|
81
|
+
*
|
|
82
|
+
* Row 1, on one line at every width: the title, its description and chips, then the secondary actions as quiet
|
|
83
|
+
* buttons (a single menu-only one among them, last), the primary, the last action on the right, and More after it. It is measured on its own width and gives way in this order: the description hides;
|
|
84
|
+
* the chips the page says elsewhere hide; the secondary actions drop their labels one by one (lower overflow first, then
|
|
85
|
+
* those with none from the end back); the primary drops its label, keeping its colour; the secondary actions move into
|
|
86
|
+
* More in the same order; the primary moves into More last; only then is the title cut, down to 64px (the actions give
|
|
87
|
+
* way before the title, never the title before them); and last the chips that are the only place their fact appears
|
|
88
|
+
* are cut, the last first. More never holds one action: the first move
|
|
89
|
+
* takes two, or one beside a menu-only action, and where only one could go it stays, at its icon width. More lists the
|
|
90
|
+
* primary first, then those that gave way, then the menu-only last.
|
|
91
|
+
*
|
|
92
|
+
* Its actions are one toolbar named by the title: one Tab stop; Left and Right, Home and End move inside it. Row 2:
|
|
93
|
+
* the context, only when given. No divider lines. Below tablet width the host draws the screen shell instead.
|
|
94
|
+
*/
|
|
95
|
+
export declare function SectionHeader({ title, icon, description, meta, primary, secondary, more, moreLabel, context, fullWidth }: SectionHeaderProps): ReactNode;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
export interface SplitterProps {
|
|
3
|
+
/**
|
|
4
|
+
* Where the width is remembered on this device (the screen and the split, such as "mail:folders"); never sent
|
|
5
|
+
* anywhere. Without one, nothing is remembered.
|
|
6
|
+
*/
|
|
7
|
+
readonly storageKey?: string;
|
|
8
|
+
/** The leading column's width in px, when the host keeps it; without one the splitter keeps it itself. */
|
|
9
|
+
readonly value?: number;
|
|
10
|
+
/** The leading column's default width in px: what a double-click puts it back to. */
|
|
11
|
+
readonly default: number;
|
|
12
|
+
/** The leading column's least width in px. */
|
|
13
|
+
readonly min: number;
|
|
14
|
+
/** The leading column's greatest width in px (or the width that leaves the trailing column its least). */
|
|
15
|
+
readonly max: number;
|
|
16
|
+
/** How far an arrow key moves it, in px; Shift with an arrow moves it 64. */
|
|
17
|
+
readonly step?: number;
|
|
18
|
+
/** The handle's accessible name, naming the columns it resizes ("Resize the folder list"). */
|
|
19
|
+
readonly label: string;
|
|
20
|
+
/**
|
|
21
|
+
* The new width: while it is dragged (`done` false), and once more when the drag ends, on each key, on a
|
|
22
|
+
* double-click and when a remembered width is read back (`done` true).
|
|
23
|
+
*/
|
|
24
|
+
readonly onChange: (width: number, done: boolean) => void;
|
|
25
|
+
readonly className?: string;
|
|
26
|
+
readonly style?: CSSProperties;
|
|
27
|
+
}
|
|
28
|
+
/** The width remembered on this device under `storageKey`, or null: none, or storage that cannot be read. */
|
|
29
|
+
export declare function readSplitterWidth(storageKey: string): number | null;
|
|
30
|
+
/**
|
|
31
|
+
* The handle between two columns (contract component `splitter`: default, hover, dragging, focused, at-min, at-max).
|
|
32
|
+
* A vertical strip at least 8px wide that draws nothing at rest and the accent line on hover, while dragged and with
|
|
33
|
+
* focus. A drag moves the leading column within min and max and remembers its width on release; a double-click puts it
|
|
34
|
+
* back to its default and forgets it. It is a focusable separator: Left and Right move it by step (Shift: 64), Home and
|
|
35
|
+
* End take it to min and max, Enter and Escape leave it; each key is remembered as a release is. A remembered width is
|
|
36
|
+
* read back, within today's limits, when it is first drawn.
|
|
37
|
+
*/
|
|
38
|
+
export declare function Splitter({ storageKey, value, default: initial, min, max, step, label, onChange, className, style }: SplitterProps): ReactNode;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* What a page, a card or a line of text shows instead of its content. `elevation-required` is not offered here: the
|
|
4
|
+
* clients this kit serves never elevate (kit.contract.json, notOffered).
|
|
5
|
+
*/
|
|
6
|
+
export type StateKind = 'loading' | 'empty' | 'error' | 'denied';
|
|
7
|
+
/**
|
|
8
|
+
* Where it stands, which sets its size: `page` (a pane or a page: the icon, the title, one line and at most one action,
|
|
9
|
+
* centred both ways in the free area it fills), `block` (a section inside a card: one muted line, no icon, aligned with
|
|
10
|
+
* the card's text; its title is the line, a description is not drawn, an action is a link beside it), or `inline`
|
|
11
|
+
* (small, beside text).
|
|
12
|
+
*/
|
|
13
|
+
export type StatePlacement = 'page' | 'block' | 'inline';
|
|
14
|
+
export interface StateProps {
|
|
15
|
+
readonly kind: StateKind;
|
|
16
|
+
/** What the state is, in the caller's words. */
|
|
17
|
+
readonly title: string;
|
|
18
|
+
/** Why, or what to do, in the caller's words. */
|
|
19
|
+
readonly description?: string;
|
|
20
|
+
/** One thing to do about it: Retry for an error, say. Its label is the caller's word too. A refusal offers none. */
|
|
21
|
+
readonly action?: {
|
|
22
|
+
readonly label: string;
|
|
23
|
+
readonly onAction: () => void;
|
|
24
|
+
};
|
|
25
|
+
readonly placement?: StatePlacement;
|
|
26
|
+
/** The empty kind only: an icon name from the icon list (as the server's nodes name them), drawn above the title, decorative. */
|
|
27
|
+
readonly icon?: string;
|
|
28
|
+
}
|
|
29
|
+
/** How long a loading state shows nothing, so a read answered sooner does not flash: the `state-delay` token. */
|
|
30
|
+
export declare const STATE_DELAY_MS = 300;
|
|
31
|
+
/**
|
|
32
|
+
* One component for every state instead of content (contract component `state`: loading, empty, error, denied, page,
|
|
33
|
+
* block, inline, with-action, delayed). It shows the caller's title and description as given and adds no words of
|
|
34
|
+
* its own beyond its action's label. Every kind is a polite status; loading shows nothing at all -- neither spinner
|
|
35
|
+
* nor title -- until the state delay has passed, then both together, while its title is in the live region from the
|
|
36
|
+
* start, visually hidden.
|
|
37
|
+
*/
|
|
38
|
+
export declare function State({ kind, title, description, action, placement, icon }: StateProps): ReactNode;
|
|
@@ -33,9 +33,14 @@ export interface EmptyStateProps {
|
|
|
33
33
|
/** Why there is nothing, and what would bring something. */
|
|
34
34
|
readonly hint?: ReactNode;
|
|
35
35
|
readonly action?: ReactNode;
|
|
36
|
+
/** An icon name from the icon list (as the server's nodes name them), drawn above the title, decorative. */
|
|
37
|
+
readonly icon?: string;
|
|
36
38
|
}
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Nothing to show, and why; optionally what to do (contract component `empty-state`: default, with-action). Drawn as the
|
|
41
|
+
* state component's empty state at page size: centred both ways in the free area it fills, as `State` draws it.
|
|
42
|
+
*/
|
|
43
|
+
export declare function EmptyState({ title, hint, action, icon }: EmptyStateProps): ReactNode;
|
|
39
44
|
export interface ErrorBannerProps {
|
|
40
45
|
/** Why the read failed, in the person's words -- the server's own words when it gave them. */
|
|
41
46
|
readonly message: ReactNode;
|
|
@@ -36,13 +36,43 @@ export interface AvatarProps {
|
|
|
36
36
|
/** The person's or account's name: the initials, and the accessible name. */
|
|
37
37
|
readonly name: string;
|
|
38
38
|
readonly pictureUrl?: string;
|
|
39
|
-
/**
|
|
40
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Whether they are reachable now, where the server declares it (chat members): a dot at the bottom right. Busy is
|
|
41
|
+
* drawn as away. Left out where the server says nothing (mail senders).
|
|
42
|
+
*/
|
|
43
|
+
readonly presence?: AvatarPresence;
|
|
44
|
+
/**
|
|
45
|
+
* On the person's own avatar in a bar: the live connection, as its dot, in place of presence; `label` says the
|
|
46
|
+
* state in words (its accessible name and tooltip), for the host's menu to repeat on a press.
|
|
47
|
+
*/
|
|
48
|
+
readonly connection?: {
|
|
49
|
+
readonly state: AvatarConnection;
|
|
50
|
+
readonly label: string;
|
|
51
|
+
};
|
|
52
|
+
/** Their account is gone: a neutral person icon, never initials of the name stored for them. */
|
|
53
|
+
readonly deleted?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* `name` is the host's words for no one ("No recipient yet", "No sender", a call's status), not a name: a neutral
|
|
56
|
+
* person icon, never initials of those words. They stay the accessible name.
|
|
57
|
+
*/
|
|
58
|
+
readonly placeholder?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* The host's words for a person with no name to show (no name given, or one the viewer may not read), the same label
|
|
61
|
+
* its lists use ("No name"): the accessible name when `name` is blank. "?" when left out. The avatar still shows "?".
|
|
62
|
+
*/
|
|
63
|
+
readonly unnamedLabel?: string;
|
|
41
64
|
readonly size?: number;
|
|
65
|
+
/** What the tint is chosen from: an id that stays the same (a user's, a conversation's). The name when left out. */
|
|
66
|
+
readonly tintSeed?: string;
|
|
42
67
|
}
|
|
43
|
-
|
|
68
|
+
export type AvatarPresence = 'online' | 'away' | 'busy' | 'offline';
|
|
69
|
+
export type AvatarConnection = 'connected' | 'reconnecting' | 'offline';
|
|
70
|
+
/**
|
|
71
|
+
* Up to two initials from a name: "Ada Lovelace" -> "AL", "ada" -> "A". A sender named for the service that sent on
|
|
72
|
+
* their behalf keeps their own: "Valentina Zagnetova via LinkedIn" -> "VZ".
|
|
73
|
+
*/
|
|
44
74
|
export declare function initialsOf(name: string): string;
|
|
45
75
|
/** Which of the six avatar tints a name takes: the same name always the same tint. */
|
|
46
76
|
export declare function tintOf(name: string): number;
|
|
47
77
|
/** A person or an account, by picture or initials (contract component `avatar`: picture, initials, presence). */
|
|
48
|
-
export declare function Avatar({ name, pictureUrl, presence, size }: AvatarProps): ReactNode;
|
|
78
|
+
export declare function Avatar({ name, pictureUrl, presence, connection, deleted, placeholder, size, tintSeed, unnamedLabel }: AvatarProps): ReactNode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import { type IconName } from './Icon';
|
|
2
|
+
import { type IconName } from './Icon.js';
|
|
3
3
|
export interface BadgeProps {
|
|
4
4
|
readonly count: number;
|
|
5
5
|
/** What the number counts, for a screen reader ("12 unread"). */
|
|
@@ -52,24 +52,21 @@ export interface SearchFieldProps {
|
|
|
52
52
|
}
|
|
53
53
|
/** A search field with its icon; the label is for assistive technology, the placeholder shows what can be found. */
|
|
54
54
|
export declare function SearchField({ label, placeholder, value, onChange, onSearch }: SearchFieldProps): ReactNode;
|
|
55
|
-
export interface FilterOption {
|
|
56
|
-
readonly id: string;
|
|
57
|
-
readonly label: string;
|
|
58
|
-
}
|
|
59
|
-
export interface FilterChipsProps {
|
|
60
|
-
readonly options: readonly FilterOption[];
|
|
61
|
-
readonly value: string;
|
|
62
|
-
readonly onChange: (id: string) => void;
|
|
63
|
-
/** What the chips filter ("Show"). */
|
|
64
|
-
readonly label: string;
|
|
65
|
-
}
|
|
66
|
-
/** One of a few filters, as pills; arrow keys move between them, as a radio group does. */
|
|
67
|
-
export declare function FilterChips({ options, value, onChange, label }: FilterChipsProps): ReactNode;
|
|
68
55
|
export interface Pane {
|
|
69
56
|
/** What the pane holds, for assistive technology ("Folders", "Messages", "Message"). */
|
|
70
57
|
readonly label: string;
|
|
71
58
|
readonly content: ReactNode;
|
|
72
59
|
}
|
|
60
|
+
/** A pane the person may make wider or narrower, in px: where it is, its limits, its default, and its splitter's name. */
|
|
61
|
+
export interface PaneSize {
|
|
62
|
+
readonly width: number;
|
|
63
|
+
readonly min: number;
|
|
64
|
+
readonly max: number;
|
|
65
|
+
/** The width a double-click on its splitter puts it back to. */
|
|
66
|
+
readonly reset: number;
|
|
67
|
+
/** The splitter's name, in the app's language ("Resize folders"). */
|
|
68
|
+
readonly label: string;
|
|
69
|
+
}
|
|
73
70
|
export interface SplitPanesProps {
|
|
74
71
|
/** Two panes (a list and what is open) or three (navigation, a list, what is open). */
|
|
75
72
|
readonly panes: readonly [Pane, Pane] | readonly [Pane, Pane, Pane];
|
|
@@ -86,14 +83,45 @@ export interface SplitPanesProps {
|
|
|
86
83
|
readonly label: string;
|
|
87
84
|
readonly href: string;
|
|
88
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* Sizes for the panes before the last, by index: each one given draws a splitter after its pane where every pane
|
|
88
|
+
* shows (the desktop grid). The caller keeps the widths (or the device does, with `storageKey`); the last pane takes
|
|
89
|
+
* the rest.
|
|
90
|
+
*/
|
|
91
|
+
readonly sizes?: readonly (PaneSize | undefined)[];
|
|
92
|
+
/** The last pane's least width while splitters move and the window narrows (360 by default). */
|
|
93
|
+
readonly lastMin?: number;
|
|
94
|
+
/**
|
|
95
|
+
* A splitter moved pane `index` to `width`: while it is dragged (`done` false), and once more when the drag or the
|
|
96
|
+
* key ends (`done` true), which is when a width is worth keeping.
|
|
97
|
+
*/
|
|
98
|
+
readonly onResize?: (index: number, width: number, done: boolean) => void;
|
|
99
|
+
/**
|
|
100
|
+
* Where the widths are remembered on this device (the screen, such as "mail"): each splitter keeps its own under
|
|
101
|
+
* `${storageKey}:${index}`, and the panes open at the widths remembered there. Without one, the caller keeps them.
|
|
102
|
+
*/
|
|
103
|
+
readonly storageKey?: string;
|
|
89
104
|
}
|
|
90
105
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
106
|
+
* The widths the panes take in `room` px: each as wanted within its limits; when the last pane would be under its
|
|
107
|
+
* least width, the pane nearest it gives way first, down to its own least, then the one before.
|
|
93
108
|
*/
|
|
94
|
-
export declare function
|
|
109
|
+
export declare function fitPanes(wanted: readonly PaneSize[], room: number, lastMin: number): number[];
|
|
110
|
+
/**
|
|
111
|
+
* Two or three panes side by side (contract `split-panes`), showing fewer as the window narrows. With `sizes`, the
|
|
112
|
+
* panes before the last are resizable where all of them show (contract `pane splitter`): each has the kit's one
|
|
113
|
+
* Splitter after it, within the pane's limits and never leaving the last pane under `lastMin`. The last pane is never
|
|
114
|
+
* narrower than `lastMin`; as the window narrows the pane nearest it gives way first. With `storageKey` the widths are
|
|
115
|
+
* remembered on the device; the caller still hears each move through `onResize`.
|
|
116
|
+
*/
|
|
117
|
+
export declare function SplitPanes({ panes, active, back, sizes, lastMin, onResize, storageKey }: SplitPanesProps): ReactNode;
|
|
95
118
|
export interface MailRowProps {
|
|
96
119
|
readonly from: string;
|
|
120
|
+
/**
|
|
121
|
+
* `from` is the host's words for no one ("No recipient yet" on a draft, "No sender"): the avatar is a neutral person
|
|
122
|
+
* icon, never initials of those words.
|
|
123
|
+
*/
|
|
124
|
+
readonly fromPlaceholder?: boolean;
|
|
97
125
|
readonly subject: string;
|
|
98
126
|
readonly preview: string;
|
|
99
127
|
/** When it arrived, as the reader reads it ("09:42", "Yesterday"). */
|
|
@@ -102,6 +130,25 @@ export interface MailRowProps {
|
|
|
102
130
|
readonly hasAttachment?: boolean;
|
|
103
131
|
readonly selected?: boolean;
|
|
104
132
|
readonly onOpen: () => void;
|
|
133
|
+
/**
|
|
134
|
+
* The row's checkbox, in the avatar's place (contract list, part avatar checkbox); with none, the avatar alone (a
|
|
135
|
+
* row the host does not let be checked). `label` is its accessible name, in the host's
|
|
136
|
+
* words: "Select: {sender}, {subject}". `onCheck` is called for a click, a tap and Space alike, with Shift and with
|
|
137
|
+
* Ctrl/Cmd (`toggle`), and the row is never opened by it. `pending`: the check is on its way, the box busy and not
|
|
138
|
+
* pressable; `disabled`: it cannot be checked now.
|
|
139
|
+
*/
|
|
140
|
+
readonly check?: {
|
|
141
|
+
readonly checked: boolean;
|
|
142
|
+
readonly onCheck: (e: {
|
|
143
|
+
readonly shift: boolean;
|
|
144
|
+
readonly toggle: boolean;
|
|
145
|
+
}) => void;
|
|
146
|
+
readonly label: string;
|
|
147
|
+
readonly pending?: boolean;
|
|
148
|
+
readonly disabled?: boolean;
|
|
149
|
+
};
|
|
150
|
+
/** Something in the list is checked: every row shows its checkbox, until nothing is. */
|
|
151
|
+
readonly selecting?: boolean;
|
|
105
152
|
/** Its words for assistive technology, in the app's language; each left out is English. */
|
|
106
153
|
readonly labels?: Partial<MailRowLabels>;
|
|
107
154
|
}
|
|
@@ -110,8 +157,15 @@ export interface MailRowLabels {
|
|
|
110
157
|
readonly unread: string;
|
|
111
158
|
}
|
|
112
159
|
export declare const MAIL_ROW_LABELS: MailRowLabels;
|
|
113
|
-
/**
|
|
114
|
-
|
|
160
|
+
/**
|
|
161
|
+
* One message in a mailbox's list: who, what, the start of it, when; unread in bold with its dot. Three lines at every
|
|
162
|
+
* width: the sender and the time, the subject, the preview. The row (`cms-mail-row`, carrying is-unread and
|
|
163
|
+
* is-selected) holds the open button (`cms-mail-row__open`, aria-current when selected) and, with `check`, the
|
|
164
|
+
* checkbox in the avatar's place (`cms-mail-row__check`): shown as the checkbox while `selecting` (something is
|
|
165
|
+
* selected), while checked, on keyboard focus within the row, and under a fine pointer's hover; the avatar otherwise,
|
|
166
|
+
* so a touch screen with nothing selected shows every avatar. The avatar's top is on the sender line's top.
|
|
167
|
+
*/
|
|
168
|
+
export declare function MailRow({ from, fromPlaceholder, subject, preview, time, unread, hasAttachment, selected, onOpen, check, selecting, labels }: MailRowProps): ReactNode;
|
|
115
169
|
export interface ChatBubbleProps {
|
|
116
170
|
/** Received from someone else, or sent by this account. */
|
|
117
171
|
readonly direction: 'in' | 'out';
|
|
@@ -137,9 +191,19 @@ export interface ComposerProps {
|
|
|
137
191
|
readonly sendLabel?: string;
|
|
138
192
|
/** The attach button's name, in the app's language ("Attach a file"). */
|
|
139
193
|
readonly attachLabel?: string;
|
|
194
|
+
/**
|
|
195
|
+
* A quick reply's own controls, at the start of its last row, before Send (an attach menu). A chat composer does not
|
|
196
|
+
* draw them. With `onAttach` as well, a reply draws both: these first, then the attach button.
|
|
197
|
+
*/
|
|
198
|
+
readonly leading?: ReactNode;
|
|
199
|
+
/**
|
|
200
|
+
* Whether Send sends: by default, when the text is not empty. Given, it decides instead, as for a reply that may go
|
|
201
|
+
* with files and no text, or may not go over its mailbox's limit.
|
|
202
|
+
*/
|
|
203
|
+
readonly canSend?: boolean;
|
|
140
204
|
}
|
|
141
205
|
/**
|
|
142
206
|
* Writing a message: the text, attaching a file, sending. Enter sends a chat message; Shift+Enter starts a new line.
|
|
143
207
|
* Enter while an input method is composing (Chinese, Japanese, Korean...) belongs to the composition and never sends.
|
|
144
208
|
*/
|
|
145
|
-
export declare function Composer({ label, value, onChange, onSend, onAttach, placeholder, variant, sendLabel, attachLabel }: ComposerProps): ReactNode;
|
|
209
|
+
export declare function Composer({ label, value, onChange, onSend, onAttach, placeholder, variant, sendLabel, attachLabel, leading, canSend }: ComposerProps): ReactNode;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ReactNode, type RefObject } from 'react';
|
|
2
|
+
/** How far down a pull has to go before letting go refreshes, in px (contract screen-shell, pull). */
|
|
3
|
+
export declare const PULL_AT = 64;
|
|
4
|
+
/**
|
|
5
|
+
* Pull to refresh on a scroll region at its top: a touch dragged down from the very top shows how far it has gone (up
|
|
6
|
+
* to half again the threshold) and, let go past the threshold, calls `onPull`. A drag that starts lower, in the region or
|
|
7
|
+
* in a list scrolling inside it, or goes up, is that scroll's own. Returns how far it is pulled now, 0 at rest.
|
|
8
|
+
*/
|
|
9
|
+
export declare function usePull(region: RefObject<HTMLElement | null>, onPull: (() => void) | null): number;
|
|
10
|
+
/** The content's pull, as the shell has it: a list inside draws it as its `pulled` state. */
|
|
11
|
+
export interface PullState {
|
|
12
|
+
/** How far it is pulled now, in px; 0 at rest. */
|
|
13
|
+
readonly distance: number;
|
|
14
|
+
/** The refresh it started is under way. */
|
|
15
|
+
readonly refreshing: boolean;
|
|
16
|
+
/** What the pull says while pulled: the time of the last sync. */
|
|
17
|
+
readonly text: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export declare const PullContext: import("react").Context<PullState | null>;
|
|
20
|
+
/** The pull of the screen around a list, or null outside a screen that takes one. */
|
|
21
|
+
export declare function usePullState(): PullState | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A drawn tip's dismissal (WCAG 1.4.13): Escape hides it whether hover, keyboard focus or a press showed it, and it
|
|
3
|
+
* stays hidden until both the pointer and the focus have left its control. A control is named by an id the caller
|
|
4
|
+
* gives; the control marks itself `data-tip-dismissed` while `dismissed(id)`, and the stylesheet shows no tip there.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useTipDismissal(): {
|
|
7
|
+
readonly dismissed: (id: string) => boolean;
|
|
8
|
+
readonly dismiss: (id: string) => void;
|
|
9
|
+
readonly show: (id: string) => void;
|
|
10
|
+
readonly pointerIn: (id: string) => void;
|
|
11
|
+
readonly pointerOut: (id: string) => void;
|
|
12
|
+
readonly focusIn: (id: string) => void;
|
|
13
|
+
readonly focusOut: (id: string) => void;
|
|
14
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
export { Button, type ButtonProps } from './components/Button';
|
|
2
|
-
export { TextField, Select, Toggle, type TextFieldProps, type SelectProps, type SelectOption, type ToggleProps } from './components/Fields';
|
|
3
|
-
export { Modal, ConfirmDialog, MODAL_CLOSE_MS, type ModalProps, type ConfirmDialogProps } from './components/Dialogs';
|
|
4
|
-
export { Toast, ToastRegion, Loading, EmptyState, ErrorBanner, type ToastProps, type LoadingProps, type EmptyStateProps, type ErrorBannerProps } from './components/Status';
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
1
|
+
export { Button, type ButtonProps } from './components/Button.js';
|
|
2
|
+
export { TextField, TextArea, Select, Toggle, writtenOut, type TextFieldProps, type TextFieldType, type TextAreaProps, type SelectProps, type SelectOption, type ToggleProps } from './components/Fields.js';
|
|
3
|
+
export { Modal, ConfirmDialog, MODAL_CLOSE_MS, type ModalProps, type ConfirmDialogProps } from './components/Dialogs.js';
|
|
4
|
+
export { Toast, ToastRegion, Loading, EmptyState, ErrorBanner, type ToastProps, type LoadingProps, type EmptyStateProps, type ErrorBannerProps } from './components/Status.js';
|
|
5
|
+
export { State, STATE_DELAY_MS, type StateKind, type StatePlacement, type StateProps } from './components/State.js';
|
|
6
|
+
export { FileViewer, type FileViewerAction, type FileViewerConflict, type FileViewerEditing, type FileViewerProps, type FileViewerSiblings, type FileViewerState } from './components/FileViewer.js';
|
|
7
|
+
export { FilePicker, FilePickerDenied, FilePickerRestart, type FilePickerBudget, type FilePickerChoice, type FilePickerEntry, type FilePickerLabels, type FilePickerPage, type FilePickerProps, type FilePickerSpace } from './components/FilePicker.js';
|
|
8
|
+
export { SectionHeader, type SectionAction, type SectionHeaderProps, type SectionMeta, type SectionPrimary } from './components/SectionHeader.js';
|
|
9
|
+
export { Column, type ColumnProps } from './components/Column.js';
|
|
10
|
+
export { PageHeader, TabStrip, Avatar, initialsOf, tintOf, type PageHeaderProps, type Tab, type TabStripProps, type AvatarProps, type AvatarPresence, type AvatarConnection } from './components/Structure.js';
|
|
11
|
+
export { Icon, ICON_NAMES, BOOTSTRAP_ICONS, NamedIcon, iconForName, type IconName, type IconProps } from './components/Icon.js';
|
|
12
|
+
export { AppShell, Badge, SearchField, SplitPanes, fitPanes, MailRow, ChatBubble, Composer, MAIL_ROW_LABELS, type MailRowLabels, type AppShellProps, type RailItem, type BadgeProps, type SearchFieldProps, type SplitPanesProps, type PaneSize, type Pane, type MailRowProps, type ChatBubbleProps, type ComposerProps } from './components/Workspace.js';
|
|
13
|
+
export { IncomingCall, CallPanel, CallBar, CALL_LABELS, type CallLabels, type IncomingCallProps, type CallPanelProps, type CallBarProps } from './components/Call.js';
|
|
14
|
+
export { SignInLayout, SignInForm, SIGN_IN_LABELS, type SignInLabels, type SignInLayoutProps, type SignInFormProps, type SignInFeature } from './components/SignIn.js';
|
|
15
|
+
export { List, ContextMenu, type ListRow, type ListProps, type MenuItem, type ContextMenuProps } from './components/Collections.js';
|
|
16
|
+
export { FilterMenu, FILTER_MENU_LABELS, type FilterMenuLabels, type FilterMenuProps, type FilterOption, type ListFilter } from './components/FilterMenu.js';
|
|
17
|
+
export { ListHead, type ListHeadProps } from './components/ListHead.js';
|
|
18
|
+
export { PaneToolbar, type PaneToolbarAction, type PaneToolbarEntry, type PaneToolbarProps } from './components/PaneToolbar.js';
|
|
19
|
+
export { Splitter, type SplitterProps } from './components/Splitter.js';
|
|
20
|
+
export { Notification, type NotificationAction, type NotificationProps } from './components/Notification.js';
|
|
21
|
+
export { offerFor, isCapability, type Capability, type Offer, type OfferOptions } from './server/capability.js';
|
|
22
|
+
export { readRefusal, refusalText, type Refusal } from './server/refusal.js';
|
|
23
|
+
export { useReread, rereadAll, type Reread } from './server/reread.js';
|
|
24
|
+
export { readConflict, type Conflict } from './server/conflict.js';
|
|
25
|
+
export { needsClientUpdate, versionBelow, CLIENT_UPDATE_REQUIRED } from './server/client-update.js';
|
|
26
|
+
export { ScreenShell, type ScreenShellProps, type ScreenPrimary } from './components/ScreenShell.js';
|
|
27
|
+
export { PULL_AT, usePull, usePullState, type PullState } from './components/pull.js';
|