@pixpilot/formily-shadcn 0.9.0 → 0.10.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 +75 -0
- package/dist/components/array-base/components/addition.cjs +2 -2
- package/dist/components/array-base/components/addition.d.cts +3 -2
- package/dist/components/array-base/components/addition.d.ts +3 -2
- package/dist/components/array-base/components/addition.js +2 -2
- 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/array-base/types.d.cts +2 -2
- package/dist/components/array-base/types.d.ts +2 -2
- package/dist/components/checkbox.d.cts +2 -2
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/context/form-context.d.cts +20 -16
- package/dist/components/context/form-context.d.ts +20 -16
- 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 +4 -10
- package/dist/components/date-picker.d.ts +5 -11
- package/dist/components/file-upload/file-upload-inline.d.cts +8 -8
- package/dist/components/file-upload/file-upload.d.cts +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-items-container.cjs +2 -5
- package/dist/components/form-items-container.js +2 -5
- package/dist/components/form.cjs +3 -5
- package/dist/components/form.d.cts +1 -2
- package/dist/components/form.d.ts +1 -2
- package/dist/components/form.js +3 -5
- package/dist/components/icon-picker.cjs +2 -2
- 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/json-schema-form-renderer.cjs +34 -7
- package/dist/components/json-schema-form-renderer.d.cts +8 -3
- package/dist/components/json-schema-form-renderer.d.ts +8 -3
- package/dist/components/json-schema-form-renderer.js +32 -7
- package/dist/components/number-input.d.cts +2 -2
- package/dist/components/number-input.d.ts +2 -2
- package/dist/components/object-container.cjs +33 -7
- package/dist/components/object-container.js +34 -8
- 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/schema-field/index.d.cts +1 -1
- package/dist/components/schema-field/index.d.ts +1 -1
- package/dist/components/schema-field/index.js +1 -1
- package/dist/components/schema-field/schema-field-basics.cjs +4 -4
- package/dist/components/schema-field/schema-field-basics.d.cts +209 -269
- package/dist/components/schema-field/schema-field-basics.d.ts +209 -269
- package/dist/components/schema-field/schema-field-basics.js +3 -3
- package/dist/components/schema-field/schema-field-extended.d.cts +427 -488
- package/dist/components/schema-field/schema-field-extended.d.ts +427 -488
- package/dist/components/schema-field/schema-field.cjs +1 -1
- package/dist/components/schema-field/schema-field.d.cts +236 -297
- package/dist/components/schema-field/schema-field.d.ts +236 -297
- package/dist/components/schema-field/schema-field.js +2 -2
- package/dist/components/separator.d.cts +2 -2
- 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.cts +2 -2
- package/dist/components/tags-input-inline.d.cts +2 -2
- package/dist/components/textarea.d.cts +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 +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/types/form.d.cts +0 -6
- package/dist/types/form.d.ts +0 -6
- 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/_virtual/rolldown_runtime.js +0 -24
package/README.md
CHANGED
|
@@ -161,3 +161,78 @@ const form = createForm({
|
|
|
161
161
|
effects: () => {},
|
|
162
162
|
});
|
|
163
163
|
```
|
|
164
|
+
|
|
165
|
+
### Form Configuration
|
|
166
|
+
|
|
167
|
+
#### useFieldNameAsLabel
|
|
168
|
+
|
|
169
|
+
The `useFieldNameAsLabel` option controls whether field names are automatically converted to labels when no explicit label is provided.
|
|
170
|
+
|
|
171
|
+
**Default Behavior:**
|
|
172
|
+
|
|
173
|
+
- **`JsonSchemaFormRenderer`** - Sets `useFieldNameAsLabel: true` by default. Field names are automatically capitalized and used as labels if no `title` is provided in the schema.
|
|
174
|
+
- **`Form` component** - Must be explicitly configured. Users need to set `useFieldNameAsLabel: true` in the `config` prop to enable this behavior.
|
|
175
|
+
|
|
176
|
+
**Example with JsonSchemaFormRenderer (enabled by default):**
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
import { JsonSchemaFormRenderer } from '@pixpilot/formily-shadcn';
|
|
180
|
+
|
|
181
|
+
const schema = {
|
|
182
|
+
type: 'object',
|
|
183
|
+
properties: {
|
|
184
|
+
userName: {
|
|
185
|
+
type: 'string',
|
|
186
|
+
'x-decorator': 'FormItem',
|
|
187
|
+
'x-component': 'Input',
|
|
188
|
+
// No title provided - will use "User Name" as label
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
export function MyForm() {
|
|
194
|
+
return <JsonSchemaFormRenderer schema={schema} />;
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**Example with Form component (requires explicit configuration):**
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
import { createForm, Form, SchemaField } from '@pixpilot/formily-shadcn';
|
|
202
|
+
|
|
203
|
+
const form = createForm();
|
|
204
|
+
|
|
205
|
+
const schema = {
|
|
206
|
+
type: 'object',
|
|
207
|
+
properties: {
|
|
208
|
+
userName: {
|
|
209
|
+
type: 'string',
|
|
210
|
+
'x-decorator': 'FormItem',
|
|
211
|
+
'x-component': 'Input',
|
|
212
|
+
// No title provided - will use "User Name" as label only if config is set
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
export function MyForm() {
|
|
218
|
+
return (
|
|
219
|
+
<Form
|
|
220
|
+
form={form}
|
|
221
|
+
config={{
|
|
222
|
+
label: {
|
|
223
|
+
useFieldNameAsLabel: true, // Must be explicitly set
|
|
224
|
+
},
|
|
225
|
+
}}
|
|
226
|
+
>
|
|
227
|
+
<SchemaField schema={schema} />
|
|
228
|
+
</Form>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
The label resolution priority is:
|
|
234
|
+
|
|
235
|
+
1. Explicit `label` prop (if provided and not `false`)
|
|
236
|
+
2. Schema `title` field
|
|
237
|
+
3. Field `name` capitalized (only if `useFieldNameAsLabel: true`)
|
|
238
|
+
4. No label
|
|
@@ -14,7 +14,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
14
14
|
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
15
15
|
|
|
16
16
|
//#region src/components/array-base/components/addition.tsx
|
|
17
|
-
|
|
17
|
+
function ArrayAddition({ ref,...props }) {
|
|
18
18
|
const { fullWidth = true } = props;
|
|
19
19
|
const self = (0, __formily_react.useField)();
|
|
20
20
|
const array = require_array_context.useArray();
|
|
@@ -44,7 +44,7 @@ const ArrayAddition = react.default.forwardRef((props, ref) => {
|
|
|
44
44
|
},
|
|
45
45
|
children: [props.icon !== void 0 ? props.icon : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.PlusIcon, { className: "mr-2 size-4" }), props.title ?? self.title ?? props.children ?? "Add Item"]
|
|
46
46
|
});
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
48
|
ArrayAddition.displayName = "ArrayAddition";
|
|
49
49
|
|
|
50
50
|
//#endregion
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { ButtonProps } from "@pixpilot/shadcn-ui";
|
|
3
|
+
import "react/jsx-runtime";
|
|
3
4
|
|
|
4
5
|
//#region src/components/array-base/components/addition.d.ts
|
|
5
|
-
interface IArrayBaseAdditionProps extends
|
|
6
|
+
interface IArrayBaseAdditionProps extends ButtonProps {
|
|
6
7
|
title?: string;
|
|
7
8
|
method?: 'push' | 'unshift';
|
|
8
9
|
defaultValue?: any;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { ButtonProps } from "@pixpilot/shadcn-ui";
|
|
3
|
+
import "react/jsx-runtime";
|
|
3
4
|
|
|
4
5
|
//#region src/components/array-base/components/addition.d.ts
|
|
5
|
-
interface IArrayBaseAdditionProps extends
|
|
6
|
+
interface IArrayBaseAdditionProps extends ButtonProps {
|
|
6
7
|
title?: string;
|
|
7
8
|
method?: 'push' | 'unshift';
|
|
8
9
|
defaultValue?: any;
|
|
@@ -8,7 +8,7 @@ import { PlusIcon } from "lucide-react";
|
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
|
|
10
10
|
//#region src/components/array-base/components/addition.tsx
|
|
11
|
-
|
|
11
|
+
function ArrayAddition({ ref,...props }) {
|
|
12
12
|
const { fullWidth = true } = props;
|
|
13
13
|
const self = useField();
|
|
14
14
|
const array = useArray();
|
|
@@ -38,7 +38,7 @@ const ArrayAddition = React.forwardRef((props, ref) => {
|
|
|
38
38
|
},
|
|
39
39
|
children: [props.icon !== void 0 ? props.icon : /* @__PURE__ */ jsx(PlusIcon, { className: "mr-2 size-4" }), props.title ?? self.title ?? props.children ?? "Add Item"]
|
|
40
40
|
});
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
ArrayAddition.displayName = "ArrayAddition";
|
|
43
43
|
|
|
44
44
|
//#endregion
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
import { ArrayBaseComponents, ArrayOperationTypes } from "./components/types.cjs";
|
|
2
2
|
import { IArrayBaseContext } from "./array-context.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { ButtonProps } from "@pixpilot/shadcn-ui";
|
|
4
4
|
|
|
5
5
|
//#region src/components/array-base/types.d.ts
|
|
6
6
|
interface ArrayBaseMixins extends ArrayBaseComponents {
|
|
@@ -17,7 +17,7 @@ interface IArrayBaseProps {
|
|
|
17
17
|
onEdit?: (index: number) => void;
|
|
18
18
|
onCopy?: (index: number) => void;
|
|
19
19
|
}
|
|
20
|
-
interface IArrayBaseOperationProps extends
|
|
20
|
+
interface IArrayBaseOperationProps extends ButtonProps {
|
|
21
21
|
title?: string;
|
|
22
22
|
index?: number;
|
|
23
23
|
icon?: React.ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ArrayBaseComponents, ArrayOperationTypes } from "./components/types.js";
|
|
2
2
|
import { IArrayBaseContext } from "./array-context.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ButtonProps } from "@pixpilot/shadcn-ui";
|
|
4
4
|
|
|
5
5
|
//#region src/components/array-base/types.d.ts
|
|
6
6
|
interface ArrayBaseMixins extends ArrayBaseComponents {
|
|
@@ -17,7 +17,7 @@ interface IArrayBaseProps {
|
|
|
17
17
|
onEdit?: (index: number) => void;
|
|
18
18
|
onCopy?: (index: number) => void;
|
|
19
19
|
}
|
|
20
|
-
interface IArrayBaseOperationProps extends
|
|
20
|
+
interface IArrayBaseOperationProps extends ButtonProps {
|
|
21
21
|
title?: string;
|
|
22
22
|
index?: number;
|
|
23
23
|
icon?: React.ReactNode;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react1 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: react1.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_checkbox0.CheckboxProps & react1.RefAttributes<HTMLButtonElement>>, "ref"> & react1.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Checkbox };
|
|
@@ -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 };
|
|
@@ -7,6 +7,24 @@ interface FomFileUpload {
|
|
|
7
7
|
onUpload?: (files: File[], options: FileUploadProgressCallBacks) => void;
|
|
8
8
|
maxSize?: number;
|
|
9
9
|
}
|
|
10
|
+
interface FormConfigProps {
|
|
11
|
+
label?: {
|
|
12
|
+
useFieldNameAsLabel?: boolean;
|
|
13
|
+
};
|
|
14
|
+
iconPicker?: {
|
|
15
|
+
/**
|
|
16
|
+
* Icon providers - can be static providers or async loader functions
|
|
17
|
+
* Users can provide either IconProvider[] or AsyncIconProvider[]
|
|
18
|
+
*/
|
|
19
|
+
providers: IconProvider[];
|
|
20
|
+
/**
|
|
21
|
+
* Optional callback when providers are loaded
|
|
22
|
+
*/
|
|
23
|
+
onProvidersLoaded?: (providers: IconProvider[]) => void;
|
|
24
|
+
};
|
|
25
|
+
fileUpload?: FomFileUpload;
|
|
26
|
+
richTextEditor?: RichTextEditorProps;
|
|
27
|
+
}
|
|
10
28
|
interface FormContextStates extends FormSpace {
|
|
11
29
|
itemProps?: {
|
|
12
30
|
className?: string;
|
|
@@ -14,21 +32,7 @@ interface FormContextStates extends FormSpace {
|
|
|
14
32
|
objectContainerProps?: {
|
|
15
33
|
className?: string;
|
|
16
34
|
};
|
|
17
|
-
|
|
18
|
-
iconPicker?: {
|
|
19
|
-
/**
|
|
20
|
-
* Icon providers - can be static providers or async loader functions
|
|
21
|
-
* Users can provide either IconProvider[] or AsyncIconProvider[]
|
|
22
|
-
*/
|
|
23
|
-
providers: IconProvider[];
|
|
24
|
-
/**
|
|
25
|
-
* Optional callback when providers are loaded
|
|
26
|
-
*/
|
|
27
|
-
onProvidersLoaded?: (providers: IconProvider[]) => void;
|
|
28
|
-
};
|
|
29
|
-
fileUpload?: FomFileUpload;
|
|
30
|
-
richTextEditor?: RichTextEditorProps;
|
|
31
|
-
};
|
|
35
|
+
settings?: FormConfigProps;
|
|
32
36
|
}
|
|
33
37
|
//#endregion
|
|
34
|
-
export { FomFileUpload, FormContextStates };
|
|
38
|
+
export { FomFileUpload, FormConfigProps, FormContextStates };
|
|
@@ -7,6 +7,24 @@ interface FomFileUpload {
|
|
|
7
7
|
onUpload?: (files: File[], options: FileUploadProgressCallBacks) => void;
|
|
8
8
|
maxSize?: number;
|
|
9
9
|
}
|
|
10
|
+
interface FormConfigProps {
|
|
11
|
+
label?: {
|
|
12
|
+
useFieldNameAsLabel?: boolean;
|
|
13
|
+
};
|
|
14
|
+
iconPicker?: {
|
|
15
|
+
/**
|
|
16
|
+
* Icon providers - can be static providers or async loader functions
|
|
17
|
+
* Users can provide either IconProvider[] or AsyncIconProvider[]
|
|
18
|
+
*/
|
|
19
|
+
providers: IconProvider[];
|
|
20
|
+
/**
|
|
21
|
+
* Optional callback when providers are loaded
|
|
22
|
+
*/
|
|
23
|
+
onProvidersLoaded?: (providers: IconProvider[]) => void;
|
|
24
|
+
};
|
|
25
|
+
fileUpload?: FomFileUpload;
|
|
26
|
+
richTextEditor?: RichTextEditorProps;
|
|
27
|
+
}
|
|
10
28
|
interface FormContextStates extends FormSpace {
|
|
11
29
|
itemProps?: {
|
|
12
30
|
className?: string;
|
|
@@ -14,21 +32,7 @@ interface FormContextStates extends FormSpace {
|
|
|
14
32
|
objectContainerProps?: {
|
|
15
33
|
className?: string;
|
|
16
34
|
};
|
|
17
|
-
|
|
18
|
-
iconPicker?: {
|
|
19
|
-
/**
|
|
20
|
-
* Icon providers - can be static providers or async loader functions
|
|
21
|
-
* Users can provide either IconProvider[] or AsyncIconProvider[]
|
|
22
|
-
*/
|
|
23
|
-
providers: IconProvider[];
|
|
24
|
-
/**
|
|
25
|
-
* Optional callback when providers are loaded
|
|
26
|
-
*/
|
|
27
|
-
onProvidersLoaded?: (providers: IconProvider[]) => void;
|
|
28
|
-
};
|
|
29
|
-
fileUpload?: FomFileUpload;
|
|
30
|
-
richTextEditor?: RichTextEditorProps;
|
|
31
|
-
};
|
|
35
|
+
settings?: FormConfigProps;
|
|
32
36
|
}
|
|
33
37
|
//#endregion
|
|
34
|
-
export { FomFileUpload, FormContextStates };
|
|
38
|
+
export { FomFileUpload, FormConfigProps, FormContextStates };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FomFileUpload, FormContextStates } from "./form-context.cjs";
|
|
1
|
+
import { FomFileUpload, FormConfigProps, FormContextStates } 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 } from "./form-context.js";
|
|
2
2
|
import "./context.js";
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as react0 from "react";
|
|
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: react0.ForwardRefExoticComponent<Partial<{
|
|
6
6
|
value?: Date;
|
|
7
7
|
onChange?: (date: Date | undefined) => void;
|
|
8
8
|
placeholder?: string;
|
|
9
|
-
} & Omit<
|
|
10
|
-
value?: Date;
|
|
11
|
-
onChange?: (date: Date | undefined) => void;
|
|
12
|
-
placeholder?: string;
|
|
13
|
-
} & Omit<react_day_picker0.DayPickerProps & {
|
|
14
|
-
buttonVariant?: React.ComponentProps<typeof void 0>["variant"];
|
|
15
|
-
}, "onSelect" | "selected" | "mode">, "onSelect" | "selected" | "mode">> & react2.RefAttributes<unknown>>;
|
|
9
|
+
} & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> & react0.RefAttributes<unknown>>;
|
|
16
10
|
//#endregion
|
|
17
11
|
export { DatePicker };
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as react2 from "react";
|
|
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$1: react2.ForwardRefExoticComponent<Partial<{
|
|
6
6
|
value?: Date;
|
|
7
7
|
onChange?: (date: Date | undefined) => void;
|
|
8
8
|
placeholder?: string;
|
|
9
|
-
} & Omit<
|
|
10
|
-
value?: Date;
|
|
11
|
-
onChange?: (date: Date | undefined) => void;
|
|
12
|
-
placeholder?: string;
|
|
13
|
-
} & Omit<react_day_picker0.DayPickerProps & {
|
|
14
|
-
buttonVariant?: React.ComponentProps<typeof void 0>["variant"];
|
|
15
|
-
}, "onSelect" | "selected" | "mode">, "onSelect" | "selected" | "mode">> & react6.RefAttributes<unknown>>;
|
|
9
|
+
} & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> & react2.RefAttributes<unknown>>;
|
|
16
10
|
//#endregion
|
|
17
|
-
export { DatePicker };
|
|
11
|
+
export { DatePicker$1 as DatePicker };
|
|
@@ -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-inline.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 FileUploadInline: React.ForwardRefExoticComponent<(Omit<Partial<
|
|
10
|
+
declare const FileUploadInline: 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 { 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.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 FileUpload: React.ForwardRefExoticComponent<(Omit<Partial<
|
|
10
|
+
declare const FileUpload: 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 { 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.");
|
|
@@ -12,11 +12,8 @@ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
|
12
12
|
//#region src/components/form-items-container.tsx
|
|
13
13
|
const FormItemContainer = (props) => {
|
|
14
14
|
const { as: Component = "div", className,...rest } = props;
|
|
15
|
-
const { density
|
|
16
|
-
const spaceClass = require_resolve_responsive_space.resolveResponsiveSpaceClass({
|
|
17
|
-
density,
|
|
18
|
-
responsive
|
|
19
|
-
});
|
|
15
|
+
const { density } = require_use_form_context.useFormContext();
|
|
16
|
+
const spaceClass = require_resolve_responsive_space.resolveResponsiveSpaceClass({ density });
|
|
20
17
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
21
18
|
...rest,
|
|
22
19
|
className: (0, __pixpilot_shadcn.cn)(spaceClass, className)
|
|
@@ -8,11 +8,8 @@ import { cn } from "@pixpilot/shadcn";
|
|
|
8
8
|
//#region src/components/form-items-container.tsx
|
|
9
9
|
const FormItemContainer = (props) => {
|
|
10
10
|
const { as: Component = "div", className,...rest } = props;
|
|
11
|
-
const { density
|
|
12
|
-
const spaceClass = resolveResponsiveSpaceClass({
|
|
13
|
-
density,
|
|
14
|
-
responsive
|
|
15
|
-
});
|
|
11
|
+
const { density } = useFormContext();
|
|
12
|
+
const spaceClass = resolveResponsiveSpaceClass({ density });
|
|
16
13
|
return /* @__PURE__ */ jsx(Component, {
|
|
17
14
|
...rest,
|
|
18
15
|
className: cn(spaceClass, className)
|
package/dist/components/form.cjs
CHANGED
|
@@ -15,7 +15,7 @@ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
|
15
15
|
/**
|
|
16
16
|
* Form component - wraps FormProvider and provides form context
|
|
17
17
|
*/
|
|
18
|
-
function Form({ form, className, style, children, onSubmit, onAutoSubmit, itemProps, objectContainerProps, density,
|
|
18
|
+
function Form({ form, className, style, children, onSubmit, onAutoSubmit, itemProps, objectContainerProps, density, settings }) {
|
|
19
19
|
const handleSubmit = (e) => {
|
|
20
20
|
e.preventDefault();
|
|
21
21
|
form.submit((values) => {
|
|
@@ -29,15 +29,13 @@ function Form({ form, className, style, children, onSubmit, onAutoSubmit, itemPr
|
|
|
29
29
|
itemProps,
|
|
30
30
|
objectContainerProps,
|
|
31
31
|
density,
|
|
32
|
-
|
|
33
|
-
config
|
|
32
|
+
settings
|
|
34
33
|
};
|
|
35
34
|
}, [
|
|
36
35
|
itemProps,
|
|
37
36
|
objectContainerProps,
|
|
38
37
|
density,
|
|
39
|
-
|
|
40
|
-
config
|
|
38
|
+
settings
|
|
41
39
|
]),
|
|
42
40
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__formily_react.FormProvider, {
|
|
43
41
|
form,
|
package/dist/components/form.js
CHANGED
|
@@ -10,7 +10,7 @@ import { cn } from "@pixpilot/shadcn";
|
|
|
10
10
|
/**
|
|
11
11
|
* Form component - wraps FormProvider and provides form context
|
|
12
12
|
*/
|
|
13
|
-
function Form({ form, className, style, children, onSubmit, onAutoSubmit, itemProps, objectContainerProps, density,
|
|
13
|
+
function Form({ form, className, style, children, onSubmit, onAutoSubmit, itemProps, objectContainerProps, density, settings }) {
|
|
14
14
|
const handleSubmit = (e) => {
|
|
15
15
|
e.preventDefault();
|
|
16
16
|
form.submit((values) => {
|
|
@@ -24,15 +24,13 @@ function Form({ form, className, style, children, onSubmit, onAutoSubmit, itemPr
|
|
|
24
24
|
itemProps,
|
|
25
25
|
objectContainerProps,
|
|
26
26
|
density,
|
|
27
|
-
|
|
28
|
-
config
|
|
27
|
+
settings
|
|
29
28
|
};
|
|
30
29
|
}, [
|
|
31
30
|
itemProps,
|
|
32
31
|
objectContainerProps,
|
|
33
32
|
density,
|
|
34
|
-
|
|
35
|
-
config
|
|
33
|
+
settings
|
|
36
34
|
]),
|
|
37
35
|
children: /* @__PURE__ */ jsx(FormProvider, {
|
|
38
36
|
form,
|
|
@@ -11,8 +11,8 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
|
11
11
|
//#region src/components/icon-picker.tsx
|
|
12
12
|
const IconPickerBase = (props) => {
|
|
13
13
|
const { providers: propProviders,...restProps } = props;
|
|
14
|
-
const {
|
|
15
|
-
const { iconPicker } =
|
|
14
|
+
const { settings } = require_use_form_context.useFormContext();
|
|
15
|
+
const { iconPicker } = settings || {};
|
|
16
16
|
const { providers: contextProviders = [] } = iconPicker || {};
|
|
17
17
|
const providersToLoad = propProviders !== void 0 ? propProviders : contextProviders;
|
|
18
18
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn_ui.IconPicker, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react4 from "react";
|
|
2
2
|
import { IconPickerProps, IconProviderProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/icon-picker.d.ts
|
|
@@ -8,8 +8,8 @@ import { IconPickerProps, IconProviderProps } from "@pixpilot/shadcn-ui";
|
|
|
8
8
|
* Automatically connects to Formily field state
|
|
9
9
|
* Supports both static and async icon providers
|
|
10
10
|
*/
|
|
11
|
-
declare const IconPicker$1:
|
|
11
|
+
declare const IconPicker$1: react4.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
|
|
12
12
|
providers?: IconProviderProps[];
|
|
13
|
-
}> &
|
|
13
|
+
}> & react4.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { IconPicker$1 as IconPicker };
|
|
@@ -7,8 +7,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
7
7
|
//#region src/components/icon-picker.tsx
|
|
8
8
|
const IconPickerBase = (props) => {
|
|
9
9
|
const { providers: propProviders,...restProps } = props;
|
|
10
|
-
const {
|
|
11
|
-
const { iconPicker } =
|
|
10
|
+
const { settings } = useFormContext();
|
|
11
|
+
const { iconPicker } = settings || {};
|
|
12
12
|
const { providers: contextProviders = [] } = iconPicker || {};
|
|
13
13
|
const providersToLoad = propProviders !== void 0 ? propProviders : contextProviders;
|
|
14
14
|
return /* @__PURE__ */ jsx(IconPicker, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react10 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/input.d.ts
|
|
4
4
|
|
|
@@ -6,6 +6,6 @@ import * as react6 from "react";
|
|
|
6
6
|
* Formily-connected Input component
|
|
7
7
|
* Automatically connects shadcn Input to Formily field state
|
|
8
8
|
*/
|
|
9
|
-
declare const Input:
|
|
9
|
+
declare const Input: react10.ForwardRefExoticComponent<Omit<Partial<react10.ClassAttributes<HTMLInputElement> & react10.InputHTMLAttributes<HTMLInputElement>>, "ref"> & react10.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Input };
|