@coolms/ui-react 0.1.0-alpha.14 → 0.1.0-alpha.16
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 +19 -0
- package/design-tokens.lock.json +5 -5
- package/dist/components/Collections.d.ts +4 -3
- package/dist/components/FileViewer.d.ts +40 -0
- package/dist/components/Notification.d.ts +38 -0
- package/dist/components/Workspace.d.ts +33 -3
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1086 -897
- package/kit.contract.json +5 -1
- package/package.json +1 -1
- package/src/kit.css +44 -6
- package/src/tokens/coolms-tokens.css +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@coolms/ui-react` are listed here. Versions follow [semantic versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## 0.1.0-alpha.16 (2026-11-19)
|
|
6
|
+
|
|
7
|
+
The design tokens 0.8.0 with their control heights, and the kit covering every entry of their contract 0.3.0.
|
|
8
|
+
|
|
9
|
+
- Tokens: the copy is design-tokens v0.8.0, with `--cms-control-height-sm` (32px), `-md` (40px; 44px on a coarse pointer) and `-lg` (44px). `tools/check-css.mjs` is its copy that keeps the coarse-pointer block.
|
|
10
|
+
- Control heights: a button, a text field and a select are `--cms-control-height-md`: 40px with a mouse, 44px on a touch screen, as the token says. A button's height is no longer set again by the window's width.
|
|
11
|
+
- `Notification`: one notification in a list (contract `notification`: unread, read, collapsed, expanded, with-action, row-action). Pressing the row reads it and follows only a row action the host can follow; a button action goes only from its button, after the text; the chevron opens the body and reads it.
|
|
12
|
+
- `FileViewer`: `state` draws loading, an error (Retry only when the caller gives it) or no preview (Download as its action) inside the content, the top bar staying; `editing.conflict` asks, above the editor, whether to overwrite the other version or keep both, and saves nothing on its own.
|
|
13
|
+
- `ContextMenu`: a refused or disabled item is described by its reason (`aria-describedby`), as the pane toolbar's disabled action is (contract `item-disabled`); an item's icon and words share one line.
|
|
14
|
+
- The kit declares `file-viewer`, `file-picker`, `pane-toolbar` and `notification` against the contract, state by state.
|
|
15
|
+
- `tools/check-layout.mjs`: below the desktop width the browser is a touch screen's (a coarse pointer, no hover), so a control's touch height is the one measured; the demo has a notifications screen.
|
|
16
|
+
|
|
17
|
+
## 0.1.0-alpha.15 (2026-11-18)
|
|
18
|
+
|
|
19
|
+
Resizable panes.
|
|
20
|
+
|
|
21
|
+
- `SplitPanes`: `sizes` gives the panes before the last a width, limits, a width to put back and a splitter's name; where every pane shows, a splitter is drawn after each. A splitter is a vertical separator with its width and limits, dragged by mouse, touch or pen, moved 16 px by the arrow keys, taken to its limits by Home and End, and put back by a double-click or Enter. `onResize` reports a move while it is dragged and once more when the drag or the key ends. The last pane is never narrower than `lastMin` (360 by default); as the window narrows the pane nearest it gives way first. Where fewer panes show, there is no splitter.
|
|
22
|
+
- `fitPanes(sizes, room, lastMin)`: the widths the panes take in a given room, as `SplitPanes` lays them out.
|
|
23
|
+
|
|
5
24
|
## 0.1.0-alpha.14 (2026-11-18)
|
|
6
25
|
|
|
7
26
|
Number, date and time fields, and a field of several lines, for forms the server declares.
|
package/design-tokens.lock.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"repository": "coolms/design-tokens",
|
|
3
|
-
"tag": "v0.
|
|
4
|
-
"commit": "
|
|
3
|
+
"tag": "v0.8.0",
|
|
4
|
+
"commit": "f43a36bfa604ce965824bf57ea23394c322ea7f7",
|
|
5
5
|
"files": {
|
|
6
6
|
"dist/coolms-tokens.css": {
|
|
7
7
|
"to": "src/tokens/coolms-tokens.css",
|
|
8
|
-
"sha256": "
|
|
8
|
+
"sha256": "aadfb15497060c9c1ddd2ffb89039ff569bd6b3618734cccde0a17c51a217fac"
|
|
9
9
|
},
|
|
10
10
|
"contract/components.json": {
|
|
11
11
|
"to": "contract/components.json",
|
|
12
|
-
"sha256": "
|
|
12
|
+
"sha256": "e9675caaa511e6581922d6bd2d7bf38975903f3269d563eb6c5be7effb28b293"
|
|
13
13
|
},
|
|
14
14
|
"contract/server-states.json": {
|
|
15
15
|
"to": "contract/server-states.json",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"tools/check-css.mjs": {
|
|
23
23
|
"to": "tools/check-css.mjs",
|
|
24
|
-
"sha256": "
|
|
24
|
+
"sha256": "aad1b7d00c46577346b4fc38ddfe0047633a61f4eebe39959918811eb134fd12"
|
|
25
25
|
},
|
|
26
26
|
"fonts/inter.css": {
|
|
27
27
|
"to": "src/fonts/inter.css",
|
|
@@ -57,8 +57,9 @@ export interface ContextMenuProps {
|
|
|
57
57
|
readonly focus?: 'first' | 'last';
|
|
58
58
|
}
|
|
59
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
|
|
62
|
-
*
|
|
60
|
+
* The selected object's actions (contract component `context-menu`: open, item-danger, item-locked, item-refused,
|
|
61
|
+
* item-disabled). An item the server withheld is not drawn; a locked one carries its lock; a refused or disabled one
|
|
62
|
+
* stays in the menu, reached by the arrow keys, aria-disabled, with the server's reason under its label and as its
|
|
63
|
+
* description; choosing it does nothing and the menu stays open. Escape, a press outside, or a choice closes it, and focus goes back where it was.
|
|
63
64
|
*/
|
|
64
65
|
export declare function ContextMenu({ at, items, onClose, label, focus }: ContextMenuProps): ReactNode;
|
|
@@ -18,6 +18,17 @@ export interface FileViewerSiblings {
|
|
|
18
18
|
readonly onPrevious?: () => void;
|
|
19
19
|
readonly onNext?: () => void;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* The file changed elsewhere while it was being edited: the viewer says so above the editor and asks whether to
|
|
23
|
+
* overwrite the other version or keep both, never saving over it silently. The words and both answers are the caller's.
|
|
24
|
+
*/
|
|
25
|
+
export interface FileViewerConflict {
|
|
26
|
+
readonly message: string;
|
|
27
|
+
readonly overwriteLabel: string;
|
|
28
|
+
readonly onOverwrite: () => void;
|
|
29
|
+
readonly keepBothLabel: string;
|
|
30
|
+
readonly onKeepBoth: () => void;
|
|
31
|
+
}
|
|
21
32
|
/** The editing state: the content hosts the type's own editor, and the viewer has none of its own. */
|
|
22
33
|
export interface FileViewerEditing {
|
|
23
34
|
readonly status: ReactNode;
|
|
@@ -26,7 +37,34 @@ export interface FileViewerEditing {
|
|
|
26
37
|
/** It holds unsaved work: Close calls onDirtyClose, which asks the person, rather than closing. */
|
|
27
38
|
readonly dirty?: boolean;
|
|
28
39
|
readonly onDirtyClose: () => void;
|
|
40
|
+
/** The file changed elsewhere meanwhile: the question above the editor until the caller has its answer. */
|
|
41
|
+
readonly conflict?: FileViewerConflict;
|
|
29
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* What the content shows instead of the file, as the state component in page placement, the top bar staying (Close and
|
|
45
|
+
* Download remain): loading while the file is read; error in the caller's words, with Retry when trying again can
|
|
46
|
+
* help (none when the server says the file is gone or refused); no-preview, with Download as its action.
|
|
47
|
+
*/
|
|
48
|
+
export type FileViewerState = {
|
|
49
|
+
readonly kind: 'loading';
|
|
50
|
+
readonly title: string;
|
|
51
|
+
} | {
|
|
52
|
+
readonly kind: 'error';
|
|
53
|
+
readonly title: string;
|
|
54
|
+
readonly description?: string;
|
|
55
|
+
readonly retry?: {
|
|
56
|
+
readonly label: string;
|
|
57
|
+
readonly onRetry: () => void;
|
|
58
|
+
};
|
|
59
|
+
} | {
|
|
60
|
+
readonly kind: 'no-preview';
|
|
61
|
+
readonly title: string;
|
|
62
|
+
readonly description?: string;
|
|
63
|
+
readonly download: {
|
|
64
|
+
readonly label: string;
|
|
65
|
+
readonly onDownload: () => void;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
30
68
|
export interface FileViewerProps {
|
|
31
69
|
/** The file's name: the dialog's name, truncated where it does not fit, with the whole of it available. */
|
|
32
70
|
readonly name: string;
|
|
@@ -45,6 +83,8 @@ export interface FileViewerProps {
|
|
|
45
83
|
readonly onEdit: () => void;
|
|
46
84
|
};
|
|
47
85
|
readonly editing?: FileViewerEditing;
|
|
86
|
+
/** Instead of the file: loading, an error, or no preview. Without it the content is the adapter's. */
|
|
87
|
+
readonly state?: FileViewerState;
|
|
48
88
|
readonly siblings?: FileViewerSiblings;
|
|
49
89
|
/** What the viewer bar holds, from the adapter: page, zoom, fit. It never holds a file action. */
|
|
50
90
|
readonly bar?: ReactNode;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A notification's action, as the server declares it, already resolved by the host: `row`, the whole row takes the
|
|
4
|
+
* person there; `button`, a button after the text does. `onAction` is absent when the host does not know where it leads:
|
|
5
|
+
* then nothing is drawn for it and pressing the row only reads the notification.
|
|
6
|
+
*/
|
|
7
|
+
export interface NotificationAction {
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly presentation: 'row' | 'button';
|
|
10
|
+
readonly onAction?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export interface NotificationProps {
|
|
13
|
+
/** The server's title, plain text. */
|
|
14
|
+
readonly title: string;
|
|
15
|
+
/** The server's body, plain text; collapsed to one line until expanded. */
|
|
16
|
+
readonly body?: string | null;
|
|
17
|
+
/** When, as the host words it. */
|
|
18
|
+
readonly time?: string | null;
|
|
19
|
+
readonly unread: boolean;
|
|
20
|
+
/** What the visually hidden word for an unread notification is, in the host's language. */
|
|
21
|
+
readonly unreadLabel: string;
|
|
22
|
+
/** The chevron's name while collapsed and while expanded, in the host's language. */
|
|
23
|
+
readonly expandLabel: string;
|
|
24
|
+
readonly collapseLabel: string;
|
|
25
|
+
readonly action?: NotificationAction | null;
|
|
26
|
+
/** The notification is read: the row pressed, its body expanded, or its button pressed. Called once while unread. */
|
|
27
|
+
readonly onRead: () => void;
|
|
28
|
+
/** A leading visual: an icon or an avatar. */
|
|
29
|
+
readonly leading?: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One notification in the person's notification list (contract component `notification`: unread, read, collapsed,
|
|
33
|
+
* expanded, with-action, row-action). Pressing the row (a click, a tap or Enter) reads it, and takes the person
|
|
34
|
+
* somewhere only when its action is a row action the host can follow; a button action goes only from its button, a real
|
|
35
|
+
* button after the text, which reads it too. Expanding the body with the chevron reads it as well. The server's title
|
|
36
|
+
* and body are drawn as given, as text.
|
|
37
|
+
*/
|
|
38
|
+
export declare function Notification({ title, body, time, unread, unreadLabel, expandLabel, collapseLabel, action, onRead, leading }: NotificationProps): ReactNode;
|
|
@@ -70,6 +70,16 @@ export interface Pane {
|
|
|
70
70
|
readonly label: string;
|
|
71
71
|
readonly content: ReactNode;
|
|
72
72
|
}
|
|
73
|
+
/** A pane the person may make wider or narrower, in px: where it is, its limits, its default, and its splitter's name. */
|
|
74
|
+
export interface PaneSize {
|
|
75
|
+
readonly width: number;
|
|
76
|
+
readonly min: number;
|
|
77
|
+
readonly max: number;
|
|
78
|
+
/** The width a double-click or Enter on its splitter puts it back to. */
|
|
79
|
+
readonly reset: number;
|
|
80
|
+
/** The splitter's name, in the app's language ("Resize folders"). */
|
|
81
|
+
readonly label: string;
|
|
82
|
+
}
|
|
73
83
|
export interface SplitPanesProps {
|
|
74
84
|
/** Two panes (a list and what is open) or three (navigation, a list, what is open). */
|
|
75
85
|
readonly panes: readonly [Pane, Pane] | readonly [Pane, Pane, Pane];
|
|
@@ -86,12 +96,32 @@ export interface SplitPanesProps {
|
|
|
86
96
|
readonly label: string;
|
|
87
97
|
readonly href: string;
|
|
88
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* Sizes for the panes before the last, by index: each one given draws a splitter after its pane where every pane
|
|
101
|
+
* shows (the desktop grid). The caller keeps the widths; the last pane takes the rest.
|
|
102
|
+
*/
|
|
103
|
+
readonly sizes?: readonly (PaneSize | undefined)[];
|
|
104
|
+
/** The last pane's least width while splitters move and the window narrows (360 by default). */
|
|
105
|
+
readonly lastMin?: number;
|
|
106
|
+
/**
|
|
107
|
+
* A splitter moved pane `index` to `width`: while it is dragged (`done` false), and once more when the drag or the
|
|
108
|
+
* key ends (`done` true), which is when a width is worth keeping.
|
|
109
|
+
*/
|
|
110
|
+
readonly onResize?: (index: number, width: number, done: boolean) => void;
|
|
89
111
|
}
|
|
90
112
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
113
|
+
* The widths the panes take in `room` px: each as wanted within its limits; when the last pane would be under its
|
|
114
|
+
* least width, the pane nearest it gives way first, down to its own least, then the one before.
|
|
115
|
+
*/
|
|
116
|
+
export declare function fitPanes(wanted: readonly PaneSize[], room: number, lastMin: number): number[];
|
|
117
|
+
/**
|
|
118
|
+
* Two or three panes side by side (contract `split-panes`), showing fewer as the window narrows. With `sizes`, the
|
|
119
|
+
* panes before the last are resizable where all of them show (contract `pane splitter`): each has a splitter, a
|
|
120
|
+
* separator dragged by mouse or touch, moved 16 px by the arrow keys, taken to its limits by Home and End, and put back
|
|
121
|
+
* by a double-click or Enter. The last pane is never narrower than `lastMin`; as the window narrows the pane nearest it
|
|
122
|
+
* gives way first.
|
|
93
123
|
*/
|
|
94
|
-
export declare function SplitPanes({ panes, active, back }: SplitPanesProps): ReactNode;
|
|
124
|
+
export declare function SplitPanes({ panes, active, back, sizes, lastMin, onResize }: SplitPanesProps): ReactNode;
|
|
95
125
|
export interface MailRowProps {
|
|
96
126
|
readonly from: string;
|
|
97
127
|
readonly subject: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,15 +3,16 @@ export { TextField, TextArea, Select, Toggle, writtenOut, type TextFieldProps, t
|
|
|
3
3
|
export { Modal, ConfirmDialog, MODAL_CLOSE_MS, type ModalProps, type ConfirmDialogProps } from './components/Dialogs';
|
|
4
4
|
export { Toast, ToastRegion, Loading, EmptyState, ErrorBanner, type ToastProps, type LoadingProps, type EmptyStateProps, type ErrorBannerProps } from './components/Status';
|
|
5
5
|
export { State, STATE_DELAY_MS, type StateKind, type StatePlacement, type StateProps } from './components/State';
|
|
6
|
-
export { FileViewer, type FileViewerAction, type FileViewerEditing, type FileViewerProps, type FileViewerSiblings } from './components/FileViewer';
|
|
6
|
+
export { FileViewer, type FileViewerAction, type FileViewerConflict, type FileViewerEditing, type FileViewerProps, type FileViewerSiblings, type FileViewerState } from './components/FileViewer';
|
|
7
7
|
export { FilePicker, FilePickerDenied, type FilePickerBudget, type FilePickerChoice, type FilePickerEntry, type FilePickerLabels, type FilePickerPage, type FilePickerProps, type FilePickerSpace } from './components/FilePicker';
|
|
8
8
|
export { PageHeader, TabStrip, Avatar, initialsOf, tintOf, type PageHeaderProps, type Tab, type TabStripProps, type AvatarProps } from './components/Structure';
|
|
9
9
|
export { Icon, ICON_NAMES, BOOTSTRAP_ICONS, iconForName, type IconName, type IconProps } from './components/Icon';
|
|
10
|
-
export { AppShell, Badge, SearchField, FilterChips, SplitPanes, MailRow, ChatBubble, Composer, MAIL_ROW_LABELS, type MailRowLabels, type AppShellProps, type RailItem, type BadgeProps, type SearchFieldProps, type FilterChipsProps, type FilterOption, type SplitPanesProps, type Pane, type MailRowProps, type ChatBubbleProps, type ComposerProps } from './components/Workspace';
|
|
10
|
+
export { AppShell, Badge, SearchField, FilterChips, SplitPanes, fitPanes, MailRow, ChatBubble, Composer, MAIL_ROW_LABELS, type MailRowLabels, type AppShellProps, type RailItem, type BadgeProps, type SearchFieldProps, type FilterChipsProps, type FilterOption, type SplitPanesProps, type PaneSize, type Pane, type MailRowProps, type ChatBubbleProps, type ComposerProps } from './components/Workspace';
|
|
11
11
|
export { IncomingCall, CallPanel, CallBar, CALL_LABELS, type CallLabels, type IncomingCallProps, type CallPanelProps, type CallBarProps } from './components/Call';
|
|
12
12
|
export { SignInLayout, SignInForm, SIGN_IN_LABELS, type SignInLabels, type SignInLayoutProps, type SignInFormProps, type SignInFeature } from './components/SignIn';
|
|
13
13
|
export { List, ContextMenu, type ListRow, type ListProps, type MenuItem, type ContextMenuProps } from './components/Collections';
|
|
14
14
|
export { PaneToolbar, type PaneToolbarAction, type PaneToolbarProps } from './components/PaneToolbar';
|
|
15
|
+
export { Notification, type NotificationAction, type NotificationProps } from './components/Notification';
|
|
15
16
|
export { offerFor, isCapability, type Capability, type Offer, type OfferOptions } from './server/capability';
|
|
16
17
|
export { readRefusal, refusalText, type Refusal } from './server/refusal';
|
|
17
18
|
export { useReread, rereadAll, type Reread } from './server/reread';
|