diff --git a/packages/plugin-report/src/ReportBuilder.tsx b/packages/plugin-report/src/ReportBuilder.tsx index 3ec823cb..7ceaf73f 100644 --- a/packages/plugin-report/src/ReportBuilder.tsx +++ b/packages/plugin-report/src/ReportBuilder.tsx @@ -156,7 +156,8 @@ export const ReportBuilder: React.FC = ({ schema }) => { const handleCancel = () => { if (onCancel) { - onCancel(); + console.log('Report cancelled:', onCancel); + // In a real implementation, this would trigger the action/script } }; @@ -205,7 +206,7 @@ export const ReportBuilder: React.FC = ({ schema }) => { setReport({ ...report, title: e.target.value })} + onChange={(e: React.ChangeEvent) => setReport({ ...report, title: e.target.value })} placeholder="Enter report title" /> @@ -215,7 +216,7 @@ export const ReportBuilder: React.FC = ({ schema }) => { setReport({ ...report, description: e.target.value })} + onChange={(e: React.ChangeEvent) => setReport({ ...report, description: e.target.value })} placeholder="Enter report description" /> @@ -302,7 +303,7 @@ export const ReportBuilder: React.FC = ({ schema }) => { handleFieldChange(index, { ...field, label: e.target.value })} + onChange={(e: React.ChangeEvent) => handleFieldChange(index, { ...field, label: e.target.value })} />
@@ -387,7 +388,7 @@ export const ReportBuilder: React.FC = ({ schema }) => { handleFilterChange(index, { ...filter, value: e.target.value })} + onChange={(e: React.ChangeEvent) => handleFilterChange(index, { ...filter, value: e.target.value })} />
@@ -511,7 +512,7 @@ export const ReportBuilder: React.FC = ({ schema }) => { handleSectionChange(index, { ...section, title: e.target.value })} + onChange={(e: React.ChangeEvent) => handleSectionChange(index, { ...section, title: e.target.value })} /> {section.type === 'text' && ( @@ -520,7 +521,7 @@ export const ReportBuilder: React.FC = ({ schema }) => { handleSectionChange(index, { ...section, text: e.target.value })} + onChange={(e: React.ChangeEvent) => handleSectionChange(index, { ...section, text: e.target.value })} /> )} @@ -574,12 +575,12 @@ export const ReportBuilder: React.FC = ({ schema }) => { className="h-8 text-sm" placeholder="e.g. value, count" value={section.chart?.yAxisFields?.join(', ') || ''} - onChange={(e) => handleSectionChange(index, { + onChange={(e: React.ChangeEvent) => handleSectionChange(index, { ...section, chart: { ...section.chart, type: 'chart', - yAxisFields: e.target.value.split(',').map(s => s.trim()).filter(Boolean) + yAxisFields: e.target.value.split(',').map((s: string) => s.trim()).filter(Boolean) } as any })} /> diff --git a/packages/plugin-report/src/ReportViewer.tsx b/packages/plugin-report/src/ReportViewer.tsx index 937fb35c..28c45f75 100644 --- a/packages/plugin-report/src/ReportViewer.tsx +++ b/packages/plugin-report/src/ReportViewer.tsx @@ -10,7 +10,7 @@ import React from 'react'; import { Card, CardContent, CardHeader, CardTitle, CardDescription, Button } from '@object-ui/components'; import { SchemaRenderer } from '@object-ui/react'; import { ComponentRegistry } from '@object-ui/core'; -import type { ReportViewerSchema, ReportSection, ReportExportFormat } from '@object-ui/types'; +import type { ReportViewerSchema, ReportSection, ReportExportFormat, ReportField } from '@object-ui/types'; import { Download, Printer, RefreshCw } from 'lucide-react'; import { exportReport } from './ReportExportEngine'; @@ -277,7 +277,7 @@ export const ReportViewer: React.FC = ({ schema, onRefresh }) - {report.fields?.map((field, idx) => ( + {report.fields?.map((field: ReportField, idx: number) => ( @@ -285,9 +285,9 @@ export const ReportViewer: React.FC = ({ schema, onRefresh }) - {data.map((row, rowIdx) => ( + {data.map((row: Record, rowIdx: number) => ( - {report.fields?.map((field, colIdx) => ( + {report.fields?.map((field: ReportField, colIdx: number) => ( diff --git a/packages/plugin-report/src/ScheduleConfig.tsx b/packages/plugin-report/src/ScheduleConfig.tsx index fccc025e..48bbc7bb 100644 --- a/packages/plugin-report/src/ScheduleConfig.tsx +++ b/packages/plugin-report/src/ScheduleConfig.tsx @@ -120,7 +120,7 @@ export const ScheduleConfig: React.FC = ({ schedule: initia min={1} max={31} value={schedule.dayOfMonth ?? 1} - onChange={(e) => handleChange({ dayOfMonth: Number(e.target.value) })} + onChange={(e: React.ChangeEvent) => handleChange({ dayOfMonth: Number(e.target.value) })} /> )} @@ -134,7 +134,7 @@ export const ScheduleConfig: React.FC = ({ schedule: initia handleChange({ time: e.target.value })} + onChange={(e: React.ChangeEvent) => handleChange({ time: e.target.value })} /> @@ -143,7 +143,7 @@ export const ScheduleConfig: React.FC = ({ schedule: initia handleChange({ timezone: e.target.value })} + onChange={(e: React.ChangeEvent) => handleChange({ timezone: e.target.value })} placeholder="e.g. America/New_York" /> @@ -162,7 +162,7 @@ export const ScheduleConfig: React.FC = ({ schedule: initia handleChange({ formats: e.target.checked ? [...formats, opt.value] - : formats.filter(f => f !== opt.value) + : formats.filter((f: ReportExportFormat) => f !== opt.value) }); }} className="rounded" @@ -182,8 +182,8 @@ export const ScheduleConfig: React.FC = ({ schedule: initia handleChange({ - recipients: e.target.value.split(',').map(s => s.trim()).filter(Boolean) + onChange={(e: React.ChangeEvent) => handleChange({ + recipients: e.target.value.split(',').map((s: string) => s.trim()).filter(Boolean) })} /> @@ -193,7 +193,7 @@ export const ScheduleConfig: React.FC = ({ schedule: initia handleChange({ subject: e.target.value })} + onChange={(e: React.ChangeEvent) => handleChange({ subject: e.target.value })} placeholder="Scheduled Report: {report_title}" /> diff --git a/packages/react/src/hooks/index.ts b/packages/react/src/hooks/index.ts index 7d851108..41dedf00 100644 --- a/packages/react/src/hooks/index.ts +++ b/packages/react/src/hooks/index.ts @@ -13,5 +13,4 @@ export * from './usePageVariables'; export * from './useViewData'; export * from './useDynamicApp'; export * from './useDiscovery'; -export * from './useTheme'; diff --git a/packages/react/src/hooks/useTheme.ts b/packages/react/src/hooks/useTheme.ts deleted file mode 100644 index 4f6866ae..00000000 --- a/packages/react/src/hooks/useTheme.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * ObjectUI - * Copyright (c) 2024-present ObjectStack Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -import { createContext, useContext } from 'react'; -import type { Theme, ThemeMode } from '@object-ui/types'; - -/** - * Theme context value for component-level theme access. - */ -export interface ThemeContextValue { - /** Current active theme */ - theme: Theme | null; - /** Current theme mode */ - mode: ThemeMode; - /** Set the theme mode */ - setMode: (mode: ThemeMode) => void; - /** Set a new theme */ - setTheme: (theme: Theme) => void; - /** Get a resolved CSS variable value */ - getCssVar: (name: string) => string; -} - -const defaultThemeContext: ThemeContextValue = { - theme: null, - mode: 'auto', - setMode: () => {}, - setTheme: () => {}, - getCssVar: (name: string) => { - if (typeof document !== 'undefined') { - return getComputedStyle(document.documentElement).getPropertyValue(name).trim(); - } - return ''; - }, -}; - -export const ThemeContext = createContext(defaultThemeContext); - -ThemeContext.displayName = 'ThemeContext'; - -/** - * Hook for component-level theme access. - * - * Provides the current theme, mode, and utility functions - * for reading and modifying theme state. - * - * @example - * ```tsx - * const { theme, mode, setMode, getCssVar } = useTheme(); - * const primaryColor = getCssVar('--primary'); - * ``` - */ -export function useTheme(): ThemeContextValue { - return useContext(ThemeContext); -}
{field.label || field.name}
{row[field.name]}