@coolms/ui-react 0.1.0-alpha.18 → 0.1.0-alpha.19

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,17 @@
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.19 (2026-11-20)
6
+
7
+ The screen shell at phone width, on design tokens 0.10.0 (contract 0.5.0).
8
+
9
+ - `ScreenShell` (contract `screen-shell`): one screen of a section at phone width. One bar: the section's navigation at its root, or Back named by the parent on a nested screen; the title; the section's search, then the shell's own icons (the bell, the avatar). Optional filter chips under it, exactly one selected. The content scrolls on its own and refreshes by a pull from its top (`onRefresh`, 64px); the primary action floats at the bottom right as one button or a menu of declared entries, and the content ends with room for it. While the section's search is open (`searching`), the bar is Close and the host's search field.
10
+ - `usePull`, `PULL_AT`, `usePullState`: the pull, shared; a `List` inside a shell draws it (state `pulled`) with the sync time, then the refreshing state.
11
+ - `List`: one row anatomy, flat on one surface with light separators, no border or card; a row may be `unread` (the title semibold) and carry a `count` under its meta.
12
+ - `Avatar`: `connection` (on one's own avatar, the live connection as its dot, said in words as its name and tooltip), `deleted` (a neutral person icon, never initials), and presence `busy`, drawn as away.
13
+ - Icons: `user`, a person.
14
+ - Tokens: the copy is design-tokens v0.10.0 (a075e93); only the components contract changed (the screen shell, its search part, the list's row and the avatar's states).
15
+
5
16
  ## 0.1.0-alpha.18 (2026-11-20)
6
17
 
7
18
  A sender's own initials when a service sent on their behalf.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "repository": "coolms/design-tokens",
3
- "tag": "v0.8.0",
4
- "commit": "f43a36bfa604ce965824bf57ea23394c322ea7f7",
3
+ "tag": "v0.10.0",
4
+ "commit": "a075e930422602ab8ccd47db721b393c80ad44ce",
5
5
  "files": {
6
6
  "dist/coolms-tokens.css": {
7
7
  "to": "src/tokens/coolms-tokens.css",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "contract/components.json": {
11
11
  "to": "contract/components.json",
12
- "sha256": "e9675caaa511e6581922d6bd2d7bf38975903f3269d563eb6c5be7effb28b293"
12
+ "sha256": "204aef4b2a18945f1a3d6e463fa18464b042943a132199b7b347c00352fb71f0"
13
13
  },
14
14
  "contract/server-states.json": {
15
15
  "to": "contract/server-states.json",
@@ -8,6 +8,10 @@ export interface ListRow {
8
8
  readonly lead?: ReactNode;
9
9
  /** Trailing text: a date, a size. */
10
10
  readonly meta?: ReactNode;
11
+ /** Not read yet: the title in semibold. */
12
+ readonly unread?: boolean;
13
+ /** A count under the meta (unread messages in a conversation). */
14
+ readonly count?: number;
11
15
  }
12
16
  export interface ListProps {
13
17
  /** What the rows are, for a screen reader ("Messages"). */
@@ -31,7 +35,9 @@ export interface ListProps {
31
35
  }
32
36
  /**
33
37
  * 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.
38
+ * empty, populated, selected, error, pulled). Up and Down move between rows; Enter opens one. Every row has one anatomy:
39
+ * a leading icon or avatar, a title (semibold while unread), a secondary line, the meta with a count under it; rows sit
40
+ * on one surface, never cards. Inside a screen that takes a pull, the list draws it at its top (pulled).
35
41
  */
36
42
  export declare function List({ label, rows, error, onRetry, loadingText, emptyTitle, emptyHint, selected, onOpen, onRowMenu }: ListProps): ReactNode;
37
43
  export interface MenuItem {
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  /** The icons the Workspace draws: one stroke style, 24 units, coloured by the text around them. */
3
- export type IconName = 'mail' | 'chat' | 'phone' | 'calendar' | 'file' | 'image' | 'search' | 'bell' | 'pencil' | 'star' | 'send' | 'inbox' | 'archive' | 'trash' | 'paperclip' | 'mic' | 'speaker' | 'user-plus' | 'phone-off' | 'video' | 'info' | 'chevron-down' | 'chevron-left' | 'plus' | 'folder' | 'check' | 'server' | 'reply' | 'more' | 'download' | 'print' | 'open-separately' | 'important' | 'forward' | 'refresh' | 'file-code' | 'mail-open' | 'copy';
3
+ export type IconName = 'mail' | 'chat' | 'phone' | 'calendar' | 'file' | 'image' | 'search' | 'bell' | 'pencil' | 'star' | 'send' | 'inbox' | 'archive' | 'trash' | 'paperclip' | 'mic' | 'speaker' | 'user-plus' | 'phone-off' | 'video' | 'info' | 'chevron-down' | 'chevron-left' | 'plus' | 'folder' | 'check' | 'server' | 'reply' | 'more' | 'download' | 'print' | 'open-separately' | 'important' | 'forward' | 'refresh' | 'file-code' | 'mail-open' | 'copy' | 'user';
4
4
  export interface IconProps {
5
5
  readonly name: IconName;
6
6
  readonly size?: number;
@@ -0,0 +1,65 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type MenuItem } from './Collections';
3
+ import { type IconName } from './Icon';
4
+ import { type FilterOption } from './Workspace';
5
+ /** The screen's floating primary action: one action, or a menu of declared entries. */
6
+ export type ScreenPrimary = {
7
+ readonly label: string;
8
+ readonly icon: IconName;
9
+ readonly onPress: () => void;
10
+ } | {
11
+ readonly label: string;
12
+ readonly icon: IconName;
13
+ readonly menu: readonly MenuItem[];
14
+ };
15
+ export interface ScreenShellProps {
16
+ /** The current place's name. */
17
+ readonly title: string;
18
+ /** On a nested screen: where Back leads, named by the parent's name. Absent at a section's root. */
19
+ readonly back?: {
20
+ readonly label: string;
21
+ readonly href?: string;
22
+ readonly onBack?: () => void;
23
+ };
24
+ /** At a section's root: the section's own navigation (mail's folders), an icon button the host supplies. */
25
+ readonly navigation?: ReactNode;
26
+ /** The section's search, an icon button. */
27
+ readonly search?: {
28
+ readonly label: string;
29
+ readonly onOpen: () => void;
30
+ };
31
+ /**
32
+ * While the section's search is open: the bar is Close, then the host's search field in place of the title and the
33
+ * icons, until Close (or the host) ends it.
34
+ */
35
+ readonly searching?: {
36
+ readonly field: ReactNode;
37
+ readonly closeLabel: string;
38
+ readonly onClose: () => void;
39
+ };
40
+ /** The shell's own icons, the same in every section: the bell, then the person's avatar. */
41
+ readonly globals?: ReactNode;
42
+ /** The place's filters, as chips under the bar, exactly one selected. */
43
+ readonly filters?: {
44
+ readonly label: string;
45
+ readonly options: readonly FilterOption[];
46
+ readonly selected: string;
47
+ readonly onSelect: (id: string) => void;
48
+ };
49
+ /** The floating primary action, given only when the server declares it; never on an item's own screen. */
50
+ readonly primary?: ScreenPrimary;
51
+ /** With it the content takes the pull: the refresh, and while it runs the refreshing state. */
52
+ readonly onRefresh?: () => Promise<unknown>;
53
+ /** What the pull says while pulled: the time of the last sync. */
54
+ readonly pullText?: ReactNode;
55
+ /** The screen's content: it scrolls on its own; a list in it draws the pull. */
56
+ readonly children: ReactNode;
57
+ }
58
+ /**
59
+ * One screen of a section at phone width (contract component `screen-shell`: root, nested, with-filters,
60
+ * with-primary-action, with-primary-menu, pulling, refreshing, searching). One bar: the section's navigation or Back
61
+ * with the parent's name, the title, then search and the shell's own icons, or while searching, Close and the field; the filters under it; the content, which
62
+ * scrolls on its own and refreshes by a pull from its top; the primary action floating at the bottom right, its menu
63
+ * opening above it. What fills each slot is the host's, from the server's declared nodes.
64
+ */
65
+ export declare function ScreenShell({ title, back, navigation, search, searching, globals, filters, primary, onRefresh, pullText, children }: ScreenShellProps): ReactNode;
@@ -36,10 +36,25 @@ 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
- /** Whether they are reachable now, as the server said. */
40
- readonly presence?: 'online' | 'away' | 'offline';
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;
41
54
  readonly size?: number;
42
55
  }
56
+ export type AvatarPresence = 'online' | 'away' | 'busy' | 'offline';
57
+ export type AvatarConnection = 'connected' | 'reconnecting' | 'offline';
43
58
  /**
44
59
  * Up to two initials from a name: "Ada Lovelace" -> "AL", "ada" -> "A". A sender named for the service that sent on
45
60
  * their behalf keeps their own: "Valentina Zagnetova via LinkedIn" -> "VZ".
@@ -48,4 +63,4 @@ export declare function initialsOf(name: string): string;
48
63
  /** Which of the six avatar tints a name takes: the same name always the same tint. */
49
64
  export declare function tintOf(name: string): number;
50
65
  /** A person or an account, by picture or initials (contract component `avatar`: picture, initials, presence). */
51
- export declare function Avatar({ name, pictureUrl, presence, size }: AvatarProps): ReactNode;
66
+ export declare function Avatar({ name, pictureUrl, presence, connection, deleted, size }: AvatarProps): 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, or goes up,
7
+ * is the region's own scroll. 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;
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export { Toast, ToastRegion, Loading, EmptyState, ErrorBanner, type ToastProps,
5
5
  export { State, STATE_DELAY_MS, type StateKind, type StatePlacement, type StateProps } from './components/State';
6
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
- export { PageHeader, TabStrip, Avatar, initialsOf, tintOf, type PageHeaderProps, type Tab, type TabStripProps, type AvatarProps } from './components/Structure';
8
+ export { PageHeader, TabStrip, Avatar, initialsOf, tintOf, type PageHeaderProps, type Tab, type TabStripProps, type AvatarProps, type AvatarPresence, type AvatarConnection } from './components/Structure';
9
9
  export { Icon, ICON_NAMES, BOOTSTRAP_ICONS, iconForName, type IconName, type IconProps } from './components/Icon';
10
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';
@@ -18,3 +18,5 @@ export { readRefusal, refusalText, type Refusal } from './server/refusal';
18
18
  export { useReread, rereadAll, type Reread } from './server/reread';
19
19
  export { readConflict, type Conflict } from './server/conflict';
20
20
  export { needsClientUpdate, versionBelow, CLIENT_UPDATE_REQUIRED } from './server/client-update';
21
+ export { ScreenShell, type ScreenShellProps, type ScreenPrimary } from './components/ScreenShell';
22
+ export { PULL_AT, usePull, usePullState, type PullState } from './components/pull';