Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/light-frogs-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openai/chatkit': minor
---

Added types for Table, Table.Row, and Table.Cell widget components
35 changes: 35 additions & 0 deletions packages/chatkit/types/widgets.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export type WidgetComponent =
| Input
| Label
| RadioGroup
| Table
| TableRow
| TableCell
| Textarea
| Transition;

Expand Down Expand Up @@ -247,6 +250,35 @@ export type Button = {
disabled?: boolean;
};

type Table = {
type: 'Table';
key?: string;
id?: string;
children?: TableRow[];
};

type TableRow = {
type: 'Table.Row';
key?: string;
id?: string;
children?: TableCell[];
header?: boolean;
};

export type TableCell = {
type: 'Table.Cell';
key?: string;
id?: string;
children?: WidgetComponent[];
width?: number | string;
padding?: Spacing;
colSpan?: number;
rowSpan?: number;
align?: TableCellAlignValue;
vAlign?: TableCellAlignValue;
colSize?: TableColSize;
};

// Form Controls

export type Input = {
Expand Down Expand Up @@ -495,6 +527,9 @@ type BaseTextProps = {
maxLines?: number;
};

type TableCellAlignValue = 'start' | 'center' | 'end';
type TableColSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';

export type WidgetIcon =
| 'agent'
| 'analytics'
Expand Down