@gerege-systems/eid-mongolia-sdk 0.38.1 → 0.39.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 +2 -1
- package/dist/button.cjs +28 -7
- package/dist/button.js +28 -7
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -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,7 +201,7 @@ 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
206
|
eid-login-button::part(icon) { width: 24px; height: 24px; }
|
|
206
207
|
```
|
package/dist/button.cjs
CHANGED
|
@@ -751,6 +751,8 @@ h2, p, ol { margin: 0; }
|
|
|
751
751
|
.trigger.icon-only { width: 44px; height: 44px; padding: 0; }
|
|
752
752
|
.backdrop { position: fixed; inset: 0; z-index: 2147483000; background: hsl(222 47% 11% / 0.5); display: flex; align-items: center;
|
|
753
753
|
justify-content: center; padding: 16px; overflow-y: auto; }
|
|
754
|
+
dialog.dialog { position: fixed; inset: 0; margin: auto; height: fit-content; width: min(26rem, calc(100% - 32px)); max-width: none; }
|
|
755
|
+
dialog.dialog::backdrop { background: hsl(222 47% 11% / 0.5); }
|
|
754
756
|
.dialog { position: relative; width: 100%; max-width: 26rem; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--_eid-bg);
|
|
755
757
|
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
758
|
@media (max-width: 639px) { .dialog { padding: 16px; } }
|
|
@@ -867,6 +869,7 @@ var EidLoginButton = class extends Base {
|
|
|
867
869
|
root;
|
|
868
870
|
trigger;
|
|
869
871
|
backdrop = null;
|
|
872
|
+
// <dialog> (top layer) эсвэл fallback div
|
|
870
873
|
body;
|
|
871
874
|
live;
|
|
872
875
|
timer = 0;
|
|
@@ -980,8 +983,9 @@ var EidLoginButton = class extends Base {
|
|
|
980
983
|
this.close();
|
|
981
984
|
const gen = ++this.gen;
|
|
982
985
|
this.lastFocus = this.getRootNode().activeElement ?? document.activeElement;
|
|
983
|
-
const
|
|
984
|
-
const
|
|
986
|
+
const modal = typeof HTMLDialogElement !== "undefined" && typeof HTMLDialogElement.prototype.showModal === "function";
|
|
987
|
+
const attrs = { class: "dialog", "aria-labelledby": "eid-title", part: "dialog", dir: this.uiDir, lang: this.uiLang };
|
|
988
|
+
const dlg = modal ? el("dialog", attrs) : el("div", { ...attrs, role: "dialog", "aria-modal": "true" });
|
|
985
989
|
const head = el("div", { class: "head" });
|
|
986
990
|
const x = el("button", { type: "button", class: "x", "aria-label": this.t.close }, "\xD7");
|
|
987
991
|
x.addEventListener("click", () => this.close());
|
|
@@ -990,13 +994,28 @@ var EidLoginButton = class extends Base {
|
|
|
990
994
|
this.body = el("div");
|
|
991
995
|
this.live = el("p", { class: "sr-only", "aria-live": "polite" });
|
|
992
996
|
dlg.append(head, this.body, this.live);
|
|
993
|
-
bd
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
+
let bd = dlg;
|
|
998
|
+
if (modal) {
|
|
999
|
+
dlg.addEventListener("mousedown", (e) => {
|
|
1000
|
+
const r = dlg.getBoundingClientRect();
|
|
1001
|
+
const m = e;
|
|
1002
|
+
if (m.clientX < r.left || m.clientX > r.right || m.clientY < r.top || m.clientY > r.bottom) this.close();
|
|
1003
|
+
});
|
|
1004
|
+
dlg.addEventListener("cancel", (e) => {
|
|
1005
|
+
e.preventDefault();
|
|
1006
|
+
this.close();
|
|
1007
|
+
});
|
|
1008
|
+
} else {
|
|
1009
|
+
bd = el("div", { class: "backdrop", part: "backdrop" });
|
|
1010
|
+
bd.append(dlg);
|
|
1011
|
+
bd.addEventListener("mousedown", (e) => {
|
|
1012
|
+
if (e.target === bd) this.close();
|
|
1013
|
+
});
|
|
1014
|
+
}
|
|
997
1015
|
bd.addEventListener("keydown", (e) => this.onKey(e));
|
|
998
1016
|
this.root.append(bd);
|
|
999
1017
|
this.backdrop = bd;
|
|
1018
|
+
if (modal) dlg.showModal();
|
|
1000
1019
|
this.showLoading();
|
|
1001
1020
|
x.focus();
|
|
1002
1021
|
void this.begin(gen, { mode: "qr" });
|
|
@@ -1007,8 +1026,10 @@ var EidLoginButton = class extends Base {
|
|
|
1007
1026
|
clearTimeout(this.timer);
|
|
1008
1027
|
clearInterval(this.tick);
|
|
1009
1028
|
if (!this.backdrop) return;
|
|
1010
|
-
this.backdrop
|
|
1029
|
+
const bd = this.backdrop;
|
|
1011
1030
|
this.backdrop = null;
|
|
1031
|
+
if (bd.localName === "dialog" && bd.hasAttribute("open")) bd.close();
|
|
1032
|
+
bd.remove();
|
|
1012
1033
|
this.lastFocus?.focus?.();
|
|
1013
1034
|
if (!this.lastFocus) this.trigger.focus();
|
|
1014
1035
|
}
|
package/dist/button.js
CHANGED
|
@@ -720,6 +720,8 @@ h2, p, ol { margin: 0; }
|
|
|
720
720
|
.trigger.icon-only { width: 44px; height: 44px; padding: 0; }
|
|
721
721
|
.backdrop { position: fixed; inset: 0; z-index: 2147483000; background: hsl(222 47% 11% / 0.5); display: flex; align-items: center;
|
|
722
722
|
justify-content: center; padding: 16px; overflow-y: auto; }
|
|
723
|
+
dialog.dialog { position: fixed; inset: 0; margin: auto; height: fit-content; width: min(26rem, calc(100% - 32px)); max-width: none; }
|
|
724
|
+
dialog.dialog::backdrop { background: hsl(222 47% 11% / 0.5); }
|
|
723
725
|
.dialog { position: relative; width: 100%; max-width: 26rem; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--_eid-bg);
|
|
724
726
|
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
727
|
@media (max-width: 639px) { .dialog { padding: 16px; } }
|
|
@@ -836,6 +838,7 @@ var EidLoginButton = class extends Base {
|
|
|
836
838
|
root;
|
|
837
839
|
trigger;
|
|
838
840
|
backdrop = null;
|
|
841
|
+
// <dialog> (top layer) эсвэл fallback div
|
|
839
842
|
body;
|
|
840
843
|
live;
|
|
841
844
|
timer = 0;
|
|
@@ -949,8 +952,9 @@ var EidLoginButton = class extends Base {
|
|
|
949
952
|
this.close();
|
|
950
953
|
const gen = ++this.gen;
|
|
951
954
|
this.lastFocus = this.getRootNode().activeElement ?? document.activeElement;
|
|
952
|
-
const
|
|
953
|
-
const
|
|
955
|
+
const modal = typeof HTMLDialogElement !== "undefined" && typeof HTMLDialogElement.prototype.showModal === "function";
|
|
956
|
+
const attrs = { class: "dialog", "aria-labelledby": "eid-title", part: "dialog", dir: this.uiDir, lang: this.uiLang };
|
|
957
|
+
const dlg = modal ? el("dialog", attrs) : el("div", { ...attrs, role: "dialog", "aria-modal": "true" });
|
|
954
958
|
const head = el("div", { class: "head" });
|
|
955
959
|
const x = el("button", { type: "button", class: "x", "aria-label": this.t.close }, "\xD7");
|
|
956
960
|
x.addEventListener("click", () => this.close());
|
|
@@ -959,13 +963,28 @@ var EidLoginButton = class extends Base {
|
|
|
959
963
|
this.body = el("div");
|
|
960
964
|
this.live = el("p", { class: "sr-only", "aria-live": "polite" });
|
|
961
965
|
dlg.append(head, this.body, this.live);
|
|
962
|
-
bd
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
+
let bd = dlg;
|
|
967
|
+
if (modal) {
|
|
968
|
+
dlg.addEventListener("mousedown", (e) => {
|
|
969
|
+
const r = dlg.getBoundingClientRect();
|
|
970
|
+
const m = e;
|
|
971
|
+
if (m.clientX < r.left || m.clientX > r.right || m.clientY < r.top || m.clientY > r.bottom) this.close();
|
|
972
|
+
});
|
|
973
|
+
dlg.addEventListener("cancel", (e) => {
|
|
974
|
+
e.preventDefault();
|
|
975
|
+
this.close();
|
|
976
|
+
});
|
|
977
|
+
} else {
|
|
978
|
+
bd = el("div", { class: "backdrop", part: "backdrop" });
|
|
979
|
+
bd.append(dlg);
|
|
980
|
+
bd.addEventListener("mousedown", (e) => {
|
|
981
|
+
if (e.target === bd) this.close();
|
|
982
|
+
});
|
|
983
|
+
}
|
|
966
984
|
bd.addEventListener("keydown", (e) => this.onKey(e));
|
|
967
985
|
this.root.append(bd);
|
|
968
986
|
this.backdrop = bd;
|
|
987
|
+
if (modal) dlg.showModal();
|
|
969
988
|
this.showLoading();
|
|
970
989
|
x.focus();
|
|
971
990
|
void this.begin(gen, { mode: "qr" });
|
|
@@ -976,8 +995,10 @@ var EidLoginButton = class extends Base {
|
|
|
976
995
|
clearTimeout(this.timer);
|
|
977
996
|
clearInterval(this.tick);
|
|
978
997
|
if (!this.backdrop) return;
|
|
979
|
-
this.backdrop
|
|
998
|
+
const bd = this.backdrop;
|
|
980
999
|
this.backdrop = null;
|
|
1000
|
+
if (bd.localName === "dialog" && bd.hasAttribute("open")) bd.close();
|
|
1001
|
+
bd.remove();
|
|
981
1002
|
this.lastFocus?.focus?.();
|
|
982
1003
|
if (!this.lastFocus) this.trigger.focus();
|
|
983
1004
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gerege-systems/eid-mongolia-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.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": [
|