@incodetech/web 0.0.0-dev-20260209-168e887 → 0.0.0-dev-20260212-7db2d06
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.
- package/dist/authentication/authentication.es.js +1 -1
- package/dist/base.css +11 -2
- package/dist/chevronDown-CN1d_3gk.js +23 -0
- package/dist/curp-validation/curp-validation.es.js +758 -0
- package/dist/curp-validation/styles.css +497 -0
- package/dist/flow/flow.es.js +150 -135
- package/dist/flow/styles.css +567 -0
- package/dist/phone/phone.es.js +354 -371
- package/dist/selfie/selfie.es.js +1 -1
- package/dist/successIcon-_WpNP6Fl.js +26 -0
- package/dist/themes/dark.css +11 -2
- package/dist/themes/light.css +11 -2
- package/dist/{tutorial-Bgqb0LCN.js → tutorial-B01CRbnX.js} +24 -44
- package/dist/types/curp-validation.d.ts +31 -0
- package/package.json +9 -2
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
import { u as e, c as N, S as L, B as E, r as j, a as Y } from "../incodeModule-SZbHLd1r.js";
|
|
2
|
+
import { mexicanStates as q, createCurpValidationManager as K } from "@incodetech/core/curp-validation";
|
|
3
|
+
import { g as X, D as B, A as U, d as F, y as W, k as z } from "../vendor-preact-CjD4WiuC.js";
|
|
4
|
+
import "@incodetech/core";
|
|
5
|
+
import "../instance-B-q0ZREN.js";
|
|
6
|
+
import { u as G, S as J } from "../spinner-BcMtCrDz.js";
|
|
7
|
+
import { I as Q, P as R } from "../incodeComponent-DWkUggQZ.js";
|
|
8
|
+
import { S as $ } from "../successIcon-_WpNP6Fl.js";
|
|
9
|
+
import { C as _ } from "../chevronDown-CN1d_3gk.js";
|
|
10
|
+
const ee = ({ class: n }) => {
|
|
11
|
+
const o = X();
|
|
12
|
+
return /* @__PURE__ */ e(
|
|
13
|
+
"svg",
|
|
14
|
+
{
|
|
15
|
+
width: "24",
|
|
16
|
+
height: "24",
|
|
17
|
+
viewBox: "0 0 24 24",
|
|
18
|
+
fill: "none",
|
|
19
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20
|
+
role: "img",
|
|
21
|
+
"aria-labelledby": o,
|
|
22
|
+
class: n,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ e("title", { id: o, children: "Calendar icon" }),
|
|
25
|
+
/* @__PURE__ */ e(
|
|
26
|
+
"path",
|
|
27
|
+
{
|
|
28
|
+
fillRule: "evenodd",
|
|
29
|
+
clipRule: "evenodd",
|
|
30
|
+
d: "M7.50244 10.1563C7.50244 9.74204 7.83823 9.40625 8.25244 9.40625H16.7485C17.1627 9.40625 17.4985 9.74204 17.4985 10.1563C17.4985 10.5705 17.1627 10.9063 16.7485 10.9063H8.25244C7.83823 10.9063 7.50244 10.5705 7.50244 10.1563Z",
|
|
31
|
+
fill: "currentColor"
|
|
32
|
+
}
|
|
33
|
+
),
|
|
34
|
+
/* @__PURE__ */ e(
|
|
35
|
+
"path",
|
|
36
|
+
{
|
|
37
|
+
fillRule: "evenodd",
|
|
38
|
+
clipRule: "evenodd",
|
|
39
|
+
d: "M16.1406 2.25C16.5548 2.25 16.8906 2.58579 16.8906 3V5.96174C16.8906 6.37595 16.5548 6.71174 16.1406 6.71174C15.7264 6.71174 15.3906 6.37595 15.3906 5.96174V3C15.3906 2.58579 15.7264 2.25 16.1406 2.25Z",
|
|
40
|
+
fill: "currentColor"
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ e(
|
|
44
|
+
"path",
|
|
45
|
+
{
|
|
46
|
+
fillRule: "evenodd",
|
|
47
|
+
clipRule: "evenodd",
|
|
48
|
+
d: "M8.86816 2.25C9.28238 2.25 9.61816 2.58579 9.61816 3V5.96174C9.61816 6.37595 9.28238 6.71174 8.86816 6.71174C8.45395 6.71174 8.11816 6.37595 8.11816 5.96174V3C8.11816 2.58579 8.45395 2.25 8.86816 2.25Z",
|
|
49
|
+
fill: "currentColor"
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ e(
|
|
53
|
+
"path",
|
|
54
|
+
{
|
|
55
|
+
fillRule: "evenodd",
|
|
56
|
+
clipRule: "evenodd",
|
|
57
|
+
d: "M5.0392 4.95256C5.95822 4.07897 7.23731 3.67188 8.69414 3.67188H16.3145C17.7746 3.67188 19.0544 4.07865 19.9721 4.95323C20.8955 5.83327 21.3546 7.094 21.3504 8.60132C21.3504 8.6011 21.3504 8.60154 21.3504 8.60132V16.8137C21.3504 18.3212 20.8891 19.5831 19.9657 20.4646C19.0476 21.341 17.768 21.7504 16.3067 21.7504H8.69414C7.23281 21.7504 5.95209 21.3322 5.03394 20.4423C4.11207 19.5488 3.65039 18.2716 3.65039 16.7456V8.59984C3.65039 7.09167 4.11438 5.83167 5.0392 4.95256ZM6.07265 6.03976C5.51149 6.57317 5.15039 7.40215 5.15039 8.59984V16.7456C5.15039 17.9683 5.5138 18.8185 6.0779 19.3652C6.64573 19.9156 7.51189 20.2504 8.69414 20.2504H16.3067C17.4968 20.2504 18.364 19.9198 18.93 19.3796C19.4906 18.8445 19.8504 18.013 19.8504 16.8137V8.59984V8.59768C19.8539 7.39945 19.4958 6.57144 18.9372 6.03908C18.3728 5.50115 17.5058 5.17187 16.3145 5.17187H8.69414C7.50739 5.17187 6.6396 5.50083 6.07265 6.03976Z",
|
|
58
|
+
fill: "currentColor"
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}, te = ({
|
|
65
|
+
width: n = 14,
|
|
66
|
+
height: o = 14,
|
|
67
|
+
class: s
|
|
68
|
+
}) => /* @__PURE__ */ e(
|
|
69
|
+
"svg",
|
|
70
|
+
{
|
|
71
|
+
width: n,
|
|
72
|
+
height: o,
|
|
73
|
+
viewBox: "0 0 14 14",
|
|
74
|
+
fill: "none",
|
|
75
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
76
|
+
class: `IncodeCloseIcon ${s || ""}`,
|
|
77
|
+
"aria-hidden": "true",
|
|
78
|
+
children: /* @__PURE__ */ e(
|
|
79
|
+
"path",
|
|
80
|
+
{
|
|
81
|
+
fillRule: "evenodd",
|
|
82
|
+
clipRule: "evenodd",
|
|
83
|
+
d: "M1.61595 0.355755C1.26799 0.00779831 0.70414 0.00779831 0.356183 0.355755C0.00822556 0.703713 0.00822556 1.26756 0.356183 1.61552L5.74046 6.9998L0.356183 12.3841C0.00825542 12.732 0.00831515 13.2959 0.356183 13.6438C0.70414 13.9918 1.26799 13.9918 1.61595 13.6438L7.00023 8.25956L12.3845 13.6438C12.7325 13.9918 13.2963 13.9918 13.6443 13.6438C13.9922 13.2959 13.9922 12.732 13.6443 12.3841L8.25999 6.9998L13.6443 1.61552C13.9922 1.26756 13.9922 0.703713 13.6443 0.355755C13.2963 0.0078879 12.7324 0.00782818 12.3845 0.355755L7.00023 5.74003L1.61595 0.355755Z",
|
|
84
|
+
fill: "var(--icon-neutral-800)"
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
), T = ({ size: n = 32 }) => /* @__PURE__ */ e(
|
|
89
|
+
"svg",
|
|
90
|
+
{
|
|
91
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
92
|
+
width: n,
|
|
93
|
+
height: n,
|
|
94
|
+
viewBox: "0 0 32 32",
|
|
95
|
+
fill: "none",
|
|
96
|
+
class: "IncodeErrorIcon",
|
|
97
|
+
"aria-hidden": "true",
|
|
98
|
+
children: [
|
|
99
|
+
/* @__PURE__ */ e("title", { children: "Error" }),
|
|
100
|
+
/* @__PURE__ */ e(
|
|
101
|
+
"path",
|
|
102
|
+
{
|
|
103
|
+
d: "M16 0C24.8219 0 32 7.17642 32 16C32 24.8219 24.8219 32 16 32C7.17811 32 0 24.8219 0 16C0 7.17642 7.17811 0 16 0ZM13.1553 11.3701C12.6618 10.8767 11.8636 10.8767 11.3701 11.3701C10.8767 11.8636 10.8767 12.6618 11.3701 13.1553L14.4053 16.1924L11.3721 19.2256C10.8803 19.7191 10.8803 20.5173 11.3721 21.0107C11.8656 21.504 12.6658 21.5041 13.1592 21.0107L16.1924 17.9775L19.2334 21.0205C19.481 21.2664 19.8029 21.3916 20.1279 21.3916C20.4513 21.3916 20.7746 21.2664 21.0205 21.0205C21.514 20.527 21.514 19.7269 21.0205 19.2334L17.9775 16.1924L21.0107 13.1572C21.5041 12.6638 21.504 11.8639 21.0107 11.3721C20.5173 10.8786 19.7191 10.8786 19.2256 11.3721L16.1904 14.4053L13.1553 11.3701Z",
|
|
104
|
+
fill: "var(--icon-status-negative)"
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
), ne = B((n, o) => {
|
|
110
|
+
const { class: s, type: a = "text", ...t } = n;
|
|
111
|
+
return /* @__PURE__ */ e(
|
|
112
|
+
"input",
|
|
113
|
+
{
|
|
114
|
+
...t,
|
|
115
|
+
ref: o,
|
|
116
|
+
type: a,
|
|
117
|
+
class: N("IncodeInput", s)
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}), x = B(
|
|
121
|
+
({
|
|
122
|
+
id: n,
|
|
123
|
+
label: o,
|
|
124
|
+
"aria-label": s,
|
|
125
|
+
type: a,
|
|
126
|
+
error: t,
|
|
127
|
+
showErrorIcon: d,
|
|
128
|
+
helper: r,
|
|
129
|
+
showHelperIcon: C,
|
|
130
|
+
closeButton: l,
|
|
131
|
+
required: u,
|
|
132
|
+
suppressMessages: m = !1,
|
|
133
|
+
class: f,
|
|
134
|
+
value: c,
|
|
135
|
+
...g
|
|
136
|
+
}, w) => {
|
|
137
|
+
const i = `${n}-helper`, h = `${n}-error`, I = m ? "" : [r ? i : null, t ? h : null].filter(Boolean).join(" ");
|
|
138
|
+
return /* @__PURE__ */ e("div", { class: N("IncodeInputComposed", f), children: [
|
|
139
|
+
o && /* @__PURE__ */ e(
|
|
140
|
+
"label",
|
|
141
|
+
{
|
|
142
|
+
class: "IncodeInputComposedLabel",
|
|
143
|
+
htmlFor: n,
|
|
144
|
+
"data-testid": `${n}-label`,
|
|
145
|
+
children: o
|
|
146
|
+
}
|
|
147
|
+
),
|
|
148
|
+
/* @__PURE__ */ e("div", { class: "IncodeInputComposedWrapper", children: [
|
|
149
|
+
/* @__PURE__ */ e(
|
|
150
|
+
ne,
|
|
151
|
+
{
|
|
152
|
+
id: n,
|
|
153
|
+
type: a,
|
|
154
|
+
...g,
|
|
155
|
+
ref: w,
|
|
156
|
+
required: u,
|
|
157
|
+
"data-has-value": !!(c && String(c).length > 0),
|
|
158
|
+
...!o && s ? { "aria-label": s } : {},
|
|
159
|
+
"aria-describedby": I || void 0,
|
|
160
|
+
"aria-required": u ? "true" : void 0,
|
|
161
|
+
"aria-invalid": t ? "true" : void 0,
|
|
162
|
+
value: c
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
l?.show && /* @__PURE__ */ e(
|
|
166
|
+
"button",
|
|
167
|
+
{
|
|
168
|
+
type: "button",
|
|
169
|
+
"aria-label": "Clear",
|
|
170
|
+
class: "IncodeInputComposedClearButton",
|
|
171
|
+
onClick: l.onClose,
|
|
172
|
+
"data-testid": `${n}-clear`,
|
|
173
|
+
children: /* @__PURE__ */ e(te, {})
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
] }),
|
|
177
|
+
!m && t && /* @__PURE__ */ e(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
class: "IncodeInputComposedErrorWrapper",
|
|
181
|
+
"data-testid": `${n}-error-wrapper`,
|
|
182
|
+
children: [
|
|
183
|
+
d && /* @__PURE__ */ e("div", { class: "IncodeInputComposedIconWrapper", children: /* @__PURE__ */ e(T, { size: 17 }) }),
|
|
184
|
+
/* @__PURE__ */ e("p", { id: h, class: "IncodeInputComposedError", children: t })
|
|
185
|
+
]
|
|
186
|
+
}
|
|
187
|
+
),
|
|
188
|
+
!m && r && !t && /* @__PURE__ */ e(
|
|
189
|
+
"div",
|
|
190
|
+
{
|
|
191
|
+
class: "IncodeInputComposedHelperWrapper",
|
|
192
|
+
"data-testid": `${n}-helper-wrapper`,
|
|
193
|
+
children: [
|
|
194
|
+
C && /* @__PURE__ */ e("div", { class: "IncodeInputComposedIconWrapper", children: /* @__PURE__ */ e($, { size: 17 }) }),
|
|
195
|
+
/* @__PURE__ */ e("p", { id: i, class: "IncodeInputComposedHelper", children: r })
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
] });
|
|
200
|
+
}
|
|
201
|
+
), re = ({
|
|
202
|
+
curp: n,
|
|
203
|
+
isValid: o,
|
|
204
|
+
onCurpChange: s,
|
|
205
|
+
onVerify: a,
|
|
206
|
+
onSwitchToGenerate: t,
|
|
207
|
+
disabled: d = !1,
|
|
208
|
+
placeholder: r,
|
|
209
|
+
continueLabel: C,
|
|
210
|
+
dontHaveLabel: l
|
|
211
|
+
}) => {
|
|
212
|
+
const { t: u } = G(), m = r ?? u("curp.placeholder.curp") ?? "CURP", f = C ?? u("curp.continue") ?? "Continue", c = l ?? u("curp.dontHave") ?? "I don't have my CURP", g = u("curp.placeholder.curp") ?? "CURP";
|
|
213
|
+
return /* @__PURE__ */ e("div", { class: "IncodeCurpValidation IncodeCurpInput", children: [
|
|
214
|
+
/* @__PURE__ */ e(
|
|
215
|
+
x,
|
|
216
|
+
{
|
|
217
|
+
id: "curp-input",
|
|
218
|
+
label: "",
|
|
219
|
+
value: n,
|
|
220
|
+
onInput: (i) => {
|
|
221
|
+
const h = i.target;
|
|
222
|
+
s(h.value.toUpperCase());
|
|
223
|
+
},
|
|
224
|
+
placeholder: m,
|
|
225
|
+
disabled: d,
|
|
226
|
+
maxLength: 18,
|
|
227
|
+
"aria-label": g
|
|
228
|
+
}
|
|
229
|
+
),
|
|
230
|
+
/* @__PURE__ */ e(L, {}),
|
|
231
|
+
/* @__PURE__ */ e(
|
|
232
|
+
E,
|
|
233
|
+
{
|
|
234
|
+
type: "button",
|
|
235
|
+
onClick: a,
|
|
236
|
+
disabled: !o || d,
|
|
237
|
+
"data-testid": "curp-verify",
|
|
238
|
+
children: f
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
/* @__PURE__ */ e(
|
|
242
|
+
E,
|
|
243
|
+
{
|
|
244
|
+
type: "button",
|
|
245
|
+
onClick: t,
|
|
246
|
+
disabled: d,
|
|
247
|
+
"data-testid": "curp-switch-to-generate",
|
|
248
|
+
class: "IncodeCurpInputDontHaveButton",
|
|
249
|
+
children: c
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
] });
|
|
253
|
+
}, O = B(
|
|
254
|
+
({
|
|
255
|
+
id: n,
|
|
256
|
+
label: o,
|
|
257
|
+
value: s,
|
|
258
|
+
onInput: a,
|
|
259
|
+
min: t,
|
|
260
|
+
max: d,
|
|
261
|
+
placeholder: r = "mm/dd/yyyy",
|
|
262
|
+
error: C,
|
|
263
|
+
showErrorIcon: l,
|
|
264
|
+
helper: u,
|
|
265
|
+
showHelperIcon: m,
|
|
266
|
+
suppressMessages: f = !1,
|
|
267
|
+
disabled: c,
|
|
268
|
+
required: g,
|
|
269
|
+
class: w,
|
|
270
|
+
"data-testid": i,
|
|
271
|
+
...h
|
|
272
|
+
}, I) => {
|
|
273
|
+
const b = U(null), V = `${n}-helper`, P = `${n}-error`, k = f ? "" : [u ? V : null, C ? P : null].filter(Boolean).join(" "), H = (y) => {
|
|
274
|
+
b.current = y, typeof I == "function" ? I(y) : I && (I.current = y);
|
|
275
|
+
}, S = (y) => {
|
|
276
|
+
y.preventDefault();
|
|
277
|
+
const D = b.current;
|
|
278
|
+
if (!(!D || c))
|
|
279
|
+
if (D.focus(), "showPicker" in HTMLInputElement.prototype)
|
|
280
|
+
try {
|
|
281
|
+
D.showPicker();
|
|
282
|
+
} catch {
|
|
283
|
+
D.click();
|
|
284
|
+
}
|
|
285
|
+
else
|
|
286
|
+
D.click();
|
|
287
|
+
};
|
|
288
|
+
return /* @__PURE__ */ e("div", { class: N("IncodeDateInputComposed", w), children: [
|
|
289
|
+
o && /* @__PURE__ */ e(
|
|
290
|
+
"label",
|
|
291
|
+
{
|
|
292
|
+
class: "IncodeDateInputComposedLabel",
|
|
293
|
+
htmlFor: n,
|
|
294
|
+
"data-testid": `${n}-label`,
|
|
295
|
+
children: [
|
|
296
|
+
o,
|
|
297
|
+
g && /* @__PURE__ */ e("span", { class: "IncodeDateInputComposedRequired", children: " *" })
|
|
298
|
+
]
|
|
299
|
+
}
|
|
300
|
+
),
|
|
301
|
+
/* @__PURE__ */ e("div", { class: "IncodeDateInputComposedWrapper", children: [
|
|
302
|
+
/* @__PURE__ */ e(
|
|
303
|
+
"input",
|
|
304
|
+
{
|
|
305
|
+
ref: H,
|
|
306
|
+
id: n,
|
|
307
|
+
type: "date",
|
|
308
|
+
class: "IncodeDateInputComposedInput",
|
|
309
|
+
value: s,
|
|
310
|
+
onInput: a,
|
|
311
|
+
min: t,
|
|
312
|
+
max: d,
|
|
313
|
+
placeholder: r,
|
|
314
|
+
disabled: c,
|
|
315
|
+
required: g,
|
|
316
|
+
"data-has-value": !!s,
|
|
317
|
+
"data-testid": i,
|
|
318
|
+
"aria-describedby": k || void 0,
|
|
319
|
+
"aria-required": g ? "true" : void 0,
|
|
320
|
+
"aria-invalid": C ? "true" : void 0,
|
|
321
|
+
...h
|
|
322
|
+
}
|
|
323
|
+
),
|
|
324
|
+
/* @__PURE__ */ e(
|
|
325
|
+
"button",
|
|
326
|
+
{
|
|
327
|
+
type: "button",
|
|
328
|
+
class: "IncodeDateInputComposedIconButton",
|
|
329
|
+
onClick: S,
|
|
330
|
+
onTouchEnd: S,
|
|
331
|
+
disabled: c,
|
|
332
|
+
"aria-label": o ?? "Date",
|
|
333
|
+
tabIndex: -1,
|
|
334
|
+
children: /* @__PURE__ */ e("span", { class: "IncodeDateInputComposedIcon", children: /* @__PURE__ */ e(ee, {}) })
|
|
335
|
+
}
|
|
336
|
+
)
|
|
337
|
+
] }),
|
|
338
|
+
!f && C && /* @__PURE__ */ e(
|
|
339
|
+
"div",
|
|
340
|
+
{
|
|
341
|
+
class: "IncodeDateInputComposedErrorWrapper",
|
|
342
|
+
"data-testid": `${n}-error-wrapper`,
|
|
343
|
+
children: [
|
|
344
|
+
l && /* @__PURE__ */ e("div", { class: "IncodeDateInputComposedIconWrapper", children: /* @__PURE__ */ e(T, { size: 17 }) }),
|
|
345
|
+
/* @__PURE__ */ e("p", { id: P, class: "IncodeDateInputComposedError", children: C })
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
),
|
|
349
|
+
!f && u && !C && /* @__PURE__ */ e(
|
|
350
|
+
"div",
|
|
351
|
+
{
|
|
352
|
+
class: "IncodeDateInputComposedHelperWrapper",
|
|
353
|
+
"data-testid": `${n}-helper-wrapper`,
|
|
354
|
+
children: [
|
|
355
|
+
m && /* @__PURE__ */ e("div", { class: "IncodeDateInputComposedIconWrapper", children: /* @__PURE__ */ e($, { size: 17 }) }),
|
|
356
|
+
/* @__PURE__ */ e("p", { id: V, class: "IncodeDateInputComposedHelper", children: u })
|
|
357
|
+
]
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
] });
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
O.displayName = "DateInputComposed";
|
|
364
|
+
const M = ({
|
|
365
|
+
id: n,
|
|
366
|
+
label: o,
|
|
367
|
+
placeholder: s = "Choose an option",
|
|
368
|
+
value: a,
|
|
369
|
+
options: t,
|
|
370
|
+
onChange: d,
|
|
371
|
+
error: r,
|
|
372
|
+
helper: C,
|
|
373
|
+
showErrorIcon: l,
|
|
374
|
+
showHelperIcon: u,
|
|
375
|
+
suppressMessages: m = !1,
|
|
376
|
+
disabled: f = !1,
|
|
377
|
+
required: c,
|
|
378
|
+
class: g,
|
|
379
|
+
"data-testid": w
|
|
380
|
+
}) => {
|
|
381
|
+
const [i, h] = F(!1), [I, b] = F(-1), V = U(null), P = U(null), k = t.find((p) => p.value === a), H = `${n}-helper`, S = `${n}-error`, y = m ? "" : [C ? H : null, r ? S : null].filter(Boolean).join(" ");
|
|
382
|
+
W(() => {
|
|
383
|
+
const p = (v) => {
|
|
384
|
+
V.current && !V.current.contains(v.target) && h(!1);
|
|
385
|
+
};
|
|
386
|
+
return i && document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
|
|
387
|
+
}, [i]), W(() => {
|
|
388
|
+
i || b(-1);
|
|
389
|
+
}, [i]), W(() => {
|
|
390
|
+
i && I >= 0 && P.current && P.current.children[I]?.scrollIntoView({ block: "nearest" });
|
|
391
|
+
}, [I, i]);
|
|
392
|
+
const D = (p) => {
|
|
393
|
+
if (!f)
|
|
394
|
+
switch (p.key) {
|
|
395
|
+
case "ArrowDown":
|
|
396
|
+
p.preventDefault(), i ? b(
|
|
397
|
+
(v) => v < t.length - 1 ? v + 1 : v
|
|
398
|
+
) : (h(!0), b(0));
|
|
399
|
+
break;
|
|
400
|
+
case "ArrowUp":
|
|
401
|
+
p.preventDefault(), i ? b((v) => v > 0 ? v - 1 : v) : (h(!0), b(t.length - 1));
|
|
402
|
+
break;
|
|
403
|
+
case "Enter":
|
|
404
|
+
case " ":
|
|
405
|
+
p.preventDefault(), i && I >= 0 && t[I] ? (d(t[I].value), h(!1)) : i || (h(!0), b(0));
|
|
406
|
+
break;
|
|
407
|
+
case "Escape":
|
|
408
|
+
p.preventDefault(), h(!1);
|
|
409
|
+
break;
|
|
410
|
+
case "Tab":
|
|
411
|
+
h(!1);
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
}, Z = (p) => {
|
|
415
|
+
d(p), h(!1);
|
|
416
|
+
};
|
|
417
|
+
return /* @__PURE__ */ e("div", { class: N("IncodeDropdownComposed", g), ref: V, children: [
|
|
418
|
+
o && /* @__PURE__ */ e(
|
|
419
|
+
"label",
|
|
420
|
+
{
|
|
421
|
+
class: "IncodeDropdownComposedLabel",
|
|
422
|
+
htmlFor: n,
|
|
423
|
+
"data-testid": `${n}-label`,
|
|
424
|
+
children: [
|
|
425
|
+
o,
|
|
426
|
+
c && /* @__PURE__ */ e("span", { class: "IncodeDropdownComposedRequired", children: " *" })
|
|
427
|
+
]
|
|
428
|
+
}
|
|
429
|
+
),
|
|
430
|
+
/* @__PURE__ */ e("div", { class: "IncodeDropdownComposedWrapper", children: [
|
|
431
|
+
/* @__PURE__ */ e(
|
|
432
|
+
"button",
|
|
433
|
+
{
|
|
434
|
+
type: "button",
|
|
435
|
+
id: n,
|
|
436
|
+
class: "IncodeDropdownComposedTrigger",
|
|
437
|
+
onClick: () => !f && h((p) => !p),
|
|
438
|
+
onKeyDown: D,
|
|
439
|
+
disabled: f,
|
|
440
|
+
"aria-haspopup": "listbox",
|
|
441
|
+
"aria-expanded": i ? "true" : "false",
|
|
442
|
+
"aria-label": o ?? s,
|
|
443
|
+
"aria-describedby": y || void 0,
|
|
444
|
+
"aria-required": c ? "true" : void 0,
|
|
445
|
+
"aria-invalid": r ? "true" : void 0,
|
|
446
|
+
"data-testid": w,
|
|
447
|
+
children: [
|
|
448
|
+
/* @__PURE__ */ e(
|
|
449
|
+
"span",
|
|
450
|
+
{
|
|
451
|
+
class: k ? "IncodeDropdownComposedTriggerText" : "IncodeDropdownComposedTriggerPlaceholder",
|
|
452
|
+
children: k ? k.label : s
|
|
453
|
+
}
|
|
454
|
+
),
|
|
455
|
+
/* @__PURE__ */ e(
|
|
456
|
+
"span",
|
|
457
|
+
{
|
|
458
|
+
class: "IncodeDropdownComposedTriggerIcon",
|
|
459
|
+
"aria-hidden": "true",
|
|
460
|
+
"data-open": i,
|
|
461
|
+
children: /* @__PURE__ */ e(_, {})
|
|
462
|
+
}
|
|
463
|
+
)
|
|
464
|
+
]
|
|
465
|
+
}
|
|
466
|
+
),
|
|
467
|
+
i && /* @__PURE__ */ e(
|
|
468
|
+
"div",
|
|
469
|
+
{
|
|
470
|
+
ref: P,
|
|
471
|
+
class: "IncodeDropdownComposedList",
|
|
472
|
+
role: "listbox",
|
|
473
|
+
"aria-label": o ?? s,
|
|
474
|
+
children: t.map((p, v) => /* @__PURE__ */ e(
|
|
475
|
+
"div",
|
|
476
|
+
{
|
|
477
|
+
role: "option",
|
|
478
|
+
"aria-selected": a === p.value ? "true" : "false",
|
|
479
|
+
class: "IncodeDropdownComposedOption",
|
|
480
|
+
"data-highlighted": I === v,
|
|
481
|
+
onClick: () => Z(p.value),
|
|
482
|
+
onMouseDown: (A) => A.preventDefault(),
|
|
483
|
+
onMouseEnter: () => b(v),
|
|
484
|
+
children: p.label
|
|
485
|
+
},
|
|
486
|
+
p.value
|
|
487
|
+
))
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
] }),
|
|
491
|
+
!m && r && /* @__PURE__ */ e(
|
|
492
|
+
"div",
|
|
493
|
+
{
|
|
494
|
+
class: "IncodeDropdownComposedErrorWrapper",
|
|
495
|
+
"data-testid": `${n}-error-wrapper`,
|
|
496
|
+
children: [
|
|
497
|
+
l && /* @__PURE__ */ e("div", { class: "IncodeDropdownComposedIconWrapper", children: /* @__PURE__ */ e(T, { size: 17 }) }),
|
|
498
|
+
/* @__PURE__ */ e("p", { id: S, class: "IncodeDropdownComposedError", children: r })
|
|
499
|
+
]
|
|
500
|
+
}
|
|
501
|
+
),
|
|
502
|
+
!m && C && !r && /* @__PURE__ */ e(
|
|
503
|
+
"div",
|
|
504
|
+
{
|
|
505
|
+
class: "IncodeDropdownComposedHelperWrapper",
|
|
506
|
+
"data-testid": `${n}-helper-wrapper`,
|
|
507
|
+
children: [
|
|
508
|
+
u && /* @__PURE__ */ e("div", { class: "IncodeDropdownComposedIconWrapper", children: /* @__PURE__ */ e($, { size: 17 }) }),
|
|
509
|
+
/* @__PURE__ */ e("p", { id: H, class: "IncodeDropdownComposedHelper", children: C })
|
|
510
|
+
]
|
|
511
|
+
}
|
|
512
|
+
)
|
|
513
|
+
] });
|
|
514
|
+
}, ae = ({
|
|
515
|
+
form: n,
|
|
516
|
+
isValid: o,
|
|
517
|
+
onFormChange: s,
|
|
518
|
+
onGenerate: a,
|
|
519
|
+
disabled: t = !1,
|
|
520
|
+
labels: d
|
|
521
|
+
}) => {
|
|
522
|
+
const { t: r } = G(), l = { ...{
|
|
523
|
+
firstName: r("curp.labels.firstName") ?? "Your First name",
|
|
524
|
+
firstLast: r("curp.labels.firstLast") ?? "Your First last name",
|
|
525
|
+
secondLast: r("curp.labels.secondLast") ?? "Your Second last name",
|
|
526
|
+
gender: r("curp.labels.genderV2") ?? "Gender",
|
|
527
|
+
genderPlaceholder: r("curp.placeholder.gender") ?? "Choose gender",
|
|
528
|
+
male: r("curp.labels.maleV2") ?? "Male",
|
|
529
|
+
female: r("curp.labels.femaleV2") ?? "Female",
|
|
530
|
+
other: r("curp.labels.other") ?? "Other",
|
|
531
|
+
dob: r("curp.labels.dob") ?? "Date of birth",
|
|
532
|
+
birthState: r("curp.labels.birthState") ?? "State of birth",
|
|
533
|
+
statePlaceholder: r("curp.placeholder.state") ?? "Select state",
|
|
534
|
+
generate: r("curp.generateCta") ?? "Generate CURP"
|
|
535
|
+
}, ...d }, u = (c) => (g) => {
|
|
536
|
+
const w = g.target;
|
|
537
|
+
s({ [c]: w.value });
|
|
538
|
+
}, m = [
|
|
539
|
+
{ value: "H", label: l.male },
|
|
540
|
+
{ value: "M", label: l.female },
|
|
541
|
+
{ value: "X", label: l.other }
|
|
542
|
+
], f = q.map((c) => ({
|
|
543
|
+
value: c.value,
|
|
544
|
+
label: c.label
|
|
545
|
+
}));
|
|
546
|
+
return /* @__PURE__ */ e("div", { class: "IncodeCurpValidation IncodeGenerateCurpForm", children: [
|
|
547
|
+
/* @__PURE__ */ e(
|
|
548
|
+
x,
|
|
549
|
+
{
|
|
550
|
+
id: "curp-first-name",
|
|
551
|
+
label: l.firstName,
|
|
552
|
+
value: n.name,
|
|
553
|
+
onInput: u("name"),
|
|
554
|
+
placeholder: l.firstName,
|
|
555
|
+
disabled: t,
|
|
556
|
+
autoComplete: "given-name"
|
|
557
|
+
}
|
|
558
|
+
),
|
|
559
|
+
/* @__PURE__ */ e(
|
|
560
|
+
x,
|
|
561
|
+
{
|
|
562
|
+
id: "curp-first-last",
|
|
563
|
+
label: l.firstLast,
|
|
564
|
+
value: n.firstLastName,
|
|
565
|
+
onInput: u("firstLastName"),
|
|
566
|
+
placeholder: l.firstLast,
|
|
567
|
+
disabled: t
|
|
568
|
+
}
|
|
569
|
+
),
|
|
570
|
+
/* @__PURE__ */ e(
|
|
571
|
+
x,
|
|
572
|
+
{
|
|
573
|
+
id: "curp-second-last",
|
|
574
|
+
label: l.secondLast,
|
|
575
|
+
value: n.secondLastName,
|
|
576
|
+
onInput: u("secondLastName"),
|
|
577
|
+
placeholder: l.secondLast,
|
|
578
|
+
disabled: t
|
|
579
|
+
}
|
|
580
|
+
),
|
|
581
|
+
/* @__PURE__ */ e(
|
|
582
|
+
M,
|
|
583
|
+
{
|
|
584
|
+
id: "curp-gender",
|
|
585
|
+
label: l.gender,
|
|
586
|
+
placeholder: l.genderPlaceholder,
|
|
587
|
+
value: n.gender,
|
|
588
|
+
options: m,
|
|
589
|
+
disabled: t,
|
|
590
|
+
onChange: (c) => s({ gender: c }),
|
|
591
|
+
"data-testid": "curp-gender"
|
|
592
|
+
}
|
|
593
|
+
),
|
|
594
|
+
/* @__PURE__ */ e(
|
|
595
|
+
O,
|
|
596
|
+
{
|
|
597
|
+
id: "curp-birth-date",
|
|
598
|
+
label: l.dob,
|
|
599
|
+
value: n.birthDate,
|
|
600
|
+
onInput: u("birthDate"),
|
|
601
|
+
max: (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
|
|
602
|
+
placeholder: r("curp.placeholder.dob") ?? "mm/dd/yyyy",
|
|
603
|
+
disabled: t,
|
|
604
|
+
"data-testid": "curp-birth-date"
|
|
605
|
+
}
|
|
606
|
+
),
|
|
607
|
+
/* @__PURE__ */ e(
|
|
608
|
+
M,
|
|
609
|
+
{
|
|
610
|
+
id: "curp-birth-state",
|
|
611
|
+
label: l.birthState,
|
|
612
|
+
placeholder: l.statePlaceholder,
|
|
613
|
+
value: n.birthState,
|
|
614
|
+
options: f,
|
|
615
|
+
disabled: t,
|
|
616
|
+
onChange: (c) => s({ birthState: c }),
|
|
617
|
+
"data-testid": "curp-birth-state"
|
|
618
|
+
}
|
|
619
|
+
),
|
|
620
|
+
/* @__PURE__ */ e(
|
|
621
|
+
E,
|
|
622
|
+
{
|
|
623
|
+
type: "button",
|
|
624
|
+
onClick: a,
|
|
625
|
+
disabled: !o || t,
|
|
626
|
+
"data-testid": "curp-generate",
|
|
627
|
+
children: l.generate
|
|
628
|
+
}
|
|
629
|
+
)
|
|
630
|
+
] });
|
|
631
|
+
}, oe = ({
|
|
632
|
+
config: n,
|
|
633
|
+
onFinish: o,
|
|
634
|
+
onError: s
|
|
635
|
+
}) => {
|
|
636
|
+
const { t: a } = G(), [t, d] = Y(() => {
|
|
637
|
+
if (!n)
|
|
638
|
+
throw new Error("CURP validation config is required");
|
|
639
|
+
return K({ config: n });
|
|
640
|
+
});
|
|
641
|
+
if (t.status === "idle" || t.status === "loading" || t.status === "verifying" || t.status === "generating") {
|
|
642
|
+
const r = t.status === "generating" ? a("curp.status.generating") ?? "Generating..." : a("curp.status.verifying") ?? "Verifying...";
|
|
643
|
+
return /* @__PURE__ */ e(R, { className: "IncodeCurpValidationPage", children: /* @__PURE__ */ e("div", { class: "IncodeCurpValidation IncodeCurpLoading", children: /* @__PURE__ */ e(J, { title: r, fullScreen: !1 }) }) });
|
|
644
|
+
}
|
|
645
|
+
if (t.status === "enterCurp")
|
|
646
|
+
return /* @__PURE__ */ e(
|
|
647
|
+
R,
|
|
648
|
+
{
|
|
649
|
+
className: "IncodeCurpValidationPage",
|
|
650
|
+
title: a("curp.enterCurp") ?? "Enter your CURP",
|
|
651
|
+
children: /* @__PURE__ */ e(
|
|
652
|
+
re,
|
|
653
|
+
{
|
|
654
|
+
curp: t.curp,
|
|
655
|
+
isValid: t.isValid,
|
|
656
|
+
onCurpChange: (r) => d.setCurp(r),
|
|
657
|
+
onVerify: () => d.verify(),
|
|
658
|
+
onSwitchToGenerate: () => d.switchToGenerate(),
|
|
659
|
+
placeholder: a("curp.placeholder.curp") ?? "CURP",
|
|
660
|
+
continueLabel: a("curp.continue") ?? "Continue",
|
|
661
|
+
dontHaveLabel: a("curp.dontHave") ?? "I don't have my CURP"
|
|
662
|
+
}
|
|
663
|
+
)
|
|
664
|
+
}
|
|
665
|
+
);
|
|
666
|
+
if (t.status === "generateCurp")
|
|
667
|
+
return /* @__PURE__ */ e(
|
|
668
|
+
R,
|
|
669
|
+
{
|
|
670
|
+
className: "IncodeCurpValidationPage",
|
|
671
|
+
title: a("curp.generate") ?? "Generate your CURP",
|
|
672
|
+
children: /* @__PURE__ */ e(
|
|
673
|
+
ae,
|
|
674
|
+
{
|
|
675
|
+
form: t.form,
|
|
676
|
+
isValid: t.isValid,
|
|
677
|
+
onFormChange: (r) => d.setGenerateForm(r),
|
|
678
|
+
onGenerate: () => d.generate()
|
|
679
|
+
}
|
|
680
|
+
)
|
|
681
|
+
}
|
|
682
|
+
);
|
|
683
|
+
if (t.status === "confirmCurp")
|
|
684
|
+
return /* @__PURE__ */ e(
|
|
685
|
+
R,
|
|
686
|
+
{
|
|
687
|
+
className: "IncodeCurpValidationPage",
|
|
688
|
+
title: a("curp.status.confirm") ?? "Confirm your CURP",
|
|
689
|
+
children: /* @__PURE__ */ e("div", { class: "IncodeCurpValidation IncodeCurpConfirm", children: [
|
|
690
|
+
/* @__PURE__ */ e(
|
|
691
|
+
"input",
|
|
692
|
+
{
|
|
693
|
+
type: "text",
|
|
694
|
+
class: "IncodeCurpConfirmInput",
|
|
695
|
+
value: t.curp,
|
|
696
|
+
readOnly: !0,
|
|
697
|
+
"aria-label": a("curp.status.generatedCurp") ?? "Generated CURP"
|
|
698
|
+
}
|
|
699
|
+
),
|
|
700
|
+
/* @__PURE__ */ e(L, {}),
|
|
701
|
+
/* @__PURE__ */ e(
|
|
702
|
+
E,
|
|
703
|
+
{
|
|
704
|
+
type: "button",
|
|
705
|
+
onClick: () => d.confirmGenerated(),
|
|
706
|
+
"data-testid": "curp-confirm",
|
|
707
|
+
children: a("curp.continue") ?? "Continue"
|
|
708
|
+
}
|
|
709
|
+
)
|
|
710
|
+
] })
|
|
711
|
+
}
|
|
712
|
+
);
|
|
713
|
+
if (t.status === "success")
|
|
714
|
+
return /* @__PURE__ */ e(R, { className: "IncodeCurpValidationPage", children: /* @__PURE__ */ e("div", { class: "IncodeCurpValidation IncodeCurpSuccess", children: [
|
|
715
|
+
/* @__PURE__ */ e($, { size: 32 }),
|
|
716
|
+
/* @__PURE__ */ e(L, { size: 16 }),
|
|
717
|
+
/* @__PURE__ */ e("h2", { class: "IncodeCurpSuccessTitle", children: a("curp.status.verified") ?? "Verified" })
|
|
718
|
+
] }) });
|
|
719
|
+
if (t.status === "failure" || t.status === "generateError") {
|
|
720
|
+
const r = t.retriesLeft > 0, C = t.status === "failure" ? a("curp.status.notVerified") ?? "Not verified" : a("curp.status.couldntGenerate") ?? "Couldn't generate CURP";
|
|
721
|
+
return /* @__PURE__ */ e(R, { className: "IncodeCurpValidationPage", children: /* @__PURE__ */ e("div", { class: "IncodeCurpValidation IncodeCurpFailure", children: [
|
|
722
|
+
/* @__PURE__ */ e(L, {}),
|
|
723
|
+
/* @__PURE__ */ e(T, { size: 32 }),
|
|
724
|
+
/* @__PURE__ */ e(L, { size: 16 }),
|
|
725
|
+
/* @__PURE__ */ e("h2", { class: "IncodeCurpFailureTitle", children: C }),
|
|
726
|
+
t.status === "generateError" && r && /* @__PURE__ */ e(z, { children: [
|
|
727
|
+
/* @__PURE__ */ e(L, { size: 12 }),
|
|
728
|
+
/* @__PURE__ */ e("p", { class: "IncodeCurpFailureHint", children: a("curp.status.checkInfo") ?? "Please check your information" })
|
|
729
|
+
] }),
|
|
730
|
+
/* @__PURE__ */ e(L, {}),
|
|
731
|
+
r && /* @__PURE__ */ e(z, { children: /* @__PURE__ */ e(
|
|
732
|
+
E,
|
|
733
|
+
{
|
|
734
|
+
type: "button",
|
|
735
|
+
onClick: () => d.retry(),
|
|
736
|
+
"data-testid": "curp-retry",
|
|
737
|
+
children: t.status === "failure" ? a("curp.status.tryAgain") ?? "Try again" : a("curp.status.edit") ?? "Edit information"
|
|
738
|
+
}
|
|
739
|
+
) })
|
|
740
|
+
] }) });
|
|
741
|
+
}
|
|
742
|
+
return t.status === "finished" ? (o?.(), null) : (t.status === "closed" && s?.(void 0), null);
|
|
743
|
+
}, le = ({
|
|
744
|
+
config: n,
|
|
745
|
+
onFinish: o,
|
|
746
|
+
onError: s
|
|
747
|
+
}) => /* @__PURE__ */ e(Q, { children: n ? /* @__PURE__ */ e(
|
|
748
|
+
oe,
|
|
749
|
+
{
|
|
750
|
+
config: n,
|
|
751
|
+
onFinish: o,
|
|
752
|
+
onError: s
|
|
753
|
+
}
|
|
754
|
+
) : null });
|
|
755
|
+
j(le, "incode-curp-validation");
|
|
756
|
+
export {
|
|
757
|
+
le as CurpValidation
|
|
758
|
+
};
|