@coolms/ui-react 0.1.0-alpha.32 → 0.1.0-alpha.33

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,19 @@
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.33 (2026-11-25)
6
+
7
+ A list's filter is one menu button, the second row's label one step under the section's title, and design tokens v0.32.0.
8
+
9
+ **Breaking.** `FilterChips` and `ScreenShell`'s `filters` are gone, with `FilterChipsProps`: a list's filter is one menu button now. Draw `ListHead` (or `FilterMenu`) where `FilterChips` was, and give `ScreenShell` `filter` in place of `filters` (`value` for `selected`, `onChange` for `onSelect`, and `defaultValue`, the choice that shows every row).
10
+
11
+ - `FilterMenu` is new: the components contract's `filter-menu`. On the default choice an icon only, the funnel; on any other choice that choice's name and a chevron in the accent, so a filtered list never looks like one with rows missing. Its menu is a single choice with a mark on the current one: Enter, Space and Down open it at the current choice, Up at the last; a second press closes it; choosing the current one changes nothing. `iconOnly` keeps the funnel, in the accent, for a bar whose title says the choice. With fewer than two choices nothing is drawn, and a value that names no choice reads as the default one and says so once, by `onChange`; while there are no choices at all they are not known yet, and nothing is said. The accessible name is the label and the choice ("Show: All"); `labels.name` gives the pattern in another language.
12
+ - `ListHead` is new: a list's second row, the header row's height. What leads (a select-all box), the list's name (title-sm, semibold: one step under the section title) on one line, cut with an ellipsis, its whole text as its title, then the filter at the end, which keeps its place and its width (a choice's name is cut only past 176px).
13
+ - `ScreenShell` has `filter`: an icon in the bar, after the search and before More, and no row of its own. On a choice other than the default the icon takes the accent and the title reads the place's name and the choice's ("Inbox · Unread"): the name is cut first, and with under 24px of it left it and its dot are not drawn, so the title is the choice alone; then the choice is cut; Back's name still gives way before both. No icon drops. Where the bar with the filter in it leaves the title less than its least (64px of the place's name, or all of a shorter one, and the choice's name whole while filtered) and More is drawn for other actions, the filter moves into More: a single choice under its label, after the other actions; More then takes the accent, and says the choice in its name, while the filter is not the default one. One width of the bar always has one answer, and the filter comes back when the width allows it. A choice that moves it gives the focus to where it then is. The bar does not step out of view while the filter's menu is open.
14
+ - `ContextMenu` items may be `checked` (true or false): each is then a `menuitemradio` with `aria-checked`, the current one with a check mark, and the menu opens with it focused. `focus` may be `current`, the default: the current choice, or the first item where there is none, as before. Items may carry a `group`: those of one group are drawn under its name, after a line (`role="group"`).
15
+ - The `funnel` icon draws as the kit's new `funnel` glyph.
16
+ - The design-tokens copy is v0.32.0: the components contract 0.22.0, with `filter-menu` in place of `filter-chips`, the screen shell's filter, the second row's label one step under the section's title, and a filtered title that never starts with its dot.
17
+
5
18
  ## 0.1.0-alpha.32 (2026-11-25)
6
19
 
7
20
  The phone screen shell's More, Back's name giving way before the title, and design tokens v0.31.0.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "repository": "coolms/design-tokens",
3
- "tag": "v0.31.0",
4
- "commit": "c0b6b2345ed93e1d63f233f09df96e22002dd790",
3
+ "tag": "v0.32.0",
4
+ "commit": "b4cbe1b2806fc33e3dd130d0abee389f6af0d95f",
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": "fe34761d5e16de3dd9c32cb5d15da5a2e04144c2da4a5df2893ccb6611b10b11"
12
+ "sha256": "855bbffcbcf347406f87c0d19746c16a0f4b0011c4ebab8dda7a7651ec184641"
13
13
  },
14
14
  "contract/server-states.json": {
15
15
  "to": "contract/server-states.json",
@@ -47,6 +47,10 @@ export interface MenuItem {
47
47
  readonly offer: Offer;
48
48
  /** Destroys or cannot be undone. */
49
49
  readonly danger?: boolean;
50
+ /** Given, the item is one choice of a single choice: the current one (marked) or not. Not given, a plain item. */
51
+ readonly checked?: boolean;
52
+ /** The group it is in: the items of one group, beside each other, are drawn under its name, apart from the rest. */
53
+ readonly group?: string;
50
54
  readonly onSelect: () => void;
51
55
  }
52
56
  export interface ContextMenuProps {
@@ -59,13 +63,18 @@ export interface ContextMenuProps {
59
63
  readonly items: readonly MenuItem[];
60
64
  readonly onClose: () => void;
61
65
  readonly label?: string;
62
- /** The item focused as it opens: the first, or the last (a menu button opened with Up). */
63
- readonly focus?: 'first' | 'last';
66
+ /**
67
+ * The item focused as it opens: the current choice (the first item without one), the first, or the last (a menu
68
+ * button opened with Up).
69
+ */
70
+ readonly focus?: 'current' | 'first' | 'last';
64
71
  }
65
72
  /**
66
73
  * The selected object's actions (contract component `context-menu`: open, item-danger, item-locked, item-refused,
67
74
  * item-disabled). An item the server withheld is not drawn; a locked one carries its lock; a refused or disabled one
68
75
  * stays in the menu, reached by the arrow keys, aria-disabled, with the server's reason under its label and as its
69
76
  * 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.
77
+ * Items with `checked` are a single choice: each a menuitemradio, the current one with a check mark.
78
+ * Items of one `group` are a group named by it, under its name and a line.
70
79
  */
71
80
  export declare function ContextMenu({ at, items, onClose, label, focus }: ContextMenuProps): ReactNode;
@@ -0,0 +1,51 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type MenuItem } from './Collections.js';
3
+ export interface FilterOption {
4
+ readonly id: string;
5
+ readonly label: string;
6
+ }
7
+ export interface FilterMenuLabels {
8
+ /** The button's accessible name and tooltip: what it filters and the current choice. */
9
+ readonly name: (label: string, choice: string) => string;
10
+ }
11
+ /** The English words; an app passes its own. */
12
+ export declare const FILTER_MENU_LABELS: FilterMenuLabels;
13
+ /** A list's one filter: its choices and the current one. */
14
+ export interface ListFilter {
15
+ /** What it filters, in the accessible name before the current choice ("Show"). */
16
+ readonly label: string;
17
+ /** The choices shown, in the declared order; the host keeps the current one in them while it is current. */
18
+ readonly options: readonly FilterOption[];
19
+ /**
20
+ * The current choice's id. One that names no option reads as the default one, and says so once, by `onChange`; while
21
+ * there are no options at all the choices are not known yet, and nothing is said.
22
+ */
23
+ readonly value: string;
24
+ /** The id of the choice that shows every row; not given, or naming no option, the first. */
25
+ readonly defaultValue?: string;
26
+ /** The chosen choice's id, when it differs from the current one. */
27
+ readonly onChange: (id: string) => void;
28
+ readonly labels?: Partial<FilterMenuLabels>;
29
+ }
30
+ export interface FilterMenuProps extends ListFilter {
31
+ /** The funnel alone, in the accent on a choice other than the default: for a bar whose title says the choice. */
32
+ readonly iconOnly?: boolean;
33
+ }
34
+ /** The choice other than the default one, or null: on the default choice, or with no other to choose from. */
35
+ export declare function activeChoice(filter: ListFilter): FilterOption | null;
36
+ /** What the filter filters and its current choice, in the host's words. */
37
+ export declare function filterName(filter: ListFilter): string;
38
+ /** The choices as a menu's items, a single choice; `group` draws them under its name, among other items. */
39
+ export declare function choiceItems(filter: ListFilter, group?: string): readonly MenuItem[];
40
+ /** Says the default choice to the host, once for each value that names no option; with no options, nothing yet. */
41
+ export declare function useStaleChoice(filter: ListFilter | undefined): void;
42
+ /** The menu button with its menu; nothing with fewer than two choices. Who draws it calls useStaleChoice. */
43
+ export declare function FilterButton({ iconOnly, onOpenChange, ...filter }: FilterMenuProps & {
44
+ readonly onOpenChange?: (open: boolean) => void;
45
+ }): ReactNode;
46
+ /**
47
+ * A list's one filter as a menu button (contract component `filter-menu`: default, active, open, focused). On the
48
+ * default choice the funnel alone; on any other that choice's name and a chevron in the accent, so a filtered list
49
+ * always says so. Its menu is a single choice, the current one marked. With fewer than two choices nothing is drawn.
50
+ */
51
+ export declare function FilterMenu(props: FilterMenuProps): ReactNode;
@@ -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' | 'user' | 'folder-plus' | 'folder-x' | 'user-check' | 'user-x' | 'upload' | 'users' | 'settings' | 'hash';
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' | 'folder-plus' | 'folder-x' | 'user-check' | 'user-x' | 'upload' | 'users' | 'settings' | 'hash' | 'funnel';
4
4
  export interface IconProps {
5
5
  readonly name: IconName;
6
6
  readonly size?: number;
@@ -0,0 +1,15 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type ListFilter } from './FilterMenu.js';
3
+ export interface ListHeadProps {
4
+ /** Before the name: the list's select-all box. */
5
+ readonly leading?: ReactNode;
6
+ /** The list's name: a folder's, or what the list holds. */
7
+ readonly name: string;
8
+ /** The list's filter, at the row's end. */
9
+ readonly filter?: ListFilter;
10
+ }
11
+ /**
12
+ * A list's second row (contract pane-toolbar, header row): the name on one line at the start, cut with an ellipsis, its
13
+ * whole text as its title, and the list's filter at the end, whole at every width. The row's padding is the host's.
14
+ */
15
+ export declare function ListHead({ leading, name, filter }: ListHeadProps): ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { type MenuItem } from './Collections.js';
3
3
  import { type IconName } from './Icon.js';
4
- import { type FilterOption } from './Workspace.js';
4
+ import { type ListFilter } from './FilterMenu.js';
5
5
  /** The screen's floating primary action: one action, or a menu of declared entries. */
6
6
  export type ScreenPrimary = {
7
7
  readonly label: string;
@@ -46,13 +46,12 @@ export interface ScreenShellProps {
46
46
  readonly moreLabel?: string;
47
47
  /** The shell's own icons, the same in every section: the bell, then the person's avatar. */
48
48
  readonly globals?: ReactNode;
49
- /** The place's filters, as chips under the bar, exactly one selected. */
50
- readonly filters?: {
51
- readonly label: string;
52
- readonly options: readonly FilterOption[];
53
- readonly selected: string;
54
- readonly onSelect: (id: string) => void;
55
- };
49
+ /**
50
+ * The list's filter: an icon in the bar, after the search. On a choice other than the default the icon takes the
51
+ * accent, and the title reads the place's name and the choice's. In a bar too narrow to show 64px of the name
52
+ * (or all of a shorter one) beside the choice's, it moves into More, while More is drawn for other actions.
53
+ */
54
+ readonly filter?: ListFilter;
56
55
  /** The floating primary action, given only when the server declares it; never on an item's own screen. */
57
56
  readonly primary?: ScreenPrimary;
58
57
  /** With it the content takes the pull: the refresh, and while it runs the refreshing state. */
@@ -60,19 +59,46 @@ export interface ScreenShellProps {
60
59
  /** What the pull says while pulled: the time of the last sync. */
61
60
  readonly pullText?: ReactNode;
62
61
  /**
63
- * Whether the bar (and the filters under it) is out of view. Not given, the shell decides: out while the content, or
64
- * any pane in it, scrolls down past the bar's own height; back on any scroll up, at the top, or when focus moves into
65
- * the bar. Never while searching, pulling or refreshing, whatever is given.
62
+ * Whether the bar is out of view. Not given, the shell decides: out while the content, or any pane in it, scrolls
63
+ * down past the bar's own height; back on any scroll up, at the top, or when focus moves into the bar. Never while
64
+ * searching, pulling or refreshing, or while the filter's menu or More's is open, whatever is given.
66
65
  */
67
66
  readonly barHidden?: boolean;
68
67
  /** The screen's content: it scrolls on its own; a list in it draws the pull. */
69
68
  readonly children: ReactNode;
70
69
  }
70
+ /** A bar's widths, none of them the widths its parts have been given: the same bar always has the same ones. */
71
+ export interface BarWidths {
72
+ /** The bar's room, its padding left out. */
73
+ readonly bar: number;
74
+ /** The least width of what leads, 0 for nothing. */
75
+ readonly leading: number;
76
+ /** The gap between what leads, the title and the icons. */
77
+ readonly gap: number;
78
+ /** One icon of the bar, and the gap between two. */
79
+ readonly icon: number;
80
+ readonly iconGap: number;
81
+ /** The icons the bar has beside the filter's. */
82
+ readonly search: boolean;
83
+ readonly more: boolean;
84
+ readonly globals: readonly number[];
85
+ /** The place's name, whole. */
86
+ readonly name: number;
87
+ /** The choice's name with its middle dot, whole; 0 while the list is not filtered. */
88
+ readonly choice: number;
89
+ }
90
+ /**
91
+ * Whether the filter goes into More: the bar with the filter in it leaves the title less than its least (64px of the
92
+ * place's name, or all of a shorter one, and the choice's name whole while the list is filtered), and More is drawn for
93
+ * other actions. It reads no width that the answer changes, so one width of the bar has one answer.
94
+ */
95
+ export declare function filterGoesIntoMore({ bar, leading, gap, icon, iconGap, search, more, globals, name, choice }: BarWidths): boolean;
71
96
  /**
72
- * One screen of a section at phone width (contract component `screen-shell`: root, nested, with-filters,
73
- * with-primary-action, with-primary-menu, with-more, pulling, refreshing, searching, bar-hidden). One bar: the section's navigation or Back
74
- * 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
97
+ * One screen of a section at phone width (contract component `screen-shell`: root, nested, with-filter, filtered,
98
+ * filter-in-more, with-primary-action, with-primary-menu, with-more, pulling, refreshing, searching, bar-hidden). One bar: the section's
99
+ * navigation or Back with the parent's name, the title (with the filter's choice while it is not the default), then
100
+ * search, the filter, More and the shell's own icons, or while searching, Close and the field; the content, which
75
101
  * scrolls on its own and refreshes by a pull from its top; the primary action floating at the bottom right, its menu
76
102
  * opening above it. What fills each slot is the host's, from the server's declared nodes.
77
103
  */
78
- export declare function ScreenShell({ title, back, navigation, search, searching, more, moreLabel, globals, filters, primary: declared, onRefresh, pullText, barHidden, children }: ScreenShellProps): ReactNode;
104
+ export declare function ScreenShell({ title, back, navigation, search, searching, more, moreLabel, globals, filter, primary: declared, onRefresh, pullText, barHidden, children }: ScreenShellProps): ReactNode;
@@ -28,7 +28,7 @@ export interface SectionHeaderProps {
28
28
  readonly more?: readonly MenuItem[];
29
29
  /** More's accessible name and tooltip, from the host's catalogue. */
30
30
  readonly moreLabel: string;
31
- /** Row 2: the section's context (a mailbox card, filters, breadcrumbs); with none, no row 2. */
31
+ /** Row 2: the section's context (a mailbox card, a list's name with its filter, breadcrumbs); with none, no row 2. */
32
32
  readonly context?: ReactNode;
33
33
  /** The header spans a one-column page. */
34
34
  readonly fullWidth?: boolean;
@@ -52,22 +52,6 @@ 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
- /**
67
- * One of a few filters, as pills; arrow keys move between them, as a radio group does. Chips are never cut off: those
68
- * that do not fit the row wrap onto the next line, each chip whole.
69
- */
70
- export declare function FilterChips({ options, value, onChange, label }: FilterChipsProps): ReactNode;
71
55
  export interface Pane {
72
56
  /** What the pane holds, for assistive technology ("Folders", "Messages", "Message"). */
73
57
  readonly label: string;
package/dist/index.d.ts CHANGED
@@ -8,10 +8,12 @@ export { FilePicker, FilePickerDenied, FilePickerRestart, type FilePickerBudget,
8
8
  export { SectionHeader, type SectionHeaderProps, type SectionPrimary } from './components/SectionHeader.js';
9
9
  export { PageHeader, TabStrip, Avatar, initialsOf, tintOf, type PageHeaderProps, type Tab, type TabStripProps, type AvatarProps, type AvatarPresence, type AvatarConnection } from './components/Structure.js';
10
10
  export { Icon, ICON_NAMES, BOOTSTRAP_ICONS, NamedIcon, iconForName, type IconName, type IconProps } from './components/Icon.js';
11
- 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.js';
11
+ 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';
12
12
  export { IncomingCall, CallPanel, CallBar, CALL_LABELS, type CallLabels, type IncomingCallProps, type CallPanelProps, type CallBarProps } from './components/Call.js';
13
13
  export { SignInLayout, SignInForm, SIGN_IN_LABELS, type SignInLabels, type SignInLayoutProps, type SignInFormProps, type SignInFeature } from './components/SignIn.js';
14
14
  export { List, ContextMenu, type ListRow, type ListProps, type MenuItem, type ContextMenuProps } from './components/Collections.js';
15
+ export { FilterMenu, FILTER_MENU_LABELS, type FilterMenuLabels, type FilterMenuProps, type FilterOption, type ListFilter } from './components/FilterMenu.js';
16
+ export { ListHead, type ListHeadProps } from './components/ListHead.js';
15
17
  export { PaneToolbar, type PaneToolbarAction, type PaneToolbarEntry, type PaneToolbarProps } from './components/PaneToolbar.js';
16
18
  export { Splitter, type SplitterProps } from './components/Splitter.js';
17
19
  export { Notification, type NotificationAction, type NotificationProps } from './components/Notification.js';