New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@firecms/formex

Package Overview
Dependencies
Maintainers
0
Versions
207
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firecms/formex - npm Package Compare versions

Comparing version 3.0.0-canary.154 to 3.0.0-canary.155

213

dist/index.es.js

@@ -0,1 +1,2 @@

import { c } from "react-compiler-runtime";
import * as React from "react";

@@ -5,3 +6,5 @@ import React__default, { useContext, useState, useEffect } from "react";

const FormexContext = React__default.createContext({});
const useFormex = () => useContext(FormexContext);
const useFormex = () => {
return useContext(FormexContext);
};
const Formex = FormexContext.Provider;

@@ -85,3 +88,5 @@ const isEmptyArray = (value) => Array.isArray(value) && value.length === 0;

} else if (typeof value === "object" && value !== null) {
return { ...value };
return {
...value
};
} else {

@@ -95,27 +100,141 @@ return value;

}
function Field({
validate,
name,
children,
as: is,
// `as` is reserved in typescript lol
// component,
className,
...props
}) {
function Field(t0) {
const $ = c(37);
let children;
let className;
let is;
let name;
let props;
if ($[0] !== t0) {
const {
validate,
name: t12,
children: t22,
as: t3,
className: t4,
...t5
} = t0;
name = t12;
children = t22;
is = t3;
className = t4;
props = t5;
$[0] = t0;
$[1] = children;
$[2] = className;
$[3] = is;
$[4] = name;
$[5] = props;
} else {
children = $[1];
className = $[2];
is = $[3];
name = $[4];
props = $[5];
}
const formex = useFormex();
const field = getFieldProps({ name, ...props }, formex);
if (isFunction(children)) {
return children({ field, form: formex });
let field;
let t1;
if ($[6] !== children || $[7] !== formex || $[8] !== name || $[9] !== props) {
t1 = Symbol.for("react.early_return_sentinel");
bb0: {
field = getFieldProps({
name,
...props
}, formex);
if (isFunction(children)) {
t1 = children({
field,
form: formex
});
break bb0;
}
}
$[6] = children;
$[7] = formex;
$[8] = name;
$[9] = props;
$[10] = field;
$[11] = t1;
} else {
field = $[10];
t1 = $[11];
}
if (t1 !== Symbol.for("react.early_return_sentinel")) {
return t1;
}
const asElement = is || "input";
if (typeof asElement === "string") {
const { innerRef, ...rest } = props;
return React.createElement(
asElement,
{ ref: innerRef, ...field, ...rest, className },
children
);
let innerRef;
let rest;
if ($[12] !== props) {
({
innerRef,
...rest
} = props);
$[12] = props;
$[13] = innerRef;
$[14] = rest;
} else {
innerRef = $[13];
rest = $[14];
}
let t22;
if ($[15] !== asElement || $[16] !== children || $[17] !== className || $[18] !== field || $[19] !== innerRef || $[20] !== rest) {
let t3;
if ($[22] !== className || $[23] !== field || $[24] !== innerRef || $[25] !== rest) {
t3 = {
ref: innerRef,
...field,
...rest,
className
};
$[22] = className;
$[23] = field;
$[24] = innerRef;
$[25] = rest;
$[26] = t3;
} else {
t3 = $[26];
}
t22 = React.createElement(asElement, t3, children);
$[15] = asElement;
$[16] = children;
$[17] = className;
$[18] = field;
$[19] = innerRef;
$[20] = rest;
$[21] = t22;
} else {
t22 = $[21];
}
return t22;
}
return React.createElement(asElement, { ...field, ...props, className }, children);
let t2;
if ($[27] !== asElement || $[28] !== children || $[29] !== className || $[30] !== field || $[31] !== props) {
let t3;
if ($[33] !== className || $[34] !== field || $[35] !== props) {
t3 = {
...field,
...props,
className
};
$[33] = className;
$[34] = field;
$[35] = props;
$[36] = t3;
} else {
t3 = $[36];
}
t2 = React.createElement(asElement, t3, children);
$[27] = asElement;
$[28] = children;
$[29] = className;
$[30] = field;
$[31] = props;
$[32] = t2;
} else {
t2 = $[32];
}
return t2;
}

@@ -195,5 +314,5 @@ const getFieldProps = (nameOrOptions, formex) => {

const setFieldValue = (key, value, shouldValidate) => {
const newValues = setIn(valuesRef.current, key, value);
valuesRef.current = newValues;
setValuesInner(newValues);
const newValues_0 = setIn(valuesRef.current, key, value);
valuesRef.current = newValues_0;
setValuesInner(newValues_0);
if (!equal(getIn(initialValuesRef.current, key), value)) {

@@ -206,16 +325,20 @@ setDirty(true);

};
const setFieldError = (key, error) => {
const newErrors = { ...errors };
const setFieldError = (key_0, error) => {
const newErrors = {
...errors
};
if (error) {
newErrors[key] = error;
newErrors[key_0] = error;
} else {
delete newErrors[key];
delete newErrors[key_0];
}
setErrors(newErrors);
};
const setFieldTouched = (key, touched, shouldValidate) => {
const newTouched = { ...touchedState };
newTouched[key] = touched;
const setFieldTouched = (key_1, touched, shouldValidate_0) => {
const newTouched = {
...touchedState
};
newTouched[key_1] = touched;
setTouchedState(newTouched);
if (shouldValidate) {
if (shouldValidate_0) {
validate();

@@ -226,18 +349,18 @@ }

const target = event.target;
let value;
let value_0;
if (target.type === "checkbox") {
value = target.checked;
value_0 = target.checked;
} else if (target.type === "number") {
value = target.valueAsNumber;
value_0 = target.valueAsNumber;
} else {
value = target.value;
value_0 = target.value;
}
const name = target.name;
setFieldValue(name, value, validateOnChange);
setFieldValue(name, value_0, validateOnChange);
setFieldTouched(name, true);
};
const handleBlur = (event) => {
const target = event.target;
const name = target.name;
setFieldTouched(name, true);
const handleBlur = (event_0) => {
const target_0 = event_0.target;
const name_0 = target_0.name;
setFieldTouched(name_0, true);
};

@@ -249,5 +372,5 @@ const submit = async (e) => {

setSubmitCount(submitCount + 1);
const validationErrors = await validation?.(valuesRef.current);
if (validationErrors && Object.keys(validationErrors).length > 0) {
setErrors(validationErrors);
const validationErrors_0 = await validation?.(valuesRef.current);
if (validationErrors_0 && Object.keys(validationErrors_0).length > 0) {
setErrors(validationErrors_0);
} else {

@@ -254,0 +377,0 @@ setErrors({});

(function(global, factory) {
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react-fast-compare")) : typeof define === "function" && define.amd ? define(["exports", "react", "react-fast-compare"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.Formex = {}, global.React, global.equal));
})(this, function(exports2, React, equal) {
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react-compiler-runtime"), require("react"), require("react-fast-compare")) : typeof define === "function" && define.amd ? define(["exports", "react-compiler-runtime", "react", "react-fast-compare"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.Formex = {}, global.reactCompilerRuntime, global.React, global.equal));
})(this, function(exports2, reactCompilerRuntime, React, equal) {
"use strict";

@@ -23,3 +23,5 @@ function _interopNamespaceDefault(e) {

const FormexContext = React.createContext({});
const useFormex = () => React.useContext(FormexContext);
const useFormex = () => {
return React.useContext(FormexContext);
};
const Formex = FormexContext.Provider;

@@ -103,3 +105,5 @@ const isEmptyArray = (value) => Array.isArray(value) && value.length === 0;

} else if (typeof value === "object" && value !== null) {
return { ...value };
return {
...value
};
} else {

@@ -113,27 +117,141 @@ return value;

}
function Field({
validate,
name,
children,
as: is,
// `as` is reserved in typescript lol
// component,
className,
...props
}) {
function Field(t0) {
const $ = reactCompilerRuntime.c(37);
let children;
let className;
let is;
let name;
let props;
if ($[0] !== t0) {
const {
validate,
name: t12,
children: t22,
as: t3,
className: t4,
...t5
} = t0;
name = t12;
children = t22;
is = t3;
className = t4;
props = t5;
$[0] = t0;
$[1] = children;
$[2] = className;
$[3] = is;
$[4] = name;
$[5] = props;
} else {
children = $[1];
className = $[2];
is = $[3];
name = $[4];
props = $[5];
}
const formex = useFormex();
const field = getFieldProps({ name, ...props }, formex);
if (isFunction(children)) {
return children({ field, form: formex });
let field;
let t1;
if ($[6] !== children || $[7] !== formex || $[8] !== name || $[9] !== props) {
t1 = Symbol.for("react.early_return_sentinel");
bb0: {
field = getFieldProps({
name,
...props
}, formex);
if (isFunction(children)) {
t1 = children({
field,
form: formex
});
break bb0;
}
}
$[6] = children;
$[7] = formex;
$[8] = name;
$[9] = props;
$[10] = field;
$[11] = t1;
} else {
field = $[10];
t1 = $[11];
}
if (t1 !== Symbol.for("react.early_return_sentinel")) {
return t1;
}
const asElement = is || "input";
if (typeof asElement === "string") {
const { innerRef, ...rest } = props;
return React__namespace.createElement(
asElement,
{ ref: innerRef, ...field, ...rest, className },
children
);
let innerRef;
let rest;
if ($[12] !== props) {
({
innerRef,
...rest
} = props);
$[12] = props;
$[13] = innerRef;
$[14] = rest;
} else {
innerRef = $[13];
rest = $[14];
}
let t22;
if ($[15] !== asElement || $[16] !== children || $[17] !== className || $[18] !== field || $[19] !== innerRef || $[20] !== rest) {
let t3;
if ($[22] !== className || $[23] !== field || $[24] !== innerRef || $[25] !== rest) {
t3 = {
ref: innerRef,
...field,
...rest,
className
};
$[22] = className;
$[23] = field;
$[24] = innerRef;
$[25] = rest;
$[26] = t3;
} else {
t3 = $[26];
}
t22 = React__namespace.createElement(asElement, t3, children);
$[15] = asElement;
$[16] = children;
$[17] = className;
$[18] = field;
$[19] = innerRef;
$[20] = rest;
$[21] = t22;
} else {
t22 = $[21];
}
return t22;
}
return React__namespace.createElement(asElement, { ...field, ...props, className }, children);
let t2;
if ($[27] !== asElement || $[28] !== children || $[29] !== className || $[30] !== field || $[31] !== props) {
let t3;
if ($[33] !== className || $[34] !== field || $[35] !== props) {
t3 = {
...field,
...props,
className
};
$[33] = className;
$[34] = field;
$[35] = props;
$[36] = t3;
} else {
t3 = $[36];
}
t2 = React__namespace.createElement(asElement, t3, children);
$[27] = asElement;
$[28] = children;
$[29] = className;
$[30] = field;
$[31] = props;
$[32] = t2;
} else {
t2 = $[32];
}
return t2;
}

@@ -213,5 +331,5 @@ const getFieldProps = (nameOrOptions, formex) => {

const setFieldValue = (key, value, shouldValidate) => {
const newValues = setIn(valuesRef.current, key, value);
valuesRef.current = newValues;
setValuesInner(newValues);
const newValues_0 = setIn(valuesRef.current, key, value);
valuesRef.current = newValues_0;
setValuesInner(newValues_0);
if (!equal(getIn(initialValuesRef.current, key), value)) {

@@ -224,16 +342,20 @@ setDirty(true);

};
const setFieldError = (key, error) => {
const newErrors = { ...errors };
const setFieldError = (key_0, error) => {
const newErrors = {
...errors
};
if (error) {
newErrors[key] = error;
newErrors[key_0] = error;
} else {
delete newErrors[key];
delete newErrors[key_0];
}
setErrors(newErrors);
};
const setFieldTouched = (key, touched, shouldValidate) => {
const newTouched = { ...touchedState };
newTouched[key] = touched;
const setFieldTouched = (key_1, touched, shouldValidate_0) => {
const newTouched = {
...touchedState
};
newTouched[key_1] = touched;
setTouchedState(newTouched);
if (shouldValidate) {
if (shouldValidate_0) {
validate();

@@ -244,18 +366,18 @@ }

const target = event.target;
let value;
let value_0;
if (target.type === "checkbox") {
value = target.checked;
value_0 = target.checked;
} else if (target.type === "number") {
value = target.valueAsNumber;
value_0 = target.valueAsNumber;
} else {
value = target.value;
value_0 = target.value;
}
const name = target.name;
setFieldValue(name, value, validateOnChange);
setFieldValue(name, value_0, validateOnChange);
setFieldTouched(name, true);
};
const handleBlur = (event) => {
const target = event.target;
const name = target.name;
setFieldTouched(name, true);
const handleBlur = (event_0) => {
const target_0 = event_0.target;
const name_0 = target_0.name;
setFieldTouched(name_0, true);
};

@@ -267,5 +389,5 @@ const submit = async (e) => {

setSubmitCount(submitCount + 1);
const validationErrors = await validation?.(valuesRef.current);
if (validationErrors && Object.keys(validationErrors).length > 0) {
setErrors(validationErrors);
const validationErrors_0 = await validation?.(valuesRef.current);
if (validationErrors_0 && Object.keys(validationErrors_0).length > 0) {
setErrors(validationErrors_0);
} else {

@@ -272,0 +394,0 @@ setErrors({});

{
"name": "@firecms/formex",
"type": "module",
"version": "3.0.0-canary.154",
"version": "3.0.0-canary.155",
"publishConfig": {

@@ -44,2 +44,4 @@ "access": "public"

"@types/react-dom": "^18.3.1",
"babel-plugin-react-compiler": "beta",
"eslint-plugin-react-compiler": "beta",
"jest": "^29.7.0",

@@ -76,3 +78,3 @@ "ts-jest": "^29.2.5",

},
"gitHead": "52858cb15cdbbbb9c1b6ed8368e133304321cf49"
"gitHead": "c9b71679d709242ff3a47ec56a0ecf980ec76564"
}

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