seam-react 0.12.4 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FormComponent.d.ts +8 -4
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3571 -3528
- package/dist/index.js.map +1 -1
- package/dist/styles.cjs +176 -6
- package/dist/styles.cjs.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.js +177 -7
- package/dist/styles.js.map +1 -1
- package/package.json +1 -1
package/dist/FormComponent.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type FormHTMLAttributes, type HTMLAttributes, type LabelHTMLAttributes,
|
|
|
2
2
|
export type FormErrors<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
3
3
|
[K in keyof T]?: string;
|
|
4
4
|
} & Record<string, string | undefined>;
|
|
5
|
+
export type FormValidationTrigger = "submit" | "focus" | "change" | "blur" | "pointerleave";
|
|
5
6
|
export type FieldRule<T = unknown> = {
|
|
6
7
|
required: boolean;
|
|
7
8
|
message?: string;
|
|
@@ -79,6 +80,7 @@ export interface FormContextValue<T = Record<string, unknown>> {
|
|
|
79
80
|
}) => void;
|
|
80
81
|
setFieldTouched: (name: string, touched: boolean) => void;
|
|
81
82
|
setFieldFocused: (name: string, focused: boolean) => void;
|
|
83
|
+
handleFieldInteraction: (name: string, trigger: Exclude<FormValidationTrigger, "submit">) => void;
|
|
82
84
|
registerField: (name: string, config: FieldConfig) => void;
|
|
83
85
|
unregisterField: (name: string) => void;
|
|
84
86
|
validateField: (name: string) => Promise<boolean>;
|
|
@@ -90,8 +92,8 @@ export interface FormContextValue<T = Record<string, unknown>> {
|
|
|
90
92
|
setFormError: (error: string | null) => void;
|
|
91
93
|
clearErrors: (fields?: string[]) => void;
|
|
92
94
|
focusFirstError: () => void;
|
|
93
|
-
validateOn:
|
|
94
|
-
revalidateOn:
|
|
95
|
+
validateOn: FormValidationTrigger;
|
|
96
|
+
revalidateOn: Exclude<FormValidationTrigger, "submit">;
|
|
95
97
|
validateDebounce: number;
|
|
96
98
|
}
|
|
97
99
|
interface FieldConfig {
|
|
@@ -110,11 +112,12 @@ export interface FormRootProps<T extends Record<string, unknown> = Record<string
|
|
|
110
112
|
onValuesChange?: (values: T, changedField?: keyof T) => void;
|
|
111
113
|
onSubmit?: (values: T) => void | Promise<void>;
|
|
112
114
|
onSubmitFailed?: (errors: FormErrors<T>) => void;
|
|
113
|
-
validateOn?:
|
|
114
|
-
revalidateOn?:
|
|
115
|
+
validateOn?: FormValidationTrigger;
|
|
116
|
+
revalidateOn?: Exclude<FormValidationTrigger, "submit">;
|
|
115
117
|
validateDebounce?: number;
|
|
116
118
|
noValidate?: boolean;
|
|
117
119
|
validate?: (values: T) => FormErrors<T> | Promise<FormErrors<T>>;
|
|
120
|
+
layout?: "vertical" | "inline" | "horizontal";
|
|
118
121
|
children: ReactNode;
|
|
119
122
|
}
|
|
120
123
|
export interface FormFieldProps<T = unknown> {
|
|
@@ -132,6 +135,7 @@ export interface FormFieldProps<T = unknown> {
|
|
|
132
135
|
}
|
|
133
136
|
export interface FormLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
|
|
134
137
|
required?: boolean;
|
|
138
|
+
labelWrap?: boolean;
|
|
135
139
|
children: ReactNode;
|
|
136
140
|
}
|
|
137
141
|
export interface FormControlProps {
|