@pixpilot/formily-shadcn 0.8.0 → 0.8.2

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 (184) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +25 -1
  2. package/dist/_virtual/rolldown_runtime.js +24 -1
  3. package/dist/components/array-base/array-base.cjs +59 -1
  4. package/dist/components/array-base/array-base.js +55 -1
  5. package/dist/components/array-base/array-context.cjs +28 -1
  6. package/dist/components/array-base/array-context.js +22 -1
  7. package/dist/components/array-base/component-context.cjs +28 -1
  8. package/dist/components/array-base/component-context.js +22 -1
  9. package/dist/components/array-base/components/addition.cjs +51 -1
  10. package/dist/components/array-base/components/addition.js +45 -1
  11. package/dist/components/array-base/components/array-copy.cjs +49 -1
  12. package/dist/components/array-base/components/array-copy.js +42 -1
  13. package/dist/components/array-base/components/array-index.cjs +15 -1
  14. package/dist/components/array-base/components/array-index.js +13 -1
  15. package/dist/components/array-base/components/array-item-label.cjs +22 -1
  16. package/dist/components/array-base/components/array-item-label.js +19 -1
  17. package/dist/components/array-base/components/components.cjs +30 -1
  18. package/dist/components/array-base/components/components.js +29 -1
  19. package/dist/components/array-base/components/edit.cjs +42 -1
  20. package/dist/components/array-base/components/edit.js +36 -1
  21. package/dist/components/array-base/components/empty.cjs +19 -1
  22. package/dist/components/array-base/components/empty.js +16 -1
  23. package/dist/components/array-base/components/get-array-components.cjs +88 -1
  24. package/dist/components/array-base/components/get-array-components.js +84 -1
  25. package/dist/components/array-base/components/move-down.cjs +47 -1
  26. package/dist/components/array-base/components/move-down.js +41 -1
  27. package/dist/components/array-base/components/move-up.cjs +47 -1
  28. package/dist/components/array-base/components/move-up.js +41 -1
  29. package/dist/components/array-base/components/remove.cjs +46 -1
  30. package/dist/components/array-base/components/remove.js +40 -1
  31. package/dist/components/array-base/components/title.cjs +17 -1
  32. package/dist/components/array-base/components/title.js +14 -1
  33. package/dist/components/array-base/components/use-array-components-registry.cjs +56 -1
  34. package/dist/components/array-base/components/use-array-components-registry.js +52 -1
  35. package/dist/components/array-base/constants/index.cjs +17 -1
  36. package/dist/components/array-base/constants/index.js +15 -1
  37. package/dist/components/array-base/index.cjs +2 -1
  38. package/dist/components/array-base/index.js +2 -1
  39. package/dist/components/array-base/utils/filter-and-sort-components.cjs +34 -1
  40. package/dist/components/array-base/utils/filter-and-sort-components.js +34 -1
  41. package/dist/components/array-base/utils/is-array-component.cjs +65 -1
  42. package/dist/components/array-base/utils/is-array-component.js +56 -1
  43. package/dist/components/array-cards/array-cards.cjs +64 -1
  44. package/dist/components/array-cards/array-cards.js +60 -1
  45. package/dist/components/array-cards/index.cjs +1 -1
  46. package/dist/components/array-cards/index.js +1 -1
  47. package/dist/components/array-cards/item.cjs +64 -1
  48. package/dist/components/array-cards/item.js +60 -1
  49. package/dist/components/array-collapse/array-collapse.cjs +96 -1
  50. package/dist/components/array-collapse/array-collapse.js +92 -1
  51. package/dist/components/array-collapse/index.cjs +1 -1
  52. package/dist/components/array-collapse/index.js +1 -1
  53. package/dist/components/array-collapse/item.cjs +84 -1
  54. package/dist/components/array-collapse/item.js +78 -1
  55. package/dist/components/array-common/array-items-list.cjs +43 -1
  56. package/dist/components/array-common/array-items-list.js +39 -1
  57. package/dist/components/array-common/create-active-item-manager.cjs +29 -1
  58. package/dist/components/array-common/create-active-item-manager.js +27 -1
  59. package/dist/components/array-common/index.cjs +5 -1
  60. package/dist/components/array-common/index.js +5 -1
  61. package/dist/components/array-common/item-wrapper.cjs +26 -1
  62. package/dist/components/array-common/item-wrapper.js +21 -1
  63. package/dist/components/array-common/list-item.cjs +53 -1
  64. package/dist/components/array-common/list-item.js +48 -1
  65. package/dist/components/array-common/use-array-editor.cjs +47 -1
  66. package/dist/components/array-common/use-array-editor.js +44 -1
  67. package/dist/components/array-dialog/array-dialog.cjs +66 -1
  68. package/dist/components/array-dialog/array-dialog.js +62 -1
  69. package/dist/components/array-dialog/edit-dialog.cjs +61 -1
  70. package/dist/components/array-dialog/edit-dialog.js +57 -1
  71. package/dist/components/array-dialog/index.cjs +1 -1
  72. package/dist/components/array-dialog/index.js +1 -1
  73. package/dist/components/array-popover/array-popover.cjs +58 -1
  74. package/dist/components/array-popover/array-popover.js +53 -1
  75. package/dist/components/array-popover/index.cjs +1 -1
  76. package/dist/components/array-popover/index.js +1 -1
  77. package/dist/components/array-popover/popover.cjs +75 -1
  78. package/dist/components/array-popover/popover.js +71 -1
  79. package/dist/components/checkbox.cjs +26 -1
  80. package/dist/components/checkbox.js +23 -1
  81. package/dist/components/column.cjs +39 -1
  82. package/dist/components/column.js +35 -1
  83. package/dist/components/combobox.cjs +14 -1
  84. package/dist/components/combobox.js +11 -1
  85. package/dist/components/context/context.cjs +7 -1
  86. package/dist/components/context/context.js +7 -1
  87. package/dist/components/context/form-context.cjs +9 -1
  88. package/dist/components/context/form-context.js +7 -1
  89. package/dist/components/context/index.cjs +2 -1
  90. package/dist/components/context/index.js +2 -1
  91. package/dist/components/date-picker.cjs +23 -1
  92. package/dist/components/date-picker.js +19 -1
  93. package/dist/components/file-upload/file-upload-inline.cjs +35 -1
  94. package/dist/components/file-upload/file-upload-inline.d.cts +8 -8
  95. package/dist/components/file-upload/file-upload-inline.js +30 -1
  96. package/dist/components/file-upload/file-upload.cjs +35 -1
  97. package/dist/components/file-upload/file-upload.d.cts +8 -8
  98. package/dist/components/file-upload/file-upload.js +30 -1
  99. package/dist/components/file-upload/index.cjs +2 -1
  100. package/dist/components/file-upload/index.js +2 -1
  101. package/dist/components/file-upload/use-file-upload-feedback.cjs +59 -3
  102. package/dist/components/file-upload/use-file-upload-feedback.js +53 -3
  103. package/dist/components/form-grid.cjs +19 -1
  104. package/dist/components/form-grid.js +15 -1
  105. package/dist/components/form-item.cjs +118 -3
  106. package/dist/components/form-item.js +112 -3
  107. package/dist/components/form-items-container.cjs +28 -1
  108. package/dist/components/form-items-container.js +24 -1
  109. package/dist/components/form.cjs +56 -1
  110. package/dist/components/form.js +51 -1
  111. package/dist/components/hidden.cjs +26 -1
  112. package/dist/components/hidden.js +23 -1
  113. package/dist/components/icon-picker.cjs +37 -1
  114. package/dist/components/icon-picker.js +33 -1
  115. package/dist/components/input.cjs +20 -1
  116. package/dist/components/input.js +17 -1
  117. package/dist/components/json-schema-form-renderer.cjs +30 -1
  118. package/dist/components/json-schema-form-renderer.js +26 -1
  119. package/dist/components/number-input.cjs +19 -1
  120. package/dist/components/number-input.d.ts +2 -2
  121. package/dist/components/number-input.js +16 -1
  122. package/dist/components/object-container.cjs +35 -1
  123. package/dist/components/object-container.js +32 -1
  124. package/dist/components/radio.cjs +40 -1
  125. package/dist/components/radio.js +35 -1
  126. package/dist/components/rich-text-editor.cjs +27 -1
  127. package/dist/components/rich-text-editor.js +23 -1
  128. package/dist/components/row.cjs +39 -1
  129. package/dist/components/row.js +35 -1
  130. package/dist/components/schema-field-extended.cjs +25 -1
  131. package/dist/components/schema-field-extended.d.cts +9 -9
  132. package/dist/components/schema-field-extended.d.ts +262 -262
  133. package/dist/components/schema-field-extended.js +23 -1
  134. package/dist/components/schema-field.cjs +61 -1
  135. package/dist/components/schema-field.d.cts +9 -9
  136. package/dist/components/schema-field.d.ts +220 -220
  137. package/dist/components/schema-field.js +57 -1
  138. package/dist/components/select.cjs +11 -1
  139. package/dist/components/select.js +8 -1
  140. package/dist/components/separator.cjs +15 -1
  141. package/dist/components/separator.d.ts +2 -2
  142. package/dist/components/separator.js +12 -1
  143. package/dist/components/slider.cjs +33 -1
  144. package/dist/components/slider.d.ts +2 -2
  145. package/dist/components/slider.js +29 -1
  146. package/dist/components/switch.cjs +21 -1
  147. package/dist/components/switch.js +18 -1
  148. package/dist/components/tags-input-inline.cjs +26 -1
  149. package/dist/components/tags-input-inline.js +23 -1
  150. package/dist/components/textarea.cjs +19 -1
  151. package/dist/components/textarea.js +16 -1
  152. package/dist/hooks/index.cjs +3 -1
  153. package/dist/hooks/index.js +3 -1
  154. package/dist/hooks/use-description.cjs +14 -1
  155. package/dist/hooks/use-description.js +12 -1
  156. package/dist/hooks/use-form-context.cjs +13 -1
  157. package/dist/hooks/use-form-context.js +11 -1
  158. package/dist/hooks/use-label.cjs +19 -1
  159. package/dist/hooks/use-label.js +16 -1
  160. package/dist/index.cjs +102 -1
  161. package/dist/index.js +35 -1
  162. package/dist/utils/create-panel-state-manager.cjs +40 -1
  163. package/dist/utils/create-panel-state-manager.js +38 -1
  164. package/dist/utils/for-each-schema.cjs +27 -1
  165. package/dist/utils/for-each-schema.js +26 -1
  166. package/dist/utils/get-array-item-info.cjs +20 -1
  167. package/dist/utils/get-array-item-info.js +19 -1
  168. package/dist/utils/get-default-value.cjs +22 -1
  169. package/dist/utils/get-default-value.js +20 -1
  170. package/dist/utils/has-array-item-errors.cjs +15 -1
  171. package/dist/utils/has-array-item-errors.js +14 -1
  172. package/dist/utils/has-error.cjs +12 -1
  173. package/dist/utils/has-error.js +10 -1
  174. package/dist/utils/index.cjs +10 -1
  175. package/dist/utils/index.js +10 -1
  176. package/dist/utils/resolve-responsive-space.cjs +131 -1
  177. package/dist/utils/resolve-responsive-space.js +123 -1
  178. package/dist/utils/transform-schema.cjs +45 -1
  179. package/dist/utils/transform-schema.js +43 -1
  180. package/dist/utils/use-array-item-editor.cjs +3 -1
  181. package/dist/utils/use-array-item-editor.js +1 -1
  182. package/dist/utils/validate-array-item-fields.cjs +22 -1
  183. package/dist/utils/validate-array-item-fields.js +22 -1
  184. package/package.json +3 -3
@@ -1 +1,71 @@
1
- import{RecursionField as e,observer as t,useField as n}from"@formily/react";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{Button as a,Popover as o,PopoverContent as s,PopoverTrigger as c}from"@pixpilot/shadcn";const l=t(({schema:t,onSave:l,onCancel:u,children:d,activeItemManager:f})=>{let p=n(),m=f.activeItem,h=f.isNew;return i(o,{open:m!==void 0,onOpenChange:e=>{e||u(m)},children:[d!==void 0&&r(c,{asChild:!0,children:d}),r(s,{className:`w-96`,side:`top`,children:i(`div`,{className:`space-y-4`,children:[i(`div`,{className:`space-y-2`,children:[r(`h4`,{className:`font-medium leading-none`,children:h?`Add New Item`:`Edit Item`}),r(`p`,{className:`text-muted-foreground text-sm`,children:h?`Fill in the details for the new item.`:`Make changes to the item.`})]}),m!=null&&r(`div`,{className:`space-y-4`,children:r(e,{basePath:p.address.concat(m),schema:t,onlyRenderProperties:!0})}),i(`div`,{className:`flex justify-end gap-2`,children:[r(a,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{u(m)},children:`Cancel`}),r(a,{type:`button`,size:`sm`,onClick:()=>{l(m)},children:`Save`})]})]})})]})});export{l as ArrayItemsEditPopover};
1
+ import { RecursionField, observer, useField } from "@formily/react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Button, Popover, PopoverContent, PopoverTrigger } from "@pixpilot/shadcn";
4
+
5
+ //#region src/components/array-popover/popover.tsx
6
+ const ArrayItemsEditPopover = observer(({ schema, onSave, onCancel, children, activeItemManager }) => {
7
+ const arrayField = useField();
8
+ const activeIndex = activeItemManager.activeItem;
9
+ const isNewItem = activeItemManager.isNew;
10
+ const open = activeIndex !== void 0;
11
+ const handleOpenChange = (isOpen) => {
12
+ if (!isOpen) onCancel(activeIndex);
13
+ };
14
+ const handleCancelClick = () => {
15
+ onCancel(activeIndex);
16
+ };
17
+ return /* @__PURE__ */ jsxs(Popover, {
18
+ open,
19
+ onOpenChange: handleOpenChange,
20
+ children: [children !== void 0 && /* @__PURE__ */ jsx(PopoverTrigger, {
21
+ asChild: true,
22
+ children
23
+ }), /* @__PURE__ */ jsx(PopoverContent, {
24
+ className: "w-96",
25
+ side: "top",
26
+ children: /* @__PURE__ */ jsxs("div", {
27
+ className: "space-y-4",
28
+ children: [
29
+ /* @__PURE__ */ jsxs("div", {
30
+ className: "space-y-2",
31
+ children: [/* @__PURE__ */ jsx("h4", {
32
+ className: "font-medium leading-none",
33
+ children: isNewItem ? "Add New Item" : `Edit Item`
34
+ }), /* @__PURE__ */ jsx("p", {
35
+ className: "text-muted-foreground text-sm",
36
+ children: isNewItem ? "Fill in the details for the new item." : "Make changes to the item."
37
+ })]
38
+ }),
39
+ activeIndex != null && /* @__PURE__ */ jsx("div", {
40
+ className: "space-y-4",
41
+ children: /* @__PURE__ */ jsx(RecursionField, {
42
+ basePath: arrayField.address.concat(activeIndex),
43
+ schema,
44
+ onlyRenderProperties: true
45
+ })
46
+ }),
47
+ /* @__PURE__ */ jsxs("div", {
48
+ className: "flex justify-end gap-2",
49
+ children: [/* @__PURE__ */ jsx(Button, {
50
+ type: "button",
51
+ variant: "outline",
52
+ size: "sm",
53
+ onClick: handleCancelClick,
54
+ children: "Cancel"
55
+ }), /* @__PURE__ */ jsx(Button, {
56
+ type: "button",
57
+ size: "sm",
58
+ onClick: () => {
59
+ onSave(activeIndex);
60
+ },
61
+ children: "Save"
62
+ })]
63
+ })
64
+ ]
65
+ })
66
+ })]
67
+ });
68
+ });
69
+
70
+ //#endregion
71
+ export { ArrayItemsEditPopover };
@@ -1 +1,26 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@formily/react`);t=e.__toESM(t);let n=require(`@pixpilot/shadcn`);n=e.__toESM(n);const r=(0,t.connect)(n.Checkbox,(0,t.mapProps)({value:`checked`,onInput:`onCheckedChange`},(e,t)=>(t.decoratorProps.labelPlacement=`end`,{...e})));r.labelPlacement=`right`,exports.Checkbox=r;
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __formily_react = require("@formily/react");
3
+ __formily_react = require_rolldown_runtime.__toESM(__formily_react);
4
+ let __pixpilot_shadcn = require("@pixpilot/shadcn");
5
+ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
6
+
7
+ //#region src/components/checkbox.tsx
8
+ /**
9
+ * Formily-connected Checkbox component
10
+ * Maps Formily field checked state to shadcn Checkbox
11
+ */
12
+ const Checkbox = (0, __formily_react.connect)(__pixpilot_shadcn.Checkbox, (0, __formily_react.mapProps)({
13
+ value: "checked",
14
+ onInput: "onCheckedChange"
15
+ }, (props, field) => {
16
+ field.decoratorProps.labelPlacement = "end";
17
+ return { ...props };
18
+ }));
19
+ /**
20
+ * Default label placement for checkbox
21
+ * Used by FormItem to determine label positioning
22
+ */
23
+ Checkbox.labelPlacement = "right";
24
+
25
+ //#endregion
26
+ exports.Checkbox = Checkbox;
@@ -1 +1,23 @@
1
- import{connect as e,mapProps as t}from"@formily/react";import{Checkbox as n}from"@pixpilot/shadcn";const r=e(n,t({value:`checked`,onInput:`onCheckedChange`},(e,t)=>(t.decoratorProps.labelPlacement=`end`,{...e})));r.labelPlacement=`right`;export{r as Checkbox};
1
+ import { connect, mapProps } from "@formily/react";
2
+ import { Checkbox } from "@pixpilot/shadcn";
3
+
4
+ //#region src/components/checkbox.tsx
5
+ /**
6
+ * Formily-connected Checkbox component
7
+ * Maps Formily field checked state to shadcn Checkbox
8
+ */
9
+ const Checkbox$1 = connect(Checkbox, mapProps({
10
+ value: "checked",
11
+ onInput: "onCheckedChange"
12
+ }, (props, field) => {
13
+ field.decoratorProps.labelPlacement = "end";
14
+ return { ...props };
15
+ }));
16
+ /**
17
+ * Default label placement for checkbox
18
+ * Used by FormItem to determine label positioning
19
+ */
20
+ Checkbox$1.labelPlacement = "right";
21
+
22
+ //#endregion
23
+ export { Checkbox$1 as Checkbox };
@@ -1 +1,39 @@
1
- const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`react`);t=e.__toESM(t);let n=require(`react/jsx-runtime`);n=e.__toESM(n);let r=require(`@pixpilot/shadcn`);r=e.__toESM(r);function i({className:e,children:t}){return(0,n.jsx)(`div`,{className:(0,r.cn)(`w-full space-y-4`,e),children:t})}exports.Column=i;
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let react = require("react");
3
+ react = require_rolldown_runtime.__toESM(react);
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
6
+ let __pixpilot_shadcn = require("@pixpilot/shadcn");
7
+ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
8
+
9
+ //#region src/components/column.tsx
10
+ /**
11
+ * Column component for creating multi-column layouts in forms
12
+ * Should be used as children of Row components
13
+ * Use Tailwind flex utilities for sizing: flex-1, w-1/2, w-1/3, w-1/4, basis-*, grow, shrink, etc.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * <Row className="gap-4">
18
+ * <Column className="flex-1">
19
+ * <FormItem label="First Name">
20
+ * <Input />
21
+ * </FormItem>
22
+ * </Column>
23
+ * <Column className="flex-1">
24
+ * <FormItem label="Last Name">
25
+ * <Input />
26
+ * </FormItem>
27
+ * </Column>
28
+ * </Row>
29
+ * ```
30
+ */
31
+ function Column({ className, children }) {
32
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
33
+ className: (0, __pixpilot_shadcn.cn)("w-full space-y-4", className),
34
+ children
35
+ });
36
+ }
37
+
38
+ //#endregion
39
+ exports.Column = Column;
@@ -1 +1,35 @@
1
- import e from"react";import{jsx as t}from"react/jsx-runtime";import{cn as n}from"@pixpilot/shadcn";function r({className:e,children:r}){return t(`div`,{className:n(`w-full space-y-4`,e),children:r})}export{r as Column};
1
+ import React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { cn } from "@pixpilot/shadcn";
4
+
5
+ //#region src/components/column.tsx
6
+ /**
7
+ * Column component for creating multi-column layouts in forms
8
+ * Should be used as children of Row components
9
+ * Use Tailwind flex utilities for sizing: flex-1, w-1/2, w-1/3, w-1/4, basis-*, grow, shrink, etc.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * <Row className="gap-4">
14
+ * <Column className="flex-1">
15
+ * <FormItem label="First Name">
16
+ * <Input />
17
+ * </FormItem>
18
+ * </Column>
19
+ * <Column className="flex-1">
20
+ * <FormItem label="Last Name">
21
+ * <Input />
22
+ * </FormItem>
23
+ * </Column>
24
+ * </Row>
25
+ * ```
26
+ */
27
+ function Column({ className, children }) {
28
+ return /* @__PURE__ */ jsx("div", {
29
+ className: cn("w-full space-y-4", className),
30
+ children
31
+ });
32
+ }
33
+
34
+ //#endregion
35
+ export { Column };
@@ -1 +1,14 @@
1
- "use client";const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@formily/react`);t=e.__toESM(t);let n=require(`@pixpilot/shadcn-ui`);n=e.__toESM(n);const r=(0,t.connect)(n.Combobox,(0,t.mapProps)({dataSource:`options`}));exports.Combobox=r;
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
5
+ let __formily_react = require("@formily/react");
6
+ __formily_react = require_rolldown_runtime.__toESM(__formily_react);
7
+ let __pixpilot_shadcn_ui = require("@pixpilot/shadcn-ui");
8
+ __pixpilot_shadcn_ui = require_rolldown_runtime.__toESM(__pixpilot_shadcn_ui);
9
+
10
+ //#region src/components/combobox.tsx
11
+ const Combobox = (0, __formily_react.connect)(__pixpilot_shadcn_ui.Combobox, (0, __formily_react.mapProps)({ dataSource: "options" }));
12
+
13
+ //#endregion
14
+ exports.Combobox = Combobox;
@@ -1 +1,11 @@
1
- "use client";import{connect as e,mapProps as t}from"@formily/react";import{Combobox as n}from"@pixpilot/shadcn-ui";const r=e(n,t({dataSource:`options`}));export{r as Combobox};
1
+ 'use client';
2
+
3
+
4
+ import { connect, mapProps } from "@formily/react";
5
+ import { Combobox } from "@pixpilot/shadcn-ui";
6
+
7
+ //#region src/components/combobox.tsx
8
+ const Combobox$1 = connect(Combobox, mapProps({ dataSource: "options" }));
9
+
10
+ //#endregion
11
+ export { Combobox$1 as Combobox };
@@ -1 +1,7 @@
1
- const e=require(`./form-context.cjs`),{Provider:t,Consumer:n}=e.FormContext;exports.Provider=t;
1
+ const require_form_context = require('./form-context.cjs');
2
+
3
+ //#region src/components/context/context.tsx
4
+ const { Provider, Consumer } = require_form_context.FormContext;
5
+
6
+ //#endregion
7
+ exports.Provider = Provider;
@@ -1 +1,7 @@
1
- import{FormContext as e}from"./form-context.js";const{Provider:t,Consumer:n}=e;export{t as Provider};
1
+ import { FormContext } from "./form-context.js";
2
+
3
+ //#region src/components/context/context.tsx
4
+ const { Provider, Consumer } = FormContext;
5
+
6
+ //#endregion
7
+ export { Provider };
@@ -1 +1,9 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`);let t=require(`react`);t=e.__toESM(t);const n=t.default.createContext({});exports.FormContext=n;
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let react = require("react");
3
+ react = require_rolldown_runtime.__toESM(react);
4
+
5
+ //#region src/components/context/form-context.ts
6
+ const FormContext = react.default.createContext({});
7
+
8
+ //#endregion
9
+ exports.FormContext = FormContext;
@@ -1 +1,7 @@
1
- import e from"react";const t=e.createContext({});export{t as FormContext};
1
+ import React from "react";
2
+
3
+ //#region src/components/context/form-context.ts
4
+ const FormContext = React.createContext({});
5
+
6
+ //#endregion
7
+ export { FormContext };
@@ -1 +1,2 @@
1
- const e=require(`./form-context.cjs`),t=require(`./context.cjs`);
1
+ const require_form_context = require('./form-context.cjs');
2
+ const require_context = require('./context.cjs');
@@ -1 +1,2 @@
1
- import{FormContext as e}from"./form-context.js";import{Provider as t}from"./context.js";
1
+ import { FormContext } from "./form-context.js";
2
+ import { Provider } from "./context.js";
@@ -1 +1,23 @@
1
- "use client";const e=require(`../_virtual/rolldown_runtime.cjs`);let t=require(`@formily/react`);t=e.__toESM(t);let n=require(`@pixpilot/shadcn-ui`);n=e.__toESM(n);let r=require(`react/jsx-runtime`);r=e.__toESM(r);function i(e){return(0,r.jsx)(n.DatePicker,{...e})}const a=(0,t.connect)(i,(0,t.mapProps)());exports.DatePicker=a;
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
5
+ let __formily_react = require("@formily/react");
6
+ __formily_react = require_rolldown_runtime.__toESM(__formily_react);
7
+ let __pixpilot_shadcn_ui = require("@pixpilot/shadcn-ui");
8
+ __pixpilot_shadcn_ui = require_rolldown_runtime.__toESM(__pixpilot_shadcn_ui);
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
11
+
12
+ //#region src/components/date-picker.tsx
13
+ /**
14
+ * Formily-connected Date Picker component
15
+ * Displays a date picker with calendar popup
16
+ */
17
+ function BaseDatePicker(props) {
18
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn_ui.DatePicker, { ...props });
19
+ }
20
+ const DatePicker = (0, __formily_react.connect)(BaseDatePicker, (0, __formily_react.mapProps)());
21
+
22
+ //#endregion
23
+ exports.DatePicker = DatePicker;
@@ -1 +1,19 @@
1
- "use client";import{connect as e,mapProps as t}from"@formily/react";import{DatePicker as n}from"@pixpilot/shadcn-ui";import{jsx as r}from"react/jsx-runtime";function i(e){return r(n,{...e})}const a=e(i,t());export{a as DatePicker};
1
+ 'use client';
2
+
3
+
4
+ import { connect, mapProps } from "@formily/react";
5
+ import { DatePicker } from "@pixpilot/shadcn-ui";
6
+ import { jsx } from "react/jsx-runtime";
7
+
8
+ //#region src/components/date-picker.tsx
9
+ /**
10
+ * Formily-connected Date Picker component
11
+ * Displays a date picker with calendar popup
12
+ */
13
+ function BaseDatePicker(props) {
14
+ return /* @__PURE__ */ jsx(DatePicker, { ...props });
15
+ }
16
+ const DatePicker$1 = connect(BaseDatePicker, mapProps());
17
+
18
+ //#endregion
19
+ export { DatePicker$1 as DatePicker };
@@ -1 +1,35 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./use-file-upload-feedback.cjs`);let n=require(`@formily/react`);n=e.__toESM(n);let r=require(`react`);r=e.__toESM(r);let i=require(`@pixpilot/shadcn-ui`);i=e.__toESM(i);let a=require(`react/jsx-runtime`);a=e.__toESM(a);const o=e=>{let{onUpload:n,maxSize:r,handleFilesRejection:o,handleFileValidate:s}=t.useFileUploadFeedback(e);return(0,a.jsx)(i.FileUploadInline,{...e,maxSize:r,onFilesReject:o,onFileValidate:s,onUpload:n})},s=(0,n.connect)(o,(0,n.mapProps)((e,t)=>({...e,value:t.value??null})));exports.FileUploadInline=s;
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_use_file_upload_feedback = require('./use-file-upload-feedback.cjs');
3
+ let __formily_react = require("@formily/react");
4
+ __formily_react = require_rolldown_runtime.__toESM(__formily_react);
5
+ let react = require("react");
6
+ react = require_rolldown_runtime.__toESM(react);
7
+ let __pixpilot_shadcn_ui = require("@pixpilot/shadcn-ui");
8
+ __pixpilot_shadcn_ui = require_rolldown_runtime.__toESM(__pixpilot_shadcn_ui);
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
11
+
12
+ //#region src/components/file-upload/file-upload-inline.tsx
13
+ const BaseFileUploadInline = (props) => {
14
+ const { onUpload, maxSize, handleFilesRejection, handleFileValidate } = require_use_file_upload_feedback.useFileUploadFeedback(props);
15
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn_ui.FileUploadInline, {
16
+ ...props,
17
+ maxSize,
18
+ onFilesReject: handleFilesRejection,
19
+ onFileValidate: handleFileValidate,
20
+ onUpload
21
+ });
22
+ };
23
+ /**
24
+ * Formily-connected FileUploadInline component
25
+ * Automatically connects shadcn FileUploadInline to Formily field state
26
+ */
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
+ }));
33
+
34
+ //#endregion
35
+ exports.FileUploadInline = FileUploadInline;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as _pixpilot_shadcn_ui190 from "@pixpilot/shadcn-ui";
2
+ import * as _pixpilot_shadcn_ui198 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_ui190 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_ui190.FileUploadInlineBaseProps & {
10
+ declare const FileUploadInline: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui198.FileUploadInlineBaseProps & {
11
11
  multiple: true;
12
- value?: _pixpilot_shadcn_ui190.FileMetadata[];
13
- onChange?: _pixpilot_shadcn_ui190.OnChangeMultipleFiles;
14
- } & _pixpilot_shadcn_ui190.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui190.FileUploadInlineBaseProps & {
12
+ value?: _pixpilot_shadcn_ui198.FileMetadata[];
13
+ onChange?: _pixpilot_shadcn_ui198.OnChangeMultipleFiles;
14
+ } & _pixpilot_shadcn_ui198.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui198.FileUploadInlineBaseProps & {
15
15
  multiple?: false;
16
- value?: _pixpilot_shadcn_ui190.FileMetadata | null;
17
- onChange?: _pixpilot_shadcn_ui190.OnChangeSingleFile;
18
- } & _pixpilot_shadcn_ui190.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
16
+ value?: _pixpilot_shadcn_ui198.FileMetadata | null;
17
+ onChange?: _pixpilot_shadcn_ui198.OnChangeSingleFile;
18
+ } & _pixpilot_shadcn_ui198.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
19
19
  //#endregion
20
20
  export { FileUploadInline };
@@ -1 +1,30 @@
1
- import{useFileUploadFeedback as e}from"./use-file-upload-feedback.js";import{connect as t,mapProps as n}from"@formily/react";import r from"react";import{FileUploadInline as i}from"@pixpilot/shadcn-ui";import{jsx as a}from"react/jsx-runtime";const o=t(t=>{let{onUpload:n,maxSize:r,handleFilesRejection:o,handleFileValidate:s}=e(t);return a(i,{...t,maxSize:r,onFilesReject:o,onFileValidate:s,onUpload:n})},n((e,t)=>({...e,value:t.value??null})));export{o as FileUploadInline};
1
+ import { useFileUploadFeedback } from "./use-file-upload-feedback.js";
2
+ import { connect, mapProps } from "@formily/react";
3
+ import React from "react";
4
+ import { FileUploadInline } from "@pixpilot/shadcn-ui";
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/components/file-upload/file-upload-inline.tsx
8
+ const BaseFileUploadInline = (props) => {
9
+ const { onUpload, maxSize, handleFilesRejection, handleFileValidate } = useFileUploadFeedback(props);
10
+ return /* @__PURE__ */ jsx(FileUploadInline, {
11
+ ...props,
12
+ maxSize,
13
+ onFilesReject: handleFilesRejection,
14
+ onFileValidate: handleFileValidate,
15
+ onUpload
16
+ });
17
+ };
18
+ /**
19
+ * Formily-connected FileUploadInline component
20
+ * Automatically connects shadcn FileUploadInline to Formily field state
21
+ */
22
+ const FileUploadInline$1 = connect(BaseFileUploadInline, mapProps((props, field) => {
23
+ return {
24
+ ...props,
25
+ value: field.value ?? null
26
+ };
27
+ }));
28
+
29
+ //#endregion
30
+ export { FileUploadInline$1 as FileUploadInline };
@@ -1 +1,35 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`./use-file-upload-feedback.cjs`);let n=require(`@formily/react`);n=e.__toESM(n);let r=require(`react`);r=e.__toESM(r);let i=require(`@pixpilot/shadcn-ui`);i=e.__toESM(i);let a=require(`react/jsx-runtime`);a=e.__toESM(a);const o=e=>{let{onUpload:n,maxSize:r,handleFilesRejection:o,handleFileValidate:s}=t.useFileUploadFeedback(e);return(0,a.jsx)(i.FileUpload,{...e,maxSize:r,onFilesReject:o,onFileValidate:s,onUpload:n})},s=(0,n.connect)(o,(0,n.mapProps)((e,t)=>({...e,value:t.value??null})));exports.FileUpload=s;
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_use_file_upload_feedback = require('./use-file-upload-feedback.cjs');
3
+ let __formily_react = require("@formily/react");
4
+ __formily_react = require_rolldown_runtime.__toESM(__formily_react);
5
+ let react = require("react");
6
+ react = require_rolldown_runtime.__toESM(react);
7
+ let __pixpilot_shadcn_ui = require("@pixpilot/shadcn-ui");
8
+ __pixpilot_shadcn_ui = require_rolldown_runtime.__toESM(__pixpilot_shadcn_ui);
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
11
+
12
+ //#region src/components/file-upload/file-upload.tsx
13
+ const BaseFileUpload = (props) => {
14
+ const { onUpload, maxSize, handleFilesRejection, handleFileValidate } = require_use_file_upload_feedback.useFileUploadFeedback(props);
15
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn_ui.FileUpload, {
16
+ ...props,
17
+ maxSize,
18
+ onFilesReject: handleFilesRejection,
19
+ onFileValidate: handleFileValidate,
20
+ onUpload
21
+ });
22
+ };
23
+ /**
24
+ * Formily-connected FileUploadInline component
25
+ * Automatically connects shadcn FileUploadInline to Formily field state
26
+ */
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
+ }));
33
+
34
+ //#endregion
35
+ exports.FileUpload = FileUpload;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import * as _pixpilot_shadcn_ui198 from "@pixpilot/shadcn-ui";
2
+ import * as _pixpilot_shadcn_ui190 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_ui198 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<_pixpilot_shadcn_ui198.FileUploadInlineBaseProps & {
10
+ declare const FileUpload: React.ForwardRefExoticComponent<(Omit<Partial<_pixpilot_shadcn_ui190.FileUploadInlineBaseProps & {
11
11
  multiple: true;
12
- value?: _pixpilot_shadcn_ui198.FileMetadata[];
13
- onChange?: _pixpilot_shadcn_ui198.OnChangeMultipleFiles;
14
- } & _pixpilot_shadcn_ui198.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui198.FileUploadInlineBaseProps & {
12
+ value?: _pixpilot_shadcn_ui190.FileMetadata[];
13
+ onChange?: _pixpilot_shadcn_ui190.OnChangeMultipleFiles;
14
+ } & _pixpilot_shadcn_ui190.FileUploadBaseProps>, "ref"> | Omit<Partial<_pixpilot_shadcn_ui190.FileUploadInlineBaseProps & {
15
15
  multiple?: false;
16
- value?: _pixpilot_shadcn_ui198.FileMetadata | null;
17
- onChange?: _pixpilot_shadcn_ui198.OnChangeSingleFile;
18
- } & _pixpilot_shadcn_ui198.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
16
+ value?: _pixpilot_shadcn_ui190.FileMetadata | null;
17
+ onChange?: _pixpilot_shadcn_ui190.OnChangeSingleFile;
18
+ } & _pixpilot_shadcn_ui190.FileUploadBaseProps>, "ref">) & React.RefAttributes<unknown>>;
19
19
  //#endregion
20
20
  export { FileUpload };
@@ -1 +1,30 @@
1
- import{useFileUploadFeedback as e}from"./use-file-upload-feedback.js";import{connect as t,mapProps as n}from"@formily/react";import r from"react";import{FileUpload as i}from"@pixpilot/shadcn-ui";import{jsx as a}from"react/jsx-runtime";const o=t(t=>{let{onUpload:n,maxSize:r,handleFilesRejection:o,handleFileValidate:s}=e(t);return a(i,{...t,maxSize:r,onFilesReject:o,onFileValidate:s,onUpload:n})},n((e,t)=>({...e,value:t.value??null})));export{o as FileUpload};
1
+ import { useFileUploadFeedback } from "./use-file-upload-feedback.js";
2
+ import { connect, mapProps } from "@formily/react";
3
+ import React from "react";
4
+ import { FileUpload } from "@pixpilot/shadcn-ui";
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/components/file-upload/file-upload.tsx
8
+ const BaseFileUpload = (props) => {
9
+ const { onUpload, maxSize, handleFilesRejection, handleFileValidate } = useFileUploadFeedback(props);
10
+ return /* @__PURE__ */ jsx(FileUpload, {
11
+ ...props,
12
+ maxSize,
13
+ onFilesReject: handleFilesRejection,
14
+ onFileValidate: handleFileValidate,
15
+ onUpload
16
+ });
17
+ };
18
+ /**
19
+ * Formily-connected FileUploadInline component
20
+ * Automatically connects shadcn FileUploadInline to Formily field state
21
+ */
22
+ const FileUpload$1 = connect(BaseFileUpload, mapProps((props, field) => {
23
+ return {
24
+ ...props,
25
+ value: field.value ?? null
26
+ };
27
+ }));
28
+
29
+ //#endregion
30
+ export { FileUpload$1 as FileUpload };
@@ -1 +1,2 @@
1
- const e=require(`./file-upload.cjs`),t=require(`./file-upload-inline.cjs`);
1
+ const require_file_upload = require('./file-upload.cjs');
2
+ const require_file_upload_inline = require('./file-upload-inline.cjs');
@@ -1 +1,2 @@
1
- import{FileUpload as e}from"./file-upload.js";import{FileUploadInline as t}from"./file-upload-inline.js";
1
+ import { FileUpload } from "./file-upload.js";
2
+ import { FileUploadInline } from "./file-upload-inline.js";
@@ -1,3 +1,59 @@
1
- const e=require(`../../_virtual/rolldown_runtime.cjs`),t=require(`../../hooks/use-form-context.cjs`);require(`../../hooks/index.cjs`);let n=require(`@formily/react`);n=e.__toESM(n);let r=require(`react`);r=e.__toESM(r);let i=require(`pretty-bytes`);i=e.__toESM(i);function a(e){let{onUpload:a,maxSize:o,onFilesReject:s,onFileValidate:c}=e,{config:l}=t.useFormContext(),u=(0,n.useField)(),{fileUpload:d}=l||{},f=a??d?.onUpload,p=o??d?.maxSize;if(f==null&&process.env.NODE_ENV!==`production`)throw Error(`onUpload prop required for FileUploadInline. Provide handler on form or field props.`);return{onUpload:f,maxSize:p,handleFilesRejection:r.default.useCallback(e=>{s?.(e);let t=e.filter(e=>e.message.startsWith(`Maximum`)),n=e.filter(e=>e.message.startsWith(`File too large`)),r=e.filter(e=>!n.includes(e)&&!t.includes(e)),a=[];if(t.length>0&&a.push(t[0].message),p!=null&&n.length>0){let e=n.map(e=>`${e.file.name} (${(0,i.default)(e.file.size)})`).join(`
2
- `);a.push(`Files exceed ${(0,i.default)(p)} limit:\n${e}`)}r.length>0&&r.forEach(e=>{a.push(`${e.message}: ${e.file.name}`)}),u.setFeedback({type:`warning`,messages:[a.join(`
3
- `)]})},[u,p,s]),handleFileValidate:r.default.useCallback(e=>(u.setFeedback({type:`warning`,messages:[]}),c?.(e)),[u,c])}}exports.useFileUploadFeedback=a;
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ const require_use_form_context = require('../../hooks/use-form-context.cjs');
3
+ require('../../hooks/index.cjs');
4
+ let __formily_react = require("@formily/react");
5
+ __formily_react = require_rolldown_runtime.__toESM(__formily_react);
6
+ let react = require("react");
7
+ react = require_rolldown_runtime.__toESM(react);
8
+ let pretty_bytes = require("pretty-bytes");
9
+ pretty_bytes = require_rolldown_runtime.__toESM(pretty_bytes);
10
+
11
+ //#region src/components/file-upload/use-file-upload-feedback.ts
12
+ function useFileUploadFeedback(props) {
13
+ const { onUpload: onUploadProp, maxSize: maxSizeProp, onFilesReject, onFileValidate } = props;
14
+ const { config } = require_use_form_context.useFormContext();
15
+ const field = (0, __formily_react.useField)();
16
+ const { fileUpload } = config || {};
17
+ const onUpload = onUploadProp ?? fileUpload?.onUpload;
18
+ const maxSize = maxSizeProp ?? fileUpload?.maxSize;
19
+ if (onUpload == null) {
20
+ if (process.env.NODE_ENV !== "production") throw new Error("onUpload prop required for FileUploadInline. Provide handler on form or field props.");
21
+ }
22
+ return {
23
+ onUpload,
24
+ maxSize,
25
+ handleFilesRejection: react.default.useCallback((files) => {
26
+ onFilesReject?.(files);
27
+ const maximumError = files.filter((f) => f.message.startsWith("Maximum"));
28
+ const withFileSizeError = files.filter((f) => f.message.startsWith("File too large"));
29
+ const otherErrors = files.filter((f) => !withFileSizeError.includes(f) && !maximumError.includes(f));
30
+ const messages = [];
31
+ if (maximumError.length > 0) messages.push(maximumError[0].message);
32
+ if (maxSize != null && withFileSizeError.length > 0) {
33
+ const fileList = withFileSizeError.map((f) => `${f.file.name} (${(0, pretty_bytes.default)(f.file.size)})`).join("\n");
34
+ messages.push(`Files exceed ${(0, pretty_bytes.default)(maxSize)} limit:\n${fileList}`);
35
+ }
36
+ if (otherErrors.length > 0) otherErrors.forEach((f) => {
37
+ messages.push(`${f.message}: ${f.file.name}`);
38
+ });
39
+ field.setFeedback({
40
+ type: "warning",
41
+ messages: [messages.join("\n")]
42
+ });
43
+ }, [
44
+ field,
45
+ maxSize,
46
+ onFilesReject
47
+ ]),
48
+ handleFileValidate: react.default.useCallback((file) => {
49
+ field.setFeedback({
50
+ type: "warning",
51
+ messages: []
52
+ });
53
+ return onFileValidate?.(file);
54
+ }, [field, onFileValidate])
55
+ };
56
+ }
57
+
58
+ //#endregion
59
+ exports.useFileUploadFeedback = useFileUploadFeedback;