@ogcio/design-system-react 1.18.1 → 1.20.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/accordion/accordion-item.js +15 -14
- package/dist/alert/alert.d.ts +1 -1
- package/dist/alert/alert.js +36 -27
- package/dist/autocomplete/autocomplete.js +3 -2
- package/dist/browser-support/runtime.d.ts +43 -0
- package/dist/browser-support/runtime.js +283 -0
- package/dist/button/button.js +12 -11
- package/dist/button-group/button-group.js +5 -4
- package/dist/card/card-next.js +16 -15
- package/dist/checkbox/checkbox-group.js +4 -3
- package/dist/checkbox/checkbox.js +5 -4
- package/dist/chip/chip.js +12 -11
- package/dist/combo-box/dropdown-item.js +3 -2
- package/dist/cookie-banner/cookie-banner.js +7 -6
- package/dist/data-table/editable-table-cell.js +3 -2
- package/dist/details/details.js +7 -6
- package/dist/drawer/drawer.js +7 -6
- package/dist/footer/footer.js +3 -2
- package/dist/forms/form-field/form-field.js +60 -61
- package/dist/header/components/header-menu.d.ts +1 -2
- package/dist/header/components/header-menu.js +18 -17
- package/dist/header/header-legacy.d.ts +2 -0
- package/dist/header/header-legacy.js +223 -0
- package/dist/header/header-next/components/header-logo.d.ts +2 -0
- package/dist/header/header-next/components/header-logo.js +19 -0
- package/dist/header/header-next/components/header-title.d.ts +2 -0
- package/dist/header/header-next/components/header-title.js +29 -0
- package/dist/header/header-next/components/menu/components/header-menu-item-button.d.ts +2 -0
- package/dist/header/header-next/components/menu/components/header-menu-item-button.js +42 -0
- package/dist/header/header-next/components/menu/components/header-menu-item-link.d.ts +8 -0
- package/dist/header/header-next/components/menu/components/header-menu-item-link.js +72 -0
- package/dist/header/header-next/components/menu/components/header-menu-item-separator.d.ts +3 -0
- package/dist/header/header-next/components/menu/components/header-menu-item-separator.js +34 -0
- package/dist/header/header-next/components/menu/components/header-menu-item-slot.d.ts +5 -0
- package/dist/header/header-next/components/menu/components/header-menu-item-slot.js +42 -0
- package/dist/header/header-next/components/menu/header-menu-context.d.ts +7 -0
- package/dist/header/header-next/components/menu/header-menu-context.js +23 -0
- package/dist/header/header-next/components/menu/header-primary-menu.d.ts +3 -0
- package/dist/header/header-next/components/menu/header-primary-menu.js +63 -0
- package/dist/header/header-next/components/menu/header-secondary-menu.d.ts +3 -0
- package/dist/header/header-next/components/menu/header-secondary-menu.js +52 -0
- package/dist/header/header-next/header-context.d.ts +13 -0
- package/dist/header/header-next/header-context.js +31 -0
- package/dist/header/header-next/header-next.d.ts +7 -0
- package/dist/header/header-next/header-next.js +75 -0
- package/dist/header/header-next/index.d.ts +11 -0
- package/dist/header/header-next/index.js +27 -0
- package/dist/header/header.d.ts +2 -2
- package/dist/header/header.js +17 -218
- package/dist/header/types.d.ts +84 -4
- package/dist/header/variants.d.ts +2 -2
- package/dist/header/variants.js +1 -1
- package/dist/hooks/use-breakpoint.js +8 -7
- package/dist/hooks/use-toggle-map.d.ts +15 -0
- package/dist/hooks/use-toggle-map.js +45 -0
- package/dist/icon/icon.js +3 -2
- package/dist/icon/icons.d.ts +2 -2
- package/dist/icon/icons.js +2 -0
- package/dist/icon-button/icon-button.js +5 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +205 -178
- package/dist/input-checkbox/input-checkbox.d.ts +1 -1
- package/dist/input-checkbox/input-checkbox.js +66 -48
- package/dist/input-checkbox-group/input-checkbox-group.js +10 -9
- package/dist/input-password/input-password.js +1 -0
- package/dist/input-radio/input-radio.d.ts +1 -1
- package/dist/input-radio/input-radio.js +52 -44
- package/dist/input-radio-group/input-radio-group.js +9 -8
- package/dist/input-text/input-text.js +3 -2
- package/dist/list-item/list-item.d.ts +3 -2
- package/dist/list-item/list-item.js +15 -6
- package/dist/modal/modal.js +5 -4
- package/dist/modal/types.d.ts +5 -3
- package/dist/pagination/pagination.js +26 -25
- package/dist/phase-banner/phase-banner.js +3 -2
- package/dist/popover/popover.js +3 -2
- package/dist/radio/radio-group.js +1 -0
- package/dist/radio/radio.js +1 -0
- package/dist/score-select/score-select.js +4 -3
- package/dist/select/select-menu.js +16 -15
- package/dist/select/select-next.js +3 -2
- package/dist/select/select.js +4 -3
- package/dist/side-nav/side-nav.js +10 -9
- package/dist/spinner/spinner.js +3 -2
- package/dist/stack/stack.js +21 -20
- package/dist/styles.css +2 -2
- package/dist/table/table-data.js +12 -11
- package/dist/table/table-header.js +3 -2
- package/dist/tabs/tab-item.js +7 -6
- package/dist/tabs/tab-list.js +3 -2
- package/dist/text-input/text-input.js +1 -0
- package/dist/textarea/textarea.js +13 -12
- package/dist/toast/ds-toast.js +3 -2
- package/dist/toast/toast.js +12 -11
- package/dist/tooltip/tooltip.js +13 -12
- package/dist/utils/utilities.d.ts +3 -0
- package/dist/utils/utilities.js +34 -25
- package/package.json +6 -4
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
2
|
+
import "@ogcio/design-system-react/browser-check";
|
|
3
|
+
import { jsxs as r, Fragment as u, jsx as n } from "react/jsx-runtime";
|
|
3
4
|
import { useState as y, useRef as b } from "react";
|
|
4
5
|
import { c as h } from "../index-CB-zPpNk.js";
|
|
5
|
-
import { cn as
|
|
6
|
+
import { cn as d } from "../cn.js";
|
|
6
7
|
import { Icon as w } from "../icon/icon.js";
|
|
7
8
|
const I = h({
|
|
8
9
|
variants: {
|
|
@@ -11,18 +12,18 @@ const I = h({
|
|
|
11
12
|
small: "gi-py-2 gi-px-2 gi-text-sm gi-font-bold"
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
|
-
}),
|
|
15
|
+
}), j = ({
|
|
15
16
|
defaultExpanded: c,
|
|
16
17
|
children: s,
|
|
17
18
|
label: t,
|
|
18
19
|
disabled: e,
|
|
19
20
|
dataTestid: l,
|
|
20
21
|
iconStart: m,
|
|
21
|
-
variant:
|
|
22
|
+
variant: i = "default"
|
|
22
23
|
}) => {
|
|
23
24
|
const [o, a] = y(c), g = b(null), p = `${t}-button`, f = `${t}-panel`;
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ r(u, { children: [
|
|
26
|
+
/* @__PURE__ */ n(
|
|
26
27
|
"div",
|
|
27
28
|
{
|
|
28
29
|
ref: g,
|
|
@@ -35,14 +36,14 @@ const I = h({
|
|
|
35
36
|
},
|
|
36
37
|
tabIndex: 0,
|
|
37
38
|
className: "gi-accordion",
|
|
38
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ r(
|
|
39
40
|
"div",
|
|
40
41
|
{
|
|
41
|
-
className:
|
|
42
|
+
className: d("gi-accordion-header", I({ variant: i })),
|
|
42
43
|
children: [
|
|
43
44
|
t,
|
|
44
45
|
" ",
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ n(
|
|
46
47
|
w,
|
|
47
48
|
{
|
|
48
49
|
icon: o ? "keyboard_arrow_up" : "keyboard_arrow_down"
|
|
@@ -53,17 +54,17 @@ const I = h({
|
|
|
53
54
|
)
|
|
54
55
|
}
|
|
55
56
|
),
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ n(
|
|
57
58
|
"div",
|
|
58
59
|
{
|
|
59
60
|
id: f,
|
|
60
61
|
role: "region",
|
|
61
62
|
"aria-labelledby": p,
|
|
62
|
-
className:
|
|
63
|
+
className: d("gi-px-2 gi-pb-4 gi-pt-2 gi-font-normal", {
|
|
63
64
|
"gi-block": o,
|
|
64
65
|
"gi-hidden": !o,
|
|
65
|
-
"gi-text-md":
|
|
66
|
-
"gi-text-sm":
|
|
66
|
+
"gi-text-md": i === "default",
|
|
67
|
+
"gi-text-sm": i === "small"
|
|
67
68
|
}),
|
|
68
69
|
children: s
|
|
69
70
|
}
|
|
@@ -71,5 +72,5 @@ const I = h({
|
|
|
71
72
|
] });
|
|
72
73
|
};
|
|
73
74
|
export {
|
|
74
|
-
|
|
75
|
+
j as AccordionItem
|
|
75
76
|
};
|
package/dist/alert/alert.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ declare const alertVariants: import('tailwind-variants').TVReturnType<{
|
|
|
78
78
|
}, undefined, TVConfig<V, EV>, unknown, unknown, undefined>>;
|
|
79
79
|
type AlertProps = {
|
|
80
80
|
variant?: VariantProps<typeof alertVariants>['variant'];
|
|
81
|
-
title
|
|
81
|
+
title?: string;
|
|
82
82
|
children?: ReactNode;
|
|
83
83
|
dismissible?: boolean;
|
|
84
84
|
dataTestid?: string;
|
package/dist/alert/alert.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import "@ogcio/design-system-react/browser-check";
|
|
2
3
|
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import { useState as
|
|
4
|
-
import { c as
|
|
5
|
-
import { cn as
|
|
4
|
+
import { useState as v } from "react";
|
|
5
|
+
import { c as k } from "../index-CB-zPpNk.js";
|
|
6
|
+
import { cn as l } from "../cn.js";
|
|
6
7
|
import { translate as w } from "../i18n/utility.js";
|
|
7
8
|
import { Icon as N } from "../icon/icon.js";
|
|
8
9
|
import { IconButton as V } from "../icon-button/icon-button.js";
|
|
9
|
-
const x =
|
|
10
|
+
const x = k({
|
|
10
11
|
slots: {
|
|
11
12
|
base: "gi-alert-base",
|
|
12
13
|
baseDismissible: "gi-alert-base-dismissible",
|
|
@@ -37,9 +38,9 @@ const x = v({
|
|
|
37
38
|
defaultVariants: {
|
|
38
39
|
variant: "info"
|
|
39
40
|
}
|
|
40
|
-
}), I = ({ variant:
|
|
41
|
+
}), I = ({ variant: a }) => {
|
|
41
42
|
let s;
|
|
42
|
-
switch (
|
|
43
|
+
switch (a) {
|
|
43
44
|
case "warning": {
|
|
44
45
|
s = "warning";
|
|
45
46
|
break;
|
|
@@ -57,46 +58,54 @@ const x = v({
|
|
|
57
58
|
}
|
|
58
59
|
return s;
|
|
59
60
|
};
|
|
60
|
-
function
|
|
61
|
-
title:
|
|
61
|
+
function y({
|
|
62
|
+
title: a,
|
|
62
63
|
children: s,
|
|
63
|
-
variant:
|
|
64
|
+
variant: i = "info",
|
|
64
65
|
dismissible: t,
|
|
65
66
|
onClose: e,
|
|
66
|
-
dataTestid:
|
|
67
|
-
className:
|
|
67
|
+
dataTestid: c,
|
|
68
|
+
className: o
|
|
68
69
|
}) {
|
|
69
|
-
const [
|
|
70
|
-
variant:
|
|
71
|
-
}),
|
|
72
|
-
return
|
|
70
|
+
const [m, g] = v(!1), { base: d, heading: b, container: f, dismiss: u, baseDismissible: p } = x({
|
|
71
|
+
variant: i
|
|
72
|
+
}), D = t ? p : d;
|
|
73
|
+
return m ? null : /* @__PURE__ */ n(
|
|
73
74
|
"div",
|
|
74
75
|
{
|
|
75
|
-
className:
|
|
76
|
-
"data-testid":
|
|
76
|
+
className: l(D(), o, "gi-not-prose"),
|
|
77
|
+
"data-testid": c,
|
|
77
78
|
role: "alert",
|
|
78
79
|
"aria-live": "assertive",
|
|
79
80
|
children: [
|
|
80
81
|
/* @__PURE__ */ r(
|
|
81
82
|
N,
|
|
82
83
|
{
|
|
83
|
-
icon: I({ variant:
|
|
84
|
+
icon: I({ variant: i }),
|
|
84
85
|
ariaHidden: !0,
|
|
85
86
|
className: "gi-alert-icon",
|
|
86
|
-
"data-variant":
|
|
87
|
+
"data-variant": i
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ n(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: l(f(), {
|
|
94
|
+
"gi-gap-1": a
|
|
95
|
+
}),
|
|
96
|
+
children: [
|
|
97
|
+
a && /* @__PURE__ */ r("p", { className: b(), children: a }),
|
|
98
|
+
s
|
|
99
|
+
]
|
|
87
100
|
}
|
|
88
101
|
),
|
|
89
|
-
/* @__PURE__ */ n("div", { className: b(), children: [
|
|
90
|
-
/* @__PURE__ */ r("p", { className: g(), children: i }),
|
|
91
|
-
s
|
|
92
|
-
] }),
|
|
93
102
|
t && /* @__PURE__ */ r(
|
|
94
103
|
V,
|
|
95
104
|
{
|
|
96
|
-
onClick: (
|
|
97
|
-
|
|
105
|
+
onClick: (h) => {
|
|
106
|
+
g(!0), e == null || e(h);
|
|
98
107
|
},
|
|
99
|
-
className:
|
|
108
|
+
className: u(),
|
|
100
109
|
size: "small",
|
|
101
110
|
appearance: "dark",
|
|
102
111
|
variant: "flat",
|
|
@@ -111,6 +120,6 @@ function q({
|
|
|
111
120
|
);
|
|
112
121
|
}
|
|
113
122
|
export {
|
|
114
|
-
|
|
123
|
+
y as Alert,
|
|
115
124
|
x as alertVariants
|
|
116
125
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import "@ogcio/design-system-react/browser-check";
|
|
2
3
|
import { jsxs as J, jsx as O } from "react/jsx-runtime";
|
|
3
4
|
import { forwardRef as Q, useRef as G, useImperativeHandle as W, useEffect as Y, createElement as Z, Children as ee, isValidElement as te } from "react";
|
|
4
5
|
import { cn as P } from "../cn.js";
|
|
@@ -38,7 +39,7 @@ const {
|
|
|
38
39
|
bubbles: !0,
|
|
39
40
|
isTrusted: !0
|
|
40
41
|
});
|
|
41
|
-
},
|
|
42
|
+
}, Ae = Q(
|
|
42
43
|
(n, l) => {
|
|
43
44
|
var N;
|
|
44
45
|
const p = G(null), {
|
|
@@ -259,7 +260,7 @@ Object.defineProperty(me, "componentType", {
|
|
|
259
260
|
enumerable: !1
|
|
260
261
|
});
|
|
261
262
|
export {
|
|
262
|
-
|
|
263
|
+
Ae as Autocomplete,
|
|
263
264
|
me as AutocompleteGroupItem,
|
|
264
265
|
fe as AutocompleteItem,
|
|
265
266
|
de as renderSelectMenuOptions
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type RenderingEngine = 'chromium' | 'gecko' | 'webkit' | 'unknown';
|
|
2
|
+
type BrowserInfo = {
|
|
3
|
+
brand: string;
|
|
4
|
+
version: number;
|
|
5
|
+
engine: RenderingEngine;
|
|
6
|
+
isMobile: boolean;
|
|
7
|
+
isIOS: boolean;
|
|
8
|
+
isAndroid: boolean;
|
|
9
|
+
isAndroidWebView: boolean;
|
|
10
|
+
isSamsungInternet: boolean;
|
|
11
|
+
};
|
|
12
|
+
type SupportPolicy = {
|
|
13
|
+
desktop: {
|
|
14
|
+
chromium: number;
|
|
15
|
+
gecko: number;
|
|
16
|
+
webkit: number;
|
|
17
|
+
};
|
|
18
|
+
mobile: {
|
|
19
|
+
chromium: number;
|
|
20
|
+
gecko: number;
|
|
21
|
+
webkit: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
declare function normalizeBrand(rawBrand: string): string;
|
|
25
|
+
declare function extractFirefoxMajorVersion(userAgentString: string): number;
|
|
26
|
+
declare function extractSafariMajorVersion(userAgentString: string, isIOS: boolean): number;
|
|
27
|
+
declare function getEngineInfoSync(): {
|
|
28
|
+
engine: RenderingEngine;
|
|
29
|
+
version: number;
|
|
30
|
+
brand: string;
|
|
31
|
+
isSamsung: boolean;
|
|
32
|
+
};
|
|
33
|
+
declare function getBrowserInfo(): Promise<BrowserInfo>;
|
|
34
|
+
export declare const __test: {
|
|
35
|
+
extractFirefoxMajorVersion: typeof extractFirefoxMajorVersion;
|
|
36
|
+
extractSafariMajorVersion: typeof extractSafariMajorVersion;
|
|
37
|
+
normalizeBrand: typeof normalizeBrand;
|
|
38
|
+
getEngineInfoSync: typeof getEngineInfoSync;
|
|
39
|
+
getBrowserInfo: typeof getBrowserInfo;
|
|
40
|
+
isBrowserSupported: (browserInfo: BrowserInfo) => boolean;
|
|
41
|
+
SUPPORT_POLICY: SupportPolicy;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "@ogcio/design-system-react/browser-check";
|
|
3
|
+
const w = {
|
|
4
|
+
desktop: { chromium: 109, gecko: 128, webkit: 16 },
|
|
5
|
+
mobile: { chromium: 114, gecko: 128, webkit: 16 }
|
|
6
|
+
}, C = {
|
|
7
|
+
title: "Limited browser support detected",
|
|
8
|
+
message: (e, t) => `${e}${t} is not officially supported. Please update or switch to a supported browser for the best experience.`,
|
|
9
|
+
linkText: "View supported browsers",
|
|
10
|
+
linkHref: "https://ds.services.gov.ie/get-started/developers/supported-browsers/"
|
|
11
|
+
};
|
|
12
|
+
function M(e) {
|
|
13
|
+
return e.length === 0 ? "" : e.charAt(0).toUpperCase() + e.slice(1);
|
|
14
|
+
}
|
|
15
|
+
function u(e) {
|
|
16
|
+
return e !== null ? Number.parseInt(e[1], 10) : 0;
|
|
17
|
+
}
|
|
18
|
+
function V(e) {
|
|
19
|
+
if (e.length === 0)
|
|
20
|
+
return "chrome";
|
|
21
|
+
const t = e.toLowerCase();
|
|
22
|
+
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;
|
|
23
|
+
}
|
|
24
|
+
function B(e) {
|
|
25
|
+
const t = /FxiOS\/(\d+)/.exec(e), n = /Firefox\/(\d+)/.exec(e), r = u(t);
|
|
26
|
+
return r || u(n);
|
|
27
|
+
}
|
|
28
|
+
function L(e, t) {
|
|
29
|
+
const n = /Version\/(\d+)/.exec(e);
|
|
30
|
+
if (n)
|
|
31
|
+
return u(n);
|
|
32
|
+
if (t) {
|
|
33
|
+
const r = /OS (\d+)_\d+(_\d+)? like Mac OS X/.exec(e), i = u(r);
|
|
34
|
+
if (i > 0)
|
|
35
|
+
return i;
|
|
36
|
+
}
|
|
37
|
+
return 0;
|
|
38
|
+
}
|
|
39
|
+
function T(e) {
|
|
40
|
+
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";
|
|
41
|
+
}
|
|
42
|
+
async function D(e) {
|
|
43
|
+
var t;
|
|
44
|
+
try {
|
|
45
|
+
const n = navigator;
|
|
46
|
+
if (typeof ((t = n.userAgentData) == null ? void 0 : t.getHighEntropyValues) == "function") {
|
|
47
|
+
const r = await n.userAgentData.getHighEntropyValues([
|
|
48
|
+
"platform",
|
|
49
|
+
"platformVersion",
|
|
50
|
+
"fullVersionList",
|
|
51
|
+
"model",
|
|
52
|
+
"architecture",
|
|
53
|
+
"bitness",
|
|
54
|
+
"uaFullVersion"
|
|
55
|
+
]), i = r.fullVersionList ?? e ?? [];
|
|
56
|
+
return { ok: !0, ...r, fullVersionList: i };
|
|
57
|
+
}
|
|
58
|
+
} catch (n) {
|
|
59
|
+
console.error("[browser-check] failed to get user-agent info", n);
|
|
60
|
+
}
|
|
61
|
+
return { ok: !1 };
|
|
62
|
+
}
|
|
63
|
+
function N() {
|
|
64
|
+
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+)/);
|
|
65
|
+
if (n || r || i || o || s || a || f || l || d) {
|
|
66
|
+
const g = u(d) || u(n) || u(r) || u(o) || u(s) || u(a) || u(f) || 0, S = T({
|
|
67
|
+
edgeMatch: n,
|
|
68
|
+
operaMatch: r,
|
|
69
|
+
hasVivaldi: i,
|
|
70
|
+
yandexMatch: o,
|
|
71
|
+
whaleMatch: s,
|
|
72
|
+
braveMatch: a,
|
|
73
|
+
arcMatch: f,
|
|
74
|
+
samsungMatch: l
|
|
75
|
+
});
|
|
76
|
+
return {
|
|
77
|
+
engine: "chromium",
|
|
78
|
+
version: g,
|
|
79
|
+
brand: S,
|
|
80
|
+
isSamsung: !!l
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
const c = B(t);
|
|
84
|
+
return c > 0 ? {
|
|
85
|
+
engine: "gecko",
|
|
86
|
+
version: c,
|
|
87
|
+
brand: "firefox",
|
|
88
|
+
isSamsung: !1
|
|
89
|
+
} : /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 };
|
|
90
|
+
}
|
|
91
|
+
async function E() {
|
|
92
|
+
var c, m, g;
|
|
93
|
+
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;
|
|
94
|
+
let s = i.version, a = i.brand;
|
|
95
|
+
if (o === "webkit" && (s = L(e, n)), o === "chromium") {
|
|
96
|
+
const F = (m = navigator.userAgentData) == null ? void 0 : m.brands, b = await D(F);
|
|
97
|
+
if (b.ok) {
|
|
98
|
+
const h = b.fullVersionList.find(
|
|
99
|
+
(p) => /Chromium|Chrome/i.test(p.brand)
|
|
100
|
+
);
|
|
101
|
+
if (h != null && h.version) {
|
|
102
|
+
const p = Number.parseInt(
|
|
103
|
+
String(h.version).split(".")[0] ?? `${s}`,
|
|
104
|
+
10
|
|
105
|
+
);
|
|
106
|
+
Number.isFinite(p) && (s = p);
|
|
107
|
+
}
|
|
108
|
+
const x = (g = b.fullVersionList.find(
|
|
109
|
+
(p) => /(edge|opera|vivaldi|brave|arc|samsung|yabrowser|whale|google chrome)/i.test(
|
|
110
|
+
p.brand
|
|
111
|
+
)
|
|
112
|
+
)) == null ? void 0 : g.brand;
|
|
113
|
+
x && (a = V(x));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const f = t && (/; wv\)/i.test(e) || /Version\/\d+\.\d+ Chrome\/\d+\.\d+\.\d+\.\d+ Mobile Safari\/\d+\.\d+/i.test(
|
|
117
|
+
e
|
|
118
|
+
)) && !/SamsungBrowser/i.test(e), l = /SamsungBrowser\/\d+/i.test(e) || i.isSamsung;
|
|
119
|
+
return {
|
|
120
|
+
brand: a,
|
|
121
|
+
version: s,
|
|
122
|
+
engine: n ? "webkit" : o,
|
|
123
|
+
isMobile: r,
|
|
124
|
+
isIOS: n,
|
|
125
|
+
isAndroid: t,
|
|
126
|
+
isAndroidWebView: f,
|
|
127
|
+
isSamsungInternet: l
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function R(e) {
|
|
131
|
+
return e.brand.length > 0 && e.brand !== "unknown" ? M(e.brand) : e.engine === "unknown" ? "Browser" : M(e.engine);
|
|
132
|
+
}
|
|
133
|
+
function P(e, t) {
|
|
134
|
+
const n = e.isMobile ? t.mobile : t.desktop;
|
|
135
|
+
return e.engine === "chromium" ? e.version >= n.chromium : e.engine === "gecko" ? e.version >= n.gecko : e.engine === "webkit" ? e.version >= n.webkit : !1;
|
|
136
|
+
}
|
|
137
|
+
const y = "lib-browser-support-banner-root";
|
|
138
|
+
function O(e, t) {
|
|
139
|
+
return P(e, t);
|
|
140
|
+
}
|
|
141
|
+
function j(e, t, n = C) {
|
|
142
|
+
const r = document.createElement("div");
|
|
143
|
+
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");
|
|
144
|
+
const i = document.createElement("span");
|
|
145
|
+
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";
|
|
146
|
+
const o = document.createElement("div");
|
|
147
|
+
o.className = "gi-alert-container";
|
|
148
|
+
const s = document.createElement("p");
|
|
149
|
+
s.className = "gi-alert-title", s.textContent = n.title;
|
|
150
|
+
const a = document.createElement("div"), f = "browser-support-message", l = document.createElement("div");
|
|
151
|
+
l.id = f, l.textContent = n.message(e, t);
|
|
152
|
+
const d = document.createElement("a");
|
|
153
|
+
d.href = n.linkHref, d.target = "_blank", d.rel = "noreferrer", d.className = "gi-link", d.textContent = n.linkText;
|
|
154
|
+
const c = document.createElement("button");
|
|
155
|
+
c.type = "button", c.setAttribute("aria-label", "Dismiss alert"), c.className = "gi-btn gi-btn-flat-dark gi-icon-btn-small gi-alert-dismiss";
|
|
156
|
+
const m = document.createElement("span");
|
|
157
|
+
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(
|
|
158
|
+
"click",
|
|
159
|
+
() => {
|
|
160
|
+
const g = document.querySelector(
|
|
161
|
+
`#${y}`
|
|
162
|
+
);
|
|
163
|
+
g == null || g.remove(), r.remove(), k = !1;
|
|
164
|
+
},
|
|
165
|
+
{ once: !0 }
|
|
166
|
+
), r.setAttribute("aria-describedby", f), r;
|
|
167
|
+
}
|
|
168
|
+
let k = !1;
|
|
169
|
+
function A() {
|
|
170
|
+
if (typeof document > "u")
|
|
171
|
+
return null;
|
|
172
|
+
const e = document.querySelector(
|
|
173
|
+
`#${y}`
|
|
174
|
+
);
|
|
175
|
+
if (e !== null)
|
|
176
|
+
return e;
|
|
177
|
+
if (!document.body)
|
|
178
|
+
return null;
|
|
179
|
+
const t = document.createElement("div");
|
|
180
|
+
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;
|
|
181
|
+
}
|
|
182
|
+
function $(e) {
|
|
183
|
+
if (document.body) {
|
|
184
|
+
e();
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (document.readyState === "loading") {
|
|
188
|
+
document.addEventListener(
|
|
189
|
+
"DOMContentLoaded",
|
|
190
|
+
() => {
|
|
191
|
+
e();
|
|
192
|
+
},
|
|
193
|
+
{ once: !0 }
|
|
194
|
+
);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const t = new MutationObserver(() => {
|
|
198
|
+
document.body && (t.disconnect(), e());
|
|
199
|
+
});
|
|
200
|
+
t.observe(document.documentElement, {
|
|
201
|
+
childList: !0,
|
|
202
|
+
subtree: !0
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function q(e) {
|
|
206
|
+
const t = A(), n = () => {
|
|
207
|
+
const r = A();
|
|
208
|
+
if (!r)
|
|
209
|
+
return;
|
|
210
|
+
const i = r.querySelector('[role="alert"]');
|
|
211
|
+
i && i.remove();
|
|
212
|
+
const o = R(e), s = e.version > 0 ? ` ${e.version}` : "", a = j(
|
|
213
|
+
o,
|
|
214
|
+
s,
|
|
215
|
+
C
|
|
216
|
+
);
|
|
217
|
+
r.prepend(a), k = !0;
|
|
218
|
+
};
|
|
219
|
+
if (!t) {
|
|
220
|
+
$(() => {
|
|
221
|
+
n();
|
|
222
|
+
});
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
n();
|
|
226
|
+
}
|
|
227
|
+
async function z(e) {
|
|
228
|
+
if (k)
|
|
229
|
+
return;
|
|
230
|
+
const t = e ?? await E();
|
|
231
|
+
q(t);
|
|
232
|
+
}
|
|
233
|
+
function v(e) {
|
|
234
|
+
requestAnimationFrame(() => {
|
|
235
|
+
e();
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
async function H() {
|
|
239
|
+
if (typeof document > "u")
|
|
240
|
+
return;
|
|
241
|
+
const e = await E();
|
|
242
|
+
if (!O(e, w)) {
|
|
243
|
+
const n = () => {
|
|
244
|
+
z(e);
|
|
245
|
+
};
|
|
246
|
+
document.readyState === "complete" ? v(n) : document.readyState === "interactive" ? window.addEventListener(
|
|
247
|
+
"load",
|
|
248
|
+
() => {
|
|
249
|
+
v(n);
|
|
250
|
+
},
|
|
251
|
+
{ once: !0 }
|
|
252
|
+
) : document.addEventListener(
|
|
253
|
+
"DOMContentLoaded",
|
|
254
|
+
() => {
|
|
255
|
+
window.addEventListener(
|
|
256
|
+
"load",
|
|
257
|
+
() => {
|
|
258
|
+
v(n);
|
|
259
|
+
},
|
|
260
|
+
{ once: !0 }
|
|
261
|
+
);
|
|
262
|
+
},
|
|
263
|
+
{ once: !0 }
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
typeof document < "u" && queueMicrotask(() => {
|
|
268
|
+
H().catch((e) => {
|
|
269
|
+
console.error("[browser-check] failed to run", e);
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
const U = {
|
|
273
|
+
extractFirefoxMajorVersion: B,
|
|
274
|
+
extractSafariMajorVersion: L,
|
|
275
|
+
normalizeBrand: V,
|
|
276
|
+
getEngineInfoSync: N,
|
|
277
|
+
getBrowserInfo: E,
|
|
278
|
+
isBrowserSupported: (e) => O(e, w),
|
|
279
|
+
SUPPORT_POLICY: w
|
|
280
|
+
};
|
|
281
|
+
export {
|
|
282
|
+
U as __test
|
|
283
|
+
};
|
package/dist/button/button.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import "@ogcio/design-system-react/browser-check";
|
|
3
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
4
|
+
import { forwardRef as l } from "react";
|
|
4
5
|
import { cn as u } from "../cn.js";
|
|
5
6
|
import { getSizeClass as c, isButtonDisabled as b, getVariantAppearanceClass as B } from "./helpers.js";
|
|
6
|
-
const r =
|
|
7
|
+
const r = l(
|
|
7
8
|
({
|
|
8
9
|
variant: e,
|
|
9
10
|
appearance: o,
|
|
10
11
|
size: a,
|
|
11
12
|
disabled: t,
|
|
12
13
|
className: n,
|
|
13
|
-
children:
|
|
14
|
-
dataTestid:
|
|
15
|
-
...
|
|
16
|
-
},
|
|
14
|
+
children: i,
|
|
15
|
+
dataTestid: m,
|
|
16
|
+
...s
|
|
17
|
+
}, p) => /* @__PURE__ */ f(
|
|
17
18
|
"button",
|
|
18
19
|
{
|
|
19
|
-
"data-testid":
|
|
20
|
-
...
|
|
21
|
-
ref:
|
|
20
|
+
"data-testid": m,
|
|
21
|
+
...s,
|
|
22
|
+
ref: p,
|
|
22
23
|
"aria-disabled": t,
|
|
23
24
|
disabled: t,
|
|
24
25
|
className: u(
|
|
@@ -28,7 +29,7 @@ const r = p(
|
|
|
28
29
|
c(a),
|
|
29
30
|
n
|
|
30
31
|
),
|
|
31
|
-
children:
|
|
32
|
+
children: i
|
|
32
33
|
}
|
|
33
34
|
)
|
|
34
35
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import "@ogcio/design-system-react/browser-check";
|
|
2
3
|
import { jsx as y } from "react/jsx-runtime";
|
|
3
4
|
import { createContext as G, useState as V, useEffect as k, useContext as S } from "react";
|
|
4
5
|
import { Button as w } from "../button/button.js";
|
|
@@ -6,7 +7,7 @@ import { cn as E } from "../cn.js";
|
|
|
6
7
|
import { useDomId as $ } from "../hooks/use-dom-id.js";
|
|
7
8
|
const x = G(
|
|
8
9
|
void 0
|
|
9
|
-
),
|
|
10
|
+
), q = ({
|
|
10
11
|
value: r,
|
|
11
12
|
children: d,
|
|
12
13
|
role: s,
|
|
@@ -43,7 +44,7 @@ const x = G(
|
|
|
43
44
|
children: d
|
|
44
45
|
}
|
|
45
46
|
);
|
|
46
|
-
},
|
|
47
|
+
}, A = ({
|
|
47
48
|
name: r,
|
|
48
49
|
size: d = "medium",
|
|
49
50
|
appearance: s = "dark",
|
|
@@ -93,6 +94,6 @@ const x = G(
|
|
|
93
94
|
);
|
|
94
95
|
};
|
|
95
96
|
export {
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
A as ButtonGroup,
|
|
98
|
+
q as ButtonGroupItem
|
|
98
99
|
};
|