@altinn/altinn-components 0.42.0 → 0.42.1

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,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.1",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",