Skip to content

Commit 3cc21d4

Browse files
authored
Merge pull request #28 from objectstack-ai/copilot/implement-ui-components
2 parents 8b8a99d + 45ba397 commit 3cc21d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+137
-186
lines changed

packages/components/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"@dnd-kit/utilities": "^3.2.2",
2626
"@object-ui/core": "workspace:*",
2727
"@object-ui/react": "workspace:*",
28+
"@object-ui/types": "workspace:*",
2829
"@radix-ui/react-accordion": "^1.2.12",
2930
"@radix-ui/react-alert-dialog": "^1.1.15",
3031
"@radix-ui/react-aspect-ratio": "^1.1.8",

packages/components/src/renderers/basic/div.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { ComponentRegistry } from '@object-ui/core';
2+
import type { DivSchema } from '@object-ui/types';
23
import { renderChildren } from '../../lib/utils';
34

45
ComponentRegistry.register('div',
5-
({ schema, className, ...props }) => (
6+
({ schema, className, ...props }: { schema: DivSchema; className?: string; [key: string]: any }) => (
67
<div className={className} {...props}>
78
{renderChildren(schema.body)}
89
</div>

packages/components/src/renderers/basic/icon.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { ComponentRegistry } from '@object-ui/core';
2+
import type { IconSchema } from '@object-ui/types';
23
import { icons } from 'lucide-react';
34

45
ComponentRegistry.register('icon',
5-
({ schema, className, ...props }) => {
6+
({ schema, className, ...props }: { schema: IconSchema; className?: string; [key: string]: any }) => {
67
const Icon = (icons as any)[schema.name || schema.icon];
78
if (!Icon) return null;
89
return <Icon className={className} {...props} />;

packages/components/src/renderers/basic/image.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ComponentRegistry } from '@object-ui/core';
2+
import type { ImageSchema } from '@object-ui/types';
23

34
ComponentRegistry.register('image',
4-
({ schema, className, ...props }) => (
5+
({ schema, className, ...props }: { schema: ImageSchema; className?: string; [key: string]: any }) => (
56
<img
67
src={schema.src}
78
alt={schema.alt || ''}

packages/components/src/renderers/basic/separator.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { ComponentRegistry } from '@object-ui/core';
2+
import type { SeparatorSchema } from '@object-ui/types';
23
import { Separator } from '@/ui';
34

45
ComponentRegistry.register('separator',
5-
({ className, ...props }) => (
6-
<Separator className={className} {...props} />
6+
({ schema, className, ...props }: { schema: SeparatorSchema; className?: string; [key: string]: any }) => (
7+
<Separator orientation={schema.orientation} className={className} {...props} />
78
),
89
{
910
label: 'Separator',

packages/components/src/renderers/basic/span.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { ComponentRegistry } from '@object-ui/core';
2+
import type { SpanSchema } from '@object-ui/types';
23
import { renderChildren } from '../../lib/utils';
34

45
ComponentRegistry.register('span',
5-
({ schema, className, ...props }) => (
6+
({ schema, className, ...props }: { schema: SpanSchema; className?: string; [key: string]: any }) => (
67
<span className={className} {...props}>
78
{renderChildren(schema.body)}
89
</span>

packages/components/src/renderers/basic/text.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ComponentRegistry } from '@object-ui/core';
2+
import type { TextSchema } from '@object-ui/types';
23

34
ComponentRegistry.register('text',
4-
({ schema }) => (
5+
({ schema }: { schema: TextSchema }) => (
56
<>{schema.content}</>
67
),
78
{

packages/components/src/renderers/complex/calendar-view.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { ComponentRegistry } from '@object-ui/core';
2-
import { CalendarView, type CalendarEvent } from '@/ui';
2+
import type { CalendarViewSchema, CalendarEvent } from '@object-ui/types';
3+
import { CalendarView } from '@/ui';
34
import React from 'react';
45

56
// Calendar View Renderer - Airtable-style calendar for displaying records as events
67
ComponentRegistry.register('calendar-view',
7-
({ schema, className, onAction, ...props }) => {
8+
({ schema, className, onAction, ...props }: { schema: CalendarViewSchema; className?: string; onAction?: (action: any) => void; [key: string]: any }) => {
89
// Transform schema data to CalendarEvent format
910
const events: CalendarEvent[] = React.useMemo(() => {
1011
if (!schema.data || !Array.isArray(schema.data)) return [];

packages/components/src/renderers/complex/carousel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ComponentRegistry } from '@object-ui/core';
2+
import type { CarouselSchema } from '@object-ui/types';
23
import {
34
Carousel,
45
CarouselContent,
@@ -9,7 +10,7 @@ import {
910
import { renderChildren } from '../../lib/utils';
1011

1112
ComponentRegistry.register('carousel',
12-
({ schema, className, ...props }) => (
13+
({ schema, className, ...props }: { schema: CarouselSchema; className?: string; [key: string]: any }) => (
1314
<Carousel
1415
opts={schema.opts}
1516
orientation={schema.orientation || 'horizontal'}

packages/components/src/renderers/complex/chatbot.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ComponentRegistry } from '@object-ui/core';
2-
import { Chatbot, type ChatMessage } from '@/ui';
2+
import type { ChatbotSchema, ChatMessage } from '@object-ui/types';
3+
import { Chatbot } from '@/ui';
34
import { useState } from 'react';
45

56
/**

0 commit comments

Comments
 (0)