@tomny-dev/uzi 0.14.0 → 0.15.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/components/filter-workspace/FilterWorkspace.d.ts +40 -0
- package/dist/components/filter-workspace/FilterWorkspace.d.ts.map +1 -0
- package/dist/components/filter-workspace/FilterWorkspace.test.d.ts +2 -0
- package/dist/components/filter-workspace/FilterWorkspace.test.d.ts.map +1 -0
- package/dist/index.cjs +18 -14
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -15
- package/dist/index57.js +21 -10
- package/dist/index57.js.map +1 -1
- package/dist/index58.cjs +30 -11
- package/dist/index58.cjs.map +1 -1
- package/dist/index58.js +101 -14
- package/dist/index58.js.map +1 -1
- package/dist/index59.cjs +104 -13
- package/dist/index59.cjs.map +1 -1
- package/dist/index59.js +10 -11
- package/dist/index59.js.map +1 -1
- package/dist/index60.cjs +11 -13
- package/dist/index60.cjs.map +1 -1
- package/dist/index60.js +13 -16
- package/dist/index60.js.map +1 -1
- package/dist/index61.cjs +13 -16
- package/dist/index61.cjs.map +1 -1
- package/dist/index61.js +10 -8
- package/dist/index61.js.map +1 -1
- package/dist/index62.cjs +11 -10
- package/dist/index62.cjs.map +1 -1
- package/dist/index62.js +15 -87
- package/dist/index62.js.map +1 -1
- package/dist/index63.cjs +15 -89
- package/dist/index63.cjs.map +1 -1
- package/dist/index63.js +9 -23
- package/dist/index63.js.map +1 -1
- package/dist/index64.cjs +12 -33
- package/dist/index64.cjs.map +1 -1
- package/dist/index64.js +89 -43
- package/dist/index64.js.map +1 -1
- package/dist/index65.cjs +88 -42
- package/dist/index65.cjs.map +1 -1
- package/dist/index65.js +23 -15
- package/dist/index65.js.map +1 -1
- package/dist/index66.cjs +33 -21
- package/dist/index66.cjs.map +1 -1
- package/dist/index66.js +44 -51
- package/dist/index66.js.map +1 -1
- package/dist/index67.cjs +43 -52
- package/dist/index67.cjs.map +1 -1
- package/dist/index67.js +14 -14
- package/dist/index67.js.map +1 -1
- package/dist/index68.cjs +19 -19
- package/dist/index68.cjs.map +1 -1
- package/dist/index68.js +49 -290
- package/dist/index68.js.map +1 -1
- package/dist/index69.cjs +51 -290
- package/dist/index69.cjs.map +1 -1
- package/dist/index69.js +15 -57
- package/dist/index69.js.map +1 -1
- package/dist/index70.cjs +20 -83
- package/dist/index70.cjs.map +1 -1
- package/dist/index70.js +276 -418
- package/dist/index70.js.map +1 -1
- package/dist/index71.cjs +275 -419
- package/dist/index71.cjs.map +1 -1
- package/dist/index71.js +56 -58
- package/dist/index71.js.map +1 -1
- package/dist/index72.cjs +82 -85
- package/dist/index72.cjs.map +1 -1
- package/dist/index72.js +420 -226
- package/dist/index72.js.map +1 -1
- package/dist/index73.cjs +421 -225
- package/dist/index73.cjs.map +1 -1
- package/dist/index73.js +58 -42
- package/dist/index73.js.map +1 -1
- package/dist/index74.cjs +85 -61
- package/dist/index74.cjs.map +1 -1
- package/dist/index74.js +236 -76
- package/dist/index74.js.map +1 -1
- package/dist/index75.cjs +235 -75
- package/dist/index75.cjs.map +1 -1
- package/dist/index75.js +42 -20
- package/dist/index75.js.map +1 -1
- package/dist/index76.cjs +60 -27
- package/dist/index76.cjs.map +1 -1
- package/dist/index76.js +73 -88
- package/dist/index76.js.map +1 -1
- package/dist/index77.cjs +73 -90
- package/dist/index77.cjs.map +1 -1
- package/dist/index77.js +17 -15
- package/dist/index77.js.map +1 -1
- package/dist/index78.cjs +22 -19
- package/dist/index78.cjs.map +1 -1
- package/dist/index78.js +85 -143
- package/dist/index78.js.map +1 -1
- package/dist/index79.cjs +87 -143
- package/dist/index79.cjs.map +1 -1
- package/dist/index79.js +19 -91
- package/dist/index79.js.map +1 -1
- package/dist/index80.cjs +27 -135
- package/dist/index80.cjs.map +1 -1
- package/dist/index80.js +140 -673
- package/dist/index80.js.map +1 -1
- package/dist/index81.cjs +140 -673
- package/dist/index81.cjs.map +1 -1
- package/dist/index81.js +91 -31
- package/dist/index81.js.map +1 -1
- package/dist/index82.cjs +135 -45
- package/dist/index82.cjs.map +1 -1
- package/dist/index82.js +667 -206
- package/dist/index82.js.map +1 -1
- package/dist/index83.cjs +667 -204
- package/dist/index83.cjs.map +1 -1
- package/dist/index83.js +31 -15
- package/dist/index83.js.map +1 -1
- package/dist/index84.cjs +45 -21
- package/dist/index84.cjs.map +1 -1
- package/dist/index84.js +224 -29
- package/dist/index84.js.map +1 -1
- package/dist/index85.cjs +224 -30
- package/dist/index85.cjs.map +1 -1
- package/dist/index85.js +19 -0
- package/dist/index85.js.map +1 -0
- package/dist/index86.cjs +25 -0
- package/dist/index86.cjs.map +1 -0
- package/dist/index86.js +36 -0
- package/dist/index86.js.map +1 -0
- package/dist/index87.cjs +37 -0
- package/dist/index87.cjs.map +1 -0
- package/dist/style.css +53 -0
- package/package.json +1 -1
package/dist/index67.cjs
CHANGED
|
@@ -1,61 +1,52 @@
|
|
|
1
1
|
const require_runtime = require("./index2.cjs");
|
|
2
2
|
const require_cx = require("./index4.cjs");
|
|
3
|
-
const
|
|
3
|
+
const require_auth_card_module = require("./index66.cjs");
|
|
4
4
|
let react = require("react");
|
|
5
5
|
react = require_runtime.__toESM(react, 1);
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
-
//#region src/components/auth-
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
7
|
+
//#region src/components/auth-card/AuthCard.tsx
|
|
8
|
+
/**
|
|
9
|
+
* AuthCard — a centered card layout for auth pages.
|
|
10
|
+
*
|
|
11
|
+
* - Centered vertically and horizontally on screen
|
|
12
|
+
* - Brand → title → subtitle → form → divider → footer
|
|
13
|
+
* - No auth logic — just the visual template
|
|
14
|
+
*/
|
|
15
|
+
var AuthCard = react.forwardRef(({ title, subtitle, children, footer, brand, className, layout = "fullscreen" }, ref) => {
|
|
16
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
17
|
+
className: require_cx.cx(require_auth_card_module.default.authLayout, layout === "embedded" && require_auth_card_module.default.authLayoutEmbedded, className),
|
|
18
|
+
ref,
|
|
19
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
20
|
+
className: require_auth_card_module.default.authCard,
|
|
21
|
+
children: [
|
|
22
|
+
brand && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
23
|
+
className: require_auth_card_module.default.authBrand,
|
|
24
|
+
children: brand
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
27
|
+
className: require_auth_card_module.default.authHeader,
|
|
28
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
29
|
+
className: require_auth_card_module.default.authTitle,
|
|
30
|
+
children: title
|
|
31
|
+
}), subtitle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
32
|
+
className: require_auth_card_module.default.authSubtitle,
|
|
33
|
+
children: subtitle
|
|
34
|
+
})]
|
|
35
|
+
}),
|
|
36
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
37
|
+
className: require_auth_card_module.default.authBody,
|
|
38
|
+
children
|
|
39
|
+
}),
|
|
40
|
+
footer && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", { className: require_auth_card_module.default.divider }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
41
|
+
className: require_auth_card_module.default.authFooter,
|
|
42
|
+
children: footer
|
|
43
|
+
})] })
|
|
44
|
+
]
|
|
45
|
+
})
|
|
27
46
|
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
var AuthForm = react.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("form", {
|
|
31
|
-
ref,
|
|
32
|
-
className: require_cx.cx(require_auth_form_module.default.form, className),
|
|
33
|
-
...props
|
|
34
|
-
}));
|
|
35
|
-
AuthForm.displayName = "AuthForm";
|
|
36
|
-
/** Associates inline errors with a field; consumers pass the error ID to aria-describedby. */
|
|
37
|
-
function AuthField({ label, htmlFor, error, children, className }) {
|
|
38
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
39
|
-
className: require_cx.cx(require_auth_form_module.default.field, className),
|
|
40
|
-
children: [
|
|
41
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
|
|
42
|
-
htmlFor,
|
|
43
|
-
className: require_auth_form_module.default.label,
|
|
44
|
-
children: label
|
|
45
|
-
}),
|
|
46
|
-
children,
|
|
47
|
-
error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
48
|
-
id: htmlFor + "-error",
|
|
49
|
-
role: "alert",
|
|
50
|
-
className: require_auth_form_module.default.error,
|
|
51
|
-
children: error
|
|
52
|
-
})
|
|
53
|
-
]
|
|
54
|
-
});
|
|
55
|
-
}
|
|
47
|
+
});
|
|
48
|
+
AuthCard.displayName = "AuthCard";
|
|
56
49
|
//#endregion
|
|
57
|
-
exports.
|
|
58
|
-
exports.AuthForm = AuthForm;
|
|
59
|
-
exports.AuthModeSwitch = AuthModeSwitch;
|
|
50
|
+
exports.AuthCard = AuthCard;
|
|
60
51
|
|
|
61
52
|
//# sourceMappingURL=index67.cjs.map
|
package/dist/index67.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index67.cjs","names":[],"sources":["../src/components/auth-
|
|
1
|
+
{"version":3,"file":"index67.cjs","names":[],"sources":["../src/components/auth-card/AuthCard.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cx } from \"../../utils/cx\";\nimport styles from \"./auth-card.module.css\";\n\nexport interface AuthCardProps {\n /** Title displayed at the top of the card. */\n title: React.ReactNode;\n /** Subtitle displayed below the title. */\n subtitle?: React.ReactNode;\n /** Primary form content rendered in the card body. */\n children: React.ReactNode;\n /** Footer links rendered below the divider (e.g., \"No account? Sign up\"). */\n footer?: React.ReactNode;\n /** Optional brand/logo element rendered above the title. */\n brand?: React.ReactNode;\n /** Additional class name for the outer wrapper. */\n className?: string;\n /** Use embedded when rendering within an existing application shell. */\n layout?: \"fullscreen\" | \"embedded\";\n}\n\n/**\n * AuthCard — a centered card layout for auth pages.\n *\n * - Centered vertically and horizontally on screen\n * - Brand → title → subtitle → form → divider → footer\n * - No auth logic — just the visual template\n */\nexport const AuthCard = React.forwardRef<HTMLDivElement, AuthCardProps>(\n ({ title, subtitle, children, footer, brand, className, layout = \"fullscreen\" }, ref) => {\n return (\n <div className={cx(styles.authLayout, layout === \"embedded\" && styles.authLayoutEmbedded, className)} ref={ref}>\n <div className={styles.authCard}>\n {brand && <div className={styles.authBrand}>{brand}</div>}\n <div className={styles.authHeader}>\n <h1 className={styles.authTitle}>{title}</h1>\n {subtitle && <p className={styles.authSubtitle}>{subtitle}</p>}\n </div>\n <div className={styles.authBody}>{children}</div>\n {footer && (\n <>\n <hr className={styles.divider} />\n <p className={styles.authFooter}>{footer}</p>\n </>\n )}\n </div>\n </div>\n );\n },\n);\n\nAuthCard.displayName = \"AuthCard\";\n"],"mappings":";;;;;;;;;;;;;;AA4BA,IAAa,WAAW,MAAM,YAC3B,EAAE,OAAO,UAAU,UAAU,QAAQ,OAAO,WAAW,SAAS,gBAAgB,QAAQ;CACvF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;EAAK,WAAW,WAAA,GAAG,yBAAA,QAAO,YAAY,WAAW,cAAc,yBAAA,QAAO,oBAAoB,SAAS;EAAQ;YACzG,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GAAK,WAAW,yBAAA,QAAO;aAAvB;IACG,SAAS,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;KAAK,WAAW,yBAAA,QAAO;eAAY;IAAW,CAAA;IACxD,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;KAAK,WAAW,yBAAA,QAAO;eAAvB,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;MAAI,WAAW,yBAAA,QAAO;gBAAY;KAAU,CAAA,GAC3C,YAAY,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;MAAG,WAAW,yBAAA,QAAO;gBAAe;KAAY,CAAA,CAC1D;;IACL,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;KAAK,WAAW,yBAAA,QAAO;KAAW;IAAc,CAAA;IAC/C,UACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAI,WAAW,yBAAA,QAAO,QAAU,CAAA,GAChC,iBAAA,GAAA,kBAAA,IAAA,CAAC,KAAD;KAAG,WAAW,yBAAA,QAAO;eAAa;IAAU,CAAA,CAC5C,EAAA,CAAA;GAED;;CACF,CAAA;AAET,CACF;AAEA,SAAS,cAAc"}
|
package/dist/index67.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
//#region src/components/auth-
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var error = "uzi-auth-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
//#region src/components/auth-form/auth-form.module.css
|
|
2
|
+
var modeSwitch = "uzi-auth-form-module__modeSwitch__U6ZS4";
|
|
3
|
+
var modeButton = "uzi-auth-form-module__modeButton__NdbE1";
|
|
4
|
+
var form = "uzi-auth-form-module__form__vAoyo";
|
|
5
|
+
var field = "uzi-auth-form-module__field__9q4y-";
|
|
6
|
+
var label = "uzi-auth-form-module__label__gLxcv";
|
|
7
|
+
var error = "uzi-auth-form-module__error__-TR-E";
|
|
8
|
+
var auth_form_module_default = {
|
|
9
|
+
modeSwitch,
|
|
10
|
+
modeButton,
|
|
11
|
+
form,
|
|
12
|
+
field,
|
|
13
|
+
label,
|
|
14
14
|
error
|
|
15
15
|
};
|
|
16
16
|
//#endregion
|
|
17
|
-
export {
|
|
17
|
+
export { auth_form_module_default as default, error, field, form, label, modeButton, modeSwitch };
|
|
18
18
|
|
|
19
19
|
//# sourceMappingURL=index67.js.map
|
package/dist/index67.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index67.js","names":[],"sources":["../src/components/auth-
|
|
1
|
+
{"version":3,"file":"index67.js","names":[],"sources":["../src/components/auth-form/auth-form.module.css"],"sourcesContent":[".modeSwitch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; padding: 3px; background: var(--background); border-radius: 10px; }\n.modeButton { min-height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--muted-foreground); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; }\n.modeButton[aria-pressed=\"true\"] { background: var(--ts-card-bg, var(--card)); color: var(--foreground); box-shadow: 0 1px 3px rgba(0,0,0,.2); }\n.modeButton:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-ring-offset); }\n.form { display: flex; flex-direction: column; gap: 16px; width: 100%; }\n.form > button[type=\"submit\"] { width: 100%; min-height: 42px; }\n.field { display: flex; flex-direction: column; gap: 6px; }\n.label { font-size: .875rem; font-weight: 500; color: var(--foreground); }\n.field input { width: 100%; min-height: 40px; }\n.error { margin: 0; color: var(--destructive); font-size: .8125rem; }\n"],"mappings":""}
|
package/dist/index68.cjs
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
//#region src/components/auth-
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var error = "uzi-auth-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
//#region src/components/auth-form/auth-form.module.css
|
|
2
|
+
var modeSwitch = "uzi-auth-form-module__modeSwitch__U6ZS4";
|
|
3
|
+
var modeButton = "uzi-auth-form-module__modeButton__NdbE1";
|
|
4
|
+
var form = "uzi-auth-form-module__form__vAoyo";
|
|
5
|
+
var field = "uzi-auth-form-module__field__9q4y-";
|
|
6
|
+
var label = "uzi-auth-form-module__label__gLxcv";
|
|
7
|
+
var error = "uzi-auth-form-module__error__-TR-E";
|
|
8
|
+
var auth_form_module_default = {
|
|
9
|
+
modeSwitch,
|
|
10
|
+
modeButton,
|
|
11
|
+
form,
|
|
12
|
+
field,
|
|
13
|
+
label,
|
|
14
14
|
error
|
|
15
15
|
};
|
|
16
16
|
//#endregion
|
|
17
|
-
exports.default =
|
|
17
|
+
exports.default = auth_form_module_default;
|
|
18
18
|
exports.error = error;
|
|
19
|
-
exports.
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
22
|
-
exports.
|
|
23
|
-
exports.
|
|
19
|
+
exports.field = field;
|
|
20
|
+
exports.form = form;
|
|
21
|
+
exports.label = label;
|
|
22
|
+
exports.modeButton = modeButton;
|
|
23
|
+
exports.modeSwitch = modeSwitch;
|
|
24
24
|
|
|
25
25
|
//# sourceMappingURL=index68.cjs.map
|
package/dist/index68.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index68.cjs","names":[],"sources":["../src/components/auth-
|
|
1
|
+
{"version":3,"file":"index68.cjs","names":[],"sources":["../src/components/auth-form/auth-form.module.css"],"sourcesContent":[".modeSwitch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; padding: 3px; background: var(--background); border-radius: 10px; }\n.modeButton { min-height: 36px; border: 0; border-radius: 7px; background: transparent; color: var(--muted-foreground); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; }\n.modeButton[aria-pressed=\"true\"] { background: var(--ts-card-bg, var(--card)); color: var(--foreground); box-shadow: 0 1px 3px rgba(0,0,0,.2); }\n.modeButton:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-ring-offset); }\n.form { display: flex; flex-direction: column; gap: 16px; width: 100%; }\n.form > button[type=\"submit\"] { width: 100%; min-height: 42px; }\n.field { display: flex; flex-direction: column; gap: 6px; }\n.label { font-size: .875rem; font-weight: 500; color: var(--foreground); }\n.field input { width: 100%; min-height: 40px; }\n.error { margin: 0; color: var(--destructive); font-size: .8125rem; }\n"],"mappings":""}
|
package/dist/index68.js
CHANGED
|
@@ -1,298 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { AuthCard } from "./index64.js";
|
|
4
|
-
import { AuthField, AuthForm, AuthModeSwitch } from "./index66.js";
|
|
5
|
-
import auth_page_module_default from "./index67.js";
|
|
1
|
+
import { cx } from "./index3.js";
|
|
2
|
+
import auth_form_module_default from "./index67.js";
|
|
6
3
|
import * as React from "react";
|
|
7
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
//#region src/components/auth-
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const emailId = id + "-email";
|
|
28
|
-
const passwordId = id + "-password";
|
|
29
|
-
const confirmId = id + "-confirm";
|
|
30
|
-
const termsId = id + "-terms";
|
|
31
|
-
const signup = mode === "signup";
|
|
32
|
-
const identifierIsEmail = signup || (signInIdentifier?.type ?? "email") === "email";
|
|
33
|
-
const termsRequired = signup && !!signUpOptions?.requireTerms;
|
|
34
|
-
const canSwitch = !!onModeChange || !!onSignIn && !!onSignUp;
|
|
35
|
-
const fieldNames = signUpFields.map((field) => field.name).join("\\u0000");
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
const activeNames = new Set(fieldNames.split("\\u0000").filter(Boolean));
|
|
38
|
-
setExtraValues((previous) => {
|
|
39
|
-
if (Object.keys(previous).every((name) => activeNames.has(name))) return previous;
|
|
40
|
-
return Object.fromEntries(Object.entries(previous).filter(([name]) => activeNames.has(name)));
|
|
41
|
-
});
|
|
42
|
-
}, [fieldNames]);
|
|
43
|
-
React.useEffect(() => {
|
|
44
|
-
setServerError(initialError ?? "");
|
|
45
|
-
}, [initialError]);
|
|
46
|
-
React.useEffect(() => {
|
|
47
|
-
if (initialEmail) setEmail((previous) => previous || initialEmail);
|
|
48
|
-
}, [initialEmail]);
|
|
49
|
-
const switchMode = (next) => {
|
|
50
|
-
if (pendingRef.current || next === mode) return;
|
|
51
|
-
setInternalMode(next);
|
|
52
|
-
setPassword("");
|
|
53
|
-
setConfirmPassword("");
|
|
54
|
-
setShowPassword(false);
|
|
55
|
-
setErrors({});
|
|
56
|
-
setServerError("");
|
|
57
|
-
onModeChange?.(next);
|
|
58
|
-
};
|
|
59
|
-
const submit = async (event) => {
|
|
60
|
-
event.preventDefault();
|
|
61
|
-
if (pendingRef.current || disabled) return;
|
|
62
|
-
const nextErrors = {};
|
|
63
|
-
const normalizedEmail = email.trim();
|
|
64
|
-
if (!normalizedEmail) nextErrors.email = (signup ? "Email" : signInIdentifier?.label ?? "Email") + " is required";
|
|
65
|
-
else if (identifierIsEmail && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(normalizedEmail)) nextErrors.email = "Enter a valid email address";
|
|
66
|
-
if (!signup && signInIdentifier?.maxLength && normalizedEmail.length > signInIdentifier.maxLength) nextErrors.email = "Identifier is too long";
|
|
67
|
-
if (!password) nextErrors.password = "Password is required";
|
|
68
|
-
else if (signup && password.length < minPasswordLength) nextErrors.password = `Use at least ${minPasswordLength} characters`;
|
|
69
|
-
if (signup && requirePasswordConfirmation && password !== confirmPasswordValue) nextErrors.confirm = "Passwords do not match";
|
|
70
|
-
if (!signup && minSignInPasswordLength && password.length < minSignInPasswordLength) nextErrors.password = `Use at least ${minSignInPasswordLength} characters`;
|
|
71
|
-
if (passwordMaxLength && password.length > passwordMaxLength) nextErrors.password = "Password is too long";
|
|
72
|
-
if (signup) for (const field of signUpFields) {
|
|
73
|
-
const value = (extraValues[field.name] ?? "").trim();
|
|
74
|
-
if (field.required && !value) nextErrors[field.name] = field.label + " is required";
|
|
75
|
-
else if (value && field.minLength && value.length < field.minLength) nextErrors[field.name] = field.label + " is too short";
|
|
76
|
-
else if (field.maxLength && value.length > field.maxLength) nextErrors[field.name] = field.label + " is too long";
|
|
77
|
-
else if (field.type === "email" && value && !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)) nextErrors[field.name] = "Enter a valid email address";
|
|
78
|
-
}
|
|
79
|
-
if (termsRequired && !acceptedTerms) nextErrors.terms = "Accept the terms to continue";
|
|
80
|
-
setErrors(nextErrors);
|
|
81
|
-
setServerError("");
|
|
82
|
-
if (Object.keys(nextErrors).length) return;
|
|
83
|
-
pendingRef.current = true;
|
|
84
|
-
setPending(true);
|
|
85
|
-
try {
|
|
86
|
-
const credentials = {
|
|
87
|
-
email: normalizedEmail,
|
|
88
|
-
password
|
|
89
|
-
};
|
|
90
|
-
if (!signup && signInIdentifier) credentials.identifier = normalizedEmail;
|
|
91
|
-
if (signup && signUpFields.length) credentials.fields = Object.fromEntries(signUpFields.map((field) => [field.name, (extraValues[field.name] ?? "").trim()]));
|
|
92
|
-
if (signup) {
|
|
93
|
-
if (!onSignUp) return;
|
|
94
|
-
await onSignUp(credentials);
|
|
95
|
-
} else {
|
|
96
|
-
if (!onSignIn) return;
|
|
97
|
-
await onSignIn(credentials);
|
|
98
|
-
}
|
|
99
|
-
setPassword("");
|
|
100
|
-
setConfirmPassword("");
|
|
101
|
-
setExtraValues({});
|
|
102
|
-
} catch (error) {
|
|
103
|
-
setServerError(error instanceof Error && error.message ? error.message : "Unable to complete the request. Try again.");
|
|
104
|
-
onError?.(error, mode);
|
|
105
|
-
} finally {
|
|
106
|
-
pendingRef.current = false;
|
|
107
|
-
setPending(false);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
return /* @__PURE__ */ jsxs(AuthCard, {
|
|
111
|
-
className,
|
|
112
|
-
layout,
|
|
113
|
-
brand,
|
|
114
|
-
title: signup ? signUpTitle : signInTitle,
|
|
115
|
-
subtitle: signup ? signUpSubtitle : signInSubtitle,
|
|
116
|
-
footer,
|
|
117
|
-
children: [canSwitch && /* @__PURE__ */ jsx(AuthModeSwitch, {
|
|
118
|
-
mode,
|
|
119
|
-
onModeChange: switchMode
|
|
120
|
-
}), /* @__PURE__ */ jsxs(AuthForm, {
|
|
121
|
-
onSubmit: submit,
|
|
122
|
-
noValidate: true,
|
|
123
|
-
"aria-busy": pending,
|
|
124
|
-
children: [
|
|
125
|
-
/* @__PURE__ */ jsx(AuthField, {
|
|
126
|
-
htmlFor: emailId,
|
|
127
|
-
label: signup ? "Email" : signInIdentifier?.label ?? "Email",
|
|
128
|
-
error: errors.email,
|
|
129
|
-
children: /* @__PURE__ */ jsx(Input, {
|
|
130
|
-
id: emailId,
|
|
131
|
-
type: signup ? "email" : signInIdentifier?.type ?? "email",
|
|
132
|
-
placeholder: signup ? "you@example.com" : signInIdentifier?.placeholder ?? "you@example.com",
|
|
133
|
-
value: email,
|
|
134
|
-
autoComplete: signup ? "email" : signInIdentifier?.autoComplete ?? "email",
|
|
135
|
-
maxLength: signup ? 254 : signInIdentifier?.maxLength,
|
|
136
|
-
required: true,
|
|
137
|
-
disabled: disabled || pending,
|
|
138
|
-
"aria-invalid": !!errors.email,
|
|
139
|
-
"aria-describedby": errors.email ? emailId + "-error" : void 0,
|
|
140
|
-
onChange: (event) => {
|
|
141
|
-
setEmail(event.target.value);
|
|
142
|
-
setErrors((old) => ({
|
|
143
|
-
...old,
|
|
144
|
-
email: ""
|
|
145
|
-
}));
|
|
146
|
-
}
|
|
147
|
-
})
|
|
148
|
-
}),
|
|
149
|
-
/* @__PURE__ */ jsx(AuthField, {
|
|
150
|
-
htmlFor: passwordId,
|
|
151
|
-
label: "Password",
|
|
152
|
-
error: errors.password,
|
|
153
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
154
|
-
className: auth_page_module_default.passwordRow,
|
|
155
|
-
children: [/* @__PURE__ */ jsx(Input, {
|
|
156
|
-
id: passwordId,
|
|
157
|
-
type: showPassword ? "text" : "password",
|
|
158
|
-
placeholder: signup ? "At least " + minPasswordLength + " characters" : "Enter your password",
|
|
159
|
-
value: password,
|
|
160
|
-
required: true,
|
|
161
|
-
maxLength: passwordMaxLength,
|
|
162
|
-
disabled: disabled || pending,
|
|
163
|
-
autoComplete: signup ? "new-password" : "current-password",
|
|
164
|
-
"aria-invalid": !!errors.password,
|
|
165
|
-
"aria-describedby": errors.password ? passwordId + "-error" : void 0,
|
|
166
|
-
onChange: (event) => {
|
|
167
|
-
setPassword(event.target.value);
|
|
168
|
-
setErrors((old) => ({
|
|
169
|
-
...old,
|
|
170
|
-
password: ""
|
|
171
|
-
}));
|
|
172
|
-
}
|
|
173
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
174
|
-
type: "button",
|
|
175
|
-
className: auth_page_module_default.visibility,
|
|
176
|
-
disabled: disabled || pending,
|
|
177
|
-
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
178
|
-
"aria-controls": passwordId,
|
|
179
|
-
"aria-pressed": showPassword,
|
|
180
|
-
onClick: () => setShowPassword((old) => !old),
|
|
181
|
-
children: showPassword ? "Hide" : "Show"
|
|
182
|
-
})]
|
|
183
|
-
})
|
|
184
|
-
}),
|
|
185
|
-
signup && requirePasswordConfirmation && /* @__PURE__ */ jsx(AuthField, {
|
|
186
|
-
htmlFor: confirmId,
|
|
187
|
-
label: "Confirm password",
|
|
188
|
-
error: errors.confirm,
|
|
189
|
-
children: /* @__PURE__ */ jsx(Input, {
|
|
190
|
-
id: confirmId,
|
|
191
|
-
type: "password",
|
|
192
|
-
placeholder: "Re-enter password",
|
|
193
|
-
value: confirmPasswordValue,
|
|
194
|
-
autoComplete: "new-password",
|
|
195
|
-
required: true,
|
|
196
|
-
disabled: disabled || pending,
|
|
197
|
-
"aria-invalid": !!errors.confirm,
|
|
198
|
-
"aria-describedby": errors.confirm ? confirmId + "-error" : void 0,
|
|
199
|
-
onChange: (event) => {
|
|
200
|
-
setConfirmPassword(event.target.value);
|
|
201
|
-
setErrors((old) => ({
|
|
202
|
-
...old,
|
|
203
|
-
confirm: ""
|
|
204
|
-
}));
|
|
205
|
-
}
|
|
206
|
-
})
|
|
207
|
-
}),
|
|
208
|
-
signup && signUpFields.map((field) => {
|
|
209
|
-
const fieldId = id + "-" + field.name;
|
|
210
|
-
return /* @__PURE__ */ jsx(AuthField, {
|
|
211
|
-
htmlFor: fieldId,
|
|
212
|
-
label: field.label,
|
|
213
|
-
error: errors[field.name],
|
|
214
|
-
children: /* @__PURE__ */ jsx(Input, {
|
|
215
|
-
id: fieldId,
|
|
216
|
-
type: field.type ?? "text",
|
|
217
|
-
value: extraValues[field.name] ?? "",
|
|
218
|
-
placeholder: field.placeholder,
|
|
219
|
-
autoComplete: field.autoComplete,
|
|
220
|
-
required: field.required,
|
|
221
|
-
minLength: field.minLength,
|
|
222
|
-
maxLength: field.maxLength,
|
|
223
|
-
disabled: disabled || pending,
|
|
224
|
-
"aria-invalid": !!errors[field.name],
|
|
225
|
-
"aria-describedby": errors[field.name] ? fieldId + "-error" : void 0,
|
|
226
|
-
onChange: (event) => {
|
|
227
|
-
setExtraValues((old) => ({
|
|
228
|
-
...old,
|
|
229
|
-
[field.name]: event.target.value
|
|
230
|
-
}));
|
|
231
|
-
setErrors((old) => ({
|
|
232
|
-
...old,
|
|
233
|
-
[field.name]: ""
|
|
234
|
-
}));
|
|
235
|
-
}
|
|
236
|
-
})
|
|
237
|
-
}, field.name);
|
|
238
|
-
}),
|
|
239
|
-
termsRequired && /* @__PURE__ */ jsxs("div", {
|
|
240
|
-
className: auth_page_module_default.terms,
|
|
241
|
-
children: [/* @__PURE__ */ jsxs("label", {
|
|
242
|
-
htmlFor: termsId,
|
|
243
|
-
className: auth_page_module_default.termsLabel,
|
|
244
|
-
children: [/* @__PURE__ */ jsx("input", {
|
|
245
|
-
id: termsId,
|
|
246
|
-
type: "checkbox",
|
|
247
|
-
checked: acceptedTerms,
|
|
248
|
-
disabled: disabled || pending,
|
|
249
|
-
"aria-invalid": !!errors.terms,
|
|
250
|
-
"aria-describedby": errors.terms ? termsId + "-error" : void 0,
|
|
251
|
-
onChange: (event) => {
|
|
252
|
-
setAcceptedTerms(event.target.checked);
|
|
253
|
-
setErrors((old) => ({
|
|
254
|
-
...old,
|
|
255
|
-
terms: ""
|
|
256
|
-
}));
|
|
257
|
-
}
|
|
258
|
-
}), /* @__PURE__ */ jsxs("span", { children: [signUpOptions?.termsLabel ?? "I agree to the ", signUpOptions?.termsHref ? /* @__PURE__ */ jsx("a", {
|
|
259
|
-
href: signUpOptions.termsHref,
|
|
260
|
-
children: "Terms of Service"
|
|
261
|
-
}) : "Terms of Service"] })]
|
|
262
|
-
}), errors.terms && /* @__PURE__ */ jsx("p", {
|
|
263
|
-
className: auth_page_module_default.error,
|
|
264
|
-
id: termsId + "-error",
|
|
265
|
-
role: "alert",
|
|
266
|
-
children: errors.terms
|
|
267
|
-
})]
|
|
268
|
-
}),
|
|
269
|
-
!signup && forgotPasswordHref && /* @__PURE__ */ jsx("a", {
|
|
270
|
-
className: auth_page_module_default.forgot,
|
|
271
|
-
href: forgotPasswordHref,
|
|
272
|
-
children: "Forgot password?"
|
|
273
|
-
}),
|
|
274
|
-
serverError && /* @__PURE__ */ jsx("p", {
|
|
275
|
-
className: auth_page_module_default.error,
|
|
276
|
-
role: "alert",
|
|
277
|
-
children: serverError
|
|
278
|
-
}),
|
|
279
|
-
!(signup ? onSignUp : onSignIn) && /* @__PURE__ */ jsx("p", {
|
|
280
|
-
className: auth_page_module_default.error,
|
|
281
|
-
role: "status",
|
|
282
|
-
children: signup ? "Sign-up is not available." : "Sign-in is not available."
|
|
283
|
-
}),
|
|
284
|
-
/* @__PURE__ */ jsx(Button, {
|
|
285
|
-
type: "submit",
|
|
286
|
-
variant: "primary",
|
|
287
|
-
size: "lg",
|
|
288
|
-
disabled: disabled || pending || (signup ? !onSignUp : !onSignIn),
|
|
289
|
-
children: pending ? signup ? "Creating account..." : "Signing in..." : signup ? "Create account" : "Sign in"
|
|
290
|
-
})
|
|
291
|
-
]
|
|
5
|
+
//#region src/components/auth-form/AuthForm.tsx
|
|
6
|
+
/** An accessible pair of mode buttons; the host app owns navigation and form state. */
|
|
7
|
+
function AuthModeSwitch({ mode, onModeChange, signInLabel = "Sign in", signUpLabel = "Create account", className }) {
|
|
8
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
9
|
+
className: cx(auth_form_module_default.modeSwitch, className),
|
|
10
|
+
role: "group",
|
|
11
|
+
"aria-label": "Account action",
|
|
12
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
13
|
+
type: "button",
|
|
14
|
+
className: auth_form_module_default.modeButton,
|
|
15
|
+
"aria-pressed": mode === "signin",
|
|
16
|
+
onClick: () => onModeChange("signin"),
|
|
17
|
+
children: signInLabel
|
|
18
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
19
|
+
type: "button",
|
|
20
|
+
className: auth_form_module_default.modeButton,
|
|
21
|
+
"aria-pressed": mode === "signup",
|
|
22
|
+
onClick: () => onModeChange("signup"),
|
|
23
|
+
children: signUpLabel
|
|
292
24
|
})]
|
|
293
25
|
});
|
|
294
26
|
}
|
|
27
|
+
/** Consistent form rhythm and full-width submit controls, without owning credentials. */
|
|
28
|
+
var AuthForm = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("form", {
|
|
29
|
+
ref,
|
|
30
|
+
className: cx(auth_form_module_default.form, className),
|
|
31
|
+
...props
|
|
32
|
+
}));
|
|
33
|
+
AuthForm.displayName = "AuthForm";
|
|
34
|
+
/** Associates inline errors with a field; consumers pass the error ID to aria-describedby. */
|
|
35
|
+
function AuthField({ label, htmlFor, error, children, className }) {
|
|
36
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
37
|
+
className: cx(auth_form_module_default.field, className),
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsx("label", {
|
|
40
|
+
htmlFor,
|
|
41
|
+
className: auth_form_module_default.label,
|
|
42
|
+
children: label
|
|
43
|
+
}),
|
|
44
|
+
children,
|
|
45
|
+
error && /* @__PURE__ */ jsx("p", {
|
|
46
|
+
id: htmlFor + "-error",
|
|
47
|
+
role: "alert",
|
|
48
|
+
className: auth_form_module_default.error,
|
|
49
|
+
children: error
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
295
54
|
//#endregion
|
|
296
|
-
export {
|
|
55
|
+
export { AuthField, AuthForm, AuthModeSwitch };
|
|
297
56
|
|
|
298
57
|
//# sourceMappingURL=index68.js.map
|