shadcn-zod-formkit 1.16.0 → 1.18.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
@@ -203,6 +203,7 @@ interface Props$4<T extends Record<string, any>> {
203
203
  fields: Array<FieldProps<T> | FieldProps<T>[]>;
204
204
  record?: Partial<T>;
205
205
  onSubmit?: (resp: FormResp<T>) => void;
206
+ onClick?: () => void;
206
207
  extraValidations?: ((schema: ZodObject<any>) => ZodObject<any>)[];
207
208
  withErrorsAlert?: boolean;
208
209
  errorAlertPosition?: alertPositionType;
@@ -212,7 +213,7 @@ interface Props$4<T extends Record<string, any>> {
212
213
  children?: ReactNode;
213
214
  childrenHeader?: ReactNode;
214
215
  }
215
- declare const DynamicForm: <T extends Record<string, any>>({ formTitle, formSubTitle, fields, readOnly, record, onSubmit, extraValidations, children, childrenHeader, showIcon, showFormHeader, withErrorsAlert, errorAlertPosition, withCard, submitBtnClass, submitBtnLabel, }: Props$4<T>) => react_jsx_runtime.JSX.Element;
216
+ declare const DynamicForm: <T extends Record<string, any>>({ formTitle, formSubTitle, fields, readOnly, record, onSubmit, onClick, extraValidations, children, childrenHeader, showIcon, showFormHeader, withErrorsAlert, errorAlertPosition, withCard, submitBtnClass, submitBtnLabel, }: Props$4<T>) => react_jsx_runtime.JSX.Element;
216
217
 
217
218
  declare const DynamicFormExample: () => react_jsx_runtime.JSX.Element;
218
219
  declare const mockFields: Array<FieldProps | FieldProps[]>;
package/dist/index.d.ts CHANGED
@@ -203,6 +203,7 @@ interface Props$4<T extends Record<string, any>> {
203
203
  fields: Array<FieldProps<T> | FieldProps<T>[]>;
204
204
  record?: Partial<T>;
205
205
  onSubmit?: (resp: FormResp<T>) => void;
206
+ onClick?: () => void;
206
207
  extraValidations?: ((schema: ZodObject<any>) => ZodObject<any>)[];
207
208
  withErrorsAlert?: boolean;
208
209
  errorAlertPosition?: alertPositionType;
@@ -212,7 +213,7 @@ interface Props$4<T extends Record<string, any>> {
212
213
  children?: ReactNode;
213
214
  childrenHeader?: ReactNode;
214
215
  }
215
- declare const DynamicForm: <T extends Record<string, any>>({ formTitle, formSubTitle, fields, readOnly, record, onSubmit, extraValidations, children, childrenHeader, showIcon, showFormHeader, withErrorsAlert, errorAlertPosition, withCard, submitBtnClass, submitBtnLabel, }: Props$4<T>) => react_jsx_runtime.JSX.Element;
216
+ declare const DynamicForm: <T extends Record<string, any>>({ formTitle, formSubTitle, fields, readOnly, record, onSubmit, onClick, extraValidations, children, childrenHeader, showIcon, showFormHeader, withErrorsAlert, errorAlertPosition, withCard, submitBtnClass, submitBtnLabel, }: Props$4<T>) => react_jsx_runtime.JSX.Element;
216
217
 
217
218
  declare const DynamicFormExample: () => react_jsx_runtime.JSX.Element;
218
219
  declare const mockFields: Array<FieldProps | FieldProps[]>;
package/dist/index.mjs CHANGED
@@ -5582,14 +5582,16 @@ var DynamicForm = ({
5582
5582
  readOnly = false,
5583
5583
  record = {},
5584
5584
  onSubmit,
5585
+ onClick,
5585
5586
  extraValidations,
5586
5587
  children,
5587
5588
  childrenHeader,
5588
- showIcon = true,
5589
+ showIcon = false,
5589
5590
  showFormHeader = true,
5590
5591
  withErrorsAlert = true,
5591
5592
  errorAlertPosition = "up",
5592
5593
  withCard = false,
5594
+ // btnType = 'submit',
5593
5595
  submitBtnClass = "",
5594
5596
  submitBtnLabel = "Guardar"
5595
5597
  }) => {
@@ -5620,7 +5622,7 @@ var DynamicForm = ({
5620
5622
  /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 w-full", children: [
5621
5623
  showIcon && /* @__PURE__ */ jsx(Pencil, { className: "h-5 w-5" }),
5622
5624
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
5623
- /* @__PURE__ */ jsxs(CardTitle, { className: "text-xl", children: [
5625
+ /* @__PURE__ */ jsxs("div", { className: "text-xl", children: [
5624
5626
  formTitle,
5625
5627
  " "
5626
5628
  ] }),
@@ -5640,7 +5642,7 @@ var DynamicForm = ({
5640
5642
  /* @__PURE__ */ jsx(FormFieldsGrid, { fields, form, readOnly }),
5641
5643
  children && /* @__PURE__ */ jsx("div", { className: "flex flex-row items-center gap-2 w-full h-full", children })
5642
5644
  ] }),
5643
- !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: [
5645
+ !readOnly && /* @__PURE__ */ jsx("div", { className: "flex flex-row gap-2 justify-end items-end", children: /* @__PURE__ */ jsx(Button, { type: onClick ? "button" : "submit", size: "lg", className: submitBtnClass, disabled: isPending, onClick, children: isPending ? /* @__PURE__ */ jsxs(Fragment, { children: [
5644
5646
  /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
5645
5647
  "Guardando..."
5646
5648
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [