@altinn/altinn-components 0.46.6 → 0.47.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,32 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
2
|
+
import { jsxs as c, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { useState as B, useEffect as h, useMemo as u } from "react";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
5
|
import "../RootProvider/RootProvider.js";
|
|
6
|
-
import { LocaleSwitcher as
|
|
6
|
+
import { LocaleSwitcher as G } 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 x } from "../Menu/MenuBase.js";
|
|
9
|
+
import { Menu as j } from "../Menu/Menu.js";
|
|
10
|
+
import { BackButton as v } from "./BackButton.js";
|
|
11
|
+
import { GlobalMenuBase as M, GlobalMenuHeader as y, GlobalMenuFooter as A } from "./GlobalMenuBase.js";
|
|
12
|
+
import { LocaleButton as S } from "./LocaleButton.js";
|
|
13
|
+
import { LogoutButton as T } from "./LogoutButton.js";
|
|
14
|
+
const Q = ({
|
|
15
15
|
menu: a,
|
|
16
|
-
backLabel:
|
|
16
|
+
backLabel: d = "Back",
|
|
17
17
|
onClose: i,
|
|
18
|
-
logoutButton:
|
|
18
|
+
logoutButton: l,
|
|
19
19
|
ariaLabel: f = "Menu",
|
|
20
|
-
localeSwitcher:
|
|
21
|
-
isOpen: p = !1
|
|
20
|
+
localeSwitcher: e,
|
|
21
|
+
isOpen: p = !1,
|
|
22
|
+
color: n = "person"
|
|
22
23
|
}) => {
|
|
23
|
-
const [
|
|
24
|
-
|
|
24
|
+
const [g, m] = B(!1), s = () => {
|
|
25
|
+
m((r) => !r);
|
|
25
26
|
};
|
|
26
|
-
|
|
27
|
-
p ||
|
|
27
|
+
h(() => {
|
|
28
|
+
p || m(!1);
|
|
28
29
|
}, [p]);
|
|
29
|
-
const
|
|
30
|
+
const L = u(() => ((a == null ? void 0 : a.items) ?? []).map((r) => ({
|
|
30
31
|
...r,
|
|
31
32
|
onClick: () => {
|
|
32
33
|
var o;
|
|
@@ -35,23 +36,23 @@ const P = ({
|
|
|
35
36
|
items: Array.isArray(r.items) ? r.items.map((o) => ({
|
|
36
37
|
...o,
|
|
37
38
|
onClick: () => {
|
|
38
|
-
var
|
|
39
|
-
(
|
|
39
|
+
var k;
|
|
40
|
+
(k = o.onClick) == null || k.call(o), i == null || i();
|
|
40
41
|
}
|
|
41
42
|
})) : void 0
|
|
42
43
|
})), [a, i]);
|
|
43
|
-
return
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
/* @__PURE__ */ t(
|
|
46
|
-
|
|
44
|
+
return g ? /* @__PURE__ */ c(M, { "aria-label": f, color: n, children: [
|
|
45
|
+
/* @__PURE__ */ c(y, { children: [
|
|
46
|
+
/* @__PURE__ */ t(v, { onClick: s, label: d }),
|
|
47
|
+
e && /* @__PURE__ */ t(G, { ...e })
|
|
47
48
|
] }),
|
|
48
|
-
/* @__PURE__ */ t(
|
|
49
|
-
] }) : /* @__PURE__ */
|
|
50
|
-
a && /* @__PURE__ */ t(
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
/* @__PURE__ */ t(x, { as: "div", role: "separator" })
|
|
50
|
+
] }) : /* @__PURE__ */ c(M, { "aria-label": f, color: n, children: [
|
|
51
|
+
a && /* @__PURE__ */ t(j, { ...a, items: L }),
|
|
52
|
+
e && /* @__PURE__ */ t(S, { onClick: s }),
|
|
53
|
+
l && /* @__PURE__ */ t(A, { children: /* @__PURE__ */ t(T, { ...l }) })
|
|
53
54
|
] });
|
|
54
55
|
};
|
|
55
56
|
export {
|
|
56
|
-
|
|
57
|
+
Q as GlobalMenu
|
|
57
58
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Color } from '../';
|
|
1
2
|
import { LocaleSwitcherProps } from '../Header';
|
|
2
3
|
import { MenuProps } from '../Menu';
|
|
3
4
|
import { LogoutButtonProps } from './LogoutButton';
|
|
@@ -13,5 +14,6 @@ export interface GlobalMenuProps {
|
|
|
13
14
|
ariaLabel?: string;
|
|
14
15
|
localeSwitcher?: LocaleSwitcherProps;
|
|
15
16
|
isOpen?: boolean;
|
|
17
|
+
color?: Color;
|
|
16
18
|
}
|
|
17
|
-
export declare const GlobalMenu: ({ menu, backLabel, onClose, logoutButton, ariaLabel, localeSwitcher, isOpen, }: GlobalMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const GlobalMenu: ({ menu, backLabel, onClose, logoutButton, ariaLabel, localeSwitcher, isOpen, color, }: 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, isOpen, }: GlobalMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
component: ({ menu, backLabel, onClose, logoutButton, ariaLabel, localeSwitcher, isOpen, color, }: GlobalMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
tags: string[];
|
|
8
8
|
parameters: {};
|
|
9
9
|
args: {
|
|
@@ -27,3 +27,4 @@ export declare const Desktop: (args: GlobalMenuProps) => import("react/jsx-runti
|
|
|
27
27
|
export declare const MobileMenu: (args: GlobalMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
export declare const Login: Story;
|
|
29
29
|
export declare const InterimMenu: (args: GlobalMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare const DesignReference: () => import("react/jsx-runtime").JSX.Element;
|