@universe-platform/ui 0.1.0-beta.2 → 0.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { ClassValue } from 'clsx';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import React, { ReactNode } from 'react';
2
4
 
3
5
  declare function cn(...inputs: ClassValue[]): string;
4
6
 
@@ -41,7 +43,78 @@ interface BaseComponentProps<TData = any, TConfig = Record<string, any>> extends
41
43
  "data-testid"?: string;
42
44
  }
43
45
 
44
- declare const isUiLibraryReady = true;
45
- declare const isUiLibraryReadyNot = false;
46
+ /**
47
+ * Table data schemas and record definitions for Universe UI components.
48
+ */
49
+ interface ColumnDef {
50
+ name: string;
51
+ type?: string;
52
+ defaultValue?: any;
53
+ isRequired?: boolean;
54
+ isUnique?: boolean;
55
+ referencedTableId?: string;
56
+ displayField?: string;
57
+ currencySymbol?: string;
58
+ }
59
+ interface SchemaDef {
60
+ columns?: ColumnDef[];
61
+ [key: string]: any;
62
+ }
63
+ interface RecordData {
64
+ id: string;
65
+ data: Record<string, any>;
66
+ }
67
+ interface DriveFileValue {
68
+ fileId: string;
69
+ fileUrl: string;
70
+ fileName: string;
71
+ }
72
+
73
+ interface TableConfig extends SchemaDef {
74
+ }
75
+ type TableData = RecordData[];
76
+ type TableBlockProps = BaseComponentProps<TableData, TableConfig>;
77
+ interface CreateRecordPayload {
78
+ records: RecordData[];
79
+ }
80
+ interface UpdateRecordPayload {
81
+ modifications: Record<string, Record<string, any>>;
82
+ }
83
+ interface DeleteRecordPayload {
84
+ ids: string[];
85
+ }
86
+
87
+ declare function TableBlock(props: TableBlockProps): react_jsx_runtime.JSX.Element;
88
+
89
+ /**
90
+ * UNIVERSE_COMPONENTS
91
+ * Dynamic Component Registry dictionary mapping component type strings (e.g., "TABLE")
92
+ * to their respective React component implementation.
93
+ */
94
+ declare const UNIVERSE_COMPONENTS: {
95
+ readonly TABLE: typeof TableBlock;
96
+ };
97
+ type ComponentRegistry = typeof UNIVERSE_COMPONENTS;
98
+ type UniverseComponentType = keyof ComponentRegistry;
99
+
100
+ interface ToastItem {
101
+ id: string;
102
+ message: string;
103
+ type?: "error" | "success" | "info" | "warning";
104
+ title?: string;
105
+ duration?: number;
106
+ }
107
+ interface ToastContextType {
108
+ toasts: ToastItem[];
109
+ addToast: (toast: Omit<ToastItem, "id">) => string;
110
+ showError: (error: string | Error | null | undefined, title?: string) => void;
111
+ removeToast: (id: string) => void;
112
+ }
113
+ declare const ToastContext: React.Context<ToastContextType | undefined>;
114
+ declare function ToastProvider({ children }: {
115
+ children: ReactNode;
116
+ }): react_jsx_runtime.JSX.Element;
117
+
118
+ declare function useToast(): ToastContextType;
46
119
 
47
- export { type BaseComponentProps, type ComponentCommunication, type ComponentConfig, type ComponentData, type ComponentPermissions, type ComponentState, cn, isUiLibraryReady, isUiLibraryReadyNot };
120
+ export { type BaseComponentProps, type ColumnDef, type ComponentCommunication, type ComponentConfig, type ComponentData, type ComponentPermissions, type ComponentRegistry, type ComponentState, type CreateRecordPayload, type DeleteRecordPayload, type DriveFileValue, type RecordData, type SchemaDef, TableBlock, type TableBlockProps, type TableConfig, type TableData, ToastContext, type ToastContextType, type ToastItem, ToastProvider, UNIVERSE_COMPONENTS, type UniverseComponentType, type UpdateRecordPayload, cn, useToast };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { ClassValue } from 'clsx';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import React, { ReactNode } from 'react';
2
4
 
3
5
  declare function cn(...inputs: ClassValue[]): string;
4
6
 
@@ -41,7 +43,78 @@ interface BaseComponentProps<TData = any, TConfig = Record<string, any>> extends
41
43
  "data-testid"?: string;
42
44
  }
43
45
 
44
- declare const isUiLibraryReady = true;
45
- declare const isUiLibraryReadyNot = false;
46
+ /**
47
+ * Table data schemas and record definitions for Universe UI components.
48
+ */
49
+ interface ColumnDef {
50
+ name: string;
51
+ type?: string;
52
+ defaultValue?: any;
53
+ isRequired?: boolean;
54
+ isUnique?: boolean;
55
+ referencedTableId?: string;
56
+ displayField?: string;
57
+ currencySymbol?: string;
58
+ }
59
+ interface SchemaDef {
60
+ columns?: ColumnDef[];
61
+ [key: string]: any;
62
+ }
63
+ interface RecordData {
64
+ id: string;
65
+ data: Record<string, any>;
66
+ }
67
+ interface DriveFileValue {
68
+ fileId: string;
69
+ fileUrl: string;
70
+ fileName: string;
71
+ }
72
+
73
+ interface TableConfig extends SchemaDef {
74
+ }
75
+ type TableData = RecordData[];
76
+ type TableBlockProps = BaseComponentProps<TableData, TableConfig>;
77
+ interface CreateRecordPayload {
78
+ records: RecordData[];
79
+ }
80
+ interface UpdateRecordPayload {
81
+ modifications: Record<string, Record<string, any>>;
82
+ }
83
+ interface DeleteRecordPayload {
84
+ ids: string[];
85
+ }
86
+
87
+ declare function TableBlock(props: TableBlockProps): react_jsx_runtime.JSX.Element;
88
+
89
+ /**
90
+ * UNIVERSE_COMPONENTS
91
+ * Dynamic Component Registry dictionary mapping component type strings (e.g., "TABLE")
92
+ * to their respective React component implementation.
93
+ */
94
+ declare const UNIVERSE_COMPONENTS: {
95
+ readonly TABLE: typeof TableBlock;
96
+ };
97
+ type ComponentRegistry = typeof UNIVERSE_COMPONENTS;
98
+ type UniverseComponentType = keyof ComponentRegistry;
99
+
100
+ interface ToastItem {
101
+ id: string;
102
+ message: string;
103
+ type?: "error" | "success" | "info" | "warning";
104
+ title?: string;
105
+ duration?: number;
106
+ }
107
+ interface ToastContextType {
108
+ toasts: ToastItem[];
109
+ addToast: (toast: Omit<ToastItem, "id">) => string;
110
+ showError: (error: string | Error | null | undefined, title?: string) => void;
111
+ removeToast: (id: string) => void;
112
+ }
113
+ declare const ToastContext: React.Context<ToastContextType | undefined>;
114
+ declare function ToastProvider({ children }: {
115
+ children: ReactNode;
116
+ }): react_jsx_runtime.JSX.Element;
117
+
118
+ declare function useToast(): ToastContextType;
46
119
 
47
- export { type BaseComponentProps, type ComponentCommunication, type ComponentConfig, type ComponentData, type ComponentPermissions, type ComponentState, cn, isUiLibraryReady, isUiLibraryReadyNot };
120
+ export { type BaseComponentProps, type ColumnDef, type ComponentCommunication, type ComponentConfig, type ComponentData, type ComponentPermissions, type ComponentRegistry, type ComponentState, type CreateRecordPayload, type DeleteRecordPayload, type DriveFileValue, type RecordData, type SchemaDef, TableBlock, type TableBlockProps, type TableConfig, type TableData, ToastContext, type ToastContextType, type ToastItem, ToastProvider, UNIVERSE_COMPONENTS, type UniverseComponentType, type UpdateRecordPayload, cn, useToast };