@coolms/ui-react 0.1.0-alpha.7 → 0.1.0-alpha.9
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 +33 -0
- package/dist/components/Dialogs.d.ts +6 -2
- package/dist/components/FilePicker.d.ts +83 -0
- package/dist/components/Workspace.d.ts +11 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +781 -620
- package/package.json +1 -1
- package/src/kit.css +44 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,39 @@
|
|
|
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.9 (2026-11-09)
|
|
6
|
+
|
|
7
|
+
A quick reply that carries its own controls and decides when it may be sent.
|
|
8
|
+
|
|
9
|
+
- `Composer` takes `leading`, a quick reply's own controls at the start of its last row before Send, and `canSend`,
|
|
10
|
+
which decides whether Send sends in place of the text being non-empty.
|
|
11
|
+
|
|
12
|
+
## 0.1.0-alpha.8 (2026-11-09)
|
|
13
|
+
|
|
14
|
+
Choosing files a person already has, and a file viewer that keeps to the screen.
|
|
15
|
+
|
|
16
|
+
- Added: `FilePicker`, for choosing files that already exist in the person's spaces, such as Drive, to attach them
|
|
17
|
+
without downloading and uploading them again (contract component `file-picker`). The kit knows no API: the host
|
|
18
|
+
gives the spaces, lists a folder page by page (`list(space, path, cursor?)`), and receives the chosen entries with
|
|
19
|
+
the space and path each was chosen in.
|
|
20
|
+
- The selection holds across folders and spaces; the footer counts all of it, and a chip lists it, with Remove and
|
|
21
|
+
Clear.
|
|
22
|
+
- An optional `budget` (`usedBytes`, `limitBytes`, `cost`) is counted here: what is left after the selection, and
|
|
23
|
+
a file that would go over is disabled with the host's words for it. `disabledReason` adds the host's own reasons.
|
|
24
|
+
Attach is disabled with nothing chosen and while over.
|
|
25
|
+
- A listbox with aria-multiselectable: Up, Down, Home and End move, Enter opens a folder, Space ticks a file,
|
|
26
|
+
Backspace goes up, Escape cancels. The breadcrumb is a navigation landmark. A page further is asked for near the
|
|
27
|
+
end of the list.
|
|
28
|
+
- Loading, empty and error with Retry through `State`; a folder the person may not open (`FilePickerDenied` from
|
|
29
|
+
`list`) is denied in place, the dialog staying open.
|
|
30
|
+
- A dialog of fixed height on a wide screen; the whole screen on a phone, its foot kept at the bottom.
|
|
31
|
+
- `kit.contract.json` does not declare it yet: no released design-tokens version has the entry.
|
|
32
|
+
- Fixed: the file viewer is never wider than the screen. A viewer bar wider than a phone widened the whole overlay;
|
|
33
|
+
now the overlay is one column the screen's width, and the bar scrolls sideways in its place, its controls centred
|
|
34
|
+
while they fit.
|
|
35
|
+
- `Modal` takes `initialFocus`, what takes the focus on opening when it is not the body's first control, and
|
|
36
|
+
`className`, for a component drawn in it that has a layout of its own.
|
|
37
|
+
|
|
5
38
|
## 0.1.0-alpha.7 (2026-11-08)
|
|
6
39
|
|
|
7
40
|
An icon of its own for the important folder.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import { type ReactNode, type RefObject } from 'react';
|
|
2
2
|
/** How long the closing state is drawn before the dialog leaves the page. */
|
|
3
3
|
export declare const MODAL_CLOSE_MS = 150;
|
|
4
4
|
export interface ModalProps {
|
|
@@ -17,12 +17,16 @@ export interface ModalProps {
|
|
|
17
17
|
readonly footer?: ReactNode;
|
|
18
18
|
/** The close button's name, in the app's language ("Close"). */
|
|
19
19
|
readonly closeLabel?: string;
|
|
20
|
+
/** What takes the focus on opening, when it is not the body's first control (a list, say). */
|
|
21
|
+
readonly initialFocus?: RefObject<HTMLElement | null>;
|
|
22
|
+
/** A class for the dialog itself, for a component drawn in it that has a layout of its own. */
|
|
23
|
+
readonly className?: string;
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
26
|
* A dialog over the page (contract component `modal`: open, closing, dirty). Focus moves into it on open and back to
|
|
23
27
|
* where it was on close; Tab stays inside while it is open.
|
|
24
28
|
*/
|
|
25
|
-
export declare function Modal({ open, title, onClose, dirty, onDirtyClose, children, footer, closeLabel }: ModalProps): ReactNode;
|
|
29
|
+
export declare function Modal({ open, title, onClose, dirty, onDirtyClose, children, footer, closeLabel, initialFocus, className }: ModalProps): ReactNode;
|
|
26
30
|
export interface ConfirmDialogProps {
|
|
27
31
|
readonly open: boolean;
|
|
28
32
|
readonly title: ReactNode;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/** A space the person may read, such as their Drive or a shared space. */
|
|
3
|
+
export interface FilePickerSpace {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly name: string;
|
|
6
|
+
}
|
|
7
|
+
/** One entry of a folder, as the host lists it: a folder opens, a file can be chosen. */
|
|
8
|
+
export interface FilePickerEntry {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly kind: 'folder' | 'file';
|
|
12
|
+
readonly size?: number | null;
|
|
13
|
+
readonly mimeType?: string | null;
|
|
14
|
+
}
|
|
15
|
+
/** One page of a folder; `next` when more follow. */
|
|
16
|
+
export interface FilePickerPage {
|
|
17
|
+
readonly entries: readonly FilePickerEntry[];
|
|
18
|
+
readonly next?: string | null;
|
|
19
|
+
}
|
|
20
|
+
/** A chosen file, with the space and folder it was chosen in, so the host needs no second lookup. */
|
|
21
|
+
export interface FilePickerChoice extends FilePickerEntry {
|
|
22
|
+
readonly space: string;
|
|
23
|
+
readonly path: string;
|
|
24
|
+
}
|
|
25
|
+
/** What the host has spent of a limit before this choice; `cost` is what a file adds against it, its size by default. */
|
|
26
|
+
export interface FilePickerBudget {
|
|
27
|
+
readonly usedBytes: number;
|
|
28
|
+
readonly limitBytes: number;
|
|
29
|
+
readonly cost?: (entry: FilePickerEntry) => number;
|
|
30
|
+
}
|
|
31
|
+
/** A folder the person may not open: thrown by `list`, it is shown as denied in place. Anything else is an error. */
|
|
32
|
+
export declare class FilePickerDenied extends Error {
|
|
33
|
+
constructor(message?: string);
|
|
34
|
+
}
|
|
35
|
+
/** The picker's words, in the host's language. */
|
|
36
|
+
export interface FilePickerLabels {
|
|
37
|
+
readonly title: string;
|
|
38
|
+
readonly close: string;
|
|
39
|
+
readonly cancel: string;
|
|
40
|
+
/** The confirm action, carrying the count: "Attach 3 files". */
|
|
41
|
+
readonly confirm: (count: number) => string;
|
|
42
|
+
readonly space: string;
|
|
43
|
+
readonly path: string;
|
|
44
|
+
readonly up: string;
|
|
45
|
+
readonly files: string;
|
|
46
|
+
/** "3 selected", on the chip that lists the selection. */
|
|
47
|
+
readonly selected: (count: number) => string;
|
|
48
|
+
readonly clear: string;
|
|
49
|
+
readonly remove: (name: string) => string;
|
|
50
|
+
/** The whole selection: "3 files, 2.1 MB". */
|
|
51
|
+
readonly total: (count: number, size: string) => string;
|
|
52
|
+
/** With a budget: "1.2 MB of 25 MB left after these". */
|
|
53
|
+
readonly left: (left: string, limit: string) => string;
|
|
54
|
+
/** Why a file is not offered, or the selection cannot be sent: it would go over the limit. */
|
|
55
|
+
readonly overBudget: string;
|
|
56
|
+
readonly loading: string;
|
|
57
|
+
readonly empty: string;
|
|
58
|
+
readonly error: string;
|
|
59
|
+
readonly retry: string;
|
|
60
|
+
readonly denied: string;
|
|
61
|
+
}
|
|
62
|
+
export interface FilePickerProps {
|
|
63
|
+
readonly open: boolean;
|
|
64
|
+
/** The spaces the person may read, in the host's order; the first is shown first. With one, no switch is drawn. */
|
|
65
|
+
readonly spaces: readonly FilePickerSpace[];
|
|
66
|
+
/** One page of a folder of a space, in the host's order. Throws FilePickerDenied for a folder the person may not open. */
|
|
67
|
+
readonly list: (space: string, path: string, cursor?: string) => Promise<FilePickerPage>;
|
|
68
|
+
/** The host's own reason a file cannot be chosen (not readable, a type it will not send), or nothing. */
|
|
69
|
+
readonly disabledReason?: (entry: FilePickerEntry) => string | null | undefined;
|
|
70
|
+
readonly budget?: FilePickerBudget;
|
|
71
|
+
/** A size as the host says it, in the person's language. */
|
|
72
|
+
readonly formatSize: (bytes: number) => string;
|
|
73
|
+
readonly labels: FilePickerLabels;
|
|
74
|
+
readonly onConfirm: (chosen: readonly FilePickerChoice[]) => void;
|
|
75
|
+
readonly onCancel: () => void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Choosing files a person already has, in their spaces (contract component `file-picker`). The kit knows no API: the
|
|
79
|
+
* host lists folders page by page and receives the chosen entries. The selection holds across folders and spaces; a
|
|
80
|
+
* budget, when given, is counted here, so every host disables the same files. Enter opens a folder, Space ticks a file,
|
|
81
|
+
* Backspace goes up, Escape cancels.
|
|
82
|
+
*/
|
|
83
|
+
export declare function FilePicker(props: FilePickerProps): ReactNode;
|
|
@@ -137,9 +137,19 @@ export interface ComposerProps {
|
|
|
137
137
|
readonly sendLabel?: string;
|
|
138
138
|
/** The attach button's name, in the app's language ("Attach a file"). */
|
|
139
139
|
readonly attachLabel?: string;
|
|
140
|
+
/**
|
|
141
|
+
* A quick reply's own controls, at the start of its last row, before Send (an attach menu). A chat composer does not
|
|
142
|
+
* draw them. With `onAttach` as well, a reply draws both: these first, then the attach button.
|
|
143
|
+
*/
|
|
144
|
+
readonly leading?: ReactNode;
|
|
145
|
+
/**
|
|
146
|
+
* Whether Send sends: by default, when the text is not empty. Given, it decides instead, as for a reply that may go
|
|
147
|
+
* with files and no text, or may not go over its mailbox's limit.
|
|
148
|
+
*/
|
|
149
|
+
readonly canSend?: boolean;
|
|
140
150
|
}
|
|
141
151
|
/**
|
|
142
152
|
* Writing a message: the text, attaching a file, sending. Enter sends a chat message; Shift+Enter starts a new line.
|
|
143
153
|
* Enter while an input method is composing (Chinese, Japanese, Korean...) belongs to the composition and never sends.
|
|
144
154
|
*/
|
|
145
|
-
export declare function Composer({ label, value, onChange, onSend, onAttach, placeholder, variant, sendLabel, attachLabel }: ComposerProps): ReactNode;
|
|
155
|
+
export declare function Composer({ label, value, onChange, onSend, onAttach, placeholder, variant, sendLabel, attachLabel, leading, canSend }: ComposerProps): ReactNode;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { Modal, ConfirmDialog, MODAL_CLOSE_MS, type ModalProps, type ConfirmDial
|
|
|
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
6
|
export { FileViewer, type FileViewerAction, type FileViewerEditing, type FileViewerProps, type FileViewerSiblings } from './components/FileViewer';
|
|
7
|
+
export { FilePicker, FilePickerDenied, type FilePickerBudget, type FilePickerChoice, type FilePickerEntry, type FilePickerLabels, type FilePickerPage, type FilePickerProps, type FilePickerSpace } from './components/FilePicker';
|
|
7
8
|
export { PageHeader, TabStrip, Avatar, initialsOf, tintOf, type PageHeaderProps, type Tab, type TabStripProps, type AvatarProps } from './components/Structure';
|
|
8
9
|
export { Icon, ICON_NAMES, type IconName, type IconProps } from './components/Icon';
|
|
9
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';
|