@altinn/altinn-components 0.38.2 → 0.38.4
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,19 +1,50 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c } from "../../index-L8X2o7IH.js";
|
|
3
|
-
import '../../assets/MenuBase.css';const
|
|
4
|
-
menu:
|
|
5
|
-
list:
|
|
6
|
-
item:
|
|
7
|
-
},
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { c as i } from "../../index-L8X2o7IH.js";
|
|
3
|
+
import '../../assets/MenuBase.css';const l = "_menu_sxyub_1", p = "_list_sxyub_16", _ = "_item_sxyub_22", u = {
|
|
4
|
+
menu: l,
|
|
5
|
+
list: p,
|
|
6
|
+
item: _
|
|
7
|
+
}, y = ({ as: t = "nav", color: n, theme: e, className: o, children: s }) => /* @__PURE__ */ c(t, { className: i(u.menu, o), "data-color": n, "data-theme": e, children: s }), b = ({
|
|
8
|
+
as: t = "ul",
|
|
9
|
+
role: n = "group",
|
|
10
|
+
className: e,
|
|
11
|
+
children: o,
|
|
12
|
+
ref: s,
|
|
13
|
+
onMouseEnter: m,
|
|
14
|
+
onMouseLeave: a
|
|
15
|
+
}) => /* @__PURE__ */ c(
|
|
16
|
+
t,
|
|
17
|
+
{
|
|
18
|
+
className: i(u.list, e),
|
|
19
|
+
role: n,
|
|
20
|
+
ref: s,
|
|
21
|
+
onMouseEnter: m,
|
|
22
|
+
onMouseLeave: a,
|
|
23
|
+
children: o
|
|
24
|
+
}
|
|
25
|
+
), M = ({
|
|
8
26
|
as: t = "li",
|
|
9
27
|
role: n = "presentation",
|
|
10
28
|
className: e,
|
|
11
29
|
children: o,
|
|
12
30
|
style: s,
|
|
13
|
-
dataIndex: m
|
|
14
|
-
|
|
31
|
+
dataIndex: m,
|
|
32
|
+
onMouseEnter: a,
|
|
33
|
+
onMouseLeave: r
|
|
34
|
+
}) => /* @__PURE__ */ c(
|
|
35
|
+
t,
|
|
36
|
+
{
|
|
37
|
+
className: i(u.item, e),
|
|
38
|
+
role: n,
|
|
39
|
+
style: s,
|
|
40
|
+
"data-index": m,
|
|
41
|
+
onMouseEnter: a,
|
|
42
|
+
onMouseLeave: r,
|
|
43
|
+
children: o
|
|
44
|
+
}
|
|
45
|
+
);
|
|
15
46
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
47
|
+
y as MenuBase,
|
|
48
|
+
b as MenuList,
|
|
49
|
+
M as MenuListItem
|
|
19
50
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as m, jsx as d, Fragment as K } from "react/jsx-runtime";
|
|
3
3
|
import { useRef as R, Fragment as S } from "react";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
5
|
import { useMenu as _ } from "../../hooks/useMenu.js";
|
|
@@ -7,44 +7,44 @@ import "../RootProvider/RootProvider.js";
|
|
|
7
7
|
import { MenuItem as $ } from "./MenuItem.js";
|
|
8
8
|
import { MenuSearch as q } from "./MenuSearch.js";
|
|
9
9
|
import { MenuHeader as w } from "./MenuHeader.js";
|
|
10
|
-
import { MenuList as
|
|
10
|
+
import { MenuList as C, MenuListItem as i } from "./MenuBase.js";
|
|
11
11
|
import "../Snackbar/useSnackbar.js";
|
|
12
|
-
const
|
|
12
|
+
const D = ({
|
|
13
13
|
level: f = 0,
|
|
14
14
|
expanded: F,
|
|
15
15
|
search: h,
|
|
16
|
-
items:
|
|
16
|
+
items: L,
|
|
17
17
|
groups: r = {},
|
|
18
18
|
defaultItemSize: x,
|
|
19
19
|
defaultItemColor: M,
|
|
20
20
|
defaultItemTheme: I,
|
|
21
|
-
defaultIconTheme:
|
|
22
|
-
as:
|
|
23
|
-
keyboardEvents:
|
|
24
|
-
onSelect:
|
|
21
|
+
defaultIconTheme: o,
|
|
22
|
+
as: j,
|
|
23
|
+
keyboardEvents: z,
|
|
24
|
+
onSelect: E = () => {
|
|
25
25
|
}
|
|
26
26
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
items:
|
|
27
|
+
const v = R(null), { menu: b, setActiveIndex: T } = _({
|
|
28
|
+
items: L,
|
|
29
29
|
groups: r,
|
|
30
30
|
groupByKey: "groupId",
|
|
31
|
-
keyboardEvents:
|
|
32
|
-
onSelect:
|
|
33
|
-
ref:
|
|
31
|
+
keyboardEvents: z ?? !1,
|
|
32
|
+
onSelect: E,
|
|
33
|
+
ref: v
|
|
34
34
|
});
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ m(C, { expanded: F, as: j, ref: v, children: [
|
|
36
36
|
h && /* @__PURE__ */ d(q, { ...h }),
|
|
37
|
-
|
|
38
|
-
const n = (t == null ? void 0 : t.props) || {}, { title: y, divider:
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
(f > 0 ||
|
|
37
|
+
b.map((t, s) => {
|
|
38
|
+
const n = (t == null ? void 0 : t.props) || {}, { title: y, divider: k = !0 } = n, A = b[s + 1];
|
|
39
|
+
return /* @__PURE__ */ m(S, { children: [
|
|
40
|
+
(f > 0 || s) && k ? /* @__PURE__ */ d(i, { role: "separator" }) : "",
|
|
41
41
|
y && /* @__PURE__ */ d(i, { children: /* @__PURE__ */ d(w, { title: y }) }),
|
|
42
|
-
t == null ? void 0 : t.items.filter((
|
|
42
|
+
t == null ? void 0 : t.items.filter((c) => {
|
|
43
43
|
var a;
|
|
44
|
-
return !((a =
|
|
45
|
-
}).map((
|
|
46
|
-
const { active: B, onMouseEnter: G } =
|
|
47
|
-
return /* @__PURE__ */
|
|
44
|
+
return !((a = c.props) != null && a.hidden);
|
|
45
|
+
}).map((c, a) => {
|
|
46
|
+
const { active: B, onMouseEnter: G } = c, { groupId: J, ...e } = c.props || {}, { expanded: l } = e, H = t == null ? void 0 : t.items[a + 1];
|
|
47
|
+
return /* @__PURE__ */ m(i, { expanded: l, onMouseLeave: () => T(-1), children: [
|
|
48
48
|
/* @__PURE__ */ d(
|
|
49
49
|
$,
|
|
50
50
|
{
|
|
@@ -52,34 +52,34 @@ const C = ({
|
|
|
52
52
|
size: (e == null ? void 0 : e.size) || (n == null ? void 0 : n.defaultItemSize) || x,
|
|
53
53
|
color: (e == null ? void 0 : e.color) || (n == null ? void 0 : n.defaultItemColor) || M,
|
|
54
54
|
theme: (e == null ? void 0 : e.theme) || (n == null ? void 0 : n.defaultItemTheme) || I,
|
|
55
|
-
iconTheme: (e == null ? void 0 : e.iconTheme) || (n == null ? void 0 : n.defaultIconTheme) ||
|
|
55
|
+
iconTheme: (e == null ? void 0 : e.iconTheme) || (n == null ? void 0 : n.defaultIconTheme) || o,
|
|
56
56
|
active: B,
|
|
57
57
|
tabIndex: e != null && e.disabled ? -1 : e.tabIndex ?? 0,
|
|
58
58
|
onMouseEnter: G
|
|
59
59
|
}
|
|
60
60
|
),
|
|
61
|
-
|
|
61
|
+
l && (e == null ? void 0 : e.items) && /* @__PURE__ */ m(K, { children: [
|
|
62
62
|
/* @__PURE__ */ d(
|
|
63
|
-
|
|
63
|
+
D,
|
|
64
64
|
{
|
|
65
|
-
expanded:
|
|
65
|
+
expanded: l,
|
|
66
66
|
level: f + 1,
|
|
67
67
|
items: e == null ? void 0 : e.items,
|
|
68
68
|
groups: r,
|
|
69
69
|
defaultItemSize: x,
|
|
70
70
|
defaultItemColor: M,
|
|
71
71
|
defaultItemTheme: I,
|
|
72
|
-
defaultIconTheme:
|
|
72
|
+
defaultIconTheme: o
|
|
73
73
|
}
|
|
74
74
|
),
|
|
75
|
-
(
|
|
75
|
+
(A || H) && /* @__PURE__ */ d(i, { role: "separator", as: "div" })
|
|
76
76
|
] })
|
|
77
77
|
] }, a);
|
|
78
78
|
})
|
|
79
|
-
] },
|
|
79
|
+
] }, s);
|
|
80
80
|
})
|
|
81
81
|
] });
|
|
82
82
|
};
|
|
83
83
|
export {
|
|
84
|
-
|
|
84
|
+
D as MenuItems
|
|
85
85
|
};
|
|
@@ -1,45 +1,43 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
3
|
import { c as x } from "../../index-L8X2o7IH.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import { Skeleton as f } from "../Skeleton/Skeleton.js";
|
|
6
6
|
import "../RootProvider/RootProvider.js";
|
|
7
7
|
import { useHighlightedText as u } from "./useHighlightedText.js";
|
|
8
8
|
import "../Snackbar/useSnackbar.js";
|
|
9
|
-
import '../../assets/Heading.css';const H = "_heading_1dyne_1",
|
|
9
|
+
import '../../assets/Heading.css';const H = "_heading_1dyne_1", _ = {
|
|
10
10
|
heading: H
|
|
11
|
-
},
|
|
12
|
-
loading:
|
|
13
|
-
highlightWords:
|
|
14
|
-
as:
|
|
11
|
+
}, T = ({
|
|
12
|
+
loading: e,
|
|
13
|
+
highlightWords: i = [],
|
|
14
|
+
as: o = "h2",
|
|
15
15
|
size: t,
|
|
16
|
-
leading:
|
|
17
|
-
weight:
|
|
18
|
-
color:
|
|
19
|
-
variant:
|
|
20
|
-
maxRows:
|
|
21
|
-
className:
|
|
16
|
+
leading: n = "tight",
|
|
17
|
+
weight: r = "medium",
|
|
18
|
+
color: d,
|
|
19
|
+
variant: m,
|
|
20
|
+
maxRows: s,
|
|
21
|
+
className: c,
|
|
22
22
|
style: h,
|
|
23
|
-
children:
|
|
23
|
+
children: g
|
|
24
24
|
}) => {
|
|
25
|
-
const p =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return console.log("CHILDREN", a), /* @__PURE__ */ e(f, { loading: i, children: /* @__PURE__ */ e(
|
|
29
|
-
p,
|
|
25
|
+
const l = o, p = u(g, i || []);
|
|
26
|
+
return /* @__PURE__ */ a(f, { loading: e, children: /* @__PURE__ */ a(
|
|
27
|
+
l,
|
|
30
28
|
{
|
|
31
|
-
className: x(
|
|
29
|
+
className: x(_.heading, c),
|
|
32
30
|
style: h,
|
|
33
31
|
"data-size": t,
|
|
34
|
-
"data-leading":
|
|
35
|
-
"data-weight":
|
|
36
|
-
"data-color":
|
|
37
|
-
"data-variant": t === "xxs" && "default" ||
|
|
38
|
-
"data-max-rows":
|
|
39
|
-
children:
|
|
32
|
+
"data-leading": n,
|
|
33
|
+
"data-weight": r,
|
|
34
|
+
"data-color": d,
|
|
35
|
+
"data-variant": t === "xxs" && "default" || m,
|
|
36
|
+
"data-max-rows": s,
|
|
37
|
+
children: p
|
|
40
38
|
}
|
|
41
39
|
) });
|
|
42
40
|
};
|
|
43
41
|
export {
|
|
44
|
-
|
|
42
|
+
T as Heading
|
|
45
43
|
};
|
|
@@ -19,6 +19,7 @@ export interface MenuListProps {
|
|
|
19
19
|
children?: ReactNode;
|
|
20
20
|
ref?: React.Ref<HTMLUListElement>;
|
|
21
21
|
onMouseEnter?: MouseEventHandler;
|
|
22
|
+
onMouseLeave?: MouseEventHandler;
|
|
22
23
|
}
|
|
23
24
|
export interface MenuListItemProps {
|
|
24
25
|
as?: ElementType;
|
|
@@ -28,7 +29,9 @@ export interface MenuListItemProps {
|
|
|
28
29
|
children?: ReactNode;
|
|
29
30
|
style?: React.CSSProperties;
|
|
30
31
|
dataIndex?: number;
|
|
32
|
+
onMouseEnter?: MouseEventHandler;
|
|
33
|
+
onMouseLeave?: MouseEventHandler;
|
|
31
34
|
}
|
|
32
35
|
export declare const MenuBase: ({ as, color, theme, className, children }: MenuBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
-
export declare const MenuList: ({ as, role, className, children, ref, onMouseEnter }: MenuListProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
-
export declare const MenuListItem: ({ as, role, className, children, style, dataIndex, }: MenuListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
36
|
+
export declare const MenuList: ({ as, role, className, children, ref, onMouseEnter, onMouseLeave, }: MenuListProps) => import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare const MenuListItem: ({ as, role, className, children, style, dataIndex, onMouseEnter, onMouseLeave, }: MenuListItemProps) => import("react/jsx-runtime").JSX.Element;
|