@pixpilot/formily-shadcn 0.18.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/context/form-context.d.cts +10 -13
- package/dist/components/context/form-context.d.ts +10 -13
- package/dist/components/date-picker.d.cts +3 -3
- package/dist/components/form-grid.d.cts +2 -2
- package/dist/components/form-grid.d.ts +2 -2
- package/dist/components/form-item/base-form-item.cjs +11 -6
- package/dist/components/form-item/base-form-item.js +11 -6
- package/dist/components/form.d.cts +2 -2
- package/dist/components/form.d.ts +2 -2
- package/dist/components/icon-picker.d.ts +3 -3
- package/dist/components/input.d.cts +2 -2
- package/dist/components/input.d.ts +2 -2
- package/dist/components/number/number-input.d.cts +2 -2
- package/dist/components/object-container.cjs +37 -7
- package/dist/components/object-container.d.cts +8 -0
- package/dist/components/object-container.d.ts +8 -0
- package/dist/components/object-container.js +37 -7
- package/dist/components/radio.d.cts +2 -2
- package/dist/components/row.d.cts +2 -2
- package/dist/components/separator.d.cts +2 -2
- package/dist/components/slider/slider-input.d.ts +3 -3
- package/dist/components/slider/slider.d.ts +3 -3
- package/dist/components/switch.d.cts +2 -2
- package/dist/components/tags-input-inline.d.cts +2 -2
- package/dist/components/textarea.d.cts +2 -2
- package/package.json +4 -4
|
@@ -39,22 +39,19 @@ interface FormLayoutOptions {
|
|
|
39
39
|
labelPlacement?: LabelPlacement;
|
|
40
40
|
/** Custom class names for FormItem elements */
|
|
41
41
|
itemProps?: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
42
|
+
label?: React.HTMLAttributes<HTMLDivElement>;
|
|
43
|
+
description?: React.HTMLAttributes<HTMLDivElement>;
|
|
44
|
+
inputWrapper?: React.HTMLAttributes<HTMLDivElement>;
|
|
45
|
+
error?: React.HTMLAttributes<HTMLDivElement>;
|
|
46
|
+
container?: React.HTMLAttributes<HTMLDivElement>;
|
|
48
47
|
};
|
|
49
48
|
/** Custom class names for ObjectContainer elements */
|
|
50
49
|
objectContainer?: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
content?: string;
|
|
57
|
-
};
|
|
50
|
+
card: React.HTMLAttributes<HTMLDivElement>;
|
|
51
|
+
header: React.HTMLAttributes<HTMLDivElement>;
|
|
52
|
+
title: React.HTMLAttributes<HTMLDivElement>;
|
|
53
|
+
description: React.HTMLAttributes<HTMLDivElement>;
|
|
54
|
+
content: React.HTMLAttributes<HTMLDivElement>;
|
|
58
55
|
};
|
|
59
56
|
}
|
|
60
57
|
interface FormContextStates {
|
|
@@ -39,22 +39,19 @@ interface FormLayoutOptions {
|
|
|
39
39
|
labelPlacement?: LabelPlacement;
|
|
40
40
|
/** Custom class names for FormItem elements */
|
|
41
41
|
itemProps?: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
42
|
+
label?: React.HTMLAttributes<HTMLDivElement>;
|
|
43
|
+
description?: React.HTMLAttributes<HTMLDivElement>;
|
|
44
|
+
inputWrapper?: React.HTMLAttributes<HTMLDivElement>;
|
|
45
|
+
error?: React.HTMLAttributes<HTMLDivElement>;
|
|
46
|
+
container?: React.HTMLAttributes<HTMLDivElement>;
|
|
48
47
|
};
|
|
49
48
|
/** Custom class names for ObjectContainer elements */
|
|
50
49
|
objectContainer?: {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
content?: string;
|
|
57
|
-
};
|
|
50
|
+
card: React.HTMLAttributes<HTMLDivElement>;
|
|
51
|
+
header: React.HTMLAttributes<HTMLDivElement>;
|
|
52
|
+
title: React.HTMLAttributes<HTMLDivElement>;
|
|
53
|
+
description: React.HTMLAttributes<HTMLDivElement>;
|
|
54
|
+
content: React.HTMLAttributes<HTMLDivElement>;
|
|
58
55
|
};
|
|
59
56
|
}
|
|
60
57
|
interface FormContextStates {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react4 from "react";
|
|
2
2
|
import { DatePickerProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/date-picker.d.ts
|
|
5
|
-
declare const DatePicker:
|
|
5
|
+
declare const DatePicker: react4.ForwardRefExoticComponent<Partial<{
|
|
6
6
|
value?: Date;
|
|
7
7
|
onChange?: (date: Date | undefined) => void;
|
|
8
8
|
placeholder?: string;
|
|
9
|
-
} & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> &
|
|
9
|
+
} & Omit<DatePickerProps, "onSelect" | "selected" | "mode">> & react4.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { DatePicker };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/form-grid.d.ts
|
|
5
5
|
interface IFormGridProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
@@ -7,6 +7,6 @@ declare function FormGrid({
|
|
|
7
7
|
className,
|
|
8
8
|
children,
|
|
9
9
|
...rest
|
|
10
|
-
}: IFormGridProps):
|
|
10
|
+
}: IFormGridProps): react_jsx_runtime0.JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { FormGrid };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
3
3
|
|
|
4
4
|
//#region src/components/form-grid.d.ts
|
|
5
5
|
interface IFormGridProps extends React.HTMLAttributes<HTMLDivElement> {}
|
|
@@ -7,6 +7,6 @@ declare function FormGrid({
|
|
|
7
7
|
className,
|
|
8
8
|
children,
|
|
9
9
|
...rest
|
|
10
|
-
}: IFormGridProps):
|
|
10
|
+
}: IFormGridProps): react_jsx_runtime1.JSX.Element;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { FormGrid };
|
|
@@ -22,7 +22,7 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
22
22
|
const fieldProps = field?.componentProps ?? {};
|
|
23
23
|
const effectiveLabel = require_use_label.useLabel(label);
|
|
24
24
|
const { layout } = require_use_form_context.useFormContext();
|
|
25
|
-
const
|
|
25
|
+
const itemComponentsProps = layout?.itemProps || {};
|
|
26
26
|
const contextDescriptionPlacement = layout?.descriptionPlacement;
|
|
27
27
|
const effectiveLabelPlacement = fieldProps.labelPlacement ?? labelPlacement;
|
|
28
28
|
const resolvedDescriptionPlacement = fieldProps.descriptionPlacement ?? descriptionPlacement ?? contextDescriptionPlacement ?? resolveLegacyDescriptionPlacement(effectiveLabelPlacement);
|
|
@@ -33,17 +33,19 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
33
33
|
const spacingConfig = require_spacing_config.getSpacingConfig(resolvedDescriptionPlacement, descriptionRenderedInline);
|
|
34
34
|
const ariaDescribedBy = [descriptionRenderedInline ? descriptionId : void 0, feedbackText != null ? feedbackId : void 0].filter(Boolean).join(" ");
|
|
35
35
|
const labelElement = effectiveLabel != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_form_item_label.FormItemLabel, {
|
|
36
|
+
...itemComponentsProps.label,
|
|
36
37
|
id,
|
|
37
38
|
label: effectiveLabel,
|
|
38
39
|
asterisk,
|
|
39
40
|
error: feedbackStatus === "error",
|
|
40
41
|
shrink: effectiveLabelPlacement === "end" || effectiveLabelPlacement === "start",
|
|
41
|
-
labelClassName: (0, __pixpilot_shadcn.cn)(spacingConfig.label,
|
|
42
|
+
labelClassName: (0, __pixpilot_shadcn.cn)(spacingConfig.label, itemComponentsProps.label?.className),
|
|
42
43
|
description,
|
|
43
44
|
descriptionInPopover: resolvedDescriptionPlacement === "popover" && description != null
|
|
44
45
|
});
|
|
45
46
|
const inputElement = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
46
|
-
|
|
47
|
+
...itemComponentsProps.inputWrapper,
|
|
48
|
+
className: (0, __pixpilot_shadcn.cn)("relative", itemComponentsProps.inputWrapper?.className),
|
|
47
49
|
children: react.default.isValidElement(children) ? react.default.cloneElement(children, {
|
|
48
50
|
id,
|
|
49
51
|
"aria-describedby": ariaDescribedBy || void 0,
|
|
@@ -51,8 +53,9 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
51
53
|
}) : children
|
|
52
54
|
});
|
|
53
55
|
const descriptionElement = descriptionRenderedInline ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
56
|
+
...itemComponentsProps.description,
|
|
54
57
|
id: descriptionId,
|
|
55
|
-
className: (0, __pixpilot_shadcn.cn)("text-muted-foreground text-[0.8rem]", spacingConfig.description,
|
|
58
|
+
className: (0, __pixpilot_shadcn.cn)("text-muted-foreground text-[0.8rem]", spacingConfig.description, itemComponentsProps.description?.className),
|
|
56
59
|
children: description
|
|
57
60
|
}) : null;
|
|
58
61
|
const contentElement = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
@@ -71,11 +74,13 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
71
74
|
] });
|
|
72
75
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
73
76
|
"data-slot": "form-item",
|
|
74
|
-
|
|
77
|
+
...itemComponentsProps.container,
|
|
75
78
|
...props,
|
|
79
|
+
className: (0, __pixpilot_shadcn.cn)("flex flex-col ", className, itemComponentsProps.container?.className),
|
|
76
80
|
children: [contentElement, Boolean(feedbackText) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
81
|
+
...itemComponentsProps.error,
|
|
77
82
|
id: feedbackId,
|
|
78
|
-
className: (0, __pixpilot_shadcn.cn)("text-[0.8rem]", spacingConfig.feedback, feedbackStatus === "error" && "text-destructive font-medium", feedbackStatus === "warning" && "text-amber-600", feedbackStatus === "success" && "text-green-600",
|
|
83
|
+
className: (0, __pixpilot_shadcn.cn)("text-[0.8rem]", spacingConfig.feedback, feedbackStatus === "error" && "text-destructive font-medium", feedbackStatus === "warning" && "text-amber-600", feedbackStatus === "success" && "text-green-600", itemComponentsProps.error?.className),
|
|
79
84
|
children: typeof feedbackText === "string" ? feedbackText.split("\n").map((line, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.default.Fragment, { children: [line, index < feedbackText.split("\n").length - 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("br", {})] }, index)) : feedbackText
|
|
80
85
|
})]
|
|
81
86
|
});
|
|
@@ -17,7 +17,7 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
17
17
|
const fieldProps = field?.componentProps ?? {};
|
|
18
18
|
const effectiveLabel = useLabel(label);
|
|
19
19
|
const { layout } = useFormContext();
|
|
20
|
-
const
|
|
20
|
+
const itemComponentsProps = layout?.itemProps || {};
|
|
21
21
|
const contextDescriptionPlacement = layout?.descriptionPlacement;
|
|
22
22
|
const effectiveLabelPlacement = fieldProps.labelPlacement ?? labelPlacement;
|
|
23
23
|
const resolvedDescriptionPlacement = fieldProps.descriptionPlacement ?? descriptionPlacement ?? contextDescriptionPlacement ?? resolveLegacyDescriptionPlacement(effectiveLabelPlacement);
|
|
@@ -28,17 +28,19 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
28
28
|
const spacingConfig = getSpacingConfig(resolvedDescriptionPlacement, descriptionRenderedInline);
|
|
29
29
|
const ariaDescribedBy = [descriptionRenderedInline ? descriptionId : void 0, feedbackText != null ? feedbackId : void 0].filter(Boolean).join(" ");
|
|
30
30
|
const labelElement = effectiveLabel != null && /* @__PURE__ */ jsx(FormItemLabel, {
|
|
31
|
+
...itemComponentsProps.label,
|
|
31
32
|
id,
|
|
32
33
|
label: effectiveLabel,
|
|
33
34
|
asterisk,
|
|
34
35
|
error: feedbackStatus === "error",
|
|
35
36
|
shrink: effectiveLabelPlacement === "end" || effectiveLabelPlacement === "start",
|
|
36
|
-
labelClassName: cn(spacingConfig.label,
|
|
37
|
+
labelClassName: cn(spacingConfig.label, itemComponentsProps.label?.className),
|
|
37
38
|
description,
|
|
38
39
|
descriptionInPopover: resolvedDescriptionPlacement === "popover" && description != null
|
|
39
40
|
});
|
|
40
41
|
const inputElement = /* @__PURE__ */ jsx("div", {
|
|
41
|
-
|
|
42
|
+
...itemComponentsProps.inputWrapper,
|
|
43
|
+
className: cn("relative", itemComponentsProps.inputWrapper?.className),
|
|
42
44
|
children: React.isValidElement(children) ? React.cloneElement(children, {
|
|
43
45
|
id,
|
|
44
46
|
"aria-describedby": ariaDescribedBy || void 0,
|
|
@@ -46,8 +48,9 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
46
48
|
}) : children
|
|
47
49
|
});
|
|
48
50
|
const descriptionElement = descriptionRenderedInline ? /* @__PURE__ */ jsx("p", {
|
|
51
|
+
...itemComponentsProps.description,
|
|
49
52
|
id: descriptionId,
|
|
50
|
-
className: cn("text-muted-foreground text-[0.8rem]", spacingConfig.description,
|
|
53
|
+
className: cn("text-muted-foreground text-[0.8rem]", spacingConfig.description, itemComponentsProps.description?.className),
|
|
51
54
|
children: description
|
|
52
55
|
}) : null;
|
|
53
56
|
const contentElement = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -66,11 +69,13 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
66
69
|
] });
|
|
67
70
|
return /* @__PURE__ */ jsxs("div", {
|
|
68
71
|
"data-slot": "form-item",
|
|
69
|
-
|
|
72
|
+
...itemComponentsProps.container,
|
|
70
73
|
...props,
|
|
74
|
+
className: cn("flex flex-col ", className, itemComponentsProps.container?.className),
|
|
71
75
|
children: [contentElement, Boolean(feedbackText) && /* @__PURE__ */ jsx("p", {
|
|
76
|
+
...itemComponentsProps.error,
|
|
72
77
|
id: feedbackId,
|
|
73
|
-
className: cn("text-[0.8rem]", spacingConfig.feedback, feedbackStatus === "error" && "text-destructive font-medium", feedbackStatus === "warning" && "text-amber-600", feedbackStatus === "success" && "text-green-600",
|
|
78
|
+
className: cn("text-[0.8rem]", spacingConfig.feedback, feedbackStatus === "error" && "text-destructive font-medium", feedbackStatus === "warning" && "text-amber-600", feedbackStatus === "success" && "text-green-600", itemComponentsProps.error?.className),
|
|
74
79
|
children: typeof feedbackText === "string" ? feedbackText.split("\n").map((line, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [line, index < feedbackText.split("\n").length - 1 && /* @__PURE__ */ jsx("br", {})] }, index)) : feedbackText
|
|
75
80
|
})]
|
|
76
81
|
});
|
|
@@ -2,7 +2,7 @@ import { FormContextStates } from "./context/form-context.cjs";
|
|
|
2
2
|
import "./context/index.cjs";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { Form } from "@formily/core";
|
|
5
|
-
import * as
|
|
5
|
+
import * as react_jsx_runtime1 from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
//#region src/components/form.d.ts
|
|
8
8
|
interface IFormProps extends FormContextStates {
|
|
@@ -25,6 +25,6 @@ declare function Form$1({
|
|
|
25
25
|
onAutoSubmit,
|
|
26
26
|
layout,
|
|
27
27
|
settings
|
|
28
|
-
}: IFormProps):
|
|
28
|
+
}: IFormProps): react_jsx_runtime1.JSX.Element;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { Form$1 as Form };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormContextStates } from "./context/form-context.js";
|
|
2
2
|
import "./context/index.js";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
5
|
import { Form } from "@formily/core";
|
|
6
6
|
|
|
7
7
|
//#region src/components/form.d.ts
|
|
@@ -25,6 +25,6 @@ declare function Form$1({
|
|
|
25
25
|
onAutoSubmit,
|
|
26
26
|
layout,
|
|
27
27
|
settings
|
|
28
|
-
}: IFormProps):
|
|
28
|
+
}: IFormProps): react_jsx_runtime0.JSX.Element;
|
|
29
29
|
//#endregion
|
|
30
30
|
export { Form$1 as Form };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react4 from "react";
|
|
2
2
|
import { IconPickerProps, IconProviderProps } from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/icon-picker.d.ts
|
|
@@ -8,8 +8,8 @@ import { IconPickerProps, IconProviderProps } from "@pixpilot/shadcn-ui";
|
|
|
8
8
|
* Automatically connects to Formily field state
|
|
9
9
|
* Supports both static and async icon providers
|
|
10
10
|
*/
|
|
11
|
-
declare const IconPicker$1:
|
|
11
|
+
declare const IconPicker$1: react4.ForwardRefExoticComponent<Partial<Omit<IconPickerProps, "providers"> & {
|
|
12
12
|
providers?: IconProviderProps[];
|
|
13
|
-
}> &
|
|
13
|
+
}> & react4.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { IconPicker$1 as IconPicker };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react6 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/input.d.ts
|
|
4
4
|
|
|
@@ -6,6 +6,6 @@ import * as react4 from "react";
|
|
|
6
6
|
* Formily-connected Input component
|
|
7
7
|
* Automatically connects shadcn Input to Formily field state
|
|
8
8
|
*/
|
|
9
|
-
declare const Input:
|
|
9
|
+
declare const Input: react6.ForwardRefExoticComponent<Omit<Partial<react6.ClassAttributes<HTMLInputElement> & react6.InputHTMLAttributes<HTMLInputElement>>, "ref"> & react6.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Input };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react6 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/input.d.ts
|
|
4
4
|
|
|
@@ -6,6 +6,6 @@ import * as react4 from "react";
|
|
|
6
6
|
* Formily-connected Input component
|
|
7
7
|
* Automatically connects shadcn Input to Formily field state
|
|
8
8
|
*/
|
|
9
|
-
declare const Input:
|
|
9
|
+
declare const Input: react6.ForwardRefExoticComponent<Omit<Partial<react6.ClassAttributes<HTMLInputElement> & react6.InputHTMLAttributes<HTMLInputElement>>, "ref"> & react6.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Input };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react24 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/number/number-input.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Formily-connected Number Input component
|
|
6
6
|
*/
|
|
7
|
-
declare const NumberInput:
|
|
7
|
+
declare const NumberInput: react24.ForwardRefExoticComponent<Omit<Partial<react24.ClassAttributes<HTMLInputElement> & react24.InputHTMLAttributes<HTMLInputElement>>, "ref"> & react24.RefAttributes<unknown>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { NumberInput };
|
|
@@ -35,7 +35,7 @@ const cardPaddingConfig = {
|
|
|
35
35
|
},
|
|
36
36
|
responsive: "py-5 md:py-6 lg:py-7"
|
|
37
37
|
};
|
|
38
|
-
const ObjectContainer = ({ className, children, label, description,...rest }) => {
|
|
38
|
+
const ObjectContainer = ({ className, children, label, description, slotProps,...rest }) => {
|
|
39
39
|
const effectiveLabel = require_use_label.useLabel(label);
|
|
40
40
|
const desc = require_use_description.useDescription(description);
|
|
41
41
|
const { layout } = require_use_form_context.useFormContext();
|
|
@@ -43,22 +43,52 @@ const ObjectContainer = ({ className, children, label, description,...rest }) =>
|
|
|
43
43
|
const gapClass = require_resolve_responsive_space.resolveResponsiveGapClass({ density });
|
|
44
44
|
const headerGapClass = require_resolve_responsive_space.resolveSpacingClass(density, headerConfig);
|
|
45
45
|
const cardPaddingClass = require_resolve_responsive_space.resolveSpacingClass(density, cardPaddingConfig);
|
|
46
|
-
const {
|
|
46
|
+
const { card, content, description: contextDesc, header, title } = objectContainer || {};
|
|
47
|
+
const mergedCardProps = {
|
|
48
|
+
...card,
|
|
49
|
+
...slotProps?.card,
|
|
50
|
+
className: (0, __pixpilot_shadcn.cn)(card?.className, slotProps?.card?.className)
|
|
51
|
+
};
|
|
52
|
+
const mergedHeaderProps = {
|
|
53
|
+
...header,
|
|
54
|
+
...slotProps?.header,
|
|
55
|
+
className: (0, __pixpilot_shadcn.cn)(header?.className, slotProps?.header?.className)
|
|
56
|
+
};
|
|
57
|
+
const mergedTitleProps = {
|
|
58
|
+
...title,
|
|
59
|
+
...slotProps?.title,
|
|
60
|
+
className: (0, __pixpilot_shadcn.cn)(title?.className, slotProps?.title?.className)
|
|
61
|
+
};
|
|
62
|
+
const mergedDescProps = {
|
|
63
|
+
...contextDesc,
|
|
64
|
+
...slotProps?.description,
|
|
65
|
+
className: (0, __pixpilot_shadcn.cn)(contextDesc?.className, slotProps?.description?.className)
|
|
66
|
+
};
|
|
67
|
+
const mergedContentProps = {
|
|
68
|
+
...content,
|
|
69
|
+
...slotProps?.content,
|
|
70
|
+
className: (0, __pixpilot_shadcn.cn)(content?.className, slotProps?.content?.className)
|
|
71
|
+
};
|
|
47
72
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.Card, {
|
|
73
|
+
...mergedCardProps,
|
|
48
74
|
...rest,
|
|
49
|
-
className: (0, __pixpilot_shadcn.cn)("form-object-card", "bg-transparent", gapClass, cardPaddingClass, className,
|
|
75
|
+
className: (0, __pixpilot_shadcn.cn)("form-object-card", "bg-transparent", gapClass, cardPaddingClass, className, mergedCardProps.className),
|
|
50
76
|
children: [(effectiveLabel != null || desc != null) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__pixpilot_shadcn.CardHeader, {
|
|
51
|
-
|
|
77
|
+
...mergedHeaderProps,
|
|
78
|
+
className: (0, __pixpilot_shadcn.cn)("form-object-header", headerGapClass, mergedHeaderProps.className),
|
|
52
79
|
children: [effectiveLabel != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.CardTitle, {
|
|
53
|
-
|
|
80
|
+
...mergedTitleProps,
|
|
81
|
+
className: (0, __pixpilot_shadcn.cn)("form-object-title", mergedTitleProps.className),
|
|
54
82
|
children: effectiveLabel
|
|
55
83
|
}), desc != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__pixpilot_shadcn.CardDescription, {
|
|
56
|
-
|
|
84
|
+
...mergedDescProps,
|
|
85
|
+
className: (0, __pixpilot_shadcn.cn)("form-object-desc", mergedDescProps.className),
|
|
57
86
|
children: desc
|
|
58
87
|
})]
|
|
59
88
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_form_items_container.FormItemContainer, {
|
|
89
|
+
...mergedContentProps,
|
|
60
90
|
as: __pixpilot_shadcn.CardContent,
|
|
61
|
-
className: (0, __pixpilot_shadcn.cn)("form-object-container",
|
|
91
|
+
className: (0, __pixpilot_shadcn.cn)("form-object-container", mergedContentProps.className),
|
|
62
92
|
children
|
|
63
93
|
})]
|
|
64
94
|
});
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { SyncReactNode } from "../types/react.cjs";
|
|
2
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@pixpilot/shadcn";
|
|
2
3
|
|
|
3
4
|
//#region src/components/object-container.d.ts
|
|
4
5
|
interface ObjectContainerProps extends React.ComponentProps<'div'> {
|
|
5
6
|
label?: SyncReactNode;
|
|
6
7
|
description?: SyncReactNode;
|
|
8
|
+
slotProps?: {
|
|
9
|
+
card?: React.ComponentProps<typeof Card>;
|
|
10
|
+
header?: React.ComponentProps<typeof CardHeader>;
|
|
11
|
+
title?: React.ComponentProps<typeof CardTitle>;
|
|
12
|
+
description?: React.ComponentProps<typeof CardDescription>;
|
|
13
|
+
content?: React.ComponentProps<typeof CardContent>;
|
|
14
|
+
};
|
|
7
15
|
}
|
|
8
16
|
//#endregion
|
|
9
17
|
export { ObjectContainerProps };
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { SyncReactNode } from "../types/react.js";
|
|
2
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@pixpilot/shadcn";
|
|
2
3
|
|
|
3
4
|
//#region src/components/object-container.d.ts
|
|
4
5
|
interface ObjectContainerProps extends React.ComponentProps<'div'> {
|
|
5
6
|
label?: SyncReactNode;
|
|
6
7
|
description?: SyncReactNode;
|
|
8
|
+
slotProps?: {
|
|
9
|
+
card?: React.ComponentProps<typeof Card>;
|
|
10
|
+
header?: React.ComponentProps<typeof CardHeader>;
|
|
11
|
+
title?: React.ComponentProps<typeof CardTitle>;
|
|
12
|
+
description?: React.ComponentProps<typeof CardDescription>;
|
|
13
|
+
content?: React.ComponentProps<typeof CardContent>;
|
|
14
|
+
};
|
|
7
15
|
}
|
|
8
16
|
//#endregion
|
|
9
17
|
export { ObjectContainerProps };
|
|
@@ -32,7 +32,7 @@ const cardPaddingConfig = {
|
|
|
32
32
|
},
|
|
33
33
|
responsive: "py-5 md:py-6 lg:py-7"
|
|
34
34
|
};
|
|
35
|
-
const ObjectContainer = ({ className, children, label, description,...rest }) => {
|
|
35
|
+
const ObjectContainer = ({ className, children, label, description, slotProps,...rest }) => {
|
|
36
36
|
const effectiveLabel = useLabel(label);
|
|
37
37
|
const desc = useDescription(description);
|
|
38
38
|
const { layout } = useFormContext();
|
|
@@ -40,22 +40,52 @@ const ObjectContainer = ({ className, children, label, description,...rest }) =>
|
|
|
40
40
|
const gapClass = resolveResponsiveGapClass({ density });
|
|
41
41
|
const headerGapClass = resolveSpacingClass(density, headerConfig);
|
|
42
42
|
const cardPaddingClass = resolveSpacingClass(density, cardPaddingConfig);
|
|
43
|
-
const {
|
|
43
|
+
const { card, content, description: contextDesc, header, title } = objectContainer || {};
|
|
44
|
+
const mergedCardProps = {
|
|
45
|
+
...card,
|
|
46
|
+
...slotProps?.card,
|
|
47
|
+
className: cn(card?.className, slotProps?.card?.className)
|
|
48
|
+
};
|
|
49
|
+
const mergedHeaderProps = {
|
|
50
|
+
...header,
|
|
51
|
+
...slotProps?.header,
|
|
52
|
+
className: cn(header?.className, slotProps?.header?.className)
|
|
53
|
+
};
|
|
54
|
+
const mergedTitleProps = {
|
|
55
|
+
...title,
|
|
56
|
+
...slotProps?.title,
|
|
57
|
+
className: cn(title?.className, slotProps?.title?.className)
|
|
58
|
+
};
|
|
59
|
+
const mergedDescProps = {
|
|
60
|
+
...contextDesc,
|
|
61
|
+
...slotProps?.description,
|
|
62
|
+
className: cn(contextDesc?.className, slotProps?.description?.className)
|
|
63
|
+
};
|
|
64
|
+
const mergedContentProps = {
|
|
65
|
+
...content,
|
|
66
|
+
...slotProps?.content,
|
|
67
|
+
className: cn(content?.className, slotProps?.content?.className)
|
|
68
|
+
};
|
|
44
69
|
return /* @__PURE__ */ jsxs(Card, {
|
|
70
|
+
...mergedCardProps,
|
|
45
71
|
...rest,
|
|
46
|
-
className: cn("form-object-card", "bg-transparent", gapClass, cardPaddingClass, className,
|
|
72
|
+
className: cn("form-object-card", "bg-transparent", gapClass, cardPaddingClass, className, mergedCardProps.className),
|
|
47
73
|
children: [(effectiveLabel != null || desc != null) && /* @__PURE__ */ jsxs(CardHeader, {
|
|
48
|
-
|
|
74
|
+
...mergedHeaderProps,
|
|
75
|
+
className: cn("form-object-header", headerGapClass, mergedHeaderProps.className),
|
|
49
76
|
children: [effectiveLabel != null && /* @__PURE__ */ jsx(CardTitle, {
|
|
50
|
-
|
|
77
|
+
...mergedTitleProps,
|
|
78
|
+
className: cn("form-object-title", mergedTitleProps.className),
|
|
51
79
|
children: effectiveLabel
|
|
52
80
|
}), desc != null && /* @__PURE__ */ jsx(CardDescription, {
|
|
53
|
-
|
|
81
|
+
...mergedDescProps,
|
|
82
|
+
className: cn("form-object-desc", mergedDescProps.className),
|
|
54
83
|
children: desc
|
|
55
84
|
})]
|
|
56
85
|
}), /* @__PURE__ */ jsx(FormItemContainer, {
|
|
86
|
+
...mergedContentProps,
|
|
57
87
|
as: CardContent,
|
|
58
|
-
className: cn("form-object-container",
|
|
88
|
+
className: cn("form-object-container", mergedContentProps.className),
|
|
59
89
|
children
|
|
60
90
|
})]
|
|
61
91
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
-
import * as
|
|
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):
|
|
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
|
|
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):
|
|
39
|
+
}: IRowProps): react_jsx_runtime3.JSX.Element;
|
|
40
40
|
//#endregion
|
|
41
41
|
export { Row };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react10 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:
|
|
9
|
+
declare const Separator: react10.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_separator0.SeparatorProps & react10.RefAttributes<HTMLDivElement>>, "ref"> & react10.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Separator };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as react1447 from "react";
|
|
2
|
+
import * as _pixpilot_shadcn_ui357 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/slider/slider-input.d.ts
|
|
5
|
-
declare const SliderInput$1:
|
|
5
|
+
declare const SliderInput$1: react1447.ForwardRefExoticComponent<Omit<Partial<_pixpilot_shadcn_ui357.SliderInputProps>, "ref"> & react1447.RefAttributes<unknown>>;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { SliderInput$1 as SliderInput };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as react1449 from "react";
|
|
2
|
+
import * as _pixpilot_shadcn_ui358 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/slider/slider.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Formily-connected Slider component
|
|
7
7
|
* Range input for selecting numeric values
|
|
8
8
|
*/
|
|
9
|
-
declare const Slider$1:
|
|
9
|
+
declare const Slider$1: react1449.ForwardRefExoticComponent<Omit<Partial<_pixpilot_shadcn_ui358.SliderProps>, "ref"> & react1449.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Slider$1 as Slider };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react13 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:
|
|
9
|
+
declare const Switch: react13.ForwardRefExoticComponent<Omit<Partial<_radix_ui_react_switch0.SwitchProps & react13.RefAttributes<HTMLButtonElement>>, "ref"> & react13.RefAttributes<unknown>>;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { Switch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react16 from "react";
|
|
2
2
|
import * as _pixpilot_shadcn_ui0 from "@pixpilot/shadcn-ui";
|
|
3
3
|
|
|
4
4
|
//#region src/components/tags-input-inline.d.ts
|
|
@@ -10,6 +10,6 @@ import * as _pixpilot_shadcn_ui0 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:
|
|
13
|
+
declare const TagsInputInLine: react16.ForwardRefExoticComponent<Partial<_pixpilot_shadcn_ui0.TagsInputProps> & react16.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { TagsInputInLine };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react18 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:
|
|
7
|
+
declare const Textarea: react18.ForwardRefExoticComponent<Omit<Partial<react18.ClassAttributes<HTMLTextAreaElement> & react18.TextareaHTMLAttributes<HTMLTextAreaElement>>, "ref"> & react18.RefAttributes<unknown>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { Textarea };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixpilot/formily-shadcn",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.19.0",
|
|
5
5
|
"description": "Formily integration for shadcn/ui components",
|
|
6
6
|
"author": "m.doaie <m.doaie@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
"react-dom": "19.2.0",
|
|
55
55
|
"tsdown": "^0.15.12",
|
|
56
56
|
"typescript": "^5.9.3",
|
|
57
|
-
"@internal/eslint-config": "0.3.0",
|
|
58
57
|
"@internal/prettier-config": "0.0.1",
|
|
59
|
-
"@internal/tsconfig": "0.1.0",
|
|
60
58
|
"@internal/tsdown-config": "0.1.0",
|
|
61
|
-
"@internal/vitest-config": "0.1.0"
|
|
59
|
+
"@internal/vitest-config": "0.1.0",
|
|
60
|
+
"@internal/tsconfig": "0.1.0",
|
|
61
|
+
"@internal/eslint-config": "0.3.0"
|
|
62
62
|
},
|
|
63
63
|
"prettier": "@internal/prettier-config",
|
|
64
64
|
"scripts": {
|