@pixpilot/formily-shadcn 1.7.4 → 1.8.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.
Files changed (36) 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/Radio.d.ts +2 -2
  7. package/dist/components/Row.d.ts +2 -2
  8. package/dist/components/Separator.d.ts +2 -2
  9. package/dist/components/Switch.d.ts +2 -2
  10. package/dist/components/TagsInputInline.d.ts +2 -2
  11. package/dist/components/Textarea.d.ts +2 -2
  12. package/dist/components/file-upload/AvatarUpload.cjs +2 -6
  13. package/dist/components/file-upload/AvatarUpload.js +2 -6
  14. package/dist/components/file-upload/FileUpload.cjs +4 -8
  15. package/dist/components/file-upload/FileUpload.d.cts +10 -10
  16. package/dist/components/file-upload/FileUpload.d.ts +10 -10
  17. package/dist/components/file-upload/FileUpload.js +4 -8
  18. package/dist/components/file-upload/FileUploadInline.cjs +2 -6
  19. package/dist/components/file-upload/FileUploadInline.d.cts +8 -8
  20. package/dist/components/file-upload/FileUploadInline.d.ts +8 -8
  21. package/dist/components/file-upload/FileUploadInline.js +2 -6
  22. package/dist/components/file-upload/map-upload-props.cjs +46 -0
  23. package/dist/components/file-upload/map-upload-props.js +45 -0
  24. package/dist/components/schema-field/schema-field-basics.d.cts +303 -303
  25. package/dist/components/schema-field/schema-field-basics.d.ts +34 -34
  26. package/dist/components/schema-field/schema-field-extended.d.cts +298 -298
  27. package/dist/components/schema-field/schema-field-extended.d.ts +298 -298
  28. package/dist/components/schema-field/schema-field.d.cts +413 -413
  29. package/dist/components/schema-field/schema-field.d.ts +100 -100
  30. package/dist/components/slider/Slider.d.cts +3 -3
  31. package/dist/components/slider/Slider.d.ts +3 -3
  32. package/dist/components/slider/SliderInput.d.cts +2 -2
  33. package/dist/components/slider/SliderInput.d.ts +3 -3
  34. package/dist/components/slider/SliderSelect.d.cts +3 -3
  35. package/dist/components/slider/SliderSelect.d.ts +3 -3
  36. package/package.json +4 -4
@@ -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 react4 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: react4.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
11
+ declare const IconPicker: react7.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
12
12
  providers?: IconProviderProps[];
13
- }> & react4.RefAttributes<unknown>>;
13
+ }> & react7.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { IconPicker };
@@ -1,4 +1,4 @@
1
- import * as react0 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$1: react0.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
11
+ declare const IconPicker$1: react4.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
12
12
  providers?: IconProviderProps[];
13
- }> & react0.RefAttributes<unknown>>;
13
+ }> & react4.RefAttributes<unknown>>;
14
14
  //#endregion
15
15
  export { IconPicker$1 as IconPicker };
@@ -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: react6.ForwardRefExoticComponent<Omit<Partial<Omit<_pixpilot_shadcn_ui0.IconToggleProps, "ref"> & react6.RefAttributes<HTMLButtonElement>>, "ref"> & react6.RefAttributes<unknown>>;
9
+ declare const IconToggle: 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,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 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 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 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,5 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_map_upload_props = require('./map-upload-props.cjs');
2
3
  const require_use_file_upload_feedback = require('./use-file-upload-feedback.cjs');
3
4
  let __formily_react = require("@formily/react");
4
5
  __formily_react = require_rolldown_runtime.__toESM(__formily_react);
@@ -24,12 +25,7 @@ const BaseAvatarUpload = (props) => {
24
25
  * Formily-connected AvatarUpload component
25
26
  * Automatically connects shadcn AvatarUpload to Formily field state
26
27
  */
27
- const AvatarUpload = (0, __formily_react.connect)(BaseAvatarUpload, (0, __formily_react.mapProps)((props, field) => {
28
- return {
29
- ...props,
30
- value: field.value ?? null
31
- };
32
- }));
28
+ const AvatarUpload = (0, __formily_react.connect)(BaseAvatarUpload, (0, __formily_react.mapProps)((props, field) => require_map_upload_props.mapUploadProps(props, field)));
33
29
 
34
30
  //#endregion
35
31
  exports.AvatarUpload = AvatarUpload;
@@ -1,3 +1,4 @@
1
+ import { mapUploadProps } from "./map-upload-props.js";
1
2
  import { useFileUploadFeedback } from "./use-file-upload-feedback.js";
2
3
  import { connect, mapProps } from "@formily/react";
3
4
  import React from "react";
@@ -19,12 +20,7 @@ const BaseAvatarUpload = (props) => {
19
20
  * Formily-connected AvatarUpload component
20
21
  * Automatically connects shadcn AvatarUpload to Formily field state
21
22
  */
22
- const AvatarUpload$1 = connect(BaseAvatarUpload, mapProps((props, field) => {
23
- return {
24
- ...props,
25
- value: field.value ?? null
26
- };
27
- }));
23
+ const AvatarUpload$1 = connect(BaseAvatarUpload, mapProps((props, field) => mapUploadProps(props, field)));
28
24
 
29
25
  //#endregion
30
26
  export { AvatarUpload$1 as AvatarUpload };
@@ -1,4 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_map_upload_props = require('./map-upload-props.cjs');
2
3
  const require_use_file_upload_feedback = require('./use-file-upload-feedback.cjs');
3
4
  let __formily_react = require("@formily/react");
4
5
  __formily_react = require_rolldown_runtime.__toESM(__formily_react);
@@ -21,15 +22,10 @@ const BaseFileUpload = (props) => {
21
22
  });
22
23
  };
23
24
  /**
24
- * Formily-connected FileUploadInline component
25
- * Automatically connects shadcn FileUploadInline to Formily field state
25
+ * Formily-connected FileUpload component
26
+ * Automatically connects shadcn FileUpload to Formily field state
26
27
  */
27
- const FileUpload = (0, __formily_react.connect)(BaseFileUpload, (0, __formily_react.mapProps)((props, field) => {
28
- return {
29
- ...props,
30
- value: field.value ?? null
31
- };
32
- }));
28
+ const FileUpload = (0, __formily_react.connect)(BaseFileUpload, (0, __formily_react.mapProps)((props, field) => require_map_upload_props.mapUploadProps(props, field)));
33
29
 
34
30
  //#endregion
35
31
  exports.FileUpload = FileUpload;
@@ -1,20 +1,20 @@
1
1
  import React from "react";
2
- import * as _pixpilot_shadcn_ui3 from "@pixpilot/shadcn-ui";
2
+ import * as _pixpilot_shadcn_ui15 from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/file-upload/FileUpload.d.ts
5
5
 
6
6
  /**
7
- * Formily-connected FileUploadInline component
8
- * Automatically connects shadcn FileUploadInline to Formily field state
7
+ * Formily-connected FileUpload component
8
+ * Automatically connects shadcn FileUpload to Formily field state
9
9
  */
10
- declare const FileUpload: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui3.FileUploadInlineBaseProps & _pixpilot_shadcn_ui3.FileUploadRootPropsBaseProps & {
10
+ declare const FileUpload: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui15.FileUploadInlineBaseProps & _pixpilot_shadcn_ui15.FileUploadRootPropsBaseProps & {
11
11
  multiple: true;
12
- value?: _pixpilot_shadcn_ui3.FileMetadata[];
13
- onChange?: _pixpilot_shadcn_ui3.OnChangeMultipleFiles;
14
- } & _pixpilot_shadcn_ui3.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui3.FileUploadInlineBaseProps & _pixpilot_shadcn_ui3.FileUploadRootPropsBaseProps & {
12
+ value?: _pixpilot_shadcn_ui15.FileMetadata[];
13
+ onChange?: _pixpilot_shadcn_ui15.OnChangeMultipleFiles;
14
+ } & _pixpilot_shadcn_ui15.FileUploadBaseProps & _pixpilot_shadcn_ui15.MultiFileCallbacks>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui15.FileUploadInlineBaseProps & _pixpilot_shadcn_ui15.FileUploadRootPropsBaseProps & {
15
15
  multiple?: false;
16
- value?: _pixpilot_shadcn_ui3.FileMetadata | null;
17
- onChange?: _pixpilot_shadcn_ui3.OnChangeSingleFile;
18
- } & _pixpilot_shadcn_ui3.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
16
+ value?: _pixpilot_shadcn_ui15.FileMetadata | null;
17
+ onChange?: _pixpilot_shadcn_ui15.OnChangeSingleFile;
18
+ } & _pixpilot_shadcn_ui15.FileUploadBaseProps & _pixpilot_shadcn_ui15.UseFileCallbacks>, "ref">) & React.RefAttributes<unknown>>;
19
19
  //#endregion
20
20
  export { FileUpload };
@@ -1,20 +1,20 @@
1
1
  import React from "react";
2
- import * as _pixpilot_shadcn_ui3 from "@pixpilot/shadcn-ui";
2
+ import * as _pixpilot_shadcn_ui15 from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/file-upload/FileUpload.d.ts
5
5
 
6
6
  /**
7
- * Formily-connected FileUploadInline component
8
- * Automatically connects shadcn FileUploadInline to Formily field state
7
+ * Formily-connected FileUpload component
8
+ * Automatically connects shadcn FileUpload to Formily field state
9
9
  */
10
- declare const FileUpload$1: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui3.FileUploadInlineBaseProps & _pixpilot_shadcn_ui3.FileUploadRootPropsBaseProps & {
10
+ declare const FileUpload$1: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui15.FileUploadInlineBaseProps & _pixpilot_shadcn_ui15.FileUploadRootPropsBaseProps & {
11
11
  multiple: true;
12
- value?: _pixpilot_shadcn_ui3.FileMetadata[];
13
- onChange?: _pixpilot_shadcn_ui3.OnChangeMultipleFiles;
14
- } & _pixpilot_shadcn_ui3.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui3.FileUploadInlineBaseProps & _pixpilot_shadcn_ui3.FileUploadRootPropsBaseProps & {
12
+ value?: _pixpilot_shadcn_ui15.FileMetadata[];
13
+ onChange?: _pixpilot_shadcn_ui15.OnChangeMultipleFiles;
14
+ } & _pixpilot_shadcn_ui15.FileUploadBaseProps & _pixpilot_shadcn_ui15.MultiFileCallbacks>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui15.FileUploadInlineBaseProps & _pixpilot_shadcn_ui15.FileUploadRootPropsBaseProps & {
15
15
  multiple?: false;
16
- value?: _pixpilot_shadcn_ui3.FileMetadata | null;
17
- onChange?: _pixpilot_shadcn_ui3.OnChangeSingleFile;
18
- } & _pixpilot_shadcn_ui3.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
16
+ value?: _pixpilot_shadcn_ui15.FileMetadata | null;
17
+ onChange?: _pixpilot_shadcn_ui15.OnChangeSingleFile;
18
+ } & _pixpilot_shadcn_ui15.FileUploadBaseProps & _pixpilot_shadcn_ui15.UseFileCallbacks>, "ref">) & React.RefAttributes<unknown>>;
19
19
  //#endregion
20
20
  export { FileUpload$1 as FileUpload };
@@ -1,3 +1,4 @@
1
+ import { mapUploadProps } from "./map-upload-props.js";
1
2
  import { useFileUploadFeedback } from "./use-file-upload-feedback.js";
2
3
  import { connect, mapProps } from "@formily/react";
3
4
  import React from "react";
@@ -16,15 +17,10 @@ const BaseFileUpload = (props) => {
16
17
  });
17
18
  };
18
19
  /**
19
- * Formily-connected FileUploadInline component
20
- * Automatically connects shadcn FileUploadInline to Formily field state
20
+ * Formily-connected FileUpload component
21
+ * Automatically connects shadcn FileUpload to Formily field state
21
22
  */
22
- const FileUpload$1 = connect(BaseFileUpload, mapProps((props, field) => {
23
- return {
24
- ...props,
25
- value: field.value ?? null
26
- };
27
- }));
23
+ const FileUpload$1 = connect(BaseFileUpload, mapProps((props, field) => mapUploadProps(props, field)));
28
24
 
29
25
  //#endregion
30
26
  export { FileUpload$1 as FileUpload };
@@ -1,4 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_map_upload_props = require('./map-upload-props.cjs');
2
3
  const require_use_file_upload_feedback = require('./use-file-upload-feedback.cjs');
3
4
  let __formily_react = require("@formily/react");
4
5
  __formily_react = require_rolldown_runtime.__toESM(__formily_react);
@@ -24,12 +25,7 @@ const BaseFileUploadInline = (props) => {
24
25
  * Formily-connected FileUploadInline component
25
26
  * Automatically connects shadcn FileUploadInline to Formily field state
26
27
  */
27
- const FileUploadInline = (0, __formily_react.connect)(BaseFileUploadInline, (0, __formily_react.mapProps)((props, field) => {
28
- return {
29
- ...props,
30
- value: field.value ?? null
31
- };
32
- }));
28
+ const FileUploadInline = (0, __formily_react.connect)(BaseFileUploadInline, (0, __formily_react.mapProps)((props, field) => require_map_upload_props.mapUploadProps(props, field)));
33
29
 
34
30
  //#endregion
35
31
  exports.FileUploadInline = FileUploadInline;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as _pixpilot_shadcn_ui13 from "@pixpilot/shadcn-ui";
2
+ import * as _pixpilot_shadcn_ui3 from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/file-upload/FileUploadInline.d.ts
5
5
 
@@ -7,14 +7,14 @@ import * as _pixpilot_shadcn_ui13 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<_pixpilot_shadcn_ui13.FileUploadInlineBaseProps & _pixpilot_shadcn_ui13.FileUploadRootPropsBaseProps & {
10
+ declare const FileUploadInline: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui3.FileUploadInlineBaseProps & _pixpilot_shadcn_ui3.FileUploadRootPropsBaseProps & {
11
11
  multiple: true;
12
- value?: _pixpilot_shadcn_ui13.FileMetadata[];
13
- onChange?: _pixpilot_shadcn_ui13.OnChangeMultipleFiles;
14
- } & _pixpilot_shadcn_ui13.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui13.FileUploadInlineBaseProps & _pixpilot_shadcn_ui13.FileUploadRootPropsBaseProps & {
12
+ value?: _pixpilot_shadcn_ui3.FileMetadata[];
13
+ onChange?: _pixpilot_shadcn_ui3.OnChangeMultipleFiles;
14
+ } & _pixpilot_shadcn_ui3.FileUploadBaseProps & _pixpilot_shadcn_ui3.MultiFileCallbacks>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui3.FileUploadInlineBaseProps & _pixpilot_shadcn_ui3.FileUploadRootPropsBaseProps & {
15
15
  multiple?: false;
16
- value?: _pixpilot_shadcn_ui13.FileMetadata | null;
17
- onChange?: _pixpilot_shadcn_ui13.OnChangeSingleFile;
18
- } & _pixpilot_shadcn_ui13.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
16
+ value?: _pixpilot_shadcn_ui3.FileMetadata | null;
17
+ onChange?: _pixpilot_shadcn_ui3.OnChangeSingleFile;
18
+ } & _pixpilot_shadcn_ui3.FileUploadBaseProps & _pixpilot_shadcn_ui3.UseFileCallbacks>, "ref">) & React.RefAttributes<unknown>>;
19
19
  //#endregion
20
20
  export { FileUploadInline };
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as _pixpilot_shadcn_ui13 from "@pixpilot/shadcn-ui";
2
+ import * as _pixpilot_shadcn_ui3 from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/file-upload/FileUploadInline.d.ts
5
5
 
@@ -7,14 +7,14 @@ import * as _pixpilot_shadcn_ui13 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<_pixpilot_shadcn_ui13.FileUploadInlineBaseProps & _pixpilot_shadcn_ui13.FileUploadRootPropsBaseProps & {
10
+ declare const FileUploadInline$1: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui3.FileUploadInlineBaseProps & _pixpilot_shadcn_ui3.FileUploadRootPropsBaseProps & {
11
11
  multiple: true;
12
- value?: _pixpilot_shadcn_ui13.FileMetadata[];
13
- onChange?: _pixpilot_shadcn_ui13.OnChangeMultipleFiles;
14
- } & _pixpilot_shadcn_ui13.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui13.FileUploadInlineBaseProps & _pixpilot_shadcn_ui13.FileUploadRootPropsBaseProps & {
12
+ value?: _pixpilot_shadcn_ui3.FileMetadata[];
13
+ onChange?: _pixpilot_shadcn_ui3.OnChangeMultipleFiles;
14
+ } & _pixpilot_shadcn_ui3.FileUploadBaseProps & _pixpilot_shadcn_ui3.MultiFileCallbacks>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui3.FileUploadInlineBaseProps & _pixpilot_shadcn_ui3.FileUploadRootPropsBaseProps & {
15
15
  multiple?: false;
16
- value?: _pixpilot_shadcn_ui13.FileMetadata | null;
17
- onChange?: _pixpilot_shadcn_ui13.OnChangeSingleFile;
18
- } & _pixpilot_shadcn_ui13.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
16
+ value?: _pixpilot_shadcn_ui3.FileMetadata | null;
17
+ onChange?: _pixpilot_shadcn_ui3.OnChangeSingleFile;
18
+ } & _pixpilot_shadcn_ui3.FileUploadBaseProps & _pixpilot_shadcn_ui3.UseFileCallbacks>, "ref">) & React.RefAttributes<unknown>>;
19
19
  //#endregion
20
20
  export { FileUploadInline$1 as FileUploadInline };
@@ -1,3 +1,4 @@
1
+ import { mapUploadProps } from "./map-upload-props.js";
1
2
  import { useFileUploadFeedback } from "./use-file-upload-feedback.js";
2
3
  import { connect, mapProps } from "@formily/react";
3
4
  import React from "react";
@@ -19,12 +20,7 @@ const BaseFileUploadInline = (props) => {
19
20
  * Formily-connected FileUploadInline component
20
21
  * Automatically connects shadcn FileUploadInline to Formily field state
21
22
  */
22
- const FileUploadInline$1 = connect(BaseFileUploadInline, mapProps((props, field) => {
23
- return {
24
- ...props,
25
- value: field.value ?? null
26
- };
27
- }));
23
+ const FileUploadInline$1 = connect(BaseFileUploadInline, mapProps((props, field) => mapUploadProps(props, field)));
28
24
 
29
25
  //#endregion
30
26
  export { FileUploadInline$1 as FileUploadInline };
@@ -0,0 +1,46 @@
1
+
2
+ //#region src/components/file-upload/map-upload-props.ts
3
+ /**
4
+ * Shared `mapProps` mapper for all Formily-connected upload components.
5
+ *
6
+ * - Forwards `field.value` (defaulting to `null`) as the `value` prop so the
7
+ * component displays the currently stored file metadata.
8
+ * - Sets `onChange` to `undefined` to prevent Formily's default wiring from
9
+ * calling `field.setValue()` the moment a file is selected (i.e. before the
10
+ * upload completes).
11
+ * - Wraps `onSuccess` so that `field.setValue(fileMeta)` is called only after a
12
+ * successful upload, followed by the original `onSuccess` callback if one was
13
+ * supplied.
14
+ * - Wraps `onError` so that `field.setFeedback({ type: 'error', … })` is set on
15
+ * upload failure, followed by the original `onError` callback if one was
16
+ * supplied.
17
+ *
18
+ * The generic `P extends object` constraint keeps the return type identical to
19
+ * the input type so that the mapper satisfies Formily's `IStateMapper<T>`.
20
+ * Internally the props are cast to `UploadFieldCallbacks` to access the
21
+ * upload-specific callbacks; the multiple-file variant of `FileUploadProps`
22
+ * uses `onFileSuccess`/`onFileError` instead, which are simply left untouched
23
+ * because this function only overrides `onSuccess` and `onError`.
24
+ */
25
+ function mapUploadProps(props, field) {
26
+ const { onSuccess, onError } = props;
27
+ return {
28
+ ...props,
29
+ value: field.value ?? null,
30
+ onChange: void 0,
31
+ onSuccess: (fileMeta) => {
32
+ field.setValue(fileMeta);
33
+ onSuccess?.(fileMeta);
34
+ },
35
+ onError: (file, error) => {
36
+ field.setFeedback({
37
+ type: "error",
38
+ messages: [error]
39
+ });
40
+ onError?.(file, error);
41
+ }
42
+ };
43
+ }
44
+
45
+ //#endregion
46
+ exports.mapUploadProps = mapUploadProps;
@@ -0,0 +1,45 @@
1
+ //#region src/components/file-upload/map-upload-props.ts
2
+ /**
3
+ * Shared `mapProps` mapper for all Formily-connected upload components.
4
+ *
5
+ * - Forwards `field.value` (defaulting to `null`) as the `value` prop so the
6
+ * component displays the currently stored file metadata.
7
+ * - Sets `onChange` to `undefined` to prevent Formily's default wiring from
8
+ * calling `field.setValue()` the moment a file is selected (i.e. before the
9
+ * upload completes).
10
+ * - Wraps `onSuccess` so that `field.setValue(fileMeta)` is called only after a
11
+ * successful upload, followed by the original `onSuccess` callback if one was
12
+ * supplied.
13
+ * - Wraps `onError` so that `field.setFeedback({ type: 'error', … })` is set on
14
+ * upload failure, followed by the original `onError` callback if one was
15
+ * supplied.
16
+ *
17
+ * The generic `P extends object` constraint keeps the return type identical to
18
+ * the input type so that the mapper satisfies Formily's `IStateMapper<T>`.
19
+ * Internally the props are cast to `UploadFieldCallbacks` to access the
20
+ * upload-specific callbacks; the multiple-file variant of `FileUploadProps`
21
+ * uses `onFileSuccess`/`onFileError` instead, which are simply left untouched
22
+ * because this function only overrides `onSuccess` and `onError`.
23
+ */
24
+ function mapUploadProps(props, field) {
25
+ const { onSuccess, onError } = props;
26
+ return {
27
+ ...props,
28
+ value: field.value ?? null,
29
+ onChange: void 0,
30
+ onSuccess: (fileMeta) => {
31
+ field.setValue(fileMeta);
32
+ onSuccess?.(fileMeta);
33
+ },
34
+ onError: (file, error) => {
35
+ field.setFeedback({
36
+ type: "error",
37
+ messages: [error]
38
+ });
39
+ onError?.(file, error);
40
+ }
41
+ };
42
+ }
43
+
44
+ //#endregion
45
+ export { mapUploadProps };