@declarion/react 0.66.1 → 0.81.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 (66) hide show
  1. package/README.md +1 -1
  2. package/dist-lib/api/auth.js +24 -14
  3. package/dist-lib/app.js +28 -23
  4. package/dist-lib/components/chrome/AssociationTabs.js +35 -38
  5. package/dist-lib/components/chrome/HighlightsStrip.js +2 -1
  6. package/dist-lib/components/chrome/RecordHeader.js +33 -38
  7. package/dist-lib/components/detail-layout/AssociatedBlock.js +10 -21
  8. package/dist-lib/components/detail-layout/ChildrenBlock.js +1 -8
  9. package/dist-lib/components/detail-layout/ChildrenCards.js +1 -8
  10. package/dist-lib/components/detail-layout/ChildrenList.js +1 -8
  11. package/dist-lib/components/detail-layout/ChildrenTable.js +1 -8
  12. package/dist-lib/components/detail-layout/ChildrenTimeline.js +1 -8
  13. package/dist-lib/components/detail-layout/DetailAuditStrip.js +33 -29
  14. package/dist-lib/components/detail-layout/DetailHighlights.js +7 -2
  15. package/dist-lib/components/detail-layout/FieldsBlock.js +12 -9
  16. package/dist-lib/components/detail-layout/LayoutRenderer.js +10 -10
  17. package/dist-lib/components/detail-layout/LayoutTabs.js +49 -48
  18. package/dist-lib/components/detail-layout/SectionBlock.js +20 -28
  19. package/dist-lib/components/detail-layout/visibility.js +28 -0
  20. package/dist-lib/components/fields/IntArrayField.js +37 -33
  21. package/dist-lib/components/fields/NumberField.js +28 -55
  22. package/dist-lib/components/fields/RichTextField.js +1 -1
  23. package/dist-lib/components/fields/TimestampField.js +50 -89
  24. package/dist-lib/components/fields/cells/factories/date.js +13 -14
  25. package/dist-lib/components/fields/cells/factories/money.js +1 -1
  26. package/dist-lib/components/fields/cells/factories/number.js +4 -4
  27. package/dist-lib/components/file-widgets/DocumentCard.js +1 -1
  28. package/dist-lib/components/file-widgets/Grid.js +153 -152
  29. package/dist-lib/components/file-widgets/ImageWidget.js +90 -91
  30. package/dist-lib/components/file-widgets/LabeledSlots.js +1 -0
  31. package/dist-lib/components/file-widgets/helpers.js +15 -19
  32. package/dist-lib/components/file-widgets/host.js +33 -32
  33. package/dist-lib/components/file-widgets/upload.js +10 -6
  34. package/dist-lib/components/layout/Layout.js +125 -123
  35. package/dist-lib/components/pages/NoScreensPage.impl.js +14 -0
  36. package/dist-lib/components/pages/NoScreensPage.js +12 -0
  37. package/dist-lib/components/pages/SmartDetailPage.impl.js +451 -451
  38. package/dist-lib/components/pages/auth/AuthShell.js +62 -61
  39. package/dist-lib/components/pages/auth/CodeInput.js +63 -0
  40. package/dist-lib/components/pages/auth/SignIn.js +12 -4
  41. package/dist-lib/components/pages/auth/SignUp.impl.js +80 -103
  42. package/dist-lib/components/pages/auth/SignUpCode.js +122 -0
  43. package/dist-lib/components/pages/auth/TwoFA.impl.js +9 -55
  44. package/dist-lib/components/pages/list/cardProjection.js +135 -122
  45. package/dist-lib/components/pages/list/columns.js +58 -43
  46. package/dist-lib/components/pages/profile/Profile.impl.js +87 -104
  47. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +1 -1
  48. package/dist-lib/components/params/ParamsBlock.js +6 -17
  49. package/dist-lib/components/params/param-editors.js +14 -10
  50. package/dist-lib/components/primitives/Fields.js +314 -236
  51. package/dist-lib/components/shared/MarkdownRenderer.js +44 -43
  52. package/dist-lib/declarion-react.css +1 -1
  53. package/dist-lib/hooks/useActiveTabFollowsRoute.js +49 -0
  54. package/dist-lib/hooks/useAuth.js +44 -37
  55. package/dist-lib/hooks/useDocumentTitle.js +20 -0
  56. package/dist-lib/hooks/useFollowAgentOpen.js +1 -0
  57. package/dist-lib/hooks/useTabTitle.js +1 -1
  58. package/dist-lib/index.d.ts +21 -7
  59. package/dist-lib/lib/date-text.js +57 -0
  60. package/dist-lib/lib/number-text.js +9 -0
  61. package/dist-lib/lib/timestamp.js +29 -29
  62. package/dist-lib/stores/tabs.js +7 -5
  63. package/dist-lib/testing.d.ts +1 -1
  64. package/dist-lib/testing.js +1 -0
  65. package/dist-lib/{useResponsiveMode-DmrpMbZX.d.ts → useResponsiveMode-D3SKz5z4.d.ts} +20 -9
  66. package/package.json +11 -11
@@ -10,34 +10,49 @@ import { usePublicParams as u } from "../../../hooks/useParams.js";
10
10
  import { useAuth as d } from "../../../hooks/useAuth.js";
11
11
  import { AuthShell as f } from "./AuthShell.js";
12
12
  import { BlankScreen as p } from "../../shared/BlankScreen.js";
13
- import { useEffect as m, useState as h } from "react";
14
- import { useQuery as g } from "@tanstack/react-query";
15
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
16
- import { Link as y, useNavigate as b } from "react-router";
13
+ import { SignUpCode as m } from "./SignUpCode.js";
14
+ import { useEffect as h, useState as g } from "react";
15
+ import { useQuery as _ } from "@tanstack/react-query";
16
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
17
+ import { Link as b, useNavigate as x } from "react-router";
17
18
  //#region src/components/pages/auth/SignUp.impl.tsx
18
- function x() {
19
- let t = b(), { signup: x, isSignupPending: C, isAuthenticated: w } = d(), T = a(), E = i(), [D, O] = h(""), [k, A] = h(""), [j, M] = h(""), [N, P] = h(""), [F, I] = h(""), [L, R] = h(""), [z, B] = h(!1), { data: V } = u(), H = l(V), U = H?.workspace_domain ?? "", W = H?.legal_links?.terms_url ?? "", G = H?.legal_links?.privacy_url ?? "", K = T.isPhone, { data: q, isPending: J } = g({
19
+ function S() {
20
+ let t = x(), { signup: S, isSignupPending: w, isAuthenticated: T } = d(), [E, D] = g(null), O = a(), k = i(), [A, j] = g(""), [M, N] = g(""), [P, F] = g(""), [I, L] = g(""), [R, z] = g(!1), { data: B } = u(), V = l(B), H = V?.legal_links?.terms_url ?? "", U = V?.legal_links?.privacy_url ?? "", W = O.isPhone, { data: G, isPending: K } = _({
20
21
  queryKey: ["check-setup"],
21
22
  queryFn: e
23
+ }), q = G?.needs_setup || G?.signup_enabled;
24
+ if (h(() => {
25
+ G && !q && t("/login", { replace: !0 });
26
+ }, [
27
+ G,
28
+ q,
29
+ t
30
+ ]), h(() => {
31
+ T && t("/", { replace: !0 });
32
+ }, [T, t]), K || !q) return /* @__PURE__ */ v(p, {});
33
+ if (E) return /* @__PURE__ */ v(m, {
34
+ email: E.email,
35
+ retryAfterSeconds: E.retryAfterSeconds,
36
+ onUseAnotherEmail: () => D(null)
22
37
  });
23
- if (m(() => {
24
- q && !q.needs_setup && t("/login", { replace: !0 });
25
- }, [q, t]), m(() => {
26
- w && t("/", { replace: !0 });
27
- }, [w, t]), J || q?.needs_setup === !1) return /* @__PURE__ */ _(p, {});
28
- function Y(e) {
29
- if (e.preventDefault(), !z) return;
30
- let t = [D, k].filter(Boolean).join(" ") || j;
31
- x({
32
- email: j,
33
- password: L,
38
+ function J(e) {
39
+ if (e.preventDefault(), !R) return;
40
+ let t = [A, M].filter(Boolean).join(" ");
41
+ S({
42
+ email: P,
43
+ password: I,
34
44
  displayName: t
35
- });
45
+ }, { onSuccess: (e) => {
46
+ e.verification_required && D({
47
+ email: P,
48
+ retryAfterSeconds: e.retry_after_seconds
49
+ });
50
+ } });
36
51
  }
37
- return /* @__PURE__ */ _(f, { children: /* @__PURE__ */ v("form", {
38
- onSubmit: Y,
52
+ return /* @__PURE__ */ v(f, { children: /* @__PURE__ */ y("form", {
53
+ onSubmit: J,
39
54
  children: [
40
- /* @__PURE__ */ _("div", {
55
+ /* @__PURE__ */ v("div", {
41
56
  style: {
42
57
  fontSize: 10.5,
43
58
  fontWeight: 700,
@@ -45,99 +60,61 @@ function x() {
45
60
  letterSpacing: "0.1em",
46
61
  textTransform: "uppercase"
47
62
  },
48
- children: E("auth.signup.eyebrow", "Request access")
63
+ children: k("auth.signup.eyebrow", "Sign up")
49
64
  }),
50
- /* @__PURE__ */ _("h2", {
65
+ /* @__PURE__ */ v("h2", {
51
66
  style: {
52
67
  margin: "6px 0 4px",
53
68
  fontSize: 24,
54
69
  fontWeight: 600,
55
70
  letterSpacing: "-0.018em"
56
71
  },
57
- children: E("auth.signup.title", "Create your workspace")
72
+ children: k("auth.signup.title", "Create your workspace")
58
73
  }),
59
- /* @__PURE__ */ _("p", {
74
+ /* @__PURE__ */ v("p", {
60
75
  style: {
61
76
  margin: "0 0 20px",
62
77
  fontSize: 13,
63
78
  color: "var(--text-3)"
64
79
  },
65
- children: E("auth.signup.subtitle", "We'll provision a tenant and invite your team. Takes under a minute.")
80
+ children: k("auth.signup.subtitle", "Enter your name, email and a password.")
66
81
  }),
67
- /* @__PURE__ */ v("div", {
82
+ /* @__PURE__ */ y("div", {
68
83
  style: {
69
84
  display: "flex",
70
85
  flexDirection: "column",
71
86
  gap: 12
72
87
  },
73
88
  children: [
74
- /* @__PURE__ */ v("div", {
89
+ /* @__PURE__ */ y("div", {
75
90
  "data-testid": "signup-name-grid",
76
91
  style: {
77
92
  display: "grid",
78
- gridTemplateColumns: K ? "minmax(0, 1fr)" : "1fr 1fr",
93
+ gridTemplateColumns: W ? "minmax(0, 1fr)" : "1fr 1fr",
79
94
  gap: 10
80
95
  },
81
- children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _(o, { children: E("auth.signup.first_name", "First name") }), /* @__PURE__ */ _(c, {
82
- value: D,
83
- onChange: O
84
- })] }), /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _(o, { children: E("auth.signup.last_name", "Last name") }), /* @__PURE__ */ _(c, {
85
- value: k,
86
- onChange: A
96
+ children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v(o, { children: k("auth.signup.first_name", "First name") }), /* @__PURE__ */ v(c, {
97
+ value: A,
98
+ onChange: j
99
+ })] }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v(o, { children: k("auth.signup.last_name", "Last name") }), /* @__PURE__ */ v(c, {
100
+ value: M,
101
+ onChange: N
87
102
  })] })]
88
103
  }),
89
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _(o, { children: E("auth.signup.work_email", "Work email") }), /* @__PURE__ */ _(c, {
90
- value: j,
91
- onChange: M,
92
- prefix: /* @__PURE__ */ _(n.email, { size: 13 }),
93
- placeholder: E("auth.signup.work_email_placeholder", "name@company.com"),
104
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v(o, { children: k("auth.signup.work_email", "Work email") }), /* @__PURE__ */ v(c, {
105
+ value: P,
106
+ onChange: F,
107
+ prefix: /* @__PURE__ */ v(n.email, { size: 13 }),
108
+ placeholder: k("auth.signup.work_email_placeholder", "name@company.com"),
94
109
  required: !0
95
110
  })] }),
96
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _(o, { children: E("auth.signup.company", "Company") }), /* @__PURE__ */ _(c, {
97
- value: N,
98
- onChange: P,
99
- prefix: /* @__PURE__ */ _(n.building, { size: 13 })
100
- })] }),
101
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _(o, { children: E("auth.signup.workspace_url", "Workspace URL") }), /* @__PURE__ */ v("div", {
102
- style: {
103
- display: "flex",
104
- flexDirection: K ? "column" : "row",
105
- alignItems: "stretch",
106
- border: "1px solid var(--border)",
107
- borderRadius: "var(--radius-md)",
108
- overflow: "hidden",
109
- minWidth: 0
110
- },
111
- children: [/* @__PURE__ */ _(c, {
112
- value: F,
113
- onChange: I,
114
- style: {
115
- border: 0,
116
- borderRadius: 0
117
- }
118
- }), U && /* @__PURE__ */ v("span", {
119
- className: "mono",
120
- style: {
121
- display: "flex",
122
- alignItems: "center",
123
- padding: K ? "8px 10px" : "0 10px",
124
- background: "var(--surface-2)",
125
- borderLeft: K ? 0 : "1px solid var(--border)",
126
- borderTop: K ? "1px solid var(--border)" : 0,
127
- fontSize: 12,
128
- color: "var(--text-3)",
129
- overflowWrap: "anywhere"
130
- },
131
- children: [".", U]
132
- })]
133
- })] }),
134
- /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _(o, { children: E("auth.field.password", "Password") }), /* @__PURE__ */ _(s, {
135
- value: L,
136
- onChange: R,
137
- placeholder: E("auth.signup.password_placeholder", "At least 12 characters"),
111
+ /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v(o, { children: k("auth.field.password", "Password") }), /* @__PURE__ */ v(s, {
112
+ value: I,
113
+ onChange: L,
114
+ placeholder: k("auth.signup.password_placeholder", "At least 8 characters"),
138
115
  showStrength: !0
139
116
  })] }),
140
- /* @__PURE__ */ v("label", {
117
+ /* @__PURE__ */ y("label", {
141
118
  style: {
142
119
  display: "flex",
143
120
  alignItems: "flex-start",
@@ -146,18 +123,18 @@ function x() {
146
123
  color: "var(--text-3)",
147
124
  lineHeight: 1.5
148
125
  },
149
- children: [/* @__PURE__ */ _("input", {
126
+ children: [/* @__PURE__ */ v("input", {
150
127
  type: "checkbox",
151
128
  style: { marginTop: 2 },
152
- checked: z,
153
- onChange: (e) => B(e.target.checked)
154
- }), /* @__PURE__ */ _(S, {
155
- termsUrl: W,
156
- privacyUrl: G,
157
- t: E
129
+ checked: R,
130
+ onChange: (e) => z(e.target.checked)
131
+ }), /* @__PURE__ */ v(C, {
132
+ termsUrl: H,
133
+ privacyUrl: U,
134
+ t: k
158
135
  })]
159
136
  }),
160
- /* @__PURE__ */ _(r, {
137
+ /* @__PURE__ */ v(r, {
161
138
  type: "submit",
162
139
  size: "md",
163
140
  kind: "primary",
@@ -165,26 +142,26 @@ function x() {
165
142
  justifyContent: "center",
166
143
  width: "100%"
167
144
  },
168
- disabled: C || !z,
169
- children: C ? E("auth.signup.submitting", "Creating…") : E("auth.signup.submit", "Create workspace")
145
+ disabled: w || !R,
146
+ children: w ? k("auth.signup.submitting", "Creating…") : k("auth.signup.submit", "Create workspace")
170
147
  }),
171
- /* @__PURE__ */ v("div", {
148
+ /* @__PURE__ */ y("div", {
172
149
  style: {
173
150
  fontSize: 12,
174
151
  color: "var(--text-3)",
175
152
  textAlign: "center"
176
153
  },
177
154
  children: [
178
- E("auth.signup.have_account", "Already have an account?"),
155
+ k("auth.signup.have_account", "Already have an account?"),
179
156
  " ",
180
- /* @__PURE__ */ _(y, {
157
+ /* @__PURE__ */ v(b, {
181
158
  to: "/login",
182
159
  style: {
183
160
  color: "var(--accent-text)",
184
161
  fontWeight: 500,
185
162
  textDecoration: "none"
186
163
  },
187
- children: E("auth.signin.title", "Sign in")
164
+ children: k("auth.signin.title", "Sign in")
188
165
  })
189
166
  ]
190
167
  })
@@ -193,24 +170,24 @@ function x() {
193
170
  ]
194
171
  }) });
195
172
  }
196
- function S({ termsUrl: e, privacyUrl: n, t: r }) {
197
- let i = r("auth.signup.terms", "Terms"), a = r("auth.signup.privacy", "Privacy"), o = e ? /* @__PURE__ */ _("a", {
173
+ function C({ termsUrl: e, privacyUrl: n, t: r }) {
174
+ let i = r("auth.signup.terms", "Terms"), a = r("auth.signup.privacy", "Privacy"), o = e ? /* @__PURE__ */ v("a", {
198
175
  href: e,
199
176
  target: "_blank",
200
177
  rel: "noopener noreferrer",
201
178
  style: { color: "var(--accent-text)" },
202
179
  children: i
203
- }) : /* @__PURE__ */ _("span", { children: i }), s = n ? /* @__PURE__ */ _("a", {
180
+ }) : /* @__PURE__ */ v("span", { children: i }), s = n ? /* @__PURE__ */ v("a", {
204
181
  href: n,
205
182
  target: "_blank",
206
183
  rel: "noopener noreferrer",
207
184
  style: { color: "var(--accent-text)" },
208
185
  children: a
209
- }) : /* @__PURE__ */ _("span", { children: a });
210
- return /* @__PURE__ */ _("span", { children: t(r("auth.signup.agreement", "I agree to the {terms} and {privacy}."), {
186
+ }) : /* @__PURE__ */ v("span", { children: a });
187
+ return /* @__PURE__ */ v("span", { children: t(r("auth.signup.agreement", "I agree to the {terms} and {privacy}."), {
211
188
  terms: o,
212
189
  privacy: s
213
190
  }) });
214
191
  }
215
192
  //#endregion
216
- export { x as SignUp };
193
+ export { S as SignUp };
@@ -0,0 +1,122 @@
1
+ import { resendSignupCode as e } from "../../../api/auth.js";
2
+ import { Btn as t } from "../../primitives/Btn.js";
3
+ import { useText as n } from "../../../hooks/useText.js";
4
+ import { failureTitle as r } from "../../../lib/failure.js";
5
+ import { useAuth as i } from "../../../hooks/useAuth.js";
6
+ import { AuthShell as a } from "./AuthShell.js";
7
+ import { CodeInput as o } from "./CodeInput.js";
8
+ import { useEffect as s, useState as c } from "react";
9
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
10
+ //#region src/components/pages/auth/SignUpCode.tsx
11
+ function d({ email: d, retryAfterSeconds: f, onUseAnotherEmail: p }) {
12
+ let m = n(), h = n("errors"), { confirmSignup: g, isConfirmSignupPending: _ } = i(), [v, y] = c(""), [b, x] = c(""), [S, C] = c(f), [w, T] = c(!1);
13
+ s(() => {
14
+ if (S <= 0) return;
15
+ let e = window.setTimeout(() => C((e) => e - 1), 1e3);
16
+ return () => window.clearTimeout(e);
17
+ }, [S]);
18
+ function E(e) {
19
+ e.preventDefault(), x(""), g({
20
+ email: d,
21
+ code: v
22
+ }, { onError: (e) => x(r(h, e)) });
23
+ }
24
+ async function D() {
25
+ T(!0), x("");
26
+ try {
27
+ let t = await e(d);
28
+ y(""), C(t.retry_after_seconds);
29
+ } catch (e) {
30
+ x(r(h, e));
31
+ } finally {
32
+ T(!1);
33
+ }
34
+ }
35
+ return /* @__PURE__ */ l(a, { children: /* @__PURE__ */ u("form", {
36
+ onSubmit: E,
37
+ children: [
38
+ /* @__PURE__ */ l("div", {
39
+ style: {
40
+ fontSize: 10.5,
41
+ fontWeight: 700,
42
+ color: "var(--accent-text)",
43
+ letterSpacing: "0.1em",
44
+ textTransform: "uppercase"
45
+ },
46
+ children: m("auth.signup.eyebrow", "Sign up")
47
+ }),
48
+ /* @__PURE__ */ l("h2", {
49
+ style: {
50
+ margin: "6px 0 4px",
51
+ fontSize: 24,
52
+ fontWeight: 600,
53
+ letterSpacing: "-0.018em"
54
+ },
55
+ children: m("auth.signup_code.title", "Check your email")
56
+ }),
57
+ /* @__PURE__ */ l("p", {
58
+ style: {
59
+ margin: "0 0 4px",
60
+ fontSize: 13,
61
+ color: "var(--text-3)"
62
+ },
63
+ children: m("auth.signup_code.subtitle", "We sent a 6-digit code to {email}. Enter it here, in this browser.", { email: d })
64
+ }),
65
+ /* @__PURE__ */ l(o, {
66
+ value: v,
67
+ onChange: y,
68
+ label: m("auth.signup_code.code", "Code")
69
+ }),
70
+ b && /* @__PURE__ */ l("div", {
71
+ "data-testid": "signup-code-error",
72
+ role: "alert",
73
+ className: "bg-destructive-soft text-destructive",
74
+ style: {
75
+ margin: "0 0 12px",
76
+ padding: 12,
77
+ borderRadius: "var(--radius-md)",
78
+ fontSize: 12.5
79
+ },
80
+ children: b
81
+ }),
82
+ /* @__PURE__ */ l(t, {
83
+ type: "submit",
84
+ size: "md",
85
+ kind: "primary",
86
+ style: {
87
+ justifyContent: "center",
88
+ width: "100%"
89
+ },
90
+ disabled: _ || v.length !== 6,
91
+ children: _ ? m("auth.signup_code.submitting", "Checking…") : m("auth.signup_code.submit", "Confirm")
92
+ }),
93
+ /* @__PURE__ */ u("div", {
94
+ style: {
95
+ marginTop: 12,
96
+ display: "flex",
97
+ justifyContent: "space-between",
98
+ gap: 12,
99
+ fontSize: 12
100
+ },
101
+ children: [/* @__PURE__ */ l(t, {
102
+ size: "sm",
103
+ kind: "ghost",
104
+ disabled: S > 0 || w,
105
+ onClick: (e) => {
106
+ e.preventDefault(), D();
107
+ },
108
+ children: S > 0 ? m("auth.signup_code.resend_in", "Send again in {seconds} s", { seconds: S }) : m("auth.signup_code.resend", "Send again")
109
+ }), /* @__PURE__ */ l(t, {
110
+ size: "sm",
111
+ kind: "ghost",
112
+ onClick: (e) => {
113
+ e.preventDefault(), p();
114
+ },
115
+ children: m("auth.signup_code.another_email", "Use another email")
116
+ })]
117
+ })
118
+ ]
119
+ }) });
120
+ }
121
+ //#endregion
122
+ export { d as SignUpCode };
@@ -1,24 +1,14 @@
1
1
  import { Btn as e } from "../../primitives/Btn.js";
2
2
  import { useText as t } from "../../../hooks/useText.js";
3
- import { useResponsiveMode as n } from "../../../hooks/useResponsiveMode.js";
4
- import { AuthShell as r } from "./AuthShell.js";
5
- import { useRef as i } from "react";
3
+ import { AuthShell as n } from "./AuthShell.js";
4
+ import { CodeInput as r } from "./CodeInput.js";
5
+ import { useState as i } from "react";
6
6
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  import { Link as s, useNavigate as c } from "react-router";
8
8
  //#region src/components/pages/auth/TwoFA.impl.tsx
9
9
  function l() {
10
- let l = t(), u = c(), d = i([]), f = n().isPhone;
11
- function p(e) {
12
- d.current[e]?.focus(), d.current[e]?.select();
13
- }
14
- function m(e, t) {
15
- let n = t.target.value.replace(/\D/g, "").slice(0, 1);
16
- t.target.value = n, n && e < 5 && p(e + 1);
17
- }
18
- function h(e, t) {
19
- t.key === "Backspace" && !t.target.value && e > 0 && p(e - 1);
20
- }
21
- return /* @__PURE__ */ a(r, { children: /* @__PURE__ */ o("div", { children: [
10
+ let l = t(), u = c(), [d, f] = i("");
11
+ return /* @__PURE__ */ a(n, { children: /* @__PURE__ */ o("div", { children: [
22
12
  /* @__PURE__ */ a("div", {
23
13
  style: {
24
14
  fontSize: 10.5,
@@ -46,46 +36,10 @@ function l() {
46
36
  },
47
37
  children: l("auth.twofa.subtitle", "Open your authenticator app and enter the 6-digit code.")
48
38
  }),
49
- /* @__PURE__ */ a("div", {
50
- style: {
51
- display: "grid",
52
- gridTemplateColumns: "repeat(6, minmax(0, 44px))",
53
- gap: f ? 6 : 8,
54
- justifyContent: "center",
55
- margin: "20px 0",
56
- width: "100%",
57
- maxWidth: "100%"
58
- },
59
- children: [
60
- 0,
61
- 1,
62
- 2,
63
- 3,
64
- 4,
65
- 5
66
- ].map((e) => /* @__PURE__ */ a("input", {
67
- ref: (t) => {
68
- d.current[e] = t;
69
- },
70
- maxLength: 1,
71
- inputMode: "numeric",
72
- onChange: (t) => m(e, t),
73
- onKeyDown: (t) => h(e, t),
74
- style: {
75
- width: "100%",
76
- minWidth: 0,
77
- height: f ? 48 : 52,
78
- textAlign: "center",
79
- fontSize: f ? 20 : 22,
80
- fontWeight: 600,
81
- background: "var(--surface-2)",
82
- border: "1px solid var(--border)",
83
- borderRadius: "var(--radius-md)",
84
- outline: "none",
85
- color: "var(--text)",
86
- fontFamily: "var(--font-mono)"
87
- }
88
- }, e))
39
+ /* @__PURE__ */ a(r, {
40
+ value: d,
41
+ onChange: f,
42
+ label: l("auth.twofa.title", "Enter your code")
89
43
  }),
90
44
  /* @__PURE__ */ a(e, {
91
45
  size: "md",