@tomny-dev/uzi 0.6.3 → 0.7.0-pr.78.214.1.87d1ede

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.
Files changed (118) hide show
  1. package/dist/components/conversation/Conversation.d.ts +18 -0
  2. package/dist/components/conversation/Conversation.d.ts.map +1 -0
  3. package/dist/components/conversation/Conversation.test.d.ts +2 -0
  4. package/dist/components/conversation/Conversation.test.d.ts.map +1 -0
  5. package/dist/components/multi-select/MultiSelect.d.ts +9 -0
  6. package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
  7. package/dist/components/multi-select/MultiSelect.test.d.ts +2 -0
  8. package/dist/components/multi-select/MultiSelect.test.d.ts.map +1 -0
  9. package/dist/index.cjs +19 -11
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +13 -12
  13. package/dist/index26.js +10 -2
  14. package/dist/index26.js.map +1 -1
  15. package/dist/index27.cjs +13 -1
  16. package/dist/index27.cjs.map +1 -1
  17. package/dist/index27.js +74 -37
  18. package/dist/index27.js.map +1 -1
  19. package/dist/index28.cjs +74 -37
  20. package/dist/index28.cjs.map +1 -1
  21. package/dist/index53.js +26 -16
  22. package/dist/index53.js.map +1 -1
  23. package/dist/index54.cjs +37 -20
  24. package/dist/index54.cjs.map +1 -1
  25. package/dist/index54.js +57 -23
  26. package/dist/index54.js.map +1 -1
  27. package/dist/index55.cjs +63 -24
  28. package/dist/index55.cjs.map +1 -1
  29. package/dist/index55.js +16 -16
  30. package/dist/index55.js.map +1 -1
  31. package/dist/index56.cjs +19 -20
  32. package/dist/index56.cjs.map +1 -1
  33. package/dist/index56.js +24 -21
  34. package/dist/index56.js.map +1 -1
  35. package/dist/index57.cjs +25 -22
  36. package/dist/index57.cjs.map +1 -1
  37. package/dist/index57.js +17 -10
  38. package/dist/index57.js.map +1 -1
  39. package/dist/index58.cjs +23 -11
  40. package/dist/index58.cjs.map +1 -1
  41. package/dist/index58.js +25 -14
  42. package/dist/index58.js.map +1 -1
  43. package/dist/index59.cjs +25 -13
  44. package/dist/index59.cjs.map +1 -1
  45. package/dist/index59.js +10 -11
  46. package/dist/index59.js.map +1 -1
  47. package/dist/index60.cjs +11 -13
  48. package/dist/index60.cjs.map +1 -1
  49. package/dist/index60.js +13 -16
  50. package/dist/index60.js.map +1 -1
  51. package/dist/index61.cjs +13 -16
  52. package/dist/index61.cjs.map +1 -1
  53. package/dist/index61.js +10 -8
  54. package/dist/index61.js.map +1 -1
  55. package/dist/index62.cjs +11 -10
  56. package/dist/index62.cjs.map +1 -1
  57. package/dist/index62.js +15 -87
  58. package/dist/index62.js.map +1 -1
  59. package/dist/index63.cjs +15 -89
  60. package/dist/index63.cjs.map +1 -1
  61. package/dist/index63.js +9 -21
  62. package/dist/index63.js.map +1 -1
  63. package/dist/index64.cjs +12 -30
  64. package/dist/index64.cjs.map +1 -1
  65. package/dist/index64.js +89 -43
  66. package/dist/index64.js.map +1 -1
  67. package/dist/index65.cjs +88 -42
  68. package/dist/index65.cjs.map +1 -1
  69. package/dist/index65.js +14 -50
  70. package/dist/index65.js.map +1 -1
  71. package/dist/index66.cjs +15 -69
  72. package/dist/index66.cjs.map +1 -1
  73. package/dist/index66.js +25 -414
  74. package/dist/index66.js.map +1 -1
  75. package/dist/index67.cjs +25 -416
  76. package/dist/index67.cjs.map +1 -1
  77. package/dist/index67.js +56 -58
  78. package/dist/index67.js.map +1 -1
  79. package/dist/index68.cjs +82 -85
  80. package/dist/index68.cjs.map +1 -1
  81. package/dist/index68.js +419 -226
  82. package/dist/index68.js.map +1 -1
  83. package/dist/index69.cjs +420 -225
  84. package/dist/index69.cjs.map +1 -1
  85. package/dist/index69.js +58 -42
  86. package/dist/index69.js.map +1 -1
  87. package/dist/index70.cjs +85 -61
  88. package/dist/index70.cjs.map +1 -1
  89. package/dist/index70.js +236 -76
  90. package/dist/index70.js.map +1 -1
  91. package/dist/index71.cjs +235 -75
  92. package/dist/index71.cjs.map +1 -1
  93. package/dist/index71.js +42 -20
  94. package/dist/index71.js.map +1 -1
  95. package/dist/index72.cjs +60 -27
  96. package/dist/index72.cjs.map +1 -1
  97. package/dist/index72.js +73 -88
  98. package/dist/index72.js.map +1 -1
  99. package/dist/index73.cjs +73 -90
  100. package/dist/index73.cjs.map +1 -1
  101. package/dist/index73.js +17 -15
  102. package/dist/index73.js.map +1 -1
  103. package/dist/index74.cjs +22 -19
  104. package/dist/index74.cjs.map +1 -1
  105. package/dist/index74.js +85 -143
  106. package/dist/index74.js.map +1 -1
  107. package/dist/index75.cjs +87 -143
  108. package/dist/index75.cjs.map +1 -1
  109. package/dist/index75.js +23 -0
  110. package/dist/index75.js.map +1 -0
  111. package/dist/index76.cjs +31 -0
  112. package/dist/index76.cjs.map +1 -0
  113. package/dist/index76.js +159 -0
  114. package/dist/index76.js.map +1 -0
  115. package/dist/index77.cjs +161 -0
  116. package/dist/index77.cjs.map +1 -0
  117. package/dist/style.css +150 -0
  118. package/package.json +1 -1
package/dist/index69.cjs CHANGED
@@ -1,248 +1,443 @@
1
- "use client";
2
1
  const require_runtime = require("./index2.cjs");
3
2
  const require_cx = require("./index4.cjs");
4
- const require_data_table_module = require("./index68.cjs");
3
+ const require_auth_pages_module = require("./index68.cjs");
5
4
  let react = require("react");
6
5
  react = require_runtime.__toESM(react, 1);
7
6
  let react_jsx_runtime = require("react/jsx-runtime");
8
- //#region src/components/data-table/DataTable.tsx
9
- function DataTable({ data, columns, onRowAction, onSelectionChange, loading = false, emptyMessage = "No data found", pageSize = 10, selectable = false, rowKey = (row) => String(row.id ?? ""), className }) {
10
- const [sortKey, setSortKey] = react.useState(null);
11
- const [sortDir, setSortDir] = react.useState("asc");
12
- const [page, setPage] = react.useState(1);
13
- const [selected, setSelected] = react.useState(/* @__PURE__ */ new Set());
14
- const handleSort = (key) => {
15
- if (key === sortKey) setSortDir((d) => d === "asc" ? "desc" : "asc");
16
- else {
17
- setSortKey(key);
18
- setSortDir("asc");
19
- }
7
+ //#region src/components/auth-pages/AuthPages.tsx
8
+ function EyeIcon({ open }) {
9
+ if (open) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
10
+ viewBox: "0 0 24 24",
11
+ fill: "none",
12
+ "aria-hidden": "true",
13
+ className: require_auth_pages_module.default.eyeIcon,
14
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
15
+ d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z",
16
+ stroke: "currentColor",
17
+ strokeWidth: "2"
18
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
19
+ cx: "12",
20
+ cy: "12",
21
+ r: "3",
22
+ stroke: "currentColor",
23
+ strokeWidth: "2"
24
+ })]
25
+ });
26
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
27
+ viewBox: "0 0 24 24",
28
+ fill: "none",
29
+ "aria-hidden": "true",
30
+ className: require_auth_pages_module.default.eyeIcon,
31
+ children: [
32
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
33
+ d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94",
34
+ stroke: "currentColor",
35
+ strokeWidth: "2"
36
+ }),
37
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
38
+ d: "M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19",
39
+ stroke: "currentColor",
40
+ strokeWidth: "2"
41
+ }),
42
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
43
+ x1: "1",
44
+ y1: "1",
45
+ x2: "23",
46
+ y2: "23",
47
+ stroke: "currentColor",
48
+ strokeWidth: "2"
49
+ })
50
+ ]
51
+ });
52
+ }
53
+ function Field({ label, id, children, error }) {
54
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
55
+ className: require_auth_pages_module.default.field,
56
+ children: [
57
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
58
+ htmlFor: id,
59
+ className: require_auth_pages_module.default.label,
60
+ children: label
61
+ }),
62
+ children,
63
+ error && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
64
+ className: require_auth_pages_module.default.error,
65
+ children: error
66
+ })
67
+ ]
68
+ });
69
+ }
70
+ function PasswordField({ id, label, placeholder, value, onChange, error }) {
71
+ const [show, setShow] = react.useState(false);
72
+ const toggleRef = react.useRef(null);
73
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
74
+ label: label ?? "Password",
75
+ id,
76
+ error,
77
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
78
+ className: require_auth_pages_module.default.passwordWrapper,
79
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
80
+ id,
81
+ type: show ? "text" : "password",
82
+ placeholder,
83
+ value,
84
+ onChange,
85
+ className: require_auth_pages_module.default.input
86
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
87
+ ref: toggleRef,
88
+ type: "button",
89
+ onClick: () => setShow((s) => !s),
90
+ className: require_auth_pages_module.default.toggle,
91
+ "aria-label": show ? "Hide password" : "Show password",
92
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EyeIcon, { open: show })
93
+ })]
94
+ })
95
+ });
96
+ }
97
+ function CheckboxRow({ label, linkText, linkHref, checked, onChange }) {
98
+ if (!label) return null;
99
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
100
+ className: require_auth_pages_module.default.checkboxRow,
101
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
102
+ className: require_auth_pages_module.default.checkboxLabel,
103
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
104
+ type: "checkbox",
105
+ className: require_auth_pages_module.default.checkbox,
106
+ checked,
107
+ onChange: (e) => onChange?.(e.target.checked)
108
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: label })]
109
+ }), linkHref && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
110
+ href: linkHref,
111
+ className: require_auth_pages_module.default.forgotLink,
112
+ children: linkText
113
+ })]
114
+ });
115
+ }
116
+ function SignInPage({ title = "Sign in", subtitle, footer, onSubmit, loading = false, brand, className, emailPlaceholder = "Email address", passwordPlaceholder = "Password", rememberLabel = "Remember me", forgotLinkText = "Forgot password?", forgotLinkHref }) {
117
+ const id = react.useId();
118
+ const [email, setEmail] = react.useState("");
119
+ const [password, setPassword] = react.useState("");
120
+ const [rememberMe, setRememberMe] = react.useState(false);
121
+ const [errors, setErrors] = react.useState({});
122
+ const [submitted, setSubmitted] = react.useState(false);
123
+ const validate = () => {
124
+ const newErrors = {};
125
+ if (!email.trim()) newErrors.email = "Email is required";
126
+ else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) newErrors.email = "Enter a valid email";
127
+ if (!password) newErrors.password = "Password is required";
128
+ setErrors(newErrors);
129
+ return Object.keys(newErrors).length === 0;
20
130
  };
21
- const toggleRow = (id) => {
22
- const next = new Set(selected);
23
- if (next.has(id)) next.delete(id);
24
- else next.add(id);
25
- setSelected(next);
26
- onSelectionChange?.(Array.from(next));
131
+ const handleSubmit = (e) => {
132
+ e.preventDefault();
133
+ setSubmitted(true);
134
+ if (!validate()) return;
135
+ onSubmit?.({
136
+ email,
137
+ password,
138
+ rememberMe
139
+ });
27
140
  };
28
- const toggleAll = () => {
29
- const allKeys = displayedData.map((r) => rowKey(r));
30
- const allSelected = allKeys.every((k) => selected.has(k));
31
- const next = new Set(selected);
32
- if (allSelected) allKeys.forEach((k) => next.delete(k));
33
- else allKeys.forEach((k) => next.add(k));
34
- setSelected(next);
35
- onSelectionChange?.(Array.from(next));
141
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
142
+ className: require_cx.cx(require_auth_pages_module.default.authLayout, className),
143
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
144
+ className: require_auth_pages_module.default.authCard,
145
+ children: [
146
+ brand && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
147
+ className: require_auth_pages_module.default.authBrand,
148
+ children: brand
149
+ }),
150
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
151
+ className: require_auth_pages_module.default.authHeader,
152
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
153
+ className: require_auth_pages_module.default.authTitle,
154
+ children: title
155
+ }), subtitle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
156
+ className: require_auth_pages_module.default.authSubtitle,
157
+ children: subtitle
158
+ })]
159
+ }),
160
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
161
+ onSubmit: handleSubmit,
162
+ className: require_auth_pages_module.default.authForm,
163
+ children: [
164
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
165
+ label: emailPlaceholder,
166
+ id: id + "-email",
167
+ error: submitted ? errors.email : void 0,
168
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
169
+ id: id + "-email",
170
+ type: "email",
171
+ placeholder: "you@example.com",
172
+ value: email,
173
+ onChange: (e) => setEmail(e.target.value),
174
+ className: require_auth_pages_module.default.input,
175
+ autoComplete: "email",
176
+ autoFocus: true
177
+ })
178
+ }),
179
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PasswordField, {
180
+ label: passwordPlaceholder,
181
+ id: id + "-password",
182
+ placeholder: passwordPlaceholder,
183
+ value: password,
184
+ onChange: (e) => {
185
+ setPassword(e.target.value);
186
+ if (submitted) setSubmitted(false);
187
+ },
188
+ error: submitted ? errors.password : void 0
189
+ }),
190
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckboxRow, {
191
+ label: rememberLabel,
192
+ linkText: forgotLinkText,
193
+ linkHref: forgotLinkHref,
194
+ checked: rememberMe,
195
+ onChange: (c) => {
196
+ setRememberMe(c);
197
+ if (submitted) setSubmitted(false);
198
+ }
199
+ }),
200
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
201
+ type: "submit",
202
+ disabled: loading,
203
+ className: require_auth_pages_module.default.submitButton,
204
+ children: loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_auth_pages_module.default.spinner }), "Signing in..."] }) : "Sign in"
205
+ })
206
+ ]
207
+ }),
208
+ footer && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", { className: require_auth_pages_module.default.divider }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
209
+ className: require_auth_pages_module.default.authFooter,
210
+ children: footer
211
+ })] })
212
+ ]
213
+ })
214
+ });
215
+ }
216
+ function SignUpPage({ title = "Create an account", subtitle, footer, onSubmit, loading = false, brand, className, emailPlaceholder = "Email address", passwordPlaceholder = "Password", confirmPasswordPlaceholder = "Confirm password", checkboxLabel, checkboxLinkText, checkboxLinkHref }) {
217
+ const id = react.useId();
218
+ const [email, setEmail] = react.useState("");
219
+ const [password, setPassword] = react.useState("");
220
+ const [confirmPassword, setConfirmPassword] = react.useState("");
221
+ const [agreed, setAgreed] = react.useState(false);
222
+ const [errors, setErrors] = react.useState({});
223
+ const [submitted, setSubmitted] = react.useState(false);
224
+ const validate = () => {
225
+ const newErrors = {};
226
+ if (!email.trim()) newErrors.email = "Email is required";
227
+ else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) newErrors.email = "Enter a valid email";
228
+ if (!password) newErrors.password = "Password is required";
229
+ else if (password.length < 8) newErrors.password = "At least 8 characters";
230
+ if (password !== confirmPassword) newErrors.confirmPassword = "Passwords do not match";
231
+ if (!agreed) newErrors.agreed = "You must agree to continue";
232
+ setErrors(newErrors);
233
+ return Object.keys(newErrors).length === 0;
36
234
  };
37
- const totalPages = Math.max(1, Math.ceil(data.length / pageSize));
38
- const safePage = Math.min(page, totalPages);
39
- const columnSpan = columns.length + (selectable ? 1 : 0) + (onRowAction && onRowAction.length > 0 ? 1 : 0);
40
- react.useEffect(() => {
41
- if (page > totalPages) setPage(totalPages);
42
- }, [
43
- data.length,
44
- page,
45
- totalPages
46
- ]);
47
- const sortedData = react.useMemo(() => {
48
- if (!sortKey) return data;
49
- const sortColumn = columns.find((column) => column.key === sortKey);
50
- const getSortValue = (row) => {
51
- if (sortColumn?.accessor) {
52
- const accessed = sortColumn.accessor(row);
53
- if (typeof accessed === "string" || typeof accessed === "number") return accessed;
54
- }
55
- return row[sortKey];
56
- };
57
- return [...data].sort((a, b) => {
58
- const aVal = getSortValue(a);
59
- const bVal = getSortValue(b);
60
- if (aVal == null) return 1;
61
- if (bVal == null) return -1;
62
- let cmp = 0;
63
- if (typeof aVal === "number" && typeof bVal === "number") cmp = aVal - bVal;
64
- else cmp = String(aVal).localeCompare(String(bVal));
65
- return sortDir === "asc" ? cmp : -cmp;
235
+ const handleSubmit = (e) => {
236
+ e.preventDefault();
237
+ setSubmitted(true);
238
+ if (!validate()) return;
239
+ onSubmit?.({
240
+ email,
241
+ password,
242
+ agreed
66
243
  });
67
- }, [
68
- columns,
69
- data,
70
- sortKey,
71
- sortDir
72
- ]);
73
- const displayedData = react.useMemo(() => {
74
- const start = (safePage - 1) * pageSize;
75
- return sortedData.slice(start, start + pageSize);
76
- }, [
77
- sortedData,
78
- safePage,
79
- pageSize
80
- ]);
81
- const displayedKeys = react.useMemo(() => displayedData.map(rowKey), [displayedData, rowKey]);
82
- const allPageSelected = displayedKeys.length > 0 && displayedKeys.every((k) => selected.has(k));
83
- const somePageSelected = displayedKeys.length > 0 && displayedKeys.some((k) => selected.has(k));
84
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
85
- className: require_cx.cx(require_data_table_module.default.wrapper, className),
86
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
87
- className: require_data_table_module.default.tableContainer,
88
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
89
- className: require_data_table_module.default.table,
90
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", {
91
- className: require_data_table_module.default.thead,
92
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", { children: [
93
- selectable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
94
- className: require_data_table_module.default.headerCell,
95
- "aria-label": "Select all",
244
+ };
245
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
246
+ className: require_cx.cx(require_auth_pages_module.default.authLayout, className),
247
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
248
+ className: require_auth_pages_module.default.authCard,
249
+ children: [
250
+ brand && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
251
+ className: require_auth_pages_module.default.authBrand,
252
+ children: brand
253
+ }),
254
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
255
+ className: require_auth_pages_module.default.authHeader,
256
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
257
+ className: require_auth_pages_module.default.authTitle,
258
+ children: title
259
+ }), subtitle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
260
+ className: require_auth_pages_module.default.authSubtitle,
261
+ children: subtitle
262
+ })]
263
+ }),
264
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
265
+ onSubmit: handleSubmit,
266
+ className: require_auth_pages_module.default.authForm,
267
+ children: [
268
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
269
+ label: emailPlaceholder,
270
+ id: id + "-email",
271
+ error: submitted ? errors.email : void 0,
96
272
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
97
- type: "checkbox",
98
- checked: allPageSelected,
99
- ref: (el) => {
100
- if (el) el.indeterminate = somePageSelected && !allPageSelected;
273
+ id: id + "-email",
274
+ type: "email",
275
+ placeholder: "you@example.com",
276
+ value: email,
277
+ onChange: (e) => {
278
+ setEmail(e.target.value);
279
+ if (submitted) setSubmitted(false);
101
280
  },
102
- onChange: toggleAll,
103
- className: require_data_table_module.default.checkbox,
104
- "aria-label": "Select all rows on this page"
281
+ className: require_auth_pages_module.default.input,
282
+ autoComplete: "email",
283
+ autoFocus: true
105
284
  })
106
285
  }),
107
- columns.map((col) => {
108
- const ariaSort = col.sortable ? sortKey === col.key ? sortDir === "asc" ? "ascending" : "descending" : "none" : void 0;
109
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
110
- className: require_cx.cx(require_data_table_module.default.headerCell, col.width && require_data_table_module.default.headerCellFixed, col.align && require_data_table_module.default[`align${col.align.charAt(0).toUpperCase() + col.align.slice(1)}`]),
111
- style: col.width ? { width: col.width } : void 0,
112
- "aria-sort": ariaSort,
113
- children: col.sortable ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
114
- type: "button",
115
- className: require_cx.cx(require_data_table_module.default.sortableHeader, require_data_table_module.default.clickableHeader),
116
- onClick: () => handleSort(col.key),
117
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
118
- className: require_data_table_module.default.headerLabel,
119
- children: col.label
120
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
121
- className: require_data_table_module.default.sortIcon,
122
- "aria-hidden": "true",
123
- children: sortKey === col.key ? sortDir === "asc" ? "▲" : "▼" : "▲▼"
124
- })]
125
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
126
- className: require_data_table_module.default.headerLabel,
127
- children: col.label
128
- })
129
- }, col.key);
286
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PasswordField, {
287
+ label: passwordPlaceholder,
288
+ id: id + "-password",
289
+ placeholder: passwordPlaceholder,
290
+ value: password,
291
+ onChange: (e) => {
292
+ setPassword(e.target.value);
293
+ if (submitted) setSubmitted(false);
294
+ },
295
+ error: submitted ? errors.password : void 0
130
296
  }),
131
- onRowAction && onRowAction.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
132
- className: require_data_table_module.default.headerCell,
133
- style: { width: "5rem" },
134
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
135
- className: require_data_table_module.default.headerLabel,
136
- children: "Actions"
297
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PasswordField, {
298
+ label: confirmPasswordPlaceholder,
299
+ id: id + "-confirm",
300
+ placeholder: confirmPasswordPlaceholder,
301
+ value: confirmPassword,
302
+ onChange: (e) => {
303
+ setConfirmPassword(e.target.value);
304
+ if (submitted) setSubmitted(false);
305
+ },
306
+ error: submitted ? errors.confirmPassword : void 0
307
+ }),
308
+ checkboxLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
309
+ className: require_auth_pages_module.default.checkboxRow,
310
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
311
+ className: require_auth_pages_module.default.checkboxLabel,
312
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
313
+ id: id + "-agreed",
314
+ type: "checkbox",
315
+ checked: agreed,
316
+ onChange: (e) => {
317
+ setAgreed(e.target.checked);
318
+ if (submitted) setSubmitted(false);
319
+ },
320
+ className: require_auth_pages_module.default.checkbox
321
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: checkboxLinkText ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
322
+ "I agree to the",
323
+ " ",
324
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
325
+ href: checkboxLinkHref,
326
+ className: require_auth_pages_module.default.checkboxLink,
327
+ children: checkboxLinkText
328
+ })
329
+ ] }) : checkboxLabel })]
137
330
  })
331
+ }),
332
+ submitted && errors.agreed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
333
+ className: require_auth_pages_module.default.error,
334
+ children: errors.agreed
335
+ }),
336
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
337
+ type: "submit",
338
+ disabled: loading,
339
+ className: require_auth_pages_module.default.submitButton,
340
+ children: loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_auth_pages_module.default.spinner }), "Creating account..."] }) : "Create account"
138
341
  })
139
- ] })
140
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tbody", {
141
- className: require_data_table_module.default.tbody,
142
- children: loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("td", {
143
- colSpan: columnSpan,
144
- className: require_data_table_module.default.loadingCell,
342
+ ]
343
+ }),
344
+ footer && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", { className: require_auth_pages_module.default.divider }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
345
+ className: require_auth_pages_module.default.authFooter,
346
+ children: footer
347
+ })] })
348
+ ]
349
+ })
350
+ });
351
+ }
352
+ function ForgotPasswordPage({ title = "Reset password", subtitle = "Enter your email and we'll send a reset link", footer, onSubmit, loading = false, brand, className, emailPlaceholder = "Email address", buttonText = "Send reset link", backLinkText = "Back to sign in", backLinkHref = "/signin" }) {
353
+ const id = react.useId();
354
+ const [email, setEmail] = react.useState("");
355
+ const [error, setError] = react.useState("");
356
+ const [sent, setSent] = react.useState(false);
357
+ const handleSubmit = (e) => {
358
+ e.preventDefault();
359
+ if (!email.trim()) {
360
+ setError("Email is required");
361
+ return;
362
+ }
363
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
364
+ setError("Enter a valid email");
365
+ return;
366
+ }
367
+ onSubmit?.({ email });
368
+ setSent(true);
369
+ };
370
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
371
+ className: require_cx.cx(require_auth_pages_module.default.authLayout, className),
372
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
373
+ className: require_auth_pages_module.default.authCard,
374
+ children: [
375
+ brand && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
376
+ className: require_auth_pages_module.default.authBrand,
377
+ children: brand
378
+ }),
379
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
380
+ className: require_auth_pages_module.default.authHeader,
381
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
382
+ className: require_auth_pages_module.default.authTitle,
383
+ children: title
384
+ }), subtitle && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
385
+ className: require_auth_pages_module.default.authSubtitle,
386
+ children: subtitle
387
+ })]
388
+ }),
389
+ sent ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
390
+ className: require_auth_pages_module.default.sentMessage,
391
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
392
+ className: require_auth_pages_module.default.sentText,
145
393
  children: [
146
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
147
- className: require_data_table_module.default.loadingRow,
148
- "aria-busy": "true",
149
- children: [
150
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_data_table_module.default.skeletonBar }),
151
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_data_table_module.default.skeletonBar }),
152
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_data_table_module.default.skeletonBar })
153
- ]
154
- }),
155
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
156
- className: require_data_table_module.default.loadingRow,
157
- "aria-busy": "true",
158
- children: [
159
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_data_table_module.default.skeletonBar }),
160
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_data_table_module.default.skeletonBar }),
161
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_data_table_module.default.skeletonBar })
162
- ]
163
- }),
164
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
165
- className: require_data_table_module.default.loadingRow,
166
- "aria-busy": "true",
167
- children: [
168
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_data_table_module.default.skeletonBar }),
169
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_data_table_module.default.skeletonBar }),
170
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_data_table_module.default.skeletonBar })
171
- ]
172
- })
394
+ "If an account exists for ",
395
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("strong", { children: email }),
396
+ ", you'll receive a reset link shortly."
173
397
  ]
174
- }) }) : data.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
175
- colSpan: columnSpan,
176
- className: require_data_table_module.default.emptyCell,
177
- children: emptyMessage
178
- }) }) : displayedData.map((row) => {
179
- const id = rowKey(row);
180
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tr", {
181
- className: require_cx.cx(require_data_table_module.default.row, selected.has(id) && require_data_table_module.default.rowSelected),
182
- children: [
183
- selectable && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
184
- className: require_data_table_module.default.cell,
185
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
186
- type: "checkbox",
187
- checked: selected.has(id),
188
- onChange: () => toggleRow(id),
189
- className: require_data_table_module.default.checkbox,
190
- "aria-label": `Select row ${id}`
191
- })
192
- }),
193
- columns.map((col) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
194
- className: require_cx.cx(require_data_table_module.default.cell, col.align && require_data_table_module.default[`align${col.align.charAt(0).toUpperCase() + col.align.slice(1)}`]),
195
- children: col.accessor ? col.accessor(row) : String(row[col.key] ?? "")
196
- }, `${id}-${col.key}`)),
197
- onRowAction && onRowAction.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
198
- className: require_data_table_module.default.cell,
199
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
200
- className: require_data_table_module.default.rowActions,
201
- children: onRowAction.map((action) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
202
- type: "button",
203
- className: require_data_table_module.default.actionBtn,
204
- onClick: () => action.onClick(row),
205
- children: action.label
206
- }, action.label))
207
- })
208
- })
209
- ]
210
- }, id);
211
- })
212
- })]
213
- })
214
- }), data.length > pageSize && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
215
- className: require_data_table_module.default.pagination,
216
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
217
- className: require_data_table_module.default.paginationInfo,
218
- children: [
219
- "Page ",
220
- safePage,
221
- " of ",
222
- totalPages
223
- ]
224
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
225
- className: require_data_table_module.default.paginationButtons,
226
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
227
- type: "button",
228
- className: require_data_table_module.default.pageBtn,
229
- disabled: safePage <= 1,
230
- onClick: () => setPage((p) => Math.max(1, p - 1)),
231
- "aria-label": "Previous page",
232
- children: "←"
233
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
234
- type: "button",
235
- className: require_data_table_module.default.pageBtn,
236
- disabled: safePage >= totalPages,
237
- onClick: () => setPage((p) => Math.min(totalPages, p + 1)),
238
- "aria-label": "Next page",
239
- children: "→"
240
- })]
241
- })]
242
- })]
398
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
399
+ href: backLinkHref,
400
+ className: require_auth_pages_module.default.backLink,
401
+ children: backLinkText
402
+ })]
403
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
404
+ onSubmit: handleSubmit,
405
+ className: require_auth_pages_module.default.authForm,
406
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Field, {
407
+ label: emailPlaceholder,
408
+ id: id + "-email",
409
+ error,
410
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
411
+ id: id + "-email",
412
+ type: "email",
413
+ placeholder: "you@example.com",
414
+ value: email,
415
+ onChange: (e) => {
416
+ setEmail(e.target.value);
417
+ setError("");
418
+ },
419
+ className: require_auth_pages_module.default.input,
420
+ autoComplete: "email",
421
+ autoFocus: true
422
+ })
423
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
424
+ type: "submit",
425
+ disabled: loading,
426
+ className: require_auth_pages_module.default.submitButton,
427
+ children: loading ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_auth_pages_module.default.spinner }), "Sending..."] }) : buttonText
428
+ })]
429
+ }),
430
+ footer && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("hr", { className: require_auth_pages_module.default.divider }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
431
+ className: require_auth_pages_module.default.authFooter,
432
+ children: footer
433
+ })] })
434
+ ]
435
+ })
243
436
  });
244
437
  }
245
438
  //#endregion
246
- exports.DataTable = DataTable;
439
+ exports.ForgotPasswordPage = ForgotPasswordPage;
440
+ exports.SignInPage = SignInPage;
441
+ exports.SignUpPage = SignUpPage;
247
442
 
248
443
  //# sourceMappingURL=index69.cjs.map