@mdxui/terminal 2.0.0
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/README.md +571 -0
- package/dist/ansi-css-Sk5mWtdK.d.ts +119 -0
- package/dist/ansi-css-V6JIHGsM.d.ts +119 -0
- package/dist/ansi-css-_3eSEU9d.d.ts +119 -0
- package/dist/chunk-3EFDH7PK.js +5235 -0
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/chunk-3X5IR6WE.js +884 -0
- package/dist/chunk-4FV5ZDCE.js +5236 -0
- package/dist/chunk-4OVMSF2J.js +243 -0
- package/dist/chunk-63FEETIS.js +4048 -0
- package/dist/chunk-B43KP7XJ.js +884 -0
- package/dist/chunk-BMTJXWUV.js +655 -0
- package/dist/chunk-C3SVH4N7.js +882 -0
- package/dist/chunk-EVWR7Y47.js +874 -0
- package/dist/chunk-F6A5VWUC.js +1285 -0
- package/dist/chunk-FD7KW7GE.js +882 -0
- package/dist/chunk-GBQ6UD6I.js +655 -0
- package/dist/chunk-GMDD3M6U.js +5227 -0
- package/dist/chunk-JBHRXOXM.js +1058 -0
- package/dist/chunk-JFOO3EYO.js +1182 -0
- package/dist/chunk-JQ5H3WXL.js +1291 -0
- package/dist/chunk-JQD5NASE.js +234 -0
- package/dist/chunk-KRHJP5R7.js +592 -0
- package/dist/chunk-KWF6WVJE.js +962 -0
- package/dist/chunk-LHYQVN3H.js +1038 -0
- package/dist/chunk-M3TLQLGC.js +1032 -0
- package/dist/chunk-MVW4Q5OP.js +240 -0
- package/dist/chunk-NXCZSWLU.js +1294 -0
- package/dist/chunk-O25TNRO6.js +607 -0
- package/dist/chunk-PNECDA2I.js +884 -0
- package/dist/chunk-QIHWRLJR.js +962 -0
- package/dist/chunk-QW5YMQ7K.js +882 -0
- package/dist/chunk-R5U7XKVJ.js +16 -0
- package/dist/chunk-RP2MVQLR.js +962 -0
- package/dist/chunk-TP6RXGXA.js +1087 -0
- package/dist/chunk-TQQSTITZ.js +655 -0
- package/dist/chunk-X24GWXQV.js +1281 -0
- package/dist/components/index.d.ts +802 -0
- package/dist/components/index.js +149 -0
- package/dist/data/index.d.ts +2554 -0
- package/dist/data/index.js +51 -0
- package/dist/forms/index.d.ts +1596 -0
- package/dist/forms/index.js +464 -0
- package/dist/index-CQRFZntR.d.ts +867 -0
- package/dist/index.d.ts +579 -0
- package/dist/index.js +786 -0
- package/dist/interactive-D0JkWosD.d.ts +217 -0
- package/dist/keyboard/index.d.ts +2 -0
- package/dist/keyboard/index.js +43 -0
- package/dist/renderers/index.d.ts +546 -0
- package/dist/renderers/index.js +2157 -0
- package/dist/storybook/index.d.ts +396 -0
- package/dist/storybook/index.js +641 -0
- package/dist/theme/index.d.ts +1339 -0
- package/dist/theme/index.js +123 -0
- package/dist/types-Bxu5PAgA.d.ts +710 -0
- package/dist/types-CIlop5Ji.d.ts +701 -0
- package/dist/types-Ca8p_p5X.d.ts +710 -0
- package/package.json +90 -0
- package/src/__tests__/components/data/card.test.ts +458 -0
- package/src/__tests__/components/data/list.test.ts +473 -0
- package/src/__tests__/components/data/metrics.test.ts +541 -0
- package/src/__tests__/components/data/table.test.ts +448 -0
- package/src/__tests__/components/input/field.test.ts +555 -0
- package/src/__tests__/components/input/form.test.ts +870 -0
- package/src/__tests__/components/input/search.test.ts +1238 -0
- package/src/__tests__/components/input/select.test.ts +658 -0
- package/src/__tests__/components/navigation/breadcrumb.test.ts +923 -0
- package/src/__tests__/components/navigation/command-palette.test.ts +1095 -0
- package/src/__tests__/components/navigation/sidebar.test.ts +1018 -0
- package/src/__tests__/components/navigation/tabs.test.ts +995 -0
- package/src/__tests__/components.test.tsx +1197 -0
- package/src/__tests__/core/compiler.test.ts +986 -0
- package/src/__tests__/core/parser.test.ts +785 -0
- package/src/__tests__/core/tier-switcher.test.ts +1103 -0
- package/src/__tests__/core/types.test.ts +1398 -0
- package/src/__tests__/data/collections.test.ts +1337 -0
- package/src/__tests__/data/db.test.ts +1265 -0
- package/src/__tests__/data/reactive.test.ts +1010 -0
- package/src/__tests__/data/sync.test.ts +1614 -0
- package/src/__tests__/errors.test.ts +660 -0
- package/src/__tests__/forms/integration.test.ts +444 -0
- package/src/__tests__/integration.test.ts +905 -0
- package/src/__tests__/keyboard.test.ts +1791 -0
- package/src/__tests__/renderer.test.ts +489 -0
- package/src/__tests__/renderers/ansi-css.test.ts +948 -0
- package/src/__tests__/renderers/ansi.test.ts +1366 -0
- package/src/__tests__/renderers/ascii.test.ts +1360 -0
- package/src/__tests__/renderers/interactive.test.ts +2353 -0
- package/src/__tests__/renderers/markdown.test.ts +1483 -0
- package/src/__tests__/renderers/text.test.ts +1369 -0
- package/src/__tests__/renderers/unicode.test.ts +1307 -0
- package/src/__tests__/theme.test.ts +639 -0
- package/src/__tests__/utils/assertions.ts +685 -0
- package/src/__tests__/utils/index.ts +115 -0
- package/src/__tests__/utils/test-renderer.ts +381 -0
- package/src/__tests__/utils/utils.test.ts +560 -0
- package/src/components/containers/card.ts +56 -0
- package/src/components/containers/dialog.ts +53 -0
- package/src/components/containers/index.ts +9 -0
- package/src/components/containers/panel.ts +59 -0
- package/src/components/feedback/badge.ts +40 -0
- package/src/components/feedback/index.ts +8 -0
- package/src/components/feedback/spinner.ts +23 -0
- package/src/components/helpers.ts +81 -0
- package/src/components/index.ts +153 -0
- package/src/components/layout/breadcrumb.ts +31 -0
- package/src/components/layout/index.ts +10 -0
- package/src/components/layout/list.ts +29 -0
- package/src/components/layout/sidebar.ts +79 -0
- package/src/components/layout/table.ts +62 -0
- package/src/components/primitives/box.ts +95 -0
- package/src/components/primitives/button.ts +54 -0
- package/src/components/primitives/index.ts +11 -0
- package/src/components/primitives/input.ts +88 -0
- package/src/components/primitives/select.ts +97 -0
- package/src/components/primitives/text.ts +60 -0
- package/src/components/render.ts +155 -0
- package/src/components/templates/app.ts +43 -0
- package/src/components/templates/index.ts +8 -0
- package/src/components/templates/site.ts +54 -0
- package/src/components/types.ts +777 -0
- package/src/core/compiler.ts +718 -0
- package/src/core/parser.ts +127 -0
- package/src/core/tier-switcher.ts +607 -0
- package/src/core/types.ts +672 -0
- package/src/data/collection.ts +316 -0
- package/src/data/collections.ts +50 -0
- package/src/data/context.tsx +174 -0
- package/src/data/db.ts +127 -0
- package/src/data/hooks.ts +532 -0
- package/src/data/index.ts +138 -0
- package/src/data/reactive.ts +1225 -0
- package/src/data/saas-collections.ts +375 -0
- package/src/data/sync.ts +1213 -0
- package/src/data/types.ts +660 -0
- package/src/forms/converters.ts +512 -0
- package/src/forms/index.ts +133 -0
- package/src/forms/schemas.ts +403 -0
- package/src/forms/types.ts +476 -0
- package/src/index.ts +542 -0
- package/src/keyboard/focus.ts +748 -0
- package/src/keyboard/index.ts +96 -0
- package/src/keyboard/integration.ts +371 -0
- package/src/keyboard/manager.ts +377 -0
- package/src/keyboard/presets.ts +90 -0
- package/src/renderers/ansi-css.ts +576 -0
- package/src/renderers/ansi.ts +802 -0
- package/src/renderers/ascii.ts +680 -0
- package/src/renderers/breadcrumb.ts +480 -0
- package/src/renderers/command-palette.ts +802 -0
- package/src/renderers/components/field.ts +210 -0
- package/src/renderers/components/form.ts +327 -0
- package/src/renderers/components/index.ts +21 -0
- package/src/renderers/components/search.ts +449 -0
- package/src/renderers/components/select.ts +222 -0
- package/src/renderers/index.ts +101 -0
- package/src/renderers/interactive/component-handlers.ts +622 -0
- package/src/renderers/interactive/cursor-manager.ts +147 -0
- package/src/renderers/interactive/focus-manager.ts +279 -0
- package/src/renderers/interactive/index.ts +661 -0
- package/src/renderers/interactive/input-handler.ts +164 -0
- package/src/renderers/interactive/keyboard-handler.ts +212 -0
- package/src/renderers/interactive/mouse-handler.ts +167 -0
- package/src/renderers/interactive/state-manager.ts +109 -0
- package/src/renderers/interactive/types.ts +338 -0
- package/src/renderers/interactive-string.ts +299 -0
- package/src/renderers/interactive.ts +59 -0
- package/src/renderers/markdown.ts +950 -0
- package/src/renderers/sidebar.ts +549 -0
- package/src/renderers/tabs.ts +682 -0
- package/src/renderers/text.ts +791 -0
- package/src/renderers/unicode.ts +917 -0
- package/src/renderers/utils.ts +942 -0
- package/src/router/adapters.ts +383 -0
- package/src/router/types.ts +140 -0
- package/src/router/utils.ts +452 -0
- package/src/schemas.ts +205 -0
- package/src/storybook/index.ts +91 -0
- package/src/storybook/interactive-decorator.tsx +659 -0
- package/src/storybook/keyboard-simulator.ts +501 -0
- package/src/theme/ansi-codes.ts +80 -0
- package/src/theme/box-drawing.ts +132 -0
- package/src/theme/color-convert.ts +254 -0
- package/src/theme/color-support.ts +321 -0
- package/src/theme/index.ts +134 -0
- package/src/theme/strip-ansi.ts +50 -0
- package/src/theme/tailwind-map.ts +469 -0
- package/src/theme/text-styles.ts +206 -0
- package/src/theme/theme-system.ts +568 -0
- package/src/types.ts +103 -0
|
@@ -0,0 +1,1596 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { U as UINode } from '../types-Bxu5PAgA.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @mdxui/terminal Form Integration Types
|
|
6
|
+
*
|
|
7
|
+
* TypeScript types for React Hook Form integration with terminal renderers.
|
|
8
|
+
* These types provide a bridge between RHF's form state management and the
|
|
9
|
+
* UINode-based rendering system.
|
|
10
|
+
*
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Base field value types supported by terminal form components.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* These represent the primitive values that can be stored in form fields.
|
|
19
|
+
* Compatible with RHF's FieldValues constraint.
|
|
20
|
+
*/
|
|
21
|
+
type FieldValue = string | number | boolean | null | undefined | string[] | FieldValue[];
|
|
22
|
+
/**
|
|
23
|
+
* Generic form values type compatible with React Hook Form.
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* This is the base constraint for all form value types.
|
|
27
|
+
* Equivalent to RHF's FieldValues type.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* interface LoginFormValues extends FormValues {
|
|
32
|
+
* email: string
|
|
33
|
+
* password: string
|
|
34
|
+
* rememberMe: boolean
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
interface FormValues {
|
|
39
|
+
[key: string]: FieldValue | FormValues;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Configuration for a single form field.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* This interface represents the complete state and configuration of a form field,
|
|
46
|
+
* including validation state, UI state, and metadata. This maps directly to
|
|
47
|
+
* the props expected by the Field renderer.
|
|
48
|
+
*
|
|
49
|
+
* @typeParam T - The value type for this field (defaults to FieldValue)
|
|
50
|
+
*/
|
|
51
|
+
interface FieldConfig<T extends FieldValue = FieldValue> {
|
|
52
|
+
/** Unique field name (used as form key) */
|
|
53
|
+
name: string;
|
|
54
|
+
/** Display label for the field */
|
|
55
|
+
label?: string;
|
|
56
|
+
/** Field input type */
|
|
57
|
+
type?: 'text' | 'email' | 'password' | 'number' | 'checkbox' | 'textarea' | 'select';
|
|
58
|
+
/** Current field value */
|
|
59
|
+
value?: T;
|
|
60
|
+
/** Placeholder text when empty */
|
|
61
|
+
placeholder?: string;
|
|
62
|
+
/** Whether the field is required */
|
|
63
|
+
required?: boolean;
|
|
64
|
+
/** Validation error message */
|
|
65
|
+
error?: string;
|
|
66
|
+
/** Whether the field has passed validation */
|
|
67
|
+
valid?: boolean;
|
|
68
|
+
/** Whether the field is disabled */
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
/** Whether the field is read-only */
|
|
71
|
+
readonly?: boolean;
|
|
72
|
+
/** Helper text displayed below the field */
|
|
73
|
+
helperText?: string;
|
|
74
|
+
/** Whether the field is currently focused */
|
|
75
|
+
focused?: boolean;
|
|
76
|
+
/** Cursor position for text inputs (interactive tier) */
|
|
77
|
+
cursorPosition?: number;
|
|
78
|
+
/** Selection start for text inputs (interactive tier) */
|
|
79
|
+
selectionStart?: number;
|
|
80
|
+
/** Selection end for text inputs (interactive tier) */
|
|
81
|
+
selectionEnd?: number;
|
|
82
|
+
/** Options for select fields */
|
|
83
|
+
options?: Array<{
|
|
84
|
+
label: string;
|
|
85
|
+
value: string;
|
|
86
|
+
disabled?: boolean;
|
|
87
|
+
}>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Form group configuration for organizing related fields.
|
|
91
|
+
*
|
|
92
|
+
* @remarks
|
|
93
|
+
* Groups allow organizing fields into logical sections with
|
|
94
|
+
* optional collapse functionality.
|
|
95
|
+
*/
|
|
96
|
+
interface FieldGroup {
|
|
97
|
+
/** Group title */
|
|
98
|
+
title: string;
|
|
99
|
+
/** Fields in this group */
|
|
100
|
+
fields: FieldConfig[];
|
|
101
|
+
/** Whether the group can be collapsed */
|
|
102
|
+
collapsible?: boolean;
|
|
103
|
+
/** Whether the group is currently collapsed */
|
|
104
|
+
collapsed?: boolean;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Complete form state configuration.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* This represents the full state of a form, including all fields,
|
|
111
|
+
* groups, validation state, and submission state. This maps directly
|
|
112
|
+
* to the props expected by the Form renderer.
|
|
113
|
+
*
|
|
114
|
+
* @typeParam T - The form values type
|
|
115
|
+
*/
|
|
116
|
+
interface FormState<T extends FormValues = FormValues> {
|
|
117
|
+
/** Form title */
|
|
118
|
+
title?: string;
|
|
119
|
+
/** Form description */
|
|
120
|
+
description?: string;
|
|
121
|
+
/** Standalone fields (not in groups) */
|
|
122
|
+
fields?: FieldConfig[];
|
|
123
|
+
/** Grouped fields */
|
|
124
|
+
groups?: FieldGroup[];
|
|
125
|
+
/** Form-level error message */
|
|
126
|
+
error?: string;
|
|
127
|
+
/** Form-level success message */
|
|
128
|
+
success?: string;
|
|
129
|
+
/** Whether the form is currently loading/submitting */
|
|
130
|
+
loading?: boolean;
|
|
131
|
+
/** Submit button label */
|
|
132
|
+
submitLabel?: string;
|
|
133
|
+
/** Cancel button label */
|
|
134
|
+
cancelLabel?: string;
|
|
135
|
+
/** Whether the submit button is disabled */
|
|
136
|
+
submitDisabled?: boolean;
|
|
137
|
+
/** Submit button hotkey (interactive tier) */
|
|
138
|
+
submitHotkey?: string;
|
|
139
|
+
/** Whether to show a border around the form */
|
|
140
|
+
border?: boolean;
|
|
141
|
+
/** The current form values (for RHF integration) */
|
|
142
|
+
values?: T;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* RHF register function signature.
|
|
146
|
+
*
|
|
147
|
+
* @remarks
|
|
148
|
+
* This is a simplified version of RHF's UseFormRegister type,
|
|
149
|
+
* designed to work with the terminal renderer system.
|
|
150
|
+
*/
|
|
151
|
+
type RegisterFn = (name: string, options?: {
|
|
152
|
+
required?: boolean | string;
|
|
153
|
+
min?: number | {
|
|
154
|
+
value: number;
|
|
155
|
+
message: string;
|
|
156
|
+
};
|
|
157
|
+
max?: number | {
|
|
158
|
+
value: number;
|
|
159
|
+
message: string;
|
|
160
|
+
};
|
|
161
|
+
minLength?: number | {
|
|
162
|
+
value: number;
|
|
163
|
+
message: string;
|
|
164
|
+
};
|
|
165
|
+
maxLength?: number | {
|
|
166
|
+
value: number;
|
|
167
|
+
message: string;
|
|
168
|
+
};
|
|
169
|
+
pattern?: RegExp | {
|
|
170
|
+
value: RegExp;
|
|
171
|
+
message: string;
|
|
172
|
+
};
|
|
173
|
+
validate?: (value: FieldValue) => boolean | string | Promise<boolean | string>;
|
|
174
|
+
}) => {
|
|
175
|
+
name: string;
|
|
176
|
+
onChange: (event: {
|
|
177
|
+
target: {
|
|
178
|
+
value: FieldValue;
|
|
179
|
+
};
|
|
180
|
+
}) => void;
|
|
181
|
+
onBlur: () => void;
|
|
182
|
+
ref: (element: unknown) => void;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* RHF form state subset relevant to terminal rendering.
|
|
186
|
+
*
|
|
187
|
+
* @remarks
|
|
188
|
+
* This represents the subset of RHF's FormState that is relevant
|
|
189
|
+
* for rendering form UI in the terminal.
|
|
190
|
+
*/
|
|
191
|
+
interface RHFFormState {
|
|
192
|
+
/** Whether the form is currently submitting */
|
|
193
|
+
isSubmitting: boolean;
|
|
194
|
+
/** Whether the form has been submitted at least once */
|
|
195
|
+
isSubmitted: boolean;
|
|
196
|
+
/** Whether the form is valid */
|
|
197
|
+
isValid: boolean;
|
|
198
|
+
/** Whether any field has been modified */
|
|
199
|
+
isDirty: boolean;
|
|
200
|
+
/** Field-level errors */
|
|
201
|
+
errors: Record<string, {
|
|
202
|
+
message?: string;
|
|
203
|
+
type?: string;
|
|
204
|
+
}>;
|
|
205
|
+
/** Fields that have been touched (focused and blurred) */
|
|
206
|
+
touchedFields: Record<string, boolean>;
|
|
207
|
+
/** Fields that have been modified */
|
|
208
|
+
dirtyFields: Record<string, boolean>;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Configuration for connecting RHF to terminal form renderer.
|
|
212
|
+
*
|
|
213
|
+
* @remarks
|
|
214
|
+
* This interface provides the bridge between RHF's hooks and
|
|
215
|
+
* the terminal form rendering system.
|
|
216
|
+
*
|
|
217
|
+
* @typeParam T - The form values type
|
|
218
|
+
*/
|
|
219
|
+
interface RHFFormConfig<T extends FormValues = FormValues> {
|
|
220
|
+
/** RHF register function */
|
|
221
|
+
register: RegisterFn;
|
|
222
|
+
/** RHF form state */
|
|
223
|
+
formState: RHFFormState;
|
|
224
|
+
/** RHF getValues function */
|
|
225
|
+
getValues: () => T;
|
|
226
|
+
/** RHF setValue function */
|
|
227
|
+
setValue: (name: keyof T, value: FieldValue) => void;
|
|
228
|
+
/** RHF trigger function (validate field) */
|
|
229
|
+
trigger: (name?: keyof T | (keyof T)[]) => Promise<boolean>;
|
|
230
|
+
/** RHF handleSubmit function */
|
|
231
|
+
handleSubmit: (onSubmit: (data: T) => void | Promise<void>) => (e?: Event) => Promise<void>;
|
|
232
|
+
/** RHF reset function */
|
|
233
|
+
reset: (values?: Partial<T>) => void;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Select field option configuration.
|
|
237
|
+
*/
|
|
238
|
+
interface SelectOption<T = string> {
|
|
239
|
+
/** Display label */
|
|
240
|
+
label: string;
|
|
241
|
+
/** Value when selected */
|
|
242
|
+
value: T;
|
|
243
|
+
/** Whether the option is disabled */
|
|
244
|
+
disabled?: boolean;
|
|
245
|
+
/** Optional description */
|
|
246
|
+
description?: string;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Select field state configuration.
|
|
250
|
+
*
|
|
251
|
+
* @remarks
|
|
252
|
+
* This maps to the props expected by the Select renderer.
|
|
253
|
+
*/
|
|
254
|
+
interface SelectState<T = string> {
|
|
255
|
+
/** Available options */
|
|
256
|
+
options: SelectOption<T>[];
|
|
257
|
+
/** Currently selected value(s) */
|
|
258
|
+
value?: T | T[];
|
|
259
|
+
/** Field label */
|
|
260
|
+
label?: string;
|
|
261
|
+
/** Placeholder text */
|
|
262
|
+
placeholder?: string;
|
|
263
|
+
/** Whether the field is required */
|
|
264
|
+
required?: boolean;
|
|
265
|
+
/** Validation error message */
|
|
266
|
+
error?: string;
|
|
267
|
+
/** Whether the field has passed validation */
|
|
268
|
+
valid?: boolean;
|
|
269
|
+
/** Whether the field is disabled */
|
|
270
|
+
disabled?: boolean;
|
|
271
|
+
/** Whether the dropdown is open */
|
|
272
|
+
open?: boolean;
|
|
273
|
+
/** Whether multiple selection is allowed */
|
|
274
|
+
multiple?: boolean;
|
|
275
|
+
/** Currently highlighted option index */
|
|
276
|
+
highlightedIndex?: number;
|
|
277
|
+
/** Whether the select is searchable */
|
|
278
|
+
searchable?: boolean;
|
|
279
|
+
/** Current search query */
|
|
280
|
+
searchValue?: string;
|
|
281
|
+
/** Filtered options (when searchable) */
|
|
282
|
+
filteredOptions?: SelectOption<T>[];
|
|
283
|
+
/** Whether options are loading */
|
|
284
|
+
loading?: boolean;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Search field suggestion configuration.
|
|
288
|
+
*/
|
|
289
|
+
interface SearchSuggestion {
|
|
290
|
+
/** Display label */
|
|
291
|
+
label: string;
|
|
292
|
+
/** Value when selected */
|
|
293
|
+
value: string;
|
|
294
|
+
/** Optional description */
|
|
295
|
+
description?: string;
|
|
296
|
+
/** Optional icon identifier */
|
|
297
|
+
icon?: string;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Search field state configuration.
|
|
301
|
+
*
|
|
302
|
+
* @remarks
|
|
303
|
+
* This maps to the props expected by the Search renderer.
|
|
304
|
+
*/
|
|
305
|
+
interface SearchState {
|
|
306
|
+
/** Current search query */
|
|
307
|
+
value: string;
|
|
308
|
+
/** Placeholder text */
|
|
309
|
+
placeholder?: string;
|
|
310
|
+
/** Field label */
|
|
311
|
+
label?: string;
|
|
312
|
+
/** Whether the field is disabled */
|
|
313
|
+
disabled?: boolean;
|
|
314
|
+
/** Whether results are loading */
|
|
315
|
+
loading?: boolean;
|
|
316
|
+
/** Validation error message */
|
|
317
|
+
error?: string;
|
|
318
|
+
/** Whether the field is focused */
|
|
319
|
+
focused?: boolean;
|
|
320
|
+
/** Cursor position (interactive tier) */
|
|
321
|
+
cursorPosition?: number;
|
|
322
|
+
/** Available suggestions */
|
|
323
|
+
suggestions?: SearchSuggestion[] | null;
|
|
324
|
+
/** Whether to show suggestions dropdown */
|
|
325
|
+
showSuggestions?: boolean;
|
|
326
|
+
/** Currently highlighted suggestion index */
|
|
327
|
+
highlightedIndex?: number;
|
|
328
|
+
/** Maximum suggestions to show */
|
|
329
|
+
maxSuggestions?: number;
|
|
330
|
+
/** Whether to highlight matching text */
|
|
331
|
+
highlightMatches?: boolean;
|
|
332
|
+
/** Whether user is currently typing (debounce indicator) */
|
|
333
|
+
isTyping?: boolean;
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Extracts the inferred type from a Zod schema.
|
|
337
|
+
*
|
|
338
|
+
* @remarks
|
|
339
|
+
* Use this to derive TypeScript types from your Zod validation schemas.
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```tsx
|
|
343
|
+
* const loginSchema = z.object({
|
|
344
|
+
* email: z.string().email(),
|
|
345
|
+
* password: z.string().min(8),
|
|
346
|
+
* })
|
|
347
|
+
*
|
|
348
|
+
* type LoginForm = InferFormValues<typeof loginSchema>
|
|
349
|
+
* // { email: string; password: string }
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
type InferFormValues<T extends z.ZodType> = z.infer<T>;
|
|
353
|
+
/**
|
|
354
|
+
* Converts RHF form state to terminal FormState format.
|
|
355
|
+
*
|
|
356
|
+
* @remarks
|
|
357
|
+
* This type represents a function that transforms RHF's internal
|
|
358
|
+
* state representation to the format expected by terminal renderers.
|
|
359
|
+
*/
|
|
360
|
+
type FormStateConverter<T extends FormValues = FormValues> = (rhfConfig: RHFFormConfig<T>, fieldConfigs: FieldConfig[]) => FormState<T>;
|
|
361
|
+
/**
|
|
362
|
+
* Field registration options for RHF integration.
|
|
363
|
+
*/
|
|
364
|
+
interface FieldRegistration {
|
|
365
|
+
/** Field name */
|
|
366
|
+
name: string;
|
|
367
|
+
/** Validation rules */
|
|
368
|
+
rules?: {
|
|
369
|
+
required?: boolean | string;
|
|
370
|
+
min?: number | {
|
|
371
|
+
value: number;
|
|
372
|
+
message: string;
|
|
373
|
+
};
|
|
374
|
+
max?: number | {
|
|
375
|
+
value: number;
|
|
376
|
+
message: string;
|
|
377
|
+
};
|
|
378
|
+
minLength?: number | {
|
|
379
|
+
value: number;
|
|
380
|
+
message: string;
|
|
381
|
+
};
|
|
382
|
+
maxLength?: number | {
|
|
383
|
+
value: number;
|
|
384
|
+
message: string;
|
|
385
|
+
};
|
|
386
|
+
pattern?: RegExp | {
|
|
387
|
+
value: RegExp;
|
|
388
|
+
message: string;
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
/** Default value */
|
|
392
|
+
defaultValue?: FieldValue;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* @mdxui/terminal Form Zod Schemas
|
|
397
|
+
*
|
|
398
|
+
* Zod validation schemas for terminal form components.
|
|
399
|
+
* These schemas can be used with @hookform/resolvers/zod for
|
|
400
|
+
* React Hook Form integration.
|
|
401
|
+
*
|
|
402
|
+
* @packageDocumentation
|
|
403
|
+
*/
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Schema for primitive field values.
|
|
407
|
+
*/
|
|
408
|
+
declare const FieldValueSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined, z.ZodArray<z.ZodString, "many">]>;
|
|
409
|
+
/**
|
|
410
|
+
* Schema for select option configuration.
|
|
411
|
+
*/
|
|
412
|
+
declare const SelectOptionSchema: z.ZodObject<{
|
|
413
|
+
label: z.ZodString;
|
|
414
|
+
value: z.ZodString;
|
|
415
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
416
|
+
description: z.ZodOptional<z.ZodString>;
|
|
417
|
+
}, "strip", z.ZodTypeAny, {
|
|
418
|
+
value: string;
|
|
419
|
+
label: string;
|
|
420
|
+
disabled?: boolean | undefined;
|
|
421
|
+
description?: string | undefined;
|
|
422
|
+
}, {
|
|
423
|
+
value: string;
|
|
424
|
+
label: string;
|
|
425
|
+
disabled?: boolean | undefined;
|
|
426
|
+
description?: string | undefined;
|
|
427
|
+
}>;
|
|
428
|
+
/**
|
|
429
|
+
* Schema for search suggestion configuration.
|
|
430
|
+
*/
|
|
431
|
+
declare const SearchSuggestionSchema: z.ZodObject<{
|
|
432
|
+
label: z.ZodString;
|
|
433
|
+
value: z.ZodString;
|
|
434
|
+
description: z.ZodOptional<z.ZodString>;
|
|
435
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
436
|
+
}, "strip", z.ZodTypeAny, {
|
|
437
|
+
value: string;
|
|
438
|
+
label: string;
|
|
439
|
+
description?: string | undefined;
|
|
440
|
+
icon?: string | undefined;
|
|
441
|
+
}, {
|
|
442
|
+
value: string;
|
|
443
|
+
label: string;
|
|
444
|
+
description?: string | undefined;
|
|
445
|
+
icon?: string | undefined;
|
|
446
|
+
}>;
|
|
447
|
+
/**
|
|
448
|
+
* Schema for field input types.
|
|
449
|
+
*/
|
|
450
|
+
declare const FieldTypeSchema: z.ZodEnum<["text", "email", "password", "number", "checkbox", "textarea", "select"]>;
|
|
451
|
+
/**
|
|
452
|
+
* Schema for field configuration.
|
|
453
|
+
*
|
|
454
|
+
* @remarks
|
|
455
|
+
* Validates the complete structure of a form field configuration.
|
|
456
|
+
* Use this to validate field configs passed to terminal renderers.
|
|
457
|
+
*/
|
|
458
|
+
declare const FieldConfigSchema: z.ZodObject<{
|
|
459
|
+
name: z.ZodString;
|
|
460
|
+
label: z.ZodOptional<z.ZodString>;
|
|
461
|
+
type: z.ZodOptional<z.ZodEnum<["text", "email", "password", "number", "checkbox", "textarea", "select"]>>;
|
|
462
|
+
value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined, z.ZodArray<z.ZodString, "many">]>>;
|
|
463
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
464
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
465
|
+
error: z.ZodOptional<z.ZodString>;
|
|
466
|
+
valid: z.ZodOptional<z.ZodBoolean>;
|
|
467
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
468
|
+
readonly: z.ZodOptional<z.ZodBoolean>;
|
|
469
|
+
helperText: z.ZodOptional<z.ZodString>;
|
|
470
|
+
focused: z.ZodOptional<z.ZodBoolean>;
|
|
471
|
+
cursorPosition: z.ZodOptional<z.ZodNumber>;
|
|
472
|
+
selectionStart: z.ZodOptional<z.ZodNumber>;
|
|
473
|
+
selectionEnd: z.ZodOptional<z.ZodNumber>;
|
|
474
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
475
|
+
label: z.ZodString;
|
|
476
|
+
value: z.ZodString;
|
|
477
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
478
|
+
description: z.ZodOptional<z.ZodString>;
|
|
479
|
+
}, "strip", z.ZodTypeAny, {
|
|
480
|
+
value: string;
|
|
481
|
+
label: string;
|
|
482
|
+
disabled?: boolean | undefined;
|
|
483
|
+
description?: string | undefined;
|
|
484
|
+
}, {
|
|
485
|
+
value: string;
|
|
486
|
+
label: string;
|
|
487
|
+
disabled?: boolean | undefined;
|
|
488
|
+
description?: string | undefined;
|
|
489
|
+
}>, "many">>;
|
|
490
|
+
}, "strip", z.ZodTypeAny, {
|
|
491
|
+
name: string;
|
|
492
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
493
|
+
valid?: boolean | undefined;
|
|
494
|
+
options?: {
|
|
495
|
+
value: string;
|
|
496
|
+
label: string;
|
|
497
|
+
disabled?: boolean | undefined;
|
|
498
|
+
description?: string | undefined;
|
|
499
|
+
}[] | undefined;
|
|
500
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
501
|
+
label?: string | undefined;
|
|
502
|
+
disabled?: boolean | undefined;
|
|
503
|
+
placeholder?: string | undefined;
|
|
504
|
+
required?: boolean | undefined;
|
|
505
|
+
error?: string | undefined;
|
|
506
|
+
readonly?: boolean | undefined;
|
|
507
|
+
helperText?: string | undefined;
|
|
508
|
+
focused?: boolean | undefined;
|
|
509
|
+
cursorPosition?: number | undefined;
|
|
510
|
+
selectionStart?: number | undefined;
|
|
511
|
+
selectionEnd?: number | undefined;
|
|
512
|
+
}, {
|
|
513
|
+
name: string;
|
|
514
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
515
|
+
valid?: boolean | undefined;
|
|
516
|
+
options?: {
|
|
517
|
+
value: string;
|
|
518
|
+
label: string;
|
|
519
|
+
disabled?: boolean | undefined;
|
|
520
|
+
description?: string | undefined;
|
|
521
|
+
}[] | undefined;
|
|
522
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
523
|
+
label?: string | undefined;
|
|
524
|
+
disabled?: boolean | undefined;
|
|
525
|
+
placeholder?: string | undefined;
|
|
526
|
+
required?: boolean | undefined;
|
|
527
|
+
error?: string | undefined;
|
|
528
|
+
readonly?: boolean | undefined;
|
|
529
|
+
helperText?: string | undefined;
|
|
530
|
+
focused?: boolean | undefined;
|
|
531
|
+
cursorPosition?: number | undefined;
|
|
532
|
+
selectionStart?: number | undefined;
|
|
533
|
+
selectionEnd?: number | undefined;
|
|
534
|
+
}>;
|
|
535
|
+
/**
|
|
536
|
+
* Schema for field group configuration.
|
|
537
|
+
*/
|
|
538
|
+
declare const FieldGroupSchema: z.ZodObject<{
|
|
539
|
+
title: z.ZodString;
|
|
540
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
541
|
+
name: z.ZodString;
|
|
542
|
+
label: z.ZodOptional<z.ZodString>;
|
|
543
|
+
type: z.ZodOptional<z.ZodEnum<["text", "email", "password", "number", "checkbox", "textarea", "select"]>>;
|
|
544
|
+
value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined, z.ZodArray<z.ZodString, "many">]>>;
|
|
545
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
546
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
547
|
+
error: z.ZodOptional<z.ZodString>;
|
|
548
|
+
valid: z.ZodOptional<z.ZodBoolean>;
|
|
549
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
550
|
+
readonly: z.ZodOptional<z.ZodBoolean>;
|
|
551
|
+
helperText: z.ZodOptional<z.ZodString>;
|
|
552
|
+
focused: z.ZodOptional<z.ZodBoolean>;
|
|
553
|
+
cursorPosition: z.ZodOptional<z.ZodNumber>;
|
|
554
|
+
selectionStart: z.ZodOptional<z.ZodNumber>;
|
|
555
|
+
selectionEnd: z.ZodOptional<z.ZodNumber>;
|
|
556
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
557
|
+
label: z.ZodString;
|
|
558
|
+
value: z.ZodString;
|
|
559
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
560
|
+
description: z.ZodOptional<z.ZodString>;
|
|
561
|
+
}, "strip", z.ZodTypeAny, {
|
|
562
|
+
value: string;
|
|
563
|
+
label: string;
|
|
564
|
+
disabled?: boolean | undefined;
|
|
565
|
+
description?: string | undefined;
|
|
566
|
+
}, {
|
|
567
|
+
value: string;
|
|
568
|
+
label: string;
|
|
569
|
+
disabled?: boolean | undefined;
|
|
570
|
+
description?: string | undefined;
|
|
571
|
+
}>, "many">>;
|
|
572
|
+
}, "strip", z.ZodTypeAny, {
|
|
573
|
+
name: string;
|
|
574
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
575
|
+
valid?: boolean | undefined;
|
|
576
|
+
options?: {
|
|
577
|
+
value: string;
|
|
578
|
+
label: string;
|
|
579
|
+
disabled?: boolean | undefined;
|
|
580
|
+
description?: string | undefined;
|
|
581
|
+
}[] | undefined;
|
|
582
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
583
|
+
label?: string | undefined;
|
|
584
|
+
disabled?: boolean | undefined;
|
|
585
|
+
placeholder?: string | undefined;
|
|
586
|
+
required?: boolean | undefined;
|
|
587
|
+
error?: string | undefined;
|
|
588
|
+
readonly?: boolean | undefined;
|
|
589
|
+
helperText?: string | undefined;
|
|
590
|
+
focused?: boolean | undefined;
|
|
591
|
+
cursorPosition?: number | undefined;
|
|
592
|
+
selectionStart?: number | undefined;
|
|
593
|
+
selectionEnd?: number | undefined;
|
|
594
|
+
}, {
|
|
595
|
+
name: string;
|
|
596
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
597
|
+
valid?: boolean | undefined;
|
|
598
|
+
options?: {
|
|
599
|
+
value: string;
|
|
600
|
+
label: string;
|
|
601
|
+
disabled?: boolean | undefined;
|
|
602
|
+
description?: string | undefined;
|
|
603
|
+
}[] | undefined;
|
|
604
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
605
|
+
label?: string | undefined;
|
|
606
|
+
disabled?: boolean | undefined;
|
|
607
|
+
placeholder?: string | undefined;
|
|
608
|
+
required?: boolean | undefined;
|
|
609
|
+
error?: string | undefined;
|
|
610
|
+
readonly?: boolean | undefined;
|
|
611
|
+
helperText?: string | undefined;
|
|
612
|
+
focused?: boolean | undefined;
|
|
613
|
+
cursorPosition?: number | undefined;
|
|
614
|
+
selectionStart?: number | undefined;
|
|
615
|
+
selectionEnd?: number | undefined;
|
|
616
|
+
}>, "many">;
|
|
617
|
+
collapsible: z.ZodOptional<z.ZodBoolean>;
|
|
618
|
+
collapsed: z.ZodOptional<z.ZodBoolean>;
|
|
619
|
+
}, "strip", z.ZodTypeAny, {
|
|
620
|
+
title: string;
|
|
621
|
+
fields: {
|
|
622
|
+
name: string;
|
|
623
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
624
|
+
valid?: boolean | undefined;
|
|
625
|
+
options?: {
|
|
626
|
+
value: string;
|
|
627
|
+
label: string;
|
|
628
|
+
disabled?: boolean | undefined;
|
|
629
|
+
description?: string | undefined;
|
|
630
|
+
}[] | undefined;
|
|
631
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
632
|
+
label?: string | undefined;
|
|
633
|
+
disabled?: boolean | undefined;
|
|
634
|
+
placeholder?: string | undefined;
|
|
635
|
+
required?: boolean | undefined;
|
|
636
|
+
error?: string | undefined;
|
|
637
|
+
readonly?: boolean | undefined;
|
|
638
|
+
helperText?: string | undefined;
|
|
639
|
+
focused?: boolean | undefined;
|
|
640
|
+
cursorPosition?: number | undefined;
|
|
641
|
+
selectionStart?: number | undefined;
|
|
642
|
+
selectionEnd?: number | undefined;
|
|
643
|
+
}[];
|
|
644
|
+
collapsible?: boolean | undefined;
|
|
645
|
+
collapsed?: boolean | undefined;
|
|
646
|
+
}, {
|
|
647
|
+
title: string;
|
|
648
|
+
fields: {
|
|
649
|
+
name: string;
|
|
650
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
651
|
+
valid?: boolean | undefined;
|
|
652
|
+
options?: {
|
|
653
|
+
value: string;
|
|
654
|
+
label: string;
|
|
655
|
+
disabled?: boolean | undefined;
|
|
656
|
+
description?: string | undefined;
|
|
657
|
+
}[] | undefined;
|
|
658
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
659
|
+
label?: string | undefined;
|
|
660
|
+
disabled?: boolean | undefined;
|
|
661
|
+
placeholder?: string | undefined;
|
|
662
|
+
required?: boolean | undefined;
|
|
663
|
+
error?: string | undefined;
|
|
664
|
+
readonly?: boolean | undefined;
|
|
665
|
+
helperText?: string | undefined;
|
|
666
|
+
focused?: boolean | undefined;
|
|
667
|
+
cursorPosition?: number | undefined;
|
|
668
|
+
selectionStart?: number | undefined;
|
|
669
|
+
selectionEnd?: number | undefined;
|
|
670
|
+
}[];
|
|
671
|
+
collapsible?: boolean | undefined;
|
|
672
|
+
collapsed?: boolean | undefined;
|
|
673
|
+
}>;
|
|
674
|
+
/**
|
|
675
|
+
* Schema for complete form state.
|
|
676
|
+
*
|
|
677
|
+
* @remarks
|
|
678
|
+
* Validates the full form configuration including all fields,
|
|
679
|
+
* groups, and UI state. Use this to validate form configs
|
|
680
|
+
* passed to the Form renderer.
|
|
681
|
+
*/
|
|
682
|
+
declare const FormStateSchema: z.ZodObject<{
|
|
683
|
+
title: z.ZodOptional<z.ZodString>;
|
|
684
|
+
description: z.ZodOptional<z.ZodString>;
|
|
685
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
686
|
+
name: z.ZodString;
|
|
687
|
+
label: z.ZodOptional<z.ZodString>;
|
|
688
|
+
type: z.ZodOptional<z.ZodEnum<["text", "email", "password", "number", "checkbox", "textarea", "select"]>>;
|
|
689
|
+
value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined, z.ZodArray<z.ZodString, "many">]>>;
|
|
690
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
691
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
692
|
+
error: z.ZodOptional<z.ZodString>;
|
|
693
|
+
valid: z.ZodOptional<z.ZodBoolean>;
|
|
694
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
695
|
+
readonly: z.ZodOptional<z.ZodBoolean>;
|
|
696
|
+
helperText: z.ZodOptional<z.ZodString>;
|
|
697
|
+
focused: z.ZodOptional<z.ZodBoolean>;
|
|
698
|
+
cursorPosition: z.ZodOptional<z.ZodNumber>;
|
|
699
|
+
selectionStart: z.ZodOptional<z.ZodNumber>;
|
|
700
|
+
selectionEnd: z.ZodOptional<z.ZodNumber>;
|
|
701
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
702
|
+
label: z.ZodString;
|
|
703
|
+
value: z.ZodString;
|
|
704
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
705
|
+
description: z.ZodOptional<z.ZodString>;
|
|
706
|
+
}, "strip", z.ZodTypeAny, {
|
|
707
|
+
value: string;
|
|
708
|
+
label: string;
|
|
709
|
+
disabled?: boolean | undefined;
|
|
710
|
+
description?: string | undefined;
|
|
711
|
+
}, {
|
|
712
|
+
value: string;
|
|
713
|
+
label: string;
|
|
714
|
+
disabled?: boolean | undefined;
|
|
715
|
+
description?: string | undefined;
|
|
716
|
+
}>, "many">>;
|
|
717
|
+
}, "strip", z.ZodTypeAny, {
|
|
718
|
+
name: string;
|
|
719
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
720
|
+
valid?: boolean | undefined;
|
|
721
|
+
options?: {
|
|
722
|
+
value: string;
|
|
723
|
+
label: string;
|
|
724
|
+
disabled?: boolean | undefined;
|
|
725
|
+
description?: string | undefined;
|
|
726
|
+
}[] | undefined;
|
|
727
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
728
|
+
label?: string | undefined;
|
|
729
|
+
disabled?: boolean | undefined;
|
|
730
|
+
placeholder?: string | undefined;
|
|
731
|
+
required?: boolean | undefined;
|
|
732
|
+
error?: string | undefined;
|
|
733
|
+
readonly?: boolean | undefined;
|
|
734
|
+
helperText?: string | undefined;
|
|
735
|
+
focused?: boolean | undefined;
|
|
736
|
+
cursorPosition?: number | undefined;
|
|
737
|
+
selectionStart?: number | undefined;
|
|
738
|
+
selectionEnd?: number | undefined;
|
|
739
|
+
}, {
|
|
740
|
+
name: string;
|
|
741
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
742
|
+
valid?: boolean | undefined;
|
|
743
|
+
options?: {
|
|
744
|
+
value: string;
|
|
745
|
+
label: string;
|
|
746
|
+
disabled?: boolean | undefined;
|
|
747
|
+
description?: string | undefined;
|
|
748
|
+
}[] | undefined;
|
|
749
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
750
|
+
label?: string | undefined;
|
|
751
|
+
disabled?: boolean | undefined;
|
|
752
|
+
placeholder?: string | undefined;
|
|
753
|
+
required?: boolean | undefined;
|
|
754
|
+
error?: string | undefined;
|
|
755
|
+
readonly?: boolean | undefined;
|
|
756
|
+
helperText?: string | undefined;
|
|
757
|
+
focused?: boolean | undefined;
|
|
758
|
+
cursorPosition?: number | undefined;
|
|
759
|
+
selectionStart?: number | undefined;
|
|
760
|
+
selectionEnd?: number | undefined;
|
|
761
|
+
}>, "many">>;
|
|
762
|
+
groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
763
|
+
title: z.ZodString;
|
|
764
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
765
|
+
name: z.ZodString;
|
|
766
|
+
label: z.ZodOptional<z.ZodString>;
|
|
767
|
+
type: z.ZodOptional<z.ZodEnum<["text", "email", "password", "number", "checkbox", "textarea", "select"]>>;
|
|
768
|
+
value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined, z.ZodArray<z.ZodString, "many">]>>;
|
|
769
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
770
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
771
|
+
error: z.ZodOptional<z.ZodString>;
|
|
772
|
+
valid: z.ZodOptional<z.ZodBoolean>;
|
|
773
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
774
|
+
readonly: z.ZodOptional<z.ZodBoolean>;
|
|
775
|
+
helperText: z.ZodOptional<z.ZodString>;
|
|
776
|
+
focused: z.ZodOptional<z.ZodBoolean>;
|
|
777
|
+
cursorPosition: z.ZodOptional<z.ZodNumber>;
|
|
778
|
+
selectionStart: z.ZodOptional<z.ZodNumber>;
|
|
779
|
+
selectionEnd: z.ZodOptional<z.ZodNumber>;
|
|
780
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
781
|
+
label: z.ZodString;
|
|
782
|
+
value: z.ZodString;
|
|
783
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
784
|
+
description: z.ZodOptional<z.ZodString>;
|
|
785
|
+
}, "strip", z.ZodTypeAny, {
|
|
786
|
+
value: string;
|
|
787
|
+
label: string;
|
|
788
|
+
disabled?: boolean | undefined;
|
|
789
|
+
description?: string | undefined;
|
|
790
|
+
}, {
|
|
791
|
+
value: string;
|
|
792
|
+
label: string;
|
|
793
|
+
disabled?: boolean | undefined;
|
|
794
|
+
description?: string | undefined;
|
|
795
|
+
}>, "many">>;
|
|
796
|
+
}, "strip", z.ZodTypeAny, {
|
|
797
|
+
name: string;
|
|
798
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
799
|
+
valid?: boolean | undefined;
|
|
800
|
+
options?: {
|
|
801
|
+
value: string;
|
|
802
|
+
label: string;
|
|
803
|
+
disabled?: boolean | undefined;
|
|
804
|
+
description?: string | undefined;
|
|
805
|
+
}[] | undefined;
|
|
806
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
807
|
+
label?: string | undefined;
|
|
808
|
+
disabled?: boolean | undefined;
|
|
809
|
+
placeholder?: string | undefined;
|
|
810
|
+
required?: boolean | undefined;
|
|
811
|
+
error?: string | undefined;
|
|
812
|
+
readonly?: boolean | undefined;
|
|
813
|
+
helperText?: string | undefined;
|
|
814
|
+
focused?: boolean | undefined;
|
|
815
|
+
cursorPosition?: number | undefined;
|
|
816
|
+
selectionStart?: number | undefined;
|
|
817
|
+
selectionEnd?: number | undefined;
|
|
818
|
+
}, {
|
|
819
|
+
name: string;
|
|
820
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
821
|
+
valid?: boolean | undefined;
|
|
822
|
+
options?: {
|
|
823
|
+
value: string;
|
|
824
|
+
label: string;
|
|
825
|
+
disabled?: boolean | undefined;
|
|
826
|
+
description?: string | undefined;
|
|
827
|
+
}[] | undefined;
|
|
828
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
829
|
+
label?: string | undefined;
|
|
830
|
+
disabled?: boolean | undefined;
|
|
831
|
+
placeholder?: string | undefined;
|
|
832
|
+
required?: boolean | undefined;
|
|
833
|
+
error?: string | undefined;
|
|
834
|
+
readonly?: boolean | undefined;
|
|
835
|
+
helperText?: string | undefined;
|
|
836
|
+
focused?: boolean | undefined;
|
|
837
|
+
cursorPosition?: number | undefined;
|
|
838
|
+
selectionStart?: number | undefined;
|
|
839
|
+
selectionEnd?: number | undefined;
|
|
840
|
+
}>, "many">;
|
|
841
|
+
collapsible: z.ZodOptional<z.ZodBoolean>;
|
|
842
|
+
collapsed: z.ZodOptional<z.ZodBoolean>;
|
|
843
|
+
}, "strip", z.ZodTypeAny, {
|
|
844
|
+
title: string;
|
|
845
|
+
fields: {
|
|
846
|
+
name: string;
|
|
847
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
848
|
+
valid?: boolean | undefined;
|
|
849
|
+
options?: {
|
|
850
|
+
value: string;
|
|
851
|
+
label: string;
|
|
852
|
+
disabled?: boolean | undefined;
|
|
853
|
+
description?: string | undefined;
|
|
854
|
+
}[] | undefined;
|
|
855
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
856
|
+
label?: string | undefined;
|
|
857
|
+
disabled?: boolean | undefined;
|
|
858
|
+
placeholder?: string | undefined;
|
|
859
|
+
required?: boolean | undefined;
|
|
860
|
+
error?: string | undefined;
|
|
861
|
+
readonly?: boolean | undefined;
|
|
862
|
+
helperText?: string | undefined;
|
|
863
|
+
focused?: boolean | undefined;
|
|
864
|
+
cursorPosition?: number | undefined;
|
|
865
|
+
selectionStart?: number | undefined;
|
|
866
|
+
selectionEnd?: number | undefined;
|
|
867
|
+
}[];
|
|
868
|
+
collapsible?: boolean | undefined;
|
|
869
|
+
collapsed?: boolean | undefined;
|
|
870
|
+
}, {
|
|
871
|
+
title: string;
|
|
872
|
+
fields: {
|
|
873
|
+
name: string;
|
|
874
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
875
|
+
valid?: boolean | undefined;
|
|
876
|
+
options?: {
|
|
877
|
+
value: string;
|
|
878
|
+
label: string;
|
|
879
|
+
disabled?: boolean | undefined;
|
|
880
|
+
description?: string | undefined;
|
|
881
|
+
}[] | undefined;
|
|
882
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
883
|
+
label?: string | undefined;
|
|
884
|
+
disabled?: boolean | undefined;
|
|
885
|
+
placeholder?: string | undefined;
|
|
886
|
+
required?: boolean | undefined;
|
|
887
|
+
error?: string | undefined;
|
|
888
|
+
readonly?: boolean | undefined;
|
|
889
|
+
helperText?: string | undefined;
|
|
890
|
+
focused?: boolean | undefined;
|
|
891
|
+
cursorPosition?: number | undefined;
|
|
892
|
+
selectionStart?: number | undefined;
|
|
893
|
+
selectionEnd?: number | undefined;
|
|
894
|
+
}[];
|
|
895
|
+
collapsible?: boolean | undefined;
|
|
896
|
+
collapsed?: boolean | undefined;
|
|
897
|
+
}>, "many">>;
|
|
898
|
+
error: z.ZodOptional<z.ZodString>;
|
|
899
|
+
success: z.ZodOptional<z.ZodString>;
|
|
900
|
+
loading: z.ZodOptional<z.ZodBoolean>;
|
|
901
|
+
submitLabel: z.ZodOptional<z.ZodString>;
|
|
902
|
+
cancelLabel: z.ZodOptional<z.ZodString>;
|
|
903
|
+
submitDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
904
|
+
submitHotkey: z.ZodOptional<z.ZodString>;
|
|
905
|
+
border: z.ZodOptional<z.ZodBoolean>;
|
|
906
|
+
}, "strip", z.ZodTypeAny, {
|
|
907
|
+
description?: string | undefined;
|
|
908
|
+
error?: string | undefined;
|
|
909
|
+
title?: string | undefined;
|
|
910
|
+
fields?: {
|
|
911
|
+
name: string;
|
|
912
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
913
|
+
valid?: boolean | undefined;
|
|
914
|
+
options?: {
|
|
915
|
+
value: string;
|
|
916
|
+
label: string;
|
|
917
|
+
disabled?: boolean | undefined;
|
|
918
|
+
description?: string | undefined;
|
|
919
|
+
}[] | undefined;
|
|
920
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
921
|
+
label?: string | undefined;
|
|
922
|
+
disabled?: boolean | undefined;
|
|
923
|
+
placeholder?: string | undefined;
|
|
924
|
+
required?: boolean | undefined;
|
|
925
|
+
error?: string | undefined;
|
|
926
|
+
readonly?: boolean | undefined;
|
|
927
|
+
helperText?: string | undefined;
|
|
928
|
+
focused?: boolean | undefined;
|
|
929
|
+
cursorPosition?: number | undefined;
|
|
930
|
+
selectionStart?: number | undefined;
|
|
931
|
+
selectionEnd?: number | undefined;
|
|
932
|
+
}[] | undefined;
|
|
933
|
+
groups?: {
|
|
934
|
+
title: string;
|
|
935
|
+
fields: {
|
|
936
|
+
name: string;
|
|
937
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
938
|
+
valid?: boolean | undefined;
|
|
939
|
+
options?: {
|
|
940
|
+
value: string;
|
|
941
|
+
label: string;
|
|
942
|
+
disabled?: boolean | undefined;
|
|
943
|
+
description?: string | undefined;
|
|
944
|
+
}[] | undefined;
|
|
945
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
946
|
+
label?: string | undefined;
|
|
947
|
+
disabled?: boolean | undefined;
|
|
948
|
+
placeholder?: string | undefined;
|
|
949
|
+
required?: boolean | undefined;
|
|
950
|
+
error?: string | undefined;
|
|
951
|
+
readonly?: boolean | undefined;
|
|
952
|
+
helperText?: string | undefined;
|
|
953
|
+
focused?: boolean | undefined;
|
|
954
|
+
cursorPosition?: number | undefined;
|
|
955
|
+
selectionStart?: number | undefined;
|
|
956
|
+
selectionEnd?: number | undefined;
|
|
957
|
+
}[];
|
|
958
|
+
collapsible?: boolean | undefined;
|
|
959
|
+
collapsed?: boolean | undefined;
|
|
960
|
+
}[] | undefined;
|
|
961
|
+
success?: string | undefined;
|
|
962
|
+
loading?: boolean | undefined;
|
|
963
|
+
submitLabel?: string | undefined;
|
|
964
|
+
cancelLabel?: string | undefined;
|
|
965
|
+
submitDisabled?: boolean | undefined;
|
|
966
|
+
submitHotkey?: string | undefined;
|
|
967
|
+
border?: boolean | undefined;
|
|
968
|
+
}, {
|
|
969
|
+
description?: string | undefined;
|
|
970
|
+
error?: string | undefined;
|
|
971
|
+
title?: string | undefined;
|
|
972
|
+
fields?: {
|
|
973
|
+
name: string;
|
|
974
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
975
|
+
valid?: boolean | undefined;
|
|
976
|
+
options?: {
|
|
977
|
+
value: string;
|
|
978
|
+
label: string;
|
|
979
|
+
disabled?: boolean | undefined;
|
|
980
|
+
description?: string | undefined;
|
|
981
|
+
}[] | undefined;
|
|
982
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
983
|
+
label?: string | undefined;
|
|
984
|
+
disabled?: boolean | undefined;
|
|
985
|
+
placeholder?: string | undefined;
|
|
986
|
+
required?: boolean | undefined;
|
|
987
|
+
error?: string | undefined;
|
|
988
|
+
readonly?: boolean | undefined;
|
|
989
|
+
helperText?: string | undefined;
|
|
990
|
+
focused?: boolean | undefined;
|
|
991
|
+
cursorPosition?: number | undefined;
|
|
992
|
+
selectionStart?: number | undefined;
|
|
993
|
+
selectionEnd?: number | undefined;
|
|
994
|
+
}[] | undefined;
|
|
995
|
+
groups?: {
|
|
996
|
+
title: string;
|
|
997
|
+
fields: {
|
|
998
|
+
name: string;
|
|
999
|
+
value?: string | number | boolean | string[] | null | undefined;
|
|
1000
|
+
valid?: boolean | undefined;
|
|
1001
|
+
options?: {
|
|
1002
|
+
value: string;
|
|
1003
|
+
label: string;
|
|
1004
|
+
disabled?: boolean | undefined;
|
|
1005
|
+
description?: string | undefined;
|
|
1006
|
+
}[] | undefined;
|
|
1007
|
+
type?: "number" | "text" | "email" | "password" | "checkbox" | "textarea" | "select" | undefined;
|
|
1008
|
+
label?: string | undefined;
|
|
1009
|
+
disabled?: boolean | undefined;
|
|
1010
|
+
placeholder?: string | undefined;
|
|
1011
|
+
required?: boolean | undefined;
|
|
1012
|
+
error?: string | undefined;
|
|
1013
|
+
readonly?: boolean | undefined;
|
|
1014
|
+
helperText?: string | undefined;
|
|
1015
|
+
focused?: boolean | undefined;
|
|
1016
|
+
cursorPosition?: number | undefined;
|
|
1017
|
+
selectionStart?: number | undefined;
|
|
1018
|
+
selectionEnd?: number | undefined;
|
|
1019
|
+
}[];
|
|
1020
|
+
collapsible?: boolean | undefined;
|
|
1021
|
+
collapsed?: boolean | undefined;
|
|
1022
|
+
}[] | undefined;
|
|
1023
|
+
success?: string | undefined;
|
|
1024
|
+
loading?: boolean | undefined;
|
|
1025
|
+
submitLabel?: string | undefined;
|
|
1026
|
+
cancelLabel?: string | undefined;
|
|
1027
|
+
submitDisabled?: boolean | undefined;
|
|
1028
|
+
submitHotkey?: string | undefined;
|
|
1029
|
+
border?: boolean | undefined;
|
|
1030
|
+
}>;
|
|
1031
|
+
/**
|
|
1032
|
+
* Schema for select component state.
|
|
1033
|
+
*/
|
|
1034
|
+
declare const SelectStateSchema: z.ZodObject<{
|
|
1035
|
+
options: z.ZodArray<z.ZodObject<{
|
|
1036
|
+
label: z.ZodString;
|
|
1037
|
+
value: z.ZodString;
|
|
1038
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
1039
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1040
|
+
}, "strip", z.ZodTypeAny, {
|
|
1041
|
+
value: string;
|
|
1042
|
+
label: string;
|
|
1043
|
+
disabled?: boolean | undefined;
|
|
1044
|
+
description?: string | undefined;
|
|
1045
|
+
}, {
|
|
1046
|
+
value: string;
|
|
1047
|
+
label: string;
|
|
1048
|
+
disabled?: boolean | undefined;
|
|
1049
|
+
description?: string | undefined;
|
|
1050
|
+
}>, "many">;
|
|
1051
|
+
value: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
|
|
1052
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1053
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
1054
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
1055
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1056
|
+
valid: z.ZodOptional<z.ZodBoolean>;
|
|
1057
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
1058
|
+
open: z.ZodOptional<z.ZodBoolean>;
|
|
1059
|
+
multiple: z.ZodOptional<z.ZodBoolean>;
|
|
1060
|
+
highlightedIndex: z.ZodOptional<z.ZodNumber>;
|
|
1061
|
+
searchable: z.ZodOptional<z.ZodBoolean>;
|
|
1062
|
+
searchValue: z.ZodOptional<z.ZodString>;
|
|
1063
|
+
filteredOptions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1064
|
+
label: z.ZodString;
|
|
1065
|
+
value: z.ZodString;
|
|
1066
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
1067
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1068
|
+
}, "strip", z.ZodTypeAny, {
|
|
1069
|
+
value: string;
|
|
1070
|
+
label: string;
|
|
1071
|
+
disabled?: boolean | undefined;
|
|
1072
|
+
description?: string | undefined;
|
|
1073
|
+
}, {
|
|
1074
|
+
value: string;
|
|
1075
|
+
label: string;
|
|
1076
|
+
disabled?: boolean | undefined;
|
|
1077
|
+
description?: string | undefined;
|
|
1078
|
+
}>, "many">>;
|
|
1079
|
+
loading: z.ZodOptional<z.ZodBoolean>;
|
|
1080
|
+
}, "strip", z.ZodTypeAny, {
|
|
1081
|
+
options: {
|
|
1082
|
+
value: string;
|
|
1083
|
+
label: string;
|
|
1084
|
+
disabled?: boolean | undefined;
|
|
1085
|
+
description?: string | undefined;
|
|
1086
|
+
}[];
|
|
1087
|
+
value?: string | string[] | undefined;
|
|
1088
|
+
valid?: boolean | undefined;
|
|
1089
|
+
label?: string | undefined;
|
|
1090
|
+
disabled?: boolean | undefined;
|
|
1091
|
+
placeholder?: string | undefined;
|
|
1092
|
+
required?: boolean | undefined;
|
|
1093
|
+
error?: string | undefined;
|
|
1094
|
+
loading?: boolean | undefined;
|
|
1095
|
+
open?: boolean | undefined;
|
|
1096
|
+
multiple?: boolean | undefined;
|
|
1097
|
+
highlightedIndex?: number | undefined;
|
|
1098
|
+
searchable?: boolean | undefined;
|
|
1099
|
+
searchValue?: string | undefined;
|
|
1100
|
+
filteredOptions?: {
|
|
1101
|
+
value: string;
|
|
1102
|
+
label: string;
|
|
1103
|
+
disabled?: boolean | undefined;
|
|
1104
|
+
description?: string | undefined;
|
|
1105
|
+
}[] | undefined;
|
|
1106
|
+
}, {
|
|
1107
|
+
options: {
|
|
1108
|
+
value: string;
|
|
1109
|
+
label: string;
|
|
1110
|
+
disabled?: boolean | undefined;
|
|
1111
|
+
description?: string | undefined;
|
|
1112
|
+
}[];
|
|
1113
|
+
value?: string | string[] | undefined;
|
|
1114
|
+
valid?: boolean | undefined;
|
|
1115
|
+
label?: string | undefined;
|
|
1116
|
+
disabled?: boolean | undefined;
|
|
1117
|
+
placeholder?: string | undefined;
|
|
1118
|
+
required?: boolean | undefined;
|
|
1119
|
+
error?: string | undefined;
|
|
1120
|
+
loading?: boolean | undefined;
|
|
1121
|
+
open?: boolean | undefined;
|
|
1122
|
+
multiple?: boolean | undefined;
|
|
1123
|
+
highlightedIndex?: number | undefined;
|
|
1124
|
+
searchable?: boolean | undefined;
|
|
1125
|
+
searchValue?: string | undefined;
|
|
1126
|
+
filteredOptions?: {
|
|
1127
|
+
value: string;
|
|
1128
|
+
label: string;
|
|
1129
|
+
disabled?: boolean | undefined;
|
|
1130
|
+
description?: string | undefined;
|
|
1131
|
+
}[] | undefined;
|
|
1132
|
+
}>;
|
|
1133
|
+
/**
|
|
1134
|
+
* Schema for search component state.
|
|
1135
|
+
*/
|
|
1136
|
+
declare const SearchStateSchema: z.ZodObject<{
|
|
1137
|
+
value: z.ZodString;
|
|
1138
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
1139
|
+
label: z.ZodOptional<z.ZodString>;
|
|
1140
|
+
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
1141
|
+
loading: z.ZodOptional<z.ZodBoolean>;
|
|
1142
|
+
error: z.ZodOptional<z.ZodString>;
|
|
1143
|
+
focused: z.ZodOptional<z.ZodBoolean>;
|
|
1144
|
+
cursorPosition: z.ZodOptional<z.ZodNumber>;
|
|
1145
|
+
suggestions: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
1146
|
+
label: z.ZodString;
|
|
1147
|
+
value: z.ZodString;
|
|
1148
|
+
description: z.ZodOptional<z.ZodString>;
|
|
1149
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1150
|
+
}, "strip", z.ZodTypeAny, {
|
|
1151
|
+
value: string;
|
|
1152
|
+
label: string;
|
|
1153
|
+
description?: string | undefined;
|
|
1154
|
+
icon?: string | undefined;
|
|
1155
|
+
}, {
|
|
1156
|
+
value: string;
|
|
1157
|
+
label: string;
|
|
1158
|
+
description?: string | undefined;
|
|
1159
|
+
icon?: string | undefined;
|
|
1160
|
+
}>, "many">>>;
|
|
1161
|
+
showSuggestions: z.ZodOptional<z.ZodBoolean>;
|
|
1162
|
+
highlightedIndex: z.ZodOptional<z.ZodNumber>;
|
|
1163
|
+
maxSuggestions: z.ZodOptional<z.ZodNumber>;
|
|
1164
|
+
highlightMatches: z.ZodOptional<z.ZodBoolean>;
|
|
1165
|
+
isTyping: z.ZodOptional<z.ZodBoolean>;
|
|
1166
|
+
}, "strip", z.ZodTypeAny, {
|
|
1167
|
+
value: string;
|
|
1168
|
+
label?: string | undefined;
|
|
1169
|
+
disabled?: boolean | undefined;
|
|
1170
|
+
placeholder?: string | undefined;
|
|
1171
|
+
error?: string | undefined;
|
|
1172
|
+
focused?: boolean | undefined;
|
|
1173
|
+
cursorPosition?: number | undefined;
|
|
1174
|
+
loading?: boolean | undefined;
|
|
1175
|
+
highlightedIndex?: number | undefined;
|
|
1176
|
+
suggestions?: {
|
|
1177
|
+
value: string;
|
|
1178
|
+
label: string;
|
|
1179
|
+
description?: string | undefined;
|
|
1180
|
+
icon?: string | undefined;
|
|
1181
|
+
}[] | null | undefined;
|
|
1182
|
+
showSuggestions?: boolean | undefined;
|
|
1183
|
+
maxSuggestions?: number | undefined;
|
|
1184
|
+
highlightMatches?: boolean | undefined;
|
|
1185
|
+
isTyping?: boolean | undefined;
|
|
1186
|
+
}, {
|
|
1187
|
+
value: string;
|
|
1188
|
+
label?: string | undefined;
|
|
1189
|
+
disabled?: boolean | undefined;
|
|
1190
|
+
placeholder?: string | undefined;
|
|
1191
|
+
error?: string | undefined;
|
|
1192
|
+
focused?: boolean | undefined;
|
|
1193
|
+
cursorPosition?: number | undefined;
|
|
1194
|
+
loading?: boolean | undefined;
|
|
1195
|
+
highlightedIndex?: number | undefined;
|
|
1196
|
+
suggestions?: {
|
|
1197
|
+
value: string;
|
|
1198
|
+
label: string;
|
|
1199
|
+
description?: string | undefined;
|
|
1200
|
+
icon?: string | undefined;
|
|
1201
|
+
}[] | null | undefined;
|
|
1202
|
+
showSuggestions?: boolean | undefined;
|
|
1203
|
+
maxSuggestions?: number | undefined;
|
|
1204
|
+
highlightMatches?: boolean | undefined;
|
|
1205
|
+
isTyping?: boolean | undefined;
|
|
1206
|
+
}>;
|
|
1207
|
+
/**
|
|
1208
|
+
* Schema for email validation.
|
|
1209
|
+
*/
|
|
1210
|
+
declare const EmailSchema: z.ZodString;
|
|
1211
|
+
/**
|
|
1212
|
+
* Schema for password validation with common requirements.
|
|
1213
|
+
*/
|
|
1214
|
+
declare const PasswordSchema: z.ZodString;
|
|
1215
|
+
/**
|
|
1216
|
+
* Schema for basic password validation (minimum length only).
|
|
1217
|
+
*/
|
|
1218
|
+
declare const SimplePasswordSchema: z.ZodString;
|
|
1219
|
+
/**
|
|
1220
|
+
* Schema for username validation.
|
|
1221
|
+
*/
|
|
1222
|
+
declare const UsernameSchema: z.ZodString;
|
|
1223
|
+
/**
|
|
1224
|
+
* Schema for URL validation.
|
|
1225
|
+
*/
|
|
1226
|
+
declare const UrlSchema: z.ZodString;
|
|
1227
|
+
/**
|
|
1228
|
+
* Schema for phone number validation (basic).
|
|
1229
|
+
*/
|
|
1230
|
+
declare const PhoneSchema: z.ZodString;
|
|
1231
|
+
/**
|
|
1232
|
+
* Creates a login form schema.
|
|
1233
|
+
*
|
|
1234
|
+
* @param options - Optional customization options
|
|
1235
|
+
* @returns Zod schema for login form validation
|
|
1236
|
+
*
|
|
1237
|
+
* @example
|
|
1238
|
+
* ```tsx
|
|
1239
|
+
* const loginSchema = createLoginSchema()
|
|
1240
|
+
* type LoginForm = z.infer<typeof loginSchema>
|
|
1241
|
+
*
|
|
1242
|
+
* // With remember me
|
|
1243
|
+
* const loginSchemaWithRemember = createLoginSchema({ rememberMe: true })
|
|
1244
|
+
* ```
|
|
1245
|
+
*/
|
|
1246
|
+
declare function createLoginSchema(options?: {
|
|
1247
|
+
rememberMe?: boolean;
|
|
1248
|
+
strictPassword?: boolean;
|
|
1249
|
+
}): z.ZodObject<{
|
|
1250
|
+
email: z.ZodString;
|
|
1251
|
+
password: z.ZodString;
|
|
1252
|
+
}, "strip", z.ZodTypeAny, {
|
|
1253
|
+
email: string;
|
|
1254
|
+
password: string;
|
|
1255
|
+
}, {
|
|
1256
|
+
email: string;
|
|
1257
|
+
password: string;
|
|
1258
|
+
}>;
|
|
1259
|
+
/**
|
|
1260
|
+
* Creates a registration form schema.
|
|
1261
|
+
*
|
|
1262
|
+
* @param options - Optional customization options
|
|
1263
|
+
* @returns Zod schema for registration form validation
|
|
1264
|
+
*
|
|
1265
|
+
* @example
|
|
1266
|
+
* ```tsx
|
|
1267
|
+
* const registerSchema = createRegistrationSchema({
|
|
1268
|
+
* confirmPassword: true,
|
|
1269
|
+
* termsRequired: true,
|
|
1270
|
+
* })
|
|
1271
|
+
* ```
|
|
1272
|
+
*/
|
|
1273
|
+
declare function createRegistrationSchema(options?: {
|
|
1274
|
+
confirmPassword?: boolean;
|
|
1275
|
+
termsRequired?: boolean;
|
|
1276
|
+
usernameRequired?: boolean;
|
|
1277
|
+
}): z.ZodObject<{
|
|
1278
|
+
email: z.ZodString;
|
|
1279
|
+
password: z.ZodString;
|
|
1280
|
+
}, "strip", z.ZodTypeAny, {
|
|
1281
|
+
email: string;
|
|
1282
|
+
password: string;
|
|
1283
|
+
}, {
|
|
1284
|
+
email: string;
|
|
1285
|
+
password: string;
|
|
1286
|
+
}> | z.ZodIntersection<z.ZodEffects<z.ZodObject<{
|
|
1287
|
+
email: z.ZodString;
|
|
1288
|
+
password: z.ZodString;
|
|
1289
|
+
}, "strip", z.ZodTypeAny, {
|
|
1290
|
+
email: string;
|
|
1291
|
+
password: string;
|
|
1292
|
+
}, {
|
|
1293
|
+
email: string;
|
|
1294
|
+
password: string;
|
|
1295
|
+
}>, {
|
|
1296
|
+
email: string;
|
|
1297
|
+
password: string;
|
|
1298
|
+
}, {
|
|
1299
|
+
email: string;
|
|
1300
|
+
password: string;
|
|
1301
|
+
}>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
1302
|
+
/**
|
|
1303
|
+
* Creates a contact form schema.
|
|
1304
|
+
*
|
|
1305
|
+
* @param options - Optional customization options
|
|
1306
|
+
* @returns Zod schema for contact form validation
|
|
1307
|
+
*/
|
|
1308
|
+
declare function createContactSchema(options?: {
|
|
1309
|
+
phoneRequired?: boolean;
|
|
1310
|
+
subjectRequired?: boolean;
|
|
1311
|
+
}): z.ZodObject<{
|
|
1312
|
+
name: z.ZodString;
|
|
1313
|
+
email: z.ZodString;
|
|
1314
|
+
message: z.ZodString;
|
|
1315
|
+
}, "strip", z.ZodTypeAny, {
|
|
1316
|
+
email: string;
|
|
1317
|
+
message: string;
|
|
1318
|
+
name: string;
|
|
1319
|
+
}, {
|
|
1320
|
+
email: string;
|
|
1321
|
+
message: string;
|
|
1322
|
+
name: string;
|
|
1323
|
+
}>;
|
|
1324
|
+
/**
|
|
1325
|
+
* Creates a profile form schema.
|
|
1326
|
+
*
|
|
1327
|
+
* @returns Zod schema for profile form validation
|
|
1328
|
+
*/
|
|
1329
|
+
declare function createProfileSchema(): z.ZodObject<{
|
|
1330
|
+
firstName: z.ZodString;
|
|
1331
|
+
lastName: z.ZodString;
|
|
1332
|
+
email: z.ZodString;
|
|
1333
|
+
bio: z.ZodOptional<z.ZodString>;
|
|
1334
|
+
website: z.ZodUnion<[z.ZodOptional<z.ZodString>, z.ZodLiteral<"">]>;
|
|
1335
|
+
location: z.ZodOptional<z.ZodString>;
|
|
1336
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
1337
|
+
}, "strip", z.ZodTypeAny, {
|
|
1338
|
+
email: string;
|
|
1339
|
+
firstName: string;
|
|
1340
|
+
lastName: string;
|
|
1341
|
+
bio?: string | undefined;
|
|
1342
|
+
website?: string | undefined;
|
|
1343
|
+
location?: string | undefined;
|
|
1344
|
+
timezone?: string | undefined;
|
|
1345
|
+
}, {
|
|
1346
|
+
email: string;
|
|
1347
|
+
firstName: string;
|
|
1348
|
+
lastName: string;
|
|
1349
|
+
bio?: string | undefined;
|
|
1350
|
+
website?: string | undefined;
|
|
1351
|
+
location?: string | undefined;
|
|
1352
|
+
timezone?: string | undefined;
|
|
1353
|
+
}>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Creates a settings form schema for common app settings.
|
|
1356
|
+
*
|
|
1357
|
+
* @returns Zod schema for settings form validation
|
|
1358
|
+
*/
|
|
1359
|
+
declare function createSettingsSchema(): z.ZodObject<{
|
|
1360
|
+
emailNotifications: z.ZodDefault<z.ZodBoolean>;
|
|
1361
|
+
pushNotifications: z.ZodDefault<z.ZodBoolean>;
|
|
1362
|
+
marketingEmails: z.ZodDefault<z.ZodBoolean>;
|
|
1363
|
+
theme: z.ZodDefault<z.ZodEnum<["light", "dark", "system"]>>;
|
|
1364
|
+
language: z.ZodDefault<z.ZodString>;
|
|
1365
|
+
}, "strip", z.ZodTypeAny, {
|
|
1366
|
+
emailNotifications: boolean;
|
|
1367
|
+
pushNotifications: boolean;
|
|
1368
|
+
marketingEmails: boolean;
|
|
1369
|
+
theme: "light" | "dark" | "system";
|
|
1370
|
+
language: string;
|
|
1371
|
+
}, {
|
|
1372
|
+
emailNotifications?: boolean | undefined;
|
|
1373
|
+
pushNotifications?: boolean | undefined;
|
|
1374
|
+
marketingEmails?: boolean | undefined;
|
|
1375
|
+
theme?: "light" | "dark" | "system" | undefined;
|
|
1376
|
+
language?: string | undefined;
|
|
1377
|
+
}>;
|
|
1378
|
+
type LoginFormValues = z.infer<ReturnType<typeof createLoginSchema>>;
|
|
1379
|
+
type RegistrationFormValues = z.infer<ReturnType<typeof createRegistrationSchema>>;
|
|
1380
|
+
type ContactFormValues = z.infer<ReturnType<typeof createContactSchema>>;
|
|
1381
|
+
type ProfileFormValues = z.infer<ReturnType<typeof createProfileSchema>>;
|
|
1382
|
+
type SettingsFormValues = z.infer<ReturnType<typeof createSettingsSchema>>;
|
|
1383
|
+
|
|
1384
|
+
/**
|
|
1385
|
+
* @mdxui/terminal Form Converters
|
|
1386
|
+
*
|
|
1387
|
+
* Utility functions for converting between React Hook Form state
|
|
1388
|
+
* and terminal UINode props format.
|
|
1389
|
+
*
|
|
1390
|
+
* @packageDocumentation
|
|
1391
|
+
*/
|
|
1392
|
+
|
|
1393
|
+
/**
|
|
1394
|
+
* Converts RHF form state and field configurations to terminal FormState.
|
|
1395
|
+
*
|
|
1396
|
+
* @remarks
|
|
1397
|
+
* This function bridges React Hook Form's state representation with
|
|
1398
|
+
* the terminal form renderer's expected props format.
|
|
1399
|
+
*
|
|
1400
|
+
* @param rhfState - RHF form state from useForm hook
|
|
1401
|
+
* @param fields - Array of field configurations
|
|
1402
|
+
* @param options - Additional form options
|
|
1403
|
+
* @returns FormState compatible with terminal Form renderer
|
|
1404
|
+
*
|
|
1405
|
+
* @example
|
|
1406
|
+
* ```tsx
|
|
1407
|
+
* const { formState, register, getValues } = useForm<LoginForm>()
|
|
1408
|
+
*
|
|
1409
|
+
* const terminalFormState = convertRHFToFormState(
|
|
1410
|
+
* formState,
|
|
1411
|
+
* [
|
|
1412
|
+
* { name: 'email', label: 'Email', type: 'email', required: true },
|
|
1413
|
+
* { name: 'password', label: 'Password', type: 'password', required: true },
|
|
1414
|
+
* ],
|
|
1415
|
+
* {
|
|
1416
|
+
* title: 'Login',
|
|
1417
|
+
* submitLabel: 'Sign In',
|
|
1418
|
+
* values: getValues(),
|
|
1419
|
+
* }
|
|
1420
|
+
* )
|
|
1421
|
+
* ```
|
|
1422
|
+
*/
|
|
1423
|
+
declare function convertRHFToFormState<T extends FormValues>(rhfState: RHFFormState, fields: FieldConfig[], options?: {
|
|
1424
|
+
title?: string;
|
|
1425
|
+
description?: string;
|
|
1426
|
+
submitLabel?: string;
|
|
1427
|
+
cancelLabel?: string;
|
|
1428
|
+
submitHotkey?: string;
|
|
1429
|
+
border?: boolean;
|
|
1430
|
+
groups?: FieldGroup[];
|
|
1431
|
+
values?: T;
|
|
1432
|
+
}): FormState<T>;
|
|
1433
|
+
/**
|
|
1434
|
+
* Converts field configurations to UINode format for Form renderer.
|
|
1435
|
+
*
|
|
1436
|
+
* @param formState - Terminal FormState configuration
|
|
1437
|
+
* @returns UINode for Form component
|
|
1438
|
+
*
|
|
1439
|
+
* @example
|
|
1440
|
+
* ```tsx
|
|
1441
|
+
* const formNode = formStateToUINode({
|
|
1442
|
+
* title: 'Contact Us',
|
|
1443
|
+
* fields: [
|
|
1444
|
+
* { name: 'email', label: 'Email', type: 'email' },
|
|
1445
|
+
* { name: 'message', label: 'Message', type: 'textarea' },
|
|
1446
|
+
* ],
|
|
1447
|
+
* submitLabel: 'Send',
|
|
1448
|
+
* })
|
|
1449
|
+
*
|
|
1450
|
+
* const rendered = renderForm(formNode, ctx)
|
|
1451
|
+
* ```
|
|
1452
|
+
*/
|
|
1453
|
+
declare function formStateToUINode<T extends FormValues>(formState: FormState<T>): UINode;
|
|
1454
|
+
/**
|
|
1455
|
+
* Converts a single field configuration to UINode format.
|
|
1456
|
+
*
|
|
1457
|
+
* @param field - Field configuration
|
|
1458
|
+
* @returns UINode for Field component
|
|
1459
|
+
*/
|
|
1460
|
+
declare function fieldConfigToUINode(field: FieldConfig): UINode;
|
|
1461
|
+
/**
|
|
1462
|
+
* Creates a field configuration from RHF register result.
|
|
1463
|
+
*
|
|
1464
|
+
* @param name - Field name
|
|
1465
|
+
* @param registerResult - Result from RHF register function
|
|
1466
|
+
* @param options - Additional field options
|
|
1467
|
+
* @returns FieldConfig for terminal rendering
|
|
1468
|
+
*/
|
|
1469
|
+
declare function createFieldFromRegister(name: string, registerResult: {
|
|
1470
|
+
name: string;
|
|
1471
|
+
}, options?: Omit<FieldConfig, 'name'>): FieldConfig;
|
|
1472
|
+
/**
|
|
1473
|
+
* Converts select state to UINode format.
|
|
1474
|
+
*
|
|
1475
|
+
* @param selectState - Select component state
|
|
1476
|
+
* @returns UINode for Select component
|
|
1477
|
+
*/
|
|
1478
|
+
declare function selectStateToUINode<T = string>(selectState: SelectState<T>): UINode;
|
|
1479
|
+
/**
|
|
1480
|
+
* Creates a select field configuration for RHF Controller integration.
|
|
1481
|
+
*
|
|
1482
|
+
* @param name - Field name
|
|
1483
|
+
* @param options - Select options
|
|
1484
|
+
* @param fieldOptions - Additional field options
|
|
1485
|
+
* @returns SelectState for terminal rendering
|
|
1486
|
+
*
|
|
1487
|
+
* @example
|
|
1488
|
+
* ```tsx
|
|
1489
|
+
* // With RHF Controller
|
|
1490
|
+
* <Controller
|
|
1491
|
+
* name="country"
|
|
1492
|
+
* control={control}
|
|
1493
|
+
* render={({ field, fieldState }) => {
|
|
1494
|
+
* const selectState = createSelectForController(
|
|
1495
|
+
* 'country',
|
|
1496
|
+
* [
|
|
1497
|
+
* { label: 'United States', value: 'us' },
|
|
1498
|
+
* { label: 'Canada', value: 'ca' },
|
|
1499
|
+
* ],
|
|
1500
|
+
* {
|
|
1501
|
+
* value: field.value,
|
|
1502
|
+
* error: fieldState.error?.message,
|
|
1503
|
+
* }
|
|
1504
|
+
* )
|
|
1505
|
+
* const node = selectStateToUINode(selectState)
|
|
1506
|
+
* return renderSelect(node, ctx)
|
|
1507
|
+
* }}
|
|
1508
|
+
* />
|
|
1509
|
+
* ```
|
|
1510
|
+
*/
|
|
1511
|
+
declare function createSelectForController<T = string>(name: string, options: SelectOption<T>[], fieldOptions?: {
|
|
1512
|
+
value?: T | T[];
|
|
1513
|
+
error?: string;
|
|
1514
|
+
label?: string;
|
|
1515
|
+
placeholder?: string;
|
|
1516
|
+
required?: boolean;
|
|
1517
|
+
disabled?: boolean;
|
|
1518
|
+
multiple?: boolean;
|
|
1519
|
+
searchable?: boolean;
|
|
1520
|
+
}): SelectState<T>;
|
|
1521
|
+
/**
|
|
1522
|
+
* Converts search state to UINode format.
|
|
1523
|
+
*
|
|
1524
|
+
* @param searchState - Search component state
|
|
1525
|
+
* @returns UINode for Search component
|
|
1526
|
+
*/
|
|
1527
|
+
declare function searchStateToUINode(searchState: SearchState): UINode;
|
|
1528
|
+
/**
|
|
1529
|
+
* Creates a debounced search state handler.
|
|
1530
|
+
*
|
|
1531
|
+
* @param onSearch - Callback when search should be executed
|
|
1532
|
+
* @param delay - Debounce delay in milliseconds (default: 300)
|
|
1533
|
+
* @returns Object with handlers for search input
|
|
1534
|
+
*
|
|
1535
|
+
* @example
|
|
1536
|
+
* ```tsx
|
|
1537
|
+
* const { handleChange, handleFocus, handleBlur, state } = createDebouncedSearch(
|
|
1538
|
+
* async (query) => {
|
|
1539
|
+
* const results = await fetchSuggestions(query)
|
|
1540
|
+
* return results.map(r => ({ label: r.name, value: r.id }))
|
|
1541
|
+
* }
|
|
1542
|
+
* )
|
|
1543
|
+
*
|
|
1544
|
+
* // Use with RHF Controller
|
|
1545
|
+
* <Controller
|
|
1546
|
+
* name="search"
|
|
1547
|
+
* control={control}
|
|
1548
|
+
* render={({ field }) => {
|
|
1549
|
+
* const searchNode = searchStateToUINode({
|
|
1550
|
+
* value: field.value,
|
|
1551
|
+
* ...state,
|
|
1552
|
+
* })
|
|
1553
|
+
* return renderSearch(searchNode, ctx)
|
|
1554
|
+
* }}
|
|
1555
|
+
* />
|
|
1556
|
+
* ```
|
|
1557
|
+
*/
|
|
1558
|
+
declare function createDebouncedSearch(onSearch: (query: string) => Promise<{
|
|
1559
|
+
label: string;
|
|
1560
|
+
value: string;
|
|
1561
|
+
}[]> | {
|
|
1562
|
+
label: string;
|
|
1563
|
+
value: string;
|
|
1564
|
+
}[], delay?: number): {
|
|
1565
|
+
handleChange: (value: string) => void;
|
|
1566
|
+
handleFocus: () => void;
|
|
1567
|
+
handleBlur: () => void;
|
|
1568
|
+
getState: () => Pick<SearchState, 'suggestions' | 'showSuggestions' | 'loading' | 'isTyping'>;
|
|
1569
|
+
};
|
|
1570
|
+
/**
|
|
1571
|
+
* Extracts field errors from RHF form state in a format suitable for rendering.
|
|
1572
|
+
*
|
|
1573
|
+
* @param errors - RHF errors object
|
|
1574
|
+
* @param fieldNames - Optional list of field names to extract
|
|
1575
|
+
* @returns Record of field names to error messages
|
|
1576
|
+
*/
|
|
1577
|
+
declare function extractFieldErrors(errors: Record<string, {
|
|
1578
|
+
message?: string;
|
|
1579
|
+
}>, fieldNames?: string[]): Record<string, string>;
|
|
1580
|
+
/**
|
|
1581
|
+
* Checks if a form has any errors.
|
|
1582
|
+
*
|
|
1583
|
+
* @param errors - RHF errors object
|
|
1584
|
+
* @returns True if there are any errors
|
|
1585
|
+
*/
|
|
1586
|
+
declare function hasFormErrors(errors: Record<string, unknown>): boolean;
|
|
1587
|
+
/**
|
|
1588
|
+
* Gets the first field with an error.
|
|
1589
|
+
*
|
|
1590
|
+
* @param errors - RHF errors object
|
|
1591
|
+
* @param fieldOrder - Optional field order to check
|
|
1592
|
+
* @returns Name of first field with error, or undefined
|
|
1593
|
+
*/
|
|
1594
|
+
declare function getFirstErrorField(errors: Record<string, unknown>, fieldOrder?: string[]): string | undefined;
|
|
1595
|
+
|
|
1596
|
+
export { type ContactFormValues, EmailSchema, type FieldConfig, FieldConfigSchema, type FieldGroup, FieldGroupSchema, type FieldRegistration, FieldTypeSchema, type FieldValue, FieldValueSchema, type FormState, type FormStateConverter, FormStateSchema, type FormValues, type InferFormValues, type LoginFormValues, PasswordSchema, PhoneSchema, type ProfileFormValues, type RHFFormConfig, type RHFFormState, type RegisterFn, type RegistrationFormValues, type SearchState, SearchStateSchema, type SearchSuggestion, SearchSuggestionSchema, type SelectOption, SelectOptionSchema, type SelectState, SelectStateSchema, type SettingsFormValues, SimplePasswordSchema, UrlSchema, UsernameSchema, convertRHFToFormState, createContactSchema, createDebouncedSearch, createFieldFromRegister, createLoginSchema, createProfileSchema, createRegistrationSchema, createSelectForController, createSettingsSchema, extractFieldErrors, fieldConfigToUINode, formStateToUINode, getFirstErrorField, hasFormErrors, searchStateToUINode, selectStateToUINode };
|