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