@altinn/altinn-components 0.16.0 → 0.18.0

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.
Files changed (39) hide show
  1. package/README.md +39 -31
  2. package/dist/ListItemBase-BVx5MDhO.js +83 -0
  3. package/dist/assets/Flex.css +1 -1
  4. package/dist/assets/ListItemBase.css +1 -1
  5. package/dist/assets/ListItemIcon.css +1 -1
  6. package/dist/components/AccessAreaList/AccessAreaListItem.js +26 -21
  7. package/dist/components/AccessPackageList/AccessPackageListItem.js +8 -16
  8. package/dist/components/Bookmarks/BookmarksSection.js +19 -19
  9. package/dist/components/Dialog/DialogListItem.js +12 -13
  10. package/dist/components/Dialog/SeenByLog.js +0 -1
  11. package/dist/components/List/List.js +3 -3
  12. package/dist/components/List/ListBase.js +2 -2
  13. package/dist/components/List/ListItem.js +62 -62
  14. package/dist/components/List/ListItemBase.js +4 -78
  15. package/dist/components/List/ListItemHeader.js +48 -48
  16. package/dist/components/List/ListItemIcon.js +6 -6
  17. package/dist/components/List/index.js +1 -1
  18. package/dist/components/Page/Flex.js +7 -7
  19. package/dist/components/Search/Autocomplete.js +27 -24
  20. package/dist/components/Transmission/TransmissionItem.js +55 -58
  21. package/dist/components/index.js +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/types/lib/components/AccessAreaList/AccessAreaListItem.d.ts +11 -2
  24. package/dist/types/lib/components/AccessAreaList/AccessAreaListItem.stories.d.ts +11 -2
  25. package/dist/types/lib/components/AccessPackageList/AccessPackageList.stories.d.ts +11 -9
  26. package/dist/types/lib/components/AccessPackageList/AccessPackageListItem.d.ts +2 -3
  27. package/dist/types/lib/components/Dialog/DialogListItem.stories.d.ts +4 -3
  28. package/dist/types/lib/components/List/ListBase.stories.d.ts +3 -4
  29. package/dist/types/lib/components/List/ListItem.d.ts +2 -0
  30. package/dist/types/lib/components/List/ListItemBase.d.ts +24 -2
  31. package/dist/types/lib/components/List/ListItemHeader.d.ts +6 -5
  32. package/dist/types/lib/components/List/Patterns.stories.d.ts +0 -1
  33. package/dist/types/lib/components/List/Specimens.stories.d.ts +2 -2
  34. package/dist/types/lib/components/Page/Flex.d.ts +1 -1
  35. package/dist/types/lib/components/ResourceList/ResourceList.stories.d.ts +0 -7
  36. package/dist/types/lib/components/ResourceList/ResourceListItem.d.ts +9 -1
  37. package/dist/types/lib/components/ResourceList/ResourceListItem.stories.d.ts +1 -0
  38. package/dist/types/lib/components/Transmission/TransmissionItem.stories.d.ts +1 -1
  39. package/package.json +1 -1
@@ -1,113 +1,113 @@
1
- import { jsxs as U, jsx as t } from "react/jsx-runtime";
2
- import { ListItemBase as h } from "./ListItemBase.js";
1
+ import { jsx as r, jsxs as R } from "react/jsx-runtime";
2
+ import { s as x, L as c } from "../../ListItemBase-BVx5MDhO.js";
3
3
  import { ListItemHeader as B } from "./ListItemHeader.js";
4
- import { S as b } from "../../ChevronRight-DUaHaWi-.js";
5
- import { S as q } from "../../ChevronUp-H8Nuww4h.js";
6
- import { S as w } from "../../ChevronDown-CRAwzuD3.js";
7
- const O = ({
4
+ import { S as U } from "../../ChevronRight-DUaHaWi-.js";
5
+ import { S as k } from "../../ChevronUp-H8Nuww4h.js";
6
+ import { S as l } from "../../ChevronDown-CRAwzuD3.js";
7
+ const K = ({
8
8
  className: o,
9
9
  variant: v = "solid",
10
- color: p,
11
- theme: I = "default",
10
+ color: f,
11
+ theme: p = "default",
12
12
  shadow: S = "xs",
13
- loading: r,
13
+ loading: e,
14
14
  collapsible: D,
15
15
  expanded: m,
16
- size: c = "sm",
17
- icon: s,
16
+ size: t = "sm",
17
+ icon: u,
18
18
  avatar: L,
19
- avatarGroup: k,
19
+ avatarGroup: I,
20
20
  title: i,
21
- description: u,
22
- badge: C,
23
- linkIcon: H = b,
24
- label: e,
25
- select: j,
21
+ description: C,
22
+ badge: j,
23
+ linkIcon: H = !1,
24
+ label: h,
25
+ select: y,
26
26
  controls: n,
27
- children: R,
28
- ...f
27
+ children: N,
28
+ ...s
29
29
  }) => {
30
- const x = D ? m ? q : w : H, y = typeof e == "function" ? e() : e;
31
- return m ? /* @__PURE__ */ U(
32
- h,
30
+ const a = D ? m ? k : l : void 0, d = typeof h == "function" ? h() : h;
31
+ return m ? /* @__PURE__ */ r("li", { className: x.item, children: /* @__PURE__ */ R(
32
+ c,
33
33
  {
34
34
  interactive: !1,
35
35
  variant: v,
36
- color: p,
37
- theme: I,
36
+ color: f,
37
+ theme: p,
38
38
  shadow: S,
39
39
  expanded: m,
40
40
  title: i,
41
- loading: r,
41
+ loading: e,
42
42
  children: [
43
- /* @__PURE__ */ t(
44
- h,
43
+ /* @__PURE__ */ r(
44
+ c,
45
45
  {
46
46
  theme: "transparent",
47
47
  interactive: !n,
48
- size: c,
49
- color: p,
50
- loading: r,
48
+ size: t,
49
+ color: f,
50
+ loading: e,
51
51
  title: i,
52
- ...f,
53
- children: /* @__PURE__ */ t(
52
+ ...s,
53
+ children: /* @__PURE__ */ r(
54
54
  B,
55
55
  {
56
56
  className: o,
57
- loading: r,
58
- select: j,
59
- size: c,
57
+ loading: e,
58
+ select: y,
59
+ size: t,
60
60
  title: i,
61
- description: u,
62
- icon: s,
61
+ description: C,
62
+ icon: u,
63
63
  avatar: L,
64
- avatarGroup: k,
65
- badge: C,
66
- linkIcon: x,
64
+ avatarGroup: I,
65
+ badge: j,
66
+ chevron: a,
67
67
  controls: n,
68
- ...f,
69
- children: y
68
+ ...s,
69
+ children: d
70
70
  }
71
71
  )
72
72
  }
73
73
  ),
74
- R
74
+ N
75
75
  ]
76
76
  }
77
- ) : /* @__PURE__ */ t(
78
- h,
77
+ ) }) : /* @__PURE__ */ r("li", { className: x.item, children: /* @__PURE__ */ r(
78
+ c,
79
79
  {
80
80
  interactive: !n,
81
81
  variant: v,
82
- color: p,
83
- theme: I,
82
+ color: f,
83
+ theme: p,
84
84
  shadow: S,
85
85
  expanded: m,
86
- loading: r,
86
+ loading: e,
87
87
  title: i,
88
- ...f,
89
- children: /* @__PURE__ */ t(
88
+ ...s,
89
+ children: /* @__PURE__ */ r(
90
90
  B,
91
91
  {
92
92
  className: o,
93
- loading: r,
94
- select: j,
95
- size: c,
93
+ loading: e,
94
+ select: y,
95
+ size: t,
96
96
  title: i,
97
- description: u,
98
- icon: s,
97
+ description: C,
98
+ icon: u,
99
99
  avatar: L,
100
- avatarGroup: k,
101
- badge: C,
102
- linkIcon: x,
100
+ avatarGroup: I,
101
+ badge: j,
102
+ chevron: a ?? (H ? U : void 0),
103
103
  controls: n,
104
- ...f,
105
- children: y
104
+ ...s,
105
+ children: d
106
106
  }
107
107
  )
108
108
  }
109
- );
109
+ ) });
110
110
  };
111
111
  export {
112
- O as ListItem
112
+ K as ListItem
113
113
  };
@@ -1,80 +1,6 @@
1
- import { jsx as w } from "react/jsx-runtime";
2
- import { c as x } from "../../index-L8X2o7IH.js";
3
- import '../../assets/ListItemBase.css';const B = "_item_bqpwx_1", E = "_interactive_bqpwx_53", I = "_interactiveSelected_bqpwx_95", L = "_interactiveHidden_bqpwx_99", t = {
4
- item: B,
5
- interactive: E,
6
- interactiveSelected: I,
7
- interactiveHidden: L
8
- }, F = ({
9
- title: S,
10
- interactive: f = !0,
11
- as: q,
12
- href: u,
13
- onClick: a,
14
- onKeyPress: e,
15
- tabIndex: H,
16
- size: c,
17
- variant: d,
18
- color: s,
19
- theme: i,
20
- shadow: h,
21
- loading: n,
22
- disabled: r,
23
- hidden: o = !1,
24
- active: v = !1,
25
- selected: m,
26
- className: p,
27
- children: _
28
- }) => {
29
- const l = i === "transparent" ? "none" : h;
30
- if (f) {
31
- const z = x(
32
- t.item,
33
- t.interactive,
34
- p,
35
- m && t.interactiveSelected,
36
- o && t.interactiveHidden
37
- );
38
- return /* @__PURE__ */ w(
39
- q || "button",
40
- {
41
- "aria-label": S,
42
- className: z,
43
- "data-variant": d,
44
- "data-color": s,
45
- "data-theme": i,
46
- "data-size": c,
47
- "data-shadow": l,
48
- "data-active": v,
49
- href: u,
50
- onKeyPress: (b) => {
51
- b.key === "Enter" && (a == null || a()), e == null || e(b);
52
- },
53
- onClick: a,
54
- tabIndex: H,
55
- "aria-disabled": r || n,
56
- disabled: r || n,
57
- children: _
58
- }
59
- );
60
- }
61
- const j = x(t.item, p, m && t.interactiveSelected);
62
- return /* @__PURE__ */ w(
63
- "article",
64
- {
65
- className: j,
66
- "data-variant": d,
67
- "data-color": s,
68
- "data-theme": i,
69
- "data-size": c,
70
- "data-shadow": l,
71
- "data-active": v,
72
- "aria-hidden": o,
73
- "aria-disabled": r || n,
74
- children: _
75
- }
76
- );
77
- };
1
+ import "react/jsx-runtime";
2
+ import "../../index-L8X2o7IH.js";
3
+ import { L as e } from "../../ListItemBase-BVx5MDhO.js";
78
4
  export {
79
- F as ListItemBase
5
+ e as ListItemBase
80
6
  };
@@ -1,39 +1,39 @@
1
- import { jsxs as t, jsx as e, Fragment as p } from "react/jsx-runtime";
2
- import { c as E } from "../../index-L8X2o7IH.js";
3
- import { isValidElement as g } from "react";
1
+ import { jsxs as i, jsx as e, Fragment as p } from "react/jsx-runtime";
2
+ import { c as y } from "../../index-L8X2o7IH.js";
3
+ import { isValidElement as B } from "react";
4
4
  import { Icon as d } from "../Icon/Icon.js";
5
- import { Badge as y } from "../Badge/Badge.js";
5
+ import { Badge as M } from "../Badge/Badge.js";
6
6
  import "../RootProvider/RootProvider.js";
7
- import { ListItemLink as B } from "./ListItemLink.js";
8
- import { ListItemLabel as M } from "./ListItemLabel.js";
9
- import { ListItemIcon as C } from "./ListItemIcon.js";
10
- import { ListItemControls as F } from "./ListItemControls.js";
11
- import { ListItemSelect as H } from "./ListItemSelect.js";
7
+ import { ListItemLink as v } from "./ListItemLink.js";
8
+ import { ListItemLabel as C } from "./ListItemLabel.js";
9
+ import { ListItemIcon as F } from "./ListItemIcon.js";
10
+ import { ListItemControls as H } from "./ListItemControls.js";
11
+ import { ListItemSelect as V } from "./ListItemSelect.js";
12
12
  import "../Search/AutocompleteBase.js";
13
13
  import "../Snackbar/useSnackbar.js";
14
- import '../../assets/ListItemHeader.css';const V = "_header_13dzg_1", b = "_link_13dzg_39", m = {
15
- header: V,
16
- link: b
14
+ import '../../assets/ListItemHeader.css';const b = "_header_13dzg_1", g = "_link_13dzg_39", m = {
15
+ header: b,
16
+ link: g
17
17
  }, X = ({
18
18
  as: f,
19
- loading: i,
20
- disabled: h,
19
+ loading: t,
20
+ disabled: I,
21
21
  select: c,
22
- href: L,
23
- onClick: x,
24
- onKeyPress: z,
25
- tabIndex: I,
22
+ href: h,
23
+ onClick: L,
24
+ onKeyPress: x,
25
+ tabIndex: z,
26
26
  size: s = "sm",
27
- title: _,
28
- description: u,
29
- icon: N,
30
- avatar: v,
27
+ title: k,
28
+ description: _,
29
+ icon: u,
30
+ avatar: N,
31
31
  avatarGroup: S,
32
- linkIcon: o,
32
+ chevron: l,
33
33
  badge: r,
34
- controls: l,
34
+ controls: o,
35
35
  className: j,
36
- children: k
36
+ children: E
37
37
  }) => {
38
38
  const n = {
39
39
  xs: "sm",
@@ -41,46 +41,46 @@ import '../../assets/ListItemHeader.css';const V = "_header_13dzg_1", b = "_link
41
41
  md: "lg",
42
42
  lg: "lg",
43
43
  xl: "xl"
44
- }[s], a = () => r && typeof r == "object" && "label" in r ? /* @__PURE__ */ e(y, { ...r }) : g(r) ? r : null;
45
- return /* @__PURE__ */ t("header", { className: m.header, "data-size": s, children: [
46
- /* @__PURE__ */ t("div", { className: m.link, children: [
47
- c && /* @__PURE__ */ e(H, { ...c, className: m.select, size: n }),
48
- /* @__PURE__ */ t(
49
- B,
44
+ }[s], a = () => r && !t && typeof r == "object" && "label" in r ? /* @__PURE__ */ e(M, { ...r }) : B(r) ? r : null;
45
+ return /* @__PURE__ */ i("header", { className: m.header, "data-size": s, children: [
46
+ /* @__PURE__ */ i("div", { className: m.link, children: [
47
+ c && /* @__PURE__ */ e(V, { ...c, className: m.select, size: n }),
48
+ /* @__PURE__ */ i(
49
+ v,
50
50
  {
51
- interactive: !!l,
52
- className: E(m.link, j),
51
+ interactive: !!o,
52
+ className: y(m.link, j),
53
53
  as: f,
54
- href: L,
55
- onClick: x,
56
- onKeyPress: z,
57
- tabIndex: I,
58
- loading: i,
59
- disabled: h || i,
54
+ href: h,
55
+ onClick: L,
56
+ onKeyPress: x,
57
+ tabIndex: z,
58
+ loading: t,
59
+ disabled: I || t,
60
60
  size: s,
61
61
  children: [
62
62
  /* @__PURE__ */ e(
63
- C,
63
+ F,
64
64
  {
65
- loading: i,
65
+ loading: t,
66
66
  size: n,
67
- icon: N,
68
- avatar: v,
67
+ icon: u,
68
+ avatar: N,
69
69
  avatarGroup: S
70
70
  }
71
71
  ),
72
- /* @__PURE__ */ e(M, { size: s, loading: i, title: _, description: u, children: k }),
73
- l && /* @__PURE__ */ t(p, { children: [
72
+ /* @__PURE__ */ e(C, { size: s, loading: t, title: k, description: _, children: E }),
73
+ o && /* @__PURE__ */ i(p, { children: [
74
74
  a(),
75
- o && /* @__PURE__ */ e(d, { svgElement: o, size: n })
75
+ l && /* @__PURE__ */ e(d, { svgElement: l, size: n })
76
76
  ] })
77
77
  ]
78
78
  }
79
79
  )
80
80
  ] }),
81
- /* @__PURE__ */ e(F, { className: m.controls, children: l || /* @__PURE__ */ t(p, { children: [
81
+ /* @__PURE__ */ e(H, { className: m.controls, children: o && !t ? o : /* @__PURE__ */ i(p, { children: [
82
82
  a(),
83
- o && /* @__PURE__ */ e(d, { svgElement: o, size: n })
83
+ l && /* @__PURE__ */ e(d, { svgElement: l, size: n })
84
84
  ] }) })
85
85
  ] });
86
86
  };
@@ -1,15 +1,15 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { Icon as c } from "../Icon/Icon.js";
3
3
  import "../../index-L8X2o7IH.js";
4
- import { IconOrAvatar as p } from "../Icon/IconOrAvatar.js";
4
+ import { IconOrAvatar as l } from "../Icon/IconOrAvatar.js";
5
5
  import "react";
6
6
  import "../RootProvider/RootProvider.js";
7
7
  import "../Search/AutocompleteBase.js";
8
8
  import "../Snackbar/useSnackbar.js";
9
- import { S as e } from "../../XMark-Bv1I87Ev.js";
10
- import '../../assets/ListItemIcon.css';const f = "_icon_vryvy_1", l = {
11
- icon: f
12
- }, d = ({ loading: s, size: r = "sm", icon: t, avatar: m, avatarGroup: n, children: i }) => !t && !m && !n && !i ? null : s ? /* @__PURE__ */ o(c, { svgElement: e, size: r, loading: !0 }) : /* @__PURE__ */ o("span", { className: l.icon, children: i || /* @__PURE__ */ o(p, { size: r, icon: t, avatar: m, avatarGroup: n }) });
9
+ import { S as p } from "../../XMark-Bv1I87Ev.js";
10
+ import '../../assets/ListItemIcon.css';const e = "_listIcon_ghios_1", I = {
11
+ listIcon: e
12
+ }, j = ({ loading: n, size: t = "sm", icon: r, avatar: m, avatarGroup: s, children: i }) => !r && !m && !s && !i ? null : n ? /* @__PURE__ */ o(c, { svgElement: p, size: t, loading: !0 }) : /* @__PURE__ */ o("span", { className: I.listIcon, children: i || /* @__PURE__ */ o(l, { size: t, icon: r, avatar: m, avatarGroup: s }) });
13
13
  export {
14
- d as ListItemIcon
14
+ j as ListItemIcon
15
15
  };
@@ -1,4 +1,4 @@
1
- import { ListItemBase as o } from "./ListItemBase.js";
1
+ import { L as o } from "../../ListItemBase-BVx5MDhO.js";
2
2
  import { ListItemLink as m } from "./ListItemLink.js";
3
3
  import { ListItemHeader as L } from "./ListItemHeader.js";
4
4
  import { ListItemLabel as f } from "./ListItemLabel.js";
@@ -1,6 +1,6 @@
1
- import { jsx as w } from "react/jsx-runtime";
1
+ import { jsx as v } from "react/jsx-runtime";
2
2
  import { c as _ } from "../../index-L8X2o7IH.js";
3
- import '../../assets/Flex.css';const h = "_flex_8w6x1_1", j = {
3
+ import '../../assets/Flex.css';const h = "_flex_vvg9d_1", j = {
4
4
  flex: h
5
5
  }, C = ({
6
6
  as: a = "div",
@@ -16,14 +16,14 @@ import '../../assets/Flex.css';const h = "_flex_8w6x1_1", j = {
16
16
  margin: c,
17
17
  bleed: f = !1,
18
18
  className: m,
19
- style: x,
20
- children: p,
19
+ style: p,
20
+ children: x,
21
21
  ...g
22
- }) => /* @__PURE__ */ w(
22
+ }) => /* @__PURE__ */ v(
23
23
  a,
24
24
  {
25
25
  className: _(j.flex, m),
26
- style: x,
26
+ style: p,
27
27
  "data-color": t,
28
28
  "data-theme": e,
29
29
  "data-shadow": n,
@@ -36,7 +36,7 @@ import '../../assets/Flex.css';const h = "_flex_8w6x1_1", j = {
36
36
  "data-margin": c,
37
37
  "data-bleed": f,
38
38
  ...g,
39
- children: p
39
+ children: x
40
40
  }
41
41
  );
42
42
  export {
@@ -1,42 +1,45 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { useRef as b, createElement as v } from "react";
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { useRef as v, createElement as x } from "react";
3
3
  import "../../index-L8X2o7IH.js";
4
- import { useMenu as x } from "../../hooks/useMenu.js";
4
+ import { useMenu as A } from "../../hooks/useMenu.js";
5
5
  import "../RootProvider/RootProvider.js";
6
- import { AutocompleteBase as A } from "./AutocompleteBase.js";
7
- import { AutocompleteGroup as I } from "./AutocompleteGroup.js";
6
+ import { AutocompleteBase as I } from "./AutocompleteBase.js";
7
+ import { AutocompleteGroup as l } from "./AutocompleteGroup.js";
8
8
  import { AutocompleteItem as h } from "./AutocompleteItem.js";
9
9
  import "../Snackbar/useSnackbar.js";
10
10
  import { useEnterKey as k } from "../../hooks/useEnterKey.js";
11
- const C = ({ className: u, items: i, groups: s = {}, expanded: n, onSelect: r }) => {
12
- const p = b(null);
11
+ const C = ({ className: u, items: s, groups: i = {}, expanded: n, onSelect: r }) => {
12
+ const p = v(null);
13
13
  k(() => {
14
- var t;
15
- const e = (t = p.current) == null ? void 0 : t.querySelector('[data-active="true"]');
16
- e == null || e.dispatchEvent(new MouseEvent("click", { bubbles: !0 })), r == null || r();
14
+ var e;
15
+ const t = (e = p.current) == null ? void 0 : e.querySelector('[data-active="true"]');
16
+ t == null || t.dispatchEvent(new MouseEvent("click", { bubbles: !0 })), r == null || r();
17
17
  });
18
- const { menu: c, setActiveIndex: d } = x({
19
- items: i,
20
- groups: s,
18
+ const { menu: a, setActiveIndex: c } = A({
19
+ items: s,
20
+ groups: i,
21
21
  groupByKey: "groupId",
22
22
  keyboardEvents: !0
23
23
  });
24
- return /* @__PURE__ */ o(A, { className: u, expanded: n, ref: p, children: c.map((e, t) => /* @__PURE__ */ v(I, { ...e.props, key: t }, /* @__PURE__ */ o("ul", { children: e.items.map((a, f) => {
24
+ return /* @__PURE__ */ m(I, { className: u, expanded: n, ref: p, children: a.map((t, e) => /* @__PURE__ */ x(l, { ...t.props, key: e }, /* @__PURE__ */ m("ul", { children: t.items.map((d, f) => {
25
25
  const {
26
- active: l,
27
- menuIndex: y,
28
- props: { groupId: M, onClick: m, ...E }
29
- } = a;
30
- return /* @__PURE__ */ o("li", { tabIndex: -1, onMouseEnter: () => d(y), children: /* @__PURE__ */ o(
26
+ active: y,
27
+ menuIndex: E,
28
+ props: { groupId: M, onClick: o, ...b }
29
+ } = d;
30
+ return /* @__PURE__ */ m(
31
31
  h,
32
32
  {
33
- ...E,
33
+ tabIndex: -1,
34
+ onMouseEnter: () => c(E),
35
+ ...b,
34
36
  onClick: () => {
35
- m == null || m(), r == null || r();
37
+ o == null || o(), r == null || r();
36
38
  },
37
- active: l
38
- }
39
- ) }, f);
39
+ active: y
40
+ },
41
+ f
42
+ );
40
43
  }) }))) });
41
44
  };
42
45
  export {