shadcn-zod-formkit 1.14.0 → 1.15.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/index.d.mts CHANGED
@@ -205,8 +205,10 @@ interface Props$4<T extends Record<string, any>> {
205
205
  withCard?: boolean;
206
206
  submitBtnLabel?: string;
207
207
  submitBtnClass?: string;
208
+ children?: ReactNode;
209
+ childrenHeader?: ReactNode;
208
210
  }
209
- declare const DynamicForm: <T extends Record<string, any>>({ formTitle, formSubTitle, fields, readOnly, record, onSubmit, extraValidations, withErrorsAlert, errorAlertPosition, withCard, submitBtnClass, submitBtnLabel, }: Props$4<T>) => react_jsx_runtime.JSX.Element;
211
+ declare const DynamicForm: <T extends Record<string, any>>({ formTitle, formSubTitle, fields, readOnly, record, onSubmit, extraValidations, children, childrenHeader, withErrorsAlert, errorAlertPosition, withCard, submitBtnClass, submitBtnLabel, }: Props$4<T>) => react_jsx_runtime.JSX.Element;
210
212
 
211
213
  declare const DynamicFormExample: () => react_jsx_runtime.JSX.Element;
212
214
  declare const mockFields: Array<FieldProps | FieldProps[]>;
package/dist/index.d.ts CHANGED
@@ -205,8 +205,10 @@ interface Props$4<T extends Record<string, any>> {
205
205
  withCard?: boolean;
206
206
  submitBtnLabel?: string;
207
207
  submitBtnClass?: string;
208
+ children?: ReactNode;
209
+ childrenHeader?: ReactNode;
208
210
  }
209
- declare const DynamicForm: <T extends Record<string, any>>({ formTitle, formSubTitle, fields, readOnly, record, onSubmit, extraValidations, withErrorsAlert, errorAlertPosition, withCard, submitBtnClass, submitBtnLabel, }: Props$4<T>) => react_jsx_runtime.JSX.Element;
211
+ declare const DynamicForm: <T extends Record<string, any>>({ formTitle, formSubTitle, fields, readOnly, record, onSubmit, extraValidations, children, childrenHeader, withErrorsAlert, errorAlertPosition, withCard, submitBtnClass, submitBtnLabel, }: Props$4<T>) => react_jsx_runtime.JSX.Element;
210
212
 
211
213
  declare const DynamicFormExample: () => react_jsx_runtime.JSX.Element;
212
214
  declare const mockFields: Array<FieldProps | FieldProps[]>;
package/dist/index.mjs CHANGED
@@ -5424,6 +5424,8 @@ var DynamicForm = ({
5424
5424
  record = {},
5425
5425
  onSubmit,
5426
5426
  extraValidations,
5427
+ children,
5428
+ childrenHeader,
5427
5429
  withErrorsAlert = true,
5428
5430
  errorAlertPosition = "up",
5429
5431
  withCard = false,
@@ -5453,12 +5455,18 @@ var DynamicForm = ({
5453
5455
  }
5454
5456
  };
5455
5457
  const formContent = /* @__PURE__ */ jsxs("div", { children: [
5456
- /* @__PURE__ */ jsxs(CardTitle, { className: "flex items-center gap-2 p-2 border-b", children: [
5457
- /* @__PURE__ */ jsx(Pencil, { className: "h-5 w-5" }),
5458
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
5459
- /* @__PURE__ */ jsx("p", { children: formTitle }),
5460
- formSubTitle && /* @__PURE__ */ jsx(CardDescription, { children: formSubTitle })
5461
- ] })
5458
+ /* @__PURE__ */ jsxs(CardTitle, { className: "flex flex-row items-center gap-2 p-2 border-b", children: [
5459
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 w-full", children: [
5460
+ /* @__PURE__ */ jsx(Pencil, { className: "h-5 w-5" }),
5461
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
5462
+ /* @__PURE__ */ jsxs(CardTitle, { className: "text-xl", children: [
5463
+ formTitle,
5464
+ " "
5465
+ ] }),
5466
+ formSubTitle && /* @__PURE__ */ jsx(CardDescription, { children: formSubTitle })
5467
+ ] })
5468
+ ] }),
5469
+ childrenHeader && /* @__PURE__ */ jsx("div", { className: "flex flex-row items-center gap-2 w-full h-full", children: childrenHeader })
5462
5470
  ] }),
5463
5471
  withErrorsAlert && errorAlertPosition === "up" && /* @__PURE__ */ jsx(FormErrorsAlert, { formState: form.formState, fields }),
5464
5472
  /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs(
@@ -5467,7 +5475,10 @@ var DynamicForm = ({
5467
5475
  onSubmit: form.handleSubmit(handleSubmit),
5468
5476
  className: `flex flex-col gap-2 ${readOnly ? "opacity-70 pointer-events-none select-none" : ""}`,
5469
5477
  children: [
5470
- /* @__PURE__ */ jsx("div", { className: "w-full grid grid-cols-1", children: /* @__PURE__ */ jsx(FormFieldsGrid, { fields, form, readOnly }) }),
5478
+ /* @__PURE__ */ jsxs("div", { className: "w-full grid grid-cols-1", children: [
5479
+ /* @__PURE__ */ jsx(FormFieldsGrid, { fields, form, readOnly }),
5480
+ children && /* @__PURE__ */ jsx("div", { className: "flex flex-row items-center gap-2 w-full h-full", children })
5481
+ ] }),
5471
5482
  !readOnly && /* @__PURE__ */ jsx("div", { className: "flex flex-row gap-2 justify-end items-end", children: /* @__PURE__ */ jsx(Button, { type: "submit", size: "lg", className: submitBtnClass, disabled: isPending, children: isPending ? /* @__PURE__ */ jsxs(Fragment, { children: [
5472
5483
  /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
5473
5484
  "Guardando..."