diff --git a/.changeset/light-frogs-cry.md b/.changeset/light-frogs-cry.md new file mode 100644 index 0000000..8d69182 --- /dev/null +++ b/.changeset/light-frogs-cry.md @@ -0,0 +1,5 @@ +--- +'@openai/chatkit': minor +--- + +Added types for Table, Table.Row, and Table.Cell widget components diff --git a/packages/chatkit/types/widgets.d.ts b/packages/chatkit/types/widgets.d.ts index 2d8859a..20967dc 100644 --- a/packages/chatkit/types/widgets.d.ts +++ b/packages/chatkit/types/widgets.d.ts @@ -21,6 +21,9 @@ export type WidgetComponent = | Input | Label | RadioGroup + | Table + | TableRow + | TableCell | Textarea | Transition; @@ -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 = { @@ -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'