@pixpilot/formily-shadcn 0.9.1 → 0.11.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 +102 -1
- package/dist/components/array-base/components/array-item-label.cjs +1 -1
- package/dist/components/array-base/components/array-item-label.js +1 -1
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/column.d.ts +2 -2
- package/dist/components/context/context.d.cts +1 -1
- package/dist/components/context/context.d.ts +1 -1
- package/dist/components/context/form-context.d.cts +52 -19
- package/dist/components/context/form-context.d.ts +52 -19
- package/dist/components/context/index.d.cts +1 -1
- package/dist/components/context/index.d.ts +1 -1
- package/dist/components/date-picker.d.cts +3 -3
- package/dist/components/date-picker.d.ts +3 -3
- package/dist/components/file-upload/file-upload-inline.d.cts +8 -8
- package/dist/components/file-upload/file-upload-inline.d.ts +8 -8
- package/dist/components/file-upload/file-upload.d.cts +8 -8
- package/dist/components/file-upload/file-upload.d.ts +8 -8
- package/dist/components/file-upload/use-file-upload-feedback.cjs +2 -2
- package/dist/components/file-upload/use-file-upload-feedback.js +2 -2
- package/dist/components/form-grid.d.cts +2 -2
- package/dist/components/form-grid.d.ts +2 -2
- package/dist/components/form-item/base-form-item.cjs +85 -0
- package/dist/components/form-item/base-form-item.d.cts +2 -0
- package/dist/components/form-item/base-form-item.d.ts +2 -0
- package/dist/components/form-item/base-form-item.js +80 -0
- package/dist/components/form-item/connected-form-item.cjs +47 -0
- package/dist/components/form-item/connected-form-item.d.cts +13 -0
- package/dist/components/form-item/connected-form-item.d.ts +13 -0
- package/dist/components/form-item/connected-form-item.js +44 -0
- package/dist/components/form-item/form-item-description-popover.cjs +42 -0
- package/dist/components/form-item/form-item-description-popover.js +37 -0
- package/dist/components/form-item/form-item-label.cjs +29 -0
- package/dist/components/form-item/form-item-label.js +25 -0
- package/dist/components/form-item/form-item-types.d.cts +23 -0
- package/dist/components/form-item/form-item-types.d.ts +23 -0
- package/dist/components/form-item/form-item.cjs +2 -0
- package/dist/components/form-item/form-item.d.cts +4 -0
- package/dist/components/form-item/form-item.d.ts +4 -0
- package/dist/components/form-item/form-item.js +2 -0
- package/dist/components/form-item/index.cjs +3 -0
- package/dist/components/form-item/index.d.cts +4 -0
- package/dist/components/form-item/index.d.ts +4 -0
- package/dist/components/form-item/index.js +3 -0
- package/dist/components/form-item/spacing-config.cjs +24 -0
- package/dist/components/form-item/spacing-config.js +23 -0
- package/dist/components/form-items-container.cjs +3 -5
- package/dist/components/form-items-container.js +3 -5
- package/dist/components/form.cjs +5 -14
- package/dist/components/form.d.cts +4 -7
- package/dist/components/form.d.ts +2 -5
- package/dist/components/form.js +5 -14
- package/dist/components/icon-picker.cjs +2 -2
- package/dist/components/icon-picker.d.cts +3 -3
- package/dist/components/icon-picker.d.ts +3 -3
- package/dist/components/icon-picker.js +2 -2
- package/dist/components/input.d.cts +2 -2
- package/dist/components/input.d.ts +2 -2
- package/dist/components/json-schema-form-renderer/index.cjs +4 -0
- package/dist/components/json-schema-form-renderer/index.d.cts +5 -0
- package/dist/components/json-schema-form-renderer/index.d.ts +5 -0
- package/dist/components/json-schema-form-renderer/index.js +4 -0
- package/dist/components/json-schema-form-renderer/json-schema-form-basic.cjs +35 -0
- package/dist/components/json-schema-form-renderer/json-schema-form-basic.d.cts +14 -0
- package/dist/components/json-schema-form-renderer/json-schema-form-basic.d.ts +14 -0
- package/dist/components/json-schema-form-renderer/json-schema-form-basic.js +32 -0
- package/dist/components/json-schema-form-renderer/json-schema-form-extended.cjs +35 -0
- package/dist/components/json-schema-form-renderer/json-schema-form-extended.d.cts +14 -0
- package/dist/components/json-schema-form-renderer/json-schema-form-extended.d.ts +14 -0
- package/dist/components/json-schema-form-renderer/json-schema-form-extended.js +32 -0
- package/dist/components/json-schema-form-renderer/json-schema-form-renderer.cjs +57 -0
- package/dist/components/json-schema-form-renderer/json-schema-form-renderer.d.cts +7 -0
- package/dist/components/json-schema-form-renderer/json-schema-form-renderer.d.ts +7 -0
- package/dist/components/json-schema-form-renderer/json-schema-form-renderer.js +51 -0
- package/dist/components/json-schema-form-renderer/json-schema-form.cjs +36 -0
- package/dist/components/json-schema-form-renderer/json-schema-form.d.cts +14 -0
- package/dist/components/json-schema-form-renderer/json-schema-form.d.ts +14 -0
- package/dist/components/json-schema-form-renderer/json-schema-form.js +33 -0
- package/dist/components/json-schema-form-renderer/types.d.cts +23 -0
- package/dist/components/json-schema-form-renderer/types.d.ts +23 -0
- package/dist/components/number-input.d.cts +2 -2
- package/dist/components/number-input.d.ts +2 -2
- package/dist/components/object-container.cjs +42 -9
- package/dist/components/object-container.js +43 -10
- package/dist/components/radio.d.cts +2 -2
- package/dist/components/radio.d.ts +2 -2
- package/dist/components/rich-text-editor.cjs +1 -1
- package/dist/components/rich-text-editor.js +1 -1
- package/dist/components/row.d.cts +2 -2
- package/dist/components/row.d.ts +2 -2
- package/dist/components/schema-field/index.d.cts +3 -3
- package/dist/components/schema-field/index.d.ts +3 -3
- package/dist/components/schema-field/index.js +3 -3
- package/dist/components/schema-field/schema-field-basics.cjs +67 -24
- package/dist/components/schema-field/schema-field-basics.d.cts +283 -198
- package/dist/components/schema-field/schema-field-basics.d.ts +283 -198
- package/dist/components/schema-field/schema-field-basics.js +65 -23
- package/dist/components/schema-field/schema-field-extended.cjs +23 -8
- package/dist/components/schema-field/schema-field-extended.d.cts +442 -307
- package/dist/components/schema-field/schema-field-extended.d.ts +442 -307
- package/dist/components/schema-field/schema-field-extended.js +23 -9
- package/dist/components/schema-field/schema-field.cjs +23 -8
- package/dist/components/schema-field/schema-field.d.cts +338 -237
- package/dist/components/schema-field/schema-field.d.ts +338 -237
- package/dist/components/schema-field/schema-field.js +23 -9
- package/dist/components/separator.d.ts +2 -2
- package/dist/components/slider.d.cts +2 -2
- package/dist/components/slider.d.ts +2 -2
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/tags-input-inline.d.cts +2 -2
- package/dist/components/tags-input-inline.d.ts +2 -2
- package/dist/components/textarea.d.ts +2 -2
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/use-form-context.cjs +5 -0
- package/dist/hooks/use-form-context.js +5 -1
- package/dist/hooks/use-label.cjs +9 -2
- package/dist/hooks/use-label.js +9 -2
- package/dist/index.cjs +17 -6
- package/dist/index.d.cts +14 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +11 -6
- package/dist/types/form-item.d.cts +5 -0
- package/dist/types/form-item.d.ts +5 -0
- package/dist/types/form.d.cts +0 -6
- package/dist/types/form.d.ts +0 -6
- package/dist/utils/extract-components.cjs +11 -0
- package/dist/utils/extract-components.js +10 -0
- package/dist/utils/extract-fields-decorators.cjs +37 -0
- package/dist/utils/extract-fields-decorators.js +36 -0
- package/dist/utils/index.cjs +2 -0
- package/dist/utils/index.js +3 -1
- package/dist/utils/resolve-responsive-space.cjs +45 -89
- package/dist/utils/resolve-responsive-space.js +42 -83
- package/dist/utils/transform-schema.cjs +9 -2
- package/dist/utils/transform-schema.js +9 -2
- package/dist/utils/validate-schema-components.cjs +45 -0
- package/dist/utils/validate-schema-components.js +43 -0
- package/package.json +4 -3
- package/dist/components/form-item.cjs +0 -118
- package/dist/components/form-item.d.cts +0 -22
- package/dist/components/form-item.d.ts +0 -22
- package/dist/components/form-item.js +0 -112
- package/dist/components/json-schema-form-renderer.cjs +0 -31
- package/dist/components/json-schema-form-renderer.d.cts +0 -15
- package/dist/components/json-schema-form-renderer.d.ts +0 -15
- package/dist/components/json-schema-form-renderer.js +0 -27
package/README.md
CHANGED
|
@@ -56,7 +56,11 @@ const schema = {
|
|
|
56
56
|
|
|
57
57
|
function MyForm() {
|
|
58
58
|
return (
|
|
59
|
-
<Form
|
|
59
|
+
<Form
|
|
60
|
+
form={form}
|
|
61
|
+
layout={{ density: 'comfortable' }}
|
|
62
|
+
onSubmit={(values) => console.log(values)}
|
|
63
|
+
>
|
|
60
64
|
<SchemaField schema={schema} />
|
|
61
65
|
<button type="submit">Submit</button>
|
|
62
66
|
</Form>
|
|
@@ -149,6 +153,28 @@ import {
|
|
|
149
153
|
- `x-component-props`: Props passed to the component
|
|
150
154
|
- `x-decorator-props`: Props passed to the decorator
|
|
151
155
|
|
|
156
|
+
## Documentation
|
|
157
|
+
|
|
158
|
+
### [Form Layout Options](./docs/form-layout-options.md)
|
|
159
|
+
|
|
160
|
+
Learn how to configure form layout and visual settings using the `FormLayoutOptions` interface:
|
|
161
|
+
|
|
162
|
+
- **Density** - Control spacing between form elements (compact, normal, comfortable, responsive)
|
|
163
|
+
- **Description Placement** - Configure where field descriptions appear (top, bottom, popover)
|
|
164
|
+
- **Label Placement** - Set label position relative to inputs (top, bottom, start, end)
|
|
165
|
+
- **Custom Classes** - Apply custom CSS classes to form elements
|
|
166
|
+
|
|
167
|
+
[Read the full documentation →](./docs/form-layout-options.md)
|
|
168
|
+
|
|
169
|
+
### [JSON Schema Form: Headless vs Default Pattern](./docs/json-schema-form-headless-vs-default.md)
|
|
170
|
+
|
|
171
|
+
Learn about the difference between `JsonSchemaFormRenderer` (headless) and `JsonSchemaForm` (batteries-included) components:
|
|
172
|
+
|
|
173
|
+
- **`JsonSchemaFormRenderer`** - Pure, headless component that requires you to provide all components explicitly. Ideal for custom component registries and bundle size optimization.
|
|
174
|
+
- **`JsonSchemaForm`** - Convenience wrapper that comes pre-loaded with all standard components (Slider, Combobox, TagsInput, etc.). Perfect for getting started quickly.
|
|
175
|
+
|
|
176
|
+
[Read the full documentation →](./docs/json-schema-form-headless-vs-default.md)
|
|
177
|
+
|
|
152
178
|
## API Reference
|
|
153
179
|
|
|
154
180
|
### createForm
|
|
@@ -161,3 +187,78 @@ const form = createForm({
|
|
|
161
187
|
effects: () => {},
|
|
162
188
|
});
|
|
163
189
|
```
|
|
190
|
+
|
|
191
|
+
### Form Configuration
|
|
192
|
+
|
|
193
|
+
#### useFieldNameAsLabel
|
|
194
|
+
|
|
195
|
+
The `useFieldNameAsLabel` option controls whether field names are automatically converted to labels when no explicit label is provided.
|
|
196
|
+
|
|
197
|
+
**Default Behavior:**
|
|
198
|
+
|
|
199
|
+
- **`JsonSchemaFormRenderer`** - Sets `useFieldNameAsLabel: true` by default. Field names are automatically capitalized and used as labels if no `title` is provided in the schema.
|
|
200
|
+
- **`Form` component** - Must be explicitly configured. Users need to set `useFieldNameAsLabel: true` in the `config` prop to enable this behavior.
|
|
201
|
+
|
|
202
|
+
**Example with JsonSchemaFormRenderer (enabled by default):**
|
|
203
|
+
|
|
204
|
+
```tsx
|
|
205
|
+
import { JsonSchemaFormRenderer } from '@pixpilot/formily-shadcn';
|
|
206
|
+
|
|
207
|
+
const schema = {
|
|
208
|
+
type: 'object',
|
|
209
|
+
properties: {
|
|
210
|
+
userName: {
|
|
211
|
+
type: 'string',
|
|
212
|
+
'x-decorator': 'FormItem',
|
|
213
|
+
'x-component': 'Input',
|
|
214
|
+
// No title provided - will use "User Name" as label
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
export function MyForm() {
|
|
220
|
+
return <JsonSchemaFormRenderer schema={schema} />;
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
**Example with Form component (requires explicit configuration):**
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
import { createForm, Form, SchemaField } from '@pixpilot/formily-shadcn';
|
|
228
|
+
|
|
229
|
+
const form = createForm();
|
|
230
|
+
|
|
231
|
+
const schema = {
|
|
232
|
+
type: 'object',
|
|
233
|
+
properties: {
|
|
234
|
+
userName: {
|
|
235
|
+
type: 'string',
|
|
236
|
+
'x-decorator': 'FormItem',
|
|
237
|
+
'x-component': 'Input',
|
|
238
|
+
// No title provided - will use "User Name" as label only if config is set
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
export function MyForm() {
|
|
244
|
+
return (
|
|
245
|
+
<Form
|
|
246
|
+
form={form}
|
|
247
|
+
config={{
|
|
248
|
+
label: {
|
|
249
|
+
useFieldNameAsLabel: true, // Must be explicitly set
|
|
250
|
+
},
|
|
251
|
+
}}
|
|
252
|
+
>
|
|
253
|
+
<SchemaField schema={schema} />
|
|
254
|
+
</Form>
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
The label resolution priority is:
|
|
260
|
+
|
|
261
|
+
1. Explicit `label` prop (if provided and not `false`)
|
|
262
|
+
2. Schema `title` field
|
|
263
|
+
3. Field `name` capitalized (only if `useFieldNameAsLabel: true`)
|
|
264
|
+
4. No label
|
|
@@ -11,7 +11,7 @@ const ArrayItemLabel = () => {
|
|
|
11
11
|
const label = require_use_label.useLabel();
|
|
12
12
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
13
13
|
className: "font-medium",
|
|
14
|
-
children: [label, typeof label === "string" ? ` ${(index ?? 0) + 1}` : ""]
|
|
14
|
+
children: [label, typeof label === "string" || label == null ? ` ${(index ?? 0) + 1}` : ""]
|
|
15
15
|
});
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -9,7 +9,7 @@ const ArrayItemLabel = () => {
|
|
|
9
9
|
const label = useLabel();
|
|
10
10
|
return /* @__PURE__ */ jsxs("span", {
|
|
11
11
|
className: "font-medium",
|
|
12
|
-
children: [label, typeof label === "string" ? ` ${(index ?? 0) + 1}` : ""]
|
|
12
|
+
children: [label, typeof label === "string" || label == null ? ` ${(index ?? 0) + 1}` : ""]
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react0 from "react";
|
|
2
2
|
import * as _radix_ui_react_checkbox0 from "@radix-ui/react-checkbox";
|
|
3
3
|
|
|
4
4
|
//#region src/components/checkbox.d.ts
|
|
@@ -6,6 +6,6 @@ import * as _radix_ui_react_checkbox0 from "@radix-ui/react-checkbox";
|
|
|
6
6
|
* Formily-connected Checkbox component
|
|
7
7
|
* Maps Formily field checked state to shadcn Checkbox
|
|
8
8
|
*/
|
|
9
|
-
declare const Checkbox:
|
|
9
|
+
declare const Checkbox: react0.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_checkbox0.CheckboxProps & react0.RefAttributes<HTMLButtonElement>>, "ref"> & react0.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Checkbox };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/column.d.ts
|
|
5
5
|
interface IColumnProps {
|
|
@@ -36,6 +36,6 @@ interface IColumnProps {
|
|
|
36
36
|
declare function Column({
|
|
37
37
|
className,
|
|
38
38
|
children
|
|
39
|
-
}: IColumnProps):
|
|
39
|
+
}: IColumnProps): react_jsx_runtime0.JSX.Element;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { Column };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FormContextStates } from "./form-context.cjs";
|
|
1
|
+
import { FormContextStates, FormLayoutOptions } from "./form-context.cjs";
|
|
2
2
|
import "react";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FormContextStates } from "./form-context.js";
|
|
1
|
+
import { FormContextStates, FormLayoutOptions } from "./form-context.js";
|
|
2
2
|
import "react";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FormSpace } from "../../types/form.cjs";
|
|
2
|
+
import { DescriptionPlacement, LabelPlacement } from "../../types/form-item.cjs";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import { FileUploadProgressCallBacks, IconProvider, RichTextEditorProps } from "@pixpilot/shadcn-ui";
|
|
4
5
|
|
|
@@ -7,28 +8,60 @@ interface FomFileUpload {
|
|
|
7
8
|
onUpload?: (files: File[], options: FileUploadProgressCallBacks) => void;
|
|
8
9
|
maxSize?: number;
|
|
9
10
|
}
|
|
10
|
-
interface
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
interface FormConfigProps {
|
|
12
|
+
label?: {
|
|
13
|
+
useFieldNameAsLabel?: boolean;
|
|
14
|
+
};
|
|
15
|
+
iconPicker?: {
|
|
16
|
+
/**
|
|
17
|
+
* Icon providers - can be static providers or async loader functions
|
|
18
|
+
* Users can provide either IconProvider[] or AsyncIconProvider[]
|
|
19
|
+
*/
|
|
20
|
+
providers: IconProvider[];
|
|
21
|
+
/**
|
|
22
|
+
* Optional callback when providers are loaded
|
|
23
|
+
*/
|
|
24
|
+
onProvidersLoaded?: (providers: IconProvider[]) => void;
|
|
13
25
|
};
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
fileUpload?: FomFileUpload;
|
|
27
|
+
richTextEditor?: RichTextEditorProps;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Layout configuration options for form components.
|
|
31
|
+
* Groups all visual and layout-related settings.
|
|
32
|
+
*/
|
|
33
|
+
interface FormLayoutOptions {
|
|
34
|
+
/** Form density - affects spacing between elements */
|
|
35
|
+
density?: FormSpace['density'];
|
|
36
|
+
/** Default description placement for FormItem decorators */
|
|
37
|
+
descriptionPlacement?: DescriptionPlacement;
|
|
38
|
+
/** Default label placement for FormItem decorators */
|
|
39
|
+
labelPlacement?: LabelPlacement;
|
|
40
|
+
/** Custom class names for FormItem elements */
|
|
41
|
+
itemProps?: {
|
|
42
|
+
classes?: {
|
|
43
|
+
label?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
inputWrapper?: string;
|
|
46
|
+
errorMessage?: string;
|
|
47
|
+
};
|
|
16
48
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Optional callback when providers are loaded
|
|
26
|
-
*/
|
|
27
|
-
onProvidersLoaded?: (providers: IconProvider[]) => void;
|
|
49
|
+
/** Custom class names for ObjectContainer elements */
|
|
50
|
+
objectContainer?: {
|
|
51
|
+
classes?: {
|
|
52
|
+
card?: string;
|
|
53
|
+
header?: string;
|
|
54
|
+
title?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
content?: string;
|
|
28
57
|
};
|
|
29
|
-
fileUpload?: FomFileUpload;
|
|
30
|
-
richTextEditor?: RichTextEditorProps;
|
|
31
58
|
};
|
|
32
59
|
}
|
|
60
|
+
interface FormContextStates {
|
|
61
|
+
/** Layout configuration options */
|
|
62
|
+
layout?: FormLayoutOptions;
|
|
63
|
+
/** Form-level configuration settings */
|
|
64
|
+
settings?: FormConfigProps;
|
|
65
|
+
}
|
|
33
66
|
//#endregion
|
|
34
|
-
export { FomFileUpload, FormContextStates };
|
|
67
|
+
export { FomFileUpload, FormConfigProps, FormContextStates, FormLayoutOptions };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FormSpace } from "../../types/form.js";
|
|
2
|
+
import { DescriptionPlacement, LabelPlacement } from "../../types/form-item.js";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import { FileUploadProgressCallBacks, IconProvider, RichTextEditorProps } from "@pixpilot/shadcn-ui";
|
|
4
5
|
|
|
@@ -7,28 +8,60 @@ interface FomFileUpload {
|
|
|
7
8
|
onUpload?: (files: File[], options: FileUploadProgressCallBacks) => void;
|
|
8
9
|
maxSize?: number;
|
|
9
10
|
}
|
|
10
|
-
interface
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
interface FormConfigProps {
|
|
12
|
+
label?: {
|
|
13
|
+
useFieldNameAsLabel?: boolean;
|
|
14
|
+
};
|
|
15
|
+
iconPicker?: {
|
|
16
|
+
/**
|
|
17
|
+
* Icon providers - can be static providers or async loader functions
|
|
18
|
+
* Users can provide either IconProvider[] or AsyncIconProvider[]
|
|
19
|
+
*/
|
|
20
|
+
providers: IconProvider[];
|
|
21
|
+
/**
|
|
22
|
+
* Optional callback when providers are loaded
|
|
23
|
+
*/
|
|
24
|
+
onProvidersLoaded?: (providers: IconProvider[]) => void;
|
|
13
25
|
};
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
fileUpload?: FomFileUpload;
|
|
27
|
+
richTextEditor?: RichTextEditorProps;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Layout configuration options for form components.
|
|
31
|
+
* Groups all visual and layout-related settings.
|
|
32
|
+
*/
|
|
33
|
+
interface FormLayoutOptions {
|
|
34
|
+
/** Form density - affects spacing between elements */
|
|
35
|
+
density?: FormSpace['density'];
|
|
36
|
+
/** Default description placement for FormItem decorators */
|
|
37
|
+
descriptionPlacement?: DescriptionPlacement;
|
|
38
|
+
/** Default label placement for FormItem decorators */
|
|
39
|
+
labelPlacement?: LabelPlacement;
|
|
40
|
+
/** Custom class names for FormItem elements */
|
|
41
|
+
itemProps?: {
|
|
42
|
+
classes?: {
|
|
43
|
+
label?: string;
|
|
44
|
+
description?: string;
|
|
45
|
+
inputWrapper?: string;
|
|
46
|
+
errorMessage?: string;
|
|
47
|
+
};
|
|
16
48
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Optional callback when providers are loaded
|
|
26
|
-
*/
|
|
27
|
-
onProvidersLoaded?: (providers: IconProvider[]) => void;
|
|
49
|
+
/** Custom class names for ObjectContainer elements */
|
|
50
|
+
objectContainer?: {
|
|
51
|
+
classes?: {
|
|
52
|
+
card?: string;
|
|
53
|
+
header?: string;
|
|
54
|
+
title?: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
content?: string;
|
|
28
57
|
};
|
|
29
|
-
fileUpload?: FomFileUpload;
|
|
30
|
-
richTextEditor?: RichTextEditorProps;
|
|
31
58
|
};
|
|
32
59
|
}
|
|
60
|
+
interface FormContextStates {
|
|
61
|
+
/** Layout configuration options */
|
|
62
|
+
layout?: FormLayoutOptions;
|
|
63
|
+
/** Form-level configuration settings */
|
|
64
|
+
settings?: FormConfigProps;
|
|
65
|
+
}
|
|
33
66
|
//#endregion
|
|
34
|
-
export { FomFileUpload, FormContextStates };
|
|
67
|
+
export { FomFileUpload, FormConfigProps, FormContextStates, FormLayoutOptions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FomFileUpload, FormContextStates } from "./form-context.cjs";
|
|
1
|
+
import { FomFileUpload, FormConfigProps, FormContextStates, FormLayoutOptions } from "./form-context.cjs";
|
|
2
2
|
import "./context.cjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FomFileUpload, FormContextStates } from "./form-context.js";
|
|
1
|
+
import { FomFileUpload, FormConfigProps, FormContextStates, FormLayoutOptions } from "./form-context.js";
|
|
2
2
|
import "./context.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react4 from "react";
|
|
2
2
|
import { DatePickerProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/date-picker.d.ts
|
|
5
|
-
declare const DatePicker:
|
|
5
|
+
declare const DatePicker: react4.ForwardRefExoticComponent<Partial<{
|
|
6
6
|
value?: Date;
|
|
7
7
|
onChange?: (date: Date | undefined) => void;
|
|
8
8
|
placeholder?: string;
|
|
9
|
-
} & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> &
|
|
9
|
+
} & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> & react4.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { DatePicker };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react2 from "react";
|
|
2
2
|
import { DatePickerProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/date-picker.d.ts
|
|
5
|
-
declare const DatePicker$1:
|
|
5
|
+
declare const DatePicker$1: react2.ForwardRefExoticComponent<Partial<{
|
|
6
6
|
value?: Date;
|
|
7
7
|
onChange?: (date: Date | undefined) => void;
|
|
8
8
|
placeholder?: string;
|
|
9
|
-
} & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> &
|
|
9
|
+
} & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> & react2.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { DatePicker$1 as DatePicker };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/file-upload/file-upload-inline.d.ts
|
|
5
5
|
|
|
@@ -7,14 +7,14 @@ import * as _pixpilot_shadcn_ui8 from "@pixpilot/shadcn-ui";
|
|
|
7
7
|
* Formily-connected FileUploadInline component
|
|
8
8
|
* Automatically connects shadcn FileUploadInline to Formily field state
|
|
9
9
|
*/
|
|
10
|
-
declare const FileUploadInline: React.ForwardRefExoticComponent<(Omit<Partial<
|
|
10
|
+
declare const FileUploadInline: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui0.FileUploadInlineBaseProps & {
|
|
11
11
|
multiple: true;
|
|
12
|
-
value?:
|
|
13
|
-
onChange?:
|
|
14
|
-
} &
|
|
12
|
+
value?: _pixpilot_shadcn_ui0.FileMetadata[];
|
|
13
|
+
onChange?: _pixpilot_shadcn_ui0.OnChangeMultipleFiles;
|
|
14
|
+
} & _pixpilot_shadcn_ui0.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui0.FileUploadInlineBaseProps & {
|
|
15
15
|
multiple?: false;
|
|
16
|
-
value?:
|
|
17
|
-
onChange?:
|
|
18
|
-
} &
|
|
16
|
+
value?: _pixpilot_shadcn_ui0.FileMetadata | null;
|
|
17
|
+
onChange?: _pixpilot_shadcn_ui0.OnChangeSingleFile;
|
|
18
|
+
} & _pixpilot_shadcn_ui0.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { FileUploadInline };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/file-upload/file-upload-inline.d.ts
|
|
5
5
|
|
|
@@ -7,14 +7,14 @@ import * as _pixpilot_shadcn_ui8 from "@pixpilot/shadcn-ui";
|
|
|
7
7
|
* Formily-connected FileUploadInline component
|
|
8
8
|
* Automatically connects shadcn FileUploadInline to Formily field state
|
|
9
9
|
*/
|
|
10
|
-
declare const FileUploadInline$1: React.ForwardRefExoticComponent<(Omit<Partial<
|
|
10
|
+
declare const FileUploadInline$1: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui0.FileUploadInlineBaseProps & {
|
|
11
11
|
multiple: true;
|
|
12
|
-
value?:
|
|
13
|
-
onChange?:
|
|
14
|
-
} &
|
|
12
|
+
value?: _pixpilot_shadcn_ui0.FileMetadata[];
|
|
13
|
+
onChange?: _pixpilot_shadcn_ui0.OnChangeMultipleFiles;
|
|
14
|
+
} & _pixpilot_shadcn_ui0.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui0.FileUploadInlineBaseProps & {
|
|
15
15
|
multiple?: false;
|
|
16
|
-
value?:
|
|
17
|
-
onChange?:
|
|
18
|
-
} &
|
|
16
|
+
value?: _pixpilot_shadcn_ui0.FileMetadata | null;
|
|
17
|
+
onChange?: _pixpilot_shadcn_ui0.OnChangeSingleFile;
|
|
18
|
+
} & _pixpilot_shadcn_ui0.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { FileUploadInline$1 as FileUploadInline };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _pixpilot_shadcn_ui8 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/file-upload/file-upload.d.ts
|
|
5
5
|
|
|
@@ -7,14 +7,14 @@ import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
|
7
7
|
* Formily-connected FileUploadInline component
|
|
8
8
|
* Automatically connects shadcn FileUploadInline to Formily field state
|
|
9
9
|
*/
|
|
10
|
-
declare const FileUpload: React.ForwardRefExoticComponent<(Omit<Partial<
|
|
10
|
+
declare const FileUpload: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui8.FileUploadInlineBaseProps & {
|
|
11
11
|
multiple: true;
|
|
12
|
-
value?:
|
|
13
|
-
onChange?:
|
|
14
|
-
} &
|
|
12
|
+
value?: _pixpilot_shadcn_ui8.FileMetadata[];
|
|
13
|
+
onChange?: _pixpilot_shadcn_ui8.OnChangeMultipleFiles;
|
|
14
|
+
} & _pixpilot_shadcn_ui8.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui8.FileUploadInlineBaseProps & {
|
|
15
15
|
multiple?: false;
|
|
16
|
-
value?:
|
|
17
|
-
onChange?:
|
|
18
|
-
} &
|
|
16
|
+
value?: _pixpilot_shadcn_ui8.FileMetadata | null;
|
|
17
|
+
onChange?: _pixpilot_shadcn_ui8.OnChangeSingleFile;
|
|
18
|
+
} & _pixpilot_shadcn_ui8.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { FileUpload };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _pixpilot_shadcn_ui8 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/file-upload/file-upload.d.ts
|
|
5
5
|
|
|
@@ -7,14 +7,14 @@ import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
|
7
7
|
* Formily-connected FileUploadInline component
|
|
8
8
|
* Automatically connects shadcn FileUploadInline to Formily field state
|
|
9
9
|
*/
|
|
10
|
-
declare const FileUpload$1: React.ForwardRefExoticComponent<(Omit<Partial<
|
|
10
|
+
declare const FileUpload$1: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui8.FileUploadInlineBaseProps & {
|
|
11
11
|
multiple: true;
|
|
12
|
-
value?:
|
|
13
|
-
onChange?:
|
|
14
|
-
} &
|
|
12
|
+
value?: _pixpilot_shadcn_ui8.FileMetadata[];
|
|
13
|
+
onChange?: _pixpilot_shadcn_ui8.OnChangeMultipleFiles;
|
|
14
|
+
} & _pixpilot_shadcn_ui8.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui8.FileUploadInlineBaseProps & {
|
|
15
15
|
multiple?: false;
|
|
16
|
-
value?:
|
|
17
|
-
onChange?:
|
|
18
|
-
} &
|
|
16
|
+
value?: _pixpilot_shadcn_ui8.FileMetadata | null;
|
|
17
|
+
onChange?: _pixpilot_shadcn_ui8.OnChangeSingleFile;
|
|
18
|
+
} & _pixpilot_shadcn_ui8.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
|
|
19
19
|
//#endregion
|
|
20
20
|
export { FileUpload$1 as FileUpload };
|
|
@@ -11,9 +11,9 @@ pretty_bytes = require_rolldown_runtime.__toESM(pretty_bytes);
|
|
|
11
11
|
//#region src/components/file-upload/use-file-upload-feedback.ts
|
|
12
12
|
function useFileUploadFeedback(props) {
|
|
13
13
|
const { onUpload: onUploadProp, maxSize: maxSizeProp, onFilesReject, onFileValidate } = props;
|
|
14
|
-
const {
|
|
14
|
+
const { settings } = require_use_form_context.useFormContext();
|
|
15
15
|
const field = (0, __formily_react.useField)();
|
|
16
|
-
const { fileUpload } =
|
|
16
|
+
const { fileUpload } = settings || {};
|
|
17
17
|
const onUpload = onUploadProp ?? fileUpload?.onUpload;
|
|
18
18
|
const maxSize = maxSizeProp ?? fileUpload?.maxSize;
|
|
19
19
|
if (onUpload == null) {
|
|
@@ -7,9 +7,9 @@ import prettyBytes from "pretty-bytes";
|
|
|
7
7
|
//#region src/components/file-upload/use-file-upload-feedback.ts
|
|
8
8
|
function useFileUploadFeedback(props) {
|
|
9
9
|
const { onUpload: onUploadProp, maxSize: maxSizeProp, onFilesReject, onFileValidate } = props;
|
|
10
|
-
const {
|
|
10
|
+
const { settings } = useFormContext();
|
|
11
11
|
const field = useField();
|
|
12
|
-
const { fileUpload } =
|
|
12
|
+
const { fileUpload } = settings || {};
|
|
13
13
|
const onUpload = onUploadProp ?? fileUpload?.onUpload;
|
|
14
14
|
const maxSize = maxSizeProp ?? fileUpload?.maxSize;
|
|
15
15
|
if (onUpload == null) throw new Error("onUpload prop required for FileUploadInline. Provide handler on form or field props.");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/form-grid.d.ts
|
|
5
5
|
interface IFormGridProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
@@ -7,6 +7,6 @@ declare function FormGrid({
|
|
|
7
7
|
className,
|
|
8
8
|
children,
|
|
9
9
|
...rest
|
|
10
|
-
}: IFormGridProps):
|
|
10
|
+
}: IFormGridProps): react_jsx_runtime0.JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { FormGrid };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/form-grid.d.ts
|
|
5
5
|
interface IFormGridProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
@@ -7,6 +7,6 @@ declare function FormGrid({
|
|
|
7
7
|
className,
|
|
8
8
|
children,
|
|
9
9
|
...rest
|
|
10
|
-
}: IFormGridProps):
|
|
10
|
+
}: IFormGridProps): react_jsx_runtime1.JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { FormGrid };
|