-
Notifications
You must be signed in to change notification settings - Fork 0
Implement UI components from @object-ui/types #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
396d940
d7c104c
1f5e322
8058f2f
45ba397
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import { ComponentRegistry } from '@object-ui/core'; | ||
| import { Chatbot, type ChatMessage } from '@/ui'; | ||
| import type { ChatbotSchema, ChatMessage } from '@object-ui/types'; | ||
| import { Chatbot } from '@/ui'; | ||
|
Comment on lines
+2
to
+3
|
||
| import { useState } from 'react'; | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| // Enterprise-level DataTable Component (Airtable-like) | ||
| import React, { useState, useMemo, useRef, useEffect } from 'react'; | ||
| import { ComponentRegistry } from '@object-ui/core'; | ||
| import type { DataTableSchema } from '@object-ui/types'; | ||
|
||
| import { | ||
| Table, | ||
| TableHeader, | ||
|
|
@@ -38,71 +39,6 @@ import { | |
|
|
||
| type SortDirection = 'asc' | 'desc' | null; | ||
|
|
||
| /** | ||
| * Column configuration for the data table. | ||
| * @interface Column | ||
| */ | ||
| interface Column { | ||
| /** Display name of the column */ | ||
| header: string; | ||
| /** Key to access the data field in each row object */ | ||
| accessorKey: string; | ||
| /** Optional CSS classes for the column header */ | ||
| className?: string; | ||
| /** Optional CSS classes for the column cells */ | ||
| cellClassName?: string; | ||
| /** Width of the column (e.g., '80px' or 80) */ | ||
| width?: string | number; | ||
| /** Whether sorting is enabled for this column (default: true) */ | ||
| sortable?: boolean; | ||
| /** Whether filtering is enabled for this column (default: true) */ | ||
| filterable?: boolean; | ||
| /** Whether column resizing is enabled (default: true) */ | ||
| resizable?: boolean; | ||
| } | ||
|
|
||
| /** | ||
| * Schema definition for the enterprise data table component. | ||
| * Supports sorting, pagination, search, row selection, CSV export, and row actions. | ||
| * @interface DataTableSchema | ||
| */ | ||
| interface DataTableSchema { | ||
| /** Optional caption text displayed above the table */ | ||
| caption?: string; | ||
| /** Array of column definitions */ | ||
| columns: Column[]; | ||
| /** Array of data objects to display. Each object should have an 'id' field for stable row identification */ | ||
| data: any[]; | ||
| /** Enable/disable pagination (default: true) */ | ||
| pagination?: boolean; | ||
| /** Number of rows per page (default: 10) */ | ||
| pageSize?: number; | ||
| /** Enable/disable search across all columns (default: true) */ | ||
| searchable?: boolean; | ||
| /** Enable/disable row selection with checkboxes (default: false) */ | ||
| selectable?: boolean; | ||
| /** Enable/disable column sorting (default: true) */ | ||
| sortable?: boolean; | ||
| /** Enable/disable CSV export button (default: false) */ | ||
| exportable?: boolean; | ||
| /** Show/hide edit and delete action buttons for each row (default: false) */ | ||
| rowActions?: boolean; | ||
| /** Enable/disable column resizing by dragging (default: true) */ | ||
| resizableColumns?: boolean; | ||
| /** Enable/disable column reordering by dragging (default: true) */ | ||
| reorderableColumns?: boolean; | ||
| /** Callback function triggered when the edit button is clicked */ | ||
| onRowEdit?: (row: any) => void; | ||
| /** Callback function triggered when the delete button is clicked */ | ||
| onRowDelete?: (row: any) => void; | ||
| /** Callback function triggered when row selection changes, receives array of selected rows */ | ||
| onSelectionChange?: (selectedRows: any[]) => void; | ||
| /** Callback function triggered when columns are reordered */ | ||
| onColumnsReorder?: (columns: Column[]) => void; | ||
| /** Optional CSS classes for the table container */ | ||
| className?: string; | ||
| } | ||
|
|
||
| /** | ||
| * Enterprise-level data table component with Airtable-like features. | ||
| * | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| import { ComponentRegistry } from '@object-ui/core'; | ||
| import { FilterBuilder, type FilterGroup } from '@/ui/filter-builder'; | ||
| import type { FilterBuilderSchema, FilterGroup } from '@object-ui/types'; | ||
| import { FilterBuilder } from '@/ui/filter-builder'; | ||
|
Comment on lines
+2
to
+3
|
||
|
|
||
| ComponentRegistry.register('filter-builder', | ||
| ({ schema, className, onChange, ...props }) => { | ||
| ({ schema, className, onChange, ...props }: { schema: FilterBuilderSchema; className?: string; onChange?: (event: any) => void; [key: string]: any }) => { | ||
| const handleChange = (value: FilterGroup) => { | ||
| if (onChange) { | ||
| onChange({ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| // table.tsx implementation | ||
| import { ComponentRegistry } from '@object-ui/core'; | ||
| import type { TableSchema } from '@object-ui/types'; | ||
|
||
| import { | ||
| Table, | ||
| TableHeader, | ||
|
|
@@ -13,7 +14,7 @@ import { | |
|
|
||
| // A simple data-driven table | ||
| ComponentRegistry.register('table', | ||
| ({ schema, className, ...props }) => ( | ||
| ({ schema, className, ...props }: { schema: TableSchema; className?: string; [key: string]: any }) => ( | ||
| <Table className={className} {...props}> | ||
| {schema.caption && <TableCaption>{schema.caption}</TableCaption>} | ||
| <TableHeader> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import { ComponentRegistry } from '@object-ui/core'; | ||
| import type { TimelineSchema } from '@object-ui/types'; | ||
|
||
| import { | ||
| Timeline, | ||
| TimelineItem, | ||
|
|
@@ -78,7 +79,7 @@ function formatDate(dateString: string, format?: string): string { | |
|
|
||
| ComponentRegistry.register( | ||
| 'timeline', | ||
| ({ schema, className, ...props }) => { | ||
| ({ schema, className, ...props }: { schema: TimelineSchema; className?: string; [key: string]: any }) => { | ||
| const { | ||
| variant = 'vertical', | ||
| items = [], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,9 @@ | ||
| import { ComponentRegistry } from '@object-ui/core'; | ||
| import type { TreeViewSchema, TreeNode } from '@object-ui/types'; | ||
|
||
| import { ChevronRight, ChevronDown, Folder, File } from 'lucide-react'; | ||
| import { useState } from 'react'; | ||
| import { cn } from '@/lib/utils'; | ||
|
|
||
| interface TreeNode { | ||
| id: string; | ||
| label: string; | ||
| icon?: string; | ||
| children?: TreeNode[]; | ||
| data?: any; | ||
| } | ||
|
|
||
| const TreeNodeComponent = ({ | ||
| node, | ||
| level = 0, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import statement is changing from importing CalendarEvent from the UI library to importing it from @object-ui/types. Verify that CalendarEvent is correctly exported from @object-ui/types and that the type definition matches what the CalendarView component expects. This is a potential breaking change if the types are not compatible.