Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mihanizm56/react-final-form-utils

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mihanizm56/react-final-form-utils - npm Package Compare versions

Comparing version 0.0.7-beta.15 to 0.0.7

7

dist/_utils/errors-field-scroll.d.ts

@@ -0,1 +1,5 @@

export declare type ICustomCheckIsErrorField = (params: {
name: string;
formErrors: Record<string, string>;
}) => boolean;
export declare type ScrollToErrorOnFieldParamsType = {

@@ -5,3 +9,4 @@ formErrors: Record<string, string>;

timeoutToScroll?: number;
customCheckIsErrorField?: ICustomCheckIsErrorField;
};
export declare const scrollToErrorOnField: ({ formErrors, fieldNameFormatter, timeoutToScroll, }: ScrollToErrorOnFieldParamsType) => void;
export declare const scrollToErrorOnField: ({ formErrors, fieldNameFormatter, timeoutToScroll, customCheckIsErrorField, }: ScrollToErrorOnFieldParamsType) => void;

9

dist/_utils/errors-field-scroll.js
// https://erikras.com/blog/focus-on-errors
export var scrollToErrorOnField = function (_a) {
var formErrors = _a.formErrors, fieldNameFormatter = _a.fieldNameFormatter, _b = _a.timeoutToScroll, timeoutToScroll = _b === void 0 ? 100 : _b;
var formErrors = _a.formErrors, fieldNameFormatter = _a.fieldNameFormatter, _b = _a.timeoutToScroll, timeoutToScroll = _b === void 0 ? 100 : _b, customCheckIsErrorField = _a.customCheckIsErrorField;
var form = Array.from(document.forms[0]);

@@ -8,6 +8,9 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment

var firstErrorFieldElement = form.find(function (_a) {
var _b;
var _b, _c;
var name = _a.name;
var fieldName = (_b = fieldNameFormatter === null || fieldNameFormatter === void 0 ? void 0 : fieldNameFormatter(name)) !== null && _b !== void 0 ? _b : name;
return fieldName in formErrors;
return ((_c = customCheckIsErrorField === null || customCheckIsErrorField === void 0 ? void 0 : customCheckIsErrorField({
name: name,
formErrors: formErrors,
})) !== null && _c !== void 0 ? _c : Boolean(formErrors[fieldName]));
});

@@ -14,0 +17,0 @@ if (firstErrorFieldElement) {

@@ -6,2 +6,2 @@ export { ChangeFieldHandler, ChangeFieldHandlerParamsType, } from './_components/change-field-handler';

export { CustomConditionParamsType, ConditionField, } from './_components/condition-field';
export { ScrollToErrorOnFieldParamsType, scrollToErrorOnField, } from './_utils/errors-field-scroll';
export { ScrollToErrorOnFieldParamsType, scrollToErrorOnField, ICustomCheckIsErrorField, } from './_utils/errors-field-scroll';
{
"name": "@mihanizm56/react-final-form-utils",
"version": "0.0.7-beta.15",
"version": "0.0.7",
"description": "form utils module",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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