Socket
Socket
Sign inDemoInstall

@croz/nrich-form-configuration-core

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@croz/nrich-form-configuration-core - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

7

dist/index.d.ts
import * as yup from 'yup';
import { ObjectSchema } from 'yup';
import * as yup_lib_object from 'yup/lib/object';

@@ -15,3 +16,3 @@ import React from 'react';

}
interface FormYupConfiguration {
interface FormYupConfiguration<T extends Record<string, never> = any> {
/**

@@ -24,3 +25,3 @@ * Registered form id for this form configuration.

*/
yupSchema: yup.ObjectSchema<any>;
yupSchema: yup.ObjectSchema<T>;
}

@@ -134,3 +135,3 @@ interface ConstrainedPropertyConfiguration {

*/
declare const useYupFormConfiguration: (formId: string) => yup.ObjectSchema<any, yup_lib_object.AnyObject, yup_lib_object.TypeOfShape<any>, yup_lib_object.AssertsShape<any>>;
declare const useYupFormConfiguration: <T extends Record<string, any> = any>(formId: string) => ObjectSchema<T, yup_lib_object.AnyObject, yup_lib_object.TypeOfShape<T>, yup_lib_object.AssertsShape<T> | Extract<yup_lib_object.TypeOfShape<T>, null>>;

@@ -137,0 +138,0 @@ type Props = {

{
"name": "@croz/nrich-form-configuration-core",
"description": "Contains core utilities related to the nrich-form-configuration module",
"version": "2.0.0",
"version": "2.1.0",
"author": "CROZ",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/croz-ltd/nrich-frontend/issues",

@@ -36,6 +36,9 @@ # @croz/nrich-form-configuration-core

type CreateForm = {
/* fields of the form */
}
export const SomeFormComponent = () => {
const [formValues, setFormValues] = useState({});
const validationSchema = useYupFormConfiguration('user.create-form');
const validationSchema = useYupFormConfiguration<CreateForm>('user.create-form');

@@ -48,3 +51,3 @@ return (

<Form>
{ /* Rest of the form */ }
{ /* Rest of the form */}
</Form>

@@ -55,2 +58,3 @@ </Formik>

```
*NOTE: Formik is used just as an example, you can use any form lib compatible with `yup`.*

@@ -70,3 +74,2 @@

### Registering and using custom validations

@@ -73,0 +76,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc