@alfadocs/ui-kit 1.73.3 → 1.75.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 (177) hide show
  1. package/dist/_chunks/alia-sidebar-CsTRAxC8.js +1323 -0
  2. package/dist/_chunks/{anamnesis-summary-rows-BedVmSAB.js → anamnesis-summary-rows-vNDyE5HW.js} +2 -2
  3. package/dist/_chunks/{antenatal-schedule-timeline-DW_qkGo1.js → antenatal-schedule-timeline-BGewPfEX.js} +18 -18
  4. package/dist/_chunks/{appointment-timeline-CKwMXUid.js → appointment-timeline-1-Za2miy.js} +2 -2
  5. package/dist/_chunks/{ar-pLopgMbL.js → ar-C4YQVTH6.js} +2 -2
  6. package/dist/_chunks/{auth-form-parts-DHv6LVV2.js → auth-form-parts-B3GWChvG.js} +2 -2
  7. package/dist/_chunks/{balance-badge-cell-DG5JWB2p.js → balance-badge-cell-B49xgL6H.js} +2 -2
  8. package/dist/_chunks/booking-ojunD_Y_.js +3901 -0
  9. package/dist/_chunks/brand-mark-DLk9kD8g.js +63 -0
  10. package/dist/_chunks/{calendar-appointment-editor-dialog-Lji2y0qJ.js → calendar-appointment-editor-dialog-CctI6mpd.js} +8 -8
  11. package/dist/_chunks/{cycle-calculator-Ycp3li61.js → cycle-calculator-HO3s5InI.js} +5 -5
  12. package/dist/_chunks/{date-picker-KcoNNsM0.js → date-picker-CdhXlgVI.js} +4 -4
  13. package/dist/_chunks/{date-picker-variants-DN37Oj5-.js → date-picker-variants-Dt6UbonG.js} +25 -25
  14. package/dist/_chunks/{date-range-picker-CjcjUJLW.js → date-range-picker-B_j4VQlV.js} +5 -5
  15. package/dist/_chunks/{date-time-picker-BVQNZ4yC.js → date-time-picker-n-yrlMJq.js} +3 -3
  16. package/dist/_chunks/{de-lVkJRPnh.js → de-B1B3PIgY.js} +2 -2
  17. package/dist/_chunks/{due-date-calculator-B0gyOijA.js → due-date-calculator-CDWTSblh.js} +6 -6
  18. package/dist/_chunks/{el-CHzxNWPj.js → el-iLqGpapg.js} +16 -16
  19. package/dist/_chunks/{en-GB-CwxYmmhU.js → en-GB-CxPRQbD6.js} +6 -6
  20. package/dist/_chunks/{es-Ck-oxbHW.js → es-Bg1oqwDs.js} +2 -2
  21. package/dist/_chunks/{forgot-password-form-D6kB72OD.js → forgot-password-form-BSOZVrZG.js} +3 -3
  22. package/dist/_chunks/{format-D-1gTdHF.js → format--x5jypvH.js} +13 -13
  23. package/dist/_chunks/{fr-fWRnDcSD.js → fr-DpGxyOGI.js} +2 -2
  24. package/dist/_chunks/{gestational-age-calculator-Bu_a-K9z.js → gestational-age-calculator-CTHeJJdb.js} +7 -7
  25. package/dist/_chunks/{hcg-doubling-BnopYgd-.js → hcg-doubling-BBk-a33g.js} +11 -11
  26. package/dist/_chunks/{header-settings-DBlTL6Qj.js → header-settings-Coh1r41O.js} +148 -154
  27. package/dist/_chunks/{hi-B5uX0h3V.js → hi-3Dtsksrw.js} +2 -2
  28. package/dist/_chunks/{isSameWeek-u81Z-J7h.js → isSameWeek-DyVftHWi.js} +2 -2
  29. package/dist/_chunks/{it-DBoNIelY.js → it-Cp0CA13d.js} +3 -3
  30. package/dist/_chunks/{ja-Du8gfg8p.js → ja-9FOyR1lb.js} +22 -22
  31. package/dist/_chunks/{kit-extensions-DgBi3tsK.js → kit-extensions-sNTZWkoo.js} +4 -4
  32. package/dist/_chunks/{link-cell-renderer-BDxxpfJM.js → link-cell-renderer-B0riA_h_.js} +2 -2
  33. package/dist/_chunks/{locale-picker-KT-Vz3bx.js → locale-picker-DzdGDSBI.js} +311 -282
  34. package/dist/_chunks/{login-dev-card-pnJbVaoQ.js → login-dev-card-DRxTPkE9.js} +3 -3
  35. package/dist/_chunks/{marketplace-app-shell-B0ix9yNI.js → marketplace-app-shell-Ck5NVJcO.js} +2 -2
  36. package/dist/_chunks/{nl-BCBwxYi8.js → nl-sfx-zJgR.js} +2 -2
  37. package/dist/_chunks/{notes-panel-C_QshXyI.js → notes-panel-CxjMovCh.js} +2 -2
  38. package/dist/_chunks/{parse-UB4FJGNA.js → parse-B0s7bY4d.js} +3 -3
  39. package/dist/_chunks/{parseISO-y3LncvfO.js → parseISO-DZZ5a-zK.js} +2 -2
  40. package/dist/_chunks/{patient-details-Cd_dCqkg.js → patient-details-Dgd_tocD.js} +2 -2
  41. package/dist/_chunks/{patient-field-row-D6Ftm46u.js → patient-field-row-BFVlJnS9.js} +3 -3
  42. package/dist/_chunks/{patient-summary-card-BSOHR4Ol.js → patient-summary-card-BTKvFUmh.js} +2 -2
  43. package/dist/_chunks/{phone-input-O9camxkq.js → phone-input-EwVuqFik.js} +74 -74
  44. package/dist/_chunks/{pl-HwLM6gPs.js → pl-BLh7KO-s.js} +3 -3
  45. package/dist/_chunks/{pregnancy-dating-CvNFirHt.js → pregnancy-dating-JBAUbM40.js} +7 -7
  46. package/dist/_chunks/{pt-BxhT5ZQH.js → pt-CPKOrOLj.js} +2 -2
  47. package/dist/_chunks/{radiograph-panel.agent-ESnkuDfH.js → radiograph-panel.agent-DQh2SX8G.js} +3 -3
  48. package/dist/_chunks/registration-form-B6qqeXP1.js +1310 -0
  49. package/dist/_chunks/{rich-text-editor-BXFgcvBW.js → rich-text-editor-BZTyxQBd.js} +1683 -1673
  50. package/dist/_chunks/{ro-Do9W55ae.js → ro-Dc-oNqbF.js} +2 -2
  51. package/dist/_chunks/{ru-PDBX5gdf.js → ru-BtNpDZRR.js} +3 -3
  52. package/dist/_chunks/send-registration-link-form-pO2bGjGa.js +409 -0
  53. package/dist/_chunks/{slot-grid-uA9j7Nik.js → slot-grid-Bb13H9Rl.js} +3 -3
  54. package/dist/_chunks/{sq-DnvsgyIh.js → sq-D4c7olaV.js} +2 -2
  55. package/dist/_chunks/subDays-DKISP2nE.js +8 -0
  56. package/dist/_chunks/{sv-CpFSK8xS.js → sv-Bf_dHPvh.js} +2 -2
  57. package/dist/_chunks/{task-editor-BTeUFGUX.js → task-editor-CRhfwP9T.js} +2 -2
  58. package/dist/_chunks/{tr-DW4oQYHT.js → tr-xqQ6cbGY.js} +2 -2
  59. package/dist/_chunks/{use-appointment-details-read-BWbOiLVw.js → use-appointment-details-read-BFslxbRr.js} +2 -2
  60. package/dist/_chunks/use-field-match-C8ug3sdQ.js +30 -0
  61. package/dist/_chunks/use-registration-submit-CLGHxwoT.js +112 -0
  62. package/dist/_chunks/{zh-CN-QGEs29fQ.js → zh-CN-C657DBCO.js} +3 -3
  63. package/dist/agent-catalog.json +90 -6
  64. package/dist/agent-i18n/en.json +11 -4
  65. package/dist/alia-asteroid-icon/index.js +52 -0
  66. package/dist/aws-transcribe/index.js +320 -0
  67. package/dist/components/appointment-details-panel/index.js +1 -1
  68. package/dist/components/appointment-timeline/index.js +1 -1
  69. package/dist/components/booking/booking-types.d.ts +9 -1
  70. package/dist/components/booking/details-form.d.ts +2 -0
  71. package/dist/components/booking/index.js +1 -1
  72. package/dist/components/cycle-calculator/index.js +1 -1
  73. package/dist/components/data-table/index.js +1 -1
  74. package/dist/components/date-picker/index.js +1 -1
  75. package/dist/components/date-range-picker/index.js +1 -1
  76. package/dist/components/date-time-picker/index.js +1 -1
  77. package/dist/components/due-date-calculator/index.js +2 -2
  78. package/dist/components/gestational-age-calculator/index.js +1 -1
  79. package/dist/components/hcg-doubling/index.js +1 -1
  80. package/dist/components/header-settings/header-settings.d.ts +6 -0
  81. package/dist/components/header-settings/index.js +1 -1
  82. package/dist/components/index.d.ts +1 -0
  83. package/dist/components/locale-picker/index.js +1 -1
  84. package/dist/components/locale-picker/locale-picker.d.ts +16 -4
  85. package/dist/components/notes-panel/index.js +1 -1
  86. package/dist/components/patient-details/index.js +1 -1
  87. package/dist/components/patient-summary-card/index.js +1 -1
  88. package/dist/components/patient-table/index.js +1 -1
  89. package/dist/components/phone-input/index.js +1 -1
  90. package/dist/components/pregnancy-dating/index.js +1 -1
  91. package/dist/components/radiograph-panel/index.js +1 -1
  92. package/dist/components/rich-text-editor/index.js +2 -2
  93. package/dist/components/slot-grid/index.js +1 -1
  94. package/dist/components/task-editor/index.js +1 -1
  95. package/dist/hooks/index.js +1 -1
  96. package/dist/hooks/use-field-match.d.ts +2 -2
  97. package/dist/i18n/locales/ar.d.ts +36 -0
  98. package/dist/i18n/locales/ar.js +38 -2
  99. package/dist/i18n/locales/de.d.ts +36 -0
  100. package/dist/i18n/locales/de.js +38 -2
  101. package/dist/i18n/locales/el.d.ts +36 -0
  102. package/dist/i18n/locales/el.js +38 -2
  103. package/dist/i18n/locales/en.d.ts +36 -0
  104. package/dist/i18n/locales/en.js +38 -2
  105. package/dist/i18n/locales/es.d.ts +36 -0
  106. package/dist/i18n/locales/es.js +38 -2
  107. package/dist/i18n/locales/fr.d.ts +36 -0
  108. package/dist/i18n/locales/fr.js +38 -2
  109. package/dist/i18n/locales/hi.d.ts +36 -0
  110. package/dist/i18n/locales/hi.js +38 -2
  111. package/dist/i18n/locales/it.d.ts +36 -0
  112. package/dist/i18n/locales/it.js +38 -2
  113. package/dist/i18n/locales/ja.d.ts +36 -0
  114. package/dist/i18n/locales/ja.js +38 -2
  115. package/dist/i18n/locales/nl.d.ts +36 -0
  116. package/dist/i18n/locales/nl.js +38 -2
  117. package/dist/i18n/locales/pl.d.ts +36 -0
  118. package/dist/i18n/locales/pl.js +38 -2
  119. package/dist/i18n/locales/pt.d.ts +36 -0
  120. package/dist/i18n/locales/pt.js +38 -2
  121. package/dist/i18n/locales/ro.d.ts +36 -0
  122. package/dist/i18n/locales/ro.js +38 -2
  123. package/dist/i18n/locales/ru.d.ts +36 -0
  124. package/dist/i18n/locales/ru.js +38 -2
  125. package/dist/i18n/locales/sq.d.ts +36 -0
  126. package/dist/i18n/locales/sq.js +38 -2
  127. package/dist/i18n/locales/sv.d.ts +36 -0
  128. package/dist/i18n/locales/sv.js +38 -2
  129. package/dist/i18n/locales/tr.d.ts +36 -0
  130. package/dist/i18n/locales/tr.js +38 -2
  131. package/dist/i18n/locales/zh.d.ts +36 -0
  132. package/dist/i18n/locales/zh.js +38 -2
  133. package/dist/index.js +296 -292
  134. package/dist/locales/ar.json +38 -2
  135. package/dist/locales/de.json +38 -2
  136. package/dist/locales/el.json +38 -2
  137. package/dist/locales/en.json +38 -2
  138. package/dist/locales/es.json +38 -2
  139. package/dist/locales/fr.json +38 -2
  140. package/dist/locales/hi.json +38 -2
  141. package/dist/locales/it.json +38 -2
  142. package/dist/locales/ja.json +38 -2
  143. package/dist/locales/nl.json +38 -2
  144. package/dist/locales/pl.json +38 -2
  145. package/dist/locales/pt.json +38 -2
  146. package/dist/locales/ro.json +38 -2
  147. package/dist/locales/ru.json +38 -2
  148. package/dist/locales/sq.json +38 -2
  149. package/dist/locales/sv.json +38 -2
  150. package/dist/locales/tr.json +38 -2
  151. package/dist/locales/zh.json +38 -2
  152. package/dist/patterns/alia-assistant/alia-types.d.ts +22 -0
  153. package/dist/patterns/alia-assistant/index.js +7 -6
  154. package/dist/patterns/anamnesis/index.js +1 -1
  155. package/dist/patterns/calendar/index.js +1 -1
  156. package/dist/patterns/forgot-password-form/index.js +1 -1
  157. package/dist/patterns/login-form/index.js +1 -1
  158. package/dist/patterns/marketplace-app-shell/index.js +1 -1
  159. package/dist/patterns/registration-form/index.d.ts +1 -0
  160. package/dist/patterns/registration-form/index.js +1 -1
  161. package/dist/patterns/registration-form/registration-form.d.ts +43 -0
  162. package/dist/patterns/registration-form/registration-verification.d.ts +38 -0
  163. package/dist/patterns/registration-form/use-contact-verification.d.ts +107 -0
  164. package/dist/patterns/registration-form/verification-requests.d.ts +9 -0
  165. package/dist/patterns/send-registration-link-form/index.d.ts +3 -0
  166. package/dist/patterns/send-registration-link-form/index.js +6 -0
  167. package/dist/patterns/send-registration-link-form/send-registration-link-form.d.ts +80 -0
  168. package/dist/speech/aws-transcribe.d.ts +65 -0
  169. package/dist/speech/event-stream.d.ts +13 -0
  170. package/dist/tokens.css +1 -1
  171. package/package.json +13 -1
  172. package/dist/_chunks/alia-sidebar-DZoyUFW8.js +0 -1290
  173. package/dist/_chunks/booking-4BCeh7OY.js +0 -3889
  174. package/dist/_chunks/registration-form-BGSVMAga.js +0 -819
  175. package/dist/_chunks/subDays-xH7cpN6B.js +0 -8
  176. package/dist/_chunks/use-field-match-pdbEnKvO.js +0 -28
  177. package/dist/_chunks/use-registration-submit-eWAECgUC.js +0 -171
@@ -1,819 +0,0 @@
1
- import { jsx as s, jsxs as R, Fragment as Jr } from "react/jsx-runtime";
2
- import { forwardRef as Ie, useId as D, useState as N, useRef as z, useMemo as Re, useEffect as j } from "react";
3
- import { useTranslation as Qr, Trans as Lr } from "react-i18next";
4
- import { c as q } from "./index-D2ZczOXr.js";
5
- import { parsePhoneNumberFromString as qe } from "libphonenumber-js/min";
6
- import { i as Se, E as Or } from "./email-input-C7THAwh2.js";
7
- import { A as Tr } from "./alert-9kEwDza3.js";
8
- import { B as Pe } from "./button-DohK_Ak_.js";
9
- import { C as _r } from "./card-BA4Ig_kn.js";
10
- import { C as ke } from "./checkbox-BjDv-r3o.js";
11
- import { D as ye } from "./dev-bypass-button-B7ePcJcg.js";
12
- import { E as Be } from "./error-summary-mGxIyDAY.js";
13
- import { F as I } from "./form-field-Ani72sVY.js";
14
- import { P as $r } from "./password-input-BokZ_rnT.js";
15
- import { u as Me } from "./use-password-requirements-C8DdwPEy.js";
16
- import { P as Ae } from "./phone-input-O9camxkq.js";
17
- import { R as De } from "./recaptcha-widget-CsvwlYTE.js";
18
- import { S as je } from "./select-4S-eYZUf.js";
19
- import { S as zr } from "./state-backed-text-input-Cgh4ms3p.js";
20
- import { i as Le } from "./is-development-CLUAnsU7.js";
21
- import { u as Hr } from "./use-state-backed-input-DhRQo6gM.js";
22
- import { a as Oe, i as Te } from "./safe-href-5dbsfbQn.js";
23
- import { u as Wr } from "./use-field-match-pdbEnKvO.js";
24
- import { u as _e, b as $e, a as ze, B as He } from "./use-registration-submit-eWAECgUC.js";
25
- import { C as We } from "./circle-alert-rGDZ73Wh.js";
26
- const Gr = [
27
- "firstName",
28
- "lastName",
29
- "email",
30
- "emailConfirm",
31
- "password",
32
- "passwordConfirm",
33
- "phone",
34
- "branch",
35
- "terms"
36
- ], Ge = q(
37
- "ds:@container/registration ds:w-full ds:text-start ds:text-[var(--foreground)]"
38
- ), Ke = q(
39
- "ds:grid ds:grid-cols-1 ds:items-start ds:gap-[var(--spacing-md)]",
40
- {
41
- variants: {
42
- columns: {
43
- /** A field alone in its row takes the full width. */
44
- one: "",
45
- /** Two fields side by side once the card is wide enough. */
46
- two: "ds:@[544px]/registration:grid-cols-2"
47
- }
48
- },
49
- defaultVariants: { columns: "two" }
50
- }
51
- ), Ue = q("ds:relative ds:flex ds:gap-[var(--spacing-sm)]", {
52
- variants: {
53
- logo: {
54
- /** A centred column under the mark. */
55
- true: "ds:flex-col ds:items-center",
56
- /** The heading at the start edge, the shortcut at the end. */
57
- false: "ds:items-start ds:justify-between"
58
- }
59
- },
60
- defaultVariants: { logo: !0 }
61
- }), Ye = q(
62
- "ds:flex ds:min-w-0 ds:flex-col ds:gap-[var(--spacing-xs)]",
63
- {
64
- variants: {
65
- centred: { true: "ds:items-center ds:text-center", false: "" }
66
- },
67
- defaultVariants: { centred: !0 }
68
- }
69
- ), Je = q("ds:shrink-0", {
70
- variants: {
71
- corner: { true: "ds:absolute ds:top-0 ds:end-0", false: "" }
72
- },
73
- defaultVariants: { corner: !0 }
74
- }), Qe = q(
75
- "ds:rounded-[var(--radius-sm)] ds:underline ds:underline-offset-4 ds:text-[var(--foreground)] ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]",
76
- {
77
- variants: {
78
- weight: { normal: "", strong: "ds:font-semibold" }
79
- },
80
- defaultVariants: { weight: "normal" }
81
- }
82
- ), Xe = q(
83
- "ds:focus-visible:outline-solid ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)]"
84
- ), Ze = q(
85
- "ds:text-destructive ds:ms-[var(--spacing-xs)]"
86
- ), Ve = {
87
- minLength: 12,
88
- uppercase: !0,
89
- lowercase: !0,
90
- digit: !0,
91
- charset: "ascii"
92
- }, rs = "Alfadocs", fr = (d) => d && Te(d) ? d : void 0, Kr = (d) => Object.values(d).some(Boolean), Ur = (d) => {
93
- var c;
94
- return ((c = qe(d)) == null ? void 0 : c.isPossible()) ?? !1;
95
- };
96
- function ur({
97
- href: d,
98
- newTab: c = !1,
99
- weight: P,
100
- action: u,
101
- children: F
102
- }) {
103
- const { t: L } = Qr("ui");
104
- return /* @__PURE__ */ R(
105
- "a",
106
- {
107
- href: d,
108
- target: c ? "_blank" : void 0,
109
- rel: c ? "noopener noreferrer" : void 0,
110
- "data-action": u,
111
- className: Qe({ weight: P }),
112
- children: [
113
- F,
114
- c && /* @__PURE__ */ s("span", { className: "ds:sr-only", children: L("link.opensInNewTab") })
115
- ]
116
- }
117
- );
118
- }
119
- function Yr({ children: d }) {
120
- return /* @__PURE__ */ s(Jr, { children: d });
121
- }
122
- const es = [
123
- ["firstName", "lastName"],
124
- ["email", "emailConfirm"],
125
- ["password", "passwordConfirm"],
126
- ["phone", "branch"]
127
- ];
128
- function ss(d) {
129
- const c = [];
130
- for (const P of es) {
131
- const u = P.filter(d);
132
- if (u.length === 0) continue;
133
- const F = c[c.length - 1];
134
- u.length === 1 && (F == null ? void 0 : F.length) === 1 ? F.push(u[0]) : c.push(u);
135
- }
136
- return c;
137
- }
138
- const os = Ie(
139
- ({
140
- title: d,
141
- description: c,
142
- headingLevel: P = 2,
143
- showLogo: u = !0,
144
- logoMotion: F = "assemble",
145
- children: L,
146
- fields: pr,
147
- initialValues: a,
148
- errors: k,
149
- emailReadOnly: Xr = !1,
150
- emailDescription: Zr,
151
- blockPaste: H,
152
- blockCopy: W,
153
- branches: G,
154
- passwordPolicy: Vr = Ve,
155
- termsHref: re,
156
- privacyHref: ee,
157
- termsLabel: se,
158
- termsDescription: K,
159
- loginHref: oe,
160
- recaptchaSiteKey: U,
161
- submitLabel: ae,
162
- submitting: te = !1,
163
- devBypass: f,
164
- onSubmit: Y,
165
- fieldNames: S,
166
- action: J,
167
- hiddenFields: ne,
168
- className: ie,
169
- ...me
170
- }, de) => {
171
- const { t: i, i18n: hr } = Qr("ui"), gr = D(), ce = D(), h = (r) => `${ce}-${r}`, wr = D(), vr = D(), br = D(), x = S !== void 0, le = !!(G && G.length > 0), [fe] = N(() => !!(a != null && a.email)), y = Xr && fe, n = (r) => r === "email" || r === "password" ? !0 : pr && !pr.includes(r) ? !1 : r === "branch" ? le : r === "emailConfirm" ? !y : !0, O = Gr.filter(n), [o, Q] = N(() => ({
172
- firstName: (a == null ? void 0 : a.firstName) ?? "",
173
- lastName: (a == null ? void 0 : a.lastName) ?? "",
174
- email: (a == null ? void 0 : a.email) ?? "",
175
- emailConfirm: (a == null ? void 0 : a.emailConfirm) ?? "",
176
- password: "",
177
- passwordConfirm: "",
178
- phone: (a == null ? void 0 : a.phone) ?? "",
179
- branch: (a == null ? void 0 : a.branch) ?? "",
180
- terms: (a == null ? void 0 : a.terms) ?? !1
181
- })), [ue, Cr] = N(
182
- () => Ur((a == null ? void 0 : a.phone) ?? "")
183
- ), [pe, X] = N(() => ({
184
- email: !!(a != null && a.email)
185
- })), [Z, Nr] = N(!1), [V, rr] = N(
186
- () => k ?? {}
187
- ), g = (r, e) => {
188
- Q((t) => ({ ...t, [r]: e })), rr(
189
- (t) => t[r] ? { ...t, [r]: void 0 } : t
190
- );
191
- }, B = (r) => X(
192
- (e) => e[r] ? e : { ...e, [r]: !0 }
193
- ), Fr = () => {
194
- Q((r) => ({
195
- ...r,
196
- password: "",
197
- passwordConfirm: ""
198
- })), X((r) => ({
199
- ...r,
200
- password: !1,
201
- passwordConfirm: !1
202
- }));
203
- }, M = (r) => ({
204
- blockPaste: (H == null ? void 0 : H.includes(r)) ?? !1,
205
- blockCopy: (W == null ? void 0 : W.includes(r)) ?? !1
206
- }), xr = Me(Vr), er = Wr({
207
- value: o.email,
208
- confirmValue: o.emailConfirm,
209
- kind: "email",
210
- submitted: Z
211
- }), sr = Wr({
212
- value: o.password,
213
- confirmValue: o.passwordConfirm,
214
- kind: "password",
215
- submitted: Z
216
- }), Er = {
217
- firstName: n("firstName") && o.firstName.trim() === "",
218
- lastName: n("lastName") && o.lastName.trim() === "",
219
- // The user cannot fix a locked address, so the server judges it.
220
- email: !y && !Se(o.email),
221
- emailConfirm: n("emailConfirm") && (o.emailConfirm === "" || !er.matches),
222
- password: o.password === "" || !xr.every((r) => r.test(o.password)),
223
- passwordConfirm: n("passwordConfirm") && (o.passwordConfirm === "" || !sr.matches),
224
- phone: n("phone") && (o.phone === "" || !ue),
225
- branch: n("branch") && o.branch === "",
226
- terms: n("terms") && !o.terms
227
- }, he = (r) => Z || r !== "terms" && pe[r] === !0, w = i("registrationForm.required"), v = {
228
- firstName: i("registrationForm.firstName"),
229
- lastName: i("registrationForm.lastName"),
230
- email: i("registrationForm.email"),
231
- emailConfirm: i("registrationForm.emailConfirm"),
232
- password: i("registrationForm.password"),
233
- passwordConfirm: i("registrationForm.passwordConfirm"),
234
- phone: i("registrationForm.phone"),
235
- branch: i("registrationForm.branch")
236
- }, b = (r, e) => he(r) && Er[r] ? e : void 0, ge = {
237
- firstName: b("firstName", w),
238
- lastName: b("lastName", w),
239
- email: b(
240
- "email",
241
- o.email === "" ? w : i("inputs.email.invalid")
242
- ),
243
- emailConfirm: o.emailConfirm === "" ? b("emailConfirm", w) : er.error,
244
- password: b(
245
- "password",
246
- o.password === "" ? w : i("registrationForm.passwordInvalid")
247
- ),
248
- passwordConfirm: o.passwordConfirm === "" ? b("passwordConfirm", w) : sr.error,
249
- phone: b(
250
- "phone",
251
- o.phone === "" ? w : i("registrationForm.phoneInvalid")
252
- ),
253
- branch: b("branch", w),
254
- terms: b("terms", i("registrationForm.termsRequired"))
255
- }, p = (r) => V[r] ?? ge[r], or = z({}), C = Re(() => {
256
- const r = (e) => (t) => {
257
- or.current[e] = t;
258
- };
259
- return {
260
- firstName: r("firstName"),
261
- lastName: r("lastName"),
262
- email: r("email"),
263
- emailConfirm: r("emailConfirm"),
264
- password: r("password"),
265
- passwordConfirm: r("passwordConfirm"),
266
- phone: r("phone"),
267
- branch: r("branch"),
268
- terms: r("terms")
269
- };
270
- }, []), Ir = Hr(o.email, C.email), Rr = Hr(
271
- o.emailConfirm,
272
- C.emailConfirm
273
- ), qr = z(null), Sr = (r) => O.find((e) => r[e]) ?? (Kr(r) ? "form" : void 0), [Pr] = N(
274
- () => O.some((r) => !!(k != null && k[r]))
275
- ), l = _e(O, p, Pr), [T, ar] = N(() => {
276
- const r = Pr ? void 0 : Sr(k ?? {});
277
- return r ? { target: r } : null;
278
- });
279
- j(() => {
280
- var r, e;
281
- T && (T.target === "form" ? (r = qr.current) == null || r.focus() : (e = or.current[T.target]) == null || e.focus());
282
- }, [T]);
283
- const tr = n("phone");
284
- j(() => {
285
- const r = or.current.phone;
286
- if (!tr || !r) return;
287
- const e = () => X(
288
- (t) => t.phone ? t : { ...t, phone: !0 }
289
- );
290
- return r.addEventListener("blur", e), () => r.removeEventListener("blur", e);
291
- }, [tr]);
292
- const nr = z(null), ir = z(null), [kr, we] = N(null);
293
- j(() => {
294
- var r;
295
- kr && ((r = nr.current) == null || r.requestSubmit());
296
- }, [kr]);
297
- const ve = () => {
298
- var e;
299
- const r = f == null ? void 0 : f.values;
300
- if (r) {
301
- const t = y ? void 0 : r.email, m = {};
302
- n("firstName") && r.firstName !== void 0 && (m.firstName = r.firstName), n("lastName") && r.lastName !== void 0 && (m.lastName = r.lastName), t !== void 0 && (m.email = t), n("emailConfirm") && t !== void 0 && (m.emailConfirm = t), r.password !== void 0 && (m.password = r.password), n("passwordConfirm") && r.password !== void 0 && (m.passwordConfirm = r.password), n("phone") && r.phone !== void 0 && (m.phone = r.phone), n("branch") && r.branch !== void 0 && (m.branch = r.branch), n("terms") && r.terms !== void 0 && (m.terms = r.terms), Q((lr) => ({ ...lr, ...m })), m.phone !== void 0 && Cr(Ur(m.phone)), rr((lr) => {
303
- const jr = { ...lr };
304
- for (const Ee of Object.keys(m))
305
- jr[Ee] = void 0;
306
- return jr;
307
- }), f.submit && we({});
308
- }
309
- (e = f == null ? void 0 : f.onClick) == null || e.call(f);
310
- }, A = $e({
311
- errors: k,
312
- submitting: te,
313
- native: x,
314
- captcha: !!U,
315
- firstProblem: () => O.find((r) => Er[r]),
316
- onRefused: (r) => {
317
- Nr(!0), l.open(() => ar({ target: r }));
318
- },
319
- deliver: (r) => {
320
- var t;
321
- if (x) {
322
- ir.current && r && (ir.current.value = r), (t = nr.current) == null || t.submit();
323
- return;
324
- }
325
- const e = (m) => n(m) ? o[m] : "";
326
- Y == null || Y({
327
- firstName: e("firstName"),
328
- lastName: e("lastName"),
329
- email: o.email,
330
- emailConfirm: e("emailConfirm"),
331
- password: o.password,
332
- passwordConfirm: e("passwordConfirm"),
333
- phone: e("phone"),
334
- branch: e("branch"),
335
- terms: n("terms") && o.terms,
336
- captchaToken: r
337
- });
338
- },
339
- onAnswer: (r) => {
340
- const e = r;
341
- rr(e), Kr(e) && (Fr(), Nr(!1), l.open(() => {
342
- const t = Sr(e);
343
- t && ar({ target: t });
344
- }));
345
- },
346
- // The page came back from the browser's cache as it was left:
347
- // the passwords must not come back with it.
348
- onRestore: Fr
349
- }), { busy: mr, captchaFailed: dr } = A;
350
- j(() => {
351
- dr && ar({ target: "form" });
352
- }, [dr]);
353
- const E = (r) => x ? S[r] : r, be = `h${P}`, yr = fr(re), Br = fr(ee), Mr = fr(oe), Ce = x && J && Oe(J) ? J : void 0, _ = [
354
- V.form,
355
- ...Gr.filter((r) => !n(r)).map(
356
- (r) => V[r]
357
- ),
358
- dr ? i("inputs.recaptcha.error") : void 0
359
- ].filter(Boolean).join(" ") || void 0, Ne = ze(
360
- _,
361
- l.listed.length > 0
362
- ), $ = p("terms"), Fe = [
363
- K ? vr : void 0,
364
- $ ? wr : void 0
365
- ].filter(Boolean).join(" ") || void 0, Ar = new Set(Object.values(S ?? {})), Dr = x ? Object.entries(ne ?? {}) : [], cr = Dr.filter(([r]) => Ar.has(r)).map(([r]) => r).join(", ");
366
- j(() => {
367
- cr && Le() && console.warn(
368
- `RegistrationForm: hiddenFields "${cr}" is also named in fieldNames and was left out. The form's own field wins.`
369
- );
370
- }, [cr]);
371
- const xe = (r) => {
372
- switch (r) {
373
- case "firstName":
374
- return /* @__PURE__ */ s(
375
- I,
376
- {
377
- id: h(r),
378
- label: v.firstName,
379
- required: !0,
380
- error: p("firstName"),
381
- announceError: !l.lists("firstName"),
382
- "data-field": "firstName",
383
- children: /* @__PURE__ */ s(
384
- zr,
385
- {
386
- ref: C.firstName,
387
- name: E("firstName"),
388
- autoComplete: "given-name",
389
- value: o.firstName,
390
- onChange: (e) => g("firstName", e.target.value),
391
- onBlur: () => B("firstName"),
392
- ...M("firstName")
393
- }
394
- )
395
- },
396
- r
397
- );
398
- case "lastName":
399
- return /* @__PURE__ */ s(
400
- I,
401
- {
402
- id: h(r),
403
- label: v.lastName,
404
- required: !0,
405
- error: p("lastName"),
406
- announceError: !l.lists("lastName"),
407
- "data-field": "lastName",
408
- children: /* @__PURE__ */ s(
409
- zr,
410
- {
411
- ref: C.lastName,
412
- name: E("lastName"),
413
- autoComplete: "family-name",
414
- value: o.lastName,
415
- onChange: (e) => g("lastName", e.target.value),
416
- onBlur: () => B("lastName"),
417
- ...M("lastName")
418
- }
419
- )
420
- },
421
- r
422
- );
423
- case "email":
424
- return /* @__PURE__ */ s(
425
- I,
426
- {
427
- id: h(r),
428
- label: v.email,
429
- required: !y,
430
- description: Zr,
431
- error: p("email"),
432
- announceError: !l.lists("email"),
433
- "data-field": "email",
434
- children: /* @__PURE__ */ s(
435
- Or,
436
- {
437
- ref: Ir.ref,
438
- name: E("email"),
439
- errorMessage: null,
440
- disableBuiltInValidation: y,
441
- readOnly: y,
442
- onChange: Ir.quiet(
443
- (e) => g("email", e.target.value)
444
- ),
445
- onBlur: () => B("email"),
446
- ...M("email")
447
- }
448
- )
449
- },
450
- r
451
- );
452
- case "emailConfirm":
453
- return /* @__PURE__ */ s(
454
- I,
455
- {
456
- id: h(r),
457
- label: v.emailConfirm,
458
- required: !0,
459
- error: p("emailConfirm"),
460
- announceError: !l.lists("emailConfirm"),
461
- "data-field": "emailConfirm",
462
- children: /* @__PURE__ */ s(
463
- Or,
464
- {
465
- ref: Rr.ref,
466
- name: E("emailConfirm"),
467
- disableBuiltInValidation: !0,
468
- onChange: Rr.quiet(
469
- (e) => g("emailConfirm", e.target.value)
470
- ),
471
- onBlur: () => {
472
- B("emailConfirm"), er.confirmProps.onBlur();
473
- },
474
- ...M("emailConfirm")
475
- }
476
- )
477
- },
478
- r
479
- );
480
- case "password":
481
- return /* @__PURE__ */ s(
482
- I,
483
- {
484
- id: h(r),
485
- label: v.password,
486
- required: !0,
487
- error: p("password"),
488
- announceError: !l.lists("password"),
489
- "data-field": "password",
490
- children: /* @__PURE__ */ s(
491
- $r,
492
- {
493
- ref: C.password,
494
- name: E("password") ?? "",
495
- autoComplete: "new-password",
496
- requirements: xr,
497
- value: o.password,
498
- onChange: (e) => g("password", e.target.value),
499
- onBlur: () => B("password"),
500
- ...M("password")
501
- }
502
- )
503
- },
504
- r
505
- );
506
- case "passwordConfirm":
507
- return /* @__PURE__ */ s(
508
- I,
509
- {
510
- id: h(r),
511
- label: v.passwordConfirm,
512
- required: !0,
513
- error: p("passwordConfirm"),
514
- announceError: !l.lists("passwordConfirm"),
515
- "data-field": "passwordConfirm",
516
- children: /* @__PURE__ */ s(
517
- $r,
518
- {
519
- ref: C.passwordConfirm,
520
- name: E("passwordConfirm") ?? "",
521
- autoComplete: "new-password",
522
- value: o.passwordConfirm,
523
- onChange: (e) => g("passwordConfirm", e.target.value),
524
- onBlur: () => {
525
- B("passwordConfirm"), sr.confirmProps.onBlur();
526
- },
527
- ...M("passwordConfirm")
528
- }
529
- )
530
- },
531
- r
532
- );
533
- case "phone":
534
- return /* @__PURE__ */ s(
535
- I,
536
- {
537
- id: h(r),
538
- label: v.phone,
539
- required: !0,
540
- error: p("phone"),
541
- announceError: !l.lists("phone"),
542
- "data-field": "phone",
543
- children: /* @__PURE__ */ s(
544
- Ae,
545
- {
546
- ref: C.phone,
547
- name: x ? void 0 : "phone",
548
- value: o.phone,
549
- onChange: (e, t) => {
550
- g("phone", e), Cr(t.isPossible);
551
- }
552
- }
553
- )
554
- },
555
- r
556
- );
557
- case "branch":
558
- return /* @__PURE__ */ s(
559
- I,
560
- {
561
- id: h(r),
562
- label: v.branch,
563
- required: !0,
564
- error: p("branch"),
565
- announceError: !l.lists("branch"),
566
- "data-field": "branch",
567
- children: /* @__PURE__ */ s(
568
- je,
569
- {
570
- ref: C.branch,
571
- name: E("branch"),
572
- options: G ?? [],
573
- value: o.branch,
574
- onValueChange: (e) => g("branch", e)
575
- }
576
- )
577
- },
578
- r
579
- );
580
- }
581
- };
582
- return /* @__PURE__ */ s(
583
- "div",
584
- {
585
- ref: de,
586
- ...me,
587
- "data-component": "registration-form",
588
- className: Ge({ className: ie }),
589
- children: /* @__PURE__ */ s(_r, { variant: "elevated", children: /* @__PURE__ */ R(_r.Body, { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-lg)]", children: [
590
- /* @__PURE__ */ R("div", { className: Ue({ logo: u }), children: [
591
- /* @__PURE__ */ R("div", { className: Ye({ centred: u }), children: [
592
- u && /* @__PURE__ */ s(He, { motion: F, label: rs }),
593
- /* @__PURE__ */ s(be, { id: gr, className: "type-title-card", children: d ?? i("registrationForm.title") }),
594
- c && /* @__PURE__ */ s("p", { className: "type-body-sm ds:text-[var(--muted-foreground)]", children: c })
595
- ] }),
596
- f && (f.values || f.onClick) && /* @__PURE__ */ s("div", { className: Je({ corner: u }), children: /* @__PURE__ */ s(
597
- ye,
598
- {
599
- label: f.label,
600
- onClick: ve
601
- }
602
- ) })
603
- ] }),
604
- L ? /* @__PURE__ */ s(
605
- "div",
606
- {
607
- "data-slot": "host-content",
608
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
609
- children: L
610
- }
611
- ) : null,
612
- /* @__PURE__ */ R(
613
- "form",
614
- {
615
- ref: nr,
616
- noValidate: !0,
617
- method: "post",
618
- action: Ce,
619
- "aria-labelledby": gr,
620
- "aria-busy": mr || void 0,
621
- onSubmit: A.handleSubmit,
622
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)]",
623
- children: [
624
- /* @__PURE__ */ s(
625
- Be,
626
- {
627
- ref: l.ref,
628
- headingLevel: P + 1,
629
- "aria-describedby": _ ? br : void 0,
630
- errors: l.listed.map((r) => {
631
- const e = p(r) ?? "";
632
- return {
633
- field: r,
634
- message: e,
635
- // "This field is required." does not say which field:
636
- // the summary names it.
637
- label: e === w && r !== "terms" ? v[r] : void 0,
638
- targetId: h(r)
639
- };
640
- })
641
- }
642
- ),
643
- _ && /* @__PURE__ */ s(
644
- Tr,
645
- {
646
- ref: qr,
647
- id: br,
648
- variant: "error",
649
- announce: Ne,
650
- tabIndex: -1,
651
- "data-field": "form",
652
- className: Xe(),
653
- children: /* @__PURE__ */ s(Tr.Description, { children: _ })
654
- }
655
- ),
656
- ss(n).map((r) => /* @__PURE__ */ s(
657
- "div",
658
- {
659
- className: Ke({
660
- columns: r.length === 2 ? "two" : "one"
661
- }),
662
- children: r.map(xe)
663
- },
664
- r[0]
665
- )),
666
- x && tr && S.phone && /* @__PURE__ */ s(
667
- "input",
668
- {
669
- type: "hidden",
670
- name: S.phone,
671
- value: o.phone
672
- }
673
- ),
674
- x && S.captcha && /* @__PURE__ */ s(
675
- "input",
676
- {
677
- ref: ir,
678
- type: "hidden",
679
- name: S.captcha,
680
- defaultValue: ""
681
- }
682
- ),
683
- Dr.filter(([r]) => !Ar.has(r)).map(([r, e]) => /* @__PURE__ */ s(
684
- "input",
685
- {
686
- type: "hidden",
687
- name: r,
688
- value: e
689
- },
690
- r
691
- )),
692
- n("terms") && /* @__PURE__ */ R(
693
- "div",
694
- {
695
- id: h("terms"),
696
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-xs)]",
697
- "data-field": "terms",
698
- children: [
699
- K && /* @__PURE__ */ s(
700
- "p",
701
- {
702
- id: vr,
703
- className: "type-body-sm ds:text-[var(--muted-foreground)]",
704
- children: K
705
- }
706
- ),
707
- /* @__PURE__ */ s(
708
- ke,
709
- {
710
- ref: C.terms,
711
- name: E("terms"),
712
- value: "1",
713
- checked: o.terms,
714
- onCheckedChange: (r) => g("terms", r === !0),
715
- "aria-required": "true",
716
- "aria-invalid": $ ? !0 : void 0,
717
- "aria-describedby": Fe,
718
- label: /* @__PURE__ */ R(Jr, { children: [
719
- se ?? /* @__PURE__ */ s(
720
- Lr,
721
- {
722
- i18n: hr,
723
- ns: "ui",
724
- i18nKey: "registrationForm.terms",
725
- components: {
726
- terms: yr ? /* @__PURE__ */ s(ur, { href: yr, newTab: !0 }) : /* @__PURE__ */ s(Yr, {}),
727
- privacy: Br ? /* @__PURE__ */ s(ur, { href: Br, newTab: !0 }) : /* @__PURE__ */ s(Yr, {})
728
- }
729
- }
730
- ),
731
- /* @__PURE__ */ s(
732
- "span",
733
- {
734
- "aria-hidden": "true",
735
- className: Ze(),
736
- children: "*"
737
- }
738
- )
739
- ] })
740
- }
741
- ),
742
- $ && /* @__PURE__ */ R(
743
- "p",
744
- {
745
- id: wr,
746
- role: l.lists("terms") ? void 0 : "alert",
747
- "data-slot": "error",
748
- className: "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)] type-body-sm ds:text-destructive",
749
- children: [
750
- /* @__PURE__ */ s(
751
- We,
752
- {
753
- "aria-hidden": "true",
754
- className: "ds:size-4 ds:shrink-0"
755
- }
756
- ),
757
- /* @__PURE__ */ s("span", { children: $ })
758
- ]
759
- }
760
- )
761
- ]
762
- }
763
- ),
764
- /* @__PURE__ */ s(
765
- Pe,
766
- {
767
- type: "submit",
768
- intent: "primary",
769
- size: "lg",
770
- loading: mr,
771
- className: "ds:w-full",
772
- "data-action": "submit",
773
- children: ae ?? i("registrationForm.submit")
774
- }
775
- ),
776
- /* @__PURE__ */ s("p", { role: "status", className: "ds:sr-only", children: mr ? i("chat.message.status.sending") : "" }),
777
- Mr && /* @__PURE__ */ s("p", { className: "type-body-sm ds:text-center ds:text-[var(--muted-foreground)]", children: /* @__PURE__ */ s(
778
- Lr,
779
- {
780
- i18n: hr,
781
- ns: "ui",
782
- i18nKey: "registrationForm.login",
783
- components: {
784
- login: /* @__PURE__ */ s(
785
- ur,
786
- {
787
- href: Mr,
788
- weight: "strong",
789
- action: "login"
790
- }
791
- )
792
- }
793
- }
794
- ) }),
795
- U && /* @__PURE__ */ s("div", { className: "ds:absolute", children: /* @__PURE__ */ s(
796
- De,
797
- {
798
- ref: A.captcha.ref,
799
- siteKey: U,
800
- size: "invisible",
801
- announceStatus: !1,
802
- onChange: A.captcha.onChange,
803
- onError: A.captcha.onError
804
- }
805
- ) })
806
- ]
807
- }
808
- )
809
- ] }) })
810
- }
811
- );
812
- }
813
- );
814
- os.displayName = "RegistrationForm";
815
- export {
816
- Gr as R,
817
- os as a
818
- };
819
- //# sourceMappingURL=registration-form-BGSVMAga.js.map