@waaelg/dga-design-system 0.4.6 → 0.4.8
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/index.js +111 -111
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
class c {
|
|
2
|
-
constructor(
|
|
3
|
-
this.root =
|
|
2
|
+
constructor(t) {
|
|
3
|
+
this.root = t, this.handleClick = this.handleClick.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.init();
|
|
4
4
|
}
|
|
5
5
|
init() {
|
|
6
6
|
this.root.addEventListener("click", this.handleClick), this.root.addEventListener("keydown", this.handleKeydown);
|
|
7
7
|
}
|
|
8
|
-
handleClick(
|
|
9
|
-
const
|
|
10
|
-
|
|
8
|
+
handleClick(t) {
|
|
9
|
+
const e = t.target.closest(".dga-acc-header");
|
|
10
|
+
e && this.root.contains(e) && this.toggle(e);
|
|
11
11
|
}
|
|
12
|
-
handleKeydown(
|
|
13
|
-
const
|
|
14
|
-
!
|
|
12
|
+
handleKeydown(t) {
|
|
13
|
+
const e = t.target.closest(".dga-acc-header");
|
|
14
|
+
!e || !this.root.contains(e) || (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.toggle(e));
|
|
15
15
|
}
|
|
16
|
-
toggle(
|
|
17
|
-
const
|
|
18
|
-
|
|
16
|
+
toggle(t) {
|
|
17
|
+
const e = t.parentElement;
|
|
18
|
+
e && (e.classList.contains("dga-acc-item--active") ? this.close(e) : this.open(e));
|
|
19
19
|
}
|
|
20
|
-
open(
|
|
21
|
-
|
|
20
|
+
open(t) {
|
|
21
|
+
t.classList.add("dga-acc-item--active"), t.querySelector(".dga-acc-header")?.setAttribute("aria-expanded", "true");
|
|
22
22
|
}
|
|
23
|
-
close(
|
|
24
|
-
|
|
23
|
+
close(t) {
|
|
24
|
+
t.classList.remove("dga-acc-item--active"), t.querySelector(".dga-acc-header")?.setAttribute("aria-expanded", "false");
|
|
25
25
|
}
|
|
26
26
|
closeAll() {
|
|
27
|
-
this.root.querySelectorAll(".dga-acc-item").forEach((
|
|
28
|
-
this.close(
|
|
27
|
+
this.root.querySelectorAll(".dga-acc-item").forEach((t) => {
|
|
28
|
+
this.close(t);
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
destroy() {
|
|
@@ -33,17 +33,17 @@ class c {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
class x {
|
|
36
|
-
constructor(
|
|
37
|
-
this.accordion =
|
|
36
|
+
constructor(t) {
|
|
37
|
+
this.accordion = t, this.controller = new c(t);
|
|
38
38
|
}
|
|
39
|
-
toggle(
|
|
40
|
-
this.controller.toggle(
|
|
39
|
+
toggle(t) {
|
|
40
|
+
this.controller.toggle(t);
|
|
41
41
|
}
|
|
42
|
-
open(
|
|
43
|
-
this.controller.open(
|
|
42
|
+
open(t) {
|
|
43
|
+
this.controller.open(t);
|
|
44
44
|
}
|
|
45
|
-
close(
|
|
46
|
-
this.controller.close(
|
|
45
|
+
close(t) {
|
|
46
|
+
this.controller.close(t);
|
|
47
47
|
}
|
|
48
48
|
closeAll() {
|
|
49
49
|
this.controller.closeAll();
|
|
@@ -53,17 +53,17 @@ class x {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
class D {
|
|
56
|
-
constructor(
|
|
57
|
-
this.root =
|
|
56
|
+
constructor(t = document) {
|
|
57
|
+
this.root = t, this.handleCloseClick = this.handleCloseClick.bind(this), this.init();
|
|
58
58
|
}
|
|
59
59
|
init() {
|
|
60
60
|
this.root.addEventListener("click", this.handleCloseClick);
|
|
61
61
|
}
|
|
62
|
-
handleCloseClick(
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
62
|
+
handleCloseClick(t) {
|
|
63
|
+
const e = t.target.closest("[data-alert-close]");
|
|
64
|
+
if (!e)
|
|
65
65
|
return;
|
|
66
|
-
const i =
|
|
66
|
+
const i = e.closest(".dga-alert");
|
|
67
67
|
i && (i.style.display = "none");
|
|
68
68
|
}
|
|
69
69
|
destroy() {
|
|
@@ -75,35 +75,35 @@ function h(s) {
|
|
|
75
75
|
}
|
|
76
76
|
function u(s = []) {
|
|
77
77
|
return `conic-gradient(${s.map(
|
|
78
|
-
(
|
|
78
|
+
(e) => `${h(e.color)} ${e.from} ${e.to}`
|
|
79
79
|
).join(", ")})`;
|
|
80
80
|
}
|
|
81
81
|
function g(s = []) {
|
|
82
82
|
return `<div class="dga-pie-chart__labels">${s.map(
|
|
83
|
-
(
|
|
84
|
-
|
|
85
|
-
)}"></span>${
|
|
83
|
+
(e) => `<span class="dga-pie-chart__label"><span class="dga-pie-chart__circle" style="background-color: ${h(
|
|
84
|
+
e.color
|
|
85
|
+
)}"></span>${e.label}</span>`
|
|
86
86
|
).join("")}</div>`;
|
|
87
87
|
}
|
|
88
88
|
function y(s) {
|
|
89
89
|
if (!s) return [];
|
|
90
90
|
try {
|
|
91
|
-
const
|
|
92
|
-
return Array.isArray(
|
|
91
|
+
const t = JSON.parse(s);
|
|
92
|
+
return Array.isArray(t) ? t : [];
|
|
93
93
|
} catch {
|
|
94
94
|
return console.warn("dga-pie-chart: invalid data attribute JSON"), [];
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
function p(s,
|
|
98
|
-
s && (s.classList.add("dga-pie-chart"), s.setAttribute("data-hole",
|
|
97
|
+
function p(s, t = [], { hole: e = !1 } = {}) {
|
|
98
|
+
s && (s.classList.add("dga-pie-chart"), s.setAttribute("data-hole", e ? "true" : "false"), s.style.background = u(t), s.innerHTML = g(t));
|
|
99
99
|
}
|
|
100
100
|
class T {
|
|
101
|
-
constructor(
|
|
102
|
-
this.chart =
|
|
101
|
+
constructor(t, e = []) {
|
|
102
|
+
this.chart = t, this.data = e, this.init();
|
|
103
103
|
}
|
|
104
104
|
init() {
|
|
105
|
-
const
|
|
106
|
-
p(this.chart, this.data, { hole:
|
|
105
|
+
const t = this.chart.getAttribute("data-hole") === "true";
|
|
106
|
+
p(this.chart, this.data, { hole: t });
|
|
107
107
|
}
|
|
108
108
|
generateGradient() {
|
|
109
109
|
return u(this.data);
|
|
@@ -118,48 +118,48 @@ async function b(s) {
|
|
|
118
118
|
return await navigator.clipboard.writeText(s), !0;
|
|
119
119
|
} catch {
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
return document.body.removeChild(
|
|
121
|
+
const t = document.createElement("textarea");
|
|
122
|
+
t.value = s, t.setAttribute("readonly", ""), t.style.position = "absolute", t.style.left = "-9999px", document.body.appendChild(t), t.select();
|
|
123
|
+
const e = document.execCommand("copy");
|
|
124
|
+
return document.body.removeChild(t), e;
|
|
125
125
|
}
|
|
126
126
|
const d = `<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
|
127
127
|
<rect x="9" y="9" width="11" height="11" rx="2" stroke-width="1.75"></rect>
|
|
128
128
|
<path d="M6 15H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v1" stroke-width="1.75" stroke-linecap="round"></path>
|
|
129
129
|
</svg>`;
|
|
130
|
-
async function m(s,
|
|
131
|
-
const
|
|
130
|
+
async function m(s, t = 1200) {
|
|
131
|
+
const e = s.getAttribute("aria-label") || "Copy code";
|
|
132
132
|
s.setAttribute("aria-label", "Copied"), s.setAttribute("data-copied", "true"), window.setTimeout(() => {
|
|
133
|
-
s.setAttribute("aria-label",
|
|
134
|
-
},
|
|
133
|
+
s.setAttribute("aria-label", e), s.setAttribute("data-copied", "false");
|
|
134
|
+
}, t);
|
|
135
135
|
}
|
|
136
136
|
class S {
|
|
137
|
-
constructor(
|
|
138
|
-
this.root =
|
|
137
|
+
constructor(t = document) {
|
|
138
|
+
this.root = t, this.handleCopyClick = this.handleCopyClick.bind(this), this.init();
|
|
139
139
|
}
|
|
140
140
|
init() {
|
|
141
141
|
this.root.addEventListener("click", this.handleCopyClick);
|
|
142
142
|
}
|
|
143
|
-
async handleCopyClick(
|
|
144
|
-
const
|
|
143
|
+
async handleCopyClick(t) {
|
|
144
|
+
const e = t.target.closest(
|
|
145
145
|
".dga-code-snippet-inline__copy, .dga-code-snippet-multiline__copy"
|
|
146
146
|
);
|
|
147
|
-
if (!
|
|
148
|
-
const i =
|
|
147
|
+
if (!e) return;
|
|
148
|
+
const i = e.closest(".dga-code-snippet-inline"), n = e.closest(".dga-code-snippet-multiline");
|
|
149
149
|
let o = "";
|
|
150
150
|
i ? o = i.querySelector(
|
|
151
151
|
".dga-code-snippet-inline__content"
|
|
152
152
|
)?.textContent?.trim() || "" : n && (o = n.querySelector(
|
|
153
153
|
".dga-code-snippet-multiline__code code"
|
|
154
|
-
)?.textContent || ""), !(!o || !await b(o)) && await m(
|
|
154
|
+
)?.textContent || ""), !(!o || !await b(o)) && await m(e);
|
|
155
155
|
}
|
|
156
156
|
destroy() {
|
|
157
157
|
this.root.removeEventListener("click", this.handleCopyClick);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
class B {
|
|
161
|
-
constructor(
|
|
162
|
-
if (this.navbar =
|
|
161
|
+
constructor(t = {}) {
|
|
162
|
+
if (this.navbar = t.navbar || document.querySelector(".dga-navbar"), this.verifyBar = t.verifyBar || null, !this.navbar) {
|
|
163
163
|
console.warn("DGA Navbar elements not found");
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
@@ -167,7 +167,7 @@ class B {
|
|
|
167
167
|
console.warn("DGA Menu element not found");
|
|
168
168
|
return;
|
|
169
169
|
}
|
|
170
|
-
this.boundToggleDropdown = (
|
|
170
|
+
this.boundToggleDropdown = (e) => this.toggleDropdown(e), this.boundToggleMobileMenu = (e) => this.toggleMobileMenu(e), this.boundCloseAllDropdowns = (e) => this.closeAllDropdowns(e), this.boundHandleResize = () => this.handleResize(), this.boundHandleKeyboard = (e) => this.handleKeyboard(e), this.init();
|
|
171
171
|
}
|
|
172
172
|
get isActive() {
|
|
173
173
|
return this.isMobileMenuOpen() || this.isNormalDropdownOpen();
|
|
@@ -176,31 +176,31 @@ class B {
|
|
|
176
176
|
this.handleResize(), this.bindEvents();
|
|
177
177
|
}
|
|
178
178
|
bindEvents() {
|
|
179
|
-
this.menuItems.forEach((
|
|
180
|
-
|
|
181
|
-
}), this.toggler?.addEventListener("click", this.boundToggleMobileMenu), document.addEventListener("click", this.boundCloseAllDropdowns), window.addEventListener("resize", this.boundHandleResize), this.menuItems.forEach((
|
|
182
|
-
|
|
179
|
+
this.menuItems.forEach((t) => {
|
|
180
|
+
t.addEventListener("click", this.boundToggleDropdown);
|
|
181
|
+
}), this.toggler?.addEventListener("click", this.boundToggleMobileMenu), document.addEventListener("click", this.boundCloseAllDropdowns), window.addEventListener("resize", this.boundHandleResize), this.menuItems.forEach((t) => {
|
|
182
|
+
t.addEventListener("keydown", this.boundHandleKeyboard);
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
|
-
toggleDropdown(
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
this.closeAllDropdowns(), n || (i.classList.add("active"),
|
|
185
|
+
toggleDropdown(t) {
|
|
186
|
+
t.preventDefault(), t.stopPropagation(), this.verifyBar && this.verifyBar.isOpen && this.verifyBar.closePanel();
|
|
187
|
+
const e = t.currentTarget, i = e.parentElement, n = i.classList.contains("active");
|
|
188
|
+
this.closeAllDropdowns(), n || (i.classList.add("active"), e.classList.add("dga-menu-item-selected"), e.setAttribute("aria-expanded", "true"), i.querySelector(".dga-dropdown").style.top = `${this.navbarHeight + this.navbarTop}px`);
|
|
189
189
|
}
|
|
190
|
-
toggleMobileMenu(
|
|
191
|
-
|
|
192
|
-
const
|
|
193
|
-
this.toggler.setAttribute("aria-expanded",
|
|
190
|
+
toggleMobileMenu(t) {
|
|
191
|
+
t.stopPropagation(), this.verifyBar && this.verifyBar.isOpen && this.verifyBar.closePanel(), this.menu.classList.toggle("dga-menu-open"), this.menu.classList.contains("dga-menu-open") ? (document.body.classList.add("no-scroll"), this.menu.style.height = `calc(100vh - ${this.navbarHeight}px - ${this.navbarTop}px)`) : (document.body.classList.remove("no-scroll"), this.menu.style.height = "0px"), this.menu.style.top = `${this.navbarTop + this.navbarHeight}px`;
|
|
192
|
+
const e = this.menu.classList.contains("dga-menu-open");
|
|
193
|
+
this.toggler.setAttribute("aria-expanded", e), this.toggler.setAttribute(
|
|
194
194
|
"aria-label",
|
|
195
|
-
|
|
195
|
+
e ? "Close menu" : "Open menu"
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
198
|
// Public method to close menu programmatically (without event)
|
|
199
199
|
closeMenu() {
|
|
200
200
|
this.closeAllDropdowns(), this.isMobileMenuOpen() && (this.menu.classList.remove("dga-menu-open"), document.body.classList.remove("no-scroll"), this.menu.style.height = "0px", this.toggler.setAttribute("aria-expanded", "false"), this.toggler.setAttribute("aria-label", "Open menu"));
|
|
201
201
|
}
|
|
202
|
-
closeAllDropdowns(
|
|
203
|
-
if (
|
|
202
|
+
closeAllDropdowns(t) {
|
|
203
|
+
if (t && t.target.closest(".dga-dropdown-content"))
|
|
204
204
|
return;
|
|
205
205
|
this.navbar.querySelectorAll(".dga-menu > li.active").forEach((i) => {
|
|
206
206
|
i.classList.remove("active");
|
|
@@ -208,21 +208,21 @@ class B {
|
|
|
208
208
|
n?.classList.remove("dga-menu-item-selected"), n?.setAttribute("aria-expanded", "false");
|
|
209
209
|
});
|
|
210
210
|
}
|
|
211
|
-
handleKeyboard(
|
|
212
|
-
|
|
211
|
+
handleKeyboard(t) {
|
|
212
|
+
t.key === "Escape" && (this.closeAllDropdowns(), t.currentTarget.focus()), (t.key === "Enter" || t.key === " ") && (t.preventDefault(), this.toggleDropdown(t));
|
|
213
213
|
}
|
|
214
214
|
handleResize() {
|
|
215
|
-
const
|
|
215
|
+
const t = window.innerWidth;
|
|
216
216
|
document.body.classList.remove(
|
|
217
217
|
"size_desktop",
|
|
218
218
|
"size_tablet",
|
|
219
219
|
"size_mobile"
|
|
220
|
-
),
|
|
220
|
+
), t > 769 ? (document.body.classList.add("size_desktop"), this.closeAllDropdowns(), this.menu.classList.remove("dga-menu-open"), document.body.classList.remove("no-scroll")) : t <= 769 && t > 375 ? document.body.classList.add("size_tablet") : document.body.classList.add("size_mobile");
|
|
221
221
|
}
|
|
222
222
|
// Public method to destroy the component
|
|
223
223
|
destroy() {
|
|
224
|
-
this.menuItems.forEach((
|
|
225
|
-
|
|
224
|
+
this.menuItems.forEach((t) => {
|
|
225
|
+
t.removeEventListener("click", this.boundToggleDropdown), t.removeEventListener("keydown", this.boundHandleKeyboard);
|
|
226
226
|
}), this.toggler?.removeEventListener("click", this.boundToggleMobileMenu), document.removeEventListener("click", this.boundCloseAllDropdowns), window.removeEventListener("resize", this.boundHandleResize);
|
|
227
227
|
}
|
|
228
228
|
isMobileMenuOpen() {
|
|
@@ -233,8 +233,8 @@ class B {
|
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
class M {
|
|
236
|
-
constructor(
|
|
237
|
-
if (this.isOpen = !1, this.verifyBar = document.getElementById("dga-verify-bar"), this.menu =
|
|
236
|
+
constructor(t = {}) {
|
|
237
|
+
if (this.isOpen = !1, this.verifyBar = document.getElementById("dga-verify-bar"), this.menu = t.menu || null, this.btn = document.getElementById("dga-verifyBtn"), this.content = document.getElementById("dga-verify-bar_content"), this.boundToggle = () => {
|
|
238
238
|
this.isOpen ? this.closePanel() : this.openPanel();
|
|
239
239
|
}, !this.verifyBar || !this.btn || !this.content) {
|
|
240
240
|
console.warn("DGA Verify Bar elements not found");
|
|
@@ -246,10 +246,10 @@ class M {
|
|
|
246
246
|
this.btn.addEventListener("click", this.boundToggle);
|
|
247
247
|
}
|
|
248
248
|
openPanel() {
|
|
249
|
-
this.menu && this.menu.isActive && this.menu.closeMenu(), this.content.style.display = "flex", this.isOpen = !0, this.verifyBar.classList.add("opend"), this.verifyBar.classList.remove("closed");
|
|
249
|
+
this.menu && this.menu.isActive && this.menu.closeMenu(), this.content.style.display = "flex", this.isOpen = !0, this.verifyBar.classList.add("opend"), this.verifyBar.classList.remove("closed"), this.btn?.setAttribute("aria-expanded", "true");
|
|
250
250
|
}
|
|
251
251
|
closePanel() {
|
|
252
|
-
this.content.style.display = "none", this.isOpen = !1, this.verifyBar.classList.add("closed"), this.verifyBar.classList.remove("opend");
|
|
252
|
+
this.content.style.display = "none", this.isOpen = !1, this.verifyBar.classList.add("closed"), this.verifyBar.classList.remove("opend"), this.btn?.setAttribute("aria-expanded", "false");
|
|
253
253
|
}
|
|
254
254
|
destroy() {
|
|
255
255
|
this.btn?.removeEventListener("click", this.boundToggle);
|
|
@@ -277,8 +277,8 @@ class _ extends HTMLElement {
|
|
|
277
277
|
_captureBodyContent() {
|
|
278
278
|
if (this._bodyContent || this.querySelector(".dga-alert-content"))
|
|
279
279
|
return;
|
|
280
|
-
const
|
|
281
|
-
|
|
280
|
+
const t = this.innerHTML.trim();
|
|
281
|
+
t && (this._bodyContent = t);
|
|
282
282
|
}
|
|
283
283
|
disconnectedCallback() {
|
|
284
284
|
this._closeButton?.removeEventListener("click", this._boundDismiss);
|
|
@@ -287,9 +287,9 @@ class _ extends HTMLElement {
|
|
|
287
287
|
this.isConnected && this._render();
|
|
288
288
|
}
|
|
289
289
|
_render() {
|
|
290
|
-
const
|
|
291
|
-
this.
|
|
292
|
-
const o =
|
|
290
|
+
const t = this.getAttribute("variant") || f, e = this.getAttribute("title") || "", i = this.hasAttribute("dismissible"), n = this._bodyContent || "";
|
|
291
|
+
this.classList.add("dga-alert"), this.setAttribute("data-variant", t);
|
|
292
|
+
const o = e ? `<h4 class="dga-alert-title">${a(e)}</h4>` : "", r = i ? '<button class="dga-alert-close" type="button" data-alert-close aria-label="Dismiss alert">×</button>' : "";
|
|
293
293
|
this.innerHTML = `
|
|
294
294
|
<span class="dga-alert-icon" aria-hidden="true"></span>
|
|
295
295
|
<div class="dga-alert-content">
|
|
@@ -317,11 +317,11 @@ class C extends HTMLElement {
|
|
|
317
317
|
this.isConnected && this._render();
|
|
318
318
|
}
|
|
319
319
|
_render() {
|
|
320
|
-
const
|
|
320
|
+
const t = this.getAttribute("title") || "", e = this.getAttribute("size") || "md", i = this.hasAttribute("open"), n = this._bodyContent || "";
|
|
321
321
|
this.innerHTML = `
|
|
322
322
|
<div class="dga-acc-item${i ? " dga-acc-item--active" : ""}">
|
|
323
|
-
<button class="dga-acc-header" data-size="${a(
|
|
324
|
-
<span>${a(
|
|
323
|
+
<button class="dga-acc-header" data-size="${a(e)}" aria-expanded="${i ? "true" : "false"}">
|
|
324
|
+
<span>${a(t)}</span>
|
|
325
325
|
</button>
|
|
326
326
|
<div class="dga-acc-content">
|
|
327
327
|
<div class="dga-acc-body">${n}</div>
|
|
@@ -360,11 +360,11 @@ class k extends HTMLElement {
|
|
|
360
360
|
this.isConnected && this._render();
|
|
361
361
|
}
|
|
362
362
|
_render() {
|
|
363
|
-
const
|
|
364
|
-
|
|
363
|
+
const t = this.hasAttribute("multiline"), e = this.getAttribute("code")?.trim() || this._codeContent || "";
|
|
364
|
+
t ? (this.innerHTML = `
|
|
365
365
|
<div class="dga-code-snippet-multiline">
|
|
366
366
|
<div class="dga-code-snippet-multiline__body">
|
|
367
|
-
<pre class="dga-code-snippet-multiline__code"><code>${a(
|
|
367
|
+
<pre class="dga-code-snippet-multiline__code"><code>${a(e)}</code></pre>
|
|
368
368
|
<button type="button" class="dga-code-snippet-multiline__copy" aria-label="Copy code" data-copied="false">
|
|
369
369
|
${d}
|
|
370
370
|
</button>
|
|
@@ -372,7 +372,7 @@ class k extends HTMLElement {
|
|
|
372
372
|
</div>
|
|
373
373
|
`, this._copyButton = this.querySelector(".dga-code-snippet-multiline__copy")) : (this.innerHTML = `
|
|
374
374
|
<div class="dga-code-snippet-inline">
|
|
375
|
-
<div class="dga-code-snippet-inline__content">${a(
|
|
375
|
+
<div class="dga-code-snippet-inline__content">${a(e)}</div>
|
|
376
376
|
<button type="button" class="dga-code-snippet-inline__copy" aria-label="Copy code" data-copied="false">
|
|
377
377
|
${d}
|
|
378
378
|
</button>
|
|
@@ -380,8 +380,8 @@ class k extends HTMLElement {
|
|
|
380
380
|
`, this._copyButton = this.querySelector(".dga-code-snippet-inline__copy")), this._copyButton?.removeEventListener("click", this._boundCopy), this._copyButton?.addEventListener("click", this._boundCopy);
|
|
381
381
|
}
|
|
382
382
|
async _handleCopy() {
|
|
383
|
-
const
|
|
384
|
-
!
|
|
383
|
+
const t = this.getAttribute("code")?.trim() || this._codeContent || "";
|
|
384
|
+
!t || !this._copyButton || !await b(t) || (await m(this._copyButton), this.dispatchEvent(
|
|
385
385
|
new CustomEvent("dga-code-copy", { bubbles: !0, composed: !0 })
|
|
386
386
|
));
|
|
387
387
|
}
|
|
@@ -398,8 +398,8 @@ class L extends HTMLElement {
|
|
|
398
398
|
this.isConnected && this._render();
|
|
399
399
|
}
|
|
400
400
|
_render() {
|
|
401
|
-
const
|
|
402
|
-
p(this,
|
|
401
|
+
const t = y(this.getAttribute("data")), e = this.hasAttribute("hole") && this.getAttribute("hole") !== "false";
|
|
402
|
+
p(this, t, { hole: e });
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
405
|
customElements.define("dga-pie-chart", L);
|
|
@@ -435,9 +435,9 @@ class w extends HTMLElement {
|
|
|
435
435
|
this.isConnected && this._render();
|
|
436
436
|
}
|
|
437
437
|
_render() {
|
|
438
|
-
const
|
|
438
|
+
const t = a(
|
|
439
439
|
this.getAttribute("registration-number") || "20250105758"
|
|
440
|
-
),
|
|
440
|
+
), e = this.getAttribute("registration-link") || "https://raqmi.dga.gov.sa/platforms/platforms/9ebc5e60-9081-4653-bfb9-08dd2a2f8633/platform-license", i = a(this._normalizeLink(e)), n = a(this.getAttribute("domain") || ".edu.sa"), o = a(this._imageSrc("flag-src")), r = a(this._imageSrc("link-icon-src")), l = a(this._imageSrc("lock-icon-src")), v = a(this._imageSrc("logo-src"));
|
|
441
441
|
this.innerHTML = `
|
|
442
442
|
<div id="dga-verify-bar" class="dga-bg-gray-100 closed">
|
|
443
443
|
<div class="dga-container dga-py-2">
|
|
@@ -492,7 +492,7 @@ class w extends HTMLElement {
|
|
|
492
492
|
<div class="dga-d-flex dga-align-items-center dga-gap-3 dga-bg-white dga-text-md dga-rounded-md dga-py-2 dga-px-7">
|
|
493
493
|
<img src="${v}" alt="شعار هيئة الحكومة الرقمية" />
|
|
494
494
|
مسجل لدى هيئة الحكومة الرقمية برقم :
|
|
495
|
-
<a href="${i}" class="dga-link">${
|
|
495
|
+
<a href="${i}" class="dga-link">${t}</a>
|
|
496
496
|
</div>
|
|
497
497
|
</div>
|
|
498
498
|
</div>
|
|
@@ -500,10 +500,10 @@ class w extends HTMLElement {
|
|
|
500
500
|
</div>
|
|
501
501
|
`, this._btn?.removeEventListener("click", this._boundToggle), this._wrapper = this.querySelector("#dga-verify-bar"), this._btn = this.querySelector("[data-verify-toggle]"), this._content = this.querySelector("[data-verify-content]"), this._btn?.addEventListener("click", this._boundToggle);
|
|
502
502
|
}
|
|
503
|
-
_imageSrc(
|
|
504
|
-
const
|
|
505
|
-
if (
|
|
506
|
-
const i = E[
|
|
503
|
+
_imageSrc(t) {
|
|
504
|
+
const e = this.getAttribute(t);
|
|
505
|
+
if (e) return e;
|
|
506
|
+
const i = E[t], n = this.getAttribute("assets-base") || "/";
|
|
507
507
|
return `${n.endsWith("/") ? n : `${n}/`}${i}`;
|
|
508
508
|
}
|
|
509
509
|
_open() {
|
|
@@ -512,9 +512,9 @@ class w extends HTMLElement {
|
|
|
512
512
|
_close() {
|
|
513
513
|
this._content.style.display = "none", this.isOpen = !1, this._btn?.setAttribute("aria-expanded", "false"), this._wrapper?.classList.replace("opend", "closed");
|
|
514
514
|
}
|
|
515
|
-
_normalizeLink(
|
|
515
|
+
_normalizeLink(t) {
|
|
516
516
|
try {
|
|
517
|
-
return new URL(
|
|
517
|
+
return new URL(t, window.location.href).href;
|
|
518
518
|
} catch {
|
|
519
519
|
return "#";
|
|
520
520
|
}
|