@rpcbase/form 0.62.0 → 0.64.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/dist/index.js +12 -0
- package/dist/navigationGuard.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,8 +2,20 @@ import { useFormState, useForm as useForm$1, get, set, appendErrors } from "reac
|
|
|
2
2
|
export * from "react-hook-form";
|
|
3
3
|
import { useId, useMemo, useCallback } from "react";
|
|
4
4
|
import { useRegisterNavigationGuard } from "@rpcbase/router";
|
|
5
|
+
import env from "@rpcbase/env";
|
|
5
6
|
import * as n$1 from "zod/v4/core";
|
|
7
|
+
const isFormNavigationGuardDisabledByEnv = () => {
|
|
8
|
+
const raw = env.RB_PUBLIC_DISABLE_FORM_GUARD;
|
|
9
|
+
if (raw === true) return true;
|
|
10
|
+
if (raw === false || raw === void 0) return false;
|
|
11
|
+
if (typeof raw !== "string") return false;
|
|
12
|
+
const val = raw.trim().toLowerCase();
|
|
13
|
+
return val === "1" || val === "true" || val === "yes" || val === "on";
|
|
14
|
+
};
|
|
6
15
|
const normalizeFormNavigationGuardOptions = (input) => {
|
|
16
|
+
if (isFormNavigationGuardDisabledByEnv()) {
|
|
17
|
+
return { enabled: false, blockOnSearch: false };
|
|
18
|
+
}
|
|
7
19
|
if (input === false) {
|
|
8
20
|
return { enabled: false, blockOnSearch: false };
|
|
9
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigationGuard.d.ts","sourceRoot":"","sources":["../src/navigationGuard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"navigationGuard.d.ts","sourceRoot":"","sources":["../src/navigationGuard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAgBtD,MAAM,MAAM,0BAA0B,GAClC,KAAK,GACL;IACA,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAEH,MAAM,MAAM,oCAAoC,GAAG;IACjD,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,mCAAmC,GAC9C,OAAO,0BAA0B,GAAG,SAAS,KAC5C,oCAeF,CAAA;AAED,eAAO,MAAM,yBAAyB,GAAI,6CAIvC;IACD,IAAI,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA;IACpC,iBAAiB,EAAE,OAAO,CAAA;IAC1B,aAAa,EAAE,OAAO,CAAA;CACvB,KAAG,OAKH,CAAA"}
|