@insforge/react 0.4.12 → 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/dist/atoms.cjs +20 -5
- package/dist/atoms.cjs.map +1 -1
- package/dist/atoms.js +20 -5
- package/dist/atoms.js.map +1 -1
- package/dist/components.cjs +25 -10
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +25 -10
- package/dist/components.js.map +1 -1
- package/dist/forms.cjs +20 -5
- package/dist/forms.cjs.map +1 -1
- package/dist/forms.js +20 -5
- package/dist/forms.js.map +1 -1
- package/dist/hooks.cjs +1 -0
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.js +1 -0
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +57 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +55 -49
- package/dist/index.js.map +1 -1
- package/dist/navigation.cjs +53 -0
- package/dist/navigation.cjs.map +1 -0
- package/dist/navigation.d.cts +64 -0
- package/dist/navigation.d.ts +64 -0
- package/dist/navigation.js +48 -0
- package/dist/navigation.js.map +1 -0
- package/package.json +6 -7
- package/dist/router.cjs +0 -45
- package/dist/router.cjs.map +0 -1
- package/dist/router.d.cts +0 -79
- package/dist/router.d.ts +0 -79
- package/dist/router.js +0 -43
- package/dist/router.js.map +0 -1
package/dist/forms.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { AlertTriangle, EyeOff, Eye, Loader2, CircleCheck, Check } from 'lucide-react';
|
|
3
3
|
import { createContext, useState, useEffect, useMemo, useCallback, useContext, useRef } from 'react';
|
|
4
|
-
import { useSearchParams } from 'react-router-dom';
|
|
5
4
|
import '@insforge/sdk';
|
|
6
5
|
|
|
7
6
|
// src/components/atoms/AuthBranding.tsx
|
|
@@ -102,6 +101,20 @@ function AuthFormField({ label, id, ...props }) {
|
|
|
102
101
|
/* @__PURE__ */ jsx("input", { id, className: "if-formField-input if-internal-i2v8k4", ...props })
|
|
103
102
|
] });
|
|
104
103
|
}
|
|
104
|
+
var NavigationContext = createContext(null);
|
|
105
|
+
function useNavigationAdapter() {
|
|
106
|
+
const adapter = useContext(NavigationContext);
|
|
107
|
+
if (!adapter) {
|
|
108
|
+
throw new Error("useNavigationAdapter must be used within NavigationProvider");
|
|
109
|
+
}
|
|
110
|
+
return adapter;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/navigation/useSearchParams.ts
|
|
114
|
+
function useSearchParams() {
|
|
115
|
+
const adapter = useNavigationAdapter();
|
|
116
|
+
return adapter.useSearchParams();
|
|
117
|
+
}
|
|
105
118
|
function AuthPasswordStrengthIndicator({
|
|
106
119
|
password,
|
|
107
120
|
config
|
|
@@ -195,7 +208,8 @@ function AuthPasswordField({
|
|
|
195
208
|
onFocus,
|
|
196
209
|
...props
|
|
197
210
|
}) {
|
|
198
|
-
const
|
|
211
|
+
const searchParams = useSearchParams();
|
|
212
|
+
const { Link } = useNavigationAdapter();
|
|
199
213
|
const [showPassword, setShowPassword] = useState(false);
|
|
200
214
|
const [showStrength, setShowStrength] = useState(false);
|
|
201
215
|
const resolvedForgotPasswordHref = useMemo(
|
|
@@ -211,7 +225,7 @@ function AuthPasswordField({
|
|
|
211
225
|
return /* @__PURE__ */ jsxs("div", { className: "if-passwordField if-internal-p5w9m7", children: [
|
|
212
226
|
(label || forgotPasswordLink) && /* @__PURE__ */ jsxs("div", { className: "if-passwordField-labelRow", children: [
|
|
213
227
|
/* @__PURE__ */ jsx("label", { htmlFor: id, className: "if-passwordField-label", children: label }),
|
|
214
|
-
forgotPasswordLink && resolvedForgotPasswordHref && /* @__PURE__ */ jsx(
|
|
228
|
+
forgotPasswordLink && resolvedForgotPasswordHref && /* @__PURE__ */ jsx(Link, { href: resolvedForgotPasswordHref, className: "if-passwordField-forgotLink", children: forgotPasswordLink.text || "Forget Password?" })
|
|
215
229
|
] }),
|
|
216
230
|
/* @__PURE__ */ jsxs("div", { className: "if-passwordField-inputWrapper", children: [
|
|
217
231
|
/* @__PURE__ */ jsx(
|
|
@@ -263,12 +277,13 @@ function AuthSubmitButton({
|
|
|
263
277
|
);
|
|
264
278
|
}
|
|
265
279
|
function AuthLink({ text, linkText, href }) {
|
|
266
|
-
const
|
|
280
|
+
const searchParams = useSearchParams();
|
|
281
|
+
const { Link } = useNavigationAdapter();
|
|
267
282
|
const finalHref = resolveAuthUrl(href, searchParams);
|
|
268
283
|
return /* @__PURE__ */ jsxs("p", { className: "if-authLink if-internal-al5w9p", children: [
|
|
269
284
|
text && /* @__PURE__ */ jsx("span", { className: "if-authLink-text", children: text }),
|
|
270
285
|
text && " ",
|
|
271
|
-
/* @__PURE__ */ jsx(
|
|
286
|
+
/* @__PURE__ */ jsx(Link, { href: finalHref, className: "if-authLink-link", children: linkText })
|
|
272
287
|
] });
|
|
273
288
|
}
|
|
274
289
|
function AuthDivider({ text = "or" }) {
|