@waaelg/dga-design-system 0.5.4 → 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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- class c {
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 c(t);
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 B {
55
+ class Dt {
56
56
  constructor(t = document) {
57
57
  this.root = t, this.handleCloseClick = this.handleCloseClick.bind(this), this.init();
58
58
  }
@@ -63,77 +63,328 @@ class B {
63
63
  const e = t.target.closest("[data-alert-close]");
64
64
  if (!e)
65
65
  return;
66
- const s = e.closest(".dga-alert");
67
- s && (s.style.display = "none");
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 h(i) {
74
- return i.startsWith("#") || i.startsWith("var(") ? i : `var(--${i})`;
73
+ function N(s) {
74
+ return s.startsWith("#") || s.startsWith("var(") ? s : `var(--${s})`;
75
75
  }
76
- function u(i = []) {
77
- return `conic-gradient(${i.map(
78
- (e) => `${h(e.color)} ${e.from} ${e.to}`
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 g(i = []) {
82
- return `<div class="dga-pie-chart__labels">${i.map(
83
- (e) => `<span class="dga-pie-chart__label"><span class="dga-pie-chart__circle" style="background-color: ${h(
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 A(i) {
89
- if (!i) return [];
120
+ function bt(s) {
121
+ if (!s) return [];
90
122
  try {
91
- const t = JSON.parse(i);
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 p(i, t = [], { hole: e = !1 } = {}) {
98
- i && (i.classList.add("dga-pie-chart"), i.setAttribute("data-hole", e ? "true" : "false"), i.style.background = u(t), i.innerHTML = g(t));
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)}`;
99
138
  }
100
- class H {
139
+ class Bt {
101
140
  constructor(t, e = []) {
102
141
  this.chart = t, this.data = e, this.init();
103
142
  }
104
143
  init() {
105
- const t = this.chart.getAttribute("data-hole") === "true";
106
- p(this.chart, this.data, { hole: t });
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 });
107
146
  }
108
147
  generateGradient() {
109
- return u(this.data);
148
+ return U(this.data);
110
149
  }
111
150
  generateLabels() {
112
- return g(this.data);
151
+ return Y(this.data);
152
+ }
153
+ }
154
+ function l(s = "") {
155
+ return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
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();
113
364
  }
114
365
  }
115
- async function b(i) {
366
+ async function tt(s) {
116
367
  try {
117
368
  if (navigator.clipboard?.writeText)
118
- return await navigator.clipboard.writeText(i), !0;
369
+ return await navigator.clipboard.writeText(s), !0;
119
370
  } catch {
120
371
  }
121
372
  const t = document.createElement("textarea");
122
- t.value = i, t.setAttribute("readonly", ""), t.style.position = "absolute", t.style.left = "-9999px", document.body.appendChild(t), t.select();
373
+ t.value = s, t.setAttribute("readonly", ""), t.style.position = "absolute", t.style.left = "-9999px", document.body.appendChild(t), t.select();
123
374
  const e = document.execCommand("copy");
124
375
  return document.body.removeChild(t), e;
125
376
  }
126
- const d = `<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
377
+ const K = `<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
127
378
  <rect x="9" y="9" width="11" height="11" rx="2" stroke-width="1.75"></rect>
128
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>
129
380
  </svg>`;
130
- async function m(i, t = 1200) {
131
- const e = i.getAttribute("aria-label") || "Copy code";
132
- i.setAttribute("aria-label", "Copied"), i.setAttribute("data-copied", "true"), window.setTimeout(() => {
133
- i.setAttribute("aria-label", e), i.setAttribute("data-copied", "false");
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");
134
385
  }, t);
135
386
  }
136
- class M {
387
+ class Nt {
137
388
  constructor(t = document) {
138
389
  this.root = t, this.handleCopyClick = this.handleCopyClick.bind(this), this.init();
139
390
  }
@@ -145,19 +396,19 @@ class M {
145
396
  ".dga-code-snippet-inline__copy, .dga-code-snippet-multiline__copy"
146
397
  );
147
398
  if (!e) return;
148
- const s = e.closest(".dga-code-snippet-inline"), n = e.closest(".dga-code-snippet-multiline");
149
- let o = "";
150
- s ? o = s.querySelector(
399
+ const i = e.closest(".dga-code-snippet-inline"), a = e.closest(".dga-code-snippet-multiline");
400
+ let n = "";
401
+ i ? n = i.querySelector(
151
402
  ".dga-code-snippet-inline__content"
152
- )?.textContent?.trim() || "" : n && (o = n.querySelector(
403
+ )?.textContent?.trim() || "" : a && (n = a.querySelector(
153
404
  ".dga-code-snippet-multiline__code code"
154
- )?.textContent || ""), !(!o || !await b(o)) && await m(e);
405
+ )?.textContent || ""), !(!n || !await tt(n)) && await et(e);
155
406
  }
156
407
  destroy() {
157
408
  this.root.removeEventListener("click", this.handleCopyClick);
158
409
  }
159
410
  }
160
- class O {
411
+ class Rt {
161
412
  constructor(t = {}) {
162
413
  if (this.navbar = t.navbar || document.querySelector(".dga-navbar"), this.verifyBar = t.verifyBar || null, !this.navbar) {
163
414
  console.warn("DGA Navbar elements not found");
@@ -184,8 +435,8 @@ class O {
184
435
  }
185
436
  toggleDropdown(t) {
186
437
  t.preventDefault(), t.stopPropagation(), this.verifyBar && this.verifyBar.isOpen && this.verifyBar.closePanel();
187
- const e = t.currentTarget, s = e.parentElement, n = s.classList.contains("active");
188
- this.closeAllDropdowns(), n || (s.classList.add("active"), e.classList.add("dga-menu-item-selected"), e.setAttribute("aria-expanded", "true"), s.querySelector(".dga-dropdown").style.top = `${this.navbarHeight + this.navbarTop}px`);
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`);
189
440
  }
190
441
  toggleMobileMenu(t) {
191
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`;
@@ -202,10 +453,10 @@ class O {
202
453
  closeAllDropdowns(t) {
203
454
  if (t && t.target.closest(".dga-dropdown-content"))
204
455
  return;
205
- this.navbar.querySelectorAll(".dga-menu > li.active").forEach((s) => {
206
- s.classList.remove("active");
207
- const n = s.querySelector(".dga-menu-item");
208
- n?.classList.remove("dga-menu-item-selected"), n?.setAttribute("aria-expanded", "false");
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");
209
460
  });
210
461
  }
211
462
  handleKeyboard(t) {
@@ -232,7 +483,7 @@ class O {
232
483
  return this.navbar.querySelectorAll(".dga-menu > li.active").length > 0;
233
484
  }
234
485
  }
235
- class G {
486
+ class qt {
236
487
  constructor(t = {}) {
237
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 = () => {
238
489
  this.isOpen ? this.closePanel() : this.openPanel();
@@ -255,48 +506,34 @@ class G {
255
506
  this.btn?.removeEventListener("click", this.boundToggle);
256
507
  }
257
508
  }
258
- function a(i = "") {
259
- return String(i).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
260
- }
261
- const C = "info-color";
262
- class k extends HTMLElement {
509
+ const At = "info-color";
510
+ class Ct extends HTMLElement {
263
511
  static get observedAttributes() {
264
512
  return ["variant", "title", "dismissible"];
265
513
  }
266
514
  constructor() {
267
- super(), this._boundDismiss = this._handleDismiss.bind(this);
515
+ super(), this._bodyContent = null, this._boundDismiss = this._handleDismiss.bind(this);
268
516
  }
269
517
  connectedCallback() {
270
- this._scheduleInitialRender();
271
- }
272
- _scheduleInitialRender() {
273
- requestAnimationFrame(() => {
274
- this._captureBodyContent(), this._render();
275
- });
276
- }
277
- _captureBodyContent() {
278
- if (this._bodyContent || this.querySelector(".dga-alert-content"))
279
- return;
280
- const t = this.innerHTML.trim();
281
- t && (this._bodyContent = t);
518
+ this._bodyContent == null && (this._bodyContent = this.innerHTML.trim()), this._render();
282
519
  }
283
520
  disconnectedCallback() {
284
521
  this._closeButton?.removeEventListener("click", this._boundDismiss);
285
522
  }
286
523
  attributeChangedCallback() {
287
- this.isConnected && this._render();
524
+ this._bodyContent != null && this.isConnected && this._render();
288
525
  }
289
526
  _render() {
290
- const t = this.getAttribute("variant") || C, e = this.getAttribute("title") || "", s = this.hasAttribute("dismissible"), n = this._bodyContent || "";
527
+ const t = this.getAttribute("variant") || At, e = this.getAttribute("title") || "", i = this.hasAttribute("dismissible"), a = this._bodyContent || "";
291
528
  this.classList.add("dga-alert"), this.setAttribute("data-variant", t);
292
- const o = e ? `<h4 class="dga-alert-title">${a(e)}</h4>` : "", r = s ? '<button class="dga-alert-close" type="button" data-alert-close aria-label="Dismiss alert">×</button>' : "";
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>' : "";
293
530
  this.innerHTML = `
294
531
  <span class="dga-alert-icon" aria-hidden="true"></span>
295
532
  <div class="dga-alert-content">
296
- ${o}
297
- <div class="dga-alert-body">${n}</div>
533
+ ${n}
534
+ <div class="dga-alert-body">${a}</div>
298
535
  </div>
299
- ${r}
536
+ ${o}
300
537
  `, this._closeButton = this.querySelector("[data-alert-close]"), this._closeButton?.removeEventListener("click", this._boundDismiss), this._closeButton?.addEventListener("click", this._boundDismiss);
301
538
  }
302
539
  _handleDismiss() {
@@ -305,8 +542,8 @@ class k extends HTMLElement {
305
542
  );
306
543
  }
307
544
  }
308
- customElements.define("dga-alert", k);
309
- class w extends HTMLElement {
545
+ customElements.define("dga-alert", Ct);
546
+ class xt extends HTMLElement {
310
547
  static get observedAttributes() {
311
548
  return ["title", "size", "open"];
312
549
  }
@@ -320,79 +557,79 @@ class w extends HTMLElement {
320
557
  this._bodyContent != null && this.isConnected && this._render();
321
558
  }
322
559
  _render() {
323
- const t = this.getAttribute("title") || "", e = this.getAttribute("size") || "md", s = this.hasAttribute("open"), n = this._bodyContent || "";
560
+ const t = this.getAttribute("title") || "", e = this.getAttribute("size") || "md", i = this.hasAttribute("open"), a = this._bodyContent || "";
324
561
  this.innerHTML = `
325
- <div class="dga-acc-item${s ? " dga-acc-item--active" : ""}">
326
- <button class="dga-acc-header" data-size="${a(e)}" aria-expanded="${s ? "true" : "false"}">
327
- <span>${a(t)}</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>
328
565
  </button>
329
566
  <div class="dga-acc-content">
330
- <div class="dga-acc-body">${n}</div>
567
+ <div class="dga-acc-body">${a}</div>
331
568
  </div>
332
569
  </div>
333
570
  `;
334
571
  }
335
572
  }
336
- class L extends HTMLElement {
573
+ class Lt extends HTMLElement {
337
574
  constructor() {
338
575
  super(), this._controller = null;
339
576
  }
340
577
  connectedCallback() {
341
- this.classList.add("dga-acc"), this._controller?.destroy(), this._controller = new c(this);
578
+ this.classList.add("dga-acc"), this._controller?.destroy(), this._controller = new W(this);
342
579
  }
343
580
  disconnectedCallback() {
344
581
  this._controller?.destroy(), this._controller = null;
345
582
  }
346
583
  }
347
- customElements.define("dga-accordion-item", w);
348
- customElements.define("dga-accordion", L);
349
- class E extends HTMLElement {
584
+ customElements.define("dga-accordion-item", xt);
585
+ customElements.define("dga-accordion", Lt);
586
+ class wt extends HTMLElement {
350
587
  static get observedAttributes() {
351
588
  return ["code", "multiline"];
352
589
  }
353
590
  constructor() {
354
- super(), this._boundCopy = this._handleCopy.bind(this);
591
+ super(), this._codeContent = null, this._boundCopy = this._handleCopy.bind(this);
355
592
  }
356
593
  connectedCallback() {
357
- this._codeContent || (this._codeContent = this.getAttribute("code")?.trim() || this.textContent?.trim() || ""), this._render();
594
+ this._codeContent == null && (this._codeContent = this.getAttribute("code")?.trim() || this.textContent?.trim() || ""), this._render();
358
595
  }
359
596
  disconnectedCallback() {
360
597
  this._copyButton?.removeEventListener("click", this._boundCopy);
361
598
  }
362
599
  attributeChangedCallback() {
363
- this.isConnected && this._render();
600
+ this._codeContent != null && this.isConnected && this._render();
364
601
  }
365
602
  _render() {
366
603
  const t = this.hasAttribute("multiline"), e = this.getAttribute("code")?.trim() || this._codeContent || "";
367
604
  t ? (this.innerHTML = `
368
605
  <div class="dga-code-snippet-multiline">
369
606
  <div class="dga-code-snippet-multiline__body">
370
- <pre class="dga-code-snippet-multiline__code"><code>${a(e)}</code></pre>
607
+ <pre class="dga-code-snippet-multiline__code"><code>${l(e)}</code></pre>
371
608
  <button type="button" class="dga-code-snippet-multiline__copy" aria-label="Copy code" data-copied="false">
372
- ${d}
609
+ ${K}
373
610
  </button>
374
611
  </div>
375
612
  </div>
376
613
  `, this._copyButton = this.querySelector(".dga-code-snippet-multiline__copy")) : (this.innerHTML = `
377
614
  <div class="dga-code-snippet-inline">
378
- <div class="dga-code-snippet-inline__content">${a(e)}</div>
615
+ <div class="dga-code-snippet-inline__content">${l(e)}</div>
379
616
  <button type="button" class="dga-code-snippet-inline__copy" aria-label="Copy code" data-copied="false">
380
- ${d}
617
+ ${K}
381
618
  </button>
382
619
  </div>
383
620
  `, this._copyButton = this.querySelector(".dga-code-snippet-inline__copy")), this._copyButton?.removeEventListener("click", this._boundCopy), this._copyButton?.addEventListener("click", this._boundCopy);
384
621
  }
385
622
  async _handleCopy() {
386
623
  const t = this.getAttribute("code")?.trim() || this._codeContent || "";
387
- !t || !this._copyButton || !await b(t) || (await m(this._copyButton), this.dispatchEvent(
624
+ !t || !this._copyButton || !await tt(t) || (await et(this._copyButton), this.dispatchEvent(
388
625
  new CustomEvent("dga-code-copy", { bubbles: !0, composed: !0 })
389
626
  ));
390
627
  }
391
628
  }
392
- customElements.define("dga-code-snippet", E);
393
- class x extends HTMLElement {
629
+ customElements.define("dga-code-snippet", wt);
630
+ class kt extends HTMLElement {
394
631
  static get observedAttributes() {
395
- return ["data", "hole"];
632
+ return ["data", "hole", "style-color"];
396
633
  }
397
634
  connectedCallback() {
398
635
  this._render();
@@ -401,17 +638,103 @@ class x extends HTMLElement {
401
638
  this.isConnected && this._render();
402
639
  }
403
640
  _render() {
404
- const t = A(this.getAttribute("data")), e = this.hasAttribute("hole") && this.getAttribute("hole") !== "false";
405
- p(this, t, { hole: e });
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
+ });
406
729
  }
407
730
  }
408
- customElements.define("dga-pie-chart", x);
409
- const S = {
731
+ customElements.define("dga-line-chart", Et);
732
+ const Mt = {
410
733
  "flag-src": "saudiFlag.svg",
411
734
  "link-icon-src": "link-icon.svg",
412
735
  "lock-icon-src": "square-lock-password.svg",
413
736
  "logo-src": "DGA-logo-icon.svg"
414
- }, D = {
737
+ }, St = {
415
738
  ar: {
416
739
  flagAlt: "علم المملكة العربية السعودية",
417
740
  banner: "موقع حكومي رسمي تابع لحكومة المملكة العربية السعودية",
@@ -437,7 +760,7 @@ const S = {
437
760
  registeredWith: "Registered with the Digital Government Authority under number:"
438
761
  }
439
762
  };
440
- class T extends HTMLElement {
763
+ class Ht extends HTMLElement {
441
764
  static get observedAttributes() {
442
765
  return [
443
766
  "registration-number",
@@ -464,20 +787,20 @@ class T extends HTMLElement {
464
787
  this.isConnected && this._render();
465
788
  }
466
789
  _render() {
467
- const t = this.getAttribute("lang") === "en" ? "en" : "ar", e = t === "en" ? "ltr" : "rtl", s = D[t], n = a(
790
+ const t = this.getAttribute("lang") === "en" ? "en" : "ar", e = t === "en" ? "ltr" : "rtl", i = St[t], a = l(
468
791
  this.getAttribute("registration-number") || "20250105758"
469
- ), o = this.getAttribute("registration-link") || "https://raqmi.dga.gov.sa/platforms/platforms/9ebc5e60-9081-4653-bfb9-08dd2a2f8633/platform-license", r = a(this._normalizeLink(o)), l = a(this.getAttribute("domain") || ".edu.sa"), v = a(this._imageSrc("flag-src")), y = a(this._imageSrc("link-icon-src")), f = a(this._imageSrc("lock-icon-src")), _ = a(this._imageSrc("logo-src"));
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"));
470
793
  this.innerHTML = `
471
794
  <div id="dga-verify-bar" dir="${e}" class="dga-bg-gray-100 closed">
472
795
  <div class="dga-container dga-py-2">
473
796
  <div id="dga-verify-bar_bar" class="dga-row">
474
797
  <div class="dga-col">
475
798
  <div class="dga-d-flex dga-align-items-center dga-gap-2">
476
- <span><img src="${v}" alt="${s.flagAlt}" /></span>
477
- <span class="dga-text-sm">${s.banner}</span>
799
+ <span><img src="${b}" alt="${i.flagAlt}" /></span>
800
+ <span class="dga-text-sm">${i.banner}</span>
478
801
  <span>
479
802
  <button id="dga-verifyBtn" class="dga-btn dga-btn-subtle dga-text-primary-500" data-verify-toggle aria-expanded="false">
480
- ${s.cta}
803
+ ${i.cta}
481
804
  </button>
482
805
  </span>
483
806
  </div>
@@ -487,14 +810,14 @@ class T extends HTMLElement {
487
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"};">
488
811
  <div class="dga-col-md-6 dga-pb-8">
489
812
  <div class="dga-d-flex dga-gap-4">
490
- <div><img src="${y}" alt="" /></div>
813
+ <div><img src="${A}" alt="" /></div>
491
814
  <div class="dga-w-full dga-d-flex dga-flex-col dga-gap-2">
492
815
  <h3 class="dga-text-xl dga-fw-bold">
493
- ${s.domainHeading}
494
- <span class="dga-text-primary-500">${l}</span>
816
+ ${i.domainHeading}
817
+ <span class="dga-text-primary-500">${h}</span>
495
818
  </h3>
496
819
  <p>
497
- ${s.domainBody} ${l}
820
+ ${i.domainBody} ${h}
498
821
  </p>
499
822
  </div>
500
823
  </div>
@@ -502,14 +825,14 @@ class T extends HTMLElement {
502
825
 
503
826
  <div class="dga-col-md-6 dga-pb-8">
504
827
  <div class="dga-d-flex dga-gap-4">
505
- <div><img src="${f}" alt="" /></div>
828
+ <div><img src="${p}" alt="" /></div>
506
829
  <div class="dga-w-full dga-d-flex dga-flex-col dga-gap-2">
507
830
  <h3 class="dga-text-xl dga-fw-bold">
508
- ${s.httpsHeading}
509
- <span class="dga-text-primary-500">HTTPS</span> ${s.httpsHeadingSuffix}
831
+ ${i.httpsHeading}
832
+ <span class="dga-text-primary-500">HTTPS</span> ${i.httpsHeadingSuffix}
510
833
  </h3>
511
834
  <p>
512
- ${s.httpsBody}
835
+ ${i.httpsBody}
513
836
  </p>
514
837
  </div>
515
838
  </div>
@@ -517,9 +840,9 @@ class T extends HTMLElement {
517
840
 
518
841
  <div class="dga-col-12">
519
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">
520
- <img src="${_}" alt="${s.logoAlt}" />
521
- ${s.registeredWith}
522
- <a href="${r}" class="dga-link">${n}</a>
843
+ <img src="${m}" alt="${i.logoAlt}" />
844
+ ${i.registeredWith}
845
+ <a href="${o}" class="dga-link">${a}</a>
523
846
  </div>
524
847
  </div>
525
848
  </div>
@@ -530,8 +853,8 @@ class T extends HTMLElement {
530
853
  _imageSrc(t) {
531
854
  const e = this.getAttribute(t);
532
855
  if (e) return e;
533
- const s = S[t], n = this.getAttribute("assets-base") || "/";
534
- return `${n.endsWith("/") ? n : `${n}/`}${s}`;
856
+ const i = Mt[t], a = this.getAttribute("assets-base") || "/";
857
+ return `${a.endsWith("/") ? a : `${a}/`}${i}`;
535
858
  }
536
859
  _open() {
537
860
  this._content.style.display = "flex", this.isOpen = !0, this._btn?.setAttribute("aria-expanded", "true"), this._wrapper?.classList.replace("closed", "opend");
@@ -547,15 +870,17 @@ class T extends HTMLElement {
547
870
  }
548
871
  }
549
872
  }
550
- customElements.define("dga-verify-bar", T);
551
- const q = !0;
873
+ customElements.define("dga-verify-bar", Ht);
874
+ const Pt = !0;
552
875
  export {
553
- $ as DGAAccordion,
554
- B as DGAAlert,
555
- H as DGAChart,
556
- M as DGACodeSnippet,
557
- O as DGAMenuDropDown,
558
- G as DGAVerifyBar,
559
- q as DGA_WEB_COMPONENTS_REGISTERED
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
560
885
  };
561
886
  //# sourceMappingURL=index.js.map