@coolms/ui-react 0.1.0-alpha.15 → 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 CHANGED
@@ -2,6 +2,18 @@
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
+
5
17
  ## 0.1.0-alpha.15 (2026-11-18)
6
18
 
7
19
  Resizable panes.
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "repository": "coolms/design-tokens",
3
- "tag": "v0.7.1",
4
- "commit": "0167cfcaf665e4f785910e7c309ef18fedf61c52",
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": "e0b01973324f21b32dc89907d379f3380c47f740e152e471ea4287efee652cc0"
8
+ "sha256": "aadfb15497060c9c1ddd2ffb89039ff569bd6b3618734cccde0a17c51a217fac"
9
9
  },
10
10
  "contract/components.json": {
11
11
  "to": "contract/components.json",
12
- "sha256": "61c8d3610cdf9a7685576d8ab891f3be8d3b55bc73716172da15e2ca8b889bd0"
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": "231ca006b6e949f9882c98186527e2a974efb5acd60bfb8d05a37d82eae6a678"
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 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.
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;
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ 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';
@@ -12,6 +12,7 @@ export { IncomingCall, CallPanel, CallBar, CALL_LABELS, type CallLabels, type In
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';