mirror of
https://github.com/johndoe6345789/low-code-react-app-b.git
synced 2026-04-24 13:44:54 +00:00
Merge pull request #115 from johndoe6345789/codex/implement-prop-compatibility-for-components
Add JSON UI support for ErrorBadge, Notification, and StatusIcon
This commit is contained in:
@@ -1088,7 +1088,7 @@
|
||||
"category": "feedback",
|
||||
"canHaveChildren": false,
|
||||
"description": "Error state badge",
|
||||
"status": "planned",
|
||||
"status": "supported",
|
||||
"source": "atoms"
|
||||
},
|
||||
{
|
||||
@@ -1164,7 +1164,7 @@
|
||||
"category": "feedback",
|
||||
"canHaveChildren": true,
|
||||
"description": "Toast notification",
|
||||
"status": "planned",
|
||||
"status": "supported",
|
||||
"source": "atoms"
|
||||
},
|
||||
{
|
||||
@@ -1201,7 +1201,7 @@
|
||||
"category": "feedback",
|
||||
"canHaveChildren": false,
|
||||
"description": "Status indicator icon",
|
||||
"status": "planned",
|
||||
"status": "supported",
|
||||
"source": "atoms"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ export function JSONUIShowcasePage() {
|
||||
</div>
|
||||
<TabsList className="w-full justify-start">
|
||||
<TabsTrigger value="atomic">Atomic Components</TabsTrigger>
|
||||
<TabsTrigger value="feedback">Feedback Atoms</TabsTrigger>
|
||||
<TabsTrigger value="molecules">New Molecules</TabsTrigger>
|
||||
<TabsTrigger value="data-components">Data Components</TabsTrigger>
|
||||
<TabsTrigger value="dashboard">JSON Dashboard</TabsTrigger>
|
||||
@@ -36,6 +37,10 @@ export function JSONUIShowcasePage() {
|
||||
<TabsContent value="atomic" className="h-full m-0 data-[state=active]:block">
|
||||
<AtomicComponentDemo />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="feedback" className="h-full m-0 data-[state=active]:block">
|
||||
<PageRenderer schema={feedbackAtomsDemoSchema} />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="molecules" className="h-full m-0 data-[state=active]:block">
|
||||
<PageRenderer schema={newMoleculesShowcaseSchema} />
|
||||
|
||||
@@ -7,6 +7,23 @@ export interface ComponentDefinition {
|
||||
icon: string
|
||||
defaultProps?: Record<string, any>
|
||||
canHaveChildren?: boolean
|
||||
props?: ComponentPropDefinition[]
|
||||
events?: ComponentEventDefinition[]
|
||||
}
|
||||
|
||||
export interface ComponentPropDefinition {
|
||||
name: string
|
||||
type: string
|
||||
description: string
|
||||
required?: boolean
|
||||
defaultValue?: string
|
||||
options?: string[]
|
||||
supportsBinding?: boolean
|
||||
}
|
||||
|
||||
export interface ComponentEventDefinition {
|
||||
name: string
|
||||
description: string
|
||||
}
|
||||
|
||||
export const componentDefinitions: ComponentDefinition[] = [
|
||||
@@ -256,6 +273,107 @@ export const componentDefinitions: ComponentDefinition[] = [
|
||||
icon: 'Circle',
|
||||
defaultProps: { status: 'active', children: 'Active' }
|
||||
},
|
||||
{
|
||||
type: 'ErrorBadge',
|
||||
label: 'Error Badge',
|
||||
category: 'feedback',
|
||||
icon: 'WarningCircle',
|
||||
defaultProps: { count: 3, variant: 'destructive', size: 'md' },
|
||||
props: [
|
||||
{
|
||||
name: 'count',
|
||||
type: 'number',
|
||||
description: 'Number of errors to display. Hidden when set to 0.',
|
||||
required: true,
|
||||
supportsBinding: true,
|
||||
},
|
||||
{
|
||||
name: 'variant',
|
||||
type: 'string',
|
||||
description: 'Visual variant for the badge.',
|
||||
defaultValue: 'destructive',
|
||||
options: ['default', 'destructive'],
|
||||
},
|
||||
{
|
||||
name: 'size',
|
||||
type: 'string',
|
||||
description: 'Badge size.',
|
||||
defaultValue: 'md',
|
||||
options: ['sm', 'md'],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'Notification',
|
||||
label: 'Notification',
|
||||
category: 'feedback',
|
||||
icon: 'Info',
|
||||
defaultProps: { type: 'info', title: 'Notification', message: 'Details go here.' },
|
||||
props: [
|
||||
{
|
||||
name: 'type',
|
||||
type: 'string',
|
||||
description: 'Notification style variant.',
|
||||
required: true,
|
||||
options: ['info', 'success', 'warning', 'error'],
|
||||
},
|
||||
{
|
||||
name: 'title',
|
||||
type: 'string',
|
||||
description: 'Primary notification title.',
|
||||
required: true,
|
||||
supportsBinding: true,
|
||||
},
|
||||
{
|
||||
name: 'message',
|
||||
type: 'string',
|
||||
description: 'Optional supporting message text.',
|
||||
supportsBinding: true,
|
||||
},
|
||||
{
|
||||
name: 'className',
|
||||
type: 'string',
|
||||
description: 'Optional custom classes for spacing or layout tweaks.',
|
||||
},
|
||||
],
|
||||
events: [
|
||||
{
|
||||
name: 'onClose',
|
||||
description: 'Fires when the close button is clicked. Bind to dismiss or trigger an action.',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'StatusIcon',
|
||||
label: 'Status Icon',
|
||||
category: 'feedback',
|
||||
icon: 'CheckCircle',
|
||||
defaultProps: { type: 'saved', size: 14, animate: false },
|
||||
props: [
|
||||
{
|
||||
name: 'type',
|
||||
type: 'string',
|
||||
description: 'Status icon style.',
|
||||
required: true,
|
||||
supportsBinding: true,
|
||||
options: ['saved', 'synced'],
|
||||
},
|
||||
{
|
||||
name: 'size',
|
||||
type: 'number',
|
||||
description: 'Icon size in pixels.',
|
||||
defaultValue: '14',
|
||||
supportsBinding: true,
|
||||
},
|
||||
{
|
||||
name: 'animate',
|
||||
type: 'boolean',
|
||||
description: 'Applies entry animation when true.',
|
||||
defaultValue: 'false',
|
||||
supportsBinding: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
// Data Components
|
||||
{
|
||||
type: 'List',
|
||||
|
||||
@@ -6,6 +6,7 @@ export type ComponentType =
|
||||
| 'Text' | 'Heading' | 'Label' | 'List' | 'Grid' | 'Stack' | 'Flex' | 'Container'
|
||||
| 'Link' | 'Image' | 'Avatar' | 'Code' | 'Tag' | 'Spinner' | 'Skeleton'
|
||||
| 'Alert' | 'InfoBox' | 'EmptyState' | 'StatusBadge'
|
||||
| 'ErrorBadge' | 'Notification' | 'StatusIcon'
|
||||
| 'Table' | 'KeyValue' | 'StatCard' | 'DataCard' | 'SearchInput' | 'ActionBar'
|
||||
| 'DataList' | 'DataTable' | 'MetricCard' | 'Timeline'
|
||||
| 'AppBranding' | 'LabelWithBadge' | 'EmptyEditorState' | 'LoadingFallback' | 'LoadingState' | 'NavigationGroupHeader'
|
||||
|
||||
Reference in New Issue
Block a user