@coolms/ui-react 0.1.0-alpha.3 → 0.1.0-alpha.4

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,20 @@
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.4 (2026-11-02)
6
+
7
+ The kit's words come from the app, and the composer leaves an input method's Enter alone.
8
+
9
+ - Added: every word a component says can be given in the app's language, English where it is not.
10
+ - `labels` on `IncomingCall`, `CallPanel` and `CallBar` (`CallLabels`, defaults `CALL_LABELS`);
11
+ - `labels` on `SignInForm` (`SignInLabels`, `SIGN_IN_LABELS`) and `MailRow` (`MailRowLabels`, `MAIL_ROW_LABELS`);
12
+ - `railLabel` on `AppShell`, `readLabel` on `ChatBubble`, `attachLabel` on `Composer`, `closeLabel` on `Modal`
13
+ and `ConfirmDialog`, `dismissLabel` on `Toast` and `retryLabel` on `ErrorBanner`.
14
+ The words that name someone or something take it as an argument (`onCallWith(name)`), so a language can place it.
15
+ - Changed: `AppShell`'s main area is a column: a section in it can fill the height (`flex: 1`), and a lone child does.
16
+ - Fixed: `Composer` no longer sends on Enter while an input method is composing (`isComposing`, or the composing key
17
+ 229 on browsers that do not set it). Typing Chinese, Japanese or Korean, Enter confirms the text.
18
+
5
19
  ## 0.1.0-alpha.3 (2026-10-30)
6
20
 
7
21
  The Workspace's components, on design-tokens 0.6.0.
@@ -1,13 +1,39 @@
1
1
  import type { ReactNode } from 'react';
2
+ /** The words a call's components say, in the app's language; English by default. */
3
+ export interface CallLabels {
4
+ readonly incomingAudio: string;
5
+ readonly incomingVideo: string;
6
+ /** The incoming card's name for a screen reader: what is ringing, and who calls. */
7
+ readonly incomingFrom: (what: string, name: string) => string;
8
+ readonly accept: string;
9
+ readonly decline: string;
10
+ readonly callWith: (name: string) => string;
11
+ readonly callTime: (duration: string) => string;
12
+ readonly goodConnection: string;
13
+ readonly poorConnection: string;
14
+ readonly you: string;
15
+ readonly speaking: string;
16
+ readonly mute: string;
17
+ readonly unmute: string;
18
+ readonly speaker: string;
19
+ readonly addPerson: string;
20
+ readonly chat: string;
21
+ readonly hangUp: string;
22
+ readonly onCallWith: (name: string) => string;
23
+ readonly returnToCall: string;
24
+ }
25
+ export declare const CALL_LABELS: CallLabels;
2
26
  export interface IncomingCallProps {
3
27
  /** Who is calling. */
4
28
  readonly name: string;
5
29
  readonly media: 'audio' | 'video';
6
30
  readonly onAccept: () => void;
7
31
  readonly onDecline: () => void;
32
+ /** Its words, in the app's language; each left out is English. */
33
+ readonly labels?: Partial<CallLabels>;
8
34
  }
9
35
  /** A call ringing on this device: who, and Accept or Decline. An alert dialog, so a screen reader announces it. */
10
- export declare function IncomingCall({ name, media, onAccept, onDecline }: IncomingCallProps): ReactNode;
36
+ export declare function IncomingCall({ name, media, onAccept, onDecline, labels }: IncomingCallProps): ReactNode;
11
37
  export interface CallPanelProps {
12
38
  readonly name: string;
13
39
  /** How long the call has lasted ("04:12"). */
@@ -26,9 +52,11 @@ export interface CallPanelProps {
26
52
  readonly onAddPerson?: () => void;
27
53
  readonly onChat?: () => void;
28
54
  readonly onHangUp: () => void;
55
+ /** Its words, in the app's language; each left out is English. */
56
+ readonly labels?: Partial<CallLabels>;
29
57
  }
30
58
  /** A call in progress: who, how long, how the connection is, and its controls. */
31
- export declare function CallPanel({ name, duration, connection, you, muted, speaker, onToggleMute, onToggleSpeaker, onAddPerson, onChat, onHangUp }: CallPanelProps): ReactNode;
59
+ export declare function CallPanel({ name, duration, connection, you, muted, speaker, onToggleMute, onToggleSpeaker, onAddPerson, onChat, onHangUp, labels }: CallPanelProps): ReactNode;
32
60
  export interface CallBarProps {
33
61
  readonly name: string;
34
62
  readonly duration: string;
@@ -36,6 +64,8 @@ export interface CallBarProps {
36
64
  readonly onToggleMute: () => void;
37
65
  readonly onReturn: () => void;
38
66
  readonly onHangUp: () => void;
67
+ /** Its words, in the app's language; each left out is English. */
68
+ readonly labels?: Partial<CallLabels>;
39
69
  }
40
70
  /** The call, kept in view while another section is open: who, how long, mute, back to it, hang up. */
41
- export declare function CallBar({ name, duration, muted, onToggleMute, onReturn, onHangUp }: CallBarProps): ReactNode;
71
+ export declare function CallBar({ name, duration, muted, onToggleMute, onReturn, onHangUp, labels }: CallBarProps): ReactNode;
@@ -15,12 +15,14 @@ export interface ModalProps {
15
15
  readonly children: ReactNode;
16
16
  /** The dialog's actions, at its foot. */
17
17
  readonly footer?: ReactNode;
18
+ /** The close button's name, in the app's language ("Close"). */
19
+ readonly closeLabel?: string;
18
20
  }
19
21
  /**
20
22
  * A dialog over the page (contract component `modal`: open, closing, dirty). Focus moves into it on open and back to
21
23
  * where it was on close; Tab stays inside while it is open.
22
24
  */
23
- export declare function Modal({ open, title, onClose, dirty, onDirtyClose, children, footer }: ModalProps): ReactNode;
25
+ export declare function Modal({ open, title, onClose, dirty, onDirtyClose, children, footer, closeLabel }: ModalProps): ReactNode;
24
26
  export interface ConfirmDialogProps {
25
27
  readonly open: boolean;
26
28
  readonly title: ReactNode;
@@ -33,8 +35,10 @@ export interface ConfirmDialogProps {
33
35
  /** The confirming button names the outcome ("Delete 3 messages"), never "OK". */
34
36
  readonly confirmLabel?: ReactNode;
35
37
  readonly cancelLabel?: ReactNode;
38
+ /** The close button's name for a screen reader, in the app's language; "Close" where none is given. */
39
+ readonly closeLabel?: string;
36
40
  readonly onConfirm: () => void;
37
41
  readonly onCancel: () => void;
38
42
  }
39
43
  /** A question before a destructive or irreversible action (contract component `confirm-dialog`: default, danger, discard-changes). */
40
- export declare function ConfirmDialog({ open, title, message, kind, confirmLabel, cancelLabel, onConfirm, onCancel }: ConfirmDialogProps): ReactNode;
44
+ export declare function ConfirmDialog({ open, title, message, kind, confirmLabel, cancelLabel, closeLabel, onConfirm, onCancel }: ConfirmDialogProps): ReactNode;
@@ -25,6 +25,22 @@ export interface SignInFormProps {
25
25
  /** The server's refusal, in its words. */
26
26
  readonly error?: string;
27
27
  readonly busy?: boolean;
28
+ /** Its words, in the app's language; each left out is English. */
29
+ readonly labels?: Partial<SignInLabels>;
28
30
  }
31
+ /** The words the sign-in form says, in the app's language; English by default. */
32
+ export interface SignInLabels {
33
+ readonly title: string;
34
+ readonly identifier: string;
35
+ readonly identifierPlaceholder: string;
36
+ readonly password: string;
37
+ readonly show: string;
38
+ readonly hide: string;
39
+ readonly forgot: string;
40
+ readonly submit: string;
41
+ readonly newHere: string;
42
+ readonly create: string;
43
+ }
44
+ export declare const SIGN_IN_LABELS: SignInLabels;
29
45
  /** Signing in with an identifier and a password; the password can be shown while typed. */
30
- export declare function SignInForm({ server, onSubmit, forgotHref, createHref, error, busy }: SignInFormProps): ReactNode;
46
+ export declare function SignInForm({ server, onSubmit, forgotHref, createHref, error, busy, labels }: SignInFormProps): ReactNode;
@@ -8,12 +8,14 @@ export interface ToastProps {
8
8
  readonly onAction: () => void;
9
9
  };
10
10
  readonly onDismiss?: () => void;
11
+ /** The dismiss button's name, in the app's language ("Dismiss"). */
12
+ readonly dismissLabel?: string;
11
13
  }
12
14
  /**
13
15
  * A short report of what happened (contract component `toast`: success, error, info, with-action). An error is said
14
16
  * assertively (role=alert); the others politely (role=status). Placement and timing are the page's (ToastRegion).
15
17
  */
16
- export declare function Toast({ kind, message, action, onDismiss }: ToastProps): ReactNode;
18
+ export declare function Toast({ kind, message, action, onDismiss, dismissLabel }: ToastProps): ReactNode;
17
19
  /** Where toasts stack: a fixed corner of the page. */
18
20
  export declare function ToastRegion({ children }: {
19
21
  readonly children: ReactNode;
@@ -39,6 +41,8 @@ export interface ErrorBannerProps {
39
41
  readonly message: ReactNode;
40
42
  /** Offered only when trying again can help (a timeout, a network failure), never for a refusal. */
41
43
  readonly onRetry?: () => void;
44
+ /** The retry button's words, in the app's language ("Try again"). */
45
+ readonly retryLabel?: string;
42
46
  }
43
47
  /** A read failed; says why, offers retry when retrying can help (contract component `error-banner`: default, with-retry). */
44
- export declare function ErrorBanner({ message, onRetry }: ErrorBannerProps): ReactNode;
48
+ export declare function ErrorBanner({ message, onRetry, retryLabel }: ErrorBannerProps): ReactNode;
@@ -35,12 +35,14 @@ export interface AppShellProps {
35
35
  /** Notifications and the account, at the right of the top bar. */
36
36
  readonly account?: ReactNode;
37
37
  readonly children: ReactNode;
38
+ /** The rail's name for assistive technology, in the app's language ("Sections"). */
39
+ readonly railLabel?: string;
38
40
  }
39
41
  /**
40
42
  * The Workspace's frame: a dark rail of sections, each an icon over its name with its count, and a light top bar with
41
43
  * the server, the search and the account. The open section is marked for assistive technology as the current page.
42
44
  */
43
- export declare function AppShell({ product, mark, rail, active, onNavigate, server, search, account, children }: AppShellProps): ReactNode;
45
+ export declare function AppShell({ product, mark, rail, active, onNavigate, server, search, account, children, railLabel }: AppShellProps): ReactNode;
44
46
  export interface SearchFieldProps {
45
47
  readonly label: string;
46
48
  readonly placeholder?: string;
@@ -100,9 +102,16 @@ export interface MailRowProps {
100
102
  readonly hasAttachment?: boolean;
101
103
  readonly selected?: boolean;
102
104
  readonly onOpen: () => void;
105
+ /** Its words for assistive technology, in the app's language; each left out is English. */
106
+ readonly labels?: Partial<MailRowLabels>;
103
107
  }
108
+ export interface MailRowLabels {
109
+ readonly attachment: string;
110
+ readonly unread: string;
111
+ }
112
+ export declare const MAIL_ROW_LABELS: MailRowLabels;
104
113
  /** One message in a mailbox's list: who, what, the start of it, when; unread in bold with its dot. */
105
- export declare function MailRow({ from, subject, preview, time, unread, hasAttachment, selected, onOpen }: MailRowProps): ReactNode;
114
+ export declare function MailRow({ from, subject, preview, time, unread, hasAttachment, selected, onOpen, labels }: MailRowProps): ReactNode;
106
115
  export interface ChatBubbleProps {
107
116
  /** Received from someone else, or sent by this account. */
108
117
  readonly direction: 'in' | 'out';
@@ -110,9 +119,11 @@ export interface ChatBubbleProps {
110
119
  readonly time: string;
111
120
  /** For a sent message: whether the other side has read it. */
112
121
  readonly read?: boolean;
122
+ /** What a read message says beside its time, in the app's language ("Read"). */
123
+ readonly readLabel?: string;
113
124
  }
114
125
  /** One chat message; the corner nearest its sender is the tail. */
115
- export declare function ChatBubble({ direction, children, time, read }: ChatBubbleProps): ReactNode;
126
+ export declare function ChatBubble({ direction, children, time, read, readLabel }: ChatBubbleProps): ReactNode;
116
127
  export interface ComposerProps {
117
128
  /** What is being written and to whom ("Message Anna", "Quick reply to Anna Kowalska"). */
118
129
  readonly label: string;
@@ -124,6 +135,11 @@ export interface ComposerProps {
124
135
  /** `chat`: one line beside its buttons; `reply`: a titled box under a message. */
125
136
  readonly variant?: 'chat' | 'reply';
126
137
  readonly sendLabel?: string;
138
+ /** The attach button's name, in the app's language ("Attach a file"). */
139
+ readonly attachLabel?: string;
127
140
  }
128
- /** Writing a message: the text, attaching a file, sending. Enter sends a chat message; Shift+Enter starts a new line. */
129
- export declare function Composer({ label, value, onChange, onSend, onAttach, placeholder, variant, sendLabel }: ComposerProps): ReactNode;
141
+ /**
142
+ * Writing a message: the text, attaching a file, sending. Enter sends a chat message; Shift+Enter starts a new line.
143
+ * Enter while an input method is composing (Chinese, Japanese, Korean...) belongs to the composition and never sends.
144
+ */
145
+ export declare function Composer({ label, value, onChange, onSend, onAttach, placeholder, variant, sendLabel, attachLabel }: ComposerProps): ReactNode;
@@ -1,4 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
+ /** A component's words: the app's where it gives them, the default where it does not, a word given as undefined included. */
3
+ export declare function withDefaults<T extends object>(defaults: T, given: Partial<T> | undefined): T;
2
4
  /** Class names, the falsy ones left out. */
3
5
  export declare function cx(...names: ReadonlyArray<string | false | null | undefined>): string;
4
6
  /** The kit's few glyphs, inline: no icon font, no dependency. Decorative -- the text beside them carries the meaning. */
package/dist/index.d.ts CHANGED
@@ -4,9 +4,9 @@ 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 { PageHeader, TabStrip, Avatar, initialsOf, tintOf, type PageHeaderProps, type Tab, type TabStripProps, type AvatarProps } from './components/Structure';
6
6
  export { Icon, ICON_NAMES, type IconName, type IconProps } from './components/Icon';
7
- export { AppShell, Badge, SearchField, FilterChips, SplitPanes, MailRow, ChatBubble, Composer, 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';
8
- export { IncomingCall, CallPanel, CallBar, type IncomingCallProps, type CallPanelProps, type CallBarProps } from './components/Call';
9
- export { SignInLayout, SignInForm, type SignInLayoutProps, type SignInFormProps, type SignInFeature } from './components/SignIn';
7
+ 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';
8
+ export { IncomingCall, CallPanel, CallBar, CALL_LABELS, type CallLabels, type IncomingCallProps, type CallPanelProps, type CallBarProps } from './components/Call';
9
+ export { SignInLayout, SignInForm, SIGN_IN_LABELS, type SignInLabels, type SignInLayoutProps, type SignInFormProps, type SignInFeature } from './components/SignIn';
10
10
  export { List, ContextMenu, type ListRow, type ListProps, type MenuItem, type ContextMenuProps } from './components/Collections';
11
11
  export { offerFor, isCapability, type Capability, type Offer, type OfferOptions } from './server/capability';
12
12
  export { readRefusal, refusalText, type Refusal } from './server/refusal';