@gerege-systems/eid-mongolia-sdk 0.38.1 → 0.40.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/README.md +5 -4
- package/dist/button.cjs +80 -48
- package/dist/button.d.cts +2 -0
- package/dist/button.d.ts +2 -0
- package/dist/button.js +80 -48
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -156,7 +156,7 @@ app.use("/auth/eid", express.json(), async (req, res) => {
|
|
|
156
156
|
| `theme` | `auto` \| `light` \| `dark` | `auto` |
|
|
157
157
|
| `success-url` (`successUrl`) | backend redirect өгөөгүй үед шилжих URL | — |
|
|
158
158
|
| `label` | товчны текст; `""` → зөвхөн лого | i18n: «e-ID-ээр нэвтрэх» / «Log in with e-ID» |
|
|
159
|
-
| `icon` | `eid` (
|
|
159
|
+
| `icon` | `eid` («e-ID» wordmark, inline SVG `fill: currentColor` — товч / гарчгийн текстийн өнгөөр light / dark-ийг дагана; өндөр товчинд 16px, зөвхөн-лого үед 12px, цонхны толгойд 20px; анхдагч текстэй үед лого «e-ID»-г орлоно: [e-ID] нэвтрэх, бүтэн нэр `aria-label`-д) \| `none` (логогүй, бүтэн текст) | `eid` |
|
|
160
160
|
| `variant` | `default` (лого + текст) \| `icon` (зөвхөн лого, 44×44) | `default` |
|
|
161
161
|
| `aria-label` | товчны хүртээмжийн нэр (дэлгэц уншигч) | зөвхөн-лого үед `label` эсвэл i18n текст |
|
|
162
162
|
|
|
@@ -185,6 +185,7 @@ document.querySelector("eid-login-button").addEventListener("eid-login-error", (
|
|
|
185
185
|
```
|
|
186
186
|
|
|
187
187
|
Гадны хамааралгүй (QR encoder дотроо), цонх нь focus trap, Esc, `aria-live` төлөвтэй.
|
|
188
|
+
Цонх нь нативи `<dialog>` + `showModal()` (browser top layer) — RP хуудасны өвөг элементийн `transform`/`filter`/`backdrop-filter`/`overflow` нөлөөлөхгүй; `showModal` үгүй хөтөчид `position: fixed` overlay-д унана.
|
|
188
189
|
|
|
189
190
|
**Дизайн, theme.** Дизайн нь eID нэвтрэх хуудсынх (лого, өнгө). Фонт нь хуудаснаас өвлөгдөнө (товч, цонх, input бүгд).
|
|
190
191
|
`theme="auto"` үед дараалал: хуудасны `html[data-theme="dark|light"]` → `html.dark` / `html.light` → OS
|
|
@@ -200,15 +201,15 @@ Dark-ийн дараалал: `--eid-<нэр>-dark` → `--eid-<нэр>` → dar
|
|
|
200
201
|
--eid-accent-dark: var(--brand-400); /* зөвхөн dark-д (өгөхгүй бол --eid-accent) */
|
|
201
202
|
--eid-radius: 6px; --eid-radius-lg: 8px;
|
|
202
203
|
}
|
|
203
|
-
eid-login-button::part(button) { width: 100%; } /* part: button, icon, label, backdrop
|
|
204
|
+
eid-login-button::part(button) { width: 100%; } /* part: button, icon, label, dialog (backdrop — зөвхөн fallback-д) */
|
|
204
205
|
eid-login-button::part(label) { font-weight: 600; }
|
|
205
|
-
eid-login-button::part(icon) {
|
|
206
|
+
eid-login-button::part(icon) { height: 18px; }
|
|
206
207
|
```
|
|
207
208
|
|
|
208
209
|
| Хувьсагч (`-dark` хувилбартай) | Юунд | Light анхдагч | Dark анхдагч |
|
|
209
210
|
|---|---|---|---|
|
|
210
211
|
| `--eid-accent` | үндсэн товч | `oklch(0.534 0.2 259)` | `oklch(0.64 0.15 259)` |
|
|
211
|
-
| `--eid-logo` | **deprecated (0.38.0)** —
|
|
212
|
+
| `--eid-logo` | **deprecated (0.38.0)** — үл хэрэгжинэ; 0.40.0-оос wordmark `currentColor` (товч / гарчгийн текстийн өнгө) | — | — |
|
|
212
213
|
| `--eid-accent-fg` | үндсэн товчны текст | `#fff` | `hsl(229 50% 6%)` |
|
|
213
214
|
| `--eid-accent-subtle` | алхмын дугаарын дэвсгэр | `oklch(0.97 0.03 259)` | `oklch(0.24 0.06 259)` |
|
|
214
215
|
| `--eid-accent-subtle-fg` | алхмын дугаар | `oklch(0.474 0.19 259)` | `oklch(0.82 0.1 259)` |
|
package/dist/button.cjs
CHANGED
|
@@ -40,16 +40,9 @@ function isMobileUserAgent(nav) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
// src/logo.ts
|
|
43
|
-
var EID_LOGO_VIEWBOX = "0 0
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
["path", { d: "M34 4H46A14 14 0 0 1 60 18V46A14 14 0 0 1 46 60H34Z", fill: "#2457E6" }],
|
|
47
|
-
["path", { class: "m-l", d: "M14 32H50A18 18 0 0 0 14 32A18 18 0 0 0 50 32", fill: "none", "stroke-width": "4.8", "stroke-linejoin": "round" }],
|
|
48
|
-
["circle", { class: "m-l", cx: "32", cy: "32", r: "12", fill: "#1564E1", "stroke-width": "1.4" }],
|
|
49
|
-
["path", { d: "M23.5 23.5L40.5 40.5M40.5 23.5L23.5 40.5", stroke: "#FFFFFF", "stroke-width": "1.8" }],
|
|
50
|
-
["circle", { cx: "32", cy: "32", r: "4.4", fill: "#FFFFFF" }],
|
|
51
|
-
["circle", { cx: "32", cy: "32", r: "3", fill: "#1564E1" }]
|
|
52
|
-
];
|
|
43
|
+
var EID_LOGO_VIEWBOX = "0 0 3840 1372";
|
|
44
|
+
var EID_LOGO_TRANSFORM = "translate(0.016725,1765.695476) scale(1,-1)";
|
|
45
|
+
var EID_LOGO_PATH = "M331 1765 c-26 -5 -46 -23 -54 -49 l-2 -7 0 -81 0 -80 2 -9 c9 -25 28 -42 54 -47 6 -1 41 -1 219 -1 237 0 219 1 235 -7 17 -9 32 -28 36 -46 3 -11 2 -160 0 -169 -7 -25 -25 -43 -50 -50 -6 -1 -16 -1 -222 -1 -207 0 -217 0 -223 1 -20 6 -35 19 -44 37 -7 12 -6 8 -7 96 -1 81 -1 82 -3 89 -7 24 -26 42 -50 49 -6 1 -13 2 -85 2 l-78 0 -8 -3 c-25 -7 -43 -25 -49 -50 -2 -7 -2 -11 -2 -276 0 -303 -1 -275 8 -292 3 -7 7 -12 232 -237 225 -225 230 -229 237 -232 16 -8 -12 -7 292 -7 257 0 271 0 277 1 24 7 44 27 49 51 3 10 3 159 0 169 -5 23 -23 42 -47 50 l-7 3 -356 0 -356 1 -8 2 c-21 8 -38 25 -44 46 l-2 8 0 79 c0 88 0 86 6 99 10 18 24 31 45 37 5 1 22 1 361 2 l356 1 7 2 c21 8 36 23 44 44 l3 8 0 134 c0 148 0 141 -6 155 -2 3 -6 9 -8 13 -3 3 -106 106 -229 229 -240 240 -227 227 -244 233 l-8 4 -133 0 c-74 0 -135 -1 -138 -1z M2251 1765 c-26 -5 -46 -23 -54 -49 l-2 -7 0 -629 0 -628 2 -8 c7 -24 23 -40 47 -47 l8 -2 80 0 81 0 8 2 c25 9 42 28 47 54 2 11 2 1247 0 1258 -5 26 -22 45 -47 54 l-8 3 -79 0 c-43 0 -80 -1 -83 -1z M2798 1765 c-26 -6 -48 -27 -53 -52 -2 -6 -2 -58 -2 -499 l1 -491 2 -8 c8 -22 27 -39 49 -45 10 -2 160 -2 170 0 22 6 41 23 49 45 l3 8 0 355 c0 286 1 356 2 361 5 18 19 36 36 45 16 8 -2 7 240 7 l217 0 7 -3 c21 -8 38 -25 44 -46 l2 -8 0 -354 0 -354 -2 -8 c-6 -21 -23 -38 -44 -46 l-7 -2 -219 -1 -219 0 -8 -3 c-19 -7 -33 -19 -41 -35 -8 -16 -8 -14 -8 -103 l1 -78 3 -9 c6 -18 18 -32 34 -40 17 -7 9 -7 157 -7 147 1 135 0 151 8 7 3 12 7 237 232 225 225 229 230 232 237 9 17 8 0 8 209 0 209 1 192 -8 209 -3 7 -7 12 -232 237 -225 225 -230 229 -237 232 -16 8 13 7 -289 8 -218 0 -271 0 -276 -1z M1424 1215 c-24 -5 -43 -24 -50 -48 l-2 -7 0 -80 0 -79 2 -8 c6 -19 19 -35 35 -43 16 -8 -3 -7 237 -7 209 0 215 0 222 2 25 6 45 27 50 52 3 10 3 156 0 166 -5 25 -25 46 -50 52 -7 2 -13 2 -223 2 -185 0 -216 0 -221 -2z";
|
|
53
46
|
|
|
54
47
|
// src/qr.ts
|
|
55
48
|
var ECC_PER_BLOCK_M = [
|
|
@@ -408,10 +401,12 @@ function resolveEidLang(lang) {
|
|
|
408
401
|
var MN = {
|
|
409
402
|
button: "e-ID-\u044D\u044D\u0440 \u043D\u044D\u0432\u0442\u0440\u044D\u0445",
|
|
410
403
|
title: "e-ID-\u044D\u044D\u0440 \u043D\u044D\u0432\u0442\u0440\u044D\u0445",
|
|
404
|
+
// Лого «e-ID» гэж бичигддэг тул логотой үед «e-ID»-г давтахгүй: [лого] нэвтрэх.
|
|
405
|
+
withLogo: ["", "\u043D\u044D\u0432\u0442\u0440\u044D\u0445"],
|
|
411
406
|
close: "\u0425\u0430\u0430\u0445",
|
|
412
407
|
loading: "\u0410\u0447\u0430\u0430\u043B\u0436 \u0431\u0430\u0439\u043D\u0430",
|
|
413
|
-
qrAlt: "\u041D\u044D\u0432\u0442\u0440\u044D\u0445 QR \u043A\u043E\u0434 \u2014 \u0443\u0442\u0441\u0430\u043D \u0434\u044D\u044D\u0440\u0445
|
|
414
|
-
steps: ["\u0423\u0442\u0441\u0430\u043D \u0434\u044D\u044D\u0440\u0445
|
|
408
|
+
qrAlt: "\u041D\u044D\u0432\u0442\u0440\u044D\u0445 QR \u043A\u043E\u0434 \u2014 \u0443\u0442\u0441\u0430\u043D \u0434\u044D\u044D\u0440\u0445 e-ID Mongolia \u0430\u043F\u043F\u0430\u0430\u0440 \u0443\u043D\u0448\u0443\u0443\u043B\u043D\u0430",
|
|
409
|
+
steps: ["\u0423\u0442\u0441\u0430\u043D \u0434\u044D\u044D\u0440\u0445 e-ID Mongolia \u0430\u043F\u043F\u044B\u0433 \u043D\u044D\u044D\u043D\u044D", "QR \u043A\u043E\u0434\u044B\u0433 \u0443\u043D\u0448\u0443\u0443\u043B\u043D\u0430", "PIN1 \u043A\u043E\u0434\u043E\u043E \u043E\u0440\u0443\u0443\u043B\u043D\u0430"],
|
|
415
410
|
vcLabel: "\u0411\u0430\u0442\u0430\u043B\u0433\u0430\u0430\u0436\u0443\u0443\u043B\u0430\u0445 \u043A\u043E\u0434",
|
|
416
411
|
or: "\u044D\u0441\u0432\u044D\u043B",
|
|
417
412
|
usePush: "\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0439\u043D \u0434\u0443\u0433\u0430\u0430\u0440\u0430\u0430\u0440 \u043D\u044D\u0432\u0442\u0440\u044D\u0445",
|
|
@@ -449,10 +444,11 @@ var T = {
|
|
|
449
444
|
en: {
|
|
450
445
|
button: "Log in with e-ID",
|
|
451
446
|
title: "Log in with e-ID",
|
|
447
|
+
withLogo: ["Log in with ", ""],
|
|
452
448
|
close: "Close",
|
|
453
449
|
loading: "Loading",
|
|
454
|
-
qrAlt: "Login QR code \u2014 scan it with the
|
|
455
|
-
steps: ["Open the
|
|
450
|
+
qrAlt: "Login QR code \u2014 scan it with the e-ID Mongolia app on your phone",
|
|
451
|
+
steps: ["Open the e-ID Mongolia app on your phone", "Scan the QR code", "Enter your PIN1"],
|
|
456
452
|
vcLabel: "Verification code",
|
|
457
453
|
or: "or",
|
|
458
454
|
usePush: "Log in with registration number",
|
|
@@ -488,10 +484,11 @@ var T = {
|
|
|
488
484
|
ru: {
|
|
489
485
|
button: "\u0412\u043E\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 e-ID",
|
|
490
486
|
title: "\u0412\u043E\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 e-ID",
|
|
487
|
+
withLogo: ["\u0412\u043E\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 ", ""],
|
|
491
488
|
close: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C",
|
|
492
489
|
loading: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430",
|
|
493
|
-
qrAlt: "QR-\u043A\u043E\u0434 \u0434\u043B\u044F \u0432\u0445\u043E\u0434\u0430 \u2014 \u043E\u0442\u0441\u043A\u0430\u043D\u0438\u0440\u0443\u0439\u0442\u0435 \u0435\u0433\u043E \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435\u043C
|
|
494
|
-
steps: ["\u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435
|
|
490
|
+
qrAlt: "QR-\u043A\u043E\u0434 \u0434\u043B\u044F \u0432\u0445\u043E\u0434\u0430 \u2014 \u043E\u0442\u0441\u043A\u0430\u043D\u0438\u0440\u0443\u0439\u0442\u0435 \u0435\u0433\u043E \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435\u043C e-ID Mongolia \u043D\u0430 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0435",
|
|
491
|
+
steps: ["\u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 e-ID Mongolia \u043D\u0430 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0435", "\u041E\u0442\u0441\u043A\u0430\u043D\u0438\u0440\u0443\u0439\u0442\u0435 QR-\u043A\u043E\u0434", "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 PIN1"],
|
|
495
492
|
vcLabel: "\u041A\u043E\u0434 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F",
|
|
496
493
|
or: "\u0438\u043B\u0438",
|
|
497
494
|
usePush: "\u0412\u043E\u0439\u0442\u0438 \u043F\u043E \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u043C\u0443 \u043D\u043E\u043C\u0435\u0440\u0443",
|
|
@@ -527,10 +524,11 @@ var T = {
|
|
|
527
524
|
zh: {
|
|
528
525
|
button: "\u4F7F\u7528 e-ID \u767B\u5F55",
|
|
529
526
|
title: "\u4F7F\u7528 e-ID \u767B\u5F55",
|
|
527
|
+
withLogo: ["\u4F7F\u7528", "\u767B\u5F55"],
|
|
530
528
|
close: "\u5173\u95ED",
|
|
531
529
|
loading: "\u52A0\u8F7D\u4E2D",
|
|
532
|
-
qrAlt: "\u767B\u5F55\u4E8C\u7EF4\u7801 \u2014 \u8BF7\u7528\u624B\u673A\u4E0A\u7684
|
|
533
|
-
steps: ["\u5728\u624B\u673A\u4E0A\u6253\u5F00
|
|
530
|
+
qrAlt: "\u767B\u5F55\u4E8C\u7EF4\u7801 \u2014 \u8BF7\u7528\u624B\u673A\u4E0A\u7684 e-ID Mongolia \u5E94\u7528\u626B\u63CF",
|
|
531
|
+
steps: ["\u5728\u624B\u673A\u4E0A\u6253\u5F00 e-ID Mongolia \u5E94\u7528", "\u626B\u63CF\u4E8C\u7EF4\u7801", "\u8F93\u5165 PIN1"],
|
|
534
532
|
vcLabel: "\u9A8C\u8BC1\u7801",
|
|
535
533
|
or: "\u6216",
|
|
536
534
|
usePush: "\u4F7F\u7528\u767B\u8BB0\u53F7\u767B\u5F55",
|
|
@@ -566,10 +564,11 @@ var T = {
|
|
|
566
564
|
fr: {
|
|
567
565
|
button: "Se connecter avec e-ID",
|
|
568
566
|
title: "Se connecter avec e-ID",
|
|
567
|
+
withLogo: ["Se connecter avec ", ""],
|
|
569
568
|
close: "Fermer",
|
|
570
569
|
loading: "Chargement",
|
|
571
|
-
qrAlt: "Code QR de connexion \u2014 scannez-le avec l'application
|
|
572
|
-
steps: ["Ouvrez l'application
|
|
570
|
+
qrAlt: "Code QR de connexion \u2014 scannez-le avec l'application e-ID Mongolia sur votre t\xE9l\xE9phone",
|
|
571
|
+
steps: ["Ouvrez l'application e-ID Mongolia sur votre t\xE9l\xE9phone", "Scannez le code QR", "Saisissez votre PIN1"],
|
|
573
572
|
vcLabel: "Code de v\xE9rification",
|
|
574
573
|
or: "ou",
|
|
575
574
|
usePush: "Se connecter avec le num\xE9ro national d'identit\xE9",
|
|
@@ -605,10 +604,11 @@ var T = {
|
|
|
605
604
|
es: {
|
|
606
605
|
button: "Iniciar sesi\xF3n con e-ID",
|
|
607
606
|
title: "Iniciar sesi\xF3n con e-ID",
|
|
607
|
+
withLogo: ["Iniciar sesi\xF3n con ", ""],
|
|
608
608
|
close: "Cerrar",
|
|
609
609
|
loading: "Cargando",
|
|
610
|
-
qrAlt: "C\xF3digo QR de inicio de sesi\xF3n: escan\xE9elo con la aplicaci\xF3n
|
|
611
|
-
steps: ["Abra la aplicaci\xF3n
|
|
610
|
+
qrAlt: "C\xF3digo QR de inicio de sesi\xF3n: escan\xE9elo con la aplicaci\xF3n e-ID Mongolia de su tel\xE9fono",
|
|
611
|
+
steps: ["Abra la aplicaci\xF3n e-ID Mongolia en su tel\xE9fono", "Escanee el c\xF3digo QR", "Introduzca su PIN1"],
|
|
612
612
|
vcLabel: "C\xF3digo de verificaci\xF3n",
|
|
613
613
|
or: "o",
|
|
614
614
|
usePush: "Iniciar sesi\xF3n con el documento nacional de identidad",
|
|
@@ -644,10 +644,11 @@ var T = {
|
|
|
644
644
|
ar: {
|
|
645
645
|
button: "\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u0639\u0628\u0631 e-ID",
|
|
646
646
|
title: "\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u0639\u0628\u0631 e-ID",
|
|
647
|
+
withLogo: ["\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u0639\u0628\u0631 ", ""],
|
|
647
648
|
close: "\u0625\u063A\u0644\u0627\u0642",
|
|
648
649
|
loading: "\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644",
|
|
649
|
-
qrAlt: "\u0631\u0645\u0632 QR \u0644\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u2014 \u0627\u0645\u0633\u062D\u0647 \u0628\u062A\u0637\u0628\u064A\u0642
|
|
650
|
-
steps: ["\u0627\u0641\u062A\u062D \u062A\u0637\u0628\u064A\u0642
|
|
650
|
+
qrAlt: "\u0631\u0645\u0632 QR \u0644\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u2014 \u0627\u0645\u0633\u062D\u0647 \u0628\u062A\u0637\u0628\u064A\u0642 e-ID Mongolia \u0639\u0644\u0649 \u0647\u0627\u062A\u0641\u0643",
|
|
651
|
+
steps: ["\u0627\u0641\u062A\u062D \u062A\u0637\u0628\u064A\u0642 e-ID Mongolia \u0639\u0644\u0649 \u0647\u0627\u062A\u0641\u0643", "\u0627\u0645\u0633\u062D \u0631\u0645\u0632 QR", "\u0623\u062F\u062E\u0644 PIN1"],
|
|
651
652
|
vcLabel: "\u0631\u0645\u0632 \u0627\u0644\u062A\u062D\u0642\u0642",
|
|
652
653
|
or: "\u0623\u0648",
|
|
653
654
|
usePush: "\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u0628\u0631\u0642\u0645 \u0627\u0644\u0647\u0648\u064A\u0629 \u0627\u0644\u0648\u0637\u0646\u064A\u0629",
|
|
@@ -725,8 +726,6 @@ button, input { font-family: inherit; }
|
|
|
725
726
|
`;
|
|
726
727
|
var DARK_CSS = `:host { color-scheme: dark;
|
|
727
728
|
${darkVars} }
|
|
728
|
-
.logo .m-a { fill: #fff; }
|
|
729
|
-
.logo .m-l { stroke: #0A1631; }
|
|
730
729
|
`;
|
|
731
730
|
var CSS_REST = `
|
|
732
731
|
*, *::before, *::after { box-sizing: border-box; }
|
|
@@ -744,18 +743,19 @@ h2, p, ol { margin: 0; }
|
|
|
744
743
|
.btn-outline:hover { background: var(--_eid-bg-muted); }
|
|
745
744
|
.btn-sm { width: auto; min-height: 36px; padding: 0 14px; font-size: 0.8125rem; }
|
|
746
745
|
.trigger { width: auto; }
|
|
747
|
-
.
|
|
748
|
-
.logo
|
|
749
|
-
.
|
|
750
|
-
.trigger.icon-only .logo { width: 24px; height: 24px; }
|
|
746
|
+
.brand { display: inline-flex; align-items: center; gap: 6px; }
|
|
747
|
+
.logo { display: block; flex: none; height: 16px; width: auto; aspect-ratio: 3840 / 1372; fill: currentColor; }
|
|
748
|
+
.trigger.icon-only .logo { height: 12px; }
|
|
751
749
|
.trigger.icon-only { width: 44px; height: 44px; padding: 0; }
|
|
752
750
|
.backdrop { position: fixed; inset: 0; z-index: 2147483000; background: hsl(222 47% 11% / 0.5); display: flex; align-items: center;
|
|
753
751
|
justify-content: center; padding: 16px; overflow-y: auto; }
|
|
752
|
+
dialog.dialog { position: fixed; inset: 0; margin: auto; height: fit-content; width: min(26rem, calc(100% - 32px)); max-width: none; }
|
|
753
|
+
dialog.dialog::backdrop { background: hsl(222 47% 11% / 0.5); }
|
|
754
754
|
.dialog { position: relative; width: 100%; max-width: 26rem; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--_eid-bg);
|
|
755
755
|
color: var(--_eid-fg); border: 1px solid var(--_eid-border); border-radius: var(--_eid-radius-lg); padding: 24px; font-size: 0.875rem; line-height: 1.5rem; }
|
|
756
756
|
@media (max-width: 639px) { .dialog { padding: 16px; } }
|
|
757
757
|
.head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
|
|
758
|
-
.head .logo {
|
|
758
|
+
.head .logo { height: 20px; }
|
|
759
759
|
.head h2 { flex: 1; font-size: 1.125rem; line-height: 1.75rem; font-weight: 600; }
|
|
760
760
|
.x { width: 36px; height: 36px; border: 0; border-radius: var(--_eid-radius); background: transparent; color: var(--_eid-fg-muted); cursor: pointer; font-size: 1.25rem; line-height: 1; }
|
|
761
761
|
.x:hover { background: var(--_eid-bg-muted); color: var(--_eid-fg); }
|
|
@@ -831,11 +831,10 @@ function logo(attrs = {}) {
|
|
|
831
831
|
for (const [k, v] of Object.entries({ class: "logo", viewBox: EID_LOGO_VIEWBOX, "aria-hidden": "true", focusable: "false", ...attrs })) {
|
|
832
832
|
svg.setAttribute(k, v);
|
|
833
833
|
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
}
|
|
834
|
+
const path = document.createElementNS(NS, "path");
|
|
835
|
+
path.setAttribute("transform", EID_LOGO_TRANSFORM);
|
|
836
|
+
path.setAttribute("d", EID_LOGO_PATH);
|
|
837
|
+
svg.append(path);
|
|
839
838
|
return svg;
|
|
840
839
|
}
|
|
841
840
|
function chevron() {
|
|
@@ -867,6 +866,7 @@ var EidLoginButton = class extends Base {
|
|
|
867
866
|
root;
|
|
868
867
|
trigger;
|
|
869
868
|
backdrop = null;
|
|
869
|
+
// <dialog> (top layer) эсвэл fallback div
|
|
870
870
|
body;
|
|
871
871
|
live;
|
|
872
872
|
timer = 0;
|
|
@@ -928,16 +928,29 @@ var EidLoginButton = class extends Base {
|
|
|
928
928
|
console.warn('<eid-login-button>: icon="none" \u0431\u0430 \u0442\u0435\u043A\u0441\u0442\u0433\u04AF\u0439 (variant="icon" \u044D\u0441\u0432\u044D\u043B label="") \u2014 \u0430\u043D\u0445\u0434\u0430\u0433\u0447 \u0442\u0435\u043A\u0441\u0442\u0438\u0439\u0433 \u0445\u0430\u0440\u0443\u0443\u043B\u0430\u0432.');
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
|
+
const brand = hasIcon && !iconOnly && !label;
|
|
931
932
|
const nodes = [];
|
|
932
|
-
if (
|
|
933
|
-
|
|
933
|
+
if (brand) nodes.push(this.brand({ part: "icon" }, { part: "label" }));
|
|
934
|
+
else {
|
|
935
|
+
if (hasIcon) nodes.push(logo({ part: "icon" }));
|
|
936
|
+
if (!iconOnly) nodes.push(el("span", { part: "label" }, text));
|
|
937
|
+
}
|
|
934
938
|
this.trigger.replaceChildren(...nodes);
|
|
935
939
|
this.trigger.classList.toggle("icon-only", iconOnly);
|
|
936
940
|
this.trigger.setAttribute("dir", this.uiDir);
|
|
937
|
-
const aria = this.getAttribute("aria-label") || (iconOnly ? text : null);
|
|
941
|
+
const aria = this.getAttribute("aria-label") || (iconOnly || brand ? text : null);
|
|
938
942
|
if (aria) this.trigger.setAttribute("aria-label", aria);
|
|
939
943
|
else this.trigger.removeAttribute("aria-label");
|
|
940
944
|
}
|
|
945
|
+
/** Лого + i18n-ийн өмнөх/дараах текст. Лого aria-hidden — дуудагч бүтэн нэрийг aria-label-аар өгнө. */
|
|
946
|
+
brand(logoAttrs = {}, textAttrs = {}) {
|
|
947
|
+
const [pre, post] = this.t.withLogo;
|
|
948
|
+
const box = el("span", { class: "brand" });
|
|
949
|
+
if (pre) box.append(el("span", textAttrs, pre));
|
|
950
|
+
box.append(logo(logoAttrs));
|
|
951
|
+
if (post) box.append(el("span", textAttrs, post));
|
|
952
|
+
return box;
|
|
953
|
+
}
|
|
941
954
|
disconnectedCallback() {
|
|
942
955
|
this.close();
|
|
943
956
|
this.themeObs?.disconnect();
|
|
@@ -980,23 +993,40 @@ var EidLoginButton = class extends Base {
|
|
|
980
993
|
this.close();
|
|
981
994
|
const gen = ++this.gen;
|
|
982
995
|
this.lastFocus = this.getRootNode().activeElement ?? document.activeElement;
|
|
983
|
-
const
|
|
984
|
-
const
|
|
996
|
+
const modal = typeof HTMLDialogElement !== "undefined" && typeof HTMLDialogElement.prototype.showModal === "function";
|
|
997
|
+
const attrs = { class: "dialog", "aria-labelledby": "eid-title", part: "dialog", dir: this.uiDir, lang: this.uiLang };
|
|
998
|
+
const dlg = modal ? el("dialog", attrs) : el("div", { ...attrs, role: "dialog", "aria-modal": "true" });
|
|
985
999
|
const head = el("div", { class: "head" });
|
|
986
1000
|
const x = el("button", { type: "button", class: "x", "aria-label": this.t.close }, "\xD7");
|
|
987
1001
|
x.addEventListener("click", () => this.close());
|
|
988
|
-
const h2 = el("h2", { id: "eid-title"
|
|
989
|
-
|
|
1002
|
+
const h2 = el("h2", { id: "eid-title", "aria-label": this.t.title });
|
|
1003
|
+
h2.append(this.brand());
|
|
1004
|
+
head.append(h2, x);
|
|
990
1005
|
this.body = el("div");
|
|
991
1006
|
this.live = el("p", { class: "sr-only", "aria-live": "polite" });
|
|
992
1007
|
dlg.append(head, this.body, this.live);
|
|
993
|
-
bd
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1008
|
+
let bd = dlg;
|
|
1009
|
+
if (modal) {
|
|
1010
|
+
dlg.addEventListener("mousedown", (e) => {
|
|
1011
|
+
const r = dlg.getBoundingClientRect();
|
|
1012
|
+
const m = e;
|
|
1013
|
+
if (m.clientX < r.left || m.clientX > r.right || m.clientY < r.top || m.clientY > r.bottom) this.close();
|
|
1014
|
+
});
|
|
1015
|
+
dlg.addEventListener("cancel", (e) => {
|
|
1016
|
+
e.preventDefault();
|
|
1017
|
+
this.close();
|
|
1018
|
+
});
|
|
1019
|
+
} else {
|
|
1020
|
+
bd = el("div", { class: "backdrop", part: "backdrop" });
|
|
1021
|
+
bd.append(dlg);
|
|
1022
|
+
bd.addEventListener("mousedown", (e) => {
|
|
1023
|
+
if (e.target === bd) this.close();
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
997
1026
|
bd.addEventListener("keydown", (e) => this.onKey(e));
|
|
998
1027
|
this.root.append(bd);
|
|
999
1028
|
this.backdrop = bd;
|
|
1029
|
+
if (modal) dlg.showModal();
|
|
1000
1030
|
this.showLoading();
|
|
1001
1031
|
x.focus();
|
|
1002
1032
|
void this.begin(gen, { mode: "qr" });
|
|
@@ -1007,8 +1037,10 @@ var EidLoginButton = class extends Base {
|
|
|
1007
1037
|
clearTimeout(this.timer);
|
|
1008
1038
|
clearInterval(this.tick);
|
|
1009
1039
|
if (!this.backdrop) return;
|
|
1010
|
-
this.backdrop
|
|
1040
|
+
const bd = this.backdrop;
|
|
1011
1041
|
this.backdrop = null;
|
|
1042
|
+
if (bd.localName === "dialog" && bd.hasAttribute("open")) bd.close();
|
|
1043
|
+
bd.remove();
|
|
1012
1044
|
this.lastFocus?.focus?.();
|
|
1013
1045
|
if (!this.lastFocus) this.trigger.focus();
|
|
1014
1046
|
}
|
package/dist/button.d.cts
CHANGED
|
@@ -82,6 +82,8 @@ declare class EidLoginButton extends Base {
|
|
|
82
82
|
attributeChangedCallback(name: string): void;
|
|
83
83
|
/** Trigger-ийн агуулга: label / icon / variant / aria-label-аас. Хоосон товч хэзээ ч үүсгэхгүй. */
|
|
84
84
|
private renderTrigger;
|
|
85
|
+
/** Лого + i18n-ийн өмнөх/дараах текст. Лого aria-hidden — дуудагч бүтэн нэрийг aria-label-аар өгнө. */
|
|
86
|
+
private brand;
|
|
85
87
|
disconnectedCallback(): void;
|
|
86
88
|
/** Одоогийн бодит схем (`theme` + auto үед хуудас/OS). */
|
|
87
89
|
get scheme(): Scheme;
|
package/dist/button.d.ts
CHANGED
|
@@ -82,6 +82,8 @@ declare class EidLoginButton extends Base {
|
|
|
82
82
|
attributeChangedCallback(name: string): void;
|
|
83
83
|
/** Trigger-ийн агуулга: label / icon / variant / aria-label-аас. Хоосон товч хэзээ ч үүсгэхгүй. */
|
|
84
84
|
private renderTrigger;
|
|
85
|
+
/** Лого + i18n-ийн өмнөх/дараах текст. Лого aria-hidden — дуудагч бүтэн нэрийг aria-label-аар өгнө. */
|
|
86
|
+
private brand;
|
|
85
87
|
disconnectedCallback(): void;
|
|
86
88
|
/** Одоогийн бодит схем (`theme` + auto үед хуудас/OS). */
|
|
87
89
|
get scheme(): Scheme;
|
package/dist/button.js
CHANGED
|
@@ -9,16 +9,9 @@ function isMobileUserAgent(nav) {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// src/logo.ts
|
|
12
|
-
var EID_LOGO_VIEWBOX = "0 0
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
["path", { d: "M34 4H46A14 14 0 0 1 60 18V46A14 14 0 0 1 46 60H34Z", fill: "#2457E6" }],
|
|
16
|
-
["path", { class: "m-l", d: "M14 32H50A18 18 0 0 0 14 32A18 18 0 0 0 50 32", fill: "none", "stroke-width": "4.8", "stroke-linejoin": "round" }],
|
|
17
|
-
["circle", { class: "m-l", cx: "32", cy: "32", r: "12", fill: "#1564E1", "stroke-width": "1.4" }],
|
|
18
|
-
["path", { d: "M23.5 23.5L40.5 40.5M40.5 23.5L23.5 40.5", stroke: "#FFFFFF", "stroke-width": "1.8" }],
|
|
19
|
-
["circle", { cx: "32", cy: "32", r: "4.4", fill: "#FFFFFF" }],
|
|
20
|
-
["circle", { cx: "32", cy: "32", r: "3", fill: "#1564E1" }]
|
|
21
|
-
];
|
|
12
|
+
var EID_LOGO_VIEWBOX = "0 0 3840 1372";
|
|
13
|
+
var EID_LOGO_TRANSFORM = "translate(0.016725,1765.695476) scale(1,-1)";
|
|
14
|
+
var EID_LOGO_PATH = "M331 1765 c-26 -5 -46 -23 -54 -49 l-2 -7 0 -81 0 -80 2 -9 c9 -25 28 -42 54 -47 6 -1 41 -1 219 -1 237 0 219 1 235 -7 17 -9 32 -28 36 -46 3 -11 2 -160 0 -169 -7 -25 -25 -43 -50 -50 -6 -1 -16 -1 -222 -1 -207 0 -217 0 -223 1 -20 6 -35 19 -44 37 -7 12 -6 8 -7 96 -1 81 -1 82 -3 89 -7 24 -26 42 -50 49 -6 1 -13 2 -85 2 l-78 0 -8 -3 c-25 -7 -43 -25 -49 -50 -2 -7 -2 -11 -2 -276 0 -303 -1 -275 8 -292 3 -7 7 -12 232 -237 225 -225 230 -229 237 -232 16 -8 -12 -7 292 -7 257 0 271 0 277 1 24 7 44 27 49 51 3 10 3 159 0 169 -5 23 -23 42 -47 50 l-7 3 -356 0 -356 1 -8 2 c-21 8 -38 25 -44 46 l-2 8 0 79 c0 88 0 86 6 99 10 18 24 31 45 37 5 1 22 1 361 2 l356 1 7 2 c21 8 36 23 44 44 l3 8 0 134 c0 148 0 141 -6 155 -2 3 -6 9 -8 13 -3 3 -106 106 -229 229 -240 240 -227 227 -244 233 l-8 4 -133 0 c-74 0 -135 -1 -138 -1z M2251 1765 c-26 -5 -46 -23 -54 -49 l-2 -7 0 -629 0 -628 2 -8 c7 -24 23 -40 47 -47 l8 -2 80 0 81 0 8 2 c25 9 42 28 47 54 2 11 2 1247 0 1258 -5 26 -22 45 -47 54 l-8 3 -79 0 c-43 0 -80 -1 -83 -1z M2798 1765 c-26 -6 -48 -27 -53 -52 -2 -6 -2 -58 -2 -499 l1 -491 2 -8 c8 -22 27 -39 49 -45 10 -2 160 -2 170 0 22 6 41 23 49 45 l3 8 0 355 c0 286 1 356 2 361 5 18 19 36 36 45 16 8 -2 7 240 7 l217 0 7 -3 c21 -8 38 -25 44 -46 l2 -8 0 -354 0 -354 -2 -8 c-6 -21 -23 -38 -44 -46 l-7 -2 -219 -1 -219 0 -8 -3 c-19 -7 -33 -19 -41 -35 -8 -16 -8 -14 -8 -103 l1 -78 3 -9 c6 -18 18 -32 34 -40 17 -7 9 -7 157 -7 147 1 135 0 151 8 7 3 12 7 237 232 225 225 229 230 232 237 9 17 8 0 8 209 0 209 1 192 -8 209 -3 7 -7 12 -232 237 -225 225 -230 229 -237 232 -16 8 13 7 -289 8 -218 0 -271 0 -276 -1z M1424 1215 c-24 -5 -43 -24 -50 -48 l-2 -7 0 -80 0 -79 2 -8 c6 -19 19 -35 35 -43 16 -8 -3 -7 237 -7 209 0 215 0 222 2 25 6 45 27 50 52 3 10 3 156 0 166 -5 25 -25 46 -50 52 -7 2 -13 2 -223 2 -185 0 -216 0 -221 -2z";
|
|
22
15
|
|
|
23
16
|
// src/qr.ts
|
|
24
17
|
var ECC_PER_BLOCK_M = [
|
|
@@ -377,10 +370,12 @@ function resolveEidLang(lang) {
|
|
|
377
370
|
var MN = {
|
|
378
371
|
button: "e-ID-\u044D\u044D\u0440 \u043D\u044D\u0432\u0442\u0440\u044D\u0445",
|
|
379
372
|
title: "e-ID-\u044D\u044D\u0440 \u043D\u044D\u0432\u0442\u0440\u044D\u0445",
|
|
373
|
+
// Лого «e-ID» гэж бичигддэг тул логотой үед «e-ID»-г давтахгүй: [лого] нэвтрэх.
|
|
374
|
+
withLogo: ["", "\u043D\u044D\u0432\u0442\u0440\u044D\u0445"],
|
|
380
375
|
close: "\u0425\u0430\u0430\u0445",
|
|
381
376
|
loading: "\u0410\u0447\u0430\u0430\u043B\u0436 \u0431\u0430\u0439\u043D\u0430",
|
|
382
|
-
qrAlt: "\u041D\u044D\u0432\u0442\u0440\u044D\u0445 QR \u043A\u043E\u0434 \u2014 \u0443\u0442\u0441\u0430\u043D \u0434\u044D\u044D\u0440\u0445
|
|
383
|
-
steps: ["\u0423\u0442\u0441\u0430\u043D \u0434\u044D\u044D\u0440\u0445
|
|
377
|
+
qrAlt: "\u041D\u044D\u0432\u0442\u0440\u044D\u0445 QR \u043A\u043E\u0434 \u2014 \u0443\u0442\u0441\u0430\u043D \u0434\u044D\u044D\u0440\u0445 e-ID Mongolia \u0430\u043F\u043F\u0430\u0430\u0440 \u0443\u043D\u0448\u0443\u0443\u043B\u043D\u0430",
|
|
378
|
+
steps: ["\u0423\u0442\u0441\u0430\u043D \u0434\u044D\u044D\u0440\u0445 e-ID Mongolia \u0430\u043F\u043F\u044B\u0433 \u043D\u044D\u044D\u043D\u044D", "QR \u043A\u043E\u0434\u044B\u0433 \u0443\u043D\u0448\u0443\u0443\u043B\u043D\u0430", "PIN1 \u043A\u043E\u0434\u043E\u043E \u043E\u0440\u0443\u0443\u043B\u043D\u0430"],
|
|
384
379
|
vcLabel: "\u0411\u0430\u0442\u0430\u043B\u0433\u0430\u0430\u0436\u0443\u0443\u043B\u0430\u0445 \u043A\u043E\u0434",
|
|
385
380
|
or: "\u044D\u0441\u0432\u044D\u043B",
|
|
386
381
|
usePush: "\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0439\u043D \u0434\u0443\u0433\u0430\u0430\u0440\u0430\u0430\u0440 \u043D\u044D\u0432\u0442\u0440\u044D\u0445",
|
|
@@ -418,10 +413,11 @@ var T = {
|
|
|
418
413
|
en: {
|
|
419
414
|
button: "Log in with e-ID",
|
|
420
415
|
title: "Log in with e-ID",
|
|
416
|
+
withLogo: ["Log in with ", ""],
|
|
421
417
|
close: "Close",
|
|
422
418
|
loading: "Loading",
|
|
423
|
-
qrAlt: "Login QR code \u2014 scan it with the
|
|
424
|
-
steps: ["Open the
|
|
419
|
+
qrAlt: "Login QR code \u2014 scan it with the e-ID Mongolia app on your phone",
|
|
420
|
+
steps: ["Open the e-ID Mongolia app on your phone", "Scan the QR code", "Enter your PIN1"],
|
|
425
421
|
vcLabel: "Verification code",
|
|
426
422
|
or: "or",
|
|
427
423
|
usePush: "Log in with registration number",
|
|
@@ -457,10 +453,11 @@ var T = {
|
|
|
457
453
|
ru: {
|
|
458
454
|
button: "\u0412\u043E\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 e-ID",
|
|
459
455
|
title: "\u0412\u043E\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 e-ID",
|
|
456
|
+
withLogo: ["\u0412\u043E\u0439\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 ", ""],
|
|
460
457
|
close: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C",
|
|
461
458
|
loading: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430",
|
|
462
|
-
qrAlt: "QR-\u043A\u043E\u0434 \u0434\u043B\u044F \u0432\u0445\u043E\u0434\u0430 \u2014 \u043E\u0442\u0441\u043A\u0430\u043D\u0438\u0440\u0443\u0439\u0442\u0435 \u0435\u0433\u043E \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435\u043C
|
|
463
|
-
steps: ["\u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435
|
|
459
|
+
qrAlt: "QR-\u043A\u043E\u0434 \u0434\u043B\u044F \u0432\u0445\u043E\u0434\u0430 \u2014 \u043E\u0442\u0441\u043A\u0430\u043D\u0438\u0440\u0443\u0439\u0442\u0435 \u0435\u0433\u043E \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435\u043C e-ID Mongolia \u043D\u0430 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0435",
|
|
460
|
+
steps: ["\u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435 e-ID Mongolia \u043D\u0430 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0435", "\u041E\u0442\u0441\u043A\u0430\u043D\u0438\u0440\u0443\u0439\u0442\u0435 QR-\u043A\u043E\u0434", "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 PIN1"],
|
|
464
461
|
vcLabel: "\u041A\u043E\u0434 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F",
|
|
465
462
|
or: "\u0438\u043B\u0438",
|
|
466
463
|
usePush: "\u0412\u043E\u0439\u0442\u0438 \u043F\u043E \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u043E\u043D\u043D\u043E\u043C\u0443 \u043D\u043E\u043C\u0435\u0440\u0443",
|
|
@@ -496,10 +493,11 @@ var T = {
|
|
|
496
493
|
zh: {
|
|
497
494
|
button: "\u4F7F\u7528 e-ID \u767B\u5F55",
|
|
498
495
|
title: "\u4F7F\u7528 e-ID \u767B\u5F55",
|
|
496
|
+
withLogo: ["\u4F7F\u7528", "\u767B\u5F55"],
|
|
499
497
|
close: "\u5173\u95ED",
|
|
500
498
|
loading: "\u52A0\u8F7D\u4E2D",
|
|
501
|
-
qrAlt: "\u767B\u5F55\u4E8C\u7EF4\u7801 \u2014 \u8BF7\u7528\u624B\u673A\u4E0A\u7684
|
|
502
|
-
steps: ["\u5728\u624B\u673A\u4E0A\u6253\u5F00
|
|
499
|
+
qrAlt: "\u767B\u5F55\u4E8C\u7EF4\u7801 \u2014 \u8BF7\u7528\u624B\u673A\u4E0A\u7684 e-ID Mongolia \u5E94\u7528\u626B\u63CF",
|
|
500
|
+
steps: ["\u5728\u624B\u673A\u4E0A\u6253\u5F00 e-ID Mongolia \u5E94\u7528", "\u626B\u63CF\u4E8C\u7EF4\u7801", "\u8F93\u5165 PIN1"],
|
|
503
501
|
vcLabel: "\u9A8C\u8BC1\u7801",
|
|
504
502
|
or: "\u6216",
|
|
505
503
|
usePush: "\u4F7F\u7528\u767B\u8BB0\u53F7\u767B\u5F55",
|
|
@@ -535,10 +533,11 @@ var T = {
|
|
|
535
533
|
fr: {
|
|
536
534
|
button: "Se connecter avec e-ID",
|
|
537
535
|
title: "Se connecter avec e-ID",
|
|
536
|
+
withLogo: ["Se connecter avec ", ""],
|
|
538
537
|
close: "Fermer",
|
|
539
538
|
loading: "Chargement",
|
|
540
|
-
qrAlt: "Code QR de connexion \u2014 scannez-le avec l'application
|
|
541
|
-
steps: ["Ouvrez l'application
|
|
539
|
+
qrAlt: "Code QR de connexion \u2014 scannez-le avec l'application e-ID Mongolia sur votre t\xE9l\xE9phone",
|
|
540
|
+
steps: ["Ouvrez l'application e-ID Mongolia sur votre t\xE9l\xE9phone", "Scannez le code QR", "Saisissez votre PIN1"],
|
|
542
541
|
vcLabel: "Code de v\xE9rification",
|
|
543
542
|
or: "ou",
|
|
544
543
|
usePush: "Se connecter avec le num\xE9ro national d'identit\xE9",
|
|
@@ -574,10 +573,11 @@ var T = {
|
|
|
574
573
|
es: {
|
|
575
574
|
button: "Iniciar sesi\xF3n con e-ID",
|
|
576
575
|
title: "Iniciar sesi\xF3n con e-ID",
|
|
576
|
+
withLogo: ["Iniciar sesi\xF3n con ", ""],
|
|
577
577
|
close: "Cerrar",
|
|
578
578
|
loading: "Cargando",
|
|
579
|
-
qrAlt: "C\xF3digo QR de inicio de sesi\xF3n: escan\xE9elo con la aplicaci\xF3n
|
|
580
|
-
steps: ["Abra la aplicaci\xF3n
|
|
579
|
+
qrAlt: "C\xF3digo QR de inicio de sesi\xF3n: escan\xE9elo con la aplicaci\xF3n e-ID Mongolia de su tel\xE9fono",
|
|
580
|
+
steps: ["Abra la aplicaci\xF3n e-ID Mongolia en su tel\xE9fono", "Escanee el c\xF3digo QR", "Introduzca su PIN1"],
|
|
581
581
|
vcLabel: "C\xF3digo de verificaci\xF3n",
|
|
582
582
|
or: "o",
|
|
583
583
|
usePush: "Iniciar sesi\xF3n con el documento nacional de identidad",
|
|
@@ -613,10 +613,11 @@ var T = {
|
|
|
613
613
|
ar: {
|
|
614
614
|
button: "\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u0639\u0628\u0631 e-ID",
|
|
615
615
|
title: "\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u0639\u0628\u0631 e-ID",
|
|
616
|
+
withLogo: ["\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u0639\u0628\u0631 ", ""],
|
|
616
617
|
close: "\u0625\u063A\u0644\u0627\u0642",
|
|
617
618
|
loading: "\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644",
|
|
618
|
-
qrAlt: "\u0631\u0645\u0632 QR \u0644\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u2014 \u0627\u0645\u0633\u062D\u0647 \u0628\u062A\u0637\u0628\u064A\u0642
|
|
619
|
-
steps: ["\u0627\u0641\u062A\u062D \u062A\u0637\u0628\u064A\u0642
|
|
619
|
+
qrAlt: "\u0631\u0645\u0632 QR \u0644\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u2014 \u0627\u0645\u0633\u062D\u0647 \u0628\u062A\u0637\u0628\u064A\u0642 e-ID Mongolia \u0639\u0644\u0649 \u0647\u0627\u062A\u0641\u0643",
|
|
620
|
+
steps: ["\u0627\u0641\u062A\u062D \u062A\u0637\u0628\u064A\u0642 e-ID Mongolia \u0639\u0644\u0649 \u0647\u0627\u062A\u0641\u0643", "\u0627\u0645\u0633\u062D \u0631\u0645\u0632 QR", "\u0623\u062F\u062E\u0644 PIN1"],
|
|
620
621
|
vcLabel: "\u0631\u0645\u0632 \u0627\u0644\u062A\u062D\u0642\u0642",
|
|
621
622
|
or: "\u0623\u0648",
|
|
622
623
|
usePush: "\u062A\u0633\u062C\u064A\u0644 \u0627\u0644\u062F\u062E\u0648\u0644 \u0628\u0631\u0642\u0645 \u0627\u0644\u0647\u0648\u064A\u0629 \u0627\u0644\u0648\u0637\u0646\u064A\u0629",
|
|
@@ -694,8 +695,6 @@ button, input { font-family: inherit; }
|
|
|
694
695
|
`;
|
|
695
696
|
var DARK_CSS = `:host { color-scheme: dark;
|
|
696
697
|
${darkVars} }
|
|
697
|
-
.logo .m-a { fill: #fff; }
|
|
698
|
-
.logo .m-l { stroke: #0A1631; }
|
|
699
698
|
`;
|
|
700
699
|
var CSS_REST = `
|
|
701
700
|
*, *::before, *::after { box-sizing: border-box; }
|
|
@@ -713,18 +712,19 @@ h2, p, ol { margin: 0; }
|
|
|
713
712
|
.btn-outline:hover { background: var(--_eid-bg-muted); }
|
|
714
713
|
.btn-sm { width: auto; min-height: 36px; padding: 0 14px; font-size: 0.8125rem; }
|
|
715
714
|
.trigger { width: auto; }
|
|
716
|
-
.
|
|
717
|
-
.logo
|
|
718
|
-
.
|
|
719
|
-
.trigger.icon-only .logo { width: 24px; height: 24px; }
|
|
715
|
+
.brand { display: inline-flex; align-items: center; gap: 6px; }
|
|
716
|
+
.logo { display: block; flex: none; height: 16px; width: auto; aspect-ratio: 3840 / 1372; fill: currentColor; }
|
|
717
|
+
.trigger.icon-only .logo { height: 12px; }
|
|
720
718
|
.trigger.icon-only { width: 44px; height: 44px; padding: 0; }
|
|
721
719
|
.backdrop { position: fixed; inset: 0; z-index: 2147483000; background: hsl(222 47% 11% / 0.5); display: flex; align-items: center;
|
|
722
720
|
justify-content: center; padding: 16px; overflow-y: auto; }
|
|
721
|
+
dialog.dialog { position: fixed; inset: 0; margin: auto; height: fit-content; width: min(26rem, calc(100% - 32px)); max-width: none; }
|
|
722
|
+
dialog.dialog::backdrop { background: hsl(222 47% 11% / 0.5); }
|
|
723
723
|
.dialog { position: relative; width: 100%; max-width: 26rem; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--_eid-bg);
|
|
724
724
|
color: var(--_eid-fg); border: 1px solid var(--_eid-border); border-radius: var(--_eid-radius-lg); padding: 24px; font-size: 0.875rem; line-height: 1.5rem; }
|
|
725
725
|
@media (max-width: 639px) { .dialog { padding: 16px; } }
|
|
726
726
|
.head { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
|
|
727
|
-
.head .logo {
|
|
727
|
+
.head .logo { height: 20px; }
|
|
728
728
|
.head h2 { flex: 1; font-size: 1.125rem; line-height: 1.75rem; font-weight: 600; }
|
|
729
729
|
.x { width: 36px; height: 36px; border: 0; border-radius: var(--_eid-radius); background: transparent; color: var(--_eid-fg-muted); cursor: pointer; font-size: 1.25rem; line-height: 1; }
|
|
730
730
|
.x:hover { background: var(--_eid-bg-muted); color: var(--_eid-fg); }
|
|
@@ -800,11 +800,10 @@ function logo(attrs = {}) {
|
|
|
800
800
|
for (const [k, v] of Object.entries({ class: "logo", viewBox: EID_LOGO_VIEWBOX, "aria-hidden": "true", focusable: "false", ...attrs })) {
|
|
801
801
|
svg.setAttribute(k, v);
|
|
802
802
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
}
|
|
803
|
+
const path = document.createElementNS(NS, "path");
|
|
804
|
+
path.setAttribute("transform", EID_LOGO_TRANSFORM);
|
|
805
|
+
path.setAttribute("d", EID_LOGO_PATH);
|
|
806
|
+
svg.append(path);
|
|
808
807
|
return svg;
|
|
809
808
|
}
|
|
810
809
|
function chevron() {
|
|
@@ -836,6 +835,7 @@ var EidLoginButton = class extends Base {
|
|
|
836
835
|
root;
|
|
837
836
|
trigger;
|
|
838
837
|
backdrop = null;
|
|
838
|
+
// <dialog> (top layer) эсвэл fallback div
|
|
839
839
|
body;
|
|
840
840
|
live;
|
|
841
841
|
timer = 0;
|
|
@@ -897,16 +897,29 @@ var EidLoginButton = class extends Base {
|
|
|
897
897
|
console.warn('<eid-login-button>: icon="none" \u0431\u0430 \u0442\u0435\u043A\u0441\u0442\u0433\u04AF\u0439 (variant="icon" \u044D\u0441\u0432\u044D\u043B label="") \u2014 \u0430\u043D\u0445\u0434\u0430\u0433\u0447 \u0442\u0435\u043A\u0441\u0442\u0438\u0439\u0433 \u0445\u0430\u0440\u0443\u0443\u043B\u0430\u0432.');
|
|
898
898
|
}
|
|
899
899
|
}
|
|
900
|
+
const brand = hasIcon && !iconOnly && !label;
|
|
900
901
|
const nodes = [];
|
|
901
|
-
if (
|
|
902
|
-
|
|
902
|
+
if (brand) nodes.push(this.brand({ part: "icon" }, { part: "label" }));
|
|
903
|
+
else {
|
|
904
|
+
if (hasIcon) nodes.push(logo({ part: "icon" }));
|
|
905
|
+
if (!iconOnly) nodes.push(el("span", { part: "label" }, text));
|
|
906
|
+
}
|
|
903
907
|
this.trigger.replaceChildren(...nodes);
|
|
904
908
|
this.trigger.classList.toggle("icon-only", iconOnly);
|
|
905
909
|
this.trigger.setAttribute("dir", this.uiDir);
|
|
906
|
-
const aria = this.getAttribute("aria-label") || (iconOnly ? text : null);
|
|
910
|
+
const aria = this.getAttribute("aria-label") || (iconOnly || brand ? text : null);
|
|
907
911
|
if (aria) this.trigger.setAttribute("aria-label", aria);
|
|
908
912
|
else this.trigger.removeAttribute("aria-label");
|
|
909
913
|
}
|
|
914
|
+
/** Лого + i18n-ийн өмнөх/дараах текст. Лого aria-hidden — дуудагч бүтэн нэрийг aria-label-аар өгнө. */
|
|
915
|
+
brand(logoAttrs = {}, textAttrs = {}) {
|
|
916
|
+
const [pre, post] = this.t.withLogo;
|
|
917
|
+
const box = el("span", { class: "brand" });
|
|
918
|
+
if (pre) box.append(el("span", textAttrs, pre));
|
|
919
|
+
box.append(logo(logoAttrs));
|
|
920
|
+
if (post) box.append(el("span", textAttrs, post));
|
|
921
|
+
return box;
|
|
922
|
+
}
|
|
910
923
|
disconnectedCallback() {
|
|
911
924
|
this.close();
|
|
912
925
|
this.themeObs?.disconnect();
|
|
@@ -949,23 +962,40 @@ var EidLoginButton = class extends Base {
|
|
|
949
962
|
this.close();
|
|
950
963
|
const gen = ++this.gen;
|
|
951
964
|
this.lastFocus = this.getRootNode().activeElement ?? document.activeElement;
|
|
952
|
-
const
|
|
953
|
-
const
|
|
965
|
+
const modal = typeof HTMLDialogElement !== "undefined" && typeof HTMLDialogElement.prototype.showModal === "function";
|
|
966
|
+
const attrs = { class: "dialog", "aria-labelledby": "eid-title", part: "dialog", dir: this.uiDir, lang: this.uiLang };
|
|
967
|
+
const dlg = modal ? el("dialog", attrs) : el("div", { ...attrs, role: "dialog", "aria-modal": "true" });
|
|
954
968
|
const head = el("div", { class: "head" });
|
|
955
969
|
const x = el("button", { type: "button", class: "x", "aria-label": this.t.close }, "\xD7");
|
|
956
970
|
x.addEventListener("click", () => this.close());
|
|
957
|
-
const h2 = el("h2", { id: "eid-title"
|
|
958
|
-
|
|
971
|
+
const h2 = el("h2", { id: "eid-title", "aria-label": this.t.title });
|
|
972
|
+
h2.append(this.brand());
|
|
973
|
+
head.append(h2, x);
|
|
959
974
|
this.body = el("div");
|
|
960
975
|
this.live = el("p", { class: "sr-only", "aria-live": "polite" });
|
|
961
976
|
dlg.append(head, this.body, this.live);
|
|
962
|
-
bd
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
977
|
+
let bd = dlg;
|
|
978
|
+
if (modal) {
|
|
979
|
+
dlg.addEventListener("mousedown", (e) => {
|
|
980
|
+
const r = dlg.getBoundingClientRect();
|
|
981
|
+
const m = e;
|
|
982
|
+
if (m.clientX < r.left || m.clientX > r.right || m.clientY < r.top || m.clientY > r.bottom) this.close();
|
|
983
|
+
});
|
|
984
|
+
dlg.addEventListener("cancel", (e) => {
|
|
985
|
+
e.preventDefault();
|
|
986
|
+
this.close();
|
|
987
|
+
});
|
|
988
|
+
} else {
|
|
989
|
+
bd = el("div", { class: "backdrop", part: "backdrop" });
|
|
990
|
+
bd.append(dlg);
|
|
991
|
+
bd.addEventListener("mousedown", (e) => {
|
|
992
|
+
if (e.target === bd) this.close();
|
|
993
|
+
});
|
|
994
|
+
}
|
|
966
995
|
bd.addEventListener("keydown", (e) => this.onKey(e));
|
|
967
996
|
this.root.append(bd);
|
|
968
997
|
this.backdrop = bd;
|
|
998
|
+
if (modal) dlg.showModal();
|
|
969
999
|
this.showLoading();
|
|
970
1000
|
x.focus();
|
|
971
1001
|
void this.begin(gen, { mode: "qr" });
|
|
@@ -976,8 +1006,10 @@ var EidLoginButton = class extends Base {
|
|
|
976
1006
|
clearTimeout(this.timer);
|
|
977
1007
|
clearInterval(this.tick);
|
|
978
1008
|
if (!this.backdrop) return;
|
|
979
|
-
this.backdrop
|
|
1009
|
+
const bd = this.backdrop;
|
|
980
1010
|
this.backdrop = null;
|
|
1011
|
+
if (bd.localName === "dialog" && bd.hasAttribute("open")) bd.close();
|
|
1012
|
+
bd.remove();
|
|
981
1013
|
this.lastFocus?.focus?.();
|
|
982
1014
|
if (!this.lastFocus) this.trigger.focus();
|
|
983
1015
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gerege-systems/eid-mongolia-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.0",
|
|
4
4
|
"description": "e-ID Mongolia Relying Party SDK — иргэнээр утсаар нь нэвтрэлт ба хууль ёсны цахим гарын үсэг (RP-API v3, Smart-ID нийцтэй).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"size:pades": "node scripts/pades-bundle-size.mjs",
|
|
57
57
|
"size:validate": "node scripts/pades-bundle-size.mjs validate",
|
|
58
58
|
"test:compat": "node scripts/test-compat.mjs",
|
|
59
|
+
"test:button-e2e": "npm run build && node scripts/button-e2e.mjs",
|
|
59
60
|
"test:convert-e2e": "npm run build && node scripts/convert-e2e.mjs"
|
|
60
61
|
},
|
|
61
62
|
"keywords": [
|