Skip to content

Commit d8ffdf7

Browse files
Copilothotlong
andcommitted
Complete chatbot and timeline plugin extraction with renderers and docs
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 3f307da commit d8ffdf7

9 files changed

Lines changed: 245 additions & 57 deletions

File tree

packages/components/src/renderers/complex/chatbot.test.ts

Lines changed: 0 additions & 52 deletions
This file was deleted.

packages/components/src/renderers/complex/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import './filter-builder';
1212
import './scroll-area';
1313
import './resizable';
1414
import './table';
15-
import './chatbot';
1615
import './data-table';
17-
import './timeline';
16+
1817

packages/plugin-chatbot/README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# @object-ui/plugin-chatbot
2+
3+
Chatbot interface plugin for Object UI.
4+
5+
## Installation
6+
7+
```bash
8+
npm install @object-ui/plugin-chatbot
9+
```
10+
11+
## Usage
12+
13+
```tsx
14+
import { Chatbot } from '@object-ui/plugin-chatbot';
15+
16+
function App() {
17+
const [messages, setMessages] = useState([
18+
{
19+
id: '1',
20+
role: 'assistant',
21+
content: 'Hello! How can I help you today?'
22+
}
23+
]);
24+
25+
const handleSend = (content: string) => {
26+
const newMessage = {
27+
id: Date.now().toString(),
28+
role: 'user',
29+
content
30+
};
31+
setMessages([...messages, newMessage]);
32+
};
33+
34+
return (
35+
<Chatbot
36+
messages={messages}
37+
onSendMessage={handleSend}
38+
placeholder="Type your message..."
39+
/>
40+
);
41+
}
42+
```
43+
44+
## Schema-Driven Usage
45+
46+
This plugin automatically registers with ObjectUI's component registry when imported:
47+
48+
```tsx
49+
import '@object-ui/plugin-chatbot';
50+
51+
const schema = {
52+
component: 'chatbot',
53+
messages: [
54+
{ id: '1', role: 'assistant', content: 'Hello!' }
55+
],
56+
placeholder: 'Type your message...',
57+
autoResponse: true
58+
};
59+
```
60+
61+
## License
62+
63+
MIT © ObjectStack Inc.

packages/plugin-chatbot/src/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,3 +243,6 @@ const TypingIndicator = React.forwardRef<HTMLDivElement, TypingIndicatorProps>(
243243
TypingIndicator.displayName = "TypingIndicator"
244244

245245
export { Chatbot, TypingIndicator }
246+
247+
// Export renderer to register the component with ObjectUI
248+
export * from './renderer';

packages/components/src/renderers/complex/chatbot.tsx renamed to packages/plugin-chatbot/src/renderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { ComponentRegistry } from '@object-ui/core';
1010
import type { ChatbotSchema, ChatMessage } from '@object-ui/types';
11-
import { Chatbot } from '../../ui';
11+
import { Chatbot } from './index';
1212
import { useState } from 'react';
1313

1414
/**

packages/plugin-timeline/README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# @object-ui/plugin-timeline
2+
3+
Timeline component plugin for Object UI with support for vertical, horizontal, and Gantt-style timelines.
4+
5+
## Installation
6+
7+
```bash
8+
npm install @object-ui/plugin-timeline
9+
```
10+
11+
## Usage
12+
13+
### Vertical Timeline
14+
15+
```tsx
16+
import {
17+
Timeline,
18+
TimelineItem,
19+
TimelineMarker,
20+
TimelineContent,
21+
TimelineTitle,
22+
TimelineTime,
23+
TimelineDescription
24+
} from '@object-ui/plugin-timeline';
25+
26+
function App() {
27+
return (
28+
<Timeline>
29+
<TimelineItem>
30+
<TimelineMarker variant="success" />
31+
<TimelineContent>
32+
<TimelineTime>2024-01-15</TimelineTime>
33+
<TimelineTitle>Project Started</TimelineTitle>
34+
<TimelineDescription>
35+
Kickoff meeting and initial planning
36+
</TimelineDescription>
37+
</TimelineContent>
38+
</TimelineItem>
39+
</Timeline>
40+
);
41+
}
42+
```
43+
44+
### Gantt Timeline
45+
46+
```tsx
47+
import {
48+
TimelineGantt,
49+
TimelineGanttHeader,
50+
TimelineGanttRow,
51+
TimelineGanttBar
52+
} from '@object-ui/plugin-timeline';
53+
54+
// See examples in the source code for Gantt usage
55+
```
56+
57+
## Schema-Driven Usage
58+
59+
This plugin automatically registers with ObjectUI's component registry when imported:
60+
61+
```tsx
62+
import '@object-ui/plugin-timeline';
63+
64+
const schema = {
65+
component: 'timeline',
66+
variant: 'vertical',
67+
items: [
68+
{
69+
time: '2024-01-15',
70+
title: 'Project Started',
71+
description: 'Kickoff meeting',
72+
variant: 'success'
73+
}
74+
]
75+
};
76+
```
77+
78+
## License
79+
80+
MIT © ObjectStack Inc.

packages/plugin-timeline/src/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,6 @@ export {
272272
TimelineGanttBar,
273273
TimelineGanttBarContent,
274274
}
275+
276+
// Export renderer to register the component with ObjectUI
277+
export * from './renderer';

packages/components/src/renderers/complex/timeline.tsx renamed to packages/plugin-timeline/src/renderer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import {
2626
TimelineGanttLabel,
2727
TimelineGanttBar,
2828
TimelineGanttBarContent,
29-
} from '../../ui';
30-
import { renderChildren } from '../../lib/utils';
29+
} from './index';
30+
import { renderChildren } from '@object-ui/components';
3131

3232
// Constants
3333
const MILLISECONDS_PER_WEEK = 7 * 24 * 60 * 60 * 1000;

pnpm-lock.yaml

Lines changed: 92 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)