@claude-code-kit/ui 0.1.0 → 0.1.1
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/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/index.d.mts +409 -21
- package/dist/index.d.ts +409 -21
- package/dist/index.js +1608 -115
- package/dist/index.mjs +1564 -85
- package/package.json +8 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Color } from '@claude-code-kit/ink-renderer';
|
|
1
|
+
import { Color, Styles, DOMElement, ClickEvent, FocusEvent, KeyboardEvent, ColorType } from '@claude-code-kit/ink-renderer';
|
|
2
2
|
export * from '@claude-code-kit/ink-renderer';
|
|
3
|
-
import React from 'react';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import React__default, { PropsWithChildren, Ref, ReactNode } from 'react';
|
|
5
|
+
import { Tokens } from 'marked';
|
|
4
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
7
|
|
|
6
8
|
type DividerProps = {
|
|
@@ -10,22 +12,22 @@ type DividerProps = {
|
|
|
10
12
|
padding?: number;
|
|
11
13
|
title?: string;
|
|
12
14
|
};
|
|
13
|
-
declare function Divider({ width, color, char, padding, title }: DividerProps):
|
|
15
|
+
declare function Divider({ width, color, char, padding, title }: DividerProps): React__default.ReactNode;
|
|
14
16
|
|
|
15
|
-
type Props$
|
|
17
|
+
type Props$b = {
|
|
16
18
|
ratio: number;
|
|
17
19
|
width: number;
|
|
18
20
|
fillColor?: Color;
|
|
19
21
|
emptyColor?: Color;
|
|
20
22
|
};
|
|
21
|
-
declare function ProgressBar({ ratio: inputRatio, width, fillColor, emptyColor }: Props$
|
|
23
|
+
declare function ProgressBar({ ratio: inputRatio, width, fillColor, emptyColor }: Props$b): React__default.ReactNode;
|
|
22
24
|
|
|
23
25
|
type Status = 'success' | 'error' | 'warning' | 'info' | 'pending' | 'loading';
|
|
24
|
-
type Props$
|
|
26
|
+
type Props$a = {
|
|
25
27
|
status: Status;
|
|
26
28
|
withSpace?: boolean;
|
|
27
29
|
};
|
|
28
|
-
declare function StatusIcon({ status, withSpace }: Props$
|
|
30
|
+
declare function StatusIcon({ status, withSpace }: Props$a): React__default.ReactNode;
|
|
29
31
|
|
|
30
32
|
type StatusLineSegment = {
|
|
31
33
|
content: string;
|
|
@@ -40,7 +42,7 @@ type StatusLineProps = {
|
|
|
40
42
|
borderStyle?: 'none' | 'single' | 'round';
|
|
41
43
|
borderColor?: Color;
|
|
42
44
|
};
|
|
43
|
-
declare function StatusLine({ segments, text, paddingX, gap, borderStyle, borderColor, }: StatusLineProps):
|
|
45
|
+
declare function StatusLine({ segments, text, paddingX, gap, borderStyle, borderColor, }: StatusLineProps): React__default.ReactNode;
|
|
44
46
|
declare function useStatusLine(updater: () => StatusLineSegment[] | string, deps: unknown[], intervalMs?: number): StatusLineSegment[] | string;
|
|
45
47
|
|
|
46
48
|
type CommandResult = {
|
|
@@ -64,7 +66,7 @@ type LocalCommand = CommandBase & {
|
|
|
64
66
|
};
|
|
65
67
|
type JSXCommand = CommandBase & {
|
|
66
68
|
type: 'jsx';
|
|
67
|
-
render: (onDone: CommandOnDone, args: string) =>
|
|
69
|
+
render: (onDone: CommandOnDone, args: string) => React__default.ReactNode;
|
|
68
70
|
};
|
|
69
71
|
type Command$1 = LocalCommand | JSXCommand;
|
|
70
72
|
|
|
@@ -161,8 +163,8 @@ declare function useKeybindings(handlers: Record<string, () => void | false | Pr
|
|
|
161
163
|
* ~/.claude/keybindings.json, with hot-reload support when the file changes.
|
|
162
164
|
*/
|
|
163
165
|
|
|
164
|
-
type Props = {
|
|
165
|
-
children:
|
|
166
|
+
type Props$9 = {
|
|
167
|
+
children: React__default.ReactNode;
|
|
166
168
|
/** Optional callback invoked when keybinding warnings are present */
|
|
167
169
|
onWarnings?: (message: string, isError: boolean) => void;
|
|
168
170
|
};
|
|
@@ -184,10 +186,18 @@ type Props = {
|
|
|
184
186
|
* - User bindings override defaults (later entries win)
|
|
185
187
|
* - Chord support with automatic timeout
|
|
186
188
|
*/
|
|
187
|
-
declare function KeybindingSetup({ children, onWarnings }: Props):
|
|
189
|
+
declare function KeybindingSetup({ children, onWarnings }: Props$9): React__default.ReactNode;
|
|
188
190
|
|
|
189
191
|
declare const DEFAULT_BINDINGS: KeybindingBlock[];
|
|
190
192
|
|
|
193
|
+
declare function useDoublePress(setPending: (pending: boolean) => void, onDoublePress: () => void, onFirstPress?: () => void): () => void;
|
|
194
|
+
|
|
195
|
+
type TerminalSize = {
|
|
196
|
+
columns: number;
|
|
197
|
+
rows: number;
|
|
198
|
+
};
|
|
199
|
+
declare function useTerminalSize(): TerminalSize;
|
|
200
|
+
|
|
191
201
|
type Command = {
|
|
192
202
|
name: string;
|
|
193
203
|
description: string;
|
|
@@ -204,7 +214,7 @@ type PromptInputProps = {
|
|
|
204
214
|
onCommandSelect?: (name: string) => void;
|
|
205
215
|
history?: string[];
|
|
206
216
|
};
|
|
207
|
-
declare function PromptInput({ value, onChange, onSubmit, placeholder, prefix, prefixColor, disabled, commands, onCommandSelect, history, }: PromptInputProps):
|
|
217
|
+
declare function PromptInput({ value, onChange, onSubmit, placeholder, prefix, prefixColor, disabled, commands, onCommandSelect, history, }: PromptInputProps): React__default.ReactNode;
|
|
208
218
|
|
|
209
219
|
type SpinnerProps = {
|
|
210
220
|
label?: string;
|
|
@@ -213,7 +223,46 @@ type SpinnerProps = {
|
|
|
213
223
|
color?: string;
|
|
214
224
|
showElapsed?: boolean;
|
|
215
225
|
};
|
|
216
|
-
declare function Spinner({ label, verb, verbs, color, showElapsed, }: SpinnerProps):
|
|
226
|
+
declare function Spinner({ label, verb, verbs, color, showElapsed, }: SpinnerProps): React__default.ReactNode;
|
|
227
|
+
|
|
228
|
+
type Props$8 = {
|
|
229
|
+
children: string;
|
|
230
|
+
/** When true, render all text content as dim */
|
|
231
|
+
dimColor?: boolean;
|
|
232
|
+
};
|
|
233
|
+
declare function Markdown(props: Props$8): React__default.ReactNode;
|
|
234
|
+
type StreamingProps = {
|
|
235
|
+
children: string;
|
|
236
|
+
};
|
|
237
|
+
declare function StreamingMarkdown({ children, }: StreamingProps): React__default.ReactNode;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Stub for cli-highlight. Syntax highlighting is optional — returns null
|
|
241
|
+
* when cli-highlight is not available, causing code blocks to render as
|
|
242
|
+
* plain text.
|
|
243
|
+
*/
|
|
244
|
+
type CliHighlight = {
|
|
245
|
+
highlight: (code: string, options?: {
|
|
246
|
+
language?: string;
|
|
247
|
+
}) => string;
|
|
248
|
+
supportsLanguage: (lang: string) => boolean;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
type Props$7 = {
|
|
252
|
+
token: Tokens.Table;
|
|
253
|
+
highlight: CliHighlight | null;
|
|
254
|
+
/** Override terminal width (useful for testing) */
|
|
255
|
+
forceWidth?: number;
|
|
256
|
+
};
|
|
257
|
+
/**
|
|
258
|
+
* Renders a markdown table using Ink's Box layout.
|
|
259
|
+
* Handles terminal width by:
|
|
260
|
+
* 1. Calculating minimum column widths based on longest word
|
|
261
|
+
* 2. Distributing available space proportionally
|
|
262
|
+
* 3. Wrapping text within cells (no truncation)
|
|
263
|
+
* 4. Properly aligning multi-line rows with borders
|
|
264
|
+
*/
|
|
265
|
+
declare function MarkdownTable({ token, highlight, forceWidth }: Props$7): React__default.ReactNode;
|
|
217
266
|
|
|
218
267
|
type SelectOption<T = string> = {
|
|
219
268
|
value: T;
|
|
@@ -246,9 +295,9 @@ type Message = {
|
|
|
246
295
|
type MessageListProps = {
|
|
247
296
|
messages: Message[];
|
|
248
297
|
streamingContent?: string | null;
|
|
249
|
-
renderMessage?: (message: Message) =>
|
|
298
|
+
renderMessage?: (message: Message) => React__default.ReactNode;
|
|
250
299
|
};
|
|
251
|
-
declare function MessageList({ messages, streamingContent, renderMessage, }: MessageListProps):
|
|
300
|
+
declare function MessageList({ messages, streamingContent, renderMessage, }: MessageListProps): React__default.ReactNode;
|
|
252
301
|
|
|
253
302
|
type StreamingTextProps = {
|
|
254
303
|
text: string;
|
|
@@ -257,7 +306,7 @@ type StreamingTextProps = {
|
|
|
257
306
|
onComplete?: () => void;
|
|
258
307
|
color?: string;
|
|
259
308
|
};
|
|
260
|
-
declare function StreamingText({ text, speed, interval, onComplete, color, }: StreamingTextProps):
|
|
309
|
+
declare function StreamingText({ text, speed, interval, onComplete, color, }: StreamingTextProps): React__default.ReactNode;
|
|
261
310
|
|
|
262
311
|
type REPLCommand = {
|
|
263
312
|
name: string;
|
|
@@ -276,9 +325,348 @@ type REPLProps = {
|
|
|
276
325
|
prefix?: string;
|
|
277
326
|
placeholder?: string;
|
|
278
327
|
history?: string[];
|
|
279
|
-
renderMessage?: (message: Message) =>
|
|
280
|
-
spinner?:
|
|
328
|
+
renderMessage?: (message: Message) => React__default.ReactNode;
|
|
329
|
+
spinner?: React__default.ReactNode;
|
|
330
|
+
};
|
|
331
|
+
declare function REPL({ onSubmit, onExit, messages, isLoading, streamingContent, commands, model, statusSegments, prefix, placeholder, history: externalHistory, renderMessage, spinner, }: REPLProps): React__default.ReactNode;
|
|
332
|
+
|
|
333
|
+
type ThemeName = 'dark' | 'light';
|
|
334
|
+
type ThemeSetting = ThemeName | 'auto';
|
|
335
|
+
type Theme = {
|
|
336
|
+
text: string;
|
|
337
|
+
dimText: string;
|
|
338
|
+
border: string;
|
|
339
|
+
accent: string;
|
|
340
|
+
success: string;
|
|
341
|
+
warning: string;
|
|
342
|
+
error: string;
|
|
343
|
+
assistant: string;
|
|
344
|
+
inactive: string;
|
|
345
|
+
inverseText: string;
|
|
346
|
+
permission: string;
|
|
347
|
+
};
|
|
348
|
+
declare function getTheme(name: ThemeName): Theme;
|
|
349
|
+
type Props$6 = {
|
|
350
|
+
children: React__default.ReactNode;
|
|
351
|
+
initialState?: ThemeSetting;
|
|
352
|
+
onThemeSave?: (setting: ThemeSetting) => void;
|
|
353
|
+
};
|
|
354
|
+
declare function ThemeProvider({ children, initialState, onThemeSave, }: Props$6): react_jsx_runtime.JSX.Element;
|
|
355
|
+
declare function useTheme(): [ThemeName, (setting: ThemeSetting) => void];
|
|
356
|
+
declare function useThemeSetting(): ThemeSetting;
|
|
357
|
+
declare function usePreviewTheme(): {
|
|
358
|
+
setPreviewTheme: (setting: ThemeSetting) => void;
|
|
359
|
+
savePreview: () => void;
|
|
360
|
+
cancelPreview: () => void;
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
type ThemedColorProps = {
|
|
364
|
+
readonly borderColor?: keyof Theme | Color;
|
|
365
|
+
readonly borderTopColor?: keyof Theme | Color;
|
|
366
|
+
readonly borderBottomColor?: keyof Theme | Color;
|
|
367
|
+
readonly borderLeftColor?: keyof Theme | Color;
|
|
368
|
+
readonly borderRightColor?: keyof Theme | Color;
|
|
369
|
+
readonly backgroundColor?: keyof Theme | Color;
|
|
370
|
+
};
|
|
371
|
+
type BaseStylesWithoutColors = Omit<Styles, 'textWrap' | 'borderColor' | 'borderTopColor' | 'borderBottomColor' | 'borderLeftColor' | 'borderRightColor' | 'backgroundColor'>;
|
|
372
|
+
type Props$5 = BaseStylesWithoutColors & ThemedColorProps & {
|
|
373
|
+
ref?: Ref<DOMElement>;
|
|
374
|
+
tabIndex?: number;
|
|
375
|
+
autoFocus?: boolean;
|
|
376
|
+
onClick?: (event: ClickEvent) => void;
|
|
377
|
+
onFocus?: (event: FocusEvent) => void;
|
|
378
|
+
onFocusCapture?: (event: FocusEvent) => void;
|
|
379
|
+
onBlur?: (event: FocusEvent) => void;
|
|
380
|
+
onBlurCapture?: (event: FocusEvent) => void;
|
|
381
|
+
onKeyDown?: (event: KeyboardEvent) => void;
|
|
382
|
+
onKeyDownCapture?: (event: KeyboardEvent) => void;
|
|
383
|
+
onMouseEnter?: () => void;
|
|
384
|
+
onMouseLeave?: () => void;
|
|
385
|
+
};
|
|
386
|
+
declare function ThemedBox({ borderColor, borderTopColor, borderBottomColor, borderLeftColor, borderRightColor, backgroundColor, children, ref, ...rest }: PropsWithChildren<Props$5>): React__default.ReactNode;
|
|
387
|
+
|
|
388
|
+
/** Colors uncolored ThemedText in the subtree. Precedence: explicit `color` >
|
|
389
|
+
* this > dimColor. Crosses Box boundaries (Ink's style cascade doesn't). */
|
|
390
|
+
declare const TextHoverColorContext: React__default.Context<keyof Theme | undefined>;
|
|
391
|
+
type Props$4 = {
|
|
392
|
+
readonly color?: keyof Theme | Color;
|
|
393
|
+
readonly backgroundColor?: keyof Theme;
|
|
394
|
+
readonly dimColor?: boolean;
|
|
395
|
+
readonly bold?: boolean;
|
|
396
|
+
readonly italic?: boolean;
|
|
397
|
+
readonly underline?: boolean;
|
|
398
|
+
readonly strikethrough?: boolean;
|
|
399
|
+
readonly inverse?: boolean;
|
|
400
|
+
readonly wrap?: Styles['textWrap'];
|
|
401
|
+
readonly children?: ReactNode;
|
|
402
|
+
};
|
|
403
|
+
declare function ThemedText({ color, backgroundColor, dimColor, bold, italic, underline, strikethrough, inverse, wrap, children, }: Props$4): React__default.ReactNode;
|
|
404
|
+
|
|
405
|
+
type DialogProps = {
|
|
406
|
+
title: React__default.ReactNode;
|
|
407
|
+
subtitle?: React__default.ReactNode;
|
|
408
|
+
children: React__default.ReactNode;
|
|
409
|
+
onCancel: () => void;
|
|
410
|
+
color?: keyof Theme;
|
|
411
|
+
hideInputGuide?: boolean;
|
|
412
|
+
hideBorder?: boolean;
|
|
413
|
+
};
|
|
414
|
+
/**
|
|
415
|
+
* A dialog box with title, content, and keyboard hints.
|
|
416
|
+
* Press Esc to cancel/close.
|
|
417
|
+
*/
|
|
418
|
+
declare function Dialog({ title, subtitle, children, onCancel, color, hideInputGuide, hideBorder, }: DialogProps): React__default.ReactNode;
|
|
419
|
+
|
|
420
|
+
type PickerAction<T> = {
|
|
421
|
+
action: string;
|
|
422
|
+
handler: (item: T) => void;
|
|
423
|
+
};
|
|
424
|
+
type Props$3<T> = {
|
|
425
|
+
title: string;
|
|
426
|
+
placeholder?: string;
|
|
427
|
+
initialQuery?: string;
|
|
428
|
+
items: readonly T[];
|
|
429
|
+
getKey: (item: T) => string;
|
|
430
|
+
renderItem: (item: T, isFocused: boolean) => React.ReactNode;
|
|
431
|
+
renderPreview?: (item: T) => React.ReactNode;
|
|
432
|
+
previewPosition?: 'bottom' | 'right';
|
|
433
|
+
visibleCount?: number;
|
|
434
|
+
direction?: 'down' | 'up';
|
|
435
|
+
onQueryChange: (query: string) => void;
|
|
436
|
+
onSelect: (item: T) => void;
|
|
437
|
+
onTab?: PickerAction<T>;
|
|
438
|
+
onShiftTab?: PickerAction<T>;
|
|
439
|
+
onFocus?: (item: T | undefined) => void;
|
|
440
|
+
onCancel: () => void;
|
|
441
|
+
emptyMessage?: string | ((query: string) => string);
|
|
442
|
+
matchLabel?: string;
|
|
443
|
+
selectAction?: string;
|
|
444
|
+
extraHints?: React.ReactNode;
|
|
445
|
+
};
|
|
446
|
+
declare function FuzzyPicker<T>({ title, placeholder, initialQuery, items, getKey, renderItem, renderPreview, previewPosition, visibleCount: requestedVisible, direction, onQueryChange, onSelect, onTab, onShiftTab, onFocus, onCancel, emptyMessage, matchLabel, selectAction, extraHints, }: Props$3<T>): React.ReactNode;
|
|
447
|
+
|
|
448
|
+
type Props$2 = {
|
|
449
|
+
/** The key or chord to display (e.g., "ctrl+o", "Enter", "↑/↓") */
|
|
450
|
+
shortcut: string;
|
|
451
|
+
/** The action the key performs (e.g., "expand", "select", "navigate") */
|
|
452
|
+
action: string;
|
|
453
|
+
/** Whether to wrap the hint in parentheses. Default: false */
|
|
454
|
+
parens?: boolean;
|
|
455
|
+
/** Whether to render the shortcut in bold. Default: false */
|
|
456
|
+
bold?: boolean;
|
|
457
|
+
};
|
|
458
|
+
/**
|
|
459
|
+
* Renders a keyboard shortcut hint like "ctrl+o to expand" or "(tab to toggle)"
|
|
460
|
+
*
|
|
461
|
+
* Wrap in <Text dimColor> for the common dim styling.
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* // Simple hint wrapped in dim Text
|
|
465
|
+
* <Text dimColor><KeyboardShortcutHint shortcut="esc" action="cancel" /></Text>
|
|
466
|
+
*
|
|
467
|
+
* // With parentheses: "(ctrl+o to expand)"
|
|
468
|
+
* <Text dimColor><KeyboardShortcutHint shortcut="ctrl+o" action="expand" parens /></Text>
|
|
469
|
+
*
|
|
470
|
+
* // With bold shortcut: "Enter to confirm" (Enter is bold)
|
|
471
|
+
* <Text dimColor><KeyboardShortcutHint shortcut="Enter" action="confirm" bold /></Text>
|
|
472
|
+
*
|
|
473
|
+
* // Multiple hints with middot separator - use Byline
|
|
474
|
+
* <Text dimColor>
|
|
475
|
+
* <Byline>
|
|
476
|
+
* <KeyboardShortcutHint shortcut="Enter" action="confirm" />
|
|
477
|
+
* <KeyboardShortcutHint shortcut="Esc" action="cancel" />
|
|
478
|
+
* </Byline>
|
|
479
|
+
* </Text>
|
|
480
|
+
*/
|
|
481
|
+
declare function KeyboardShortcutHint({ shortcut, action, parens, bold, }: Props$2): React__default.ReactNode;
|
|
482
|
+
|
|
483
|
+
type ListItemProps = {
|
|
484
|
+
/**
|
|
485
|
+
* Whether this item is currently focused (keyboard selection).
|
|
486
|
+
* Shows the pointer indicator (❯) when true.
|
|
487
|
+
*/
|
|
488
|
+
isFocused: boolean;
|
|
489
|
+
/**
|
|
490
|
+
* Whether this item is selected (chosen/checked).
|
|
491
|
+
* Shows the checkmark indicator (✓) when true.
|
|
492
|
+
* @default false
|
|
493
|
+
*/
|
|
494
|
+
isSelected?: boolean;
|
|
495
|
+
/** The content to display for this item. */
|
|
496
|
+
children: ReactNode;
|
|
497
|
+
/** Optional description text displayed below the main content. */
|
|
498
|
+
description?: string;
|
|
499
|
+
/**
|
|
500
|
+
* Show a down arrow indicator instead of pointer (for scroll hints).
|
|
501
|
+
* Only applies when not focused.
|
|
502
|
+
*/
|
|
503
|
+
showScrollDown?: boolean;
|
|
504
|
+
/**
|
|
505
|
+
* Show an up arrow indicator instead of pointer (for scroll hints).
|
|
506
|
+
* Only applies when not focused.
|
|
507
|
+
*/
|
|
508
|
+
showScrollUp?: boolean;
|
|
509
|
+
/**
|
|
510
|
+
* Whether to apply automatic styling to the children based on focus/selection state.
|
|
511
|
+
* - When true (default): children are wrapped in Text with state-based colors
|
|
512
|
+
* - When false: children are rendered as-is, allowing custom styling
|
|
513
|
+
* @default true
|
|
514
|
+
*/
|
|
515
|
+
styled?: boolean;
|
|
516
|
+
/**
|
|
517
|
+
* Whether this item is disabled. Disabled items show dimmed text and no indicators.
|
|
518
|
+
* @default false
|
|
519
|
+
*/
|
|
520
|
+
disabled?: boolean;
|
|
521
|
+
/**
|
|
522
|
+
* Whether this ListItem should declare the terminal cursor position.
|
|
523
|
+
* Set false when a child (e.g. BaseTextInput) declares its own cursor.
|
|
524
|
+
* @default true
|
|
525
|
+
*/
|
|
526
|
+
declareCursor?: boolean;
|
|
527
|
+
};
|
|
528
|
+
/**
|
|
529
|
+
* A list item component for selection UIs (dropdowns, multi-selects, menus).
|
|
530
|
+
*
|
|
531
|
+
* Handles the common pattern of:
|
|
532
|
+
* - Pointer indicator (❯) for focused items
|
|
533
|
+
* - Checkmark indicator (✓) for selected items
|
|
534
|
+
* - Scroll indicators (↓↑) for truncated lists
|
|
535
|
+
* - Color states for focus/selection
|
|
536
|
+
*
|
|
537
|
+
* @example
|
|
538
|
+
* // Basic usage in a selection list
|
|
539
|
+
* {options.map((option, i) => (
|
|
540
|
+
* <ListItem
|
|
541
|
+
* key={option.id}
|
|
542
|
+
* isFocused={focusIndex === i}
|
|
543
|
+
* isSelected={selectedId === option.id}
|
|
544
|
+
* >
|
|
545
|
+
* {option.label}
|
|
546
|
+
* </ListItem>
|
|
547
|
+
* ))}
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* // With scroll indicators
|
|
551
|
+
* <ListItem isFocused={false} showScrollUp>First visible item</ListItem>
|
|
552
|
+
* ...
|
|
553
|
+
* <ListItem isFocused={false} showScrollDown>Last visible item</ListItem>
|
|
554
|
+
*
|
|
555
|
+
* @example
|
|
556
|
+
* // With description
|
|
557
|
+
* <ListItem isFocused isSelected={false} description="Secondary text here">
|
|
558
|
+
* Primary text
|
|
559
|
+
* </ListItem>
|
|
560
|
+
*
|
|
561
|
+
* @example
|
|
562
|
+
* // Custom children styling (styled=false)
|
|
563
|
+
* <ListItem isFocused styled={false}>
|
|
564
|
+
* <Text color="claude">Custom styled content</Text>
|
|
565
|
+
* </ListItem>
|
|
566
|
+
*/
|
|
567
|
+
declare function ListItem({ isFocused, isSelected, children, description, showScrollDown, showScrollUp, styled, disabled, declareCursor, }: ListItemProps): React__default.ReactNode;
|
|
568
|
+
|
|
569
|
+
type LoadingStateProps = {
|
|
570
|
+
/** The loading message to display next to the spinner. */
|
|
571
|
+
message: string;
|
|
572
|
+
/**
|
|
573
|
+
* Display the message in bold.
|
|
574
|
+
* @default false
|
|
575
|
+
*/
|
|
576
|
+
bold?: boolean;
|
|
577
|
+
/**
|
|
578
|
+
* Display the message in dimmed color.
|
|
579
|
+
* @default false
|
|
580
|
+
*/
|
|
581
|
+
dimColor?: boolean;
|
|
582
|
+
/** Optional subtitle displayed below the main message. */
|
|
583
|
+
subtitle?: string;
|
|
584
|
+
};
|
|
585
|
+
/**
|
|
586
|
+
* A spinner with loading message for async operations.
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* <LoadingState message="Loading..." />
|
|
590
|
+
*
|
|
591
|
+
* @example
|
|
592
|
+
* <LoadingState message="Loading sessions" bold subtitle="Fetching your sessions..." />
|
|
593
|
+
*/
|
|
594
|
+
declare function LoadingState({ message, bold, dimColor, subtitle, }: LoadingStateProps): React__default.ReactNode;
|
|
595
|
+
|
|
596
|
+
type PaneProps = {
|
|
597
|
+
children: React__default.ReactNode;
|
|
598
|
+
color?: keyof Theme;
|
|
281
599
|
};
|
|
282
|
-
|
|
600
|
+
/**
|
|
601
|
+
* A pane -- a region of the terminal bounded by a colored top line with
|
|
602
|
+
* horizontal padding. Used by slash-command screens.
|
|
603
|
+
*/
|
|
604
|
+
declare function Pane({ children, color }: PaneProps): React__default.ReactNode;
|
|
605
|
+
|
|
606
|
+
type Props$1 = {
|
|
607
|
+
children: React__default.ReactNode;
|
|
608
|
+
lock?: 'always' | 'offscreen';
|
|
609
|
+
};
|
|
610
|
+
declare function Ratchet({ children, lock, }: Props$1): React__default.ReactNode;
|
|
611
|
+
|
|
612
|
+
type TabsProps = {
|
|
613
|
+
children: Array<React__default.ReactElement<TabProps>>;
|
|
614
|
+
title?: string;
|
|
615
|
+
color?: keyof Theme;
|
|
616
|
+
defaultTab?: string;
|
|
617
|
+
hidden?: boolean;
|
|
618
|
+
useFullWidth?: boolean;
|
|
619
|
+
selectedTab?: string;
|
|
620
|
+
onTabChange?: (tabId: string) => void;
|
|
621
|
+
banner?: React__default.ReactNode;
|
|
622
|
+
disableNavigation?: boolean;
|
|
623
|
+
};
|
|
624
|
+
declare function Tabs({ title, color, defaultTab, children, hidden, useFullWidth, selectedTab: controlledSelectedTab, onTabChange, banner, disableNavigation, }: TabsProps): React__default.ReactNode;
|
|
625
|
+
type TabProps = {
|
|
626
|
+
title: string;
|
|
627
|
+
id?: string;
|
|
628
|
+
children: React__default.ReactNode;
|
|
629
|
+
};
|
|
630
|
+
declare function Tab({ title, id, children }: TabProps): React__default.ReactNode;
|
|
631
|
+
declare function useTabsWidth(): number | undefined;
|
|
632
|
+
|
|
633
|
+
type Props = {
|
|
634
|
+
/** The items to join with a middot separator */
|
|
635
|
+
children: React__default.ReactNode;
|
|
636
|
+
};
|
|
637
|
+
/**
|
|
638
|
+
* Joins children with a middot separator (" · ") for inline metadata display.
|
|
639
|
+
*
|
|
640
|
+
* Named after the publishing term "byline" - the line of metadata typically
|
|
641
|
+
* shown below a title (e.g., "John Doe · 5 min read · Mar 12").
|
|
642
|
+
*
|
|
643
|
+
* Automatically filters out null/undefined/false children and only renders
|
|
644
|
+
* separators between valid elements.
|
|
645
|
+
*
|
|
646
|
+
* @example
|
|
647
|
+
* // Basic usage: "Enter to confirm · Esc to cancel"
|
|
648
|
+
* <Text dimColor>
|
|
649
|
+
* <Byline>
|
|
650
|
+
* <KeyboardShortcutHint shortcut="Enter" action="confirm" />
|
|
651
|
+
* <KeyboardShortcutHint shortcut="Esc" action="cancel" />
|
|
652
|
+
* </Byline>
|
|
653
|
+
* </Text>
|
|
654
|
+
*
|
|
655
|
+
* @example
|
|
656
|
+
* // With conditional children: "Esc to cancel" (only one item shown)
|
|
657
|
+
* <Text dimColor>
|
|
658
|
+
* <Byline>
|
|
659
|
+
* {showEnter && <KeyboardShortcutHint shortcut="Enter" action="confirm" />}
|
|
660
|
+
* <KeyboardShortcutHint shortcut="Esc" action="cancel" />
|
|
661
|
+
* </Byline>
|
|
662
|
+
* </Text>
|
|
663
|
+
*/
|
|
664
|
+
declare function Byline({ children }: Props): React__default.ReactNode;
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Curried theme-aware color function. Resolves theme keys to raw color
|
|
668
|
+
* values before delegating to the ink renderer's colorize.
|
|
669
|
+
*/
|
|
670
|
+
declare function color(c: keyof Theme | Color | undefined, theme: ThemeName, type?: ColorType): (text: string) => string;
|
|
283
671
|
|
|
284
|
-
export { type Command$1 as Command, type CommandBase, type CommandOnDone, CommandRegistry, type CommandResult, DEFAULT_BINDINGS, Divider, type JSXCommand, KeybindingSetup, type LocalCommand, type Message, MessageList, type MessageListProps, MultiSelect, type MultiSelectProps, ProgressBar, PromptInput, REPL, type REPLProps, Select, type SelectOption, type SelectProps, Spinner, StatusIcon, StatusLine, type StatusLineProps, type StatusLineSegment, StreamingText, type StreamingTextProps, clearCommand, createCommandRegistry, defineCommand, defineJSXCommand, defineLocalCommand, exitCommand, helpCommand, useKeybinding, useKeybindings, useStatusLine };
|
|
672
|
+
export { Byline, type Command$1 as Command, type CommandBase, type CommandOnDone, CommandRegistry, type CommandResult, DEFAULT_BINDINGS, Dialog, Divider, FuzzyPicker, type JSXCommand, KeybindingSetup, KeyboardShortcutHint, ListItem, LoadingState, type LocalCommand, Markdown, MarkdownTable, type Message, MessageList, type MessageListProps, MultiSelect, type MultiSelectProps, Pane, ProgressBar, PromptInput, REPL, type REPLProps, Ratchet, Select, type SelectOption, type SelectProps, Spinner, StatusIcon, StatusLine, type StatusLineProps, type StatusLineSegment, StreamingMarkdown, StreamingText, type StreamingTextProps, Tab, Tabs, type TerminalSize, TextHoverColorContext, type Theme, type ThemeName, ThemeProvider, type ThemeSetting, ThemedBox, type Props$5 as ThemedBoxProps, ThemedText, type Props$4 as ThemedTextProps, clearCommand, color, createCommandRegistry, defineCommand, defineJSXCommand, defineLocalCommand, exitCommand, getTheme, helpCommand, useDoublePress, useKeybinding, useKeybindings, usePreviewTheme, useStatusLine, useTabsWidth, useTerminalSize, useTheme, useThemeSetting };
|