diff --git a/apps/www/src/lib/registry/new-york/example/AutoForm.vue b/apps/www/src/lib/registry/new-york/example/AutoForm.vue
index ebc35eb5..561d7fd3 100644
--- a/apps/www/src/lib/registry/new-york/example/AutoForm.vue
+++ b/apps/www/src/lib/registry/new-york/example/AutoForm.vue
@@ -146,7 +146,6 @@ const onSubmit = handleSubmit((values) => {
placeholder: 'Choose a color',
},
},
-
marshmallows: {
component: 'radio',
},
@@ -158,7 +157,15 @@ const onSubmit = handleSubmit((values) => {
},
subObject: {
-
+ subField: {
+ label: 'custom labvel',
+ description: '123',
+ },
+ subSubObject: {
+ subSubField: {
+ label: 'sub suuuub',
+ },
+ },
},
}"
@submit="onSubmit"
@@ -175,6 +182,10 @@ const onSubmit = handleSubmit((values) => {
+
+
+
+
diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/AutoForm.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/AutoForm.vue
index ab3e5c6a..ed753b3b 100644
--- a/apps/www/src/lib/registry/new-york/ui/auto-form/AutoForm.vue
+++ b/apps/www/src/lib/registry/new-york/ui/auto-form/AutoForm.vue
@@ -1,15 +1,13 @@
-
diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/constant.ts b/apps/www/src/lib/registry/new-york/ui/auto-form/constant.ts
index 7a63d5e4..8e116530 100644
--- a/apps/www/src/lib/registry/new-york/ui/auto-form/constant.ts
+++ b/apps/www/src/lib/registry/new-york/ui/auto-form/constant.ts
@@ -4,6 +4,7 @@ import FieldEnum from './fields/Enum.vue'
import FieldFile from './fields/File.vue'
import FieldInput from './fields/Input.vue'
import FieldNumber from './fields/Number.vue'
+import FieldObject from './fields/Object.vue'
export const INPUT_COMPONENTS = {
date: FieldDate,
@@ -15,6 +16,7 @@ export const INPUT_COMPONENTS = {
number: FieldNumber,
string: FieldInput,
file: FieldFile,
+ object: FieldObject,
}
/**
@@ -30,4 +32,5 @@ export const DEFAULT_ZOD_HANDLERS: {
ZodEnum: 'select',
ZodNativeEnum: 'select',
ZodNumber: 'number',
+ ZodObject: 'object',
}
diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Boolean.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Boolean.vue
index d1ad1a9d..2ed28d69 100644
--- a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Boolean.vue
+++ b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Boolean.vue
@@ -1,6 +1,6 @@
diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Date.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Date.vue
index 2127fdbf..e3279cc2 100644
--- a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Date.vue
+++ b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Date.vue
@@ -2,8 +2,8 @@
import { DateFormatter, getLocalTimeZone } from '@internationalized/date'
import { CalendarIcon } from '@radix-icons/vue'
import { beautifyObjectName } from '../utils'
-import type { Config } from '../interface'
import AutoFormLabel from '../AutoFormLabel.vue'
+import type { ConfigItem } from '../interface'
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@/lib/registry/new-york/ui/form'
import { Calendar } from '@/lib/registry/new-york/ui/calendar'
@@ -14,7 +14,7 @@ import { cn } from '@/lib/utils'
defineProps<{
name: string
required?: boolean
- config?: Config
+ config?: ConfigItem
}>()
const df = new DateFormatter('en-US', {
diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Enum.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Enum.vue
index 2489f6c8..e84c0ca5 100644
--- a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Enum.vue
+++ b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Enum.vue
@@ -1,7 +1,7 @@
diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Number.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Number.vue
index e292c598..ef552939 100644
--- a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Number.vue
+++ b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Number.vue
@@ -1,6 +1,6 @@
diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Object.vue b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Object.vue
new file mode 100644
index 00000000..0275384d
--- /dev/null
+++ b/apps/www/src/lib/registry/new-york/ui/auto-form/fields/Object.vue
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+ {{ beautifyObjectName(name) }}
+
+
+
+
+
+
+
+
+
diff --git a/apps/www/src/lib/registry/new-york/ui/auto-form/interface.ts b/apps/www/src/lib/registry/new-york/ui/auto-form/interface.ts
index 139152e0..6d392c5c 100644
--- a/apps/www/src/lib/registry/new-york/ui/auto-form/interface.ts
+++ b/apps/www/src/lib/registry/new-york/ui/auto-form/interface.ts
@@ -1,8 +1,8 @@
import type { InputHTMLAttributes, SelectHTMLAttributes } from 'vue'
-import type * as z from 'zod'
+import type { z } from 'zod'
import type { INPUT_COMPONENTS } from './constant'
-export interface Config {
+export interface ConfigItem {
label?: string
description?: string
component?: keyof typeof INPUT_COMPONENTS
@@ -10,11 +10,11 @@ export interface Config {
enumProps?: SelectHTMLAttributes & { options?: any[] }
}
-export type FieldConfig>> = {
- // If SchemaType.key is an object, create a nested FieldConfig, otherwise FieldConfigItem
+export type Config = {
+ // If SchemaType.key is an object, create a nested Config, otherwise ConfigItem
[Key in keyof SchemaType]?: SchemaType[Key] extends object
- ? FieldConfig>
- : FieldConfig> // TODO;
+ ? Config
+ : ConfigItem;
}
export enum DependencyType {