@lets-events/react 11.7.1 → 11.7.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @lets-events/react@11.7.1 build
2
+ > @lets-events/react@11.7.2 build
3
3
  > tsup src/index.tsx --format esm,cjs --dts --external react
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist\index.js 332.02 KB
12
- CJS ⚡️ Build success in 316ms
13
- ESM dist\index.mjs 319.88 KB
14
- ESM ⚡️ Build success in 318ms
11
+ CJS dist\index.js 332.14 KB
12
+ CJS ⚡️ Build success in 234ms
13
+ ESM dist\index.mjs 320.00 KB
14
+ ESM ⚡️ Build success in 235ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4206ms
17
- DTS dist\index.d.mts 383.55 KB
18
- DTS dist\index.d.ts 383.55 KB
16
+ DTS ⚡️ Build success in 4217ms
17
+ DTS dist\index.d.mts 383.61 KB
18
+ DTS dist\index.d.ts 383.61 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @lets-events/react
2
2
 
3
+ ## 11.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - form child function
8
+
3
9
  ## 11.7.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -13,7 +13,7 @@ import { VariantProps } from '@stitches/react';
13
13
  import { MaskOptions, format, unformat } from '@react-input/mask';
14
14
  import { Dialog } from 'radix-ui';
15
15
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
16
- import { FieldError, Merge, FieldErrorsImpl, FieldValues, UseFormProps, SubmitHandler, useForm } from 'react-hook-form';
16
+ import { FieldError, Merge, FieldErrorsImpl, FieldValues, UseFormProps, SubmitHandler, UseFormReturn, useForm } from 'react-hook-form';
17
17
 
18
18
  interface IconProps extends Omit<FontAwesomeIconProps, "icon" | "size"> {
19
19
  name: IconName;
@@ -14535,7 +14535,7 @@ declare const TextFormField: ({ name, label, required, mask, validate, validatio
14535
14535
 
14536
14536
  type FormProps<T extends FieldValues = FieldValues> = UseFormProps<T> & {
14537
14537
  onSubmit: SubmitHandler<T>;
14538
- children: JSX.Element;
14538
+ children: JSX.Element | ((p: UseFormReturn<T, any, T>) => JSX.Element);
14539
14539
  methods?: ReturnType<typeof useForm<T>>;
14540
14540
  };
14541
14541
  declare const Form: <T extends FieldValues = FieldValues>({ onSubmit, children, ...props }: FormProps<T>) => react_jsx_runtime.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -13,7 +13,7 @@ import { VariantProps } from '@stitches/react';
13
13
  import { MaskOptions, format, unformat } from '@react-input/mask';
14
14
  import { Dialog } from 'radix-ui';
15
15
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
16
- import { FieldError, Merge, FieldErrorsImpl, FieldValues, UseFormProps, SubmitHandler, useForm } from 'react-hook-form';
16
+ import { FieldError, Merge, FieldErrorsImpl, FieldValues, UseFormProps, SubmitHandler, UseFormReturn, useForm } from 'react-hook-form';
17
17
 
18
18
  interface IconProps extends Omit<FontAwesomeIconProps, "icon" | "size"> {
19
19
  name: IconName;
@@ -14535,7 +14535,7 @@ declare const TextFormField: ({ name, label, required, mask, validate, validatio
14535
14535
 
14536
14536
  type FormProps<T extends FieldValues = FieldValues> = UseFormProps<T> & {
14537
14537
  onSubmit: SubmitHandler<T>;
14538
- children: JSX.Element;
14538
+ children: JSX.Element | ((p: UseFormReturn<T, any, T>) => JSX.Element);
14539
14539
  methods?: ReturnType<typeof useForm<T>>;
14540
14540
  };
14541
14541
  declare const Form: <T extends FieldValues = FieldValues>({ onSubmit, children, ...props }: FormProps<T>) => react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -9915,7 +9915,12 @@ var Form = (_a) => {
9915
9915
  const formMethods = (0, import_react_hook_form3.useForm)(__spreadValues({
9916
9916
  mode: "onTouched"
9917
9917
  }, props));
9918
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_hook_form3.FormProvider, __spreadProps(__spreadValues({}, formMethods), { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("form", { onSubmit: formMethods.handleSubmit(onSubmit), children }) }));
9918
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react_hook_form3.FormProvider, __spreadProps(__spreadValues({}, formMethods), { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("form", { onSubmit: formMethods.handleSubmit(onSubmit), children: (() => {
9919
+ if (typeof children === "function") {
9920
+ return children(formMethods);
9921
+ }
9922
+ return children;
9923
+ })() }) }));
9919
9924
  };
9920
9925
 
9921
9926
  // src/components/FormFields/MultiSelectFormField.tsx
package/dist/index.mjs CHANGED
@@ -9821,7 +9821,12 @@ var Form = (_a) => {
9821
9821
  const formMethods = useForm(__spreadValues({
9822
9822
  mode: "onTouched"
9823
9823
  }, props));
9824
- return /* @__PURE__ */ jsx34(FormProvider, __spreadProps(__spreadValues({}, formMethods), { children: /* @__PURE__ */ jsx34("form", { onSubmit: formMethods.handleSubmit(onSubmit), children }) }));
9824
+ return /* @__PURE__ */ jsx34(FormProvider, __spreadProps(__spreadValues({}, formMethods), { children: /* @__PURE__ */ jsx34("form", { onSubmit: formMethods.handleSubmit(onSubmit), children: (() => {
9825
+ if (typeof children === "function") {
9826
+ return children(formMethods);
9827
+ }
9828
+ return children;
9829
+ })() }) }));
9825
9830
  };
9826
9831
 
9827
9832
  // src/components/FormFields/MultiSelectFormField.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lets-events/react",
3
- "version": "11.7.1",
3
+ "version": "11.7.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -1,15 +1,16 @@
1
- import { JSX } from "react";
1
+ import { JSX, useMemo } from "react";
2
2
  import {
3
3
  FormProvider,
4
4
  useForm,
5
5
  SubmitHandler,
6
6
  FieldValues,
7
7
  UseFormProps,
8
+ UseFormReturn,
8
9
  } from "react-hook-form";
9
10
 
10
11
  export type FormProps<T extends FieldValues = FieldValues> = UseFormProps<T> & {
11
12
  onSubmit: SubmitHandler<T>;
12
- children: JSX.Element;
13
+ children: JSX.Element | ((p: UseFormReturn<T, any, T>) => JSX.Element);
13
14
  methods?: ReturnType<typeof useForm<T>>;
14
15
  };
15
16
 
@@ -22,10 +23,17 @@ export const Form = <T extends FieldValues = FieldValues>({
22
23
  mode: "onTouched",
23
24
  ...props,
24
25
  });
25
-
26
+
26
27
  return (
27
28
  <FormProvider {...formMethods}>
28
- <form onSubmit={formMethods.handleSubmit(onSubmit)}>{children}</form>
29
+ <form onSubmit={formMethods.handleSubmit(onSubmit)}>
30
+ {(() => {
31
+ if (typeof children === "function") {
32
+ return children(formMethods);
33
+ }
34
+ return children;
35
+ })()}
36
+ </form>
29
37
  </FormProvider>
30
38
  );
31
39
  };