@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.
Files changed (130) hide show
  1. package/dist/components/filter-workspace/FilterWorkspace.d.ts +40 -0
  2. package/dist/components/filter-workspace/FilterWorkspace.d.ts.map +1 -0
  3. package/dist/components/filter-workspace/FilterWorkspace.test.d.ts +2 -0
  4. package/dist/components/filter-workspace/FilterWorkspace.test.d.ts.map +1 -0
  5. package/dist/index.cjs +18 -14
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +16 -15
  9. package/dist/index57.js +21 -10
  10. package/dist/index57.js.map +1 -1
  11. package/dist/index58.cjs +30 -11
  12. package/dist/index58.cjs.map +1 -1
  13. package/dist/index58.js +101 -14
  14. package/dist/index58.js.map +1 -1
  15. package/dist/index59.cjs +104 -13
  16. package/dist/index59.cjs.map +1 -1
  17. package/dist/index59.js +10 -11
  18. package/dist/index59.js.map +1 -1
  19. package/dist/index60.cjs +11 -13
  20. package/dist/index60.cjs.map +1 -1
  21. package/dist/index60.js +13 -16
  22. package/dist/index60.js.map +1 -1
  23. package/dist/index61.cjs +13 -16
  24. package/dist/index61.cjs.map +1 -1
  25. package/dist/index61.js +10 -8
  26. package/dist/index61.js.map +1 -1
  27. package/dist/index62.cjs +11 -10
  28. package/dist/index62.cjs.map +1 -1
  29. package/dist/index62.js +15 -87
  30. package/dist/index62.js.map +1 -1
  31. package/dist/index63.cjs +15 -89
  32. package/dist/index63.cjs.map +1 -1
  33. package/dist/index63.js +9 -23
  34. package/dist/index63.js.map +1 -1
  35. package/dist/index64.cjs +12 -33
  36. package/dist/index64.cjs.map +1 -1
  37. package/dist/index64.js +89 -43
  38. package/dist/index64.js.map +1 -1
  39. package/dist/index65.cjs +88 -42
  40. package/dist/index65.cjs.map +1 -1
  41. package/dist/index65.js +23 -15
  42. package/dist/index65.js.map +1 -1
  43. package/dist/index66.cjs +33 -21
  44. package/dist/index66.cjs.map +1 -1
  45. package/dist/index66.js +44 -51
  46. package/dist/index66.js.map +1 -1
  47. package/dist/index67.cjs +43 -52
  48. package/dist/index67.cjs.map +1 -1
  49. package/dist/index67.js +14 -14
  50. package/dist/index67.js.map +1 -1
  51. package/dist/index68.cjs +19 -19
  52. package/dist/index68.cjs.map +1 -1
  53. package/dist/index68.js +49 -290
  54. package/dist/index68.js.map +1 -1
  55. package/dist/index69.cjs +51 -290
  56. package/dist/index69.cjs.map +1 -1
  57. package/dist/index69.js +15 -57
  58. package/dist/index69.js.map +1 -1
  59. package/dist/index70.cjs +20 -83
  60. package/dist/index70.cjs.map +1 -1
  61. package/dist/index70.js +276 -418
  62. package/dist/index70.js.map +1 -1
  63. package/dist/index71.cjs +275 -419
  64. package/dist/index71.cjs.map +1 -1
  65. package/dist/index71.js +56 -58
  66. package/dist/index71.js.map +1 -1
  67. package/dist/index72.cjs +82 -85
  68. package/dist/index72.cjs.map +1 -1
  69. package/dist/index72.js +420 -226
  70. package/dist/index72.js.map +1 -1
  71. package/dist/index73.cjs +421 -225
  72. package/dist/index73.cjs.map +1 -1
  73. package/dist/index73.js +58 -42
  74. package/dist/index73.js.map +1 -1
  75. package/dist/index74.cjs +85 -61
  76. package/dist/index74.cjs.map +1 -1
  77. package/dist/index74.js +236 -76
  78. package/dist/index74.js.map +1 -1
  79. package/dist/index75.cjs +235 -75
  80. package/dist/index75.cjs.map +1 -1
  81. package/dist/index75.js +42 -20
  82. package/dist/index75.js.map +1 -1
  83. package/dist/index76.cjs +60 -27
  84. package/dist/index76.cjs.map +1 -1
  85. package/dist/index76.js +73 -88
  86. package/dist/index76.js.map +1 -1
  87. package/dist/index77.cjs +73 -90
  88. package/dist/index77.cjs.map +1 -1
  89. package/dist/index77.js +17 -15
  90. package/dist/index77.js.map +1 -1
  91. package/dist/index78.cjs +22 -19
  92. package/dist/index78.cjs.map +1 -1
  93. package/dist/index78.js +85 -143
  94. package/dist/index78.js.map +1 -1
  95. package/dist/index79.cjs +87 -143
  96. package/dist/index79.cjs.map +1 -1
  97. package/dist/index79.js +19 -91
  98. package/dist/index79.js.map +1 -1
  99. package/dist/index80.cjs +27 -135
  100. package/dist/index80.cjs.map +1 -1
  101. package/dist/index80.js +140 -673
  102. package/dist/index80.js.map +1 -1
  103. package/dist/index81.cjs +140 -673
  104. package/dist/index81.cjs.map +1 -1
  105. package/dist/index81.js +91 -31
  106. package/dist/index81.js.map +1 -1
  107. package/dist/index82.cjs +135 -45
  108. package/dist/index82.cjs.map +1 -1
  109. package/dist/index82.js +667 -206
  110. package/dist/index82.js.map +1 -1
  111. package/dist/index83.cjs +667 -204
  112. package/dist/index83.cjs.map +1 -1
  113. package/dist/index83.js +31 -15
  114. package/dist/index83.js.map +1 -1
  115. package/dist/index84.cjs +45 -21
  116. package/dist/index84.cjs.map +1 -1
  117. package/dist/index84.js +224 -29
  118. package/dist/index84.js.map +1 -1
  119. package/dist/index85.cjs +224 -30
  120. package/dist/index85.cjs.map +1 -1
  121. package/dist/index85.js +19 -0
  122. package/dist/index85.js.map +1 -0
  123. package/dist/index86.cjs +25 -0
  124. package/dist/index86.cjs.map +1 -0
  125. package/dist/index86.js +36 -0
  126. package/dist/index86.js.map +1 -0
  127. package/dist/index87.cjs +37 -0
  128. package/dist/index87.cjs.map +1 -0
  129. package/dist/style.css +53 -0
  130. package/package.json +1 -1
package/dist/index72.js CHANGED
@@ -1,246 +1,440 @@
1
- "use client";
2
1
  import { cx } from "./index3.js";
3
- import data_table_module_default from "./index71.js";
2
+ import auth_pages_module_default from "./index71.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
+ autoComplete: "current-password"
85
+ }), /* @__PURE__ */ jsx("button", {
86
+ ref: toggleRef,
87
+ type: "button",
88
+ onClick: () => setShow((s) => !s),
89
+ className: auth_pages_module_default.toggle,
90
+ "aria-label": show ? "Hide password" : "Show password",
91
+ children: /* @__PURE__ */ jsx(EyeIcon, { open: show })
92
+ })]
93
+ })
94
+ });
95
+ }
96
+ function CheckboxRow({ label, linkText, linkHref, checked, onChange }) {
97
+ if (!label) return null;
98
+ return /* @__PURE__ */ jsxs("div", {
99
+ className: auth_pages_module_default.checkboxRow,
100
+ children: [/* @__PURE__ */ jsxs("label", {
101
+ className: auth_pages_module_default.checkboxLabel,
102
+ children: [/* @__PURE__ */ jsx("input", {
103
+ type: "checkbox",
104
+ className: auth_pages_module_default.checkbox,
105
+ checked,
106
+ onChange: (e) => onChange?.(e.target.checked)
107
+ }), /* @__PURE__ */ jsx("span", { children: label })]
108
+ }), linkHref && /* @__PURE__ */ jsx("a", {
109
+ href: linkHref,
110
+ className: auth_pages_module_default.forgotLink,
111
+ children: linkText
112
+ })]
113
+ });
114
+ }
115
+ function SignInPage({ title = "Sign in", subtitle, footer, onSubmit, loading = false, brand, className, emailPlaceholder = "Email address", passwordPlaceholder = "Password", rememberLabel = "Remember me", forgotLinkText = "Forgot password?", forgotLinkHref }) {
116
+ const id = React.useId();
117
+ const [email, setEmail] = React.useState("");
118
+ const [password, setPassword] = React.useState("");
119
+ const [rememberMe, setRememberMe] = React.useState(false);
120
+ const [errors, setErrors] = React.useState({});
121
+ const [submitted, setSubmitted] = React.useState(false);
122
+ const validate = () => {
123
+ const newErrors = {};
124
+ if (!email.trim()) newErrors.email = "Email is required";
125
+ else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) newErrors.email = "Enter a valid email";
126
+ if (!password) newErrors.password = "Password is required";
127
+ setErrors(newErrors);
128
+ return Object.keys(newErrors).length === 0;
18
129
  };
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));
130
+ const handleSubmit = (e) => {
131
+ e.preventDefault();
132
+ setSubmitted(true);
133
+ if (!validate()) return;
134
+ onSubmit?.({
135
+ email,
136
+ password,
137
+ rememberMe
138
+ });
25
139
  };
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));
140
+ return /* @__PURE__ */ jsx("div", {
141
+ className: cx(auth_pages_module_default.authLayout, className),
142
+ children: /* @__PURE__ */ jsxs("div", {
143
+ className: auth_pages_module_default.authCard,
144
+ children: [
145
+ brand && /* @__PURE__ */ jsx("div", {
146
+ className: auth_pages_module_default.authBrand,
147
+ children: brand
148
+ }),
149
+ /* @__PURE__ */ jsxs("div", {
150
+ className: auth_pages_module_default.authHeader,
151
+ children: [/* @__PURE__ */ jsx("h1", {
152
+ className: auth_pages_module_default.authTitle,
153
+ children: title
154
+ }), subtitle && /* @__PURE__ */ jsx("p", {
155
+ className: auth_pages_module_default.authSubtitle,
156
+ children: subtitle
157
+ })]
158
+ }),
159
+ /* @__PURE__ */ jsxs("form", {
160
+ onSubmit: handleSubmit,
161
+ className: auth_pages_module_default.authForm,
162
+ children: [
163
+ /* @__PURE__ */ jsx(Field, {
164
+ label: emailPlaceholder,
165
+ id: id + "-email",
166
+ error: submitted ? errors.email : void 0,
167
+ children: /* @__PURE__ */ jsx("input", {
168
+ id: id + "-email",
169
+ type: "email",
170
+ placeholder: "you@example.com",
171
+ value: email,
172
+ onChange: (e) => setEmail(e.target.value),
173
+ className: auth_pages_module_default.input,
174
+ autoComplete: "email",
175
+ autoFocus: true
176
+ })
177
+ }),
178
+ /* @__PURE__ */ jsx(PasswordField, {
179
+ label: passwordPlaceholder,
180
+ id: id + "-password",
181
+ placeholder: passwordPlaceholder,
182
+ value: password,
183
+ onChange: (e) => {
184
+ setPassword(e.target.value);
185
+ if (submitted) setSubmitted(false);
186
+ },
187
+ error: submitted ? errors.password : void 0
188
+ }),
189
+ /* @__PURE__ */ jsx(CheckboxRow, {
190
+ label: rememberLabel,
191
+ linkText: forgotLinkText,
192
+ linkHref: forgotLinkHref,
193
+ checked: rememberMe,
194
+ onChange: (c) => {
195
+ setRememberMe(c);
196
+ if (submitted) setSubmitted(false);
197
+ }
198
+ }),
199
+ /* @__PURE__ */ jsx("button", {
200
+ type: "submit",
201
+ disabled: loading,
202
+ className: auth_pages_module_default.submitButton,
203
+ children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { className: auth_pages_module_default.spinner }), "Signing in..."] }) : "Sign in"
204
+ })
205
+ ]
206
+ }),
207
+ footer && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("hr", { className: auth_pages_module_default.divider }), /* @__PURE__ */ jsx("p", {
208
+ className: auth_pages_module_default.authFooter,
209
+ children: footer
210
+ })] })
211
+ ]
212
+ })
213
+ });
214
+ }
215
+ function SignUpPage({ title = "Create an account", subtitle, footer, onSubmit, loading = false, brand, className, emailPlaceholder = "Email address", passwordPlaceholder = "Password", confirmPasswordPlaceholder = "Confirm password", checkboxLabel, checkboxLinkText, checkboxLinkHref }) {
216
+ const id = React.useId();
217
+ const [email, setEmail] = React.useState("");
218
+ const [password, setPassword] = React.useState("");
219
+ const [confirmPassword, setConfirmPassword] = React.useState("");
220
+ const [agreed, setAgreed] = React.useState(false);
221
+ const [errors, setErrors] = React.useState({});
222
+ const [submitted, setSubmitted] = React.useState(false);
223
+ const validate = () => {
224
+ const newErrors = {};
225
+ if (!email.trim()) newErrors.email = "Email is required";
226
+ else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) newErrors.email = "Enter a valid email";
227
+ if (!password) newErrors.password = "Password is required";
228
+ else if (password.length < 8) newErrors.password = "At least 8 characters";
229
+ if (password !== confirmPassword) newErrors.confirmPassword = "Passwords do not match";
230
+ if (checkboxLabel && !agreed) newErrors.agreed = "You must agree to continue";
231
+ setErrors(newErrors);
232
+ return Object.keys(newErrors).length === 0;
34
233
  };
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;
234
+ const handleSubmit = (e) => {
235
+ e.preventDefault();
236
+ setSubmitted(true);
237
+ if (!validate()) return;
238
+ onSubmit?.({
239
+ email,
240
+ password,
241
+ agreed
64
242
  });
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",
243
+ };
244
+ return /* @__PURE__ */ jsx("div", {
245
+ className: cx(auth_pages_module_default.authLayout, className),
246
+ children: /* @__PURE__ */ jsxs("div", {
247
+ className: auth_pages_module_default.authCard,
248
+ children: [
249
+ brand && /* @__PURE__ */ jsx("div", {
250
+ className: auth_pages_module_default.authBrand,
251
+ children: brand
252
+ }),
253
+ /* @__PURE__ */ jsxs("div", {
254
+ className: auth_pages_module_default.authHeader,
255
+ children: [/* @__PURE__ */ jsx("h1", {
256
+ className: auth_pages_module_default.authTitle,
257
+ children: title
258
+ }), subtitle && /* @__PURE__ */ jsx("p", {
259
+ className: auth_pages_module_default.authSubtitle,
260
+ children: subtitle
261
+ })]
262
+ }),
263
+ /* @__PURE__ */ jsxs("form", {
264
+ onSubmit: handleSubmit,
265
+ className: auth_pages_module_default.authForm,
266
+ children: [
267
+ /* @__PURE__ */ jsx(Field, {
268
+ label: emailPlaceholder,
269
+ id: id + "-email",
270
+ error: submitted ? errors.email : void 0,
94
271
  children: /* @__PURE__ */ jsx("input", {
95
- type: "checkbox",
96
- checked: allPageSelected,
97
- ref: (el) => {
98
- if (el) el.indeterminate = somePageSelected && !allPageSelected;
272
+ id: id + "-email",
273
+ type: "email",
274
+ placeholder: "you@example.com",
275
+ value: email,
276
+ onChange: (e) => {
277
+ setEmail(e.target.value);
278
+ if (submitted) setSubmitted(false);
99
279
  },
100
- onChange: toggleAll,
101
- className: data_table_module_default.checkbox,
102
- "aria-label": "Select all rows on this page"
280
+ className: auth_pages_module_default.input,
281
+ autoComplete: "email",
282
+ autoFocus: true
103
283
  })
104
284
  }),
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);
285
+ /* @__PURE__ */ jsx(PasswordField, {
286
+ label: passwordPlaceholder,
287
+ id: id + "-password",
288
+ placeholder: passwordPlaceholder,
289
+ value: password,
290
+ onChange: (e) => {
291
+ setPassword(e.target.value);
292
+ if (submitted) setSubmitted(false);
293
+ },
294
+ error: submitted ? errors.password : void 0
128
295
  }),
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"
296
+ /* @__PURE__ */ jsx(PasswordField, {
297
+ label: confirmPasswordPlaceholder,
298
+ id: id + "-confirm",
299
+ placeholder: confirmPasswordPlaceholder,
300
+ value: confirmPassword,
301
+ onChange: (e) => {
302
+ setConfirmPassword(e.target.value);
303
+ if (submitted) setSubmitted(false);
304
+ },
305
+ error: submitted ? errors.confirmPassword : void 0
306
+ }),
307
+ checkboxLabel && /* @__PURE__ */ jsx("div", {
308
+ className: auth_pages_module_default.checkboxRow,
309
+ children: /* @__PURE__ */ jsxs("label", {
310
+ className: auth_pages_module_default.checkboxLabel,
311
+ children: [/* @__PURE__ */ jsx("input", {
312
+ id: id + "-agreed",
313
+ type: "checkbox",
314
+ checked: agreed,
315
+ onChange: (e) => {
316
+ setAgreed(e.target.checked);
317
+ if (submitted) setSubmitted(false);
318
+ },
319
+ className: auth_pages_module_default.checkbox
320
+ }), /* @__PURE__ */ jsx("span", { children: checkboxLinkText ? /* @__PURE__ */ jsxs(Fragment, { children: [
321
+ "I agree to the",
322
+ " ",
323
+ /* @__PURE__ */ jsx("a", {
324
+ href: checkboxLinkHref,
325
+ className: auth_pages_module_default.checkboxLink,
326
+ children: checkboxLinkText
327
+ })
328
+ ] }) : checkboxLabel })]
135
329
  })
330
+ }),
331
+ submitted && errors.agreed && /* @__PURE__ */ jsx("span", {
332
+ className: auth_pages_module_default.error,
333
+ children: errors.agreed
334
+ }),
335
+ /* @__PURE__ */ jsx("button", {
336
+ type: "submit",
337
+ disabled: loading,
338
+ className: auth_pages_module_default.submitButton,
339
+ children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { className: auth_pages_module_default.spinner }), "Creating account..."] }) : "Create account"
136
340
  })
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,
341
+ ]
342
+ }),
343
+ footer && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("hr", { className: auth_pages_module_default.divider }), /* @__PURE__ */ jsx("p", {
344
+ className: auth_pages_module_default.authFooter,
345
+ children: footer
346
+ })] })
347
+ ]
348
+ })
349
+ });
350
+ }
351
+ 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" }) {
352
+ const id = React.useId();
353
+ const [email, setEmail] = React.useState("");
354
+ const [error, setError] = React.useState("");
355
+ const [sent, setSent] = React.useState(false);
356
+ const handleSubmit = (e) => {
357
+ e.preventDefault();
358
+ if (!email.trim()) {
359
+ setError("Email is required");
360
+ return;
361
+ }
362
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
363
+ setError("Enter a valid email");
364
+ return;
365
+ }
366
+ onSubmit?.({ email });
367
+ setSent(true);
368
+ };
369
+ return /* @__PURE__ */ jsx("div", {
370
+ className: cx(auth_pages_module_default.authLayout, className),
371
+ children: /* @__PURE__ */ jsxs("div", {
372
+ className: auth_pages_module_default.authCard,
373
+ children: [
374
+ brand && /* @__PURE__ */ jsx("div", {
375
+ className: auth_pages_module_default.authBrand,
376
+ children: brand
377
+ }),
378
+ /* @__PURE__ */ jsxs("div", {
379
+ className: auth_pages_module_default.authHeader,
380
+ children: [/* @__PURE__ */ jsx("h1", {
381
+ className: auth_pages_module_default.authTitle,
382
+ children: title
383
+ }), subtitle && /* @__PURE__ */ jsx("p", {
384
+ className: auth_pages_module_default.authSubtitle,
385
+ children: subtitle
386
+ })]
387
+ }),
388
+ sent ? /* @__PURE__ */ jsxs("div", {
389
+ className: auth_pages_module_default.sentMessage,
390
+ children: [/* @__PURE__ */ jsxs("p", {
391
+ className: auth_pages_module_default.sentText,
143
392
  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
- })
393
+ "If an account exists for ",
394
+ /* @__PURE__ */ jsx("strong", { children: email }),
395
+ ", you'll receive a reset link shortly."
171
396
  ]
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
- })]
397
+ }), /* @__PURE__ */ jsx("a", {
398
+ href: backLinkHref,
399
+ className: auth_pages_module_default.backLink,
400
+ children: backLinkText
401
+ })]
402
+ }) : /* @__PURE__ */ jsxs("form", {
403
+ onSubmit: handleSubmit,
404
+ className: auth_pages_module_default.authForm,
405
+ children: [/* @__PURE__ */ jsx(Field, {
406
+ label: emailPlaceholder,
407
+ id: id + "-email",
408
+ error,
409
+ children: /* @__PURE__ */ jsx("input", {
410
+ id: id + "-email",
411
+ type: "email",
412
+ placeholder: "you@example.com",
413
+ value: email,
414
+ onChange: (e) => {
415
+ setEmail(e.target.value);
416
+ setError("");
417
+ },
418
+ className: auth_pages_module_default.input,
419
+ autoComplete: "email",
420
+ autoFocus: true
421
+ })
422
+ }), /* @__PURE__ */ jsx("button", {
423
+ type: "submit",
424
+ disabled: loading,
425
+ className: auth_pages_module_default.submitButton,
426
+ children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", { className: auth_pages_module_default.spinner }), "Sending..."] }) : buttonText
427
+ })]
428
+ }),
429
+ footer && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("hr", { className: auth_pages_module_default.divider }), /* @__PURE__ */ jsx("p", {
430
+ className: auth_pages_module_default.authFooter,
431
+ children: footer
432
+ })] })
433
+ ]
434
+ })
241
435
  });
242
436
  }
243
437
  //#endregion
244
- export { DataTable };
438
+ export { ForgotPasswordPage, SignInPage, SignUpPage };
245
439
 
246
440
  //# sourceMappingURL=index72.js.map