@altinn/altinn-components 0.42.0 → 0.42.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.
@@ -5,14 +5,14 @@ import "react";
5
5
  import { useRootContext as H } from "../RootProvider/RootProvider.js";
6
6
  import { DropdownBase as S } from "../Dropdown/DropdownBase.js";
7
7
  import { DrawerBase as k } from "../Dropdown/DrawerBase.js";
8
- import { GlobalMenu as w } from "../GlobalMenu/GlobalMenu.js";
8
+ import { GlobalMenu as f } from "../GlobalMenu/GlobalMenu.js";
9
9
  import { GlobalMenuButton as B } from "../GlobalMenu/GlobalMenuButton.js";
10
10
  import { HeaderBase as D } from "./HeaderBase.js";
11
11
  import { HeaderLogo as I } from "./HeaderLogo.js";
12
12
  import { HeaderGroup as N } from "./HeaderGroup.js";
13
- import { HeaderSearch as x } from "./HeaderSearch.js";
13
+ import { HeaderSearch as w } from "./HeaderSearch.js";
14
14
  import { LocaleSwitcher as F } from "./LocaleSwitcher.js";
15
- import { Searchbar as _ } from "../Searchbar/Searchbar.js";
15
+ import { Searchbar as x } from "../Searchbar/Searchbar.js";
16
16
  import "../Snackbar/useSnackbar.js";
17
17
  import { useIsDesktop as G } from "../../hooks/useIsDesktop.js";
18
18
  import '../../assets/Header.css';const L = "_drawer_afyu3_1", j = "_dropdown_afyu3_6", z = "_relative_afyu3_19", t = {
@@ -21,21 +21,21 @@ import '../../assets/Header.css';const L = "_drawer_afyu3_1", j = "_dropdown_afy
21
21
  relative: z
22
22
  }, A = ({
23
23
  globalMenu: e,
24
- desktopMenu: C,
25
- mobileMenu: u,
24
+ desktopMenu: _,
25
+ mobileMenu: C,
26
26
  locale: p,
27
27
  search: s,
28
28
  currentAccount: m,
29
- logo: l = {},
30
- badge: i
29
+ logo: u = {},
30
+ badge: l
31
31
  }) => {
32
- const { currentId: r, toggleId: c, openId: v, closeAll: d } = H(), a = () => {
32
+ const { currentId: r, toggleId: i, openId: v, closeAll: d } = H(), c = () => {
33
33
  v("search");
34
- }, h = () => {
35
- c("search");
34
+ }, a = () => {
35
+ i("search");
36
36
  }, y = () => {
37
- c("menu");
38
- }, f = G();
37
+ i("menu");
38
+ }, h = G();
39
39
  return /* @__PURE__ */ n(
40
40
  D,
41
41
  {
@@ -43,15 +43,14 @@ import '../../assets/Header.css';const L = "_drawer_afyu3_1", j = "_dropdown_afy
43
43
  open: r === "search" || r === "menu" || r === "locale",
44
44
  onClose: d,
45
45
  children: [
46
- /* @__PURE__ */ o(I, { ...l, badge: i, className: t.logo }),
47
- s && f && /* @__PURE__ */ o(x, { expanded: r === "search", children: /* @__PURE__ */ o(_, { ...s, expanded: r === "search", onClose: h, onFocus: a }) }),
46
+ /* @__PURE__ */ o(I, { ...u, badge: l, className: t.logo }),
47
+ s && h && /* @__PURE__ */ o(w, { expanded: r === "search", children: /* @__PURE__ */ o(x, { ...s, expanded: r === "search", onClose: a, onFocus: c }) }),
48
48
  /* @__PURE__ */ n(N, { children: [
49
49
  p && /* @__PURE__ */ o(F, { ...p }),
50
50
  /* @__PURE__ */ n("div", { className: t.relative, children: [
51
51
  /* @__PURE__ */ o(
52
52
  B,
53
53
  {
54
- badge: i,
55
54
  currentAccount: m,
56
55
  onClick: y,
57
56
  expanded: r === "menu",
@@ -68,10 +67,10 @@ import '../../assets/Header.css';const L = "_drawer_afyu3_1", j = "_dropdown_afy
68
67
  open: r === "menu",
69
68
  className: t.dropdown,
70
69
  children: /* @__PURE__ */ o(
71
- w,
70
+ f,
72
71
  {
73
72
  ...e,
74
- menu: C || (e == null ? void 0 : e.menu),
73
+ menu: _ || (e == null ? void 0 : e.menu),
75
74
  currentAccount: m,
76
75
  onClose: d
77
76
  }
@@ -80,12 +79,12 @@ import '../../assets/Header.css';const L = "_drawer_afyu3_1", j = "_dropdown_afy
80
79
  )
81
80
  ] })
82
81
  ] }),
83
- s && !f && /* @__PURE__ */ o(x, { expanded: r === "search", children: /* @__PURE__ */ o(_, { ...s, expanded: r === "search", onClose: h, onFocus: a }) }),
82
+ s && !h && /* @__PURE__ */ o(w, { expanded: r === "search", children: /* @__PURE__ */ o(x, { ...s, expanded: r === "search", onClose: a, onFocus: c }) }),
84
83
  e && /* @__PURE__ */ o(k, { open: r === "menu", className: t.drawer, children: /* @__PURE__ */ o(
85
- w,
84
+ f,
86
85
  {
87
86
  ...e,
88
- menu: u || (e == null ? void 0 : e.menu),
87
+ menu: C || (e == null ? void 0 : e.menu),
89
88
  currentAccount: m,
90
89
  onClose: d
91
90
  }
@@ -1,35 +1,44 @@
1
1
  "use client";
2
- import { jsx as o, jsxs as e } from "react/jsx-runtime";
3
- import { useState as B, createElement as L, Fragment as S } from "react";
2
+ import { jsx as n, jsxs as u } from "react/jsx-runtime";
3
+ import { useState as B, createElement as L, useMemo as S, Fragment as j } from "react";
4
4
  import "../../index-L8X2o7IH.js";
5
5
  import "../RootProvider/RootProvider.js";
6
- import { SeenByLogButton as i } from "../Dialog/SeenByLogButton.js";
7
- import { Divider as u } from "../Divider/Divider.js";
8
- import { List as a } from "../List/List.js";
6
+ import { SeenByLogButton as g } from "../Dialog/SeenByLogButton.js";
7
+ import { Divider as i } from "../Divider/Divider.js";
8
+ import { List as m } from "../List/List.js";
9
9
  import "../Snackbar/useSnackbar.js";
10
- import { Flex as j } from "../Page/Flex.js";
10
+ import { Flex as k } from "../Page/Flex.js";
11
11
  import { Section as f } from "../Page/Section.js";
12
12
  import { UsedByLogItem as h } from "./UsedByLogItem.js";
13
- const w = ({
14
- collapsible: d = !0,
13
+ const q = ({
14
+ collapsible: a = !0,
15
15
  expanded: l,
16
16
  title: c,
17
17
  items: r,
18
18
  size: p = "sm",
19
19
  endUserLabel: t
20
20
  }) => {
21
- const [g, m] = B(l || !d && !0), x = () => {
22
- m((n) => !n);
21
+ const [d, v] = B(l || !a && !0), x = () => {
22
+ v((o) => !o);
23
23
  };
24
- return (r == null ? void 0 : r.length) === 1 ? /* @__PURE__ */ o(f, { spacing: 1, children: /* @__PURE__ */ o(a, { size: p, spacing: 1, children: r == null ? void 0 : r.map((n) => /* @__PURE__ */ L(h, { ...n, key: n.id, size: p, endUserLabel: t })) }) }) : /* @__PURE__ */ e(f, { spacing: 1, children: [
25
- c && /* @__PURE__ */ o(j, { children: d ? /* @__PURE__ */ o(i, { icon: { items: r }, as: "button", onClick: x, children: c }) : /* @__PURE__ */ o(i, { icon: { items: r }, as: "div", children: c }) }),
26
- c && g && /* @__PURE__ */ o(u, {}),
27
- g && /* @__PURE__ */ o(a, { size: p, spacing: 1, children: r == null ? void 0 : r.map((n, y) => /* @__PURE__ */ e(S, { children: [
28
- y > 0 && /* @__PURE__ */ o(u, {}),
29
- /* @__PURE__ */ o(h, { ...n, size: p, endUserLabel: t })
30
- ] }, n.id)) })
24
+ if ((r == null ? void 0 : r.length) === 1)
25
+ return /* @__PURE__ */ n(f, { spacing: 1, children: /* @__PURE__ */ n(m, { size: p, spacing: 1, children: r == null ? void 0 : r.map((o) => /* @__PURE__ */ L(h, { ...o, key: o.id, size: p, endUserLabel: t })) }) });
26
+ const e = S(
27
+ () => r.map((o) => ({
28
+ ...o,
29
+ ...o.avatar
30
+ })),
31
+ [r]
32
+ );
33
+ return /* @__PURE__ */ u(f, { spacing: 1, children: [
34
+ c && /* @__PURE__ */ n(k, { children: a ? /* @__PURE__ */ n(g, { icon: { items: e }, as: "button", onClick: x, children: c }) : /* @__PURE__ */ n(g, { icon: { items: e }, as: "div", children: c }) }),
35
+ c && d && /* @__PURE__ */ n(i, {}),
36
+ d && /* @__PURE__ */ n(m, { size: p, spacing: 1, children: r == null ? void 0 : r.map((o, y) => /* @__PURE__ */ u(j, { children: [
37
+ y > 0 && /* @__PURE__ */ n(i, {}),
38
+ /* @__PURE__ */ n(h, { ...o, size: p, endUserLabel: t })
39
+ ] }, o.id)) })
31
40
  ] });
32
41
  };
33
42
  export {
34
- w as UsedByLog
43
+ q as UsedByLog
35
44
  };
@@ -1,22 +1,23 @@
1
- import { jsxs as r, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as r, jsx as s } from "react/jsx-runtime";
2
2
  import "../../index-L8X2o7IH.js";
3
3
  import "react";
4
- import { Badge as s } from "../Badge/Badge.js";
5
- import { Byline as p } from "../Byline/Byline.js";
4
+ import { Badge as p } from "../Badge/Badge.js";
5
+ import { Byline as c } from "../Byline/Byline.js";
6
6
  import "../RootProvider/RootProvider.js";
7
7
  import "../Snackbar/useSnackbar.js";
8
- import { Flex as c } from "../Page/Flex.js";
9
- const u = ({
8
+ import { Flex as g } from "../Page/Flex.js";
9
+ const v = ({
10
10
  type: e,
11
11
  name: t,
12
12
  description: o,
13
13
  isEndUser: m,
14
14
  endUserLabel: a,
15
- size: l = "sm"
15
+ avatar: l,
16
+ size: n = "sm"
16
17
  }) => {
17
18
  const i = m && { label: a };
18
- return /* @__PURE__ */ r(c, { align: "center", spacing: 2, as: "li", children: [
19
- /* @__PURE__ */ r(p, { size: l, avatar: { name: t, type: e }, children: [
19
+ return /* @__PURE__ */ r(g, { align: "center", spacing: 2, as: "li", children: [
20
+ /* @__PURE__ */ r(c, { size: n, avatar: { name: t, type: e, ...l }, children: [
20
21
  /* @__PURE__ */ r("strong", { children: [
21
22
  t,
22
23
  o && NaN
@@ -24,9 +25,9 @@ const u = ({
24
25
  " ",
25
26
  o
26
27
  ] }),
27
- i && /* @__PURE__ */ n(s, { variant: "subtle", ...i })
28
+ i && /* @__PURE__ */ s(p, { variant: "subtle", ...i })
28
29
  ] });
29
30
  };
30
31
  export {
31
- u as UsedByLogItem
32
+ v as UsedByLogItem
32
33
  };
@@ -6,8 +6,9 @@ export interface UsedByLogItemProps extends AvatarProps {
6
6
  endUserLabel?: string;
7
7
  badge?: BadgeProps;
8
8
  size?: 'sm' | 'md';
9
+ avatar?: AvatarProps;
9
10
  }
10
11
  /**
11
12
  * SeenByLog item
12
13
  */
13
- export declare const UsedByLogItem: ({ type, name, description, isEndUser, endUserLabel, size, }: UsedByLogItemProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const UsedByLogItem: ({ type, name, description, isEndUser, endUserLabel, avatar, size, }: UsedByLogItemProps) => 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.42.0",
3
+ "version": "0.42.2",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",