@ogcio/design-system-react 1.23.0 → 1.25.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.
@@ -1,282 +0,0 @@
1
- "use client";
2
- const w = {
3
- desktop: { chromium: 109, gecko: 128, webkit: 16 },
4
- mobile: { chromium: 114, gecko: 128, webkit: 16 }
5
- }, C = {
6
- title: "Limited browser support detected",
7
- message: (e, t) => `${e}${t} is not officially supported. Please update or switch to a supported browser for the best experience.`,
8
- linkText: "View supported browsers",
9
- linkHref: "https://ds.services.gov.ie/get-started/developers/supported-browsers/"
10
- };
11
- function M(e) {
12
- return e.length === 0 ? "" : e.charAt(0).toUpperCase() + e.slice(1);
13
- }
14
- function u(e) {
15
- return e !== null ? Number.parseInt(e[1], 10) : 0;
16
- }
17
- function V(e) {
18
- if (e.length === 0)
19
- return "chrome";
20
- const t = e.toLowerCase();
21
- return t.includes("google chrome") ? "chrome" : t.includes("edge") ? "edge" : t.includes("opera") ? "opera" : t.includes("vivaldi") ? "vivaldi" : t.includes("brave") ? "brave" : t.includes("arc") ? "arc" : t.includes("samsung") ? "samsung" : t.includes("yabrowser") ? "yandex" : t.includes("whale") ? "whale" : t.includes("firefox") ? "firefox" : t.includes("safari") ? "safari" : t;
22
- }
23
- function B(e) {
24
- const t = /FxiOS\/(\d+)/.exec(e), n = /Firefox\/(\d+)/.exec(e), r = u(t);
25
- return r || u(n);
26
- }
27
- function L(e, t) {
28
- const n = /Version\/(\d+)/.exec(e);
29
- if (n)
30
- return u(n);
31
- if (t) {
32
- const r = /OS (\d+)_\d+(_\d+)? like Mac OS X/.exec(e), i = u(r);
33
- if (i > 0)
34
- return i;
35
- }
36
- return 0;
37
- }
38
- function T(e) {
39
- return e.edgeMatch ? "edge" : e.operaMatch ? "opera" : e.hasVivaldi ? "vivaldi" : e.yandexMatch ? "yandex" : e.whaleMatch ? "whale" : e.braveMatch ? "brave" : e.arcMatch ? "arc" : e.samsungMatch ? "samsung" : "chrome";
40
- }
41
- async function D(e) {
42
- var t;
43
- try {
44
- const n = navigator;
45
- if (typeof ((t = n.userAgentData) == null ? void 0 : t.getHighEntropyValues) == "function") {
46
- const r = await n.userAgentData.getHighEntropyValues([
47
- "platform",
48
- "platformVersion",
49
- "fullVersionList",
50
- "model",
51
- "architecture",
52
- "bitness",
53
- "uaFullVersion"
54
- ]), i = r.fullVersionList ?? e ?? [];
55
- return { ok: !0, ...r, fullVersionList: i };
56
- }
57
- } catch (n) {
58
- console.error("[browser-check] failed to get user-agent info", n);
59
- }
60
- return { ok: !1 };
61
- }
62
- function N() {
63
- const e = globalThis.navigator, t = (e == null ? void 0 : e.userAgent) ?? "", n = t.match(/Edg\/(\d+)/), r = t.match(/OPR\/(\d+)/), i = /Vivaldi/i.test(t), o = /YaBrowser\/(\d+)/i.exec(t), s = /Whale\/(\d+)/i.exec(t), a = /Brave\/(\d+)/i.exec(t), f = /Arc\/(\d+)/i.exec(t), l = /SamsungBrowser\/(\d+)/i.exec(t), d = t.match(/Chrome\/(\d+)/);
64
- if (n || r || i || o || s || a || f || l || d) {
65
- const g = u(d) || u(n) || u(r) || u(o) || u(s) || u(a) || u(f) || 0, S = T({
66
- edgeMatch: n,
67
- operaMatch: r,
68
- hasVivaldi: i,
69
- yandexMatch: o,
70
- whaleMatch: s,
71
- braveMatch: a,
72
- arcMatch: f,
73
- samsungMatch: l
74
- });
75
- return {
76
- engine: "chromium",
77
- version: g,
78
- brand: S,
79
- isSamsung: !!l
80
- };
81
- }
82
- const c = B(t);
83
- return c > 0 ? {
84
- engine: "gecko",
85
- version: c,
86
- brand: "firefox",
87
- isSamsung: !1
88
- } : /Safari\//.test(t) && !/Chrome|Chromium|CriOS|Edg|OPR|SamsungBrowser/i.test(t) ? { engine: "webkit", version: 0, brand: "safari", isSamsung: !1 } : { engine: "unknown", version: 0, brand: "unknown", isSamsung: !1 };
89
- }
90
- async function E() {
91
- var c, m, g;
92
- const e = ((c = globalThis.navigator) == null ? void 0 : c.userAgent) ?? "", t = /Android/i.test(e), n = /iP(hone|ad|od)/i.test(e), r = t || n || /Mobile/i.test(e), i = N(), o = i.engine;
93
- let s = i.version, a = i.brand;
94
- if (o === "webkit" && (s = L(e, n)), o === "chromium") {
95
- const F = (m = navigator.userAgentData) == null ? void 0 : m.brands, b = await D(F);
96
- if (b.ok) {
97
- const h = b.fullVersionList.find(
98
- (p) => /Chromium|Chrome/i.test(p.brand)
99
- );
100
- if (h != null && h.version) {
101
- const p = Number.parseInt(
102
- String(h.version).split(".")[0] ?? `${s}`,
103
- 10
104
- );
105
- Number.isFinite(p) && (s = p);
106
- }
107
- const x = (g = b.fullVersionList.find(
108
- (p) => /(edge|opera|vivaldi|brave|arc|samsung|yabrowser|whale|google chrome)/i.test(
109
- p.brand
110
- )
111
- )) == null ? void 0 : g.brand;
112
- x && (a = V(x));
113
- }
114
- }
115
- const f = t && (/; wv\)/i.test(e) || /Version\/\d+\.\d+ Chrome\/\d+\.\d+\.\d+\.\d+ Mobile Safari\/\d+\.\d+/i.test(
116
- e
117
- )) && !/SamsungBrowser/i.test(e), l = /SamsungBrowser\/\d+/i.test(e) || i.isSamsung;
118
- return {
119
- brand: a,
120
- version: s,
121
- engine: n ? "webkit" : o,
122
- isMobile: r,
123
- isIOS: n,
124
- isAndroid: t,
125
- isAndroidWebView: f,
126
- isSamsungInternet: l
127
- };
128
- }
129
- function R(e) {
130
- return e.brand.length > 0 && e.brand !== "unknown" ? M(e.brand) : e.engine === "unknown" ? "Browser" : M(e.engine);
131
- }
132
- function P(e, t) {
133
- const n = e.isMobile ? t.mobile : t.desktop;
134
- return e.engine === "chromium" ? e.version >= n.chromium : e.engine === "gecko" ? e.version >= n.gecko : e.engine === "webkit" ? e.version >= n.webkit : !1;
135
- }
136
- const y = "lib-browser-support-banner-root";
137
- function O(e, t) {
138
- return P(e, t);
139
- }
140
- function j(e, t, n = C) {
141
- const r = document.createElement("div");
142
- r.className = "gi-alert-base-dismissible gi-alert-warning !gi-max-w-full gi-not-prose", r.setAttribute("role", "alert"), r.setAttribute("aria-live", "assertive");
143
- const i = document.createElement("span");
144
- i.dataset.testid = "govie-icon", i.dataset.variant = "warning", i.setAttribute("aria-hidden", "true"), i.setAttribute("role", "presentation"), i.className = "gi-block material-symbols-outlined gi-alert-icon", i.style.fontSize = "24px", i.textContent = "warning";
145
- const o = document.createElement("div");
146
- o.className = "gi-alert-container";
147
- const s = document.createElement("p");
148
- s.className = "gi-alert-title", s.textContent = n.title;
149
- const a = document.createElement("div"), f = "browser-support-message", l = document.createElement("div");
150
- l.id = f, l.textContent = n.message(e, t);
151
- const d = document.createElement("a");
152
- d.href = n.linkHref, d.target = "_blank", d.rel = "noreferrer", d.className = "gi-link", d.textContent = n.linkText;
153
- const c = document.createElement("button");
154
- c.type = "button", c.setAttribute("aria-label", "Dismiss alert"), c.className = "gi-btn gi-btn-flat-dark gi-icon-btn-small gi-alert-dismiss";
155
- const m = document.createElement("span");
156
- return m.setAttribute("role", "presentation"), m.className = "gi-block material-symbols-outlined", m.style.fontSize = "16px", m.textContent = "close", c.append(m), a.append(l), a.append(d), o.append(s), o.append(a), r.append(i), r.append(o), r.append(c), c.addEventListener(
157
- "click",
158
- () => {
159
- const g = document.querySelector(
160
- `#${y}`
161
- );
162
- g == null || g.remove(), r.remove(), k = !1;
163
- },
164
- { once: !0 }
165
- ), r.setAttribute("aria-describedby", f), r;
166
- }
167
- let k = !1;
168
- function A() {
169
- if (typeof document > "u")
170
- return null;
171
- const e = document.querySelector(
172
- `#${y}`
173
- );
174
- if (e !== null)
175
- return e;
176
- if (!document.body)
177
- return null;
178
- const t = document.createElement("div");
179
- return t.id = y, t.className = "gi-w-full gi-p-1 gi-block", document.body.firstChild ? document.body.insertBefore(t, document.body.firstChild) : document.body.append(t), t;
180
- }
181
- function $(e) {
182
- if (document.body) {
183
- e();
184
- return;
185
- }
186
- if (document.readyState === "loading") {
187
- document.addEventListener(
188
- "DOMContentLoaded",
189
- () => {
190
- e();
191
- },
192
- { once: !0 }
193
- );
194
- return;
195
- }
196
- const t = new MutationObserver(() => {
197
- document.body && (t.disconnect(), e());
198
- });
199
- t.observe(document.documentElement, {
200
- childList: !0,
201
- subtree: !0
202
- });
203
- }
204
- function q(e) {
205
- const t = A(), n = () => {
206
- const r = A();
207
- if (!r)
208
- return;
209
- const i = r.querySelector('[role="alert"]');
210
- i && i.remove();
211
- const o = R(e), s = e.version > 0 ? ` ${e.version}` : "", a = j(
212
- o,
213
- s,
214
- C
215
- );
216
- r.prepend(a), k = !0;
217
- };
218
- if (!t) {
219
- $(() => {
220
- n();
221
- });
222
- return;
223
- }
224
- n();
225
- }
226
- async function z(e) {
227
- if (k)
228
- return;
229
- const t = e ?? await E();
230
- q(t);
231
- }
232
- function v(e) {
233
- requestAnimationFrame(() => {
234
- e();
235
- });
236
- }
237
- async function H() {
238
- if (typeof document > "u")
239
- return;
240
- const e = await E();
241
- if (!O(e, w)) {
242
- const n = () => {
243
- z(e);
244
- };
245
- document.readyState === "complete" ? v(n) : document.readyState === "interactive" ? window.addEventListener(
246
- "load",
247
- () => {
248
- v(n);
249
- },
250
- { once: !0 }
251
- ) : document.addEventListener(
252
- "DOMContentLoaded",
253
- () => {
254
- window.addEventListener(
255
- "load",
256
- () => {
257
- v(n);
258
- },
259
- { once: !0 }
260
- );
261
- },
262
- { once: !0 }
263
- );
264
- }
265
- }
266
- typeof document < "u" && queueMicrotask(() => {
267
- H().catch((e) => {
268
- console.error("[browser-check] failed to run", e);
269
- });
270
- });
271
- const I = {
272
- extractFirefoxMajorVersion: B,
273
- extractSafariMajorVersion: L,
274
- normalizeBrand: V,
275
- getEngineInfoSync: N,
276
- getBrowserInfo: E,
277
- isBrowserSupported: (e) => O(e, w),
278
- SUPPORT_POLICY: w
279
- };
280
- export {
281
- I as __test
282
- };