@insforge/react 0.4.6 → 0.4.7
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 +28 -14
- package/dist/atoms.cjs.map +1 -1
- package/dist/atoms.js +29 -15
- package/dist/atoms.js.map +1 -1
- package/dist/components.cjs +36 -24
- package/dist/components.cjs.map +1 -1
- package/dist/components.js +37 -25
- package/dist/components.js.map +1 -1
- package/dist/forms.cjs +28 -14
- package/dist/forms.cjs.map +1 -1
- package/dist/forms.js +29 -15
- package/dist/forms.js.map +1 -1
- package/dist/index.cjs +38 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +38 -26
- package/dist/index.js.map +1 -1
- package/dist/lib.cjs +24 -0
- package/dist/lib.cjs.map +1 -1
- package/dist/lib.d.cts +36 -1
- package/dist/lib.d.ts +36 -1
- package/dist/lib.js +23 -1
- package/dist/lib.js.map +1 -1
- package/package.json +1 -1
package/dist/forms.cjs
CHANGED
|
@@ -171,6 +171,28 @@ function createRequirements(config) {
|
|
|
171
171
|
}
|
|
172
172
|
return requirements;
|
|
173
173
|
}
|
|
174
|
+
|
|
175
|
+
// src/lib/path-utils.ts
|
|
176
|
+
function resolveAuthPath(targetPath) {
|
|
177
|
+
if (typeof window === "undefined") {
|
|
178
|
+
return targetPath;
|
|
179
|
+
}
|
|
180
|
+
const currentPath = window.location.pathname;
|
|
181
|
+
if (currentPath.startsWith("/auth/")) {
|
|
182
|
+
if (targetPath.startsWith("/auth/")) {
|
|
183
|
+
return targetPath;
|
|
184
|
+
}
|
|
185
|
+
return `/auth${targetPath}`;
|
|
186
|
+
}
|
|
187
|
+
return targetPath;
|
|
188
|
+
}
|
|
189
|
+
function resolveAuthUrl(targetPath, searchParams) {
|
|
190
|
+
const resolvedPath = resolveAuthPath(targetPath);
|
|
191
|
+
if (!searchParams || searchParams.toString() === "") {
|
|
192
|
+
return resolvedPath;
|
|
193
|
+
}
|
|
194
|
+
return `${resolvedPath}?${searchParams.toString()}`;
|
|
195
|
+
}
|
|
174
196
|
function AuthPasswordField({
|
|
175
197
|
label,
|
|
176
198
|
id,
|
|
@@ -183,6 +205,10 @@ function AuthPasswordField({
|
|
|
183
205
|
}) {
|
|
184
206
|
const [showPassword, setShowPassword] = react.useState(false);
|
|
185
207
|
const [showStrength, setShowStrength] = react.useState(false);
|
|
208
|
+
const resolvedForgotPasswordHref = react.useMemo(
|
|
209
|
+
() => forgotPasswordLink ? resolveAuthPath(forgotPasswordLink.href) : void 0,
|
|
210
|
+
[forgotPasswordLink]
|
|
211
|
+
);
|
|
186
212
|
const handleFocus = (e) => {
|
|
187
213
|
if (showStrengthIndicator) {
|
|
188
214
|
setShowStrength(true);
|
|
@@ -192,7 +218,7 @@ function AuthPasswordField({
|
|
|
192
218
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-passwordField if-internal-p5w9m7", children: [
|
|
193
219
|
(label || forgotPasswordLink) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-passwordField-labelRow", children: [
|
|
194
220
|
/* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, className: "if-passwordField-label", children: label }),
|
|
195
|
-
forgotPasswordLink && /* @__PURE__ */ jsxRuntime.jsx("a", { href:
|
|
221
|
+
forgotPasswordLink && resolvedForgotPasswordHref && /* @__PURE__ */ jsxRuntime.jsx("a", { href: resolvedForgotPasswordHref, className: "if-passwordField-forgotLink", children: forgotPasswordLink.text || "Forget Password?" })
|
|
196
222
|
] }),
|
|
197
223
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "if-passwordField-inputWrapper", children: [
|
|
198
224
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -245,19 +271,7 @@ function AuthSubmitButton({
|
|
|
245
271
|
}
|
|
246
272
|
function AuthLink({ text, linkText, href }) {
|
|
247
273
|
const [searchParams] = reactRouterDom.useSearchParams();
|
|
248
|
-
const
|
|
249
|
-
const finalHref = (() => {
|
|
250
|
-
if (!currentSearch) {
|
|
251
|
-
return href;
|
|
252
|
-
}
|
|
253
|
-
try {
|
|
254
|
-
const url = new URL(href, window.location.origin);
|
|
255
|
-
url.search = currentSearch;
|
|
256
|
-
return url.pathname + url.search;
|
|
257
|
-
} catch {
|
|
258
|
-
return href;
|
|
259
|
-
}
|
|
260
|
-
})();
|
|
274
|
+
const finalHref = resolveAuthUrl(href, searchParams);
|
|
261
275
|
return /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "if-authLink if-internal-al5w9p", children: [
|
|
262
276
|
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "if-authLink-text", children: text }),
|
|
263
277
|
text && " ",
|