@maif/react-forms 1.3.1-rc.4 → 1.3.1-rc.7

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.
Files changed (2) hide show
  1. package/lib/index.d.ts +23 -14
  2. package/package.json +1 -1
package/lib/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import * as yup from 'yup';
4
4
  import { AnySchema, StringSchema, NumberSchema, ArraySchema, TestFunction } from 'yup';
5
5
  import Reference from 'yup/lib/Reference';
6
6
  import React$1 from 'react';
7
+ import { UseFormReturn } from 'react-hook-form';
7
8
 
8
9
  declare const type: {
9
10
  readonly string: "string";
@@ -58,7 +59,7 @@ declare const test: (name: string, message: string | undefined, test: TestFuncti
58
59
  declare const when: (ref: string, test: TestFunction<any, object>, then?: Constraint[], otherwise?: Constraint[]) => (r: AnySchema, key: string, dependencies: any[]) => yup.AnySchema<any, any, any>;
59
60
  declare const oneOf: (arrayOfValues: any[], message?: string) => (r: AnySchema) => yup.AnySchema<any, any, any>;
60
61
  declare const blacklist: (arrayOfValues: any[], message?: string) => (r: AnySchema) => yup.AnySchema<any, any, any>;
61
- declare const ref: (ref: string) => Reference<unknown>;
62
+ declare const ref: <T>(ref: string) => Reference<T>;
62
63
  declare const jsonConstraints: Record<string, any>;
63
64
  declare type TConstraintType = keyof typeof jsonConstraints;
64
65
 
@@ -400,7 +401,7 @@ interface SchemaEntry {
400
401
  interface FlowObject {
401
402
  label: string;
402
403
  flow: Flow;
403
- collapse: boolean;
404
+ collapsed: boolean;
404
405
  }
405
406
  declare type Flow = Array<string | FlowObject>;
406
407
  interface Informations {
@@ -410,22 +411,30 @@ interface Informations {
410
411
  index?: number;
411
412
  }
412
413
 
413
- declare const Form: React$1.ForwardRefExoticComponent<{
414
+ declare type FormProps = {
414
415
  schema: Schema;
415
- flow?: (string | FlowObject)[] | undefined;
416
- value?: object | undefined;
417
- inputWrapper?: ((props: object) => JSX.Element) | undefined;
416
+ flow?: Array<string | FlowObject>;
417
+ value?: object;
418
+ inputWrapper?: (props: object) => JSX.Element;
418
419
  onSubmit: (obj: {
419
420
  [x: string]: any;
420
421
  }) => void;
421
- onError?: (() => void) | undefined;
422
- footer?: ((props: {
422
+ onError?: () => void;
423
+ footer?: (props: {
423
424
  reset: () => void;
424
425
  valid: () => void;
425
- }) => JSX.Element) | undefined;
426
- style?: object | undefined;
427
- className?: string | undefined;
428
- options?: Option | undefined;
429
- } & React$1.RefAttributes<unknown>>;
426
+ }) => JSX.Element;
427
+ style?: object;
428
+ className?: string;
429
+ options?: Option;
430
+ };
431
+ interface FormRef {
432
+ handleSubmit: () => void;
433
+ trigger: () => void;
434
+ methods: UseFormReturn & {
435
+ data: () => any;
436
+ };
437
+ }
438
+ declare const Form: React$1.ForwardRefExoticComponent<FormProps & React$1.RefAttributes<FormRef>>;
430
439
 
431
- export { BooleanInput, CodeInput, Collapse, Form, Format, MarkdownInput, ObjectInput, SelectInput, SelectOption, SingleLineCode, Type, constraints_d as constraints, format, type };
440
+ export { BooleanInput, CodeInput, Collapse, Form, FormRef, Format, MarkdownInput, ObjectInput, SelectInput, SelectOption, SingleLineCode, Type, constraints_d as constraints, format, type };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maif/react-forms",
3
3
  "description": "Build react safe forms as fast as possible",
4
- "version": "1.3.1-rc.4",
4
+ "version": "1.3.1-rc.7",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
7
7
  "source": "src/index.ts",