react-f0rm 0.4.0 → 0.5.0
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/README.md +52 -3
- package/dist/devtools/index.cjs.js +20 -13
- package/dist/devtools/index.cjs.js.map +1 -1
- package/dist/devtools/index.d.ts +1 -1
- package/dist/devtools/index.mjs +20 -13
- package/dist/devtools/index.mjs.map +1 -1
- package/dist/{form-b9441d8c.cjs.js → form-B4r7INJ0.cjs.js} +10 -39
- package/dist/form-B4r7INJ0.cjs.js.map +1 -0
- package/dist/{form-94c70b4b.mjs → form-R1hDKjBm.mjs} +11 -40
- package/dist/form-R1hDKjBm.mjs.map +1 -0
- package/dist/{form-61297bc0.d.ts → form-rTlcIiWH.d.ts} +31 -2
- package/dist/index.cjs.js +73 -43
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +27 -11
- package/dist/index.mjs +73 -45
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +73 -43
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +2 -2
- package/dist/index.umd.min.js.map +1 -1
- package/dist/resolvers/standard-schema.cjs.js +1 -1
- package/dist/resolvers/standard-schema.cjs.js.map +1 -1
- package/dist/resolvers/standard-schema.d.ts +2 -2
- package/dist/resolvers/standard-schema.mjs +1 -1
- package/dist/resolvers/standard-schema.mjs.map +1 -1
- package/dist/resolvers/yup.cjs.js +5 -7
- package/dist/resolvers/yup.cjs.js.map +1 -1
- package/dist/resolvers/yup.d.ts +2 -2
- package/dist/resolvers/yup.mjs +5 -7
- package/dist/resolvers/yup.mjs.map +1 -1
- package/dist/resolvers/zod.cjs.js +5 -7
- package/dist/resolvers/zod.cjs.js.map +1 -1
- package/dist/resolvers/zod.d.ts +2 -2
- package/dist/resolvers/zod.mjs +5 -7
- package/dist/resolvers/zod.mjs.map +1 -1
- package/dist/{validate-148fe167.d.ts → validate-CQX7BJOD.d.ts} +1 -1
- package/package.json +52 -51
- package/dist/form-94c70b4b.mjs.map +0 -1
- package/dist/form-b9441d8c.cjs.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { a as FieldPath, N as Name, F as Form$1, P as PathValueOf, b as FieldError, c as Path, O as Options } from './form-rTlcIiWH.js';
|
|
2
|
+
export { d as FieldErrorEntry, e as FieldState, H as HandleSubmitOptions, f as PathValue, R as ReValidateMode, g as ResetFieldOptions, h as ResetOptions, S as SetFieldOptions, i as SetFocusOptions, j as SetServerErrorsOptions, V as VALIDATION_OUTCOME, k as ValidateResult, l as ValidationMode, m as ValidationOutcome, n as clearErrors, o as createForm, p as ensureValidate, q as getDirtyFields, r as getError, s as getErrorByPath, t as getErrors, u as getFieldErrors, v as getFieldErrorsByPath, w as getFieldState, x as getFirstError, y as getTouchedFields, z as getValue, A as getValueByPath, B as getValues, C as handleSubmit, D as hasErrors, E as hasTouched, G as hasTouchedByPath, I as incrementSubmitCount, J as isDirty, K as isTouched, L as removeField, M as removeFieldByPath, Q as reset, T as resetField, U as setDisabled, W as setError, X as setErrorByPath, Y as setFocus, Z as setInitialValues, _ as setIsSubmitting, $ as setServerErrors, a0 as setSubmitSuccessful, a1 as setTouched, a2 as setTouchedByPath, a3 as setValidatingByPath, a4 as setValue, a5 as setValueByPath, a6 as trigger, a7 as unsetValidatingByPath, a8 as validate } from './form-rTlcIiWH.js';
|
|
3
|
+
import { V as Validator } from './validate-CQX7BJOD.js';
|
|
3
4
|
import * as React from 'react';
|
|
4
5
|
import { ReactNode } from 'react';
|
|
5
|
-
import { V as Validator } from './validate-148fe167.js';
|
|
6
6
|
import { EventEmitter } from '@for-fun/event-emitter';
|
|
7
7
|
|
|
8
8
|
/** Type tag of a failed rule, as stored on the resulting FieldError. */
|
|
@@ -317,7 +317,7 @@ declare function subscribe(form: Form$1, options: SubscribeOptions): () => void;
|
|
|
317
317
|
* this component is a thin wrapper that binds it to the rendered <form>.
|
|
318
318
|
*/
|
|
319
319
|
interface FormProps<T extends Record<string, any> = any> extends Omit<React.FormHTMLAttributes<HTMLFormElement>, 'onSubmit'> {
|
|
320
|
-
form?: Form<T>;
|
|
320
|
+
form?: Form$1<T>;
|
|
321
321
|
/**
|
|
322
322
|
* Provide into an isolated context from `createFormContext()` instead of
|
|
323
323
|
* the module-level one — `<Form context={ProfileForm.context}>` keeps the
|
|
@@ -327,7 +327,7 @@ interface FormProps<T extends Record<string, any> = any> extends Omit<React.Form
|
|
|
327
327
|
* `useField` do not see it; that is the point of the isolation. Omitted,
|
|
328
328
|
* the form lands in the module-level FormContext as before.
|
|
329
329
|
*/
|
|
330
|
-
context?: React.Context<Form<any> | null>;
|
|
330
|
+
context?: React.Context<Form$1<any> | null>;
|
|
331
331
|
initialValues?: T;
|
|
332
332
|
/**
|
|
333
333
|
* Controlled external values. When the `values` reference changes, the
|
|
@@ -338,8 +338,11 @@ interface FormProps<T extends Record<string, any> = any> extends Omit<React.Form
|
|
|
338
338
|
* `values` reference never clobber what the user is typing.
|
|
339
339
|
*/
|
|
340
340
|
values?: T;
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
/** May be async — the submit flow awaits it, so form.isSubmitting
|
|
342
|
+
* covers the entire flight. */
|
|
343
|
+
onSubmit?: (values: T, e: React.FormEvent) => void | Promise<void>;
|
|
344
|
+
/** May be async, same as onSubmit. */
|
|
345
|
+
onValidSubmit?: (values: T, e: React.FormEvent) => void | Promise<void>;
|
|
343
346
|
/**
|
|
344
347
|
* Called when validation fails.
|
|
345
348
|
* @param errors array of {path, type, message} entries in insertion
|
|
@@ -428,12 +431,25 @@ interface FieldProps<TValues extends Record<string, any> = any, TPath extends Fi
|
|
|
428
431
|
/**
|
|
429
432
|
* Optional error renderer. When provided and the field has an error,
|
|
430
433
|
* Field renders `<span id={id} role="alert">{renderError(error, id)}</span>`
|
|
431
|
-
* next to the input
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
+
* next to the input. The input's aria-describedby points at that span's
|
|
435
|
+
* id (the same `fieldErrorId(name)` derivation) whenever the field has
|
|
436
|
+
* an error — with or without renderError — so custom error components
|
|
437
|
+
* that render the element themselves (using `fieldErrorId`) get the
|
|
438
|
+
* wiring for free.
|
|
434
439
|
*/
|
|
435
440
|
renderError?: (error: string, id: string) => React.ReactNode;
|
|
436
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* The error-message element id a field's `aria-describedby` points at —
|
|
444
|
+
* `fieldErrorId('a[0].b')` is `'a-0-b'`, the same id `Field`'s built-in
|
|
445
|
+
* `renderError` span carries. This is the library-level wiring convention:
|
|
446
|
+
* whenever a bound field (Field/Checkbox/Select) has an error it sets
|
|
447
|
+
* `aria-invalid` and describes the element with this id, so a custom error
|
|
448
|
+
* component only needs `<span id={fieldErrorId(name)} role="alert">` to
|
|
449
|
+
* complete the accessible-name chain for screen readers.
|
|
450
|
+
* @param name the same field name passed to the bound component
|
|
451
|
+
*/
|
|
452
|
+
declare function fieldErrorId(name: Name): string;
|
|
437
453
|
/**
|
|
438
454
|
* The callable shape of {@link Field}: `form` + `name` flow their generics
|
|
439
455
|
* into `validate`'s value argument (`PathValueOf<TValues, TPath>`). A named
|
|
@@ -468,5 +484,5 @@ interface SelectComponent {
|
|
|
468
484
|
}
|
|
469
485
|
declare const Select: SelectComponent;
|
|
470
486
|
|
|
471
|
-
export { Checkbox, CheckboxGroupContext, CheckboxGroupProvider, Field, FieldError, FieldPath, Form, FormContext, Form$1 as FormInstance, FormProvider, Name, Options, PathValueOf, Select, createFormContext, subscribe, useCheckboxGroupContext, useDirtyFields, useError, useErrorByPath, useField, useFieldArray, useFieldErrors, useFieldErrorsByPath, useForm, useFormContext, useHasErrors, useIsDirty, useIsSubmitting, useSubmitCount, useTouched, useTouchedByPath, useTouchedFields, useValue, useValueByPath, useWatch };
|
|
487
|
+
export { Checkbox, CheckboxGroupContext, CheckboxGroupProvider, Field, FieldError, FieldPath, Form, FormContext, Form$1 as FormInstance, FormProvider, Name, Options, Path, PathValueOf, Select, Validator, createFormContext, fieldErrorId, subscribe, useCheckboxGroupContext, useDirtyFields, useError, useErrorByPath, useField, useFieldArray, useFieldErrors, useFieldErrorsByPath, useForm, useFormContext, useHasErrors, useIsDirty, useIsSubmitting, useSubmitCount, useTouched, useTouchedByPath, useTouchedFields, useValue, useValueByPath, useWatch };
|
|
472
488
|
export type { FieldRules, SubscribeEvent, SubscribeOptions, WatchScope };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, {
|
|
2
|
+
import React__default, { useCallback, useRef, useState, useEffect, useMemo, useContext, useReducer, createContext, createElement } from 'react';
|
|
3
3
|
|
|
4
4
|
function getSet(ee, key) {
|
|
5
5
|
var set = ee.get(key);
|
|
@@ -11,7 +11,7 @@ function getSet(ee, key) {
|
|
|
11
11
|
function create$2() {
|
|
12
12
|
return new Map();
|
|
13
13
|
}
|
|
14
|
-
function emit
|
|
14
|
+
function emit(ee, key) {
|
|
15
15
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
16
16
|
args[_key - 2] = arguments[_key];
|
|
17
17
|
}
|
|
@@ -144,6 +144,31 @@ function setOwned(root, path, value, owned) {
|
|
|
144
144
|
function isPromise(value) {
|
|
145
145
|
return value && typeof value.then === "function";
|
|
146
146
|
}
|
|
147
|
+
function isEqual(a, b) {
|
|
148
|
+
if (Object.is(a, b)) return true;
|
|
149
|
+
if (a instanceof Date && b instanceof Date)
|
|
150
|
+
return a.getTime() === b.getTime();
|
|
151
|
+
if (!a || !b || typeof a !== "object" || typeof b !== "object") return false;
|
|
152
|
+
const isArray = Array.isArray(a);
|
|
153
|
+
if (isArray !== Array.isArray(b)) return false;
|
|
154
|
+
if (isArray) {
|
|
155
|
+
if (a.length !== b.length) return false;
|
|
156
|
+
for (let i = 0; i < a.length; i++) {
|
|
157
|
+
if (!isEqual(a[i], b[i])) return false;
|
|
158
|
+
}
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
const proto = Object.getPrototypeOf(a);
|
|
162
|
+
if (proto !== Object.prototype && proto !== null) return false;
|
|
163
|
+
if (Object.getPrototypeOf(b) !== proto) return false;
|
|
164
|
+
const keysA = Object.keys(a);
|
|
165
|
+
const keysB = Object.keys(b);
|
|
166
|
+
if (keysA.length !== keysB.length) return false;
|
|
167
|
+
for (const key of keysA) {
|
|
168
|
+
if (!isEqual(a[key], b[key])) return false;
|
|
169
|
+
}
|
|
170
|
+
return true;
|
|
171
|
+
}
|
|
147
172
|
function waitUntil(emitter, event, isResolve, isReject) {
|
|
148
173
|
return new Promise((resolve, reject) => {
|
|
149
174
|
if (isReject()) return void reject();
|
|
@@ -166,7 +191,6 @@ function create$1(name) {
|
|
|
166
191
|
return { value, key: JSON.stringify(value) };
|
|
167
192
|
}
|
|
168
193
|
|
|
169
|
-
const emit = emit$1;
|
|
170
194
|
const VALIDATION_OUTCOME = /* @__PURE__ */ Symbol("validation-outcome");
|
|
171
195
|
function create(options) {
|
|
172
196
|
const emitter = create$2();
|
|
@@ -302,6 +326,19 @@ function clearErrors(form, name) {
|
|
|
302
326
|
for (const { key } of paths) errors.delete(key);
|
|
303
327
|
for (const path of paths) emit(emitter, "errors", path);
|
|
304
328
|
}
|
|
329
|
+
function setServerErrors(form, errors, options) {
|
|
330
|
+
if (!options?.keepExisting) clearErrors(form);
|
|
331
|
+
for (const [name, error] of Object.entries(errors)) {
|
|
332
|
+
setError(
|
|
333
|
+
form,
|
|
334
|
+
name,
|
|
335
|
+
(Array.isArray(error) ? error : [error]).map((message) => ({
|
|
336
|
+
type: "server",
|
|
337
|
+
message
|
|
338
|
+
}))
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
305
342
|
function setTouched(form, name) {
|
|
306
343
|
setTouchedByPath(form, create$1(name));
|
|
307
344
|
}
|
|
@@ -402,7 +439,9 @@ function reviveBranch(deleted, { key }) {
|
|
|
402
439
|
}
|
|
403
440
|
}
|
|
404
441
|
function setInitialValues(form, initialValues) {
|
|
405
|
-
if (form.initialValues === initialValues)
|
|
442
|
+
if (form.initialValues === initialValues || isEqual(form.initialValues, initialValues)) {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
406
445
|
form.initialValues = initialValues;
|
|
407
446
|
form.parsedValues = void 0;
|
|
408
447
|
form.values.clear();
|
|
@@ -761,7 +800,7 @@ function requireUseSyncExternalStoreShim_production () {
|
|
|
761
800
|
var nextValue = latestGetSnapshot();
|
|
762
801
|
return !objectIs(inst, nextValue);
|
|
763
802
|
} catch (error) {
|
|
764
|
-
return
|
|
803
|
+
return true;
|
|
765
804
|
}
|
|
766
805
|
}
|
|
767
806
|
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
@@ -803,7 +842,7 @@ function requireUseSyncExternalStoreShim_development () {
|
|
|
803
842
|
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
804
843
|
didWarnOld18Alpha ||
|
|
805
844
|
void 0 === React.startTransition ||
|
|
806
|
-
((didWarnOld18Alpha =
|
|
845
|
+
((didWarnOld18Alpha = true),
|
|
807
846
|
console.error(
|
|
808
847
|
"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
|
|
809
848
|
));
|
|
@@ -814,7 +853,7 @@ function requireUseSyncExternalStoreShim_development () {
|
|
|
814
853
|
(console.error(
|
|
815
854
|
"The result of getSnapshot should be cached to avoid an infinite loop"
|
|
816
855
|
),
|
|
817
|
-
(didWarnUncachedGetSnapshot =
|
|
856
|
+
(didWarnUncachedGetSnapshot = true));
|
|
818
857
|
}
|
|
819
858
|
cachedValue = useState({
|
|
820
859
|
inst: { value: value, getSnapshot: getSnapshot }
|
|
@@ -848,7 +887,7 @@ function requireUseSyncExternalStoreShim_development () {
|
|
|
848
887
|
var nextValue = latestGetSnapshot();
|
|
849
888
|
return !objectIs(inst, nextValue);
|
|
850
889
|
} catch (error) {
|
|
851
|
-
return
|
|
890
|
+
return true;
|
|
852
891
|
}
|
|
853
892
|
}
|
|
854
893
|
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
@@ -864,8 +903,8 @@ function requireUseSyncExternalStoreShim_development () {
|
|
|
864
903
|
useEffect = React.useEffect,
|
|
865
904
|
useLayoutEffect = React.useLayoutEffect,
|
|
866
905
|
useDebugValue = React.useDebugValue,
|
|
867
|
-
didWarnOld18Alpha =
|
|
868
|
-
didWarnUncachedGetSnapshot =
|
|
906
|
+
didWarnOld18Alpha = false,
|
|
907
|
+
didWarnUncachedGetSnapshot = false,
|
|
869
908
|
shim =
|
|
870
909
|
"undefined" === typeof window ||
|
|
871
910
|
"undefined" === typeof window.document ||
|
|
@@ -882,13 +921,21 @@ function requireUseSyncExternalStoreShim_development () {
|
|
|
882
921
|
return useSyncExternalStoreShim_development;
|
|
883
922
|
}
|
|
884
923
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
924
|
+
var hasRequiredShim;
|
|
925
|
+
|
|
926
|
+
function requireShim () {
|
|
927
|
+
if (hasRequiredShim) return shim.exports;
|
|
928
|
+
hasRequiredShim = 1;
|
|
929
|
+
|
|
930
|
+
if (process.env.NODE_ENV === 'production') {
|
|
931
|
+
shim.exports = requireUseSyncExternalStoreShim_production();
|
|
932
|
+
} else {
|
|
933
|
+
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
934
|
+
}
|
|
935
|
+
return shim.exports;
|
|
889
936
|
}
|
|
890
937
|
|
|
891
|
-
var shimExports =
|
|
938
|
+
var shimExports = requireShim();
|
|
892
939
|
|
|
893
940
|
function isDescendant(key, ancestorKey) {
|
|
894
941
|
return key.startsWith(`${ancestorKey.slice(0, -1)},`);
|
|
@@ -1064,31 +1111,6 @@ function useIsSubmitting(form) {
|
|
|
1064
1111
|
function useSubmitCount(form) {
|
|
1065
1112
|
return useWatch(form.emitter, "submitCount", () => form.submitCount);
|
|
1066
1113
|
}
|
|
1067
|
-
function isEqual(a, b) {
|
|
1068
|
-
if (Object.is(a, b)) return true;
|
|
1069
|
-
if (a instanceof Date && b instanceof Date)
|
|
1070
|
-
return a.getTime() === b.getTime();
|
|
1071
|
-
if (!a || !b || typeof a !== "object" || typeof b !== "object") return false;
|
|
1072
|
-
const isArray = Array.isArray(a);
|
|
1073
|
-
if (isArray !== Array.isArray(b)) return false;
|
|
1074
|
-
if (isArray) {
|
|
1075
|
-
if (a.length !== b.length) return false;
|
|
1076
|
-
for (let i = 0; i < a.length; i++) {
|
|
1077
|
-
if (!isEqual(a[i], b[i])) return false;
|
|
1078
|
-
}
|
|
1079
|
-
return true;
|
|
1080
|
-
}
|
|
1081
|
-
const proto = Object.getPrototypeOf(a);
|
|
1082
|
-
if (proto !== Object.prototype && proto !== null) return false;
|
|
1083
|
-
if (Object.getPrototypeOf(b) !== proto) return false;
|
|
1084
|
-
const keysA = Object.keys(a);
|
|
1085
|
-
const keysB = Object.keys(b);
|
|
1086
|
-
if (keysA.length !== keysB.length) return false;
|
|
1087
|
-
for (const key of keysA) {
|
|
1088
|
-
if (!isEqual(a[key], b[key])) return false;
|
|
1089
|
-
}
|
|
1090
|
-
return true;
|
|
1091
|
-
}
|
|
1092
1114
|
|
|
1093
1115
|
function usePath(name) {
|
|
1094
1116
|
const path = useMemo(() => create$1(normalizePath(name)), [name]);
|
|
@@ -1471,6 +1493,9 @@ function errorIdFromKey(key) {
|
|
|
1471
1493
|
const id = key.replace(/["'[\],\s]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1472
1494
|
return id || "field";
|
|
1473
1495
|
}
|
|
1496
|
+
function fieldErrorId(name) {
|
|
1497
|
+
return errorIdFromKey(create$1(name).key);
|
|
1498
|
+
}
|
|
1474
1499
|
const Field = React.forwardRef(
|
|
1475
1500
|
({
|
|
1476
1501
|
validate,
|
|
@@ -1559,16 +1584,17 @@ const Field = React.forwardRef(
|
|
|
1559
1584
|
);
|
|
1560
1585
|
const toValue = eventToValue ?? ((e) => e.target.value);
|
|
1561
1586
|
const errorId = errorIdFromKey(fieldKey);
|
|
1587
|
+
const describedBy = error ? [props["aria-describedby"], errorId].filter(Boolean).join(" ") : props["aria-describedby"];
|
|
1562
1588
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
1563
1589
|
Component,
|
|
1564
1590
|
{
|
|
1565
|
-
"aria-invalid": error ? true : void 0,
|
|
1566
|
-
"aria-describedby": error && renderError ? errorId : void 0,
|
|
1567
1591
|
...props,
|
|
1568
1592
|
name: fieldKey,
|
|
1569
1593
|
onBlur,
|
|
1570
1594
|
...asProps,
|
|
1571
1595
|
...valueToProps ? valueToProps(value) : { value },
|
|
1596
|
+
"aria-invalid": error ? true : props["aria-invalid"],
|
|
1597
|
+
"aria-describedby": describedBy,
|
|
1572
1598
|
disabled: isDisabled,
|
|
1573
1599
|
onChange: (e) => onChange(toValue(e)),
|
|
1574
1600
|
ref: mergedRef
|
|
@@ -1610,12 +1636,13 @@ const Checkbox = React.forwardRef(
|
|
|
1610
1636
|
return /* @__PURE__ */ React.createElement(
|
|
1611
1637
|
"input",
|
|
1612
1638
|
{
|
|
1613
|
-
"aria-invalid": error ? true : void 0,
|
|
1614
1639
|
...props,
|
|
1615
1640
|
name: fieldKey,
|
|
1616
1641
|
onBlur,
|
|
1617
1642
|
type: "checkbox",
|
|
1618
1643
|
checked: !!value,
|
|
1644
|
+
"aria-invalid": error ? true : props["aria-invalid"],
|
|
1645
|
+
"aria-describedby": error ? [props["aria-describedby"], errorIdFromKey(fieldKey)].filter(Boolean).join(" ") : props["aria-describedby"],
|
|
1619
1646
|
disabled: isDisabled,
|
|
1620
1647
|
onChange: (e) => onChange(e.target.checked),
|
|
1621
1648
|
ref
|
|
@@ -1663,12 +1690,13 @@ const Select = React.forwardRef(
|
|
|
1663
1690
|
return /* @__PURE__ */ React.createElement(
|
|
1664
1691
|
"select",
|
|
1665
1692
|
{
|
|
1666
|
-
"aria-invalid": error ? true : void 0,
|
|
1667
1693
|
...props,
|
|
1668
1694
|
name: fieldKey,
|
|
1669
1695
|
onBlur,
|
|
1670
1696
|
multiple,
|
|
1671
1697
|
value: toSelectValue(multiple, value),
|
|
1698
|
+
"aria-invalid": error ? true : props["aria-invalid"],
|
|
1699
|
+
"aria-describedby": error ? [props["aria-describedby"], errorIdFromKey(fieldKey)].filter(Boolean).join(" ") : props["aria-describedby"],
|
|
1672
1700
|
disabled: isDisabled,
|
|
1673
1701
|
onChange: (e) => onChange(
|
|
1674
1702
|
multiple ? Array.from(e.target.selectedOptions, (option) => option.value) : e.target.value
|
|
@@ -1680,5 +1708,5 @@ const Select = React.forwardRef(
|
|
|
1680
1708
|
}
|
|
1681
1709
|
);
|
|
1682
1710
|
|
|
1683
|
-
export { Checkbox, CheckboxGroupContext, CheckboxGroupProvider, Field, Form, FormContext, FormProvider, Select, VALIDATION_OUTCOME, clearErrors, create as createForm, createFormContext, ensureValidate, getDirtyFields, getError, getErrorByPath, getErrors, getFieldErrors, getFieldErrorsByPath, getFieldState, getFirstError, getTouchedFields, getValue, getValueByPath, getValues, handleSubmit, hasErrors, hasTouched, hasTouchedByPath, incrementSubmitCount, isDirty, isTouched, removeField, removeFieldByPath, reset, resetField, setDisabled, setError, setErrorByPath, setFocus, setInitialValues, setIsSubmitting, setSubmitSuccessful, setTouched, setTouchedByPath, setValidatingByPath, setValue, setValueByPath, subscribe, trigger, unsetValidatingByPath, useCheckboxGroupContext, useDirtyFields, useError, useErrorByPath, useField, useFieldArray, useFieldErrors, useFieldErrorsByPath, useForm, useFormContext, useHasErrors, useIsDirty, useIsSubmitting, useSubmitCount, useTouched, useTouchedByPath, useTouchedFields, useValue, useValueByPath, useWatch, validate };
|
|
1711
|
+
export { Checkbox, CheckboxGroupContext, CheckboxGroupProvider, Field, Form, FormContext, FormProvider, Select, VALIDATION_OUTCOME, clearErrors, create as createForm, createFormContext, ensureValidate, fieldErrorId, getDirtyFields, getError, getErrorByPath, getErrors, getFieldErrors, getFieldErrorsByPath, getFieldState, getFirstError, getTouchedFields, getValue, getValueByPath, getValues, handleSubmit, hasErrors, hasTouched, hasTouchedByPath, incrementSubmitCount, isDirty, isTouched, removeField, removeFieldByPath, reset, resetField, setDisabled, setError, setErrorByPath, setFocus, setInitialValues, setIsSubmitting, setServerErrors, setSubmitSuccessful, setTouched, setTouchedByPath, setValidatingByPath, setValue, setValueByPath, subscribe, trigger, unsetValidatingByPath, useCheckboxGroupContext, useDirtyFields, useError, useErrorByPath, useField, useFieldArray, useFieldErrors, useFieldErrorsByPath, useForm, useFormContext, useHasErrors, useIsDirty, useIsSubmitting, useSubmitCount, useTouched, useTouchedByPath, useTouchedFields, useValue, useValueByPath, useWatch, validate };
|
|
1684
1712
|
//# sourceMappingURL=index.mjs.map
|