@incodetech/web 2.0.1 → 2.1.0-rc.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.
- package/dist/ae-signature/ae-signature.es.js +15 -13
- package/dist/ae-signature/styles.css +3 -17
- package/dist/ae-signature/styles2.css +15 -5
- package/dist/aligndevicelottie-DY_bX_p8.js +12769 -0
- package/dist/antifraud/antifraud.es.js +23 -16
- package/dist/authentication/authentication.es.js +42 -27
- package/dist/autoFocusTitle-BzkUiELM.js +29 -0
- package/dist/{back-horizontal-hint-B8Brxh3U.js → back-horizontal-hint-D_8LptLm.js} +26 -26
- package/dist/back-tutorial-vb1MxlrT.js +14597 -0
- package/dist/{back-vertical-hint-BBo36dxn.js → back-vertical-hint-C1evxxq2.js} +27 -27
- package/dist/backdevicelottie-HypPqBz7.js +16690 -0
- package/dist/base.css +1258 -104
- package/dist/blurdevicelottie-CBXtBFiJ.js +15951 -0
- package/dist/bottomSheet-F1GJfQx_.js +39 -0
- package/dist/browser-ponyfill-CLLvZCVg.js +441 -0
- package/dist/button-CM_hgyIP.js +35 -0
- package/dist/checkbox-BoeLHKgp.js +96 -0
- package/dist/consent/consent.es.js +89 -73
- package/dist/consent/styles.css +35 -22
- package/dist/countrySelector-mSWyHSy4.js +60 -0
- package/dist/cpf-ocr/cpf-ocr.es.js +2 -0
- package/dist/cpfOcr-MtpRztkG.js +92 -0
- package/dist/cpfOcr-jJkYCfsX.js +2 -0
- package/dist/cross-document-data-match/cross-document-data-match.es.js +20 -16
- package/dist/curp-validation/curp-validation.es.js +247 -203
- package/dist/customFields-DXXt9HGM.js +140 -0
- package/dist/customWatchlist-DsW04UF6.js +36 -0
- package/dist/dateInputComposed-C_mh4XBg.js +69 -0
- package/dist/dateInputComposed-Cy6a7ymh.js +1 -0
- package/dist/defineProperty-mefzVtTv.js +39 -0
- package/dist/document-capture/document-capture.es.js +2 -0
- package/dist/document-capture/styles.css +2 -5
- package/dist/documentCapture-8ypBJehw.js +2 -0
- package/dist/documentCapture-BDV_921m.js +880 -0
- package/dist/dropdownComposed-CEWBSdGl.js +1 -0
- package/dist/dropdownComposed-_fgAlo_C.js +380 -0
- package/dist/dynamic-forms/styles.css +25 -13
- package/dist/dynamicForms-DyfnsS7E.js +352 -0
- package/dist/ekyb/ekyb.es.js +2 -2
- package/dist/ekyb/styles.css +2 -0
- package/dist/ekybModule-CIPGmCvD.js +279 -0
- package/dist/ekybModule-DFoYpheB.js +2 -0
- package/dist/ekyc/ekyc.es.js +2 -2
- package/dist/ekyc/styles.css +9 -7
- package/dist/ekycModule-BGzwgjl1.js +2 -0
- package/dist/ekycModule-BuTaC5ct.js +257 -0
- package/dist/electronic-signature/electronic-signature.es.js +2 -2
- package/dist/electronic-signature-B-Q7M0wK.js +430 -0
- package/dist/email/email.es.js +199 -66
- package/dist/emailInput-KZmhjOdZ.js +39 -0
- package/dist/errorIcon-DJRZpd8j.js +26 -0
- package/dist/expiredId-Q1t6aVpk.js +85 -0
- package/dist/extensibility-Cs3KQQdC.js +3070 -0
- package/dist/extensibility.es.js +26 -25
- package/dist/face-match/face-match.es.js +2 -2
- package/dist/face-match/styles.css +0 -4
- package/dist/faceMatch--RDHJe4t.js +343 -0
- package/dist/faceMatch-yEKPYaym.js +2 -0
- package/dist/field-comparison/field-comparison.es.js +2 -0
- package/dist/field-comparison/styles.css +16 -0
- package/dist/fieldComparison-CAF86bTC.js +88 -0
- package/dist/fieldComparison-D0an7T_g.js +2 -0
- package/dist/fiscal-qr/fiscal-qr.es.js +224 -0
- package/dist/fiscal-qr/styles.css +71 -0
- package/dist/{flip-animation-CgwRsEmK.js → flip-animation-BGRvygw9.js} +4221 -4221
- package/dist/flow/flow.es.js +619 -484
- package/dist/flow/styles.css +378 -418
- package/dist/{front-horizontal-hint-DGGGi8e1.js → front-horizontal-hint-Uf5bHCsd.js} +70 -70
- package/dist/{front-vertical-hint-CNr5mE6Q.js → front-vertical-hint-DdWNA45v.js} +81 -81
- package/dist/frontdevicelottie-CLqitJhG.js +17314 -0
- package/dist/geolocation/geolocation.es.js +486 -395
- package/dist/glaredevicelottie-BS04U6Fc.js +14478 -0
- package/dist/governmentValidation/governmentValidation.es.js +166 -93
- package/dist/governmentValidation/styles.css +0 -17
- package/dist/homeScreen-BZnIEDrV.js +264 -0
- package/dist/hooks-Da_yP_Dr.js +149 -0
- package/dist/i18n-CoCO2ZuN.js +2971 -0
- package/dist/icons-Dbs9ZfYM.js +360 -0
- package/dist/id/id.es.js +583 -414
- package/dist/id/styles.css +59 -43
- package/dist/id-laser-h-DX8UbVNH.js +467 -0
- package/dist/id-laser-v-DhnHdjlB.js +490 -0
- package/dist/id-tutorial-lj4iKtYT.js +13165 -0
- package/dist/id-verification/id-verification.es.js +21 -17
- package/dist/idOcr-CjGbb4dB.js +123 -0
- package/dist/identity-reuse/identity-reuse.es.js +311 -182
- package/dist/identity-reuse/styles.css +134 -80
- package/dist/incode-logo-57XFniXU.js +4 -0
- package/dist/incodeComponent-wfnHlnXx.js +63 -0
- package/dist/incodeModule-BUDoTwT9.js +13 -0
- package/dist/index.es.js +16 -13
- package/dist/inputComposed-BEn7_nZd.js +1 -0
- package/dist/inputComposed-CQ4AsvZg.js +99 -0
- package/dist/loadingIcon-B0ysgiNq.js +148 -0
- package/dist/lottie_light-Dp9Bz3mf.js +9031 -0
- package/dist/mandatoryConsent-r0PQHmv-.js +107 -0
- package/dist/modal-nTSaG7nB.js +139 -0
- package/dist/modal.hooks-D2xhIuHA.js +195 -0
- package/dist/numberedStep-CEtwZqLp.js +13 -0
- package/dist/optionAccessibleLabel-CnA-mNAU.js +202 -0
- package/dist/otpInput-_JmtVwa0.js +195 -0
- package/dist/page-DxGQj7Gk.js +71 -0
- package/dist/{passport-horizontal-hint-Bgquwtac.js → passport-horizontal-hint-Bbm2mvSn.js} +55 -55
- package/dist/{passport-tutorial-DwRwtPVX.js → passport-tutorial-zT1ZoA-D.js} +7096 -7084
- package/dist/{passport-vertical-hint-BT1D5BrW.js → passport-vertical-hint-DJbCtBiM.js} +49 -49
- package/dist/pdf-BZA70WbM.js +22398 -0
- package/dist/pdfViewer-BK-yVIve.js +114 -0
- package/dist/phone/phone.es.js +214 -70
- package/dist/phoneInputComposed-DjNdsmPE.js +12142 -0
- package/dist/processing-BM-wT-1W.js +8 -0
- package/dist/qe-signature/qe-signature.es.js +15 -13
- package/dist/radioGroupComposed-BNuaopVr.js +215 -0
- package/dist/redirect-to-mobile/redirect-to-mobile.es.js +2774 -0
- package/dist/redirect-to-mobile/styles.css +19 -269
- package/dist/registerIncodeElement-77NGCDsy.js +11 -0
- package/dist/requiredLabelHint-DEadtiwx.js +17 -0
- package/dist/richText-Cf9aMOCk.js +3153 -0
- package/dist/rolldown-runtime--E5BIlTp.js +33 -0
- package/dist/selfie/selfie.es.js +54 -37
- package/dist/selfie/styles.css +0 -4
- package/dist/selfieTutorial-CtruLyO2.js +2689 -0
- package/dist/signature/signature.es.js +778 -405
- package/dist/snackbar-CxepGC3e.js +16 -0
- package/dist/spinner-B6RxGFrI.js +1 -0
- package/dist/spinner-D8a_2LvW.js +42 -0
- package/dist/statusPage-DMYPUwRZ.js +28 -0
- package/dist/successIcon-BAyDPT7I.js +30 -0
- package/dist/tabs-C8npVBbk.js +103 -0
- package/dist/themes/dark.css +5 -0
- package/dist/themes/light.css +4 -0
- package/dist/transitionSpinner-DRRz-NV8.js +26 -0
- package/dist/{tutorial-9vHAHvMK.js → tutorial-D1qaY2Tm.js} +1105 -856
- package/dist/types/ae-signature.d.ts +4 -1
- package/dist/types/antifraud.d.ts +9 -3
- package/dist/types/authentication.d.ts +4 -1
- package/dist/types/consent.d.ts +4 -1
- package/dist/types/cpf-ocr.d.ts +12 -0
- package/dist/types/cross-document-data-match.d.ts +4 -1
- package/dist/types/curp-validation.d.ts +9 -3
- package/dist/types/document-capture.d.ts +37 -0
- package/dist/types/ekyb.d.ts +4 -1
- package/dist/types/ekyc.d.ts +4 -1
- package/dist/types/electronic-signature.d.ts +4 -1
- package/dist/types/email.d.ts +4 -1
- package/dist/types/extensibility.d.ts +40 -15
- package/dist/types/face-match.d.ts +4 -1
- package/dist/types/field-comparison.d.ts +38 -0
- package/dist/types/fiscal-qr.d.ts +43 -0
- package/dist/types/flow.d.ts +5 -2
- package/dist/types/geolocation.d.ts +4 -1
- package/dist/types/governmentValidation.d.ts +4 -1
- package/dist/types/id-verification.d.ts +4 -1
- package/dist/types/id.d.ts +4 -1
- package/dist/types/identity-reuse.d.ts +4 -1
- package/dist/types/index.d.ts +20 -2
- package/dist/types/phone.d.ts +4 -1
- package/dist/types/qe-signature.d.ts +4 -1
- package/dist/types/redirect-to-mobile.d.ts +17 -0
- package/dist/types/selfie.d.ts +4 -1
- package/dist/types/signature.d.ts +4 -1
- package/dist/types/watchlist.d.ts +4 -1
- package/dist/types/workflow.d.ts +55 -11
- package/dist/typography-YLgHHuao.js +45 -0
- package/dist/uiConfig-D2_wawvr.js +25 -0
- package/dist/useModuleLoader-CeJ2jL25.js +672 -0
- package/dist/vendor-preact-DThS2ZQ_.js +955 -0
- package/dist/verificationResult-Do5SpZ6X.js +64 -0
- package/dist/verifiedByIncode-DjXOdCml.js +103 -0
- package/dist/watchlist/watchlist.es.js +31 -28
- package/dist/watchlistForBusiness-BFFXC9d-.js +80 -0
- package/dist/workflow/styles.css +449 -427
- package/dist/workflow/workflow.es.js +268 -182
- package/package.json +32 -10
- package/dist/aligndevicelottie-DoV8xKjh.js +0 -12757
- package/dist/autoFocusTitle-QexamZ4i.js +0 -16
- package/dist/back-tutorial-1NOQobGO.js +0 -14585
- package/dist/backdevicelottie-C_ceuqY7.js +0 -16678
- package/dist/blurdevicelottie-UO14Y0WC.js +0 -15939
- package/dist/bottomSheet-DE_8TFEC.js +0 -31
- package/dist/browser-ponyfill-jOkuz57z.js +0 -299
- package/dist/button-DcCUEn2n.js +0 -24
- package/dist/checkbox-Cl57ltq_.js +0 -85
- package/dist/countrySelector-CE-JgIsv.js +0 -58
- package/dist/cpfOcr-D_tbwbvh.js +0 -78
- package/dist/customFields-CW38fQUv.js +0 -127
- package/dist/customWatchlist-D9_yjEQd.js +0 -33
- package/dist/dateInputComposed-BpAGsjN6.js +0 -55
- package/dist/dateInputComposed-DU3o6PAV.js +0 -1
- package/dist/defineProperty-Dh8nSJpJ.js +0 -39
- package/dist/documentCapture-xX-JT7ZY.js +0 -763
- package/dist/dropdownComposed-DFRBG22E.js +0 -284
- package/dist/dropdownComposed-DwTzc2YU.js +0 -1
- package/dist/dynamicForms-CJP1Ia6Q.js +0 -262
- package/dist/ekybModule-BSs7mndb.js +0 -280
- package/dist/ekybModule-D9M3E2Gm.js +0 -2
- package/dist/ekycModule-CU9pt5YN.js +0 -246
- package/dist/ekycModule-CZw9cLno.js +0 -2
- package/dist/electronic-signature-COYXjGdd.js +0 -410
- package/dist/emailInput-DppGf9pv.js +0 -37
- package/dist/expiredId-BnmzE8T3.js +0 -70
- package/dist/extensibility-CzEJfRwo.js +0 -2586
- package/dist/faceMatch-B8j0g0Yo.js +0 -2
- package/dist/faceMatch-BV8UD7tj.js +0 -201
- package/dist/frontdevicelottie-Bu6f9fDE.js +0 -17302
- package/dist/glaredevicelottie-B10axYs_.js +0 -14466
- package/dist/homeScreen-DnP1jw9A.js +0 -227
- package/dist/hooks-BVnGysT7.js +0 -80
- package/dist/i18n-9s4OSqwi.js +0 -2010
- package/dist/icons-Cc7zwchP.js +0 -310
- package/dist/id-laser-h-mBAzHVOK.js +0 -467
- package/dist/id-laser-v-CrFg4bcJ.js +0 -483
- package/dist/id-tutorial-BCr42Pnn.js +0 -13153
- package/dist/idOcr-CCjfWQvH.js +0 -94
- package/dist/incode-logo-DX016usY.js +0 -4
- package/dist/incodeComponent-C1o4M0ZK.js +0 -50
- package/dist/incodeModule-BqCjVgEI.js +0 -18
- package/dist/inputComposed-APSw8C7o.js +0 -89
- package/dist/inputComposed-XYrarFxS.js +0 -1
- package/dist/loadingIcon-BN5YRQUb.js +0 -104
- package/dist/mandatoryConsent-DssKMC3v.js +0 -100
- package/dist/modal-NMxsQHAO.js +0 -135
- package/dist/modal.hooks-CAjcIFZK.js +0 -126
- package/dist/numberedStep-CT-alrK5.js +0 -11
- package/dist/optionAccessibleLabel-CzEeX3Q4.js +0 -140
- package/dist/otpInput-DqRA_egd.js +0 -145
- package/dist/page-C1yT4DLb.js +0 -69
- package/dist/pdf-BurGZ08w.js +0 -14967
- package/dist/pdfViewer-BGBNL1Ea.js +0 -63
- package/dist/phoneInputComposed-bvWhGLFZ.js +0 -11206
- package/dist/processing-G_y3o32b.js +0 -6
- package/dist/radioGroupComposed-BbmvxmD2.js +0 -177
- package/dist/redirectToMobile-C3k1gloW.js +0 -1514
- package/dist/requiredLabelHint-BLwgqozE.js +0 -13
- package/dist/richText-DbJ5sl2n.js +0 -1973
- package/dist/rolldown-runtime-CYMK-g2i.js +0 -20
- package/dist/selfieTutorial-BgrlUMXP.js +0 -2677
- package/dist/snackbar-BDp8x7Cv.js +0 -14
- package/dist/spinner-B4dcie2T.js +0 -1
- package/dist/spinner-CKnjVHxw.js +0 -39
- package/dist/statusPage-CUI7ApcU.js +0 -28
- package/dist/successIcon-DbILeIz_.js +0 -28
- package/dist/tabs-DaPyP71c.js +0 -78
- package/dist/transitionSpinner-PIEPU2Vx.js +0 -17
- package/dist/types/cpf-ocr/styles.d.ts +0 -1
- package/dist/types/document-capture/styles.d.ts +0 -1
- package/dist/types/redirect-to-mobile/styles.d.ts +0 -1
- package/dist/typography-CxjaknHN.js +0 -28
- package/dist/uiConfig-CwpQ-IM6.js +0 -20
- package/dist/useModuleLoader-BFiVA41N.js +0 -432
- package/dist/vendor-preact-D6SntenC.js +0 -958
- package/dist/verificationResult-BrVbUJ4U.js +0 -97
- package/dist/verifiedByIncode-ChZBpqNy.js +0 -101
- package/dist/watchlistForBusiness-BcSNtHCV.js +0 -77
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { n as useTranslation } from "./i18n-CoCO2ZuN.js";
|
|
2
|
+
import { _ as y, l as A, v as u } from "./vendor-preact-DThS2ZQ_.js";
|
|
3
|
+
import { a as isTerminalModuleState, c as useManager, o as useModuleTerminalCallbacks } from "./hooks-Da_yP_Dr.js";
|
|
4
|
+
import { t as IncodeComponent } from "./incodeComponent-wfnHlnXx.js";
|
|
5
|
+
import { t as Page } from "./page-DxGQj7Gk.js";
|
|
6
|
+
import { t as TransitionSpinner } from "./transitionSpinner-DRRz-NV8.js";
|
|
7
|
+
import { t as Button } from "./button-CM_hgyIP.js";
|
|
8
|
+
import { t as Checkbox } from "./checkbox-BoeLHKgp.js";
|
|
9
|
+
import { t as registerIncodeModuleElement } from "./incodeModule-BUDoTwT9.js";
|
|
10
|
+
import { t as RichText } from "./richText-Cf9aMOCk.js";
|
|
11
|
+
import { createMandatoryConsentManager } from "@incodetech/core/mandatory-consent";
|
|
12
|
+
//#region src/modules/mandatory-consent/mandatoryConsent.tsx
|
|
13
|
+
var stopLinkPropagation = (event) => {
|
|
14
|
+
if (event.target.closest("a")) event.stopPropagation();
|
|
15
|
+
};
|
|
16
|
+
var MandatoryConsentContent = ({ config, manager: externalManager, onFinish, onError }) => {
|
|
17
|
+
const { t, i18n } = useTranslation();
|
|
18
|
+
const titleRef = A(null);
|
|
19
|
+
const [state, manager] = useManager(() => {
|
|
20
|
+
if (externalManager) return externalManager;
|
|
21
|
+
if (!config) throw new Error("MandatoryConsent config is required when no manager is provided");
|
|
22
|
+
return createMandatoryConsentManager({ config: {
|
|
23
|
+
...config,
|
|
24
|
+
language: i18n.language
|
|
25
|
+
} });
|
|
26
|
+
}, { manageLifecycle: !externalManager });
|
|
27
|
+
y(() => {
|
|
28
|
+
if (state.status === "display") titleRef.current?.focus();
|
|
29
|
+
}, [state.status]);
|
|
30
|
+
useModuleTerminalCallbacks({
|
|
31
|
+
status: state.status,
|
|
32
|
+
onFinish,
|
|
33
|
+
onError,
|
|
34
|
+
error: state.status === "error" ? state.error : void 0
|
|
35
|
+
});
|
|
36
|
+
if (isTerminalModuleState(state)) return null;
|
|
37
|
+
if (state.status === "idle" || state.status === "loading") return /* @__PURE__ */ u(TransitionSpinner, { hideText: true });
|
|
38
|
+
const consentBody = state.text.split("\n").filter((line) => line.trim().length > 0).join(" ");
|
|
39
|
+
const isMandatoryConsent = (config?.type ?? "MANDATORY") === "MANDATORY";
|
|
40
|
+
return /* @__PURE__ */ u(Page, {
|
|
41
|
+
className: "IncodeConsentPage",
|
|
42
|
+
title: state.title,
|
|
43
|
+
children: /* @__PURE__ */ u("div", {
|
|
44
|
+
class: "IncodeConsentContent",
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ u("div", {
|
|
47
|
+
class: "IncodeConsentBody",
|
|
48
|
+
children: [/* @__PURE__ */ u("p", {
|
|
49
|
+
class: "IncodeConsentSubtitle",
|
|
50
|
+
children: t("biometricConsent.subtitle")
|
|
51
|
+
}), /* @__PURE__ */ u("div", {
|
|
52
|
+
class: "IncodeConsentCheckboxList",
|
|
53
|
+
children: /* @__PURE__ */ u(Checkbox, {
|
|
54
|
+
id: "mandatory-consent-checkbox",
|
|
55
|
+
class: "IncodeConsentCheckbox",
|
|
56
|
+
checked: state.isSigned,
|
|
57
|
+
required: true,
|
|
58
|
+
onChange: () => manager.toggle(),
|
|
59
|
+
label: /* @__PURE__ */ u("span", {
|
|
60
|
+
class: "IncodeConsentCheckboxLabel",
|
|
61
|
+
role: "presentation",
|
|
62
|
+
onClick: stopLinkPropagation,
|
|
63
|
+
onKeyDown: stopLinkPropagation,
|
|
64
|
+
children: /* @__PURE__ */ u(RichText, {
|
|
65
|
+
content: consentBody,
|
|
66
|
+
class: "IncodeRichText"
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
})]
|
|
71
|
+
}),
|
|
72
|
+
state.status === "display" && state.error ? /* @__PURE__ */ u("p", {
|
|
73
|
+
class: "IncodeConsentSubmitError",
|
|
74
|
+
"data-testid": "mandatory-consent-submit-error",
|
|
75
|
+
role: "alert",
|
|
76
|
+
children: state.error
|
|
77
|
+
}) : null,
|
|
78
|
+
/* @__PURE__ */ u("div", {
|
|
79
|
+
class: "IncodeConsentActions",
|
|
80
|
+
children: [/* @__PURE__ */ u(Button, {
|
|
81
|
+
"data-testid": "mandatory-consent-submit",
|
|
82
|
+
class: !isMandatoryConsent ? "IncodeConsentButton" : void 0,
|
|
83
|
+
onClick: () => manager.submit(),
|
|
84
|
+
disabled: !state.canSubmit,
|
|
85
|
+
isLoading: state.status === "submitting",
|
|
86
|
+
children: t("biometricConsent.button.continue")
|
|
87
|
+
}), isMandatoryConsent && /* @__PURE__ */ u(Button, {
|
|
88
|
+
variant: "link",
|
|
89
|
+
onClick: () => manager.cancel(),
|
|
90
|
+
children: t("biometricConsent.button.cancel")
|
|
91
|
+
})]
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
})
|
|
95
|
+
}, "ready");
|
|
96
|
+
};
|
|
97
|
+
var MandatoryConsent = ({ config, manager, onFinish, onError }) => {
|
|
98
|
+
return /* @__PURE__ */ u(IncodeComponent, { children: config || manager ? /* @__PURE__ */ u(MandatoryConsentContent, {
|
|
99
|
+
config,
|
|
100
|
+
manager,
|
|
101
|
+
onFinish,
|
|
102
|
+
onError
|
|
103
|
+
}) : null });
|
|
104
|
+
};
|
|
105
|
+
registerIncodeModuleElement(MandatoryConsent, "incode-mandatory-consent");
|
|
106
|
+
//#endregion
|
|
107
|
+
export { MandatoryConsent };
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { b as Q, d as T, f as _, g as x, h as q, l as A, p as d, r as $, v as u } from "./vendor-preact-DThS2ZQ_.js";
|
|
2
|
+
import { n as cn } from "./loadingIcon-B0ysgiNq.js";
|
|
3
|
+
import { o as CloseIcon } from "./icons-Dbs9ZfYM.js";
|
|
4
|
+
import { a as useModalPortalTarget, i as useModalFocusCapture, n as useModalBodyScrollLock, o as useModalTabCycle, r as useModalEscapeDismiss, t as MODAL_TITLE_ID } from "./modal.hooks-D2xhIuHA.js";
|
|
5
|
+
//#region src/shared/modal/modal.tsx
|
|
6
|
+
var ModalContext = Q(null);
|
|
7
|
+
function useModalContext() {
|
|
8
|
+
const ctx = x(ModalContext);
|
|
9
|
+
if (!ctx) throw new Error("Modal compound components must be used within Modal.Root");
|
|
10
|
+
return ctx;
|
|
11
|
+
}
|
|
12
|
+
function ModalRoot({ open, children, onOpenChange, dismissible = true, portalContainer, class: className, hasBackdrop = true, manageInitialFocus = true, returnFocusRef }) {
|
|
13
|
+
const portalTarget = useModalPortalTarget(open, portalContainer ?? void 0);
|
|
14
|
+
const [hasDescription, setHasDescription] = d(false);
|
|
15
|
+
const dialogRef = A(null);
|
|
16
|
+
const requestClose = q(() => {
|
|
17
|
+
if (!dismissible) return;
|
|
18
|
+
onOpenChange?.(false);
|
|
19
|
+
}, [dismissible, onOpenChange]);
|
|
20
|
+
const contextValue = T(() => ({
|
|
21
|
+
setHasDescription,
|
|
22
|
+
dismissible,
|
|
23
|
+
requestClose
|
|
24
|
+
}), [dismissible, requestClose]);
|
|
25
|
+
const dialogActive = open && Boolean(portalTarget);
|
|
26
|
+
useModalBodyScrollLock(open);
|
|
27
|
+
useModalEscapeDismiss(open, dismissible, requestClose);
|
|
28
|
+
useModalFocusCapture(dialogActive, dialogRef, manageInitialFocus, returnFocusRef);
|
|
29
|
+
useModalTabCycle(dialogActive, dialogRef);
|
|
30
|
+
if (!portalTarget || !open) return null;
|
|
31
|
+
return $(/* @__PURE__ */ u(ModalContext.Provider, {
|
|
32
|
+
value: contextValue,
|
|
33
|
+
children: /* @__PURE__ */ u("div", {
|
|
34
|
+
class: cn("IncodeModalRoot", className),
|
|
35
|
+
"data-incode-modal": "",
|
|
36
|
+
children: [hasBackdrop && /* @__PURE__ */ u("div", {
|
|
37
|
+
class: "IncodeModalBackdrop",
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
onMouseDown: () => {
|
|
40
|
+
requestClose();
|
|
41
|
+
}
|
|
42
|
+
}), /* @__PURE__ */ u("div", {
|
|
43
|
+
ref: dialogRef,
|
|
44
|
+
class: "IncodeModalDialog",
|
|
45
|
+
role: "dialog",
|
|
46
|
+
"aria-modal": "true",
|
|
47
|
+
"aria-labelledby": MODAL_TITLE_ID,
|
|
48
|
+
"aria-describedby": hasDescription ? "incode-modal-description" : void 0,
|
|
49
|
+
tabIndex: -1,
|
|
50
|
+
onMouseDown: (event) => {
|
|
51
|
+
event.stopPropagation();
|
|
52
|
+
},
|
|
53
|
+
children
|
|
54
|
+
})]
|
|
55
|
+
})
|
|
56
|
+
}), portalTarget);
|
|
57
|
+
}
|
|
58
|
+
function ModalContent({ children, class: className }) {
|
|
59
|
+
return /* @__PURE__ */ u("div", {
|
|
60
|
+
class: cn("IncodeModalContent", className),
|
|
61
|
+
children
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function ModalClose({ "aria-label": ariaLabel = "Close", title: titleAttr = "Close", class: className, onClick }) {
|
|
65
|
+
const { dismissible, requestClose } = useModalContext();
|
|
66
|
+
if (!dismissible) return null;
|
|
67
|
+
const handleClose = async () => {
|
|
68
|
+
if (onClick) await onClick();
|
|
69
|
+
requestClose();
|
|
70
|
+
};
|
|
71
|
+
return /* @__PURE__ */ u("button", {
|
|
72
|
+
type: "button",
|
|
73
|
+
class: cn("IncodeModalClose", className),
|
|
74
|
+
"aria-label": ariaLabel,
|
|
75
|
+
title: titleAttr,
|
|
76
|
+
onClick: handleClose,
|
|
77
|
+
children: /* @__PURE__ */ u(CloseIcon, {
|
|
78
|
+
height: 32,
|
|
79
|
+
width: 32,
|
|
80
|
+
fillColor: "var(--icon-neutral-300)"
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function ModalIcon({ children, class: className }) {
|
|
85
|
+
return /* @__PURE__ */ u("div", {
|
|
86
|
+
class: cn("IncodeModalIcon", className),
|
|
87
|
+
children
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
function ModalTitleSection({ children, align = "center" }) {
|
|
91
|
+
const className = {
|
|
92
|
+
center: "IncodeModalTitleSectionCenter",
|
|
93
|
+
left: "IncodeModalTitleSectionLeft"
|
|
94
|
+
}[align];
|
|
95
|
+
return /* @__PURE__ */ u("div", {
|
|
96
|
+
class: className,
|
|
97
|
+
children
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function ModalTitle({ children, ref, class: className }) {
|
|
101
|
+
return /* @__PURE__ */ u("h2", {
|
|
102
|
+
id: MODAL_TITLE_ID,
|
|
103
|
+
ref,
|
|
104
|
+
tabIndex: -1,
|
|
105
|
+
className: cn("IncodeModalTitle", className),
|
|
106
|
+
children
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function ModalSubtitle({ children, class: className }) {
|
|
110
|
+
const { setHasDescription } = useModalContext();
|
|
111
|
+
_(() => {
|
|
112
|
+
setHasDescription(true);
|
|
113
|
+
return () => setHasDescription(false);
|
|
114
|
+
}, [setHasDescription]);
|
|
115
|
+
return /* @__PURE__ */ u("p", {
|
|
116
|
+
id: "incode-modal-description",
|
|
117
|
+
className: cn("IncodeModalSubtitle", className),
|
|
118
|
+
children
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function ModalActions({ children, class: className, orientation = "vertical" }) {
|
|
122
|
+
return /* @__PURE__ */ u("div", {
|
|
123
|
+
class: cn(orientation === "vertical" ? "IncodeModalActionsVertical" : "IncodeModalActionsHorizontal", className),
|
|
124
|
+
role: "group",
|
|
125
|
+
children
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
var Modal = {
|
|
129
|
+
Root: ModalRoot,
|
|
130
|
+
Content: ModalContent,
|
|
131
|
+
Close: ModalClose,
|
|
132
|
+
Icon: ModalIcon,
|
|
133
|
+
TitleSection: ModalTitleSection,
|
|
134
|
+
Title: ModalTitle,
|
|
135
|
+
Subtitle: ModalSubtitle,
|
|
136
|
+
Actions: ModalActions
|
|
137
|
+
};
|
|
138
|
+
//#endregion
|
|
139
|
+
export { Modal as t };
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { _ as y, p as d } from "./vendor-preact-DThS2ZQ_.js";
|
|
2
|
+
//#region src/shared/modal/modal.hooks.ts
|
|
3
|
+
var MODAL_SCROLL_LOCK_CLASS = "IncodeModalScrollLock";
|
|
4
|
+
/** `id` of the `Modal.Title` heading; also the dialog's `aria-labelledby`. */
|
|
5
|
+
var MODAL_TITLE_ID = "incode-modal-title";
|
|
6
|
+
/**
|
|
7
|
+
* Selector for focusable elements that participate in Tab cycling inside the dialog.
|
|
8
|
+
*/
|
|
9
|
+
var TAB_FOCUSABLE_SELECTOR = [
|
|
10
|
+
"button:not([disabled])",
|
|
11
|
+
"[href]",
|
|
12
|
+
"input:not([disabled])",
|
|
13
|
+
"select:not([disabled])",
|
|
14
|
+
"textarea:not([disabled])",
|
|
15
|
+
"[tabindex]:not([tabindex=\"-1\"])"
|
|
16
|
+
].join(", ");
|
|
17
|
+
function getTabFocusableElements(container) {
|
|
18
|
+
return Array.from(container.querySelectorAll(TAB_FOCUSABLE_SELECTOR));
|
|
19
|
+
}
|
|
20
|
+
function isTabFocusableElement(element) {
|
|
21
|
+
try {
|
|
22
|
+
return element.matches(TAB_FOCUSABLE_SELECTOR);
|
|
23
|
+
} catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Picks the dialog's initial focus. By default focus lands on the `Modal.Title`
|
|
29
|
+
* heading so screen readers announce it on open, rather than the dialog
|
|
30
|
+
* role / item count or an action control. A dialog can opt a specific control
|
|
31
|
+
* into initial focus by marking it with the `autofocus` attribute. Falls back
|
|
32
|
+
* to the dialog container when no title is present.
|
|
33
|
+
*/
|
|
34
|
+
function resolveModalInitialFocusTarget(dialog) {
|
|
35
|
+
const autofocusEl = dialog.querySelector("[autofocus]");
|
|
36
|
+
if (autofocusEl && isTabFocusableElement(autofocusEl)) return autofocusEl;
|
|
37
|
+
return dialog.querySelector(`#incode-modal-title`) ?? dialog;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Renders the modal into `.IncodeComponent` by default, falling back to `document.body`.
|
|
41
|
+
* Pass `portalContainer` to mount into a host you control.
|
|
42
|
+
* The ephemeral portal host is only created while `open` is true.
|
|
43
|
+
*/
|
|
44
|
+
function useModalPortalTarget(open, portalContainer) {
|
|
45
|
+
const [node, setNode] = d(null);
|
|
46
|
+
y(() => {
|
|
47
|
+
if (!open) {
|
|
48
|
+
setNode(null);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (portalContainer) {
|
|
52
|
+
setNode(portalContainer);
|
|
53
|
+
return () => {
|
|
54
|
+
setNode(null);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const el = document.createElement("div");
|
|
58
|
+
el.setAttribute("data-incode-modal-portal", "");
|
|
59
|
+
(document.querySelector(".IncodeComponent") ?? document.body).appendChild(el);
|
|
60
|
+
setNode(el);
|
|
61
|
+
return () => {
|
|
62
|
+
el.remove();
|
|
63
|
+
setNode(null);
|
|
64
|
+
};
|
|
65
|
+
}, [open, portalContainer]);
|
|
66
|
+
return node;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Locks scroll while the modal is open by adding a CSS class to `.IncodeComponent`
|
|
70
|
+
* when present, otherwise `document.body`.
|
|
71
|
+
*/
|
|
72
|
+
function useModalBodyScrollLock(open) {
|
|
73
|
+
y(() => {
|
|
74
|
+
if (!open) return;
|
|
75
|
+
const incodeComponent = document.querySelector(".IncodeComponent");
|
|
76
|
+
(incodeComponent ?? document.body).classList.add(MODAL_SCROLL_LOCK_CLASS);
|
|
77
|
+
return () => {
|
|
78
|
+
(incodeComponent ?? document.body).classList.remove(MODAL_SCROLL_LOCK_CLASS);
|
|
79
|
+
};
|
|
80
|
+
}, [open]);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Invokes `onRequestClose` when Escape is pressed while `open && dismissible`.
|
|
84
|
+
*/
|
|
85
|
+
function useModalEscapeDismiss(open, dismissible, onRequestClose) {
|
|
86
|
+
y(() => {
|
|
87
|
+
if (!open || !dismissible) return;
|
|
88
|
+
const onKeyDown = (event) => {
|
|
89
|
+
if (event.key === "Escape") {
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
onRequestClose();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
document.addEventListener("keydown", onKeyDown);
|
|
95
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
96
|
+
}, [
|
|
97
|
+
open,
|
|
98
|
+
dismissible,
|
|
99
|
+
onRequestClose
|
|
100
|
+
]);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* When `active` becomes true, moves focus to the first tabbable inside the dialog,
|
|
104
|
+
* or the dialog surface. Otherwise restores focus on cleanup — to the element in
|
|
105
|
+
* `returnFocusRef` if provided, otherwise to the previously focused element.
|
|
106
|
+
*
|
|
107
|
+
* An explicit `returnFocusRef` is strongly recommended for dialogs opened via
|
|
108
|
+
* touch on iOS/VoiceOver, where `document.activeElement` is frequently `<body>`
|
|
109
|
+
* at open time, which would otherwise cause focus to be restored to nothing and
|
|
110
|
+
* VoiceOver to land on a nearby empty container.
|
|
111
|
+
*
|
|
112
|
+
* `active` should include portal mount readiness (e.g. `open && portalTarget != null`)
|
|
113
|
+
* so focus runs after the dialog node exists.
|
|
114
|
+
*/
|
|
115
|
+
function useModalFocusCapture(active, dialogRef, manageInitialFocus = true, returnFocusRef) {
|
|
116
|
+
y(() => {
|
|
117
|
+
if (!active) return;
|
|
118
|
+
const previous = document.activeElement;
|
|
119
|
+
const explicitReturnTarget = returnFocusRef?.current ?? null;
|
|
120
|
+
if (manageInitialFocus) {
|
|
121
|
+
const dialog = dialogRef.current;
|
|
122
|
+
if (dialog) resolveModalInitialFocusTarget(dialog).focus();
|
|
123
|
+
}
|
|
124
|
+
return () => {
|
|
125
|
+
if (explicitReturnTarget && typeof explicitReturnTarget.focus === "function") {
|
|
126
|
+
explicitReturnTarget.focus();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (previous && typeof previous.focus === "function") previous.focus();
|
|
130
|
+
};
|
|
131
|
+
}, [
|
|
132
|
+
active,
|
|
133
|
+
dialogRef,
|
|
134
|
+
manageInitialFocus,
|
|
135
|
+
returnFocusRef
|
|
136
|
+
]);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Tracks the visual viewport (shrinks when a mobile virtual keyboard opens) and
|
|
140
|
+
* publishes its size + offset as CSS custom properties on the target element:
|
|
141
|
+
*/
|
|
142
|
+
function useModalVisualViewportBounds(active, targetRef) {
|
|
143
|
+
y(() => {
|
|
144
|
+
if (!active) return;
|
|
145
|
+
if (typeof window === "undefined") return;
|
|
146
|
+
const viewport = window.visualViewport;
|
|
147
|
+
if (!viewport) return;
|
|
148
|
+
const update = () => {
|
|
149
|
+
const el = targetRef.current;
|
|
150
|
+
if (!el) return;
|
|
151
|
+
el.style.setProperty("--incode-visual-viewport-height", `${viewport.height}px`);
|
|
152
|
+
el.style.setProperty("--incode-visual-viewport-offset-top", `${viewport.offsetTop}px`);
|
|
153
|
+
};
|
|
154
|
+
update();
|
|
155
|
+
viewport.addEventListener("resize", update);
|
|
156
|
+
viewport.addEventListener("scroll", update);
|
|
157
|
+
return () => {
|
|
158
|
+
viewport.removeEventListener("resize", update);
|
|
159
|
+
viewport.removeEventListener("scroll", update);
|
|
160
|
+
};
|
|
161
|
+
}, [active, targetRef]);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Keeps Tab / Shift+Tab cycling within the dialog while `active` is true.
|
|
165
|
+
*/
|
|
166
|
+
function useModalTabCycle(active, dialogRef) {
|
|
167
|
+
y(() => {
|
|
168
|
+
if (!active) return;
|
|
169
|
+
const onKeyDown = (event) => {
|
|
170
|
+
if (event.key !== "Tab") return;
|
|
171
|
+
const dialog = dialogRef.current;
|
|
172
|
+
if (!dialog) return;
|
|
173
|
+
const focusables = getTabFocusableElements(dialog);
|
|
174
|
+
if (focusables.length === 0) {
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const first = focusables[0];
|
|
179
|
+
const last = focusables[focusables.length - 1];
|
|
180
|
+
if (event.shiftKey) {
|
|
181
|
+
if (document.activeElement === first) {
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
last.focus();
|
|
184
|
+
}
|
|
185
|
+
} else if (document.activeElement === last) {
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
first.focus();
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
document.addEventListener("keydown", onKeyDown);
|
|
191
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
192
|
+
}, [active, dialogRef]);
|
|
193
|
+
}
|
|
194
|
+
//#endregion
|
|
195
|
+
export { useModalPortalTarget as a, useModalFocusCapture as i, useModalBodyScrollLock as n, useModalTabCycle as o, useModalEscapeDismiss as r, useModalVisualViewportBounds as s, MODAL_TITLE_ID as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { v as u } from "./vendor-preact-DThS2ZQ_.js";
|
|
2
|
+
//#region src/shared/permissions/camera/numberedStep.tsx
|
|
3
|
+
var NumberedStep = ({ number }) => {
|
|
4
|
+
return /* @__PURE__ */ u("div", {
|
|
5
|
+
class: "IncodeNumberedStep",
|
|
6
|
+
children: /* @__PURE__ */ u("span", {
|
|
7
|
+
class: "IncodeNumberedStepText",
|
|
8
|
+
children: number
|
|
9
|
+
})
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { NumberedStep as t };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { n as useTranslation } from "./i18n-CoCO2ZuN.js";
|
|
2
|
+
import { _ as y, h as q, l as A, p as d, v as u } from "./vendor-preact-DThS2ZQ_.js";
|
|
3
|
+
import { r as useIsMobileDeviceWidth } from "./hooks-Da_yP_Dr.js";
|
|
4
|
+
import { t as InputComposed } from "./inputComposed-CQ4AsvZg.js";
|
|
5
|
+
import { i as translateError } from "./radioGroupComposed-BNuaopVr.js";
|
|
6
|
+
import { t as BottomSheet } from "./bottomSheet-F1GJfQx_.js";
|
|
7
|
+
//#region src/shared/addressAutocomplete/addressAutocomplete.tsx
|
|
8
|
+
var AddressAutocomplete = ({ label, value, error, errorParams, suggestions, readonly, required, labelHint, onChange, onSearch, onSelect, onBlur }) => {
|
|
9
|
+
const { t } = useTranslation();
|
|
10
|
+
const [showSuggestions, setShowSuggestions] = d(false);
|
|
11
|
+
const [isModalOpen, setIsModalOpen] = d(false);
|
|
12
|
+
const [modalQuery, setModalQuery] = d("");
|
|
13
|
+
const [activeIndex, setActiveIndex] = d(-1);
|
|
14
|
+
const [mobileActiveIndex, setMobileActiveIndex] = d(-1);
|
|
15
|
+
const containerRef = A(null);
|
|
16
|
+
const listboxRef = A(null);
|
|
17
|
+
const mobileListboxRef = A(null);
|
|
18
|
+
const listboxId = "ekyc-address-listbox";
|
|
19
|
+
const mobileListboxId = "ekyc-address-mobile-listbox";
|
|
20
|
+
const mobileTitleId = "ekyc-address-modal-title";
|
|
21
|
+
const isMobile = useIsMobileDeviceWidth();
|
|
22
|
+
const translatedLabel = t(label);
|
|
23
|
+
y(() => {
|
|
24
|
+
function handleClickOutside(e) {
|
|
25
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) setShowSuggestions(false);
|
|
26
|
+
}
|
|
27
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
28
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
29
|
+
}, []);
|
|
30
|
+
y(() => {
|
|
31
|
+
setActiveIndex(-1);
|
|
32
|
+
setMobileActiveIndex(-1);
|
|
33
|
+
}, [suggestions]);
|
|
34
|
+
y(() => {
|
|
35
|
+
const ref = isMobile ? mobileListboxRef : listboxRef;
|
|
36
|
+
const idx = isMobile ? mobileActiveIndex : activeIndex;
|
|
37
|
+
if (idx < 0) return;
|
|
38
|
+
ref.current?.children[idx]?.scrollIntoView({ block: "nearest" });
|
|
39
|
+
}, [
|
|
40
|
+
activeIndex,
|
|
41
|
+
mobileActiveIndex,
|
|
42
|
+
isMobile
|
|
43
|
+
]);
|
|
44
|
+
const handleSelect = q((suggestion) => {
|
|
45
|
+
onSelect(suggestion);
|
|
46
|
+
setShowSuggestions(false);
|
|
47
|
+
setIsModalOpen(false);
|
|
48
|
+
setActiveIndex(-1);
|
|
49
|
+
setMobileActiveIndex(-1);
|
|
50
|
+
}, [onSelect]);
|
|
51
|
+
const closeModal = q(() => {
|
|
52
|
+
setIsModalOpen(false);
|
|
53
|
+
setMobileActiveIndex(-1);
|
|
54
|
+
}, []);
|
|
55
|
+
const handleInput = (val) => {
|
|
56
|
+
onChange(val);
|
|
57
|
+
if (val.length >= 3) if (isMobile) {
|
|
58
|
+
setIsModalOpen(true);
|
|
59
|
+
setModalQuery(val);
|
|
60
|
+
onSearch(val);
|
|
61
|
+
} else {
|
|
62
|
+
onSearch(val);
|
|
63
|
+
setShowSuggestions(true);
|
|
64
|
+
}
|
|
65
|
+
else setShowSuggestions(false);
|
|
66
|
+
};
|
|
67
|
+
const createListboxKeyHandler = (getIndex, setIndex, onEscape) => {
|
|
68
|
+
return (e) => {
|
|
69
|
+
if (suggestions.length === 0) return;
|
|
70
|
+
if (e.key === "ArrowDown") {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
setIndex((i) => i < suggestions.length - 1 ? i + 1 : 0);
|
|
73
|
+
} else if (e.key === "ArrowUp") {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
setIndex((i) => i > 0 ? i - 1 : suggestions.length - 1);
|
|
76
|
+
} else if (e.key === "Enter" && getIndex() >= 0) {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
handleSelect(suggestions[getIndex()]);
|
|
79
|
+
} else if (e.key === "Escape" && onEscape) onEscape();
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
const handleKeyDown = createListboxKeyHandler(() => activeIndex, setActiveIndex, () => {
|
|
83
|
+
setShowSuggestions(false);
|
|
84
|
+
setActiveIndex(-1);
|
|
85
|
+
});
|
|
86
|
+
const handleMobileKeyDown = createListboxKeyHandler(() => mobileActiveIndex, setMobileActiveIndex);
|
|
87
|
+
const isExpanded = !isMobile && showSuggestions && suggestions.length > 0;
|
|
88
|
+
const activeDescendant = isExpanded && activeIndex >= 0 ? `${listboxId}-option-${activeIndex}` : void 0;
|
|
89
|
+
return /* @__PURE__ */ u("div", {
|
|
90
|
+
className: "IncodeAddressAutocomplete",
|
|
91
|
+
ref: containerRef,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ u(InputComposed, {
|
|
94
|
+
id: "ekyc-street",
|
|
95
|
+
label: translatedLabel,
|
|
96
|
+
labelHint,
|
|
97
|
+
name: "street",
|
|
98
|
+
value,
|
|
99
|
+
readOnly: readonly,
|
|
100
|
+
required,
|
|
101
|
+
error: translateError(t, error, errorParams),
|
|
102
|
+
onInput: (e) => handleInput(e.target.value),
|
|
103
|
+
onKeyDown: handleKeyDown,
|
|
104
|
+
onBlur,
|
|
105
|
+
role: "combobox",
|
|
106
|
+
"aria-expanded": isExpanded,
|
|
107
|
+
"aria-controls": listboxId,
|
|
108
|
+
"aria-activedescendant": activeDescendant,
|
|
109
|
+
"aria-autocomplete": "list",
|
|
110
|
+
"data-testid": "ekyc-address-input"
|
|
111
|
+
}),
|
|
112
|
+
isExpanded && /* @__PURE__ */ u("ul", {
|
|
113
|
+
ref: listboxRef,
|
|
114
|
+
id: listboxId,
|
|
115
|
+
role: "listbox",
|
|
116
|
+
className: "IncodeAddressAutocompleteSuggestions",
|
|
117
|
+
children: suggestions.map((s, i) => /* @__PURE__ */ u("li", {
|
|
118
|
+
id: `${listboxId}-option-${i}`,
|
|
119
|
+
role: "option",
|
|
120
|
+
"aria-selected": i === activeIndex,
|
|
121
|
+
className: `IncodeAddressAutocompleteSuggestion ${i === activeIndex ? "IncodeAddressAutocompleteSuggestionActive" : ""}`,
|
|
122
|
+
onClick: () => handleSelect(s),
|
|
123
|
+
children: s.label
|
|
124
|
+
}, s.id))
|
|
125
|
+
}),
|
|
126
|
+
isMobile && /* @__PURE__ */ u(BottomSheet, {
|
|
127
|
+
isOpen: isModalOpen,
|
|
128
|
+
onClose: closeModal,
|
|
129
|
+
labelledById: mobileTitleId,
|
|
130
|
+
children: [/* @__PURE__ */ u("div", {
|
|
131
|
+
className: "IncodeAddressAutocompleteModalHeader",
|
|
132
|
+
children: [/* @__PURE__ */ u("h3", {
|
|
133
|
+
id: mobileTitleId,
|
|
134
|
+
children: t("verification.addressSearch")
|
|
135
|
+
}), /* @__PURE__ */ u("button", {
|
|
136
|
+
className: "IncodeAddressAutocompleteModalClose",
|
|
137
|
+
onClick: closeModal,
|
|
138
|
+
type: "button",
|
|
139
|
+
"aria-label": t("common.close"),
|
|
140
|
+
children: "×"
|
|
141
|
+
})]
|
|
142
|
+
}), /* @__PURE__ */ u("div", {
|
|
143
|
+
className: "IncodeAddressAutocompleteModalBody",
|
|
144
|
+
children: [
|
|
145
|
+
/* @__PURE__ */ u("input", {
|
|
146
|
+
className: "IncodeAddressAutocompleteModalInput",
|
|
147
|
+
type: "text",
|
|
148
|
+
value: modalQuery,
|
|
149
|
+
placeholder: t("verification.addressPlaceholder"),
|
|
150
|
+
"aria-label": t("verification.addressSearch"),
|
|
151
|
+
role: "combobox",
|
|
152
|
+
"aria-expanded": suggestions.length > 0,
|
|
153
|
+
"aria-controls": mobileListboxId,
|
|
154
|
+
"aria-activedescendant": mobileActiveIndex >= 0 ? `${mobileListboxId}-option-${mobileActiveIndex}` : void 0,
|
|
155
|
+
"aria-autocomplete": "list",
|
|
156
|
+
onInput: (e) => {
|
|
157
|
+
const val = e.target.value;
|
|
158
|
+
setModalQuery(val);
|
|
159
|
+
if (val.length >= 3) onSearch(val);
|
|
160
|
+
},
|
|
161
|
+
onKeyDown: handleMobileKeyDown,
|
|
162
|
+
autoFocus: true
|
|
163
|
+
}),
|
|
164
|
+
suggestions.length > 0 && /* @__PURE__ */ u("ul", {
|
|
165
|
+
ref: mobileListboxRef,
|
|
166
|
+
id: mobileListboxId,
|
|
167
|
+
role: "listbox",
|
|
168
|
+
className: "IncodeAddressAutocompleteModalSuggestions",
|
|
169
|
+
children: suggestions.map((s, i) => /* @__PURE__ */ u("li", {
|
|
170
|
+
id: `${mobileListboxId}-option-${i}`,
|
|
171
|
+
role: "option",
|
|
172
|
+
"aria-selected": i === mobileActiveIndex,
|
|
173
|
+
className: `IncodeAddressAutocompleteModalSuggestion ${i === mobileActiveIndex ? "IncodeAddressAutocompleteModalSuggestionActive" : ""}`,
|
|
174
|
+
onClick: () => handleSelect(s),
|
|
175
|
+
children: s.label
|
|
176
|
+
}, s.id))
|
|
177
|
+
}),
|
|
178
|
+
/* @__PURE__ */ u("button", {
|
|
179
|
+
className: "IncodeAddressAutocompleteEnterManually",
|
|
180
|
+
onClick: closeModal,
|
|
181
|
+
type: "button",
|
|
182
|
+
children: t("verification.enterManually")
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
})]
|
|
186
|
+
})
|
|
187
|
+
]
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/shared/utils/optionAccessibleLabel/optionAccessibleLabel.ts
|
|
192
|
+
/**
|
|
193
|
+
* Strips a single leading flag or pictograph (plus following whitespace) from
|
|
194
|
+
* labels so accessible names can mirror visible text without screen readers
|
|
195
|
+
* announcing decorative emoji.
|
|
196
|
+
*/
|
|
197
|
+
var LEADING_DECORATIVE_EMOJI = /^(?:[\u{1F1E6}-\u{1F1FF}]{2}|\p{Extended_Pictographic})\s*/u;
|
|
198
|
+
function getAccessibleOptionLabel(label) {
|
|
199
|
+
return label.replace(LEADING_DECORATIVE_EMOJI, "").trimStart();
|
|
200
|
+
}
|
|
201
|
+
//#endregion
|
|
202
|
+
export { AddressAutocomplete as n, getAccessibleOptionLabel as t };
|