@object-ui/types 0.3.0 → 0.3.1

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.
Files changed (115) hide show
  1. package/README.md +19 -11
  2. package/dist/api-types.d.ts +7 -0
  3. package/dist/api-types.d.ts.map +1 -1
  4. package/dist/api-types.js +4 -6
  5. package/dist/app.d.ts +7 -0
  6. package/dist/app.d.ts.map +1 -1
  7. package/dist/app.js +4 -3
  8. package/dist/base.d.ts +7 -0
  9. package/dist/base.d.ts.map +1 -1
  10. package/dist/base.js +4 -6
  11. package/dist/complex.d.ts +68 -1
  12. package/dist/complex.d.ts.map +1 -1
  13. package/dist/complex.js +4 -5
  14. package/dist/crud.d.ts +7 -0
  15. package/dist/crud.d.ts.map +1 -1
  16. package/dist/crud.js +4 -6
  17. package/dist/data-display.d.ts +54 -2
  18. package/dist/data-display.d.ts.map +1 -1
  19. package/dist/data-display.js +4 -5
  20. package/dist/data.d.ts +16 -0
  21. package/dist/data.d.ts.map +1 -1
  22. package/dist/data.js +4 -6
  23. package/dist/disclosure.d.ts +70 -1
  24. package/dist/disclosure.d.ts.map +1 -1
  25. package/dist/disclosure.js +4 -5
  26. package/dist/feedback.d.ts +68 -1
  27. package/dist/feedback.d.ts.map +1 -1
  28. package/dist/feedback.js +4 -5
  29. package/dist/field-types.d.ts +386 -0
  30. package/dist/field-types.d.ts.map +1 -0
  31. package/dist/field-types.js +8 -0
  32. package/dist/form.d.ts +123 -1
  33. package/dist/form.d.ts.map +1 -1
  34. package/dist/form.js +4 -5
  35. package/dist/index.d.ts +21 -13
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +4 -37
  38. package/dist/layout.d.ts +66 -16
  39. package/dist/layout.d.ts.map +1 -1
  40. package/dist/layout.js +4 -6
  41. package/dist/navigation.d.ts +102 -2
  42. package/dist/navigation.d.ts.map +1 -1
  43. package/dist/navigation.js +4 -5
  44. package/dist/objectql.d.ts +484 -54
  45. package/dist/objectql.d.ts.map +1 -1
  46. package/dist/objectql.js +4 -6
  47. package/dist/overlay.d.ts +31 -1
  48. package/dist/overlay.d.ts.map +1 -1
  49. package/dist/overlay.js +4 -5
  50. package/dist/registry.d.ts +7 -0
  51. package/dist/registry.d.ts.map +1 -1
  52. package/dist/registry.js +7 -0
  53. package/dist/zod/base.zod.d.ts +202 -0
  54. package/dist/zod/base.zod.d.ts.map +1 -0
  55. package/dist/zod/base.zod.js +198 -0
  56. package/dist/zod/complex.zod.d.ts +742 -0
  57. package/dist/zod/complex.zod.d.ts.map +1 -0
  58. package/dist/zod/complex.zod.js +233 -0
  59. package/dist/zod/data-display.zod.d.ts +996 -0
  60. package/dist/zod/data-display.zod.d.ts.map +1 -0
  61. package/dist/zod/data-display.zod.js +266 -0
  62. package/dist/zod/disclosure.zod.d.ts +267 -0
  63. package/dist/zod/disclosure.zod.d.ts.map +1 -0
  64. package/dist/zod/disclosure.zod.js +84 -0
  65. package/dist/zod/feedback.zod.d.ts +538 -0
  66. package/dist/zod/feedback.zod.d.ts.map +1 -0
  67. package/dist/zod/feedback.zod.js +127 -0
  68. package/dist/zod/form.zod.d.ts +1308 -0
  69. package/dist/zod/form.zod.d.ts.map +1 -0
  70. package/dist/zod/form.zod.js +406 -0
  71. package/dist/zod/index.zod.d.ts +3174 -0
  72. package/dist/zod/index.zod.d.ts.map +1 -0
  73. package/dist/zod/index.zod.js +106 -0
  74. package/dist/zod/layout.zod.d.ts +1048 -0
  75. package/dist/zod/layout.zod.d.ts.map +1 -0
  76. package/dist/zod/layout.zod.js +241 -0
  77. package/dist/zod/navigation.zod.d.ts +486 -0
  78. package/dist/zod/navigation.zod.d.ts.map +1 -0
  79. package/dist/zod/navigation.zod.js +142 -0
  80. package/dist/zod/objectql.zod.d.ts +1261 -0
  81. package/dist/zod/objectql.zod.d.ts.map +1 -0
  82. package/dist/zod/objectql.zod.js +248 -0
  83. package/dist/zod/overlay.zod.d.ts +691 -0
  84. package/dist/zod/overlay.zod.d.ts.map +1 -0
  85. package/dist/zod/overlay.zod.js +179 -0
  86. package/package.json +9 -1
  87. package/src/api-types.ts +8 -0
  88. package/src/app.ts +8 -0
  89. package/src/base.ts +8 -0
  90. package/src/complex.ts +69 -1
  91. package/src/crud.ts +8 -0
  92. package/src/data-display.ts +60 -2
  93. package/src/data.ts +18 -0
  94. package/src/disclosure.ts +74 -1
  95. package/src/feedback.ts +76 -2
  96. package/src/field-types.ts +465 -0
  97. package/src/form.ts +131 -1
  98. package/src/index.ts +91 -8
  99. package/src/layout.ts +70 -15
  100. package/src/navigation.ts +109 -2
  101. package/src/objectql.ts +555 -59
  102. package/src/overlay.ts +35 -1
  103. package/src/registry.ts +8 -0
  104. package/src/zod/README.md +329 -0
  105. package/src/zod/base.zod.ts +229 -0
  106. package/src/zod/complex.zod.ts +258 -0
  107. package/src/zod/data-display.zod.ts +290 -0
  108. package/src/zod/disclosure.zod.ts +92 -0
  109. package/src/zod/feedback.zod.ts +138 -0
  110. package/src/zod/form.zod.ts +434 -0
  111. package/src/zod/index.zod.ts +277 -0
  112. package/src/zod/layout.zod.ts +262 -0
  113. package/src/zod/navigation.zod.ts +159 -0
  114. package/src/zod/objectql.zod.ts +268 -0
  115. package/src/zod/overlay.zod.ts +196 -0
@@ -0,0 +1,138 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ /**
10
+ * @object-ui/types/zod - Feedback Component Zod Validators
11
+ *
12
+ * Zod validation schemas for feedback and status indication components.
13
+ * Following @objectstack/spec UI specification format.
14
+ *
15
+ * @module zod/feedback
16
+ * @packageDocumentation
17
+ */
18
+
19
+ import { z } from 'zod';
20
+ import { BaseSchema, SchemaNodeSchema } from './base.zod';
21
+
22
+ /**
23
+ * Loading Schema - Loading indicator component
24
+ */
25
+ export const LoadingSchema = BaseSchema.extend({
26
+ type: z.literal('loading'),
27
+ label: z.string().optional().describe('Loading label text'),
28
+ size: z.enum(['sm', 'default', 'lg']).optional().describe('Loading indicator size'),
29
+ variant: z.enum(['spinner', 'dots', 'pulse']).optional().describe('Loading variant'),
30
+ fullscreen: z.boolean().optional().describe('Whether to show fullscreen overlay'),
31
+ });
32
+
33
+ /**
34
+ * Progress Schema - Progress bar component
35
+ */
36
+ export const ProgressSchema = BaseSchema.extend({
37
+ type: z.literal('progress'),
38
+ value: z.number().optional().describe('Progress value'),
39
+ max: z.number().optional().describe('Maximum value'),
40
+ variant: z.enum(['default', 'success', 'warning', 'error']).optional().describe('Progress variant'),
41
+ showLabel: z.boolean().optional().describe('Show progress label'),
42
+ size: z.enum(['sm', 'default', 'lg']).optional().describe('Progress bar size'),
43
+ indeterminate: z.boolean().optional().describe('Indeterminate progress'),
44
+ });
45
+
46
+ /**
47
+ * Skeleton Schema - Skeleton loading placeholder
48
+ */
49
+ export const SkeletonSchema = BaseSchema.extend({
50
+ type: z.literal('skeleton'),
51
+ variant: z.enum(['text', 'circular', 'rectangular']).optional().describe('Skeleton variant'),
52
+ width: z.union([z.string(), z.number()]).optional().describe('Skeleton width'),
53
+ height: z.union([z.string(), z.number()]).optional().describe('Skeleton height'),
54
+ lines: z.number().optional().describe('Number of text lines'),
55
+ animate: z.boolean().optional().describe('Enable animation'),
56
+ });
57
+
58
+ /**
59
+ * Toast Schema - Toast notification component
60
+ */
61
+ export const ToastSchema = BaseSchema.extend({
62
+ type: z.literal('toast'),
63
+ title: z.string().optional().describe('Toast title'),
64
+ description: z.string().optional().describe('Toast description'),
65
+ variant: z.enum(['default', 'success', 'warning', 'error', 'info']).optional().describe('Toast variant'),
66
+ duration: z.number().optional().describe('Auto-dismiss duration (ms)'),
67
+ position: z.enum([
68
+ 'top-left',
69
+ 'top-center',
70
+ 'top-right',
71
+ 'bottom-left',
72
+ 'bottom-center',
73
+ 'bottom-right',
74
+ ]).optional().describe('Toast position'),
75
+ action: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Action button'),
76
+ onDismiss: z.function().optional().describe('Dismiss handler'),
77
+ });
78
+
79
+ /**
80
+ * Toaster Schema - Toast container component
81
+ */
82
+ export const ToasterSchema = BaseSchema.extend({
83
+ type: z.literal('toaster'),
84
+ position: z.enum([
85
+ 'top-left',
86
+ 'top-center',
87
+ 'top-right',
88
+ 'bottom-left',
89
+ 'bottom-center',
90
+ 'bottom-right',
91
+ ]).optional().describe('Toaster position'),
92
+ limit: z.number().optional().describe('Maximum number of toasts'),
93
+ });
94
+
95
+ /**
96
+ * Spinner Schema - Spinner component
97
+ */
98
+ export const SpinnerSchema = BaseSchema.extend({
99
+ type: z.literal('spinner'),
100
+ size: z.enum(['sm', 'md', 'lg', 'xl']).optional().describe('Spinner size'),
101
+ });
102
+
103
+ /**
104
+ * Empty Schema - Empty state component
105
+ */
106
+ export const EmptySchema = BaseSchema.extend({
107
+ type: z.literal('empty'),
108
+ title: z.string().optional().describe('Empty state title'),
109
+ description: z.string().optional().describe('Empty state description'),
110
+ icon: z.string().optional().describe('Empty state icon'),
111
+ });
112
+
113
+ /**
114
+ * Sonner Schema - Sonner toast component
115
+ */
116
+ export const SonnerSchema = BaseSchema.extend({
117
+ type: z.literal('sonner'),
118
+ message: z.string().optional().describe('Toast message'),
119
+ title: z.string().optional().describe('Toast title'),
120
+ description: z.string().optional().describe('Toast description'),
121
+ variant: z.enum(['default', 'success', 'warning', 'error', 'info']).optional().describe('Toast variant'),
122
+ buttonLabel: z.string().optional().describe('Action button label'),
123
+ buttonVariant: z.string().optional().describe('Action button variant'),
124
+ });
125
+
126
+ /**
127
+ * Feedback Schema Union - All feedback component schemas
128
+ */
129
+ export const FeedbackSchema = z.union([
130
+ LoadingSchema,
131
+ ProgressSchema,
132
+ SkeletonSchema,
133
+ ToastSchema,
134
+ ToasterSchema,
135
+ SpinnerSchema,
136
+ EmptySchema,
137
+ SonnerSchema,
138
+ ]);
@@ -0,0 +1,434 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ /**
10
+ * @object-ui/types/zod - Form Component Zod Validators
11
+ *
12
+ * Zod validation schemas for form input and interactive components.
13
+ * Following @objectstack/spec UI specification format.
14
+ *
15
+ * @module zod/form
16
+ * @packageDocumentation
17
+ */
18
+
19
+ import { z } from 'zod';
20
+ import { BaseSchema, SchemaNodeSchema } from './base.zod';
21
+
22
+ /**
23
+ * Select Option Schema
24
+ */
25
+ export const SelectOptionSchema = z.object({
26
+ label: z.string().describe('Option label'),
27
+ value: z.union([z.string(), z.number(), z.boolean()]).describe('Option value'),
28
+ disabled: z.boolean().optional().describe('Whether option is disabled'),
29
+ icon: z.string().optional().describe('Option icon'),
30
+ });
31
+
32
+ /**
33
+ * Radio Option Schema
34
+ */
35
+ export const RadioOptionSchema = z.object({
36
+ label: z.string().describe('Option label'),
37
+ value: z.union([z.string(), z.number()]).describe('Option value'),
38
+ disabled: z.boolean().optional().describe('Whether option is disabled'),
39
+ description: z.string().optional().describe('Option description'),
40
+ });
41
+
42
+ /**
43
+ * Combobox Option Schema
44
+ */
45
+ export const ComboboxOptionSchema = z.object({
46
+ value: z.string().describe('Option value'),
47
+ label: z.string().describe('Option label'),
48
+ disabled: z.boolean().optional().describe('Whether option is disabled'),
49
+ });
50
+
51
+ /**
52
+ * Command Item Schema
53
+ */
54
+ export const CommandItemSchema = z.object({
55
+ value: z.string().describe('Item value'),
56
+ label: z.string().describe('Item label'),
57
+ icon: z.string().optional().describe('Item icon'),
58
+ });
59
+
60
+ /**
61
+ * Command Group Schema
62
+ */
63
+ export const CommandGroupSchema = z.object({
64
+ heading: z.string().optional().describe('Group heading'),
65
+ items: z.array(CommandItemSchema).describe('Group items'),
66
+ });
67
+
68
+ /**
69
+ * Validation Rule Schema
70
+ */
71
+ export const ValidationRuleSchema = z.object({
72
+ required: z.boolean().optional().describe('Whether field is required'),
73
+ minLength: z.number().optional().describe('Minimum length'),
74
+ maxLength: z.number().optional().describe('Maximum length'),
75
+ min: z.number().optional().describe('Minimum value'),
76
+ max: z.number().optional().describe('Maximum value'),
77
+ pattern: z.string().optional().describe('Validation pattern (regex)'),
78
+ validate: z.function().optional().describe('Custom validation function'),
79
+ });
80
+
81
+ /**
82
+ * Field Condition Schema
83
+ */
84
+ export const FieldConditionSchema = z.object({
85
+ field: z.string().describe('Field name to check'),
86
+ equals: z.any().optional().describe('Value must equal'),
87
+ notEquals: z.any().optional().describe('Value must not equal'),
88
+ in: z.array(z.any()).optional().describe('Value must be in array'),
89
+ custom: z.function().optional().describe('Custom condition function'),
90
+ });
91
+
92
+ /**
93
+ * Button Schema - Button component
94
+ */
95
+ export const ButtonSchema = BaseSchema.extend({
96
+ type: z.literal('button'),
97
+ label: z.string().optional().describe('Button text label'),
98
+ variant: z.enum(['default', 'secondary', 'destructive', 'outline', 'ghost', 'link'])
99
+ .optional()
100
+ .default('default')
101
+ .describe('Button variant/style'),
102
+ size: z.enum(['default', 'sm', 'lg', 'icon'])
103
+ .optional()
104
+ .default('default')
105
+ .describe('Button size'),
106
+ disabled: z.boolean().optional().describe('Whether button is disabled'),
107
+ loading: z.boolean().optional().describe('Whether button is in loading state'),
108
+ icon: z.string().optional().describe('Icon to display (lucide-react icon name)'),
109
+ iconPosition: z.enum(['left', 'right']).optional().default('left').describe('Icon position'),
110
+ onClick: z.function()
111
+ .optional()
112
+ .describe('Click handler'),
113
+ buttonType: z.enum(['button', 'submit', 'reset'])
114
+ .optional()
115
+ .default('button')
116
+ .describe('Button type'),
117
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
118
+ });
119
+
120
+ /**
121
+ * Input Schema - Text input component
122
+ */
123
+ export const InputSchema = BaseSchema.extend({
124
+ type: z.literal('input'),
125
+ name: z.string().optional().describe('Field name for form submission'),
126
+ label: z.string().optional().describe('Input label'),
127
+ placeholder: z.string().optional().describe('Placeholder text'),
128
+ inputType: z.enum([
129
+ 'text', 'email', 'password', 'number', 'tel', 'url', 'search',
130
+ 'date', 'time', 'datetime-local',
131
+ ])
132
+ .optional()
133
+ .default('text')
134
+ .describe('Input type'),
135
+ defaultValue: z.union([z.string(), z.number()]).optional().describe('Default value'),
136
+ value: z.union([z.string(), z.number()]).optional().describe('Controlled value'),
137
+ required: z.boolean().optional().describe('Whether field is required'),
138
+ disabled: z.boolean().optional().describe('Whether field is disabled'),
139
+ readOnly: z.boolean().optional().describe('Whether field is read-only'),
140
+ description: z.string().optional().describe('Help text'),
141
+ error: z.string().optional().describe('Error message'),
142
+ onChange: z.function().optional().describe('Change handler'),
143
+ min: z.number().optional().describe('Minimum value (for number type)'),
144
+ max: z.number().optional().describe('Maximum value (for number type)'),
145
+ step: z.number().optional().describe('Step value (for number type)'),
146
+ maxLength: z.number().optional().describe('Maximum length'),
147
+ pattern: z.string().optional().describe('Validation pattern'),
148
+ });
149
+
150
+ /**
151
+ * Textarea Schema - Multi-line text input
152
+ */
153
+ export const TextareaSchema = BaseSchema.extend({
154
+ type: z.literal('textarea'),
155
+ name: z.string().optional().describe('Field name for form submission'),
156
+ label: z.string().optional().describe('Textarea label'),
157
+ placeholder: z.string().optional().describe('Placeholder text'),
158
+ defaultValue: z.string().optional().describe('Default value'),
159
+ value: z.string().optional().describe('Controlled value'),
160
+ rows: z.number().optional().describe('Number of visible rows'),
161
+ required: z.boolean().optional().describe('Whether field is required'),
162
+ disabled: z.boolean().optional().describe('Whether field is disabled'),
163
+ readOnly: z.boolean().optional().describe('Whether field is read-only'),
164
+ description: z.string().optional().describe('Help text'),
165
+ error: z.string().optional().describe('Error message'),
166
+ onChange: z.function().optional().describe('Change handler'),
167
+ maxLength: z.number().optional().describe('Maximum length'),
168
+ });
169
+
170
+ /**
171
+ * Select Schema - Select/dropdown component
172
+ */
173
+ export const SelectSchema = BaseSchema.extend({
174
+ type: z.literal('select'),
175
+ name: z.string().optional().describe('Field name for form submission'),
176
+ label: z.string().optional().describe('Select label'),
177
+ placeholder: z.string().optional().describe('Placeholder text'),
178
+ defaultValue: z.union([z.string(), z.number()]).optional().describe('Default value'),
179
+ value: z.union([z.string(), z.number()]).optional().describe('Controlled value'),
180
+ options: z.array(SelectOptionSchema).describe('Select options'),
181
+ required: z.boolean().optional().describe('Whether field is required'),
182
+ disabled: z.boolean().optional().describe('Whether field is disabled'),
183
+ description: z.string().optional().describe('Help text'),
184
+ error: z.string().optional().describe('Error message'),
185
+ onChange: z.function().optional().describe('Change handler'),
186
+ });
187
+
188
+ /**
189
+ * Checkbox Schema - Checkbox component
190
+ */
191
+ export const CheckboxSchema = BaseSchema.extend({
192
+ type: z.literal('checkbox'),
193
+ name: z.string().optional().describe('Field name for form submission'),
194
+ label: z.string().optional().describe('Checkbox label'),
195
+ defaultChecked: z.boolean().optional().describe('Default checked state'),
196
+ checked: z.boolean().optional().describe('Controlled checked state'),
197
+ disabled: z.boolean().optional().describe('Whether checkbox is disabled'),
198
+ description: z.string().optional().describe('Help text'),
199
+ error: z.string().optional().describe('Error message'),
200
+ onChange: z.function().optional().describe('Change handler'),
201
+ });
202
+
203
+ /**
204
+ * Radio Group Schema - Radio button group
205
+ */
206
+ export const RadioGroupSchema = BaseSchema.extend({
207
+ type: z.literal('radio-group'),
208
+ name: z.string().optional().describe('Field name for form submission'),
209
+ label: z.string().optional().describe('Radio group label'),
210
+ defaultValue: z.union([z.string(), z.number()]).optional().describe('Default value'),
211
+ value: z.union([z.string(), z.number()]).optional().describe('Controlled value'),
212
+ options: z.array(RadioOptionSchema).describe('Radio options'),
213
+ orientation: z.enum(['horizontal', 'vertical']).optional().describe('Layout orientation'),
214
+ disabled: z.boolean().optional().describe('Whether radio group is disabled'),
215
+ description: z.string().optional().describe('Help text'),
216
+ error: z.string().optional().describe('Error message'),
217
+ onChange: z.function().optional().describe('Change handler'),
218
+ });
219
+
220
+ /**
221
+ * Switch Schema - Toggle switch component
222
+ */
223
+ export const SwitchSchema = BaseSchema.extend({
224
+ type: z.literal('switch'),
225
+ name: z.string().optional().describe('Field name for form submission'),
226
+ label: z.string().optional().describe('Switch label'),
227
+ defaultChecked: z.boolean().optional().describe('Default checked state'),
228
+ checked: z.boolean().optional().describe('Controlled checked state'),
229
+ disabled: z.boolean().optional().describe('Whether switch is disabled'),
230
+ description: z.string().optional().describe('Help text'),
231
+ onChange: z.function().optional().describe('Change handler'),
232
+ });
233
+
234
+ /**
235
+ * Toggle Schema - Toggle button component
236
+ */
237
+ export const ToggleSchema = BaseSchema.extend({
238
+ type: z.literal('toggle'),
239
+ label: z.string().optional().describe('Toggle label'),
240
+ defaultPressed: z.boolean().optional().describe('Default pressed state'),
241
+ pressed: z.boolean().optional().describe('Controlled pressed state'),
242
+ disabled: z.boolean().optional().describe('Whether toggle is disabled'),
243
+ variant: z.enum(['default', 'outline']).optional().describe('Toggle variant'),
244
+ size: z.enum(['default', 'sm', 'lg']).optional().describe('Toggle size'),
245
+ onChange: z.function().optional().describe('Change handler'),
246
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
247
+ });
248
+
249
+ /**
250
+ * Slider Schema - Range slider component
251
+ */
252
+ export const SliderSchema = BaseSchema.extend({
253
+ type: z.literal('slider'),
254
+ name: z.string().optional().describe('Field name for form submission'),
255
+ label: z.string().optional().describe('Slider label'),
256
+ defaultValue: z.union([z.number(), z.array(z.number())]).optional().describe('Default value(s)'),
257
+ value: z.union([z.number(), z.array(z.number())]).optional().describe('Controlled value(s)'),
258
+ min: z.number().optional().describe('Minimum value'),
259
+ max: z.number().optional().describe('Maximum value'),
260
+ step: z.number().optional().describe('Step value'),
261
+ disabled: z.boolean().optional().describe('Whether slider is disabled'),
262
+ description: z.string().optional().describe('Help text'),
263
+ onChange: z.function().optional().describe('Change handler'),
264
+ });
265
+
266
+ /**
267
+ * File Upload Schema - File upload component
268
+ */
269
+ export const FileUploadSchema = BaseSchema.extend({
270
+ type: z.literal('file-upload'),
271
+ name: z.string().optional().describe('Field name for form submission'),
272
+ label: z.string().optional().describe('Upload label'),
273
+ accept: z.string().optional().describe('Accepted file types'),
274
+ multiple: z.boolean().optional().describe('Allow multiple files'),
275
+ maxSize: z.number().optional().describe('Maximum file size (bytes)'),
276
+ maxFiles: z.number().optional().describe('Maximum number of files'),
277
+ disabled: z.boolean().optional().describe('Whether upload is disabled'),
278
+ description: z.string().optional().describe('Help text'),
279
+ error: z.string().optional().describe('Error message'),
280
+ onChange: z.function().optional().describe('Change handler'),
281
+ });
282
+
283
+ /**
284
+ * Date Picker Schema - Date picker component
285
+ */
286
+ export const DatePickerSchema = BaseSchema.extend({
287
+ type: z.literal('date-picker'),
288
+ name: z.string().optional().describe('Field name for form submission'),
289
+ label: z.string().optional().describe('Date picker label'),
290
+ placeholder: z.string().optional().describe('Placeholder text'),
291
+ defaultValue: z.union([z.string(), z.date()]).optional().describe('Default value'),
292
+ value: z.union([z.string(), z.date()]).optional().describe('Controlled value'),
293
+ minDate: z.union([z.string(), z.date()]).optional().describe('Minimum date'),
294
+ maxDate: z.union([z.string(), z.date()]).optional().describe('Maximum date'),
295
+ format: z.string().optional().describe('Date format string'),
296
+ disabled: z.boolean().optional().describe('Whether date picker is disabled'),
297
+ description: z.string().optional().describe('Help text'),
298
+ error: z.string().optional().describe('Error message'),
299
+ onChange: z.function().optional().describe('Change handler'),
300
+ });
301
+
302
+ /**
303
+ * Calendar Schema - Calendar component
304
+ */
305
+ export const CalendarSchema = BaseSchema.extend({
306
+ type: z.literal('calendar'),
307
+ defaultValue: z.union([z.string(), z.date()]).optional().describe('Default value'),
308
+ value: z.union([z.string(), z.date()]).optional().describe('Controlled value'),
309
+ mode: z.enum(['single', 'multiple', 'range']).optional().describe('Selection mode'),
310
+ minDate: z.union([z.string(), z.date()]).optional().describe('Minimum date'),
311
+ maxDate: z.union([z.string(), z.date()]).optional().describe('Maximum date'),
312
+ disabled: z.boolean().optional().describe('Whether calendar is disabled'),
313
+ onChange: z.function().optional().describe('Change handler'),
314
+ });
315
+
316
+ /**
317
+ * Input OTP Schema - One-time password input
318
+ */
319
+ export const InputOTPSchema = BaseSchema.extend({
320
+ type: z.literal('input-otp'),
321
+ name: z.string().optional().describe('Field name for form submission'),
322
+ label: z.string().optional().describe('OTP input label'),
323
+ length: z.number().optional().describe('Number of OTP digits'),
324
+ defaultValue: z.string().optional().describe('Default value'),
325
+ value: z.string().optional().describe('Controlled value'),
326
+ disabled: z.boolean().optional().describe('Whether OTP input is disabled'),
327
+ description: z.string().optional().describe('Help text'),
328
+ error: z.string().optional().describe('Error message'),
329
+ onChange: z.function().optional().describe('Change handler'),
330
+ onComplete: z.function().optional().describe('Complete handler'),
331
+ });
332
+
333
+ /**
334
+ * Combobox Schema - Searchable select component
335
+ */
336
+ export const ComboboxSchema = BaseSchema.extend({
337
+ type: z.literal('combobox'),
338
+ name: z.string().optional().describe('Field name for form submission'),
339
+ label: z.string().optional().describe('Combobox label'),
340
+ placeholder: z.string().optional().describe('Placeholder text'),
341
+ options: z.array(ComboboxOptionSchema).describe('Combobox options'),
342
+ defaultValue: z.string().optional().describe('Default value'),
343
+ value: z.string().optional().describe('Controlled value'),
344
+ disabled: z.boolean().optional().describe('Whether combobox is disabled'),
345
+ description: z.string().optional().describe('Help text'),
346
+ error: z.string().optional().describe('Error message'),
347
+ onChange: z.function().optional().describe('Change handler'),
348
+ });
349
+
350
+ /**
351
+ * Label Schema - Form label component
352
+ */
353
+ export const LabelSchema = BaseSchema.extend({
354
+ type: z.literal('label'),
355
+ text: z.string().optional().describe('Label text'),
356
+ label: z.string().optional().describe('Label text (alternative)'),
357
+ htmlFor: z.string().optional().describe('Associated input ID'),
358
+ });
359
+
360
+ /**
361
+ * Command Schema - Command palette component
362
+ */
363
+ export const CommandSchema = BaseSchema.extend({
364
+ type: z.literal('command'),
365
+ placeholder: z.string().optional().describe('Search placeholder'),
366
+ emptyText: z.string().optional().describe('Empty state text'),
367
+ groups: z.array(CommandGroupSchema).describe('Command groups'),
368
+ onChange: z.function().optional().describe('Change handler'),
369
+ });
370
+
371
+ /**
372
+ * Form Field Schema
373
+ */
374
+ export const FormFieldSchema = z.object({
375
+ id: z.string().optional().describe('Field ID'),
376
+ name: z.string().describe('Field name'),
377
+ label: z.string().optional().describe('Field label'),
378
+ description: z.string().optional().describe('Field description'),
379
+ type: z.string().describe('Field type'),
380
+ inputType: z.string().optional().describe('Input type'),
381
+ required: z.boolean().optional().describe('Required flag'),
382
+ disabled: z.boolean().optional().describe('Disabled flag'),
383
+ placeholder: z.string().optional().describe('Placeholder text'),
384
+ options: z.array(SelectOptionSchema).optional().describe('Options for select/radio'),
385
+ validation: ValidationRuleSchema.optional().describe('Validation rules'),
386
+ condition: FieldConditionSchema.optional().describe('Conditional display'),
387
+ colSpan: z.number().optional().describe('Column span in grid layout'),
388
+ });
389
+
390
+ /**
391
+ * Form Schema - Complete form component
392
+ */
393
+ export const FormSchema = BaseSchema.extend({
394
+ type: z.literal('form'),
395
+ fields: z.array(FormFieldSchema).describe('Form fields'),
396
+ defaultValues: z.record(z.string(), z.any()).optional().describe('Default form values'),
397
+ submitLabel: z.string().optional().describe('Submit button label'),
398
+ cancelLabel: z.string().optional().describe('Cancel button label'),
399
+ showCancel: z.boolean().optional().describe('Show cancel button'),
400
+ layout: z.enum(['vertical', 'horizontal', 'grid']).optional().describe('Form layout'),
401
+ columns: z.number().optional().describe('Number of columns (for grid layout)'),
402
+ validationMode: z.enum(['onSubmit', 'onChange', 'onBlur']).optional().describe('Validation mode'),
403
+ resetOnSubmit: z.boolean().optional().describe('Reset form on successful submit'),
404
+ disabled: z.boolean().optional().describe('Disable entire form'),
405
+ mode: z.enum(['create', 'edit', 'view']).optional().describe('Form mode'),
406
+ actions: z.array(z.any()).optional().describe('Custom actions'),
407
+ onSubmit: z.function().optional().describe('Submit handler'),
408
+ onChange: z.function().optional().describe('Change handler'),
409
+ onCancel: z.function().optional().describe('Cancel handler'),
410
+ showActions: z.boolean().optional().describe('Show action buttons'),
411
+ });
412
+
413
+ /**
414
+ * Form Component Schema Union - All form component schemas
415
+ */
416
+ export const FormComponentSchema = z.union([
417
+ ButtonSchema,
418
+ InputSchema,
419
+ TextareaSchema,
420
+ SelectSchema,
421
+ CheckboxSchema,
422
+ RadioGroupSchema,
423
+ SwitchSchema,
424
+ ToggleSchema,
425
+ SliderSchema,
426
+ FileUploadSchema,
427
+ DatePickerSchema,
428
+ CalendarSchema,
429
+ InputOTPSchema,
430
+ ComboboxSchema,
431
+ LabelSchema,
432
+ CommandSchema,
433
+ FormSchema,
434
+ ]);