@waaelg/dga-design-system 0.5.7 → 0.7.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 +7 -3
- package/dist/index.js +445 -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,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class W {
|
|
2
2
|
constructor(t) {
|
|
3
3
|
this.root = t, this.handleClick = this.handleClick.bind(this), this.handleKeydown = this.handleKeydown.bind(this), this.init();
|
|
4
4
|
}
|
|
@@ -32,9 +32,9 @@ class c {
|
|
|
32
32
|
this.root.removeEventListener("click", this.handleClick), this.root.removeEventListener("keydown", this.handleKeydown);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
class
|
|
35
|
+
class Tt {
|
|
36
36
|
constructor(t) {
|
|
37
|
-
this.accordion = t, this.controller = new
|
|
37
|
+
this.accordion = t, this.controller = new W(t);
|
|
38
38
|
}
|
|
39
39
|
toggle(t) {
|
|
40
40
|
this.controller.toggle(t);
|
|
@@ -52,7 +52,7 @@ class $ {
|
|
|
52
52
|
this.controller.destroy();
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
class
|
|
55
|
+
class Dt {
|
|
56
56
|
constructor(t = document) {
|
|
57
57
|
this.root = t, this.handleCloseClick = this.handleCloseClick.bind(this), this.init();
|
|
58
58
|
}
|
|
@@ -63,79 +63,328 @@ class B {
|
|
|
63
63
|
const e = t.target.closest("[data-alert-close]");
|
|
64
64
|
if (!e)
|
|
65
65
|
return;
|
|
66
|
-
const
|
|
67
|
-
|
|
66
|
+
const i = e.closest(".dga-alert");
|
|
67
|
+
i && (i.style.display = "none");
|
|
68
68
|
}
|
|
69
69
|
destroy() {
|
|
70
70
|
this.root.removeEventListener("click", this.handleCloseClick);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
function
|
|
74
|
-
return
|
|
73
|
+
function N(s) {
|
|
74
|
+
return s.startsWith("#") || s.startsWith("var(") ? s : `var(--${s})`;
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
const dt = [
|
|
77
|
+
"dga-primary-700",
|
|
78
|
+
"dga-primary-600",
|
|
79
|
+
"dga-primary-500",
|
|
80
|
+
"dga-primary-400",
|
|
81
|
+
"dga-primary-300",
|
|
82
|
+
"dga-primary-200"
|
|
83
|
+
], F = [
|
|
84
|
+
"dga-gold-500",
|
|
85
|
+
"dga-primary-300",
|
|
86
|
+
"dga-warning-500",
|
|
87
|
+
"dga-info-500",
|
|
88
|
+
"dga-lavender-500",
|
|
89
|
+
"dga-error-500"
|
|
90
|
+
];
|
|
91
|
+
function ht(s) {
|
|
92
|
+
if (s <= 0) return [];
|
|
93
|
+
const t = dt;
|
|
94
|
+
return s === 1 ? [t[Math.floor((t.length - 1) / 2)]] : Array.from(
|
|
95
|
+
{ length: s },
|
|
96
|
+
(e, i) => t[Math.round(i * (t.length - 1) / (s - 1))]
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
function gt(s) {
|
|
100
|
+
return Array.from(
|
|
101
|
+
{ length: Math.max(s, 0) },
|
|
102
|
+
(t, e) => F[e % F.length]
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
function ut(s, t) {
|
|
106
|
+
return s === "color" ? gt(t) : ht(t);
|
|
107
|
+
}
|
|
108
|
+
function U(s = []) {
|
|
109
|
+
return `conic-gradient(${s.map(
|
|
110
|
+
(e) => `${N(e.color)} ${e.from} ${e.to}`
|
|
79
111
|
).join(", ")})`;
|
|
80
112
|
}
|
|
81
|
-
function
|
|
82
|
-
return `<div class="dga-pie-chart__labels">${
|
|
83
|
-
(e) => `<span class="dga-pie-chart__label"><span class="dga-pie-chart__circle" style="background-color: ${
|
|
113
|
+
function Y(s = []) {
|
|
114
|
+
return `<div class="dga-pie-chart__labels">${s.map(
|
|
115
|
+
(e) => `<span class="dga-pie-chart__label"><span class="dga-pie-chart__circle" style="background-color: ${N(
|
|
84
116
|
e.color
|
|
85
117
|
)}"></span>${e.label}</span>`
|
|
86
118
|
).join("")}</div>`;
|
|
87
119
|
}
|
|
88
|
-
function
|
|
89
|
-
if (!
|
|
120
|
+
function bt(s) {
|
|
121
|
+
if (!s) return [];
|
|
90
122
|
try {
|
|
91
|
-
const t = JSON.parse(
|
|
123
|
+
const t = JSON.parse(s);
|
|
92
124
|
return Array.isArray(t) ? t : [];
|
|
93
125
|
} catch {
|
|
94
126
|
return console.warn("dga-pie-chart: invalid data attribute JSON"), [];
|
|
95
127
|
}
|
|
96
128
|
}
|
|
97
|
-
function
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
129
|
+
function V(s, t = [], { hole: e = !1, styleColor: i = "brand" } = {}) {
|
|
130
|
+
if (!s) return;
|
|
131
|
+
const a = i === "color" ? "color" : "brand", n = ut(a, t.length), o = t.map((h, b) => ({
|
|
132
|
+
...h,
|
|
133
|
+
color: h.color || n[b] || "dga-primary-500"
|
|
134
|
+
}));
|
|
135
|
+
s.classList.add("dga-pie-chart"), s.setAttribute("data-hole", e ? "true" : "false"), s.setAttribute("data-style-color", a), s.style.background = "", s.innerHTML = `<span class="dga-pie-chart__disc" style="background: ${U(
|
|
136
|
+
o
|
|
137
|
+
)}"></span>${Y(o)}`;
|
|
101
138
|
}
|
|
102
|
-
class
|
|
139
|
+
class Bt {
|
|
103
140
|
constructor(t, e = []) {
|
|
104
141
|
this.chart = t, this.data = e, this.init();
|
|
105
142
|
}
|
|
106
143
|
init() {
|
|
107
|
-
const t = this.chart.getAttribute("data-hole") === "true";
|
|
108
|
-
|
|
144
|
+
const t = this.chart.getAttribute("data-hole") === "true", e = this.chart.getAttribute("data-style-color") === "color" ? "color" : "brand";
|
|
145
|
+
V(this.chart, this.data, { hole: t, styleColor: e });
|
|
109
146
|
}
|
|
110
147
|
generateGradient() {
|
|
111
|
-
return
|
|
148
|
+
return U(this.data);
|
|
112
149
|
}
|
|
113
150
|
generateLabels() {
|
|
114
|
-
return
|
|
151
|
+
return Y(this.data);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function l(s = "") {
|
|
155
|
+
return String(s).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
156
|
+
}
|
|
157
|
+
const pt = [
|
|
158
|
+
"dga-primary-700",
|
|
159
|
+
"dga-primary-400",
|
|
160
|
+
"dga-gray-200",
|
|
161
|
+
"dga-primary-500",
|
|
162
|
+
"dga-primary-300",
|
|
163
|
+
"dga-gray-400"
|
|
164
|
+
], mt = [
|
|
165
|
+
"dga-gold-500",
|
|
166
|
+
"dga-primary-300",
|
|
167
|
+
"dga-warning-500",
|
|
168
|
+
"dga-info-500",
|
|
169
|
+
"dga-lavender-500",
|
|
170
|
+
"dga-error-500"
|
|
171
|
+
];
|
|
172
|
+
function yt(s, t) {
|
|
173
|
+
const e = s === "color" ? mt : pt;
|
|
174
|
+
return Array.from(
|
|
175
|
+
{ length: Math.max(t, 0) },
|
|
176
|
+
(i, a) => e[a % e.length]
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
function Q(s, t = 8) {
|
|
180
|
+
const e = s > 0 ? s : 1, i = e / t, a = Math.pow(10, Math.floor(Math.log10(i))), n = i / a;
|
|
181
|
+
let o;
|
|
182
|
+
n <= 1 ? o = 1 : n <= 2 ? o = 2 : n <= 2.5 ? o = 2.5 : n <= 5 ? o = 5 : o = 10, o *= a;
|
|
183
|
+
const h = Math.ceil(e / o) * o;
|
|
184
|
+
return { step: o, niceMax: h };
|
|
185
|
+
}
|
|
186
|
+
function J(s) {
|
|
187
|
+
if (!s) return { categories: [], series: [] };
|
|
188
|
+
try {
|
|
189
|
+
const t = JSON.parse(s);
|
|
190
|
+
return {
|
|
191
|
+
categories: Array.isArray(t.categories) ? t.categories : [],
|
|
192
|
+
series: Array.isArray(t.series) ? t.series : []
|
|
193
|
+
};
|
|
194
|
+
} catch {
|
|
195
|
+
return console.warn("dga-bar-chart: invalid data attribute JSON"), { categories: [], series: [] };
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function X(s, t = {}) {
|
|
199
|
+
if (!s) return;
|
|
200
|
+
const {
|
|
201
|
+
categories: e = [],
|
|
202
|
+
series: i = [],
|
|
203
|
+
styleColor: a = "brand",
|
|
204
|
+
max: n = null,
|
|
205
|
+
showLegend: o = !0,
|
|
206
|
+
showXLabel: h = !0,
|
|
207
|
+
showYLabel: b = !0,
|
|
208
|
+
xLabel: A = "",
|
|
209
|
+
yLabel: p = ""
|
|
210
|
+
} = t, m = a === "color" ? "color" : "brand", y = yt(m, i.length), x = i.map(
|
|
211
|
+
(c, g) => N(c.color || y[g] || "dga-primary-500")
|
|
212
|
+
), $ = e.map(
|
|
213
|
+
(c, g) => i.reduce((f, u) => f + (Number(u.values?.[g]) || 0), 0)
|
|
214
|
+
), L = Math.max(1, ...$), { step: w, niceMax: E } = Q(Number(n) > 0 ? Number(n) : L), v = [];
|
|
215
|
+
for (let c = E; c >= 0; c -= w) v.push(Math.round(c));
|
|
216
|
+
const M = o ? `<div class="dga-bar-chart__legend">${i.map(
|
|
217
|
+
(c, g) => `<span class="dga-bar-chart__legend-item"><span class="dga-bar-chart__legend-dot" style="background:${x[g]}"></span>${l(
|
|
218
|
+
c.label ?? ""
|
|
219
|
+
)}</span>`
|
|
220
|
+
).join("")}</div>` : "", S = `<div class="dga-bar-chart__y-axis">${v.map((c) => `<span class="dga-bar-chart__y-tick">${c}</span>`).join("")}</div>`, H = `<div class="dga-bar-chart__gridlines">${v.map(() => '<span class="dga-bar-chart__gridline"></span>').join("")}</div>`, R = `<div class="dga-bar-chart__bars">${e.map((c, g) => {
|
|
221
|
+
const f = $[g], u = f / E * 100, T = i.map((D, B) => {
|
|
222
|
+
const O = Number(D.values?.[g]) || 0;
|
|
223
|
+
return `<span class="dga-bar-chart__seg" style="height:${f > 0 ? O / f * 100 : 0}%;background:${x[B]}"></span>`;
|
|
224
|
+
}).join("");
|
|
225
|
+
return `<div class="dga-bar-chart__col"><div class="dga-bar-chart__bar" style="height:${u}%">${T}</div></div>`;
|
|
226
|
+
}).join("")}</div>`, q = `<div class="dga-bar-chart__x-axis">${e.map((c) => `<span class="dga-bar-chart__x-tick">${l(c)}</span>`).join("")}</div>`, P = b && p ? `<div class="dga-bar-chart__axis-title dga-bar-chart__axis-title--y">${l(
|
|
227
|
+
p
|
|
228
|
+
)}</div>` : "", z = h && A ? `<div class="dga-bar-chart__axis-title dga-bar-chart__axis-title--x">${l(
|
|
229
|
+
A
|
|
230
|
+
)}</div>` : "";
|
|
231
|
+
s.classList.add("dga-bar-chart"), s.setAttribute("data-style-color", m), s.innerHTML = `
|
|
232
|
+
${M}
|
|
233
|
+
<div class="dga-bar-chart__frame">
|
|
234
|
+
${P}
|
|
235
|
+
<div class="dga-bar-chart__plot-wrap">
|
|
236
|
+
${S}
|
|
237
|
+
<div class="dga-bar-chart__plot">
|
|
238
|
+
${H}
|
|
239
|
+
${R}
|
|
240
|
+
</div>
|
|
241
|
+
<span class="dga-bar-chart__spacer"></span>
|
|
242
|
+
${q}
|
|
243
|
+
</div>
|
|
244
|
+
${z}
|
|
245
|
+
</div>
|
|
246
|
+
`;
|
|
247
|
+
}
|
|
248
|
+
class Ot {
|
|
249
|
+
constructor(t, e = {}) {
|
|
250
|
+
this.chart = t, this.config = e, this.render();
|
|
251
|
+
}
|
|
252
|
+
render() {
|
|
253
|
+
X(this.chart, this.config);
|
|
254
|
+
}
|
|
255
|
+
update(t = {}) {
|
|
256
|
+
this.config = { ...this.config, ...t }, this.render();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const vt = [
|
|
260
|
+
"dga-primary-700",
|
|
261
|
+
"dga-primary-500",
|
|
262
|
+
"dga-primary-300",
|
|
263
|
+
"dga-primary-600",
|
|
264
|
+
"dga-primary-400",
|
|
265
|
+
"dga-primary-200"
|
|
266
|
+
], ft = [
|
|
267
|
+
"dga-gold-500",
|
|
268
|
+
"dga-primary-300",
|
|
269
|
+
"dga-warning-500",
|
|
270
|
+
"dga-info-500",
|
|
271
|
+
"dga-lavender-500",
|
|
272
|
+
"dga-error-500"
|
|
273
|
+
];
|
|
274
|
+
function _t(s, t) {
|
|
275
|
+
const e = s === "color" ? ft : vt;
|
|
276
|
+
return Array.from(
|
|
277
|
+
{ length: Math.max(t, 0) },
|
|
278
|
+
(i, a) => e[a % e.length]
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
function Z(s, t = {}) {
|
|
282
|
+
if (!s) return;
|
|
283
|
+
const {
|
|
284
|
+
categories: e = [],
|
|
285
|
+
series: i = [],
|
|
286
|
+
styleColor: a = "brand",
|
|
287
|
+
max: n = null,
|
|
288
|
+
showLegend: o = !0,
|
|
289
|
+
showXLabel: h = !0,
|
|
290
|
+
showYLabel: b = !0,
|
|
291
|
+
showContent: A = !0,
|
|
292
|
+
xLabel: p = "",
|
|
293
|
+
yLabel: m = "",
|
|
294
|
+
rtl: y = !1
|
|
295
|
+
} = t, x = a === "color" ? "color" : "brand", $ = _t(x, i.length), L = i.map(
|
|
296
|
+
(r, d) => N(r.color || $[d] || "dga-primary-500")
|
|
297
|
+
);
|
|
298
|
+
let w = 1;
|
|
299
|
+
for (const r of i)
|
|
300
|
+
for (const d of r.values || []) w = Math.max(w, Number(d) || 0);
|
|
301
|
+
const { step: E, niceMax: v } = Q(Number(n) > 0 ? Number(n) : w), M = [];
|
|
302
|
+
for (let r = 0; r <= v; r += E) M.push(Math.round(r));
|
|
303
|
+
const S = 600, H = 300, R = y ? 16 : 44, q = y ? 44 : 16, P = 12, z = 28, c = R, g = S - q, f = P, u = H - z, T = g - c, D = u - f, B = e.length, O = (r) => {
|
|
304
|
+
const d = B <= 1 ? 0.5 : r / (B - 1);
|
|
305
|
+
return y ? g - d * T : c + d * T;
|
|
306
|
+
}, I = (r) => u - Math.max(0, Number(r) || 0) / v * D, st = M.map((r) => {
|
|
307
|
+
const d = u - r / v * D, _ = y ? g + 6 : c - 6, G = y ? "start" : "end";
|
|
308
|
+
return `<line x1="${c}" y1="${d.toFixed(1)}" x2="${g}" y2="${d.toFixed(
|
|
309
|
+
1
|
|
310
|
+
)}" class="dga-line-chart__grid"/><text x="${_}" y="${(d + 4).toFixed(
|
|
311
|
+
1
|
|
312
|
+
)}" text-anchor="${G}" class="dga-line-chart__tick">${r}</text>`;
|
|
313
|
+
}).join(""), it = e.map(
|
|
314
|
+
(r, d) => `<text x="${O(d).toFixed(1)}" y="${(u + 18).toFixed(
|
|
315
|
+
1
|
|
316
|
+
)}" text-anchor="middle" class="dga-line-chart__xtick">${l(
|
|
317
|
+
r
|
|
318
|
+
)}</text>`
|
|
319
|
+
).join(""), at = i.map((r, d) => {
|
|
320
|
+
const _ = e.map((k, C) => [O(C), I(r.values?.[C])]);
|
|
321
|
+
if (_.length === 0) return "";
|
|
322
|
+
const G = _.map((k, C) => `${C === 0 ? "M" : "L"}${k[0].toFixed(1)} ${k[1].toFixed(1)}`).join(" ");
|
|
323
|
+
let j = "";
|
|
324
|
+
if (A) {
|
|
325
|
+
const k = _[0], C = _[_.length - 1];
|
|
326
|
+
j = `<path d="${G} L${C[0].toFixed(1)} ${u} L${k[0].toFixed(
|
|
327
|
+
1
|
|
328
|
+
)} ${u} Z" style="fill:${L[d]};fill-opacity:.12;stroke:none"/>`;
|
|
329
|
+
}
|
|
330
|
+
const ct = `<path d="${G}" style="fill:none;stroke:${L[d]};stroke-width:2;stroke-linejoin:round;stroke-linecap:round"/>`;
|
|
331
|
+
return j + ct;
|
|
332
|
+
}).join(""), nt = `<svg viewBox="0 0 ${S} ${H}" class="dga-line-chart__svg" preserveAspectRatio="xMidYMid meet" role="img">${st}${at}${it}</svg>`, ot = o ? `<div class="dga-line-chart__legend">${i.map(
|
|
333
|
+
(r, d) => `<span class="dga-line-chart__legend-item"><span class="dga-line-chart__legend-dot" style="background:${L[d]}"></span>${l(
|
|
334
|
+
r.label ?? ""
|
|
335
|
+
)}</span>`
|
|
336
|
+
).join("")}</div>` : "", rt = b && m ? `<div class="dga-line-chart__axis-title dga-line-chart__axis-title--y">${l(
|
|
337
|
+
m
|
|
338
|
+
)}</div>` : "", lt = h && p ? `<div class="dga-line-chart__axis-title dga-line-chart__axis-title--x">${l(
|
|
339
|
+
p
|
|
340
|
+
)}</div>` : "";
|
|
341
|
+
s.classList.add("dga-line-chart"), s.setAttribute("data-style-color", x), s.innerHTML = `
|
|
342
|
+
${ot}
|
|
343
|
+
<div class="dga-line-chart__frame">
|
|
344
|
+
${rt}
|
|
345
|
+
<div class="dga-line-chart__plot">${nt}</div>
|
|
346
|
+
${lt}
|
|
347
|
+
</div>
|
|
348
|
+
`;
|
|
349
|
+
}
|
|
350
|
+
class Gt {
|
|
351
|
+
constructor(t, e = {}) {
|
|
352
|
+
this.chart = t, this.config = e, this.render();
|
|
353
|
+
}
|
|
354
|
+
render() {
|
|
355
|
+
let t = !1;
|
|
356
|
+
try {
|
|
357
|
+
t = getComputedStyle(this.chart).direction === "rtl";
|
|
358
|
+
} catch {
|
|
359
|
+
}
|
|
360
|
+
Z(this.chart, { rtl: t, ...this.config });
|
|
361
|
+
}
|
|
362
|
+
update(t = {}) {
|
|
363
|
+
this.config = { ...this.config, ...t }, this.render();
|
|
115
364
|
}
|
|
116
365
|
}
|
|
117
|
-
async function
|
|
366
|
+
async function tt(s) {
|
|
118
367
|
try {
|
|
119
368
|
if (navigator.clipboard?.writeText)
|
|
120
|
-
return await navigator.clipboard.writeText(
|
|
369
|
+
return await navigator.clipboard.writeText(s), !0;
|
|
121
370
|
} catch {
|
|
122
371
|
}
|
|
123
372
|
const t = document.createElement("textarea");
|
|
124
|
-
t.value =
|
|
373
|
+
t.value = s, t.setAttribute("readonly", ""), t.style.position = "absolute", t.style.left = "-9999px", document.body.appendChild(t), t.select();
|
|
125
374
|
const e = document.execCommand("copy");
|
|
126
375
|
return document.body.removeChild(t), e;
|
|
127
376
|
}
|
|
128
|
-
const
|
|
377
|
+
const K = `<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
|
|
129
378
|
<rect x="9" y="9" width="11" height="11" rx="2" stroke-width="1.75"></rect>
|
|
130
379
|
<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>
|
|
131
380
|
</svg>`;
|
|
132
|
-
async function
|
|
133
|
-
const e =
|
|
134
|
-
|
|
135
|
-
|
|
381
|
+
async function et(s, t = 1200) {
|
|
382
|
+
const e = s.getAttribute("aria-label") || "Copy code";
|
|
383
|
+
s.setAttribute("aria-label", "Copied"), s.setAttribute("data-copied", "true"), window.setTimeout(() => {
|
|
384
|
+
s.setAttribute("aria-label", e), s.setAttribute("data-copied", "false");
|
|
136
385
|
}, t);
|
|
137
386
|
}
|
|
138
|
-
class
|
|
387
|
+
class Nt {
|
|
139
388
|
constructor(t = document) {
|
|
140
389
|
this.root = t, this.handleCopyClick = this.handleCopyClick.bind(this), this.init();
|
|
141
390
|
}
|
|
@@ -147,19 +396,19 @@ class M {
|
|
|
147
396
|
".dga-code-snippet-inline__copy, .dga-code-snippet-multiline__copy"
|
|
148
397
|
);
|
|
149
398
|
if (!e) return;
|
|
150
|
-
const
|
|
151
|
-
let
|
|
152
|
-
|
|
399
|
+
const i = e.closest(".dga-code-snippet-inline"), a = e.closest(".dga-code-snippet-multiline");
|
|
400
|
+
let n = "";
|
|
401
|
+
i ? n = i.querySelector(
|
|
153
402
|
".dga-code-snippet-inline__content"
|
|
154
|
-
)?.textContent?.trim() || "" :
|
|
403
|
+
)?.textContent?.trim() || "" : a && (n = a.querySelector(
|
|
155
404
|
".dga-code-snippet-multiline__code code"
|
|
156
|
-
)?.textContent || ""), !(!
|
|
405
|
+
)?.textContent || ""), !(!n || !await tt(n)) && await et(e);
|
|
157
406
|
}
|
|
158
407
|
destroy() {
|
|
159
408
|
this.root.removeEventListener("click", this.handleCopyClick);
|
|
160
409
|
}
|
|
161
410
|
}
|
|
162
|
-
class
|
|
411
|
+
class Rt {
|
|
163
412
|
constructor(t = {}) {
|
|
164
413
|
if (this.navbar = t.navbar || document.querySelector(".dga-navbar"), this.verifyBar = t.verifyBar || null, !this.navbar) {
|
|
165
414
|
console.warn("DGA Navbar elements not found");
|
|
@@ -186,8 +435,8 @@ class O {
|
|
|
186
435
|
}
|
|
187
436
|
toggleDropdown(t) {
|
|
188
437
|
t.preventDefault(), t.stopPropagation(), this.verifyBar && this.verifyBar.isOpen && this.verifyBar.closePanel();
|
|
189
|
-
const e = t.currentTarget,
|
|
190
|
-
this.closeAllDropdowns(),
|
|
438
|
+
const e = t.currentTarget, i = e.parentElement, a = i.classList.contains("active");
|
|
439
|
+
this.closeAllDropdowns(), a || (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`);
|
|
191
440
|
}
|
|
192
441
|
toggleMobileMenu(t) {
|
|
193
442
|
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`;
|
|
@@ -204,10 +453,10 @@ class O {
|
|
|
204
453
|
closeAllDropdowns(t) {
|
|
205
454
|
if (t && t.target.closest(".dga-dropdown-content"))
|
|
206
455
|
return;
|
|
207
|
-
this.navbar.querySelectorAll(".dga-menu > li.active").forEach((
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
|
|
456
|
+
this.navbar.querySelectorAll(".dga-menu > li.active").forEach((i) => {
|
|
457
|
+
i.classList.remove("active");
|
|
458
|
+
const a = i.querySelector(".dga-menu-item");
|
|
459
|
+
a?.classList.remove("dga-menu-item-selected"), a?.setAttribute("aria-expanded", "false");
|
|
211
460
|
});
|
|
212
461
|
}
|
|
213
462
|
handleKeyboard(t) {
|
|
@@ -234,7 +483,7 @@ class O {
|
|
|
234
483
|
return this.navbar.querySelectorAll(".dga-menu > li.active").length > 0;
|
|
235
484
|
}
|
|
236
485
|
}
|
|
237
|
-
class
|
|
486
|
+
class qt {
|
|
238
487
|
constructor(t = {}) {
|
|
239
488
|
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 = () => {
|
|
240
489
|
this.isOpen ? this.closePanel() : this.openPanel();
|
|
@@ -257,11 +506,8 @@ class G {
|
|
|
257
506
|
this.btn?.removeEventListener("click", this.boundToggle);
|
|
258
507
|
}
|
|
259
508
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
const C = "info-color";
|
|
264
|
-
class k extends HTMLElement {
|
|
509
|
+
const At = "info-color";
|
|
510
|
+
class Ct extends HTMLElement {
|
|
265
511
|
static get observedAttributes() {
|
|
266
512
|
return ["variant", "title", "dismissible"];
|
|
267
513
|
}
|
|
@@ -278,16 +524,16 @@ class k extends HTMLElement {
|
|
|
278
524
|
this._bodyContent != null && this.isConnected && this._render();
|
|
279
525
|
}
|
|
280
526
|
_render() {
|
|
281
|
-
const t = this.getAttribute("variant") ||
|
|
527
|
+
const t = this.getAttribute("variant") || At, e = this.getAttribute("title") || "", i = this.hasAttribute("dismissible"), a = this._bodyContent || "";
|
|
282
528
|
this.classList.add("dga-alert"), this.setAttribute("data-variant", t);
|
|
283
|
-
const
|
|
529
|
+
const n = e ? `<h4 class="dga-alert-title">${l(e)}</h4>` : "", o = i ? '<button class="dga-alert-close" type="button" data-alert-close aria-label="Dismiss alert">×</button>' : "";
|
|
284
530
|
this.innerHTML = `
|
|
285
531
|
<span class="dga-alert-icon" aria-hidden="true"></span>
|
|
286
532
|
<div class="dga-alert-content">
|
|
287
|
-
${
|
|
288
|
-
<div class="dga-alert-body">${
|
|
533
|
+
${n}
|
|
534
|
+
<div class="dga-alert-body">${a}</div>
|
|
289
535
|
</div>
|
|
290
|
-
${
|
|
536
|
+
${o}
|
|
291
537
|
`, this._closeButton = this.querySelector("[data-alert-close]"), this._closeButton?.removeEventListener("click", this._boundDismiss), this._closeButton?.addEventListener("click", this._boundDismiss);
|
|
292
538
|
}
|
|
293
539
|
_handleDismiss() {
|
|
@@ -296,8 +542,8 @@ class k extends HTMLElement {
|
|
|
296
542
|
);
|
|
297
543
|
}
|
|
298
544
|
}
|
|
299
|
-
customElements.define("dga-alert",
|
|
300
|
-
class
|
|
545
|
+
customElements.define("dga-alert", Ct);
|
|
546
|
+
class xt extends HTMLElement {
|
|
301
547
|
static get observedAttributes() {
|
|
302
548
|
return ["title", "size", "open"];
|
|
303
549
|
}
|
|
@@ -311,33 +557,33 @@ class w extends HTMLElement {
|
|
|
311
557
|
this._bodyContent != null && this.isConnected && this._render();
|
|
312
558
|
}
|
|
313
559
|
_render() {
|
|
314
|
-
const t = this.getAttribute("title") || "", e = this.getAttribute("size") || "md",
|
|
560
|
+
const t = this.getAttribute("title") || "", e = this.getAttribute("size") || "md", i = this.hasAttribute("open"), a = this._bodyContent || "";
|
|
315
561
|
this.innerHTML = `
|
|
316
|
-
<div class="dga-acc-item${
|
|
317
|
-
<button class="dga-acc-header" data-size="${
|
|
318
|
-
<span>${
|
|
562
|
+
<div class="dga-acc-item${i ? " dga-acc-item--active" : ""}">
|
|
563
|
+
<button class="dga-acc-header" data-size="${l(e)}" aria-expanded="${i ? "true" : "false"}">
|
|
564
|
+
<span>${l(t)}</span>
|
|
319
565
|
</button>
|
|
320
566
|
<div class="dga-acc-content">
|
|
321
|
-
<div class="dga-acc-body">${
|
|
567
|
+
<div class="dga-acc-body">${a}</div>
|
|
322
568
|
</div>
|
|
323
569
|
</div>
|
|
324
570
|
`;
|
|
325
571
|
}
|
|
326
572
|
}
|
|
327
|
-
class
|
|
573
|
+
class Lt extends HTMLElement {
|
|
328
574
|
constructor() {
|
|
329
575
|
super(), this._controller = null;
|
|
330
576
|
}
|
|
331
577
|
connectedCallback() {
|
|
332
|
-
this.classList.add("dga-acc"), this._controller?.destroy(), this._controller = new
|
|
578
|
+
this.classList.add("dga-acc"), this._controller?.destroy(), this._controller = new W(this);
|
|
333
579
|
}
|
|
334
580
|
disconnectedCallback() {
|
|
335
581
|
this._controller?.destroy(), this._controller = null;
|
|
336
582
|
}
|
|
337
583
|
}
|
|
338
|
-
customElements.define("dga-accordion-item",
|
|
339
|
-
customElements.define("dga-accordion",
|
|
340
|
-
class
|
|
584
|
+
customElements.define("dga-accordion-item", xt);
|
|
585
|
+
customElements.define("dga-accordion", Lt);
|
|
586
|
+
class wt extends HTMLElement {
|
|
341
587
|
static get observedAttributes() {
|
|
342
588
|
return ["code", "multiline"];
|
|
343
589
|
}
|
|
@@ -358,32 +604,32 @@ class E extends HTMLElement {
|
|
|
358
604
|
t ? (this.innerHTML = `
|
|
359
605
|
<div class="dga-code-snippet-multiline">
|
|
360
606
|
<div class="dga-code-snippet-multiline__body">
|
|
361
|
-
<pre class="dga-code-snippet-multiline__code"><code>${
|
|
607
|
+
<pre class="dga-code-snippet-multiline__code"><code>${l(e)}</code></pre>
|
|
362
608
|
<button type="button" class="dga-code-snippet-multiline__copy" aria-label="Copy code" data-copied="false">
|
|
363
|
-
${
|
|
609
|
+
${K}
|
|
364
610
|
</button>
|
|
365
611
|
</div>
|
|
366
612
|
</div>
|
|
367
613
|
`, this._copyButton = this.querySelector(".dga-code-snippet-multiline__copy")) : (this.innerHTML = `
|
|
368
614
|
<div class="dga-code-snippet-inline">
|
|
369
|
-
<div class="dga-code-snippet-inline__content">${
|
|
615
|
+
<div class="dga-code-snippet-inline__content">${l(e)}</div>
|
|
370
616
|
<button type="button" class="dga-code-snippet-inline__copy" aria-label="Copy code" data-copied="false">
|
|
371
|
-
${
|
|
617
|
+
${K}
|
|
372
618
|
</button>
|
|
373
619
|
</div>
|
|
374
620
|
`, this._copyButton = this.querySelector(".dga-code-snippet-inline__copy")), this._copyButton?.removeEventListener("click", this._boundCopy), this._copyButton?.addEventListener("click", this._boundCopy);
|
|
375
621
|
}
|
|
376
622
|
async _handleCopy() {
|
|
377
623
|
const t = this.getAttribute("code")?.trim() || this._codeContent || "";
|
|
378
|
-
!t || !this._copyButton || !await
|
|
624
|
+
!t || !this._copyButton || !await tt(t) || (await et(this._copyButton), this.dispatchEvent(
|
|
379
625
|
new CustomEvent("dga-code-copy", { bubbles: !0, composed: !0 })
|
|
380
626
|
));
|
|
381
627
|
}
|
|
382
628
|
}
|
|
383
|
-
customElements.define("dga-code-snippet",
|
|
384
|
-
class
|
|
629
|
+
customElements.define("dga-code-snippet", wt);
|
|
630
|
+
class kt extends HTMLElement {
|
|
385
631
|
static get observedAttributes() {
|
|
386
|
-
return ["data", "hole"];
|
|
632
|
+
return ["data", "hole", "style-color"];
|
|
387
633
|
}
|
|
388
634
|
connectedCallback() {
|
|
389
635
|
this._render();
|
|
@@ -392,17 +638,103 @@ class x extends HTMLElement {
|
|
|
392
638
|
this.isConnected && this._render();
|
|
393
639
|
}
|
|
394
640
|
_render() {
|
|
395
|
-
const t =
|
|
396
|
-
|
|
641
|
+
const t = bt(this.getAttribute("data")), e = this.hasAttribute("hole") && this.getAttribute("hole") !== "false", i = this.getAttribute("style-color") === "color" ? "color" : "brand";
|
|
642
|
+
V(this, t, { hole: e, styleColor: i });
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
customElements.define("dga-pie-chart", kt);
|
|
646
|
+
class $t extends HTMLElement {
|
|
647
|
+
static get observedAttributes() {
|
|
648
|
+
return [
|
|
649
|
+
"data",
|
|
650
|
+
"style-color",
|
|
651
|
+
"max",
|
|
652
|
+
"x-label",
|
|
653
|
+
"y-label",
|
|
654
|
+
"show-legend",
|
|
655
|
+
"show-x-label",
|
|
656
|
+
"show-y-label"
|
|
657
|
+
];
|
|
658
|
+
}
|
|
659
|
+
connectedCallback() {
|
|
660
|
+
this._render();
|
|
661
|
+
}
|
|
662
|
+
attributeChangedCallback() {
|
|
663
|
+
this.isConnected && this._render();
|
|
664
|
+
}
|
|
665
|
+
_bool(t) {
|
|
666
|
+
const e = this.getAttribute(t);
|
|
667
|
+
return e === null ? !0 : e !== "false";
|
|
668
|
+
}
|
|
669
|
+
_render() {
|
|
670
|
+
const { categories: t, series: e } = J(this.getAttribute("data"));
|
|
671
|
+
X(this, {
|
|
672
|
+
categories: t,
|
|
673
|
+
series: e,
|
|
674
|
+
styleColor: this.getAttribute("style-color") === "color" ? "color" : "brand",
|
|
675
|
+
max: this.getAttribute("max"),
|
|
676
|
+
xLabel: this.getAttribute("x-label") || "",
|
|
677
|
+
yLabel: this.getAttribute("y-label") || "",
|
|
678
|
+
showLegend: this._bool("show-legend"),
|
|
679
|
+
showXLabel: this._bool("show-x-label"),
|
|
680
|
+
showYLabel: this._bool("show-y-label")
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
customElements.define("dga-bar-chart", $t);
|
|
685
|
+
class Et extends HTMLElement {
|
|
686
|
+
static get observedAttributes() {
|
|
687
|
+
return [
|
|
688
|
+
"data",
|
|
689
|
+
"style-color",
|
|
690
|
+
"max",
|
|
691
|
+
"x-label",
|
|
692
|
+
"y-label",
|
|
693
|
+
"show-legend",
|
|
694
|
+
"show-x-label",
|
|
695
|
+
"show-y-label",
|
|
696
|
+
"show-content"
|
|
697
|
+
];
|
|
698
|
+
}
|
|
699
|
+
connectedCallback() {
|
|
700
|
+
this._render();
|
|
701
|
+
}
|
|
702
|
+
attributeChangedCallback() {
|
|
703
|
+
this.isConnected && this._render();
|
|
704
|
+
}
|
|
705
|
+
_bool(t) {
|
|
706
|
+
const e = this.getAttribute(t);
|
|
707
|
+
return e === null ? !0 : e !== "false";
|
|
708
|
+
}
|
|
709
|
+
_render() {
|
|
710
|
+
const { categories: t, series: e } = J(this.getAttribute("data"));
|
|
711
|
+
let i = !1;
|
|
712
|
+
try {
|
|
713
|
+
i = getComputedStyle(this).direction === "rtl";
|
|
714
|
+
} catch {
|
|
715
|
+
}
|
|
716
|
+
Z(this, {
|
|
717
|
+
categories: t,
|
|
718
|
+
series: e,
|
|
719
|
+
rtl: i,
|
|
720
|
+
styleColor: this.getAttribute("style-color") === "color" ? "color" : "brand",
|
|
721
|
+
max: this.getAttribute("max"),
|
|
722
|
+
xLabel: this.getAttribute("x-label") || "",
|
|
723
|
+
yLabel: this.getAttribute("y-label") || "",
|
|
724
|
+
showLegend: this._bool("show-legend"),
|
|
725
|
+
showXLabel: this._bool("show-x-label"),
|
|
726
|
+
showYLabel: this._bool("show-y-label"),
|
|
727
|
+
showContent: this._bool("show-content")
|
|
728
|
+
});
|
|
397
729
|
}
|
|
398
730
|
}
|
|
399
|
-
customElements.define("dga-
|
|
400
|
-
const
|
|
731
|
+
customElements.define("dga-line-chart", Et);
|
|
732
|
+
const Mt = {
|
|
401
733
|
"flag-src": "saudiFlag.svg",
|
|
402
734
|
"link-icon-src": "link-icon.svg",
|
|
403
735
|
"lock-icon-src": "square-lock-password.svg",
|
|
404
736
|
"logo-src": "DGA-logo-icon.svg"
|
|
405
|
-
},
|
|
737
|
+
}, St = {
|
|
406
738
|
ar: {
|
|
407
739
|
flagAlt: "علم المملكة العربية السعودية",
|
|
408
740
|
banner: "موقع حكومي رسمي تابع لحكومة المملكة العربية السعودية",
|
|
@@ -428,7 +760,7 @@ const D = {
|
|
|
428
760
|
registeredWith: "Registered with the Digital Government Authority under number:"
|
|
429
761
|
}
|
|
430
762
|
};
|
|
431
|
-
class
|
|
763
|
+
class Ht extends HTMLElement {
|
|
432
764
|
static get observedAttributes() {
|
|
433
765
|
return [
|
|
434
766
|
"registration-number",
|
|
@@ -455,20 +787,20 @@ class T extends HTMLElement {
|
|
|
455
787
|
this.isConnected && this._render();
|
|
456
788
|
}
|
|
457
789
|
_render() {
|
|
458
|
-
const t = this.getAttribute("lang") === "en" ? "en" : "ar", e = t === "en" ? "ltr" : "rtl",
|
|
790
|
+
const t = this.getAttribute("lang") === "en" ? "en" : "ar", e = t === "en" ? "ltr" : "rtl", i = St[t], a = l(
|
|
459
791
|
this.getAttribute("registration-number") || "20250105758"
|
|
460
|
-
),
|
|
792
|
+
), n = this.getAttribute("registration-link") || "https://raqmi.dga.gov.sa/platforms/platforms/9ebc5e60-9081-4653-bfb9-08dd2a2f8633/platform-license", o = l(this._normalizeLink(n)), h = l(this.getAttribute("domain") || ".edu.sa"), b = l(this._imageSrc("flag-src")), A = l(this._imageSrc("link-icon-src")), p = l(this._imageSrc("lock-icon-src")), m = l(this._imageSrc("logo-src"));
|
|
461
793
|
this.innerHTML = `
|
|
462
794
|
<div id="dga-verify-bar" dir="${e}" class="dga-bg-gray-100 closed">
|
|
463
795
|
<div class="dga-container dga-py-2">
|
|
464
796
|
<div id="dga-verify-bar_bar" class="dga-row">
|
|
465
797
|
<div class="dga-col">
|
|
466
798
|
<div class="dga-d-flex dga-align-items-center dga-gap-2">
|
|
467
|
-
<span><img src="${
|
|
468
|
-
<span class="dga-text-sm">${
|
|
799
|
+
<span><img src="${b}" alt="${i.flagAlt}" /></span>
|
|
800
|
+
<span class="dga-text-sm">${i.banner}</span>
|
|
469
801
|
<span>
|
|
470
802
|
<button id="dga-verifyBtn" class="dga-btn dga-btn-subtle dga-text-primary-500" data-verify-toggle aria-expanded="false">
|
|
471
|
-
${
|
|
803
|
+
${i.cta}
|
|
472
804
|
</button>
|
|
473
805
|
</span>
|
|
474
806
|
</div>
|
|
@@ -478,14 +810,14 @@ class T extends HTMLElement {
|
|
|
478
810
|
<div id="dga-verify-bar_content" class="dga-row dga-pt-10 dga-pb-8" data-verify-content style="display: ${this.isOpen ? "flex" : "none"};">
|
|
479
811
|
<div class="dga-col-md-6 dga-pb-8">
|
|
480
812
|
<div class="dga-d-flex dga-gap-4">
|
|
481
|
-
<div><img src="${
|
|
813
|
+
<div><img src="${A}" alt="" /></div>
|
|
482
814
|
<div class="dga-w-full dga-d-flex dga-flex-col dga-gap-2">
|
|
483
815
|
<h3 class="dga-text-xl dga-fw-bold">
|
|
484
|
-
${
|
|
485
|
-
<span class="dga-text-primary-500">${
|
|
816
|
+
${i.domainHeading}
|
|
817
|
+
<span class="dga-text-primary-500">${h}</span>
|
|
486
818
|
</h3>
|
|
487
819
|
<p>
|
|
488
|
-
${
|
|
820
|
+
${i.domainBody} ${h}
|
|
489
821
|
</p>
|
|
490
822
|
</div>
|
|
491
823
|
</div>
|
|
@@ -493,14 +825,14 @@ class T extends HTMLElement {
|
|
|
493
825
|
|
|
494
826
|
<div class="dga-col-md-6 dga-pb-8">
|
|
495
827
|
<div class="dga-d-flex dga-gap-4">
|
|
496
|
-
<div><img src="${
|
|
828
|
+
<div><img src="${p}" alt="" /></div>
|
|
497
829
|
<div class="dga-w-full dga-d-flex dga-flex-col dga-gap-2">
|
|
498
830
|
<h3 class="dga-text-xl dga-fw-bold">
|
|
499
|
-
${
|
|
500
|
-
<span class="dga-text-primary-500">HTTPS</span> ${
|
|
831
|
+
${i.httpsHeading}
|
|
832
|
+
<span class="dga-text-primary-500">HTTPS</span> ${i.httpsHeadingSuffix}
|
|
501
833
|
</h3>
|
|
502
834
|
<p>
|
|
503
|
-
${
|
|
835
|
+
${i.httpsBody}
|
|
504
836
|
</p>
|
|
505
837
|
</div>
|
|
506
838
|
</div>
|
|
@@ -508,9 +840,9 @@ class T extends HTMLElement {
|
|
|
508
840
|
|
|
509
841
|
<div class="dga-col-12">
|
|
510
842
|
<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">
|
|
511
|
-
<img src="${
|
|
512
|
-
${
|
|
513
|
-
<a href="${
|
|
843
|
+
<img src="${m}" alt="${i.logoAlt}" />
|
|
844
|
+
${i.registeredWith}
|
|
845
|
+
<a href="${o}" class="dga-link">${a}</a>
|
|
514
846
|
</div>
|
|
515
847
|
</div>
|
|
516
848
|
</div>
|
|
@@ -521,8 +853,8 @@ class T extends HTMLElement {
|
|
|
521
853
|
_imageSrc(t) {
|
|
522
854
|
const e = this.getAttribute(t);
|
|
523
855
|
if (e) return e;
|
|
524
|
-
const
|
|
525
|
-
return `${
|
|
856
|
+
const i = Mt[t], a = this.getAttribute("assets-base") || "/";
|
|
857
|
+
return `${a.endsWith("/") ? a : `${a}/`}${i}`;
|
|
526
858
|
}
|
|
527
859
|
_open() {
|
|
528
860
|
this._content.style.display = "flex", this.isOpen = !0, this._btn?.setAttribute("aria-expanded", "true"), this._wrapper?.classList.replace("closed", "opend");
|
|
@@ -538,15 +870,17 @@ class T extends HTMLElement {
|
|
|
538
870
|
}
|
|
539
871
|
}
|
|
540
872
|
}
|
|
541
|
-
customElements.define("dga-verify-bar",
|
|
542
|
-
const
|
|
873
|
+
customElements.define("dga-verify-bar", Ht);
|
|
874
|
+
const Pt = !0;
|
|
543
875
|
export {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
876
|
+
Tt as DGAAccordion,
|
|
877
|
+
Dt as DGAAlert,
|
|
878
|
+
Ot as DGABarChart,
|
|
879
|
+
Bt as DGAChart,
|
|
880
|
+
Nt as DGACodeSnippet,
|
|
881
|
+
Gt as DGALineChart,
|
|
882
|
+
Rt as DGAMenuDropDown,
|
|
883
|
+
qt as DGAVerifyBar,
|
|
884
|
+
Pt as DGA_WEB_COMPONENTS_REGISTERED
|
|
551
885
|
};
|
|
552
886
|
//# sourceMappingURL=index.js.map
|