From 968efc770160285fa52fe0a5af55462bfd5c1e66 Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Sun, 18 Jan 2026 13:12:25 +0000 Subject: [PATCH] Add DatePicker and FileUpload defaults --- src/config/ui-examples/form.json | 7 +++++-- src/lib/component-definitions.json | 14 ++++++++++++++ src/lib/json-ui/component-registry.ts | 13 ++++++++----- src/types/json-ui.ts | 3 +-- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/config/ui-examples/form.json b/src/config/ui-examples/form.json index e0a3428..6674c77 100644 --- a/src/config/ui-examples/form.json +++ b/src/config/ui-examples/form.json @@ -147,7 +147,8 @@ "id": "birthdate-input", "type": "DatePicker", "props": { - "placeholder": "Select a date" + "placeholder": "Select a date", + "disabled": false }, "dataBinding": "formData.birthDate", "events": { @@ -207,7 +208,9 @@ "id": "resume-upload", "type": "FileUpload", "props": { - "accept": ".pdf,.doc,.docx" + "accept": ".pdf,.doc,.docx", + "multiple": false, + "maxSize": 10485760 }, "events": { "onFilesSelected": { diff --git a/src/lib/component-definitions.json b/src/lib/component-definitions.json index 9731f20..416a87c 100644 --- a/src/lib/component-definitions.json +++ b/src/lib/component-definitions.json @@ -119,6 +119,20 @@ "icon": "NumberCircleOne", "defaultProps": { "placeholder": "0", "min": 0 } }, + { + "type": "DatePicker", + "label": "Date Picker", + "category": "input", + "icon": "Calendar", + "defaultProps": { "placeholder": "Pick a date" } + }, + { + "type": "FileUpload", + "label": "File Upload", + "category": "input", + "icon": "Upload", + "defaultProps": { "multiple": false } + }, { "type": "Heading", "label": "Heading", diff --git a/src/lib/json-ui/component-registry.ts b/src/lib/json-ui/component-registry.ts index 90df225..9341352 100644 --- a/src/lib/json-ui/component-registry.ts +++ b/src/lib/json-ui/component-registry.ts @@ -77,6 +77,7 @@ const buildRegistryFromNames = ( } const jsonRegistryEntries = jsonRegistry.components ?? [] +const atomComponentMap = AtomComponents as Record> const deprecatedComponentInfo = jsonRegistryEntries.reduce>( (acc, entry) => { const entryName = entry.export ?? entry.name ?? entry.type @@ -173,12 +174,14 @@ export const shadcnComponents: UIComponentRegistry = { export const atomComponents: UIComponentRegistry = { ...buildRegistryFromNames( atomRegistryNames, - AtomComponents as Record> + atomComponentMap ), - DataList: (AtomComponents as Record>).DataList, - DataTable: (AtomComponents as Record>).DataTable, - MetricCard: (AtomComponents as Record>).MetricCard, - Timeline: (AtomComponents as Record>).Timeline, + DatePicker: atomComponentMap.DatePicker, + FileUpload: atomComponentMap.FileUpload, + DataList: atomComponentMap.DataList, + DataTable: atomComponentMap.DataTable, + MetricCard: atomComponentMap.MetricCard, + Timeline: atomComponentMap.Timeline, } const breadcrumbComponent = AtomComponents.Breadcrumb ?? AtomComponents.BreadcrumbNav diff --git a/src/types/json-ui.ts b/src/types/json-ui.ts index 51c6c9b..f7420d4 100644 --- a/src/types/json-ui.ts +++ b/src/types/json-ui.ts @@ -1,8 +1,7 @@ export type ComponentType = | 'div' | 'section' | 'article' | 'header' | 'footer' | 'main' | 'Button' | 'Card' | 'CardHeader' | 'CardTitle' | 'CardDescription' | 'CardContent' | 'CardFooter' - | 'Input' | 'TextArea' | 'Textarea' | 'Select' | 'Checkbox' | 'Radio' | 'Switch' | 'Slider' | 'NumberInput' - | 'DatePicker' | 'FileUpload' + | 'Input' | 'TextArea' | 'Textarea' | 'Select' | 'Checkbox' | 'Radio' | 'Switch' | 'Slider' | 'NumberInput' | 'DatePicker' | 'FileUpload' | 'Badge' | 'Progress' | 'Separator' | 'Tabs' | 'TabsContent' | 'TabsList' | 'TabsTrigger' | 'Dialog' | 'Text' | 'Heading' | 'Label' | 'List' | 'Grid' | 'Stack' | 'Flex' | 'Container' | 'Link' | 'Breadcrumb' | 'Image' | 'Avatar' | 'Code' | 'Tag' | 'Spinner' | 'Skeleton'