@pixpilot/formily-shadcn 1.10.7 → 1.10.9

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.
Files changed (45) hide show
  1. package/dist/components/Checkbox.d.ts +2 -2
  2. package/dist/components/DatePicker.d.ts +3 -3
  3. package/dist/components/IconPicker.d.cts +3 -3
  4. package/dist/components/IconPicker.d.ts +3 -3
  5. package/dist/components/IconToggle.d.cts +2 -2
  6. package/dist/components/IconToggle.d.ts +2 -2
  7. package/dist/components/Radio.d.ts +2 -2
  8. package/dist/components/Row.d.ts +2 -2
  9. package/dist/components/Separator.d.ts +2 -2
  10. package/dist/components/Switch.d.cts +2 -2
  11. package/dist/components/Switch.d.ts +2 -2
  12. package/dist/components/TagsInputInline.d.cts +2 -2
  13. package/dist/components/TagsInputInline.d.ts +2 -2
  14. package/dist/components/Textarea.d.cts +2 -2
  15. package/dist/components/Textarea.d.ts +2 -2
  16. package/dist/components/array-tags/ArrayTags.d.cts +2 -2
  17. package/dist/components/context/types.d.cts +3 -1
  18. package/dist/components/context/types.d.ts +3 -1
  19. package/dist/components/file-upload/index.cjs +2 -0
  20. package/dist/components/file-upload/index.d.cts +6 -3
  21. package/dist/components/file-upload/index.d.ts +6 -4
  22. package/dist/components/file-upload/index.js +2 -0
  23. package/dist/components/file-upload/map-upload-props.d.cts +43 -2
  24. package/dist/components/file-upload/map-upload-props.d.ts +43 -2
  25. package/dist/components/file-upload/types.d.cts +10 -0
  26. package/dist/components/file-upload/types.d.ts +10 -0
  27. package/dist/components/file-upload/use-file-upload-feedback.cjs +3 -1
  28. package/dist/components/file-upload/use-file-upload-feedback.d.cts +14 -0
  29. package/dist/components/file-upload/use-file-upload-feedback.d.ts +14 -0
  30. package/dist/components/file-upload/use-file-upload-feedback.js +3 -1
  31. package/dist/components/form-item/ConnectedFormItem.d.cts +4 -4
  32. package/dist/components/number/NumberInput.d.cts +3 -3
  33. package/dist/components/schema-field/schema-field-basics.d.cts +303 -303
  34. package/dist/components/schema-field/schema-field-basics.d.ts +303 -303
  35. package/dist/components/schema-field/schema-field-extended.d.cts +501 -501
  36. package/dist/components/schema-field/schema-field.d.cts +412 -412
  37. package/dist/components/schema-field/schema-field.d.ts +413 -413
  38. package/dist/components/slider/SliderSelect.d.cts +3 -3
  39. package/dist/index.cjs +5 -1
  40. package/dist/index.d.cts +6 -3
  41. package/dist/index.d.ts +6 -3
  42. package/dist/index.js +3 -1
  43. package/dist/utils/resolve-field-options.d.cts +1 -1
  44. package/dist/utils/resolve-field-options.d.ts +1 -1
  45. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import * as react1 from "react";
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: react1.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_checkbox0.CheckboxProps & react1.RefAttributes<HTMLButtonElement>>, "ref"> & react1.RefAttributes<unknown>>;
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,11 +1,11 @@
1
- import * as react4 from "react";
1
+ import * as react2 from "react";
2
2
  import { DatePickerProps } from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/DatePicker.d.ts
5
- declare const DatePicker$1: react4.ForwardRefExoticComponent<Partial<{
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">> & react4.RefAttributes<unknown>>;
9
+ } & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> & react2.RefAttributes<unknown>>;
10
10
  //#endregion
11
11
  export { DatePicker$1 as DatePicker };
@@ -1,4 +1,4 @@
1
- import * as react7 from "react";
1
+ import * as react4 from "react";
2
2
  import { IconPickerProps, IconProviderProps } from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/IconPicker.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: react7.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
11
+ declare const IconPicker: react4.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
12
12
  providers?: IconProviderProps[];
13
- }> & react7.RefAttributes<unknown>>;
13
+ }> & react4.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { IconPicker };
@@ -1,4 +1,4 @@
1
- import * as react0 from "react";
1
+ import * as react7 from "react";
2
2
  import { IconPickerProps, IconProviderProps } from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/IconPicker.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: react0.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
11
+ declare const IconPicker$1: react7.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
12
12
  providers?: IconProviderProps[];
13
- }> & react0.RefAttributes<unknown>>;
13
+ }> & react7.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { IconPicker$1 as IconPicker };
@@ -1,4 +1,4 @@
1
- import * as react4 from "react";
1
+ import * as react6 from "react";
2
2
  import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/IconToggle.d.ts
@@ -6,6 +6,6 @@ import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
6
6
  * Formily-connected IconToggle component
7
7
  * Toggle button with customizable icons for boolean values
8
8
  */
9
- declare const IconToggle: react4.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui0.IconToggleProps, "ref"> & react4.RefAttributes<HTMLButtonElement>>, "ref"> & react4.RefAttributes<unknown>>;
9
+ declare const IconToggle: react6.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui0.IconToggleProps, "ref"> & react6.RefAttributes<HTMLButtonElement>>, "ref"> & react6.RefAttributes<unknown>>;
10
10
  //#endregion
11
11
  export { IconToggle };
@@ -1,4 +1,4 @@
1
- import * as react6 from "react";
1
+ import * as react4 from "react";
2
2
  import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/IconToggle.d.ts
@@ -6,6 +6,6 @@ import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
6
6
  * Formily-connected IconToggle component
7
7
  * Toggle button with customizable icons for boolean values
8
8
  */
9
- declare const IconToggle$1: react6.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui0.IconToggleProps, "ref"> & react6.RefAttributes<HTMLButtonElement>>, "ref"> & react6.RefAttributes<unknown>>;
9
+ declare const IconToggle$1: react4.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui0.IconToggleProps, "ref"> & react4.RefAttributes<HTMLButtonElement>>, "ref"> & react4.RefAttributes<unknown>>;
10
10
  //#endregion
11
11
  export { IconToggle$1 as IconToggle };
@@ -1,5 +1,5 @@
1
1
  import { FC } from "react";
2
- import * as react_jsx_runtime3 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
3
3
  import { RadioGroup } from "@pixpilot/shadcn";
4
4
 
5
5
  //#region src/components/Radio.d.ts
@@ -15,7 +15,7 @@ type RadioProps = {
15
15
  /**
16
16
  * Radio component with options rendering
17
17
  */
18
- declare function Radio(props: RadioProps): react_jsx_runtime3.JSX.Element;
18
+ declare function Radio(props: RadioProps): react_jsx_runtime2.JSX.Element;
19
19
  declare namespace Radio {
20
20
  var displayName: string;
21
21
  }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as react_jsx_runtime2 from "react/jsx-runtime";
2
+ import * as react_jsx_runtime3 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/components/Row.d.ts
5
5
  interface IRowProps {
@@ -36,6 +36,6 @@ interface IRowProps {
36
36
  declare function Row({
37
37
  className,
38
38
  children
39
- }: IRowProps): react_jsx_runtime2.JSX.Element;
39
+ }: IRowProps): react_jsx_runtime3.JSX.Element;
40
40
  //#endregion
41
41
  export { Row };
@@ -1,4 +1,4 @@
1
- import * as react19 from "react";
1
+ import * as react16 from "react";
2
2
  import * as _radix_ui_react_separator0 from "@radix-ui/react-separator";
3
3
 
4
4
  //#region src/components/Separator.d.ts
@@ -6,6 +6,6 @@ import * as _radix_ui_react_separator0 from "@radix-ui/react-separator";
6
6
  * Formily-connected Separator component
7
7
  * A visual divider for content sections
8
8
  */
9
- declare const Separator: react19.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_separator0.SeparatorProps & react19.RefAttributes<HTMLDivElement>>, "ref"> & react19.RefAttributes<unknown>>;
9
+ declare const Separator: react16.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_separator0.SeparatorProps & react16.RefAttributes<HTMLDivElement>>, "ref"> & react16.RefAttributes<unknown>>;
10
10
  //#endregion
11
11
  export { Separator };
@@ -1,4 +1,4 @@
1
- import * as react19 from "react";
1
+ import * as react23 from "react";
2
2
  import * as _radix_ui_react_switch0 from "@radix-ui/react-switch";
3
3
 
4
4
  //#region src/components/Switch.d.ts
@@ -6,6 +6,6 @@ import * as _radix_ui_react_switch0 from "@radix-ui/react-switch";
6
6
  * Formily-connected Switch component
7
7
  * Toggle switch for boolean values
8
8
  */
9
- declare const Switch: react19.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react19.RefAttributes<HTMLButtonElement>>, "ref"> & react19.RefAttributes<unknown>>;
9
+ declare const Switch: react23.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react23.RefAttributes<HTMLButtonElement>>, "ref"> & react23.RefAttributes<unknown>>;
10
10
  //#endregion
11
11
  export { Switch };
@@ -1,4 +1,4 @@
1
- import * as react16 from "react";
1
+ import * as react19 from "react";
2
2
  import * as _radix_ui_react_switch0 from "@radix-ui/react-switch";
3
3
 
4
4
  //#region src/components/Switch.d.ts
@@ -6,6 +6,6 @@ import * as _radix_ui_react_switch0 from "@radix-ui/react-switch";
6
6
  * Formily-connected Switch component
7
7
  * Toggle switch for boolean values
8
8
  */
9
- declare const Switch: react16.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react16.RefAttributes<HTMLButtonElement>>, "ref"> & react16.RefAttributes<unknown>>;
9
+ declare const Switch: react19.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react19.RefAttributes<HTMLButtonElement>>, "ref"> & react19.RefAttributes<unknown>>;
10
10
  //#endregion
11
11
  export { Switch };
@@ -1,4 +1,4 @@
1
- import * as react22 from "react";
1
+ import * as react26 from "react";
2
2
  import * as _pixpilot_shadcn_ui1 from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/TagsInputInline.d.ts
@@ -10,6 +10,6 @@ import * as _pixpilot_shadcn_ui1 from "@pixpilot/shadcn-ui";
10
10
  * Based on DiceUI's tags-input for inline tag editing with keyboard navigation
11
11
  * and validation support.
12
12
  */
13
- declare const TagsInputInLine: react22.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui1.TagsInputProps> & react22.RefAttributes<unknown>>;
13
+ declare const TagsInputInLine: react26.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui1.TagsInputProps> & react26.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { TagsInputInLine };
@@ -1,4 +1,4 @@
1
- import * as react26 from "react";
1
+ import * as react22 from "react";
2
2
  import * as _pixpilot_shadcn_ui1 from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/TagsInputInline.d.ts
@@ -10,6 +10,6 @@ import * as _pixpilot_shadcn_ui1 from "@pixpilot/shadcn-ui";
10
10
  * Based on DiceUI's tags-input for inline tag editing with keyboard navigation
11
11
  * and validation support.
12
12
  */
13
- declare const TagsInputInLine: react26.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui1.TagsInputProps> & react26.RefAttributes<unknown>>;
13
+ declare const TagsInputInLine: react22.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui1.TagsInputProps> & react22.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { TagsInputInLine };
@@ -1,9 +1,9 @@
1
- import * as react24 from "react";
1
+ import * as react19 from "react";
2
2
 
3
3
  //#region src/components/Textarea.d.ts
4
4
  /**
5
5
  * Formily-connected Textarea component
6
6
  */
7
- declare const Textarea: react24.ForwardRefExoticComponent<Omit<Partial<react24.ClassAttributes<HTMLTextAreaElement> & react24.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react24.RefAttributes<unknown>>;
7
+ declare const Textarea: react19.ForwardRefExoticComponent<Omit<Partial<react19.ClassAttributes<HTMLTextAreaElement> & react19.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react19.RefAttributes<unknown>>;
8
8
  //#endregion
9
9
  export { Textarea };
@@ -1,9 +1,9 @@
1
- import * as react22 from "react";
1
+ import * as react24 from "react";
2
2
 
3
3
  //#region src/components/Textarea.d.ts
4
4
  /**
5
5
  * Formily-connected Textarea component
6
6
  */
7
- declare const Textarea: react22.ForwardRefExoticComponent<Omit<Partial<react22.ClassAttributes<HTMLTextAreaElement> & react22.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react22.RefAttributes<unknown>>;
7
+ declare const Textarea: react24.ForwardRefExoticComponent<Omit<Partial<react24.ClassAttributes<HTMLTextAreaElement> & react24.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react24.RefAttributes<unknown>>;
8
8
  //#endregion
9
9
  export { Textarea };
@@ -1,4 +1,4 @@
1
- import * as _formily_react102 from "@formily/react";
1
+ import * as _formily_react0 from "@formily/react";
2
2
  import React from "react";
3
3
  import { TagsInputProps } from "@pixpilot/shadcn-ui";
4
4
 
@@ -54,6 +54,6 @@ interface ArrayTagsProps extends TagsInputProps {
54
54
  * };
55
55
  * ```
56
56
  */
57
- declare const ArrayTags: React.MemoExoticComponent<_formily_react102.ReactFC<ArrayTagsProps>>;
57
+ declare const ArrayTags: React.MemoExoticComponent<_formily_react0.ReactFC<ArrayTagsProps>>;
58
58
  //#endregion
59
59
  export { ArrayTags, ArrayTagsProps };
@@ -2,7 +2,9 @@ import { ActionItem } from "../array-base/types.cjs";
2
2
  import "../array-base/index.cjs";
3
3
  import { FormSpace } from "../../types/form.cjs";
4
4
  import { DescriptionPlacement, LabelPlacement } from "../../types/form-item.cjs";
5
- import { DialogContentProps, FormFileUploadOptions, IconProvider, PopoverContentProps, RichTextEditorProps } from "@pixpilot/shadcn-ui";
5
+ import { FormFileUploadOptions } from "../file-upload/types.cjs";
6
+ import "../file-upload/index.cjs";
7
+ import { DialogContentProps, IconProvider, PopoverContentProps, RichTextEditorProps } from "@pixpilot/shadcn-ui";
6
8
 
7
9
  //#region src/components/context/types.d.ts
8
10
  interface FomFileUpload {
@@ -2,7 +2,9 @@ import { ActionItem } from "../array-base/types.js";
2
2
  import "../array-base/index.js";
3
3
  import { FormSpace } from "../../types/form.js";
4
4
  import { DescriptionPlacement, LabelPlacement } from "../../types/form-item.js";
5
- import { DialogContentProps, FormFileUploadOptions, IconProvider, PopoverContentProps, RichTextEditorProps } from "@pixpilot/shadcn-ui";
5
+ import { FormFileUploadOptions } from "../file-upload/types.js";
6
+ import "../file-upload/index.js";
7
+ import { DialogContentProps, IconProvider, PopoverContentProps, RichTextEditorProps } from "@pixpilot/shadcn-ui";
6
8
 
7
9
  //#region src/components/context/types.d.ts
8
10
  interface FomFileUpload {
@@ -1,3 +1,5 @@
1
+ const require_map_upload_props = require('./map-upload-props.cjs');
2
+ const require_use_file_upload_feedback = require('./use-file-upload-feedback.cjs');
1
3
  const require_AvatarUpload = require('./AvatarUpload.cjs');
2
4
  const require_FileUpload = require('./FileUpload.cjs');
3
5
  const require_FileUploadInline = require('./FileUploadInline.cjs');
@@ -1,3 +1,6 @@
1
- import { AvatarUpload, AvatarUploadProps as AvatarUploadProps$1 } from "./AvatarUpload.cjs";
2
- import { FileUpload, FileUploadProps as FileUploadProps$1 } from "./FileUpload.cjs";
3
- import { FileUploadInline, FileUploadInlineProps as FileUploadInlineProps$1 } from "./FileUploadInline.cjs";
1
+ import { FormilyUploadProps, UploadFieldCallbacks, UploadValueMapper, mapUploadProps } from "./map-upload-props.cjs";
2
+ import { AvatarUpload, AvatarUploadProps } from "./AvatarUpload.cjs";
3
+ import { FileUpload, FileUploadProps } from "./FileUpload.cjs";
4
+ import { FileUploadInline, FileUploadInlineProps } from "./FileUploadInline.cjs";
5
+ import { FormFileUploadOptions } from "./types.cjs";
6
+ import { useFileUploadFeedback } from "./use-file-upload-feedback.cjs";
@@ -1,4 +1,6 @@
1
- import { AvatarUpload as AvatarUpload$1, AvatarUploadProps as AvatarUploadProps$1 } from "./AvatarUpload.js";
2
- import { FileUpload as FileUpload$1, FileUploadProps as FileUploadProps$1 } from "./FileUpload.js";
3
- import { FileUploadInline as FileUploadInline$1, FileUploadInlineProps as FileUploadInlineProps$1 } from "./FileUploadInline.js";
4
- import "@pixpilot/shadcn-ui";
1
+ import { FormilyUploadProps, UploadFieldCallbacks, UploadValueMapper, mapUploadProps } from "./map-upload-props.js";
2
+ import { AvatarUpload, AvatarUploadProps } from "./AvatarUpload.js";
3
+ import { FileUpload, FileUploadProps } from "./FileUpload.js";
4
+ import { FileUploadInline, FileUploadInlineProps } from "./FileUploadInline.js";
5
+ import { FormFileUploadOptions } from "./types.js";
6
+ import { useFileUploadFeedback } from "./use-file-upload-feedback.js";
@@ -1,3 +1,5 @@
1
+ import { mapUploadProps } from "./map-upload-props.js";
2
+ import { useFileUploadFeedback } from "./use-file-upload-feedback.js";
1
3
  import { AvatarUpload } from "./AvatarUpload.js";
2
4
  import { FileUpload } from "./FileUpload.js";
3
5
  import { FileUploadInline } from "./FileUploadInline.js";
@@ -1,4 +1,4 @@
1
- import "@formily/core";
1
+ import { Field } from "@formily/core";
2
2
  import { FileMetadata } from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/file-upload/map-upload-props.d.ts
@@ -12,5 +12,46 @@ interface UploadValueMapper<TValue$1 extends SingleFileUploadValue = SingleFileU
12
12
  type FormilyUploadProps<P> = P extends {
13
13
  multiple: true;
14
14
  } ? P : P & UploadValueMapper<ExtractSingleFileValue<P>>;
15
+ /**
16
+ * Callbacks that the shadcn upload components expose at the single-file level.
17
+ * `FileUploadProps`, `AvatarUploadProps` and `FileUploadInlineProps` all carry
18
+ * these when used in single-file mode.
19
+ */
20
+ interface UploadFieldCallbacks<TValue$1 extends SingleFileUploadValue = SingleFileUploadValue> extends UploadValueMapper<TValue$1> {
21
+ onFileSuccess?: (fileMeta: FileMetadata) => void;
22
+ onFileError?: (file: File, error: string) => void;
23
+ }
24
+ interface MapUploadPropsOptions {
25
+ forceSingle?: boolean;
26
+ }
27
+ /**
28
+ * Shared `mapProps` mapper for all Formily-connected upload components.
29
+ *
30
+ * - Forwards `field.value` (defaulting to `null`) as the `value` prop so the
31
+ * component displays the currently stored file metadata.
32
+ * - Applies `mapValue` to the field value before forwarding it so callers can
33
+ * derive a display-ready file object without mutating the stored form value.
34
+ * - Provides a guarded `onChange` that only writes to the field on deletions
35
+ * (value becomes `null` for single-file, or the array shrinks for
36
+ * multi-file). New-file accepts fire `onChange` before the upload
37
+ * completes with incomplete metadata (no `url`), so those calls are
38
+ * intentionally ignored here — `onFileSuccess` handles the final write
39
+ * once the upload finishes.
40
+ * - Wraps `onFileSuccess` so that `field.setValue(fileMeta)` is called only
41
+ * after a successful upload, followed by the original `onFileSuccess`
42
+ * callback if one was supplied. When the field value is an array (multiple
43
+ * mode), the new file is appended to the existing array rather than
44
+ * replacing it.
45
+ * - Wraps `onFileError` so that `field.setFeedback({ type: 'error', … })` is
46
+ * set on upload failure, followed by the original `onFileError` callback if
47
+ * one was supplied.
48
+ *
49
+ * The generic `P extends object` constraint keeps the return type identical to
50
+ * the input type so that the mapper satisfies Formily's `IStateMapper<T>`.
51
+ * Internally the props are cast to `UploadFieldCallbacks` to access the
52
+ * upload-specific callbacks; both single-file and multiple-file modes share
53
+ * the same `onFileSuccess`/`onFileError` callbacks that fire per file.
54
+ */
55
+ declare function mapUploadProps<P extends object>(props: P, field: Field, options?: MapUploadPropsOptions): P;
15
56
  //#endregion
16
- export { FormilyUploadProps, UploadValueMapper };
57
+ export { FormilyUploadProps, UploadFieldCallbacks, UploadValueMapper, mapUploadProps };
@@ -1,5 +1,5 @@
1
1
  import { FileMetadata } from "@pixpilot/shadcn-ui";
2
- import "@formily/core";
2
+ import { Field } from "@formily/core";
3
3
 
4
4
  //#region src/components/file-upload/map-upload-props.d.ts
5
5
  type SingleFileUploadValue = FileMetadata | null;
@@ -12,5 +12,46 @@ interface UploadValueMapper<TValue$1 extends SingleFileUploadValue = SingleFileU
12
12
  type FormilyUploadProps<P> = P extends {
13
13
  multiple: true;
14
14
  } ? P : P & UploadValueMapper<ExtractSingleFileValue<P>>;
15
+ /**
16
+ * Callbacks that the shadcn upload components expose at the single-file level.
17
+ * `FileUploadProps`, `AvatarUploadProps` and `FileUploadInlineProps` all carry
18
+ * these when used in single-file mode.
19
+ */
20
+ interface UploadFieldCallbacks<TValue$1 extends SingleFileUploadValue = SingleFileUploadValue> extends UploadValueMapper<TValue$1> {
21
+ onFileSuccess?: (fileMeta: FileMetadata) => void;
22
+ onFileError?: (file: File, error: string) => void;
23
+ }
24
+ interface MapUploadPropsOptions {
25
+ forceSingle?: boolean;
26
+ }
27
+ /**
28
+ * Shared `mapProps` mapper for all Formily-connected upload components.
29
+ *
30
+ * - Forwards `field.value` (defaulting to `null`) as the `value` prop so the
31
+ * component displays the currently stored file metadata.
32
+ * - Applies `mapValue` to the field value before forwarding it so callers can
33
+ * derive a display-ready file object without mutating the stored form value.
34
+ * - Provides a guarded `onChange` that only writes to the field on deletions
35
+ * (value becomes `null` for single-file, or the array shrinks for
36
+ * multi-file). New-file accepts fire `onChange` before the upload
37
+ * completes with incomplete metadata (no `url`), so those calls are
38
+ * intentionally ignored here — `onFileSuccess` handles the final write
39
+ * once the upload finishes.
40
+ * - Wraps `onFileSuccess` so that `field.setValue(fileMeta)` is called only
41
+ * after a successful upload, followed by the original `onFileSuccess`
42
+ * callback if one was supplied. When the field value is an array (multiple
43
+ * mode), the new file is appended to the existing array rather than
44
+ * replacing it.
45
+ * - Wraps `onFileError` so that `field.setFeedback({ type: 'error', … })` is
46
+ * set on upload failure, followed by the original `onFileError` callback if
47
+ * one was supplied.
48
+ *
49
+ * The generic `P extends object` constraint keeps the return type identical to
50
+ * the input type so that the mapper satisfies Formily's `IStateMapper<T>`.
51
+ * Internally the props are cast to `UploadFieldCallbacks` to access the
52
+ * upload-specific callbacks; both single-file and multiple-file modes share
53
+ * the same `onFileSuccess`/`onFileError` callbacks that fire per file.
54
+ */
55
+ declare function mapUploadProps<P extends object>(props: P, field: Field, options?: MapUploadPropsOptions): P;
15
56
  //#endregion
16
- export { FormilyUploadProps, UploadValueMapper };
57
+ export { FormilyUploadProps, UploadFieldCallbacks, UploadValueMapper, mapUploadProps };
@@ -0,0 +1,10 @@
1
+ import { FileUploadProgressCallBacks } from "@pixpilot/shadcn-ui";
2
+
3
+ //#region src/components/file-upload/types.d.ts
4
+ interface FormFileUploadOptions extends FileUploadProgressCallBacks {
5
+ component: string;
6
+ componentProps: Record<string, any>;
7
+ path: string;
8
+ }
9
+ //#endregion
10
+ export { FormFileUploadOptions };
@@ -0,0 +1,10 @@
1
+ import { FileUploadProgressCallBacks } from "@pixpilot/shadcn-ui";
2
+
3
+ //#region src/components/file-upload/types.d.ts
4
+ interface FormFileUploadOptions extends FileUploadProgressCallBacks {
5
+ component: string;
6
+ componentProps: Record<string, any>;
7
+ path: string;
8
+ }
9
+ //#endregion
10
+ export { FormFileUploadOptions };
@@ -55,9 +55,11 @@ function useFileUploadFeedback(props) {
55
55
  return onUpload?.(files, {
56
56
  ...options,
57
57
  component: field.componentType,
58
- componentProps: { ...field.componentProps }
58
+ componentProps: { ...field.componentProps },
59
+ path: field.address.toString()
59
60
  });
60
61
  }, [
62
+ field.address,
61
63
  field.componentProps,
62
64
  field.componentType,
63
65
  onUpload,
@@ -0,0 +1,14 @@
1
+ import { FileUploadBaseProps } from "@pixpilot/shadcn-ui";
2
+
3
+ //#region src/components/file-upload/use-file-upload-feedback.d.ts
4
+ declare function useFileUploadFeedback(props: FileUploadBaseProps): {
5
+ onUpload: ((...args: any[]) => any) | undefined;
6
+ maxSize: number | undefined;
7
+ handleFilesRejection: (files: Array<{
8
+ file: File;
9
+ message: string;
10
+ }>) => void;
11
+ handleFileValidate: (file: File) => string | null | undefined;
12
+ };
13
+ //#endregion
14
+ export { useFileUploadFeedback };
@@ -0,0 +1,14 @@
1
+ import { FileUploadBaseProps } from "@pixpilot/shadcn-ui";
2
+
3
+ //#region src/components/file-upload/use-file-upload-feedback.d.ts
4
+ declare function useFileUploadFeedback(props: FileUploadBaseProps): {
5
+ onUpload: ((...args: any[]) => any) | undefined;
6
+ maxSize: number | undefined;
7
+ handleFilesRejection: (files: Array<{
8
+ file: File;
9
+ message: string;
10
+ }>) => void;
11
+ handleFileValidate: (file: File) => string | null | undefined;
12
+ };
13
+ //#endregion
14
+ export { useFileUploadFeedback };
@@ -49,9 +49,11 @@ function useFileUploadFeedback(props) {
49
49
  return onUpload?.(files, {
50
50
  ...options,
51
51
  component: field.componentType,
52
- componentProps: { ...field.componentProps }
52
+ componentProps: { ...field.componentProps },
53
+ path: field.address.toString()
53
54
  });
54
55
  }, [
56
+ field.address,
55
57
  field.componentProps,
56
58
  field.componentType,
57
59
  onUpload,
@@ -1,13 +1,13 @@
1
1
  import { FormItemProps } from "./form-item-types.cjs";
2
- import * as react1889 from "react";
2
+ import * as react1891 from "react";
3
3
 
4
4
  //#region src/components/form-item/ConnectedFormItem.d.ts
5
5
  /**
6
6
  * FormItem component connected to Formily field state.
7
7
  * Automatically maps field validation state to component props.
8
8
  */
9
- declare const FormItem: react1889.ForwardRefExoticComponent<Omit<Partial<FormItemProps & {
10
- children?: react1889.ReactNode | undefined;
11
- }>, "ref"> & react1889.RefAttributes<unknown>>;
9
+ declare const FormItem: react1891.ForwardRefExoticComponent<Omit<Partial<FormItemProps & {
10
+ children?: react1891.ReactNode | undefined;
11
+ }>, "ref"> & react1891.RefAttributes<unknown>>;
12
12
  //#endregion
13
13
  export { FormItem };
@@ -1,15 +1,15 @@
1
- import * as react33 from "react";
1
+ import * as react31 from "react";
2
2
 
3
3
  //#region src/components/number/NumberInput.d.ts
4
4
  /**
5
5
  * Formily-connected Number Input component
6
6
  */
7
- declare const NumberInput: react33.ForwardRefExoticComponent<Omit<Partial<react33.ClassAttributes<HTMLInputElement> & react33.InputHTMLAttributes<HTMLInputElement> & {
7
+ declare const NumberInput: react31.ForwardRefExoticComponent<Omit<Partial<react31.ClassAttributes<HTMLInputElement> & react31.InputHTMLAttributes<HTMLInputElement> & {
8
8
  prefix?: React.ReactNode;
9
9
  suffix?: React.ReactNode;
10
10
  groupClassName?: string;
11
11
  prefixClassName?: string;
12
12
  suffixClassName?: string;
13
- }>, "ref"> & react33.RefAttributes<unknown>>;
13
+ }>, "ref"> & react31.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { NumberInput };