@altinn/altinn-components 0.38.2 → 0.38.5

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,56 +1,56 @@
1
1
  "use client";
2
- import { jsx as w } from "react/jsx-runtime";
3
- import { useState as I } from "react";
2
+ import { jsx as I } from "react/jsx-runtime";
3
+ import { useState as c } from "react";
4
4
  import "../../index-L8X2o7IH.js";
5
5
  import "../RootProvider/RootProvider.js";
6
6
  import { Menu as M } from "../Menu/Menu.js";
7
7
  import "../Snackbar/useSnackbar.js";
8
8
  const b = (n) => `${n} hits`, k = ({
9
9
  items: n = [],
10
- groups: h = {},
10
+ groups: f = {},
11
11
  search: t,
12
12
  onSelectAccount: r,
13
13
  currentAccount: s,
14
- menuItemsVirtual: C
14
+ menuItemsVirtual: h
15
15
  }) => {
16
- var p;
16
+ var u;
17
17
  const d = n.map((o) => ({
18
18
  ...o,
19
19
  title: (o == null ? void 0 : o.title) || o.name,
20
20
  groupId: o.groupId || "search",
21
21
  selected: o.selected ?? (s == null ? void 0 : s.id) === o.id,
22
22
  onClick: () => r == null ? void 0 : r(o.id)
23
- })), [l, a] = I(""), e = l ? d.filter(
23
+ })), [l, a] = c(""), e = l ? d.filter(
24
24
  (o) => {
25
- var g, i, f;
26
- return ((g = o == null ? void 0 : o.name) == null ? void 0 : g.toLowerCase().includes(l.toLowerCase())) || ((f = (i = o == null ? void 0 : o.description) == null ? void 0 : i.toString()) == null ? void 0 : f.toLowerCase().includes(l.toLowerCase()));
25
+ var p, g, i;
26
+ return ((p = o == null ? void 0 : o.name) == null ? void 0 : p.toLowerCase().includes(l.toLowerCase())) || ((i = (g = o == null ? void 0 : o.description) == null ? void 0 : g.toString()) == null ? void 0 : i.toLowerCase().includes(l.toLowerCase()));
27
27
  }
28
28
  ).map((o) => ({
29
29
  ...o,
30
30
  groupId: "search",
31
31
  title: (o == null ? void 0 : o.title) || o.name,
32
32
  highlightWords: [l]
33
- })) : d, L = l ? {
33
+ })) : d, C = l ? {
34
34
  search: {
35
- title: ((p = t == null ? void 0 : t.getResultsLabel) == null ? void 0 : p.call(t, e.length)) ?? b(e.length)
35
+ title: ((u = t == null ? void 0 : t.getResultsLabel) == null ? void 0 : u.call(t, e.length)) ?? b(e.length)
36
36
  }
37
- } : h, c = {
37
+ } : f, L = {
38
38
  name: "account-search",
39
39
  value: l,
40
40
  placeholder: (t == null ? void 0 : t.placeholder) ?? "Find account",
41
41
  onChange: (o) => a(o.target.value),
42
42
  onClear: () => a("")
43
- }, u = [
43
+ }, w = [
44
44
  ...e.length > 0 ? e : [{ id: "search", groupId: "search", hidden: !0 }]
45
45
  ];
46
- return console.log("items", u), /* @__PURE__ */ w(
46
+ return /* @__PURE__ */ I(
47
47
  M,
48
48
  {
49
49
  theme: "default",
50
- search: t && c,
51
- groups: L,
52
- items: u,
53
- menuItemsVirtual: C
50
+ search: t && L,
51
+ groups: C,
52
+ items: w,
53
+ menuItemsVirtual: h
54
54
  }
55
55
  );
56
56
  };
@@ -1,21 +1,17 @@
1
1
  import { jsxs as t, jsx as r } from "react/jsx-runtime";
2
2
  import "../../index-L8X2o7IH.js";
3
3
  import "react";
4
- import { Button as n } from "../Button/Button.js";
5
4
  import "../RootProvider/RootProvider.js";
6
- import { Heading as e } from "../Typography/Heading.js";
7
- import { List as p } from "../List/List.js";
5
+ import { Typography as p } from "../Typography/Typography.js";
6
+ import { Heading as s } from "../Typography/Heading.js";
7
+ import { List as e } from "../List/List.js";
8
8
  import "../Snackbar/useSnackbar.js";
9
- import { Flex as s } from "../Page/Flex.js";
10
- import { Section as c } from "../Page/Section.js";
11
- import { S as a } from "../../Checkmark-D17Nyv_u.js";
12
- const z = ({ title: i, children: m, checkAllLabel: o }) => /* @__PURE__ */ t(c, { spacing: 3, children: [
13
- i && /* @__PURE__ */ t(s, { direction: "row", align: "center", justify: "between", children: [
14
- /* @__PURE__ */ r(e, { size: "lg", children: i }),
15
- o && /* @__PURE__ */ r(n, { variant: "text", icon: a, size: "sm", children: o })
16
- ] }),
17
- /* @__PURE__ */ r(p, { spacing: 3, children: m })
9
+ import { Section as n } from "../Page/Section.js";
10
+ const j = ({ title: o, description: i, children: m }) => /* @__PURE__ */ t(n, { spacing: 3, children: [
11
+ o && /* @__PURE__ */ r(s, { size: "lg", children: o }),
12
+ i && /* @__PURE__ */ r(p, { size: "sm", style: { marginBottom: ".5em" }, children: i }),
13
+ /* @__PURE__ */ r(e, { spacing: 3, children: m })
18
14
  ] });
19
15
  export {
20
- z as DialogListGroup
16
+ j as DialogListGroup
21
17
  };
@@ -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
  };
@@ -13,6 +13,7 @@ declare const meta: {
13
13
  };
14
14
  export default meta;
15
15
  type Story = StoryObj<typeof meta>;
16
- export declare const Default: Story;
17
16
  export declare const GroupedByDate: Story;
18
- export declare const GroupedByRoute: Story;
17
+ export declare const SearchResults: Story;
18
+ export declare const SingleGroup: Story;
19
+ export declare const Ungrouped: Story;
@@ -1,7 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
2
  export interface DialogListGroupProps {
3
- title?: string;
3
+ title?: string | ReactNode;
4
+ description?: string | ReactNode;
4
5
  children?: ReactNode;
5
- checkAllLabel?: string;
6
6
  }
7
- export declare const DialogListGroup: ({ title, children, checkAllLabel }: DialogListGroupProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const DialogListGroup: ({ title, description, children }: DialogListGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -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;
@@ -10,4 +10,6 @@ export default meta;
10
10
  export declare const Default: () => import("react/jsx-runtime").JSX.Element;
11
11
  export declare const WithContact: () => import("react/jsx-runtime").JSX.Element;
12
12
  export declare const PageNotFound: () => import("react/jsx-runtime").JSX.Element;
13
+ export declare const UnknownError: () => import("react/jsx-runtime").JSX.Element;
14
+ export declare const DownForMaintenance: () => import("react/jsx-runtime").JSX.Element;
13
15
  export declare const LoginError: () => 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.5",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",