@insforge/react 0.4.11 → 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/forms.js CHANGED
@@ -1,9 +1,9 @@
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
 
6
+ // src/components/atoms/AuthBranding.tsx
7
7
  function AuthBranding() {
8
8
  return /* @__PURE__ */ jsxs("div", { className: "if-authBranding if-internal-ab4k9w", children: [
9
9
  /* @__PURE__ */ jsx("p", { className: "if-authBranding-text", children: "Secured by" }),
@@ -101,6 +101,20 @@ function AuthFormField({ label, id, ...props }) {
101
101
  /* @__PURE__ */ jsx("input", { id, className: "if-formField-input if-internal-i2v8k4", ...props })
102
102
  ] });
103
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
+ }
104
118
  function AuthPasswordStrengthIndicator({
105
119
  password,
106
120
  config
@@ -194,7 +208,8 @@ function AuthPasswordField({
194
208
  onFocus,
195
209
  ...props
196
210
  }) {
197
- const [searchParams] = useSearchParams();
211
+ const searchParams = useSearchParams();
212
+ const { Link } = useNavigationAdapter();
198
213
  const [showPassword, setShowPassword] = useState(false);
199
214
  const [showStrength, setShowStrength] = useState(false);
200
215
  const resolvedForgotPasswordHref = useMemo(
@@ -210,7 +225,7 @@ function AuthPasswordField({
210
225
  return /* @__PURE__ */ jsxs("div", { className: "if-passwordField if-internal-p5w9m7", children: [
211
226
  (label || forgotPasswordLink) && /* @__PURE__ */ jsxs("div", { className: "if-passwordField-labelRow", children: [
212
227
  /* @__PURE__ */ jsx("label", { htmlFor: id, className: "if-passwordField-label", children: label }),
213
- forgotPasswordLink && resolvedForgotPasswordHref && /* @__PURE__ */ jsx("a", { href: resolvedForgotPasswordHref, className: "if-passwordField-forgotLink", children: forgotPasswordLink.text || "Forget Password?" })
228
+ forgotPasswordLink && resolvedForgotPasswordHref && /* @__PURE__ */ jsx(Link, { href: resolvedForgotPasswordHref, className: "if-passwordField-forgotLink", children: forgotPasswordLink.text || "Forget Password?" })
214
229
  ] }),
215
230
  /* @__PURE__ */ jsxs("div", { className: "if-passwordField-inputWrapper", children: [
216
231
  /* @__PURE__ */ jsx(
@@ -262,12 +277,13 @@ function AuthSubmitButton({
262
277
  );
263
278
  }
264
279
  function AuthLink({ text, linkText, href }) {
265
- const [searchParams] = useSearchParams();
280
+ const searchParams = useSearchParams();
281
+ const { Link } = useNavigationAdapter();
266
282
  const finalHref = resolveAuthUrl(href, searchParams);
267
283
  return /* @__PURE__ */ jsxs("p", { className: "if-authLink if-internal-al5w9p", children: [
268
284
  text && /* @__PURE__ */ jsx("span", { className: "if-authLink-text", children: text }),
269
285
  text && " ",
270
- /* @__PURE__ */ jsx("a", { href: finalHref, className: "if-authLink-link", children: linkText })
286
+ /* @__PURE__ */ jsx(Link, { href: finalHref, className: "if-authLink-link", children: linkText })
271
287
  ] });
272
288
  }
273
289
  function AuthDivider({ text = "or" }) {