@altinn/altinn-components 0.46.0 → 0.46.2
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/assets/SearchbarBase.css +1 -1
- package/dist/components/GlobalHeader/GlobalHeader.js +38 -36
- package/dist/components/GlobalMenu/GlobalMenu.js +32 -27
- package/dist/components/Searchbar/SearchbarBase.js +9 -9
- package/dist/types/lib/components/GlobalHeader/GlobalHeader.d.ts +3 -3
- package/dist/types/lib/components/GlobalMenu/GlobalMenu.d.ts +2 -1
- package/dist/types/lib/components/GlobalMenu/GlobalMenu.stories.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._searchbar_13e7s_1{position:relative}._searchbar_13e7s_1[data-autocomplete=true][aria-expanded=true] input{border-bottom-left-radius:0;border-bottom-right-radius:0}._searchbar_13e7s_1 nav{display:none}._searchbarExpanded_13e7s_14 nav{position:absolute;display:block;border-top-left-radius:0;border-top-right-radius:0;margin-top:-2px}._searchbarLocal_13e7s_22{width:100%;padding:var(--dsc-spacing-4) 0;z-index:100;margin-bottom:16px}@media (min-width: 1024px){._searchbarLocal_13e7s_22{max-width:320px;margin-right:auto}._searchbarLocal_13e7s_22._searchbarExpanded_13e7s_14{max-width:640px}}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useIsDesktop as
|
|
4
|
-
import { AccountMenuButton as
|
|
5
|
-
import { DropdownBase as
|
|
2
|
+
import { jsxs as d, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { useIsDesktop as O } from "../../hooks/useIsDesktop.js";
|
|
4
|
+
import { AccountMenuButton as F } from "../Account/AccountMenuButton.js";
|
|
5
|
+
import { DropdownBase as y } from "../Dropdown/DropdownBase.js";
|
|
6
6
|
import { c as h } from "../../index-L8X2o7IH.js";
|
|
7
7
|
import { DrawerBase as p } from "../Dropdown/DrawerBase.js";
|
|
8
8
|
import "react";
|
|
9
|
-
import { useRootContext as
|
|
10
|
-
import { GlobalHeaderBase as
|
|
9
|
+
import { useRootContext as D } from "../RootProvider/RootProvider.js";
|
|
10
|
+
import { GlobalHeaderBase as H } from "./GlobalHeaderBase.js";
|
|
11
11
|
import "../Snackbar/useSnackbar.js";
|
|
12
12
|
import { GlobalMenu as w } from "../GlobalMenu/GlobalMenu.js";
|
|
13
|
-
import { GlobalMenuButton as
|
|
14
|
-
import { AccountSelector as
|
|
13
|
+
import { GlobalMenuButton as I } from "../GlobalMenu/GlobalMenuButton.js";
|
|
14
|
+
import { AccountSelector as L } from "./AccountSelector.js";
|
|
15
15
|
import { GlobalSearch as T } from "./GlobalSearch.js";
|
|
16
16
|
import { GlobalSearchButton as j } from "./GlobalSearchButton.js";
|
|
17
17
|
import { HeaderGroup as z } from "./HeaderGroup.js";
|
|
@@ -24,7 +24,7 @@ import '../../assets/GlobalHeader.css';const q = "_drawer_1r5ak_1", E = "_dropdo
|
|
|
24
24
|
globalMenu: e,
|
|
25
25
|
desktopMenu: k,
|
|
26
26
|
mobileMenu: _,
|
|
27
|
-
globalSearch:
|
|
27
|
+
globalSearch: i,
|
|
28
28
|
locale: a,
|
|
29
29
|
accountSelector: n,
|
|
30
30
|
logo: x = {},
|
|
@@ -32,82 +32,84 @@ import '../../assets/GlobalHeader.css';const q = "_drawer_1r5ak_1", E = "_dropdo
|
|
|
32
32
|
onLoginClick: A
|
|
33
33
|
}) => {
|
|
34
34
|
var f, l;
|
|
35
|
-
const { currentId:
|
|
35
|
+
const { currentId: r, toggleId: u, openId: C, closeAll: m } = D(), G = () => {
|
|
36
36
|
u("search");
|
|
37
37
|
}, v = () => {
|
|
38
|
-
|
|
38
|
+
r === "account" || r === "accountFullscreen" ? m() : C("account");
|
|
39
39
|
}, N = () => {
|
|
40
40
|
u("menu");
|
|
41
|
-
},
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
n && /* @__PURE__ */
|
|
46
|
-
|
|
41
|
+
}, c = r === "account" || r === "accountFullscreen" || (n == null ? void 0 : n.forceOpenFullScreen), s = O();
|
|
42
|
+
return /* @__PURE__ */ d(H, { currentId: r, openBackdrop: r === "menu", onCloseBackdrop: m, children: [
|
|
43
|
+
/* @__PURE__ */ o(R, { ...x, badge: B, className: t.logo }),
|
|
44
|
+
/* @__PURE__ */ d(z, { children: [
|
|
45
|
+
n && /* @__PURE__ */ o(
|
|
46
|
+
F,
|
|
47
47
|
{
|
|
48
48
|
currentAccount: (f = n.accountMenu) == null ? void 0 : f.currentAccount,
|
|
49
49
|
minimized: !s,
|
|
50
50
|
onClick: (l = n.accountMenu) != null && l.currentAccount ? v : A,
|
|
51
|
-
expanded:
|
|
51
|
+
expanded: c,
|
|
52
52
|
loading: n.loading
|
|
53
53
|
}
|
|
54
54
|
),
|
|
55
|
-
|
|
56
|
-
/* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
e && /* @__PURE__ */
|
|
59
|
-
|
|
55
|
+
i && /* @__PURE__ */ o(j, { onClick: G, expanded: r === "search" }),
|
|
56
|
+
/* @__PURE__ */ d("div", { className: t.relative, children: [
|
|
57
|
+
/* @__PURE__ */ o(I, { onClick: N, expanded: r === "menu", label: e == null ? void 0 : e.menuLabel }),
|
|
58
|
+
e && /* @__PURE__ */ o(
|
|
59
|
+
y,
|
|
60
60
|
{
|
|
61
61
|
layout: "desktop",
|
|
62
62
|
padding: !0,
|
|
63
63
|
size: "lg",
|
|
64
64
|
placement: "right",
|
|
65
|
-
open:
|
|
65
|
+
open: r === "menu",
|
|
66
66
|
className: t.dropdown,
|
|
67
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ o(
|
|
68
68
|
w,
|
|
69
69
|
{
|
|
70
70
|
...e,
|
|
71
71
|
menu: k || (e == null ? void 0 : e.menu),
|
|
72
72
|
onClose: m,
|
|
73
|
-
localeSwitcher: a
|
|
73
|
+
localeSwitcher: a,
|
|
74
|
+
isOpen: r === "menu"
|
|
74
75
|
}
|
|
75
76
|
)
|
|
76
77
|
}
|
|
77
78
|
)
|
|
78
79
|
] })
|
|
79
80
|
] }),
|
|
80
|
-
e && /* @__PURE__ */
|
|
81
|
+
e && /* @__PURE__ */ o(p, { open: r === "menu", className: t.drawer, children: /* @__PURE__ */ o(
|
|
81
82
|
w,
|
|
82
83
|
{
|
|
83
84
|
...e,
|
|
84
85
|
menu: _ || (e == null ? void 0 : e.menu),
|
|
85
86
|
onClose: m,
|
|
86
|
-
localeSwitcher: a
|
|
87
|
+
localeSwitcher: a,
|
|
88
|
+
isOpen: r === "menu"
|
|
87
89
|
}
|
|
88
90
|
) }),
|
|
89
|
-
n && /* @__PURE__ */
|
|
91
|
+
n && /* @__PURE__ */ o(
|
|
90
92
|
p,
|
|
91
93
|
{
|
|
92
|
-
open:
|
|
94
|
+
open: c,
|
|
93
95
|
className: h(t.drawer),
|
|
94
96
|
dataLayout: s ? "desktop" : "mobile",
|
|
95
|
-
children: /* @__PURE__ */
|
|
96
|
-
|
|
97
|
+
children: /* @__PURE__ */ o(
|
|
98
|
+
L,
|
|
97
99
|
{
|
|
98
100
|
...n,
|
|
99
|
-
forceOpenFullScreen: n.forceOpenFullScreen || !s ?
|
|
101
|
+
forceOpenFullScreen: n.forceOpenFullScreen || !s ? c : void 0
|
|
100
102
|
}
|
|
101
103
|
)
|
|
102
104
|
}
|
|
103
105
|
),
|
|
104
|
-
|
|
106
|
+
i && /* @__PURE__ */ o(
|
|
105
107
|
p,
|
|
106
108
|
{
|
|
107
|
-
open:
|
|
109
|
+
open: r === "search",
|
|
108
110
|
className: h(t.drawer),
|
|
109
111
|
dataLayout: s ? "desktop" : "mobile",
|
|
110
|
-
children: /* @__PURE__ */
|
|
112
|
+
children: /* @__PURE__ */ o(T, { ...i })
|
|
111
113
|
}
|
|
112
114
|
)
|
|
113
115
|
] });
|
|
@@ -1,27 +1,32 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as l, jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as L, useEffect as B, useMemo as h } from "react";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
5
|
import "../RootProvider/RootProvider.js";
|
|
6
|
-
import { LocaleSwitcher as
|
|
6
|
+
import { LocaleSwitcher as u } from "./LocaleSwitcher.js";
|
|
7
7
|
import "../Snackbar/useSnackbar.js";
|
|
8
|
-
import { MenuListItem as
|
|
9
|
-
import { Menu as
|
|
10
|
-
import { BackButton as
|
|
11
|
-
import { GlobalMenuBase as
|
|
12
|
-
import { LocaleButton as
|
|
13
|
-
import { LogoutButton as
|
|
14
|
-
const
|
|
8
|
+
import { MenuListItem as G } from "../Menu/MenuBase.js";
|
|
9
|
+
import { Menu as x } from "../Menu/Menu.js";
|
|
10
|
+
import { BackButton as j } from "./BackButton.js";
|
|
11
|
+
import { GlobalMenuBase as k, GlobalMenuHeader as v, GlobalMenuFooter as y } from "./GlobalMenuBase.js";
|
|
12
|
+
import { LocaleButton as A } from "./LocaleButton.js";
|
|
13
|
+
import { LogoutButton as S } from "./LogoutButton.js";
|
|
14
|
+
const P = ({
|
|
15
15
|
menu: a,
|
|
16
|
-
backLabel:
|
|
16
|
+
backLabel: M = "Back",
|
|
17
17
|
onClose: i,
|
|
18
18
|
logoutButton: e,
|
|
19
|
-
ariaLabel:
|
|
20
|
-
localeSwitcher: c
|
|
19
|
+
ariaLabel: f = "Menu",
|
|
20
|
+
localeSwitcher: c,
|
|
21
|
+
isOpen: p = !1
|
|
21
22
|
}) => {
|
|
22
|
-
const [
|
|
23
|
-
|
|
24
|
-
}
|
|
23
|
+
const [d, n] = L(!1), m = () => {
|
|
24
|
+
n((r) => !r);
|
|
25
|
+
};
|
|
26
|
+
B(() => {
|
|
27
|
+
p || n(!1);
|
|
28
|
+
}, [p]);
|
|
29
|
+
const g = h(() => ((a == null ? void 0 : a.items) ?? []).map((r) => ({
|
|
25
30
|
...r,
|
|
26
31
|
onClick: () => {
|
|
27
32
|
var o;
|
|
@@ -30,23 +35,23 @@ const K = ({
|
|
|
30
35
|
items: Array.isArray(r.items) ? r.items.map((o) => ({
|
|
31
36
|
...o,
|
|
32
37
|
onClick: () => {
|
|
33
|
-
var
|
|
34
|
-
(
|
|
38
|
+
var s;
|
|
39
|
+
(s = o.onClick) == null || s.call(o), i == null || i();
|
|
35
40
|
}
|
|
36
41
|
})) : void 0
|
|
37
42
|
})), [a, i]);
|
|
38
|
-
return
|
|
39
|
-
/* @__PURE__ */ l(
|
|
40
|
-
/* @__PURE__ */ t(
|
|
41
|
-
c && /* @__PURE__ */ t(
|
|
43
|
+
return d ? /* @__PURE__ */ l(k, { "aria-label": f, children: [
|
|
44
|
+
/* @__PURE__ */ l(v, { children: [
|
|
45
|
+
/* @__PURE__ */ t(j, { onClick: m, label: M }),
|
|
46
|
+
c && /* @__PURE__ */ t(u, { ...c })
|
|
42
47
|
] }),
|
|
43
|
-
/* @__PURE__ */ t(
|
|
44
|
-
] }) : /* @__PURE__ */ l(
|
|
45
|
-
a && /* @__PURE__ */ t(
|
|
46
|
-
c && /* @__PURE__ */ t(
|
|
47
|
-
e && /* @__PURE__ */ t(
|
|
48
|
+
/* @__PURE__ */ t(G, { as: "div", role: "separator" })
|
|
49
|
+
] }) : /* @__PURE__ */ l(k, { "aria-label": f, children: [
|
|
50
|
+
a && /* @__PURE__ */ t(x, { ...a, items: g }),
|
|
51
|
+
c && /* @__PURE__ */ t(A, { onClick: m }),
|
|
52
|
+
e && /* @__PURE__ */ t(y, { children: /* @__PURE__ */ t(S, { ...e }) })
|
|
48
53
|
] });
|
|
49
54
|
};
|
|
50
55
|
export {
|
|
51
|
-
|
|
56
|
+
P as GlobalMenu
|
|
52
57
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import '../../assets/SearchbarBase.css';const
|
|
4
|
-
searchbar:
|
|
1
|
+
import { jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { c as l } from "../../index-L8X2o7IH.js";
|
|
3
|
+
import '../../assets/SearchbarBase.css';const n = "_searchbar_13e7s_1", d = "_searchbarExpanded_13e7s_14", _ = "_searchbarLocal_13e7s_22", a = {
|
|
4
|
+
searchbar: n,
|
|
5
5
|
searchbarExpanded: d,
|
|
6
6
|
searchbarLocal: _
|
|
7
7
|
}, m = ({
|
|
@@ -9,16 +9,16 @@ import '../../assets/SearchbarBase.css';const l = "_searchbar_nnykn_1", d = "_se
|
|
|
9
9
|
children: s,
|
|
10
10
|
expanded: e = !1,
|
|
11
11
|
onBlurCapture: c,
|
|
12
|
-
autocomplete:
|
|
13
|
-
useGlobalHeader:
|
|
12
|
+
autocomplete: o = !1,
|
|
13
|
+
useGlobalHeader: t = !1
|
|
14
14
|
}) => {
|
|
15
|
-
const
|
|
15
|
+
const h = l(
|
|
16
16
|
a.searchbar,
|
|
17
17
|
r,
|
|
18
18
|
e && a.searchbarExpanded,
|
|
19
|
-
|
|
19
|
+
t && a.searchbarLocal
|
|
20
20
|
);
|
|
21
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ b("div", { className: h, "data-autocomplete": o, onBlurCapture: c, children: s });
|
|
22
22
|
};
|
|
23
23
|
export {
|
|
24
24
|
m as SearchbarBase
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BadgeProps } from '../Badge
|
|
2
|
-
import { GlobalMenuProps, LocaleSwitcherProps } from '../GlobalMenu
|
|
3
|
-
import { MenuProps } from '../Menu
|
|
1
|
+
import { BadgeProps } from '../Badge';
|
|
2
|
+
import { GlobalMenuProps, LocaleSwitcherProps } from '../GlobalMenu';
|
|
3
|
+
import { MenuProps } from '../Menu';
|
|
4
4
|
import { AccountSelectorProps } from './AccountSelector.tsx';
|
|
5
5
|
import { GlobalSearchProps } from './GlobalSearch.tsx';
|
|
6
6
|
import { HeaderLogoProps } from './HeaderLogo.tsx';
|
|
@@ -12,5 +12,6 @@ export interface GlobalMenuProps {
|
|
|
12
12
|
onClose?: () => void;
|
|
13
13
|
ariaLabel?: string;
|
|
14
14
|
localeSwitcher?: LocaleSwitcherProps;
|
|
15
|
+
isOpen?: boolean;
|
|
15
16
|
}
|
|
16
|
-
export declare const GlobalMenu: ({ menu, backLabel, onClose, logoutButton, ariaLabel, localeSwitcher, }: GlobalMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const GlobalMenu: ({ menu, backLabel, onClose, logoutButton, ariaLabel, localeSwitcher, isOpen, }: GlobalMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,7 +3,7 @@ import { MenuProps } from '../Menu';
|
|
|
3
3
|
import { GlobalMenuProps } from './GlobalMenu';
|
|
4
4
|
declare const meta: {
|
|
5
5
|
title: string;
|
|
6
|
-
component: ({ menu, backLabel, onClose, logoutButton, ariaLabel, localeSwitcher, }: GlobalMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
component: ({ menu, backLabel, onClose, logoutButton, ariaLabel, localeSwitcher, isOpen, }: GlobalMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
tags: string[];
|
|
8
8
|
parameters: {};
|
|
9
9
|
args: {
|