@pixpilot/formily-shadcn 1.12.8 → 1.13.1
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/Form.cjs +1 -1
- package/dist/components/Form.js +1 -1
- package/dist/components/context/types.d.cts +5 -8
- package/dist/components/context/types.d.ts +5 -8
- package/dist/components/form-item/BaseFormItem.cjs +6 -6
- package/dist/components/form-item/BaseFormItem.js +6 -6
- package/dist/components/form-item/ConnectedFormItem.cjs +6 -8
- package/dist/components/form-item/ConnectedFormItem.d.cts +4 -4
- package/dist/components/form-item/ConnectedFormItem.js +6 -8
- package/dist/components/form-item/FormItem.d.cts +1 -1
- package/dist/components/form-item/FormItem.d.ts +1 -1
- package/dist/components/form-item/FormItemLabel.cjs +5 -4
- package/dist/components/form-item/FormItemLabel.js +5 -4
- package/dist/components/form-item/form-item-types.d.cts +8 -1
- package/dist/components/form-item/form-item-types.d.ts +8 -1
- package/dist/components/form-item/index.d.cts +1 -1
- package/dist/components/form-item/index.d.ts +1 -1
- package/dist/components/number/NumberInput.d.ts +3 -3
- package/dist/components/schema-field/schema-field-basics.d.cts +288 -288
- package/dist/components/schema-field/schema-field-basics.d.ts +303 -303
- package/dist/components/schema-field/schema-field-extended.d.cts +495 -495
- package/dist/components/schema-field/schema-field-extended.d.ts +501 -501
- package/dist/components/schema-field/schema-field.d.cts +398 -398
- package/dist/components/schema-field/schema-field.d.ts +412 -412
- package/dist/components/slider/Slider.d.ts +3 -3
- package/dist/components/slider/SliderInput.d.ts +3 -3
- package/dist/components/slider/SliderSelect.d.cts +3 -3
- package/dist/components/slider/SliderSelect.d.ts +3 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/types/form-item.d.cts +1 -2
- package/dist/types/form-item.d.ts +1 -2
- package/dist/utils/resolve-responsive-space.cjs +6 -6
- package/dist/utils/resolve-responsive-space.js +6 -6
- package/package.json +3 -3
package/dist/components/Form.cjs
CHANGED
|
@@ -35,7 +35,7 @@ function Form({ form, id, className, style, children, onSubmit, onAutoSubmit, la
|
|
|
35
35
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FormItemContainer.FormItemContainer, {
|
|
36
36
|
as: "form",
|
|
37
37
|
id,
|
|
38
|
-
className: (0, __pixpilot_shadcn.cn)(className),
|
|
38
|
+
className: (0, __pixpilot_shadcn.cn)("flex flex-col", className),
|
|
39
39
|
style,
|
|
40
40
|
onSubmit: handleSubmit,
|
|
41
41
|
children
|
package/dist/components/Form.js
CHANGED
|
@@ -30,7 +30,7 @@ function Form({ form, id, className, style, children, onSubmit, onAutoSubmit, la
|
|
|
30
30
|
children: /* @__PURE__ */ jsx(FormItemContainer, {
|
|
31
31
|
as: "form",
|
|
32
32
|
id,
|
|
33
|
-
className: cn(className),
|
|
33
|
+
className: cn("flex flex-col", className),
|
|
34
34
|
style,
|
|
35
35
|
onSubmit: handleSubmit,
|
|
36
36
|
children
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ActionItem } from "../array-base/types.cjs";
|
|
2
2
|
import "../array-base/index.cjs";
|
|
3
3
|
import { FormSpace } from "../../types/form.cjs";
|
|
4
|
-
import { DescriptionPlacement, LabelPlacement } from "../../types/form-item.cjs";
|
|
5
4
|
import { FormFileUploadOptions } from "../file-upload/types.cjs";
|
|
6
5
|
import "../file-upload/index.cjs";
|
|
6
|
+
import { FormItemDescriptionProps, FormItemLabelProps } from "../form-item/form-item-types.cjs";
|
|
7
|
+
import "../form-item/index.cjs";
|
|
7
8
|
import { DialogContentProps, IconProvider, PopoverContentProps, RichTextEditorProps } from "@pixpilot/shadcn-ui";
|
|
8
9
|
|
|
9
10
|
//#region src/components/context/types.d.ts
|
|
@@ -53,14 +54,10 @@ interface FormSettings {
|
|
|
53
54
|
interface FormLayoutOptions {
|
|
54
55
|
/** Form density - affects spacing between elements */
|
|
55
56
|
density?: FormSpace['density'];
|
|
56
|
-
/**
|
|
57
|
-
descriptionPlacement?: DescriptionPlacement;
|
|
58
|
-
/** Default label placement for FormItem decorators */
|
|
59
|
-
labelPlacement?: LabelPlacement;
|
|
60
|
-
/** Custom class names for FormItem elements */
|
|
57
|
+
/** Custom props for FormItem elements */
|
|
61
58
|
itemProps?: {
|
|
62
|
-
label?:
|
|
63
|
-
description?:
|
|
59
|
+
label?: FormItemLabelProps;
|
|
60
|
+
description?: FormItemDescriptionProps;
|
|
64
61
|
inputWrapper?: React.HTMLAttributes<HTMLDivElement>;
|
|
65
62
|
error?: React.HTMLAttributes<HTMLParagraphElement>;
|
|
66
63
|
container?: React.HTMLAttributes<HTMLDivElement>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ActionItem } from "../array-base/types.js";
|
|
2
2
|
import "../array-base/index.js";
|
|
3
3
|
import { FormSpace } from "../../types/form.js";
|
|
4
|
-
import { DescriptionPlacement, LabelPlacement } from "../../types/form-item.js";
|
|
5
4
|
import { FormFileUploadOptions } from "../file-upload/types.js";
|
|
6
5
|
import "../file-upload/index.js";
|
|
6
|
+
import { FormItemDescriptionProps, FormItemLabelProps } from "../form-item/form-item-types.js";
|
|
7
|
+
import "../form-item/index.js";
|
|
7
8
|
import { DialogContentProps, IconProvider, PopoverContentProps, RichTextEditorProps } from "@pixpilot/shadcn-ui";
|
|
8
9
|
|
|
9
10
|
//#region src/components/context/types.d.ts
|
|
@@ -53,14 +54,10 @@ interface FormSettings {
|
|
|
53
54
|
interface FormLayoutOptions {
|
|
54
55
|
/** Form density - affects spacing between elements */
|
|
55
56
|
density?: FormSpace['density'];
|
|
56
|
-
/**
|
|
57
|
-
descriptionPlacement?: DescriptionPlacement;
|
|
58
|
-
/** Default label placement for FormItem decorators */
|
|
59
|
-
labelPlacement?: LabelPlacement;
|
|
60
|
-
/** Custom class names for FormItem elements */
|
|
57
|
+
/** Custom props for FormItem elements */
|
|
61
58
|
itemProps?: {
|
|
62
|
-
label?:
|
|
63
|
-
description?:
|
|
59
|
+
label?: FormItemLabelProps;
|
|
60
|
+
description?: FormItemDescriptionProps;
|
|
64
61
|
inputWrapper?: React.HTMLAttributes<HTMLDivElement>;
|
|
65
62
|
error?: React.HTMLAttributes<HTMLParagraphElement>;
|
|
66
63
|
container?: React.HTMLAttributes<HTMLDivElement>;
|
|
@@ -19,7 +19,7 @@ __pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
|
19
19
|
function resolveLegacyDescriptionPlacement(labelPlacement) {
|
|
20
20
|
return labelPlacement === "top" ? "top" : "bottom";
|
|
21
21
|
}
|
|
22
|
-
const BaseFormItem = ({ className, children, label, description, descriptionPlacement, asterisk, feedbackStatus, feedbackText, slots,...props }) => {
|
|
22
|
+
const BaseFormItem = ({ className, children, label, description, descriptionPlacement, requiredMark, asterisk, feedbackStatus, feedbackText, slots,...props }) => {
|
|
23
23
|
const field = (0, __formily_react.useField)();
|
|
24
24
|
const fieldDecoratorProps = field?.decoratorProps;
|
|
25
25
|
const fieldComponentProps = field?.componentProps;
|
|
@@ -29,8 +29,8 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
29
29
|
const effectiveLabel = require_use_label.useLabel(label);
|
|
30
30
|
const { layout } = require_use_form_context.useFormContext();
|
|
31
31
|
const itemComponentsProps = layout?.itemProps || {};
|
|
32
|
-
const contextDescriptionPlacement =
|
|
33
|
-
const contextLabelPlacement =
|
|
32
|
+
const { placement: contextDescriptionPlacement,...itemDescriptionProps } = itemComponentsProps.description ?? {};
|
|
33
|
+
const contextLabelPlacement = itemComponentsProps.label?.placement;
|
|
34
34
|
const fieldLabelPlacement = fieldLabelProps?.placement ?? fieldDecoratorProps?.labelPlacement ?? fieldComponentProps?.labelPlacement;
|
|
35
35
|
const propLabelPlacement = slots?.label?.placement;
|
|
36
36
|
const effectiveLabelPlacement = fieldLabelPlacement ?? propLabelPlacement ?? contextLabelPlacement ?? "top";
|
|
@@ -45,7 +45,7 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
45
45
|
"data-slot": "form-item-label",
|
|
46
46
|
id: (0, __pixpilot_shadcn_ui.getId)(id, "label"),
|
|
47
47
|
label: effectiveLabel,
|
|
48
|
-
asterisk,
|
|
48
|
+
requiredMark: requiredMark !== void 0 ? requiredMark : asterisk,
|
|
49
49
|
error: feedbackStatus === "error",
|
|
50
50
|
shrink: effectiveLabelPlacement === "end" || effectiveLabelPlacement === "start",
|
|
51
51
|
labelProps: {
|
|
@@ -70,10 +70,10 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
70
70
|
});
|
|
71
71
|
const descriptionElement = descriptionRenderedInline ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
72
72
|
"data-slot": "form-item-description",
|
|
73
|
-
...
|
|
73
|
+
...itemDescriptionProps,
|
|
74
74
|
...slots?.description,
|
|
75
75
|
id: descriptionId,
|
|
76
|
-
className: (0, __pixpilot_shadcn.cn)("text-muted-foreground text-[0.8rem]", spacingConfig.description,
|
|
76
|
+
className: (0, __pixpilot_shadcn.cn)("text-muted-foreground text-[0.8rem]", spacingConfig.description, itemDescriptionProps.className, slots?.description?.className),
|
|
77
77
|
children: description
|
|
78
78
|
}) : null;
|
|
79
79
|
const contentElement = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
@@ -13,7 +13,7 @@ import { cn as cn$1 } from "@pixpilot/shadcn";
|
|
|
13
13
|
function resolveLegacyDescriptionPlacement(labelPlacement) {
|
|
14
14
|
return labelPlacement === "top" ? "top" : "bottom";
|
|
15
15
|
}
|
|
16
|
-
const BaseFormItem = ({ className, children, label, description, descriptionPlacement, asterisk, feedbackStatus, feedbackText, slots,...props }) => {
|
|
16
|
+
const BaseFormItem = ({ className, children, label, description, descriptionPlacement, requiredMark, asterisk, feedbackStatus, feedbackText, slots,...props }) => {
|
|
17
17
|
const field = useField();
|
|
18
18
|
const fieldDecoratorProps = field?.decoratorProps;
|
|
19
19
|
const fieldComponentProps = field?.componentProps;
|
|
@@ -23,8 +23,8 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
23
23
|
const effectiveLabel = useLabel(label);
|
|
24
24
|
const { layout } = useFormContext();
|
|
25
25
|
const itemComponentsProps = layout?.itemProps || {};
|
|
26
|
-
const contextDescriptionPlacement =
|
|
27
|
-
const contextLabelPlacement =
|
|
26
|
+
const { placement: contextDescriptionPlacement,...itemDescriptionProps } = itemComponentsProps.description ?? {};
|
|
27
|
+
const contextLabelPlacement = itemComponentsProps.label?.placement;
|
|
28
28
|
const fieldLabelPlacement = fieldLabelProps?.placement ?? fieldDecoratorProps?.labelPlacement ?? fieldComponentProps?.labelPlacement;
|
|
29
29
|
const propLabelPlacement = slots?.label?.placement;
|
|
30
30
|
const effectiveLabelPlacement = fieldLabelPlacement ?? propLabelPlacement ?? contextLabelPlacement ?? "top";
|
|
@@ -39,7 +39,7 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
39
39
|
"data-slot": "form-item-label",
|
|
40
40
|
id: getId(id, "label"),
|
|
41
41
|
label: effectiveLabel,
|
|
42
|
-
asterisk,
|
|
42
|
+
requiredMark: requiredMark !== void 0 ? requiredMark : asterisk,
|
|
43
43
|
error: feedbackStatus === "error",
|
|
44
44
|
shrink: effectiveLabelPlacement === "end" || effectiveLabelPlacement === "start",
|
|
45
45
|
labelProps: {
|
|
@@ -64,10 +64,10 @@ const BaseFormItem = ({ className, children, label, description, descriptionPlac
|
|
|
64
64
|
});
|
|
65
65
|
const descriptionElement = descriptionRenderedInline ? /* @__PURE__ */ jsx("p", {
|
|
66
66
|
"data-slot": "form-item-description",
|
|
67
|
-
...
|
|
67
|
+
...itemDescriptionProps,
|
|
68
68
|
...slots?.description,
|
|
69
69
|
id: descriptionId,
|
|
70
|
-
className: cn$1("text-muted-foreground text-[0.8rem]", spacingConfig.description,
|
|
70
|
+
className: cn$1("text-muted-foreground text-[0.8rem]", spacingConfig.description, itemDescriptionProps.className, slots?.description?.className),
|
|
71
71
|
children: description
|
|
72
72
|
}) : null;
|
|
73
73
|
const contentElement = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -15,7 +15,7 @@ const FormItem = (0, __formily_react.connect)(require_BaseFormItem.BaseFormItem,
|
|
|
15
15
|
if ((0, __formily_core.isVoidField)(field)) return {
|
|
16
16
|
label: field.title ?? props.label,
|
|
17
17
|
description: props.description ?? field.description,
|
|
18
|
-
|
|
18
|
+
requiredMark: props.requiredMark !== void 0 ? props.requiredMark : props.asterisk
|
|
19
19
|
};
|
|
20
20
|
const takeFeedbackStatus = () => {
|
|
21
21
|
if (field.validating) return void 0;
|
|
@@ -30,18 +30,16 @@ const FormItem = (0, __formily_react.connect)(require_BaseFormItem.BaseFormItem,
|
|
|
30
30
|
if (field.selfWarnings?.length) return field.selfWarnings.join(", ");
|
|
31
31
|
if (field.selfSuccesses?.length) return field.selfSuccesses.join(", ");
|
|
32
32
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return false;
|
|
38
|
-
};
|
|
33
|
+
let resolvedRequiredMark = props.requiredMark;
|
|
34
|
+
if (resolvedRequiredMark === void 0) if (props.asterisk !== void 0) resolvedRequiredMark = Boolean(props.asterisk);
|
|
35
|
+
else if (schema.parent && Array.isArray(schema.parent.required) && schema.parent.required.includes(schema.name)) resolvedRequiredMark = true;
|
|
36
|
+
else resolvedRequiredMark = field.required && field.pattern !== "readPretty";
|
|
39
37
|
return {
|
|
40
38
|
label: props.label ?? field.title,
|
|
41
39
|
description: props.description ?? field.description,
|
|
42
40
|
feedbackStatus: takeFeedbackStatus(),
|
|
43
41
|
feedbackText: takeFeedbackText(),
|
|
44
|
-
|
|
42
|
+
requiredMark: resolvedRequiredMark
|
|
45
43
|
};
|
|
46
44
|
}));
|
|
47
45
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { FormItemProps } from "./form-item-types.cjs";
|
|
2
|
-
import * as
|
|
2
|
+
import * as react1889 from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/components/form-item/ConnectedFormItem.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* FormItem component connected to Formily field state.
|
|
7
7
|
* Automatically maps field validation state to component props.
|
|
8
8
|
*/
|
|
9
|
-
declare const FormItem:
|
|
10
|
-
children?:
|
|
11
|
-
}>, "ref"> &
|
|
9
|
+
declare const FormItem: react1889.ForwardRefExoticComponent<Omit<Partial<FormItemProps & {
|
|
10
|
+
children?: react1889.ReactNode | undefined;
|
|
11
|
+
}>, "ref"> & react1889.RefAttributes<unknown>>;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { FormItem };
|
|
@@ -12,7 +12,7 @@ const FormItem = connect(BaseFormItem, mapProps((props, field) => {
|
|
|
12
12
|
if (isVoidField(field)) return {
|
|
13
13
|
label: field.title ?? props.label,
|
|
14
14
|
description: props.description ?? field.description,
|
|
15
|
-
|
|
15
|
+
requiredMark: props.requiredMark !== void 0 ? props.requiredMark : props.asterisk
|
|
16
16
|
};
|
|
17
17
|
const takeFeedbackStatus = () => {
|
|
18
18
|
if (field.validating) return void 0;
|
|
@@ -27,18 +27,16 @@ const FormItem = connect(BaseFormItem, mapProps((props, field) => {
|
|
|
27
27
|
if (field.selfWarnings?.length) return field.selfWarnings.join(", ");
|
|
28
28
|
if (field.selfSuccesses?.length) return field.selfSuccesses.join(", ");
|
|
29
29
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return false;
|
|
35
|
-
};
|
|
30
|
+
let resolvedRequiredMark = props.requiredMark;
|
|
31
|
+
if (resolvedRequiredMark === void 0) if (props.asterisk !== void 0) resolvedRequiredMark = Boolean(props.asterisk);
|
|
32
|
+
else if (schema.parent && Array.isArray(schema.parent.required) && schema.parent.required.includes(schema.name)) resolvedRequiredMark = true;
|
|
33
|
+
else resolvedRequiredMark = field.required && field.pattern !== "readPretty";
|
|
36
34
|
return {
|
|
37
35
|
label: props.label ?? field.title,
|
|
38
36
|
description: props.description ?? field.description,
|
|
39
37
|
feedbackStatus: takeFeedbackStatus(),
|
|
40
38
|
feedbackText: takeFeedbackText(),
|
|
41
|
-
|
|
39
|
+
requiredMark: resolvedRequiredMark
|
|
42
40
|
};
|
|
43
41
|
}));
|
|
44
42
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DescriptionPlacement } from "../../types/form-item.cjs";
|
|
2
|
-
import { FormItemLabelProps, FormItemProps, FormItemSlots, LabelPlacement } from "./form-item-types.cjs";
|
|
2
|
+
import { FormItemDescriptionProps, FormItemLabelProps, FormItemProps, FormItemSlots, LabelPlacement } from "./form-item-types.cjs";
|
|
3
3
|
import "./BaseFormItem.cjs";
|
|
4
4
|
import { FormItem } from "./ConnectedFormItem.cjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DescriptionPlacement } from "../../types/form-item.js";
|
|
2
|
-
import { FormItemLabelProps, FormItemProps, FormItemSlots, LabelPlacement } from "./form-item-types.js";
|
|
2
|
+
import { FormItemDescriptionProps, FormItemLabelProps, FormItemProps, FormItemSlots, LabelPlacement } from "./form-item-types.js";
|
|
3
3
|
import "./BaseFormItem.js";
|
|
4
4
|
import { FormItem } from "./ConnectedFormItem.js";
|
|
@@ -6,8 +6,9 @@ let __pixpilot_shadcn = require("@pixpilot/shadcn");
|
|
|
6
6
|
__pixpilot_shadcn = require_rolldown_runtime.__toESM(__pixpilot_shadcn);
|
|
7
7
|
|
|
8
8
|
//#region src/components/form-item/FormItemLabel.tsx
|
|
9
|
-
function FormItemLabel({ id, label, asterisk, error, shrink, labelProps, description, descriptionInPopover }) {
|
|
9
|
+
function FormItemLabel({ id, label, requiredMark, asterisk, error, shrink, labelProps, description, descriptionInPopover }) {
|
|
10
10
|
const { className, placement: _placement,...restLabelProps } = labelProps ?? {};
|
|
11
|
+
const resolvedRequiredMark = requiredMark !== void 0 ? requiredMark : asterisk;
|
|
11
12
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
12
13
|
htmlFor: id,
|
|
13
14
|
"data-slot": "form-item-label",
|
|
@@ -21,11 +22,11 @@ function FormItemLabel({ id, label, asterisk, error, shrink, labelProps, descrip
|
|
|
21
22
|
"data-slot": "form-item-label-text",
|
|
22
23
|
children: label
|
|
23
24
|
}), descriptionInPopover && description != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FormItemDescriptionPopover.FormItemDescriptionPopover, { description })]
|
|
24
|
-
}),
|
|
25
|
-
"data-slot": "form-item-label-
|
|
25
|
+
}), resolvedRequiredMark !== false && resolvedRequiredMark != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
26
|
+
"data-slot": "form-item-label-required-mark",
|
|
26
27
|
className: "text-destructive ml-1",
|
|
27
28
|
"aria-label": "required",
|
|
28
|
-
children: "*"
|
|
29
|
+
children: resolvedRequiredMark === true ? "*" : resolvedRequiredMark
|
|
29
30
|
})]
|
|
30
31
|
});
|
|
31
32
|
}
|
|
@@ -3,8 +3,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { cn } from "@pixpilot/shadcn";
|
|
4
4
|
|
|
5
5
|
//#region src/components/form-item/FormItemLabel.tsx
|
|
6
|
-
function FormItemLabel({ id, label, asterisk, error, shrink, labelProps, description, descriptionInPopover }) {
|
|
6
|
+
function FormItemLabel({ id, label, requiredMark, asterisk, error, shrink, labelProps, description, descriptionInPopover }) {
|
|
7
7
|
const { className, placement: _placement,...restLabelProps } = labelProps ?? {};
|
|
8
|
+
const resolvedRequiredMark = requiredMark !== void 0 ? requiredMark : asterisk;
|
|
8
9
|
return /* @__PURE__ */ jsxs("label", {
|
|
9
10
|
htmlFor: id,
|
|
10
11
|
"data-slot": "form-item-label",
|
|
@@ -18,11 +19,11 @@ function FormItemLabel({ id, label, asterisk, error, shrink, labelProps, descrip
|
|
|
18
19
|
"data-slot": "form-item-label-text",
|
|
19
20
|
children: label
|
|
20
21
|
}), descriptionInPopover && description != null && /* @__PURE__ */ jsx(FormItemDescriptionPopover, { description })]
|
|
21
|
-
}),
|
|
22
|
-
"data-slot": "form-item-label-
|
|
22
|
+
}), resolvedRequiredMark !== false && resolvedRequiredMark != null && /* @__PURE__ */ jsx("span", {
|
|
23
|
+
"data-slot": "form-item-label-required-mark",
|
|
23
24
|
className: "text-destructive ml-1",
|
|
24
25
|
"aria-label": "required",
|
|
25
|
-
children: "*"
|
|
26
|
+
children: resolvedRequiredMark === true ? "*" : resolvedRequiredMark
|
|
26
27
|
})]
|
|
27
28
|
});
|
|
28
29
|
}
|
|
@@ -7,6 +7,9 @@ type LabelPlacement = 'top' | 'bottom' | 'start' | 'end';
|
|
|
7
7
|
type FormItemLabelProps = Omit<React.ComponentPropsWithoutRef<'label'>, 'children' | 'htmlFor'> & {
|
|
8
8
|
placement?: LabelPlacement;
|
|
9
9
|
};
|
|
10
|
+
type FormItemDescriptionProps = React.HTMLAttributes<HTMLParagraphElement> & {
|
|
11
|
+
placement?: DescriptionPlacement;
|
|
12
|
+
};
|
|
10
13
|
interface FormItemSlots {
|
|
11
14
|
label?: FormItemLabelProps;
|
|
12
15
|
description?: React.HTMLAttributes<HTMLParagraphElement>;
|
|
@@ -25,9 +28,13 @@ interface FormItemProps extends React.ComponentProps<'div'> {
|
|
|
25
28
|
* - `popover`: show a help icon before the label and render the description in a hover popover
|
|
26
29
|
*/
|
|
27
30
|
descriptionPlacement?: DescriptionPlacement;
|
|
31
|
+
requiredMark?: boolean | React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use `requiredMark` instead.
|
|
34
|
+
*/
|
|
28
35
|
asterisk?: boolean;
|
|
29
36
|
feedbackStatus?: 'error' | 'warning' | 'success';
|
|
30
37
|
feedbackText?: SyncReactNode;
|
|
31
38
|
}
|
|
32
39
|
//#endregion
|
|
33
|
-
export { FormItemLabelProps, FormItemProps, FormItemSlots, LabelPlacement };
|
|
40
|
+
export { FormItemDescriptionProps, FormItemLabelProps, FormItemProps, FormItemSlots, LabelPlacement };
|
|
@@ -7,6 +7,9 @@ type LabelPlacement = 'top' | 'bottom' | 'start' | 'end';
|
|
|
7
7
|
type FormItemLabelProps = Omit<React.ComponentPropsWithoutRef<'label'>, 'children' | 'htmlFor'> & {
|
|
8
8
|
placement?: LabelPlacement;
|
|
9
9
|
};
|
|
10
|
+
type FormItemDescriptionProps = React.HTMLAttributes<HTMLParagraphElement> & {
|
|
11
|
+
placement?: DescriptionPlacement;
|
|
12
|
+
};
|
|
10
13
|
interface FormItemSlots {
|
|
11
14
|
label?: FormItemLabelProps;
|
|
12
15
|
description?: React.HTMLAttributes<HTMLParagraphElement>;
|
|
@@ -25,9 +28,13 @@ interface FormItemProps extends React.ComponentProps<'div'> {
|
|
|
25
28
|
* - `popover`: show a help icon before the label and render the description in a hover popover
|
|
26
29
|
*/
|
|
27
30
|
descriptionPlacement?: DescriptionPlacement;
|
|
31
|
+
requiredMark?: boolean | React.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use `requiredMark` instead.
|
|
34
|
+
*/
|
|
28
35
|
asterisk?: boolean;
|
|
29
36
|
feedbackStatus?: 'error' | 'warning' | 'success';
|
|
30
37
|
feedbackText?: SyncReactNode;
|
|
31
38
|
}
|
|
32
39
|
//#endregion
|
|
33
|
-
export { FormItemLabelProps, FormItemProps, FormItemSlots, LabelPlacement };
|
|
40
|
+
export { FormItemDescriptionProps, FormItemLabelProps, FormItemProps, FormItemSlots, LabelPlacement };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DescriptionPlacement } from "../../types/form-item.cjs";
|
|
2
|
-
import { FormItemLabelProps, FormItemProps, FormItemSlots, LabelPlacement } from "./form-item-types.cjs";
|
|
2
|
+
import { FormItemDescriptionProps, FormItemLabelProps, FormItemProps, FormItemSlots, LabelPlacement } from "./form-item-types.cjs";
|
|
3
3
|
import { FormItem } from "./ConnectedFormItem.cjs";
|
|
4
4
|
import "./FormItem.cjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { DescriptionPlacement } from "../../types/form-item.js";
|
|
2
|
-
import { FormItemLabelProps, FormItemProps, FormItemSlots, LabelPlacement } from "./form-item-types.js";
|
|
2
|
+
import { FormItemDescriptionProps, FormItemLabelProps, FormItemProps, FormItemSlots, LabelPlacement } from "./form-item-types.js";
|
|
3
3
|
import { FormItem } from "./ConnectedFormItem.js";
|
|
4
4
|
import "./FormItem.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react37 from "react";
|
|
2
2
|
|
|
3
3
|
//#region src/components/number/NumberInput.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Formily-connected Number Input component
|
|
6
6
|
*/
|
|
7
|
-
declare const NumberInput:
|
|
7
|
+
declare const NumberInput: react37.ForwardRefExoticComponent<Omit<Partial<react37.ClassAttributes<HTMLInputElement> & react37.InputHTMLAttributes<HTMLInputElement> & {
|
|
8
8
|
prefix?: React.ReactNode;
|
|
9
9
|
suffix?: React.ReactNode;
|
|
10
10
|
groupClassName?: string;
|
|
11
11
|
prefixClassName?: string;
|
|
12
12
|
suffixClassName?: string;
|
|
13
|
-
}>, "ref"> &
|
|
13
|
+
}>, "ref"> & react37.RefAttributes<unknown>>;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { NumberInput };
|