Socket
Book a DemoSign in
Socket

@opengov/form-utils

Package Overview
Dependencies
Maintainers
381
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opengov/form-utils - npm Package Compare versions

Comparing version
0.7.0
to
0.7.1
+16
-10
dist/types.d.ts

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

import { FieldValues, Control } from 'react-hook-form';
import { FieldValues, Control, RegisterOptions, Validate } from 'react-hook-form';
import { DateUnit, DayOfWeek } from './enums';

@@ -137,3 +137,6 @@ /** TEMPLATE TYPES */

/** FIELD CONFIGURATION TYPES */
export type FieldConfiguration<T extends FieldValues = FieldValues> = {
export type FieldRules<TFieldValues extends FieldValues = FieldValues> = Omit<RegisterOptions, 'validate'> & {
validate?: Record<string, Validate<any, TFieldValues>>;
};
export type FieldConfiguration<TFieldValues extends FieldValues = FieldValues> = {
type: string;

@@ -143,14 +146,17 @@ name: string;

icon?: string;
groups: ConfigurationGroup<T>[];
groups: ConfigurationGroup<TFieldValues>[];
label?: LabelConfiguration;
fullWidth?: boolean;
};
export type TypeConfig<T extends FieldConfiguration = FieldConfiguration> = T & {
renderField: (template: FieldTemplate, config: T, { disabled, readonly, name, icons, }: {
disabled?: boolean;
readonly?: boolean;
name?: string;
icons?: React.ReactNode;
}) => JSX.Element;
export type FieldInstanceState<TFieldValues extends FieldValues = FieldValues> = {
disabled?: boolean;
readonly?: boolean;
name?: string;
icons?: React.ReactNode;
rules?: FieldRules<TFieldValues>;
};
export type RenderField<TConfig extends FieldConfiguration = FieldConfiguration> = (template: FieldTemplate, config: TConfig, state: FieldInstanceState) => JSX.Element;
export type TypeConfig<TConfig extends FieldConfiguration = FieldConfiguration> = TConfig & {
renderField: RenderField<TConfig>;
};
export type TextConfiguration = FieldConfiguration & {

@@ -157,0 +163,0 @@ maxLength: number;

{
"name": "@opengov/form-utils",
"version": "0.7.0",
"version": "0.7.1",
"description": "OpenGov Smart Forms form utils",

@@ -5,0 +5,0 @@ "type": "module",