@formatica/react 0.1.2 → 0.2.3
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 +264 -25
- package/dist/components/BaseField.d.ts +17 -0
- package/dist/components/BaseField.d.ts.map +1 -0
- package/dist/components/FormBuilder.d.ts +22 -0
- package/dist/components/FormBuilder.d.ts.map +1 -0
- package/dist/components/FormaticaProvider.d.ts +15 -0
- package/dist/components/FormaticaProvider.d.ts.map +1 -0
- package/dist/components/fields/CheckboxField.d.ts +10 -0
- package/dist/components/fields/CheckboxField.d.ts.map +1 -0
- package/dist/components/fields/NumberField.d.ts +17 -0
- package/dist/components/fields/NumberField.d.ts.map +1 -0
- package/dist/components/fields/RadioField.d.ts +17 -0
- package/dist/components/fields/RadioField.d.ts.map +1 -0
- package/dist/components/fields/SelectField.d.ts +19 -0
- package/dist/components/fields/SelectField.d.ts.map +1 -0
- package/dist/components/fields/SliderField.d.ts +13 -0
- package/dist/components/fields/SliderField.d.ts.map +1 -0
- package/dist/components/fields/SwitchField.d.ts +11 -0
- package/dist/components/fields/SwitchField.d.ts.map +1 -0
- package/dist/components/fields/TextField.d.ts +15 -0
- package/dist/components/fields/TextField.d.ts.map +1 -0
- package/dist/components/fields/TextareaField.d.ts +14 -0
- package/dist/components/fields/TextareaField.d.ts.map +1 -0
- package/dist/formatica-react.es.js +630 -616
- package/dist/formatica-react.es.js.map +1 -1
- package/dist/formatica-react.umd.cjs +1 -1
- package/dist/formatica-react.umd.cjs.map +1 -1
- package/dist/hooks/useForm.d.ts +26 -0
- package/dist/hooks/useForm.d.ts.map +1 -0
- package/dist/hooks/useFormContext.d.ts +4 -0
- package/dist/hooks/useFormContext.d.ts.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,54 +1,293 @@
|
|
|
1
1
|
# @formatica/react
|
|
2
2
|
|
|
3
|
-
Schema-driven form builder for React. Powered by `@formatica/core`, it provides components and hooks for building forms from JSON schemas with automatic validation and
|
|
3
|
+
Schema-driven form builder for React. Powered by `@formatica/core`, it provides a context provider, components, and hooks for building forms from JSON schemas with automatic validation, conditional logic, theming, and dark mode.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @formatica/react
|
|
8
|
+
npm install @formatica/react libphonenumber-js
|
|
9
|
+
# or
|
|
10
|
+
yarn add @formatica/react libphonenumber-js
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Import the CSS file in your entry point (required for theming and dark mode):
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
// The CSS file is published via @formatica/vue
|
|
17
|
+
import "@formatica/vue/style.css";
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`libphonenumber-js` is required for the phone field type. All other field types have zero external dependencies.
|
|
21
|
+
|
|
22
|
+
## FormaticaProvider Setup
|
|
23
|
+
|
|
24
|
+
Wrap your app (or a subtree) in `FormaticaProvider` to configure global defaults:
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { FormaticaProvider } from "@formatica/react";
|
|
28
|
+
import "@formatica/vue/style.css";
|
|
29
|
+
|
|
30
|
+
function App() {
|
|
31
|
+
return (
|
|
32
|
+
<FormaticaProvider
|
|
33
|
+
config={{
|
|
34
|
+
theme: {
|
|
35
|
+
name: "my-theme",
|
|
36
|
+
colors: { primary: "#059669", error: "#dc2626" },
|
|
37
|
+
borders: { radius: "0.5rem" },
|
|
38
|
+
},
|
|
39
|
+
locale: "en",
|
|
40
|
+
// components: { rating: MyRatingField }, // register custom types globally
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
<MyForms />
|
|
44
|
+
</FormaticaProvider>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### FormaticaConfig
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
interface FormaticaConfig {
|
|
53
|
+
theme?: ThemeConfig;
|
|
54
|
+
locale?: string;
|
|
55
|
+
fallbackLocale?: string;
|
|
56
|
+
components?: Record<string, ComponentType<FieldComponentProps>>;
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Props passed directly to `FormBuilder` always override the provider config.
|
|
61
|
+
|
|
62
|
+
### useFormaticaConfig()
|
|
63
|
+
|
|
64
|
+
Access the global config from any component inside the provider:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import { useFormaticaConfig } from "@formatica/react";
|
|
68
|
+
|
|
69
|
+
function MyComponent() {
|
|
70
|
+
const config = useFormaticaConfig();
|
|
71
|
+
console.log(config.locale); // 'en'
|
|
72
|
+
console.log(config.theme); // ThemeConfig object
|
|
73
|
+
return <div>...</div>;
|
|
74
|
+
}
|
|
9
75
|
```
|
|
10
76
|
|
|
11
77
|
## Quick Start
|
|
12
78
|
|
|
13
79
|
```tsx
|
|
14
|
-
import {
|
|
15
|
-
import type { FormSchema } from "@formatica/
|
|
80
|
+
import { FormBuilder } from "@formatica/react";
|
|
81
|
+
import type { FormSchema } from "@formatica/react";
|
|
16
82
|
|
|
17
83
|
const schema: FormSchema = {
|
|
18
84
|
fields: [
|
|
19
|
-
{ name: "name", type: "text", label: "Name", required: true },
|
|
20
|
-
{ name: "email", type: "email", label: "Email", required: true },
|
|
21
85
|
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
label: "
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
86
|
+
type: "text",
|
|
87
|
+
name: "name",
|
|
88
|
+
label: "Full name",
|
|
89
|
+
rules: ["required", "minLength:2"],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: "text",
|
|
93
|
+
name: "email",
|
|
94
|
+
label: "Email",
|
|
95
|
+
inputType: "email",
|
|
96
|
+
rules: ["required", "email"],
|
|
97
|
+
},
|
|
98
|
+
{ type: "textarea", name: "message", label: "Message", rules: ["required"] },
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export default function ContactForm() {
|
|
103
|
+
async function handleSubmit(values: Record<string, unknown>) {
|
|
104
|
+
console.log("Form submitted:", values);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<FormBuilder
|
|
109
|
+
schema={schema}
|
|
110
|
+
onSubmit={handleSubmit}
|
|
111
|
+
onError={(errors) => console.error("Validation failed:", errors)}
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Schema Format
|
|
118
|
+
|
|
119
|
+
The schema format is identical across all three packages. Fields and layout containers live together in a single tree. See the [`@formatica/core` README](../core/README.md) for full details.
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
const schema: FormSchema = {
|
|
123
|
+
fields: [
|
|
124
|
+
{ type: "text", name: "email", label: "Email", rules: ["required", "email"] },
|
|
125
|
+
{
|
|
126
|
+
type: "row",
|
|
127
|
+
children: [
|
|
128
|
+
{ type: "text", name: "city", label: "City", span: 8 },
|
|
129
|
+
{ type: "text", name: "zip", label: "ZIP", span: 4 },
|
|
28
130
|
],
|
|
29
131
|
},
|
|
30
132
|
],
|
|
31
133
|
};
|
|
134
|
+
```
|
|
32
135
|
|
|
33
|
-
|
|
34
|
-
const form = useForm(schema);
|
|
136
|
+
## Custom Components
|
|
35
137
|
|
|
36
|
-
|
|
37
|
-
console.log("Form submitted:", data);
|
|
38
|
-
}
|
|
138
|
+
### Via provider
|
|
39
139
|
|
|
40
|
-
|
|
140
|
+
```tsx
|
|
141
|
+
<FormaticaProvider
|
|
142
|
+
config={{
|
|
143
|
+
components: {
|
|
144
|
+
rating: MyRatingField,
|
|
145
|
+
text: MyCustomTextField,
|
|
146
|
+
},
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
<MyForms />
|
|
150
|
+
</FormaticaProvider>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Via props
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
<FormBuilder
|
|
157
|
+
schema={schema}
|
|
158
|
+
components={{ rating: MyRatingField }}
|
|
159
|
+
onSubmit={handleSubmit}
|
|
160
|
+
/>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Custom components receive `FieldComponentProps`:
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
interface FieldComponentProps {
|
|
167
|
+
field: FieldSchema;
|
|
168
|
+
value: unknown;
|
|
169
|
+
onChange: (value: unknown) => void;
|
|
170
|
+
onBlur: () => void;
|
|
171
|
+
errors: string[];
|
|
172
|
+
disabled: boolean;
|
|
41
173
|
}
|
|
42
174
|
```
|
|
43
175
|
|
|
44
|
-
|
|
176
|
+
Components are wrapped by `BaseField` which handles label, error messages, and help text automatically.
|
|
177
|
+
|
|
178
|
+
## useForm() Hook
|
|
179
|
+
|
|
180
|
+
For advanced use cases where you need direct access to form state:
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
import { useForm } from "@formatica/react";
|
|
184
|
+
|
|
185
|
+
const form = useForm(schema, { locale: "en" });
|
|
186
|
+
|
|
187
|
+
// State
|
|
188
|
+
form.values; // Record<string, unknown>
|
|
189
|
+
form.errors; // Record<string, string[]>
|
|
190
|
+
form.touched; // Record<string, boolean>
|
|
191
|
+
form.dirty; // Record<string, boolean>
|
|
192
|
+
form.isValid; // boolean
|
|
193
|
+
form.isDirty; // boolean
|
|
194
|
+
form.isSubmitting; // boolean
|
|
195
|
+
form.submitCount; // number
|
|
196
|
+
|
|
197
|
+
// Methods
|
|
198
|
+
form.setFieldValue("email", "test@example.com");
|
|
199
|
+
form.getFieldValue("email");
|
|
200
|
+
form.validate(); // validate all, returns Promise<boolean>
|
|
201
|
+
form.validateField("email");
|
|
202
|
+
form.reset();
|
|
203
|
+
form.clear();
|
|
204
|
+
form.setError("email", "Already taken");
|
|
205
|
+
form.clearError("email");
|
|
206
|
+
form.clearErrors();
|
|
207
|
+
|
|
208
|
+
// Submit (validates first, then calls handler)
|
|
209
|
+
form.submit(async (values) => {
|
|
210
|
+
await fetch("/api/users", { method: "POST", body: JSON.stringify(values) });
|
|
211
|
+
});
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## useFormContext()
|
|
215
|
+
|
|
216
|
+
Access form state from any child component rendered inside `FormBuilder`:
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
import { useFormContext } from "@formatica/react";
|
|
45
220
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
221
|
+
function SubmitButton() {
|
|
222
|
+
const form = useFormContext();
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
<button type="submit" disabled={form.isSubmitting || !form.isValid}>
|
|
226
|
+
{form.isSubmitting ? "Saving..." : "Submit"}
|
|
227
|
+
</button>
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Theming
|
|
233
|
+
|
|
234
|
+
### CSS variables
|
|
235
|
+
|
|
236
|
+
The CSS file (`@formatica/vue/style.css`) maps ThemeConfig values to CSS custom properties:
|
|
237
|
+
|
|
238
|
+
| Variable | Description |
|
|
239
|
+
| --- | --- |
|
|
240
|
+
| `--fc-color-primary` | Primary color (buttons, focus rings, accents) |
|
|
241
|
+
| `--fc-color-error` | Error color (validation messages, borders) |
|
|
242
|
+
| `--fc-color-success` | Success color |
|
|
243
|
+
| `--fc-border-radius` | Border radius for inputs and buttons |
|
|
244
|
+
| `--fc-color-border` | Default border color |
|
|
245
|
+
| `--fc-color-border-focus` | Border color on focus |
|
|
246
|
+
| `--fc-input-padding-x` | Horizontal input padding |
|
|
247
|
+
| `--fc-input-padding-y` | Vertical input padding |
|
|
248
|
+
|
|
249
|
+
You can also set CSS variables directly via a wrapper div:
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
<div
|
|
253
|
+
style={
|
|
254
|
+
{
|
|
255
|
+
"--fc-color-primary": "#4f46e5",
|
|
256
|
+
"--fc-border-radius": "0.75rem",
|
|
257
|
+
} as React.CSSProperties
|
|
258
|
+
}
|
|
259
|
+
>
|
|
260
|
+
<FormBuilder schema={schema} onSubmit={handleSubmit} />
|
|
261
|
+
</div>
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Dark mode
|
|
265
|
+
|
|
266
|
+
Add the `.dark` class to any ancestor element. Compatible with Tailwind's `darkMode: 'class'`:
|
|
267
|
+
|
|
268
|
+
```html
|
|
269
|
+
<html class="dark">
|
|
270
|
+
...
|
|
271
|
+
</html>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## TypeScript Support
|
|
275
|
+
|
|
276
|
+
All types are exported from `@formatica/react` (re-exported from `@formatica/core`):
|
|
277
|
+
|
|
278
|
+
```ts
|
|
279
|
+
import type {
|
|
280
|
+
FormSchema,
|
|
281
|
+
FieldSchema,
|
|
282
|
+
SchemaNode,
|
|
283
|
+
ThemeConfig,
|
|
284
|
+
FormaticaConfig,
|
|
285
|
+
FieldComponentProps,
|
|
286
|
+
FormBuilderProps,
|
|
287
|
+
FormInstance,
|
|
288
|
+
UseFormOptions,
|
|
289
|
+
} from "@formatica/react";
|
|
290
|
+
```
|
|
52
291
|
|
|
53
292
|
## License
|
|
54
293
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface BaseFieldProps {
|
|
3
|
+
label?: string;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
errors?: string[];
|
|
6
|
+
touched?: boolean;
|
|
7
|
+
helpText?: string;
|
|
8
|
+
tooltip?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
readOnly?: boolean;
|
|
11
|
+
fieldName?: string;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
}
|
|
16
|
+
export declare function BaseField({ label, required, errors, touched, helpText, tooltip, disabled, readOnly, fieldName, children, className, style, }: BaseFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=BaseField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseField.d.ts","sourceRoot":"","sources":["../../src/components/BaseField.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAEjD,MAAM,WAAW,cAAc;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC/B;AAED,wBAAgB,SAAS,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,OAAc,EACd,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,SAAS,EACT,KAAK,GACR,EAAE,cAAc,2CA8EhB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FieldSchema, FormSchema, ThemeConfig } from '@formatica/core';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
export interface FieldComponentProps {
|
|
4
|
+
field: FieldSchema;
|
|
5
|
+
value: unknown;
|
|
6
|
+
onChange: (value: unknown) => void;
|
|
7
|
+
onBlur: () => void;
|
|
8
|
+
errors: string[];
|
|
9
|
+
disabled: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface FormBuilderProps {
|
|
12
|
+
schema: FormSchema;
|
|
13
|
+
onSubmit?: (values: Record<string, unknown>) => void | Promise<void>;
|
|
14
|
+
onError?: (errors: Record<string, string[]>) => void;
|
|
15
|
+
locale?: string;
|
|
16
|
+
fallbackLocale?: string;
|
|
17
|
+
theme?: ThemeConfig;
|
|
18
|
+
components?: Record<string, ComponentType<FieldComponentProps>>;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function FormBuilder({ schema, onSubmit, onError, locale: localeProp, fallbackLocale: fallbackLocaleProp, theme: themeProp, components: componentsProp, className, }: FormBuilderProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=FormBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormBuilder.d.ts","sourceRoot":"","sources":["../../src/components/FormBuilder.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAGR,WAAW,EACX,UAAU,EASV,WAAW,EACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,OAAO,CAAC;AAoBjE,MAAM,WAAW,mBAAmB;IAChC,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AA2pBD,wBAAgB,WAAW,CAAC,EACxB,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,EAAE,UAAU,EAClB,cAAc,EAAE,kBAAkB,EAClC,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,cAAc,EAC1B,SAAS,GACZ,EAAE,gBAAgB,2CAgGlB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ThemeConfig } from '@formatica/core';
|
|
2
|
+
import { ComponentType, ReactNode } from 'react';
|
|
3
|
+
import { FieldComponentProps } from './FormBuilder';
|
|
4
|
+
export interface FormaticaConfig {
|
|
5
|
+
theme?: ThemeConfig;
|
|
6
|
+
locale?: string;
|
|
7
|
+
fallbackLocale?: string;
|
|
8
|
+
components?: Record<string, ComponentType<FieldComponentProps>>;
|
|
9
|
+
}
|
|
10
|
+
export declare function FormaticaProvider({ config, children, }: {
|
|
11
|
+
config: FormaticaConfig;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function useFormaticaConfig(): FormaticaConfig;
|
|
15
|
+
//# sourceMappingURL=FormaticaProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormaticaProvider.d.ts","sourceRoot":"","sources":["../../src/components/FormaticaProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAiB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,mBAAmB,CAAC,CAAC,CAAC;CACnE;AAID,wBAAgB,iBAAiB,CAAC,EAC9B,MAAM,EACN,QAAQ,GACX,EAAE;IACC,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;CACvB,2CAIA;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface CheckboxFieldProps {
|
|
2
|
+
value: boolean;
|
|
3
|
+
onChange: (value: boolean) => void;
|
|
4
|
+
onBlur?: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
label?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function CheckboxField({ value, onChange, onBlur, disabled, label, className, }: CheckboxFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=CheckboxField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/CheckboxField.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,KAAK,EACL,SAAS,GACZ,EAAE,kBAAkB,2CA+DpB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface NumberFieldProps {
|
|
2
|
+
value: number | null;
|
|
3
|
+
onChange: (value: number | null) => void;
|
|
4
|
+
onBlur?: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
step?: number;
|
|
10
|
+
precision?: number;
|
|
11
|
+
readOnly?: boolean;
|
|
12
|
+
prefix?: string;
|
|
13
|
+
suffix?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function NumberField({ value, onChange, onBlur, disabled, placeholder, min, max, step, precision, readOnly, prefix, suffix, className, }: NumberFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=NumberField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/NumberField.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,wBAAgB,WAAW,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,WAAW,EACX,GAAG,EACH,GAAG,EACH,IAAQ,EACR,SAAS,EACT,QAAQ,EACR,MAAM,EACN,MAAM,EACN,SAAS,GACZ,EAAE,gBAAgB,2CAgElB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface RadioOption {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string | number | boolean;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface RadioFieldProps {
|
|
7
|
+
name: string;
|
|
8
|
+
value: unknown;
|
|
9
|
+
onChange: (value: string | number | boolean) => void;
|
|
10
|
+
onBlur?: () => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
options: RadioOption[];
|
|
13
|
+
inline?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function RadioField({ name, value, onChange, onBlur, disabled, options, inline, className, }: RadioFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=RadioField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/RadioField.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;IACrD,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,EACvB,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAc,EACd,SAAS,GACZ,EAAE,eAAe,2CA0EjB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface SelectOption {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string | number | boolean;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface SelectFieldProps {
|
|
7
|
+
value: unknown;
|
|
8
|
+
onChange: (value: unknown) => void;
|
|
9
|
+
onBlur?: () => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
options: SelectOption[];
|
|
13
|
+
multiple?: boolean;
|
|
14
|
+
searchable?: boolean;
|
|
15
|
+
clearable?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function SelectField({ value, onChange, onBlur, disabled, placeholder, options, multiple, searchable, clearable, className, }: SelectFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=SelectField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/SelectField.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,WAAyB,EACzB,OAAO,EACP,QAAgB,EAChB,UAAkB,EAClB,SAAiB,EACjB,SAAS,GACZ,EAAE,gBAAgB,2CAqQlB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface SliderFieldProps {
|
|
2
|
+
value: number | null;
|
|
3
|
+
onChange: (value: number) => void;
|
|
4
|
+
onBlur?: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
min?: number;
|
|
7
|
+
max?: number;
|
|
8
|
+
step?: number;
|
|
9
|
+
showTooltip?: boolean;
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function SliderField({ value, onChange, onBlur, disabled, min, max, step, showTooltip, className, }: SliderFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=SliderField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SliderField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/SliderField.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,GAAO,EACP,GAAS,EACT,IAAQ,EACR,WAAkB,EAClB,SAAS,GACZ,EAAE,gBAAgB,2CAmDlB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SwitchFieldProps {
|
|
2
|
+
value: boolean;
|
|
3
|
+
onChange: (value: boolean) => void;
|
|
4
|
+
onBlur?: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
activeLabel?: string;
|
|
7
|
+
inactiveLabel?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function SwitchField({ value, onChange, onBlur, disabled, activeLabel, inactiveLabel, className, }: SwitchFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=SwitchField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwitchField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/SwitchField.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,WAAW,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,WAAW,EACX,aAAa,EACb,SAAS,GACZ,EAAE,gBAAgB,2CAiDlB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface TextFieldProps {
|
|
2
|
+
value: string;
|
|
3
|
+
onChange: (value: string) => void;
|
|
4
|
+
onBlur?: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
inputType?: "text" | "email" | "password" | "url" | "tel" | "search";
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
prefix?: string;
|
|
10
|
+
suffix?: string;
|
|
11
|
+
maxLength?: number;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function TextField({ value, onChange, onBlur, disabled, placeholder, inputType, readOnly, prefix, suffix, maxLength, className, }: TextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=TextField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/TextField.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,wBAAgB,SAAS,CAAC,EACtB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAkB,EAClB,QAAQ,EACR,MAAM,EACN,MAAM,EACN,SAAS,EACT,SAAS,GACZ,EAAE,cAAc,2CAiDhB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface TextareaFieldProps {
|
|
2
|
+
value: string;
|
|
3
|
+
onChange: (value: string) => void;
|
|
4
|
+
onBlur?: () => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
rows?: number;
|
|
8
|
+
readOnly?: boolean;
|
|
9
|
+
autoResize?: boolean;
|
|
10
|
+
maxLength?: number;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function TextareaField({ value, onChange, onBlur, disabled, placeholder, rows, readOnly, autoResize, maxLength, className, }: TextareaFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=TextareaField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextareaField.d.ts","sourceRoot":"","sources":["../../../src/components/fields/TextareaField.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAKD,wBAAgB,aAAa,CAAC,EAC1B,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,WAAW,EACX,IAAQ,EACR,QAAQ,EACR,UAAU,EACV,SAAS,EACT,SAAS,GACZ,EAAE,kBAAkB,2CA2CpB"}
|