@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 a } from "react/jsx-runtime";
2
- import { c } from "../../index-L8X2o7IH.js";
3
- import '../../assets/MenuBase.css';const r = "_menu_sxyub_1", l = "_list_sxyub_16", p = "_item_sxyub_22", i = {
4
- menu: r,
5
- list: l,
6
- item: p
7
- }, C = ({ as: t = "nav", color: n, theme: e, className: o, children: s }) => /* @__PURE__ */ a(t, { className: c(i.menu, o), "data-color": n, "data-theme": e, children: s }), d = ({ as: t = "ul", role: n = "group", className: e, children: o, ref: s, onMouseEnter: m }) => /* @__PURE__ */ a(t, { className: c(i.list, e), role: n, ref: s, onMouseEnter: m, children: o }), y = ({
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
- }) => /* @__PURE__ */ a(t, { className: c(i.item, e), role: n, style: s, "data-index": m, children: o });
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
- C as MenuBase,
17
- d as MenuList,
18
- y as MenuListItem
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 c, jsx as d, Fragment as K } from "react/jsx-runtime";
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 A, MenuListItem as i } from "./MenuBase.js";
10
+ import { MenuList as C, MenuListItem as i } from "./MenuBase.js";
11
11
  import "../Snackbar/useSnackbar.js";
12
- const C = ({
12
+ const D = ({
13
13
  level: f = 0,
14
14
  expanded: F,
15
15
  search: h,
16
- items: j,
16
+ items: L,
17
17
  groups: r = {},
18
18
  defaultItemSize: x,
19
19
  defaultItemColor: M,
20
20
  defaultItemTheme: I,
21
- defaultIconTheme: b,
22
- as: z,
23
- keyboardEvents: E,
24
- onSelect: L = () => {
21
+ defaultIconTheme: o,
22
+ as: j,
23
+ keyboardEvents: z,
24
+ onSelect: E = () => {
25
25
  }
26
26
  }) => {
27
- const o = R(null), { menu: v } = _({
28
- items: j,
27
+ const v = R(null), { menu: b, setActiveIndex: T } = _({
28
+ items: L,
29
29
  groups: r,
30
30
  groupByKey: "groupId",
31
- keyboardEvents: E ?? !1,
32
- onSelect: L,
33
- ref: o
31
+ keyboardEvents: z ?? !1,
32
+ onSelect: E,
33
+ ref: v
34
34
  });
35
- return /* @__PURE__ */ c(A, { expanded: F, as: z, ref: o, children: [
35
+ return /* @__PURE__ */ m(C, { expanded: F, as: j, ref: v, children: [
36
36
  h && /* @__PURE__ */ d(q, { ...h }),
37
- v.map((t, l) => {
38
- const n = (t == null ? void 0 : t.props) || {}, { title: y, divider: T = !0 } = n, k = v[l + 1];
39
- return /* @__PURE__ */ c(S, { children: [
40
- (f > 0 || l) && T ? /* @__PURE__ */ d(i, { role: "separator" }) : "",
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((m) => {
42
+ t == null ? void 0 : t.items.filter((c) => {
43
43
  var a;
44
- return !((a = m.props) != null && a.hidden);
45
- }).map((m, a) => {
46
- const { active: B, onMouseEnter: G } = m, { groupId: D, ...e } = m.props || {}, { expanded: s } = e, H = t == null ? void 0 : t.items[a + 1];
47
- return /* @__PURE__ */ c(i, { expanded: s, children: [
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) || b,
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
- s && (e == null ? void 0 : e.items) && /* @__PURE__ */ c(K, { children: [
61
+ l && (e == null ? void 0 : e.items) && /* @__PURE__ */ m(K, { children: [
62
62
  /* @__PURE__ */ d(
63
- C,
63
+ D,
64
64
  {
65
- expanded: s,
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: b
72
+ defaultIconTheme: o
73
73
  }
74
74
  ),
75
- (k || H) && /* @__PURE__ */ d(i, { role: "separator", as: "div" })
75
+ (A || H) && /* @__PURE__ */ d(i, { role: "separator", as: "div" })
76
76
  ] })
77
77
  ] }, a);
78
78
  })
79
- ] }, l);
79
+ ] }, s);
80
80
  })
81
81
  ] });
82
82
  };
83
83
  export {
84
- C as MenuItems
84
+ D as MenuItems
85
85
  };
@@ -1,45 +1,43 @@
1
1
  "use client";
2
- import { jsx as e } from "react/jsx-runtime";
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", N = {
9
+ import '../../assets/Heading.css';const H = "_heading_1dyne_1", _ = {
10
10
  heading: H
11
- }, L = ({
12
- loading: i,
13
- highlightWords: n = [],
14
- as: r = "h2",
11
+ }, T = ({
12
+ loading: e,
13
+ highlightWords: i = [],
14
+ as: o = "h2",
15
15
  size: t,
16
- leading: d = "tight",
17
- weight: s = "medium",
18
- color: m,
19
- variant: c,
20
- maxRows: l,
21
- className: g,
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: o
23
+ children: g
24
24
  }) => {
25
- const p = r;
26
- console.log("CHILDREN", o);
27
- const a = u(o, n || []);
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(N.heading, g),
29
+ className: x(_.heading, c),
32
30
  style: h,
33
31
  "data-size": t,
34
- "data-leading": d,
35
- "data-weight": s,
36
- "data-color": m,
37
- "data-variant": t === "xxs" && "default" || c,
38
- "data-max-rows": l,
39
- children: a
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
- L as Heading
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.38.2",
3
+ "version": "0.38.4",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",