import type { ChannelNode } from "./ir.js"; import type { ClickHandler, MessageReactionHandler } from "./types.js"; /** * Anything that can appear as a child in the component tree: nested elements, * text, numbers, and conditionals (`false` / `null` / `undefined` render * nothing), plus arrays thereof. */ export type BotChildren = ChannelNode | string | number | boolean | null | undefined | BotChildren[]; /** Mixin for the container components that wrap children. */ interface WithChildren { children?: BotChildren; } export interface MessageProps extends WithChildren { /** Accent color (hex, e.g. `#27AE60`) for the message's colored rail. */ accent?: string; /** Plain-text notification and screen-reader summary for rich Slack output. */ fallbackText?: string; /** * Called when a user reacts to this message (add or remove). The first arg is * the emoji, e.g. `onReaction={(r) => r === "bug" ? triage() : ack()}`; the * second carries `added`/`user`/`rawEmoji` plus a `thread` and the reacted * message's `messageRef` — the same surface an `onClick` gets, so the handler * can `thread.post(...)`, `thread.update(messageRef, ...)`, or run a HITL flow. * Durable on the same terms as a component `onClick`: survives a restart when * the `` comes from a registered component and a durable store is * configured; inline handlers route in-process only. */ onReaction?: MessageReactionHandler; } export interface HeaderProps extends WithChildren { } export interface SectionProps extends WithChildren { } export interface MarkdownProps extends WithChildren { } export interface FieldsProps extends WithChildren { } export interface FieldProps extends WithChildren { /** * Bold label rendered before the value (e.g. `Online`). * Rendered on Discord, Slack, and Telegram; surfaces without a field label * concept fall back to the value text alone. */ label?: string; } export interface ContextProps extends WithChildren { } export interface ActionsProps extends WithChildren { } export interface ImageProps { /** Image URL. */ url: string; /** Alternative text for accessibility. */ alt?: string; } /** `` takes no props or children. */ export type DividerProps = { children?: never; }; export interface ButtonProps extends WithChildren { /** * Inline handler run when the button is clicked (bound by the action * registry). Its `ctx.action.value` is typed as `TValue`, inferred from * `value`. Ignored when `url` is set (a link button doesn't dispatch). */ onClick?: ClickHandler; /** Value echoed back to `onClick`/`awaitChoice` on click; drives `TValue`. */ value?: TValue; /** * Makes this a link button that opens `url` instead of dispatching a handler. * Rendered natively on Slack, Discord, Teams, and Telegram; surfaces without * link buttons skip it. When set, `onClick`/`value` are ignored. */ url?: string; /** Slack button accent. */ style?: "primary" | "danger"; } export interface SelectOption { label: string; value: string; } export interface SelectProps { /** Stable field key used when a provider submits this select with a form. */ name?: string; /** * Handler run on selection. `ctx.action.value` is the chosen option's `value` * (a `string`), or a `string[]` of chosen values when `multi` is set. */ onSelect?: ClickHandler; placeholder?: string; options: SelectOption[]; /** * Allow selecting multiple options. Rendered natively on Slack * (`multi_static_select`), Discord (max-values), and Teams * (`isMultiSelect`); surfaces that can only express a single choice * (Telegram, WhatsApp) degrade to single-select. When set, `onSelect` * receives a `string[]`. */ multi?: boolean; } export interface InputProps { /** Handler run on submit; `ctx.action.value` is the entered text. */ onSubmit?: ClickHandler; placeholder?: string; multiline?: boolean; /** Stable field key used when a provider submits this input with a form. */ name?: string; } export interface TableColumn { header: string; align?: "left" | "center" | "right"; } export interface TableProps extends WithChildren { columns?: TableColumn[]; } export interface RowProps extends WithChildren { } export interface CellProps extends WithChildren { } /** The chart kinds a surface can render. Platforms that don't support a native * chart simply skip the node (the renderer is total). */ export type ChartType = "verticalBar" | "horizontalBar" | "line" | "pie" | "donut"; /** One `(label, value)` datum. `label` is the category/x value, `value` the * numeric y value (or the slice size for pie/donut). */ export interface ChartDataPoint { label: string; value: number; } export interface ChartProps { /** Chart kind; defaults to `verticalBar`. */ type?: ChartType; /** Title shown above the chart. */ title?: string; /** Axis titles (cartesian charts only — bar/line; ignored for pie/donut). */ xAxisTitle?: string; yAxisTitle?: string; /** The data to plot — one entry per category. */ data: ChartDataPoint[]; } export declare const intrinsic:

(type: string) => (props: P) => ChannelNode; export declare const Message: (props: MessageProps) => ChannelNode; export declare const Header: (props: HeaderProps) => ChannelNode; export declare const Section: (props: SectionProps) => ChannelNode; export declare const Markdown: (props: MarkdownProps) => ChannelNode; export declare const Field: (props: FieldProps) => ChannelNode; export declare const Fields: (props: FieldsProps) => ChannelNode; export declare const Context: (props: ContextProps) => ChannelNode; export declare const Actions: (props: ActionsProps) => ChannelNode; export declare const Image: (props: ImageProps) => ChannelNode; export declare const Divider: (props: DividerProps) => ChannelNode; export declare const Chart: (props: ChartProps) => ChannelNode; export declare const Row: (props: RowProps) => ChannelNode; export declare const Cell: (props: CellProps) => ChannelNode; export declare function Button(props: ButtonProps): ChannelNode; export declare function Select(props: SelectProps): ChannelNode; export declare function Input(props: InputProps): ChannelNode; export declare function Table(props: TableProps): ChannelNode; export {}; //# sourceMappingURL=components.d.ts.map