@classytic/formkit 1.0.3 → 1.2.2
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/CHANGELOG.md +88 -56
- package/README.md +465 -113
- package/dist/index.d.mts +914 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1044 -0
- package/dist/index.mjs.map +1 -0
- package/dist/server.d.mts +625 -0
- package/dist/server.d.mts.map +1 -0
- package/dist/server.mjs +418 -0
- package/dist/server.mjs.map +1 -0
- package/package.json +24 -31
- package/dist/index.cjs +0 -233
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -511
- package/dist/index.d.ts +0 -511
- package/dist/index.js +0 -223
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
DELETED
|
@@ -1,511 +0,0 @@
|
|
|
1
|
-
import { FieldValues, Path, Control } from 'react-hook-form';
|
|
2
|
-
import { ReactNode, JSX, ComponentType } from 'react';
|
|
3
|
-
import { ClassValue } from 'clsx';
|
|
4
|
-
export { ClassValue } from 'clsx';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Field type identifier.
|
|
8
|
-
* Can be built-in types or custom string identifiers.
|
|
9
|
-
*/
|
|
10
|
-
type FieldType = "text" | "email" | "password" | "number" | "tel" | "url" | "textarea" | "select" | "checkbox" | "radio" | "switch" | "date" | "time" | "datetime" | "file" | "hidden" | "custom" | (string & {});
|
|
11
|
-
/**
|
|
12
|
-
* Layout type identifier.
|
|
13
|
-
*/
|
|
14
|
-
type LayoutType = "section" | "grid" | "default" | (string & {});
|
|
15
|
-
/**
|
|
16
|
-
* Variant identifier for component styling.
|
|
17
|
-
*/
|
|
18
|
-
type Variant = "default" | "compact" | "inline" | (string & {}) | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Single option for select/radio/checkbox fields.
|
|
21
|
-
*/
|
|
22
|
-
interface FieldOption<TValue = string> {
|
|
23
|
-
/** Display label */
|
|
24
|
-
label: string;
|
|
25
|
-
/** Option value */
|
|
26
|
-
value: TValue;
|
|
27
|
-
/** Whether option is disabled */
|
|
28
|
-
disabled?: boolean;
|
|
29
|
-
/** Optional description */
|
|
30
|
-
description?: string;
|
|
31
|
-
/** Optional icon */
|
|
32
|
-
icon?: ReactNode;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Option group for select fields.
|
|
36
|
-
*/
|
|
37
|
-
interface FieldOptionGroup<TValue = string> {
|
|
38
|
-
/** Group label */
|
|
39
|
-
label: string;
|
|
40
|
-
/** Group options */
|
|
41
|
-
options: FieldOption<TValue>[];
|
|
42
|
-
/** Whether group is disabled */
|
|
43
|
-
disabled?: boolean;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Base field configuration shared by all field types.
|
|
47
|
-
* @template TFieldValues - Form field values type for type-safe field names
|
|
48
|
-
*/
|
|
49
|
-
interface BaseField<TFieldValues extends FieldValues = FieldValues> {
|
|
50
|
-
/** Field name (must be a valid path in form values) */
|
|
51
|
-
name: Path<TFieldValues> | (string & {});
|
|
52
|
-
/** Field type identifier */
|
|
53
|
-
type: FieldType;
|
|
54
|
-
/** Field label */
|
|
55
|
-
label?: string;
|
|
56
|
-
/** Placeholder text */
|
|
57
|
-
placeholder?: string;
|
|
58
|
-
/** Helper text shown below the field */
|
|
59
|
-
helperText?: string;
|
|
60
|
-
/** Whether field is disabled */
|
|
61
|
-
disabled?: boolean;
|
|
62
|
-
/** Whether field is required */
|
|
63
|
-
required?: boolean;
|
|
64
|
-
/** Whether field is read-only */
|
|
65
|
-
readOnly?: boolean;
|
|
66
|
-
/** Field variant */
|
|
67
|
-
variant?: Variant;
|
|
68
|
-
/** Whether field should span full width in grid */
|
|
69
|
-
fullWidth?: boolean;
|
|
70
|
-
/** Custom CSS class name */
|
|
71
|
-
className?: string;
|
|
72
|
-
/**
|
|
73
|
-
* Conditional rendering function.
|
|
74
|
-
* Return true to show the field, false to hide.
|
|
75
|
-
*/
|
|
76
|
-
condition?: (formValues: TFieldValues) => boolean;
|
|
77
|
-
/** Default value */
|
|
78
|
-
defaultValue?: unknown;
|
|
79
|
-
/** Options for select/radio/checkbox fields */
|
|
80
|
-
options?: (FieldOption | FieldOptionGroup)[];
|
|
81
|
-
/** Minimum value (for number/date fields) */
|
|
82
|
-
min?: number | string;
|
|
83
|
-
/** Maximum value (for number/date fields) */
|
|
84
|
-
max?: number | string;
|
|
85
|
-
/** Step value (for number fields) */
|
|
86
|
-
step?: number;
|
|
87
|
-
/** Pattern for validation (regex string) */
|
|
88
|
-
pattern?: string;
|
|
89
|
-
/** Minimum length */
|
|
90
|
-
minLength?: number;
|
|
91
|
-
/** Maximum length */
|
|
92
|
-
maxLength?: number;
|
|
93
|
-
/** Number of rows (for textarea) */
|
|
94
|
-
rows?: number;
|
|
95
|
-
/** Multiple selection (for select/file) */
|
|
96
|
-
multiple?: boolean;
|
|
97
|
-
/** Accepted file types (for file input) */
|
|
98
|
-
accept?: string;
|
|
99
|
-
/** Auto-complete attribute */
|
|
100
|
-
autoComplete?: string;
|
|
101
|
-
/** Auto-focus on mount */
|
|
102
|
-
autoFocus?: boolean;
|
|
103
|
-
/** Additional field-specific props (for custom components) */
|
|
104
|
-
[key: string]: unknown;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Props passed to field components.
|
|
108
|
-
*
|
|
109
|
-
* Components receive both:
|
|
110
|
-
* 1. A `field` object with the complete field configuration
|
|
111
|
-
* 2. All field properties spread at the top level
|
|
112
|
-
*
|
|
113
|
-
* @template TFieldValues - Form field values type
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* ```tsx
|
|
117
|
-
* // Schema
|
|
118
|
-
* { name: "email", type: "email", label: "Email", placeholder: "user@example.com" }
|
|
119
|
-
*
|
|
120
|
-
* // Your component receives:
|
|
121
|
-
* {
|
|
122
|
-
* field: { name: "email", type: "email", label: "Email", placeholder: "..." },
|
|
123
|
-
* control: {...},
|
|
124
|
-
* disabled: false,
|
|
125
|
-
* variant: undefined,
|
|
126
|
-
* // PLUS all field props at top level:
|
|
127
|
-
* name: "email",
|
|
128
|
-
* type: "email",
|
|
129
|
-
* label: "Email",
|
|
130
|
-
* placeholder: "user@example.com"
|
|
131
|
-
* }
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
interface FieldComponentProps<TFieldValues extends FieldValues = FieldValues> extends BaseField<TFieldValues> {
|
|
135
|
-
/** Field configuration object (contains all field props) */
|
|
136
|
-
field: BaseField<TFieldValues>;
|
|
137
|
-
/** React Hook Form control for Controller integration */
|
|
138
|
-
control: Control<TFieldValues>;
|
|
139
|
-
/** Whether field is globally disabled */
|
|
140
|
-
disabled?: boolean;
|
|
141
|
-
/** Component variant */
|
|
142
|
-
variant?: Variant;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Field component type.
|
|
146
|
-
* A React component that renders a form field.
|
|
147
|
-
*/
|
|
148
|
-
type FieldComponent<TFieldValues extends FieldValues = FieldValues> = ComponentType<FieldComponentProps<TFieldValues>>;
|
|
149
|
-
/**
|
|
150
|
-
* Section configuration for grouping fields.
|
|
151
|
-
* @template TFieldValues - Form field values type
|
|
152
|
-
*/
|
|
153
|
-
interface Section<TFieldValues extends FieldValues = FieldValues> {
|
|
154
|
-
/** Unique section identifier */
|
|
155
|
-
id?: string;
|
|
156
|
-
/** Section title */
|
|
157
|
-
title?: string;
|
|
158
|
-
/** Section description */
|
|
159
|
-
description?: string;
|
|
160
|
-
/** Section icon */
|
|
161
|
-
icon?: ReactNode;
|
|
162
|
-
/** Fields in this section */
|
|
163
|
-
fields?: BaseField<TFieldValues>[];
|
|
164
|
-
/** Number of columns in grid layout */
|
|
165
|
-
cols?: 1 | 2 | 3 | 4 | 5 | 6 | number;
|
|
166
|
-
/** Gap between grid items (Tailwind spacing scale) */
|
|
167
|
-
gap?: number;
|
|
168
|
-
/**
|
|
169
|
-
* Custom render function for complete control.
|
|
170
|
-
* When provided, fields array is ignored.
|
|
171
|
-
*/
|
|
172
|
-
render?: (props: SectionRenderProps<TFieldValues>) => ReactNode;
|
|
173
|
-
/** Section variant */
|
|
174
|
-
variant?: Variant;
|
|
175
|
-
/** Custom CSS class name */
|
|
176
|
-
className?: string;
|
|
177
|
-
/**
|
|
178
|
-
* Conditional rendering function.
|
|
179
|
-
* Return true to show the section, false to hide.
|
|
180
|
-
*/
|
|
181
|
-
condition?: (control?: Control<TFieldValues>) => boolean;
|
|
182
|
-
/** Whether section is collapsible */
|
|
183
|
-
collapsible?: boolean;
|
|
184
|
-
/** Default collapsed state */
|
|
185
|
-
defaultCollapsed?: boolean;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Props passed to section render function.
|
|
189
|
-
*/
|
|
190
|
-
interface SectionRenderProps<TFieldValues extends FieldValues = FieldValues> {
|
|
191
|
-
control?: Control<TFieldValues>;
|
|
192
|
-
disabled?: boolean;
|
|
193
|
-
section: Section<TFieldValues>;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Section layout component props.
|
|
197
|
-
*/
|
|
198
|
-
interface SectionLayoutProps {
|
|
199
|
-
/** Section title */
|
|
200
|
-
title?: string;
|
|
201
|
-
/** Section description */
|
|
202
|
-
description?: string;
|
|
203
|
-
/** Section icon */
|
|
204
|
-
icon?: ReactNode;
|
|
205
|
-
/** Layout variant */
|
|
206
|
-
variant?: Variant;
|
|
207
|
-
/** Custom CSS class name */
|
|
208
|
-
className?: string;
|
|
209
|
-
/** Whether section is collapsible */
|
|
210
|
-
collapsible?: boolean;
|
|
211
|
-
/** Default collapsed state */
|
|
212
|
-
defaultCollapsed?: boolean;
|
|
213
|
-
/** Children content */
|
|
214
|
-
children: ReactNode;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Grid layout component props.
|
|
218
|
-
*/
|
|
219
|
-
interface GridLayoutProps {
|
|
220
|
-
/** Number of columns */
|
|
221
|
-
cols?: number;
|
|
222
|
-
/** Gap between items */
|
|
223
|
-
gap?: number;
|
|
224
|
-
/** Custom CSS class name */
|
|
225
|
-
className?: string;
|
|
226
|
-
/** Children content */
|
|
227
|
-
children: ReactNode;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Default layout component props.
|
|
231
|
-
*/
|
|
232
|
-
interface DefaultLayoutProps {
|
|
233
|
-
/** Custom CSS class name */
|
|
234
|
-
className?: string;
|
|
235
|
-
/** Children content */
|
|
236
|
-
children: ReactNode;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Union of all layout component props.
|
|
240
|
-
*/
|
|
241
|
-
type LayoutComponentProps = SectionLayoutProps | GridLayoutProps | DefaultLayoutProps;
|
|
242
|
-
/**
|
|
243
|
-
* Layout component type.
|
|
244
|
-
*/
|
|
245
|
-
type LayoutComponent<TProps extends LayoutComponentProps = LayoutComponentProps> = ComponentType<TProps>;
|
|
246
|
-
/**
|
|
247
|
-
* Complete form schema configuration.
|
|
248
|
-
* @template TFieldValues - Form field values type for type-safe schemas
|
|
249
|
-
*/
|
|
250
|
-
interface FormSchema<TFieldValues extends FieldValues = FieldValues> {
|
|
251
|
-
/** Form sections */
|
|
252
|
-
sections: Section<TFieldValues>[];
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Component registry mapping field types to components.
|
|
256
|
-
* Supports variant-specific components via nested objects.
|
|
257
|
-
*
|
|
258
|
-
* @example
|
|
259
|
-
* ```tsx
|
|
260
|
-
* const components: ComponentRegistry = {
|
|
261
|
-
* text: TextInput,
|
|
262
|
-
* select: SelectInput,
|
|
263
|
-
* // Variant-specific
|
|
264
|
-
* compact: {
|
|
265
|
-
* text: CompactTextInput,
|
|
266
|
-
* },
|
|
267
|
-
* };
|
|
268
|
-
* ```
|
|
269
|
-
*/
|
|
270
|
-
interface ComponentRegistry {
|
|
271
|
-
[key: string]: FieldComponent<FieldValues> | ComponentRegistry;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Layout registry mapping layout types to components.
|
|
275
|
-
* Supports variant-specific layouts via nested objects.
|
|
276
|
-
*/
|
|
277
|
-
interface LayoutRegistry {
|
|
278
|
-
[key: string]: LayoutComponent<SectionLayoutProps | GridLayoutProps | DefaultLayoutProps> | LayoutRegistry;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Form system context value.
|
|
282
|
-
*/
|
|
283
|
-
interface FormSystemContextValue {
|
|
284
|
-
/** Registered field components */
|
|
285
|
-
components: ComponentRegistry;
|
|
286
|
-
/** Registered layout components */
|
|
287
|
-
layouts: LayoutRegistry;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Form system provider props.
|
|
291
|
-
*/
|
|
292
|
-
interface FormSystemProviderProps {
|
|
293
|
-
/** Field component registry */
|
|
294
|
-
components?: ComponentRegistry;
|
|
295
|
-
/** Layout component registry */
|
|
296
|
-
layouts?: LayoutRegistry;
|
|
297
|
-
/** Children content */
|
|
298
|
-
children: ReactNode;
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* FormGenerator component props.
|
|
302
|
-
* @template TFieldValues - Form field values type
|
|
303
|
-
*/
|
|
304
|
-
interface FormGeneratorProps<TFieldValues extends FieldValues = FieldValues> {
|
|
305
|
-
/** Form schema defining sections and fields */
|
|
306
|
-
schema: FormSchema<TFieldValues>;
|
|
307
|
-
/** React Hook Form control object */
|
|
308
|
-
control?: Control<TFieldValues>;
|
|
309
|
-
/** Global disabled state for all fields */
|
|
310
|
-
disabled?: boolean;
|
|
311
|
-
/** Global variant for all components */
|
|
312
|
-
variant?: Variant;
|
|
313
|
-
/** Additional CSS class for the root element */
|
|
314
|
-
className?: string;
|
|
315
|
-
}
|
|
316
|
-
/**
|
|
317
|
-
* Extract field names from a schema.
|
|
318
|
-
*/
|
|
319
|
-
type SchemaFieldNames<TSchema extends FormSchema> = TSchema extends FormSchema<infer T> ? keyof T : never;
|
|
320
|
-
/**
|
|
321
|
-
* Infer field values type from a schema.
|
|
322
|
-
*/
|
|
323
|
-
type InferSchemaValues<TSchema extends FormSchema> = TSchema extends FormSchema<infer T> ? T : FieldValues;
|
|
324
|
-
/**
|
|
325
|
-
* Helper type for creating type-safe field definitions.
|
|
326
|
-
*/
|
|
327
|
-
type DefineField<TFieldValues extends FieldValues, TType extends FieldType = FieldType> = BaseField<TFieldValues> & {
|
|
328
|
-
type: TType;
|
|
329
|
-
};
|
|
330
|
-
/**
|
|
331
|
-
* JSX Element return type for components.
|
|
332
|
-
*/
|
|
333
|
-
type FormElement = JSX.Element | null;
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* FormGenerator - Headless Form Generator Component
|
|
337
|
-
*
|
|
338
|
-
* Renders a form based on a schema definition, using components registered
|
|
339
|
-
* via FormSystemProvider. Supports conditional fields, dynamic layouts,
|
|
340
|
-
* and component variants.
|
|
341
|
-
*
|
|
342
|
-
* @template TFieldValues - Form field values type for type safety
|
|
343
|
-
*
|
|
344
|
-
* @example
|
|
345
|
-
* ```tsx
|
|
346
|
-
* import { useForm } from 'react-hook-form';
|
|
347
|
-
* import { FormGenerator } from '@classytic/formkit';
|
|
348
|
-
*
|
|
349
|
-
* interface FormData {
|
|
350
|
-
* firstName: string;
|
|
351
|
-
* email: string;
|
|
352
|
-
* }
|
|
353
|
-
*
|
|
354
|
-
* function MyForm() {
|
|
355
|
-
* const { control } = useForm<FormData>();
|
|
356
|
-
*
|
|
357
|
-
* const schema = {
|
|
358
|
-
* sections: [
|
|
359
|
-
* {
|
|
360
|
-
* title: "User Details",
|
|
361
|
-
* fields: [
|
|
362
|
-
* { name: "firstName", type: "text", label: "First Name" },
|
|
363
|
-
* { name: "email", type: "email", label: "Email" }
|
|
364
|
-
* ]
|
|
365
|
-
* }
|
|
366
|
-
* ]
|
|
367
|
-
* };
|
|
368
|
-
*
|
|
369
|
-
* return <FormGenerator schema={schema} control={control} />;
|
|
370
|
-
* }
|
|
371
|
-
* ```
|
|
372
|
-
*/
|
|
373
|
-
declare function FormGenerator<TFieldValues extends FieldValues = FieldValues>({ schema, control, disabled, variant, className, }: FormGeneratorProps<TFieldValues>): FormElement;
|
|
374
|
-
interface SectionRendererProps<TFieldValues extends FieldValues = FieldValues> {
|
|
375
|
-
section: Section<TFieldValues>;
|
|
376
|
-
control?: Control<TFieldValues>;
|
|
377
|
-
disabled?: boolean;
|
|
378
|
-
variant?: Variant;
|
|
379
|
-
}
|
|
380
|
-
/**
|
|
381
|
-
* Renders a single section with its fields.
|
|
382
|
-
* Handles conditional rendering and variant resolution.
|
|
383
|
-
*/
|
|
384
|
-
declare function SectionRenderer<TFieldValues extends FieldValues = FieldValues>({ section, control, disabled, variant, }: SectionRendererProps<TFieldValues>): FormElement;
|
|
385
|
-
interface GridRendererProps<TFieldValues extends FieldValues = FieldValues> {
|
|
386
|
-
fields?: BaseField<TFieldValues>[];
|
|
387
|
-
cols?: number;
|
|
388
|
-
gap?: number;
|
|
389
|
-
control?: Control<TFieldValues>;
|
|
390
|
-
disabled?: boolean;
|
|
391
|
-
variant?: Variant;
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* Renders a grid of fields with specified column layout.
|
|
395
|
-
*/
|
|
396
|
-
declare function GridRenderer<TFieldValues extends FieldValues = FieldValues>({ fields, cols, gap, control, disabled, variant, }: GridRendererProps<TFieldValues>): FormElement;
|
|
397
|
-
interface FieldWrapperProps<TFieldValues extends FieldValues = FieldValues> {
|
|
398
|
-
field: BaseField<TFieldValues>;
|
|
399
|
-
control?: Control<TFieldValues>;
|
|
400
|
-
disabled?: boolean;
|
|
401
|
-
variant?: Variant;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Wraps individual fields with conditional rendering logic.
|
|
405
|
-
* Handles field visibility and variant resolution.
|
|
406
|
-
*/
|
|
407
|
-
declare function FieldWrapper<TFieldValues extends FieldValues = FieldValues>({ field, control, disabled, variant, }: FieldWrapperProps<TFieldValues>): FormElement;
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* FormSystemProvider
|
|
411
|
-
*
|
|
412
|
-
* Root provider that enables the form system. Provides component and layout
|
|
413
|
-
* registries to FormGenerator and its descendants.
|
|
414
|
-
*
|
|
415
|
-
* @example
|
|
416
|
-
* ```tsx
|
|
417
|
-
* import { FormSystemProvider } from '@classytic/formkit';
|
|
418
|
-
*
|
|
419
|
-
* const components = {
|
|
420
|
-
* text: TextInput,
|
|
421
|
-
* select: SelectInput,
|
|
422
|
-
* // Variant-specific components
|
|
423
|
-
* compact: {
|
|
424
|
-
* text: CompactTextInput,
|
|
425
|
-
* },
|
|
426
|
-
* };
|
|
427
|
-
*
|
|
428
|
-
* const layouts = {
|
|
429
|
-
* section: SectionLayout,
|
|
430
|
-
* grid: GridLayout,
|
|
431
|
-
* };
|
|
432
|
-
*
|
|
433
|
-
* function App() {
|
|
434
|
-
* return (
|
|
435
|
-
* <FormSystemProvider components={components} layouts={layouts}>
|
|
436
|
-
* <YourFormComponent />
|
|
437
|
-
* </FormSystemProvider>
|
|
438
|
-
* );
|
|
439
|
-
* }
|
|
440
|
-
* ```
|
|
441
|
-
*/
|
|
442
|
-
declare function FormSystemProvider({ components, layouts, children, }: FormSystemProviderProps): FormElement;
|
|
443
|
-
/**
|
|
444
|
-
* Hook to access the form system context.
|
|
445
|
-
*
|
|
446
|
-
* @throws {Error} If used outside FormSystemProvider
|
|
447
|
-
* @returns Form system context value
|
|
448
|
-
*
|
|
449
|
-
* @example
|
|
450
|
-
* ```tsx
|
|
451
|
-
* const { components, layouts } = useFormSystem();
|
|
452
|
-
* ```
|
|
453
|
-
*/
|
|
454
|
-
declare function useFormSystem(): FormSystemContextValue;
|
|
455
|
-
/**
|
|
456
|
-
* Hook to get a field component by type and optional variant.
|
|
457
|
-
*
|
|
458
|
-
* Resolution order:
|
|
459
|
-
* 1. Variant-specific component: `components[variant][type]`
|
|
460
|
-
* 2. Type-specific component: `components[type]`
|
|
461
|
-
* 3. Default component: `components["default"]`
|
|
462
|
-
* 4. Text fallback: `components["text"]`
|
|
463
|
-
*
|
|
464
|
-
* @param type - Field type identifier
|
|
465
|
-
* @param variant - Optional variant name
|
|
466
|
-
* @returns Field component or fallback
|
|
467
|
-
*
|
|
468
|
-
* @internal
|
|
469
|
-
*/
|
|
470
|
-
declare function useFieldComponent(type: FieldType, variant?: Variant): FieldComponent;
|
|
471
|
-
/**
|
|
472
|
-
* Hook to get a layout component by type and optional variant.
|
|
473
|
-
*
|
|
474
|
-
* Resolution order:
|
|
475
|
-
* 1. Variant-specific layout: `layouts[variant][type]`
|
|
476
|
-
* 2. Type-specific layout: `layouts[type]`
|
|
477
|
-
* 3. Default layout: `layouts["default"]`
|
|
478
|
-
* 4. Built-in default layout
|
|
479
|
-
*
|
|
480
|
-
* @param type - Layout type identifier
|
|
481
|
-
* @param variant - Optional variant name
|
|
482
|
-
* @returns Layout component or fallback
|
|
483
|
-
*
|
|
484
|
-
* @internal
|
|
485
|
-
*/
|
|
486
|
-
declare function useLayoutComponent(type: LayoutType, variant?: Variant): LayoutComponent<SectionLayoutProps | GridLayoutProps | DefaultLayoutProps>;
|
|
487
|
-
|
|
488
|
-
/**
|
|
489
|
-
* Utility function to merge CSS classes with Tailwind CSS conflict resolution.
|
|
490
|
-
*
|
|
491
|
-
* Combines `clsx` for conditional class handling with `tailwind-merge`
|
|
492
|
-
* for proper Tailwind CSS class conflict resolution.
|
|
493
|
-
*
|
|
494
|
-
* @param inputs - Class values to merge (strings, arrays, objects, or conditionals)
|
|
495
|
-
* @returns Merged and deduplicated class string
|
|
496
|
-
*
|
|
497
|
-
* @example
|
|
498
|
-
* ```tsx
|
|
499
|
-
* // Basic usage
|
|
500
|
-
* cn("px-2 py-1", "px-4") // "py-1 px-4"
|
|
501
|
-
*
|
|
502
|
-
* // Conditional classes
|
|
503
|
-
* cn("base", isActive && "active", { "disabled": isDisabled })
|
|
504
|
-
*
|
|
505
|
-
* // Arrays
|
|
506
|
-
* cn(["flex", "items-center"], "gap-2")
|
|
507
|
-
* ```
|
|
508
|
-
*/
|
|
509
|
-
declare function cn(...inputs: ClassValue[]): string;
|
|
510
|
-
|
|
511
|
-
export { type BaseField, type ComponentRegistry, type DefaultLayoutProps, type DefineField, type FieldComponent, type FieldComponentProps, type FieldOption, type FieldOptionGroup, type FieldType, FieldWrapper, type FormElement, FormGenerator, type FormGeneratorProps, type FormSchema, type FormSystemContextValue, FormSystemProvider, type FormSystemProviderProps, type GridLayoutProps, GridRenderer, type InferSchemaValues, type LayoutComponent, type LayoutComponentProps, type LayoutRegistry, type LayoutType, type SchemaFieldNames, type Section, type SectionLayoutProps, type SectionRenderProps, SectionRenderer, type Variant, cn, useFieldComponent, useFormSystem, useLayoutComponent };
|