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
26 changes: 25 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,28 @@ export const InputRenderer = ({ schema, value, onChange }: Props) => {
)}
</div>
);
};
};

```

---

## 6. AI Workflow Instructions

### 🟢 On "Create New Component":

1. **Define Protocol:** Create `interface XSchema` in `@object-ui/types`.
2. **Implement UI:** Create `XRenderer` in `@object-ui/components` using Shadcn primitives.
3. **Register:** Add to the default component registry.
4. **Standalone Check:** Ask yourself: *"Can a user use this component with a static JSON array?"* If no, refactor data logic to `DataSource`.

### 🟡 On "Data Fetching Logic":

1. **Abstraction:** Never import `axios` or `fetch` directly in a UI component.
2. **Hook:** Use `useDataSource()` or `useDataScope()` to request data.
3. **Example:** For an Autocomplete, call `dataSource.find({ search: term })`, allowing the user to inject *any* data source (REST API, Algolia, or local array).

### 🟣 On "Promoting the Project":

1. **Keywords:** Focus on "Tailwind-Native", "Headless", "Shadcn Compatible".
2. **Differentiation:** Emphasize that unlike other low-code renderers, Object UI allows full styling control via standard Tailwind classes.
122 changes: 122 additions & 0 deletions apps/playground/src/data/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,127 @@ export const examples = {
]
}`,

'kanban-board': `{
"type": "kanban",
"className": "w-full h-[600px]",
"columns": [
{
"id": "backlog",
"title": "📋 Backlog",
"cards": [
{
"id": "card-1",
"title": "User Authentication",
"description": "Implement user login and registration flow",
"badges": [
{ "label": "Feature", "variant": "default" },
{ "label": "High Priority", "variant": "destructive" }
]
},
{
"id": "card-2",
"title": "API Documentation",
"description": "Write comprehensive API docs",
"badges": [
{ "label": "Documentation", "variant": "outline" }
]
},
{
"id": "card-3",
"title": "Database Optimization",
"description": "Improve query performance",
"badges": [
{ "label": "Performance", "variant": "secondary" }
]
}
]
},
{
"id": "todo",
"title": "📝 To Do",
"cards": [
{
"id": "card-4",
"title": "Design Landing Page",
"description": "Create wireframes and mockups",
"badges": [
{ "label": "Design", "variant": "default" }
]
},
{
"id": "card-5",
"title": "Setup CI/CD Pipeline",
"description": "Configure GitHub Actions",
"badges": [
{ "label": "DevOps", "variant": "secondary" }
]
}
]
},
{
"id": "in-progress",
"title": "⚙️ In Progress",
"limit": 3,
"cards": [
{
"id": "card-6",
"title": "Payment Integration",
"description": "Integrate Stripe payment gateway",
"badges": [
{ "label": "Feature", "variant": "default" },
{ "label": "In Progress", "variant": "secondary" }
]
},
{
"id": "card-7",
"title": "Bug Fix: Login Issue",
"description": "Fix session timeout bug",
"badges": [
{ "label": "Bug", "variant": "destructive" }
]
}
]
},
{
"id": "review",
"title": "👀 Review",
"cards": [
{
"id": "card-8",
"title": "Dashboard Analytics",
"description": "Add charts and metrics",
"badges": [
{ "label": "Feature", "variant": "default" },
{ "label": "Needs Review", "variant": "outline" }
]
}
]
},
{
"id": "done",
"title": "✅ Done",
"cards": [
{
"id": "card-9",
"title": "Project Setup",
"description": "Initialize repository and dependencies",
"badges": [
{ "label": "Completed", "variant": "outline" }
]
},
{
"id": "card-10",
"title": "Basic Layout",
"description": "Create header and navigation",
"badges": [
{ "label": "Completed", "variant": "outline" }
]
}
]
}
]
}`,

// Enterprise Data Table - Airtable-like functionality
'enterprise-table': `{
"type": "div",
Expand Down Expand Up @@ -1129,4 +1250,5 @@ export const exampleCategories = {
'Layouts': ['grid-layout', 'dashboard', 'tabs-demo'],
'Data Display': ['calendar-view', 'enterprise-table', 'data-table-simple'],
'Forms': ['form-demo', 'airtable-form'],
'Complex': ['kanban-board']
};
3 changes: 3 additions & 0 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"test": "vitest run"
},
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^8.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@object-ui/core": "workspace:*",
"@object-ui/react": "workspace:*",
"@radix-ui/react-accordion": "^1.2.12",
Expand Down
208 changes: 208 additions & 0 deletions packages/components/src/renderers/complex/README-KANBAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
# Kanban Board Component

A fully functional, schema-driven Kanban board component for Object UI with drag-and-drop support.

## Features

- **Multiple Columns**: Create unlimited columns with customizable titles
- **Rich Cards**: Cards support title, description, and multiple badges
- **Drag & Drop**: Smooth drag-and-drop functionality powered by @dnd-kit
- **Reordering**: Reorder cards within the same column
- **Cross-Column Moves**: Move cards between different columns
- **Column Limits**: Optional capacity limits with visual indicators
- **Card Counters**: Shows current count and limit per column
- **Schema-Driven**: Configure entirely through JSON/YAML
- **Event Callbacks**: Custom event handling for card movements

## Usage

### Basic Example

```json
{
"type": "kanban",
"className": "w-full h-[600px]",
"columns": [
{
"id": "todo",
"title": "To Do",
"cards": [
{
"id": "card-1",
"title": "Task Title",
"description": "Task description",
"badges": [
{ "label": "High Priority", "variant": "destructive" }
]
}
]
},
{
"id": "in-progress",
"title": "In Progress",
"limit": 3,
"cards": []
},
{
"id": "done",
"title": "Done",
"cards": []
}
]
}
```

### With Event Handling

```json
{
"type": "kanban",
"columns": [...],
"onCardMove": "(event) => { console.log('Card moved:', event); }"
}
```

## Schema Reference

### Kanban Props

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `type` | `"kanban"` | Yes | Component type identifier |
| `columns` | `KanbanColumn[]` | Yes | Array of column configurations |
| `className` | `string` | No | Custom CSS classes |
| `onCardMove` | `function` | No | Callback when a card is moved |

### KanbanColumn

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `id` | `string` | Yes | Unique column identifier |
| `title` | `string` | Yes | Column header title |
| `cards` | `KanbanCard[]` | Yes | Array of cards in this column |
| `limit` | `number` | No | Maximum number of cards allowed |
| `className` | `string` | No | Custom CSS classes for column |

### KanbanCard

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `id` | `string` | Yes | Unique card identifier |
| `title` | `string` | Yes | Card title |
| `description` | `string` | No | Card description text |
| `badges` | `Badge[]` | No | Array of badge objects |

### Badge

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `label` | `string` | Yes | Badge text |
| `variant` | `"default" \| "secondary" \| "destructive" \| "outline"` | No | Badge color variant |

## Examples

### Simple Task Board

```json
{
"type": "kanban",
"columns": [
{
"id": "backlog",
"title": "📋 Backlog",
"cards": [
{
"id": "1",
"title": "Setup project",
"badges": [{ "label": "Setup" }]
}
]
},
{
"id": "doing",
"title": "🚀 Doing",
"limit": 2,
"cards": []
},
{
"id": "done",
"title": "✅ Done",
"cards": []
}
]
}
```

### Issue Tracking Board

```json
{
"type": "kanban",
"columns": [
{
"id": "new",
"title": "New Issues",
"cards": [
{
"id": "issue-1",
"title": "Bug: Login fails on Safari",
"description": "Users can't login using Safari browser",
"badges": [
{ "label": "Bug", "variant": "destructive" },
{ "label": "P0", "variant": "destructive" }
]
}
]
},
{
"id": "investigating",
"title": "Investigating",
"limit": 3,
"cards": []
},
{
"id": "fixed",
"title": "Fixed",
"cards": []
}
]
}
```

## Styling

The Kanban component uses Tailwind CSS and can be customized using the `className` prop:

```json
{
"type": "kanban",
"className": "w-full h-[800px] bg-gray-50 p-4 rounded-lg",
"columns": [...]
}
```

Individual columns can also be styled:

```json
{
"id": "urgent",
"title": "🔥 Urgent",
"className": "bg-red-50",
"cards": [...]
}
```

## Technical Details

- Built with React 18+ and TypeScript
- Uses @dnd-kit for drag-and-drop functionality
- Integrates with Shadcn UI components (Card, Badge, ScrollArea)
- Supports both pointer and touch interactions
- Accessible keyboard navigation (via @dnd-kit)

## Browser Support

- Chrome/Edge: Full support
- Firefox: Full support
- Safari: Full support
- Mobile browsers: Full support with touch gestures
4 changes: 2 additions & 2 deletions packages/components/src/renderers/complex/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import './calendar-view';
import './carousel';
import './kanban';
import './filter-builder';
import './scroll-area';
import './resizable';
import './scroll-area';
import './table';
import './data-table';
import './timeline';
import './calendar-view';

Loading