Skip to content

Commit c3b5604

Browse files
authored
Merge pull request #203 from objectstack-ai/copilot/audit-non-standard-components-again
2 parents 300f04f + 0be1d04 commit c3b5604

File tree

11 files changed

+231
-43
lines changed

11 files changed

+231
-43
lines changed

packages/components/shadcn-components.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,14 @@
252252
"dependencies": ["button"]
253253
},
254254
"calendar-view": {
255-
"description": "Custom ObjectUI component - Full calendar view",
256-
"dependencies": ["calendar"]
255+
"description": "Custom ObjectUI component - Full calendar view (moved to @object-ui/plugin-calendar-view)",
256+
"dependencies": ["calendar"],
257+
"movedToPlugin": "@object-ui/plugin-calendar-view"
257258
},
258259
"chatbot": {
259-
"description": "Custom ObjectUI component - Chatbot interface",
260-
"dependencies": ["card", "input", "button"]
260+
"description": "Custom ObjectUI component - Chatbot interface (moved to @object-ui/plugin-chatbot)",
261+
"dependencies": ["card", "input", "button"],
262+
"movedToPlugin": "@object-ui/plugin-chatbot"
261263
},
262264
"combobox": {
263265
"description": "Custom ObjectUI component - Combo box (select + input)",
@@ -296,8 +298,9 @@
296298
"dependencies": []
297299
},
298300
"timeline": {
299-
"description": "Custom ObjectUI component - Timeline component",
300-
"dependencies": []
301+
"description": "Custom ObjectUI component - Timeline component (moved to @object-ui/plugin-timeline)",
302+
"dependencies": [],
303+
"movedToPlugin": "@object-ui/plugin-timeline"
301304
},
302305
"toaster": {
303306
"description": "Custom ObjectUI component - Toast container",

packages/components/src/__tests__/complex-disclosure-renderers.test.tsx

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -224,29 +224,6 @@ describe('Complex Renderers - Display Issue Detection', () => {
224224
});
225225
});
226226

227-
describe('Calendar View Renderer', () => {
228-
it('should be properly registered', () => {
229-
const validation = validateComponentRegistration('calendar-view');
230-
expect(validation.isRegistered).toBe(true);
231-
});
232-
233-
it('should render calendar view', () => {
234-
const { container } = renderComponent({
235-
type: 'calendar-view',
236-
events: [
237-
{
238-
id: '1',
239-
title: 'Event 1',
240-
start: '2024-01-01',
241-
end: '2024-01-01',
242-
},
243-
],
244-
});
245-
246-
expect(container).toBeDefined();
247-
});
248-
});
249-
250227
describe('Table Renderer', () => {
251228
it('should be properly registered', () => {
252229
const validation = validateComponentRegistration('table');

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
import './calendar-view';
109
import './carousel';
1110
import './filter-builder';
1211
import './scroll-area';

packages/components/src/ui/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export * from './breadcrumb';
1616
export * from './button-group';
1717
export * from './button';
1818
export * from './calendar';
19-
export * from './calendar-view';
2019
export * from './card';
2120
export * from './carousel';
2221
export * from './checkbox';
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# @object-ui/plugin-calendar-view
2+
3+
Full-featured calendar view plugin for Object UI with month, week, and day views.
4+
5+
## Installation
6+
7+
```bash
8+
npm install @object-ui/plugin-calendar-view
9+
```
10+
11+
## Usage
12+
13+
```tsx
14+
import { CalendarView } from '@object-ui/plugin-calendar-view';
15+
16+
const events = [
17+
{
18+
id: 1,
19+
title: 'Team Meeting',
20+
start: new Date(2024, 0, 15, 10, 0),
21+
end: new Date(2024, 0, 15, 11, 0),
22+
},
23+
// ... more events
24+
];
25+
26+
function App() {
27+
return (
28+
<CalendarView
29+
events={events}
30+
view="month"
31+
onEventClick={(event) => console.log('Event clicked:', event)}
32+
onDateClick={(date) => console.log('Date clicked:', date)}
33+
/>
34+
);
35+
}
36+
```
37+
38+
## Features
39+
40+
- Month, week, and day views
41+
- Event handling and display
42+
- Customizable event colors
43+
- All-day and timed events
44+
- Responsive design
45+
- Built with Tailwind CSS and Shadcn UI
46+
47+
## License
48+
49+
MIT
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"name": "@object-ui/plugin-calendar-view",
3+
"version": "0.3.0",
4+
"type": "module",
5+
"license": "MIT",
6+
"description": "Calendar view plugin for Object UI",
7+
"homepage": "https://www.objectui.org",
8+
"repository": {
9+
"type": "git",
10+
"url": "https://github.com/objectstack-ai/objectui.git",
11+
"directory": "packages/plugin-calendar-view"
12+
},
13+
"bugs": {
14+
"url": "https://github.com/objectstack-ai/objectui/issues"
15+
},
16+
"main": "dist/index.umd.cjs",
17+
"module": "dist/index.js",
18+
"types": "dist/index.d.ts",
19+
"exports": {
20+
".": {
21+
"types": "./dist/index.d.ts",
22+
"import": "./dist/index.js",
23+
"require": "./dist/index.umd.cjs"
24+
}
25+
},
26+
"scripts": {
27+
"build": "vite build",
28+
"test": "vitest run",
29+
"test:watch": "vitest",
30+
"type-check": "tsc --noEmit",
31+
"lint": "eslint ."
32+
},
33+
"dependencies": {
34+
"@object-ui/components": "workspace:*",
35+
"@object-ui/core": "workspace:*",
36+
"@object-ui/react": "workspace:*",
37+
"@object-ui/types": "workspace:*",
38+
"lucide-react": "^0.468.0"
39+
},
40+
"peerDependencies": {
41+
"react": "^18.0.0 || ^19.0.0",
42+
"react-dom": "^18.0.0 || ^19.0.0"
43+
},
44+
"devDependencies": {
45+
"@types/react": "^19.0.6",
46+
"@types/react-dom": "^19.0.3",
47+
"@vitejs/plugin-react": "^4.2.1",
48+
"typescript": "^5.9.3",
49+
"vite": "^7.3.1",
50+
"vite-plugin-dts": "^4.5.4"
51+
}
52+
}

packages/components/src/ui/calendar-view.tsx renamed to packages/plugin-calendar-view/src/index.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,7 @@
1010

1111
import * as React from "react"
1212
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"
13-
import { cn } from "../lib/utils"
14-
import { Button } from "./button"
15-
import {
16-
Select,
17-
SelectContent,
18-
SelectItem,
19-
SelectTrigger,
20-
SelectValue,
21-
} from "./select"
13+
import { cn, Button, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@object-ui/components"
2214

2315
const DEFAULT_EVENT_COLOR = "bg-blue-500 text-white"
2416

@@ -509,3 +501,6 @@ function DayView({ date, events, onEventClick }: DayViewProps) {
509501
}
510502

511503
export { CalendarView }
504+
505+
// Export renderer for ObjectUI schema integration
506+
export * from './renderer';

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import { ComponentRegistry } from '@object-ui/core';
1010
import type { CalendarViewSchema, CalendarEvent } from '@object-ui/types';
11-
import { CalendarView } from '../../ui';
11+
import { CalendarView } from './index';
1212
import React from 'react';
1313

1414
// Calendar View Renderer - Airtable-style calendar for displaying records as events
@@ -101,10 +101,14 @@ ComponentRegistry.register('calendar-view',
101101
}
102102
}, [onAction, schema]);
103103

104+
const validView = (schema.view && ['month', 'week', 'day'].includes(schema.view))
105+
? (schema.view as "month" | "week" | "day")
106+
: 'month';
107+
104108
return (
105109
<CalendarView
106-
events={events as any[]}
107-
view={(schema.view as any) || 'month'}
110+
events={events}
111+
view={validView}
108112
currentDate={schema.currentDate ? new Date(schema.currentDate) : undefined}
109113
onEventClick={handleEventClick}
110114
onDateClick={schema.allowCreate || schema.onDateClick ? handleDateClick : undefined}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
"jsx": "react-jsx",
6+
"baseUrl": ".",
7+
"paths": {
8+
"@/*": ["src/*"]
9+
},
10+
"noEmit": false,
11+
"declaration": true,
12+
"composite": true,
13+
"declarationMap": true,
14+
"skipLibCheck": true
15+
},
16+
"include": ["src"],
17+
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx"]
18+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* ObjectUI
3+
* Copyright (c) 2024-present ObjectStack Inc.
4+
*
5+
* This source code is licensed under the MIT license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
import { defineConfig } from 'vite';
10+
import react from '@vitejs/plugin-react';
11+
import dts from 'vite-plugin-dts';
12+
import { resolve } from 'path';
13+
14+
export default defineConfig({
15+
plugins: [
16+
react(),
17+
dts({
18+
insertTypesEntry: true,
19+
include: ['src'],
20+
exclude: ['**/*.test.ts', '**/*.test.tsx', 'node_modules'],
21+
skipDiagnostics: true,
22+
}),
23+
],
24+
resolve: {
25+
alias: {
26+
'@': resolve(__dirname, './src'),
27+
},
28+
},
29+
build: {
30+
lib: {
31+
entry: resolve(__dirname, 'src/index.tsx'),
32+
name: 'ObjectUIPluginCalendarView',
33+
fileName: 'index',
34+
},
35+
rollupOptions: {
36+
external: ['react', 'react-dom', '@object-ui/components', '@object-ui/core', '@object-ui/react', 'lucide-react'],
37+
output: {
38+
globals: {
39+
react: 'React',
40+
'react-dom': 'ReactDOM',
41+
'@object-ui/components': 'ObjectUIComponents',
42+
'@object-ui/core': 'ObjectUICore',
43+
'@object-ui/react': 'ObjectUIReact',
44+
'lucide-react': 'LucideReact',
45+
},
46+
},
47+
},
48+
},
49+
});

0 commit comments

Comments
 (0)