You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@conform-to/react

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@conform-to/react - npm Package Compare versions

Comparing version

to
1.0.0

3

context.d.ts

@@ -30,5 +30,4 @@ import { type Constraint, type FormId, type FieldName, type FormContext as BaseFormContext, type FormValue, type FormState, type Intent, type SubscriptionScope, type SubscriptionSubject, type UnionKeyof, type UnionKeyType, type FormOptions as BaseFormOptions } from '@conform-to/dom';

};
export type FieldMetadata<Schema = unknown, FormSchema extends Record<string, any> = Record<string, unknown>, FormError = string[]> = Metadata<Schema, FormSchema, FormError> & {
export type FieldMetadata<Schema = unknown, FormSchema extends Record<string, any> = Record<string, unknown>, FormError = string[]> = Metadata<Schema, FormSchema, FormError> & Constraint & {
formId: FormId<FormSchema, FormError>;
constraint?: Constraint;
getFieldset: unknown extends Schema ? () => unknown : Schema extends Primitive | Array<any> ? never : () => {

@@ -35,0 +34,0 @@ [Key in UnionKeyof<Schema>]: FieldMetadata<UnionKeyType<Schema, Key>, FormSchema, FormError>;

@@ -77,5 +77,11 @@ 'use strict';

descriptionId: "".concat(id, "-description"),
initialValue: state.initialValue[name],
value: state.value[name],
errors: state.error[name],
get initialValue() {
return state.initialValue[name];
},
get value() {
return state.value[name];
},
get errors() {
return state.error[name];
},
get key() {

@@ -138,7 +144,15 @@ return state.key[name];

get(_, key, receiver) {
var _state$constraint$nam;
switch (key) {
case 'formId':
return formId;
case 'constraint':
return state.constraint[name];
case 'required':
case 'minLength':
case 'maxLength':
case 'min':
case 'max':
case 'pattern':
case 'step':
case 'multiple':
return (_state$constraint$nam = state.constraint[name]) === null || _state$constraint$nam === void 0 ? void 0 : _state$constraint$nam[key];
case 'getFieldList':

@@ -145,0 +159,0 @@ {

@@ -75,6 +75,5 @@ 'use strict';

function getFormControlProps(metadata, options) {
var _metadata$constraint;
return simplify(_rollupPluginBabelHelpers.objectSpread2({
key: metadata.key,
required: ((_metadata$constraint = metadata.constraint) === null || _metadata$constraint === void 0 ? void 0 : _metadata$constraint.required) || undefined
required: metadata.required || undefined
}, getFieldsetProps(metadata, options)));

@@ -104,12 +103,11 @@ }

function getInputProps(metadata, options) {
var _metadata$constraint2, _metadata$constraint3, _metadata$constraint4, _metadata$constraint5, _metadata$constraint6, _metadata$constraint7, _metadata$constraint8;
var props = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, getFormControlProps(metadata, options)), {}, {
type: options.type,
minLength: (_metadata$constraint2 = metadata.constraint) === null || _metadata$constraint2 === void 0 ? void 0 : _metadata$constraint2.minLength,
maxLength: (_metadata$constraint3 = metadata.constraint) === null || _metadata$constraint3 === void 0 ? void 0 : _metadata$constraint3.maxLength,
min: (_metadata$constraint4 = metadata.constraint) === null || _metadata$constraint4 === void 0 ? void 0 : _metadata$constraint4.min,
max: (_metadata$constraint5 = metadata.constraint) === null || _metadata$constraint5 === void 0 ? void 0 : _metadata$constraint5.max,
step: (_metadata$constraint6 = metadata.constraint) === null || _metadata$constraint6 === void 0 ? void 0 : _metadata$constraint6.step,
pattern: (_metadata$constraint7 = metadata.constraint) === null || _metadata$constraint7 === void 0 ? void 0 : _metadata$constraint7.pattern,
multiple: (_metadata$constraint8 = metadata.constraint) === null || _metadata$constraint8 === void 0 ? void 0 : _metadata$constraint8.multiple
minLength: metadata.minLength,
maxLength: metadata.maxLength,
min: metadata.min,
max: metadata.max,
step: metadata.step,
pattern: metadata.pattern,
multiple: metadata.multiple
});

@@ -143,6 +141,5 @@ if (typeof options.value === 'undefined' || options.value) {

function getSelectProps(metadata) {
var _metadata$constraint9;
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var props = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, getFormControlProps(metadata, options)), {}, {
multiple: (_metadata$constraint9 = metadata.constraint) === null || _metadata$constraint9 === void 0 ? void 0 : _metadata$constraint9.multiple
multiple: metadata.multiple
});

@@ -171,7 +168,6 @@ if (typeof options.value === 'undefined' || options.value) {

function getTextareaProps(metadata) {
var _metadata$constraint10, _metadata$constraint11;
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var props = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, getFormControlProps(metadata, options)), {}, {
minLength: (_metadata$constraint10 = metadata.constraint) === null || _metadata$constraint10 === void 0 ? void 0 : _metadata$constraint10.minLength,
maxLength: (_metadata$constraint11 = metadata.constraint) === null || _metadata$constraint11 === void 0 ? void 0 : _metadata$constraint11.maxLength
minLength: metadata.minLength,
maxLength: metadata.maxLength
});

@@ -206,3 +202,3 @@ if (typeof options.value === 'undefined' || options.value) {

return options.options.map(value => {
var _metadata$key, _metadata$constraint12;
var _metadata$key;
return simplify(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, getFormControlProps(metadata, options)), {}, {

@@ -217,3 +213,3 @@ key: "".concat((_metadata$key = metadata.key) !== null && _metadata$key !== void 0 ? _metadata$key : '').concat(value),

// It is overriden with `undefiend` so it could be cleaned up properly
required: options.type === 'checkbox' ? undefined : (_metadata$constraint12 = metadata.constraint) === null || _metadata$constraint12 === void 0 ? void 0 : _metadata$constraint12.required
required: options.type === 'checkbox' ? undefined : metadata.required
}));

@@ -220,0 +216,0 @@ });

@@ -6,3 +6,3 @@ {

"license": "MIT",
"version": "1.0.0-rc.1",
"version": "1.0.0",
"main": "index.js",

@@ -34,3 +34,3 @@ "module": "index.mjs",

"dependencies": {
"@conform-to/dom": "1.0.0-rc.1"
"@conform-to/dom": "1.0.0"
},

@@ -37,0 +37,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet