@altinn/altinn-components 0.50.4 → 0.50.6
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.
- package/dist/components/Account/AccountListVirtual.js +11 -10
- package/dist/components/List/ListItem.js +55 -53
- package/dist/components/List/ListItemHeader.js +69 -65
- package/dist/components/List/ListItemLink.js +23 -18
- package/dist/components/Menu/MenuItemsVirtual.js +18 -17
- package/dist/components/Toolbar/ToolbarAdd.js +7 -7
- package/dist/components/Toolbar/ToolbarFilter.js +17 -17
- package/dist/functions/date/date.js +4 -8
- package/dist/functions/date/date.spec.js +7 -5
- package/dist/types/lib/components/Account/AccountListItem.stories.d.ts +1 -0
- package/dist/types/lib/components/List/ListItemHeader.d.ts +1 -1
- package/dist/types/lib/components/List/ListItemLink.d.ts +4 -1
- package/dist/types/lib/components/Settings/SettingsItem.stories.d.ts +1 -0
- package/dist/types/lib/components/Transmission/Transmission.stories.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as l } from "react/jsx-runtime";
|
|
3
|
-
import { u as
|
|
4
|
-
import { useRef as
|
|
3
|
+
import { u as h } from "../../index-D-VWMqlv.js";
|
|
4
|
+
import { useRef as v, useEffect as x } from "react";
|
|
5
5
|
import "../../index-L8X2o7IH.js";
|
|
6
|
-
import { AccountListItem as
|
|
6
|
+
import { AccountListItem as I } from "./AccountListItem.js";
|
|
7
7
|
import { useMenu as _ } from "../../hooks/useMenu.js";
|
|
8
8
|
import { Heading as L } from "../Typography/Heading.js";
|
|
9
9
|
import "../RootProvider/RootProvider.js";
|
|
10
10
|
import "../Snackbar/useSnackbar.js";
|
|
11
11
|
import { Section as S } from "../Page/Section.js";
|
|
12
|
-
import '../../assets/AccountListVirtual.css';const $ = "_virtualScrollRef_188ep_1", C = "_virtualList_188ep_9", P = "_virtualListItem_188ep_15",
|
|
12
|
+
import '../../assets/AccountListVirtual.css';const $ = "_virtualScrollRef_188ep_1", C = "_virtualList_188ep_9", P = "_virtualListItem_188ep_15", z = "_lastChild_188ep_31", E = "_virtualTitleItem_188ep_35", o = {
|
|
13
13
|
virtualScrollRef: $,
|
|
14
14
|
virtualList: C,
|
|
15
15
|
virtualListItem: P,
|
|
16
|
-
lastChild:
|
|
17
|
-
virtualTitleItem:
|
|
16
|
+
lastChild: z,
|
|
17
|
+
virtualTitleItem: E
|
|
18
18
|
}, j = ({ items: u, groups: d = {}, sortGroupBy: f }) => {
|
|
19
|
-
const n =
|
|
19
|
+
const n = v(null), { menu: y } = _({
|
|
20
20
|
items: u,
|
|
21
21
|
groups: d,
|
|
22
22
|
groupByKey: "groupId",
|
|
@@ -31,8 +31,9 @@ import '../../assets/AccountListVirtual.css';const $ = "_virtualScrollRef_188ep_
|
|
|
31
31
|
itemProps: s.props || {}
|
|
32
32
|
}))
|
|
33
33
|
];
|
|
34
|
-
}), m =
|
|
34
|
+
}), m = h({
|
|
35
35
|
count: a.length,
|
|
36
|
+
useAnimationFrameWithResizeObserver: !0,
|
|
36
37
|
gap: 8,
|
|
37
38
|
estimateSize: (t) => {
|
|
38
39
|
var c;
|
|
@@ -44,7 +45,7 @@ import '../../assets/AccountListVirtual.css';const $ = "_virtualScrollRef_188ep_
|
|
|
44
45
|
},
|
|
45
46
|
getScrollElement: () => n.current
|
|
46
47
|
}), p = m.getVirtualItems();
|
|
47
|
-
return
|
|
48
|
+
return x(() => {
|
|
48
49
|
var t, e, i;
|
|
49
50
|
for (const r of p) {
|
|
50
51
|
const s = ((t = n.current) == null ? void 0 : t.querySelector(`[data-index="${r.index}"]`)) ?? ((e = n.current) == null ? void 0 : e.querySelector(`[dataindex="${r.index}"]`)) ?? ((i = n.current) == null ? void 0 : i.querySelector(`[dataIndex="${r.index}"]`));
|
|
@@ -81,7 +82,7 @@ import '../../assets/AccountListVirtual.css';const $ = "_virtualScrollRef_188ep_
|
|
|
81
82
|
"data-index": t.index,
|
|
82
83
|
className: `${o.virtualListItem} ${c ? o.lastChild : ""}`,
|
|
83
84
|
style: { transform: `translateY(${t.start}px)` },
|
|
84
|
-
children: /* @__PURE__ */ l(
|
|
85
|
+
children: /* @__PURE__ */ l(I, { ...e.itemProps, containerAs: "div" })
|
|
85
86
|
},
|
|
86
87
|
t.key
|
|
87
88
|
);
|
|
@@ -1,79 +1,81 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
3
|
-
import {
|
|
1
|
+
import { jsxs as N, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { c as k } from "../../index-L8X2o7IH.js";
|
|
3
|
+
import { useId as q } from "react";
|
|
4
|
+
import { ListItemBase as A } from "./ListItemBase.js";
|
|
4
5
|
import { ListItemHeader as D } from "./ListItemHeader.js";
|
|
5
6
|
import '../../assets/ListItem.css';const E = "_item_1nwey_3", F = {
|
|
6
7
|
item: E
|
|
7
|
-
},
|
|
8
|
-
className:
|
|
9
|
-
color:
|
|
10
|
-
variant:
|
|
11
|
-
shadow:
|
|
12
|
-
border:
|
|
13
|
-
loading:
|
|
14
|
-
disabled:
|
|
8
|
+
}, P = ({
|
|
9
|
+
className: f,
|
|
10
|
+
color: o,
|
|
11
|
+
variant: l = "default",
|
|
12
|
+
shadow: p = "xs",
|
|
13
|
+
border: I = "none",
|
|
14
|
+
loading: m,
|
|
15
|
+
disabled: r,
|
|
15
16
|
collapsible: a,
|
|
16
17
|
expanded: t,
|
|
17
|
-
size:
|
|
18
|
-
icon:
|
|
18
|
+
size: i,
|
|
19
|
+
icon: u,
|
|
19
20
|
label: s,
|
|
20
|
-
title:
|
|
21
|
-
description:
|
|
22
|
-
badge:
|
|
23
|
-
linkIcon:
|
|
24
|
-
select:
|
|
25
|
-
selected:
|
|
26
|
-
controls:
|
|
27
|
-
children:
|
|
28
|
-
interactive:
|
|
21
|
+
title: L,
|
|
22
|
+
description: h,
|
|
23
|
+
badge: y,
|
|
24
|
+
linkIcon: _ = !1,
|
|
25
|
+
select: d,
|
|
26
|
+
selected: j,
|
|
27
|
+
controls: x,
|
|
28
|
+
children: v,
|
|
29
|
+
interactive: e,
|
|
29
30
|
id: w,
|
|
30
31
|
containerAs: B,
|
|
31
|
-
...
|
|
32
|
+
...C
|
|
32
33
|
}) => {
|
|
33
|
-
const
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
|
|
34
|
+
const H = typeof s == "function" ? s() : s, c = q();
|
|
35
|
+
return /* @__PURE__ */ N(
|
|
36
|
+
A,
|
|
36
37
|
{
|
|
37
|
-
className:
|
|
38
|
-
size:
|
|
39
|
-
color:
|
|
40
|
-
variant:
|
|
41
|
-
shadow:
|
|
42
|
-
border:
|
|
43
|
-
disabled:
|
|
44
|
-
selected:
|
|
38
|
+
className: k(F.item, f),
|
|
39
|
+
size: i,
|
|
40
|
+
color: o,
|
|
41
|
+
variant: l,
|
|
42
|
+
shadow: p,
|
|
43
|
+
border: I,
|
|
44
|
+
disabled: r,
|
|
45
|
+
selected: j,
|
|
45
46
|
expanded: t,
|
|
46
|
-
loading:
|
|
47
|
-
interactive:
|
|
47
|
+
loading: m,
|
|
48
|
+
interactive: e,
|
|
48
49
|
id: w,
|
|
49
50
|
as: B,
|
|
50
51
|
children: [
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ n(
|
|
52
53
|
D,
|
|
53
54
|
{
|
|
54
|
-
color:
|
|
55
|
-
loading:
|
|
56
|
-
linkIcon:
|
|
57
|
-
disabled:
|
|
55
|
+
color: o,
|
|
56
|
+
loading: m,
|
|
57
|
+
linkIcon: _,
|
|
58
|
+
disabled: r,
|
|
58
59
|
collapsible: a,
|
|
59
60
|
expanded: t,
|
|
60
|
-
select:
|
|
61
|
-
title:
|
|
62
|
-
size:
|
|
63
|
-
description:
|
|
64
|
-
icon:
|
|
65
|
-
badge:
|
|
66
|
-
controls:
|
|
67
|
-
interactive:
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
select: d,
|
|
62
|
+
title: L,
|
|
63
|
+
size: i,
|
|
64
|
+
description: h,
|
|
65
|
+
icon: u,
|
|
66
|
+
badge: y,
|
|
67
|
+
controls: x,
|
|
68
|
+
interactive: e,
|
|
69
|
+
ariaControlsId: t ? c : void 0,
|
|
70
|
+
...C,
|
|
71
|
+
children: H
|
|
70
72
|
}
|
|
71
73
|
),
|
|
72
|
-
t ?
|
|
74
|
+
t ? /* @__PURE__ */ n("div", { id: c, children: v }) : null
|
|
73
75
|
]
|
|
74
76
|
}
|
|
75
77
|
);
|
|
76
78
|
};
|
|
77
79
|
export {
|
|
78
|
-
|
|
80
|
+
P as ListItem
|
|
79
81
|
};
|
|
@@ -1,102 +1,106 @@
|
|
|
1
|
-
import { jsxs as i, jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import { useId as
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { Badge as
|
|
1
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { c as w } from "../../index-L8X2o7IH.js";
|
|
3
|
+
import { useId as z, isValidElement as A } from "react";
|
|
4
|
+
import { Icon as D } from "../Icon/Icon.js";
|
|
5
|
+
import { Badge as H } from "../Badge/Badge.js";
|
|
6
6
|
import "../RootProvider/RootProvider.js";
|
|
7
|
-
import { ListItemLink as
|
|
8
|
-
import { ListItemLabel as
|
|
9
|
-
import { ListItemIcon as
|
|
10
|
-
import { ListItemControls as
|
|
11
|
-
import { ListItemSelect as
|
|
7
|
+
import { ListItemLink as R } from "./ListItemLink.js";
|
|
8
|
+
import { ListItemLabel as U } from "./ListItemLabel.js";
|
|
9
|
+
import { ListItemIcon as V } from "./ListItemIcon.js";
|
|
10
|
+
import { ListItemControls as q } from "./ListItemControls.js";
|
|
11
|
+
import { ListItemSelect as G } from "./ListItemSelect.js";
|
|
12
12
|
import "../Snackbar/useSnackbar.js";
|
|
13
|
-
import { S as
|
|
14
|
-
import { S as
|
|
15
|
-
import '../../assets/ListItemHeader.css';const
|
|
16
|
-
header:
|
|
17
|
-
label:
|
|
18
|
-
link:
|
|
19
|
-
badge:
|
|
20
|
-
linkIcon:
|
|
21
|
-
linkFocus:
|
|
22
|
-
controls:
|
|
23
|
-
},
|
|
24
|
-
as:
|
|
25
|
-
highlightWords:
|
|
13
|
+
import { S as J, a as K } from "../../ChevronUp-_BBfEirx.js";
|
|
14
|
+
import { S as M } from "../../ChevronRight-ANFWmIs1.js";
|
|
15
|
+
import '../../assets/ListItemHeader.css';const O = "_header_29hv7_1", P = "_label_29hv7_27", Q = "_link_29hv7_43", T = "_badge_29hv7_47", W = "_linkIcon_29hv7_51", X = "_linkFocus_29hv7_61", Y = "_controls_29hv7_69", o = {
|
|
16
|
+
header: O,
|
|
17
|
+
label: P,
|
|
18
|
+
link: Q,
|
|
19
|
+
badge: T,
|
|
20
|
+
linkIcon: W,
|
|
21
|
+
linkFocus: X,
|
|
22
|
+
controls: Y
|
|
23
|
+
}, _o = ({
|
|
24
|
+
as: f,
|
|
25
|
+
highlightWords: I,
|
|
26
26
|
interactive: a = !0,
|
|
27
|
-
color:
|
|
27
|
+
color: k,
|
|
28
28
|
loading: s,
|
|
29
29
|
disabled: r,
|
|
30
|
-
collapsible:
|
|
31
|
-
linkIcon:
|
|
32
|
-
expanded:
|
|
33
|
-
select:
|
|
30
|
+
collapsible: c,
|
|
31
|
+
linkIcon: u,
|
|
32
|
+
expanded: l,
|
|
33
|
+
select: m,
|
|
34
34
|
href: L,
|
|
35
|
-
onClick:
|
|
36
|
-
onKeyPress:
|
|
35
|
+
onClick: N,
|
|
36
|
+
onKeyPress: b,
|
|
37
37
|
tabIndex: S,
|
|
38
|
-
size:
|
|
38
|
+
size: h,
|
|
39
39
|
title: n,
|
|
40
40
|
description: C,
|
|
41
|
-
icon:
|
|
42
|
-
active:
|
|
43
|
-
badge:
|
|
44
|
-
controls:
|
|
45
|
-
className:
|
|
46
|
-
children:
|
|
47
|
-
ariaLabel:
|
|
41
|
+
icon: y,
|
|
42
|
+
active: d,
|
|
43
|
+
badge: e,
|
|
44
|
+
controls: _,
|
|
45
|
+
className: F,
|
|
46
|
+
children: j,
|
|
47
|
+
ariaLabel: p,
|
|
48
|
+
ariaControlsId: x
|
|
48
49
|
}) => {
|
|
49
|
-
const
|
|
50
|
+
const v = c ? l ? J : K : u ? M : void 0, g = () => e && !s && typeof e == "object" && "label" in e ? /* @__PURE__ */ t(H, { ...e, className: o.badge }) : A(e) ? e : null, B = p !== void 0 ? p : typeof n == "string" ? n : void 0, E = z();
|
|
50
51
|
return /* @__PURE__ */ i(
|
|
51
52
|
"div",
|
|
52
53
|
{
|
|
53
|
-
className:
|
|
54
|
-
"data-color":
|
|
54
|
+
className: w(o.header, F),
|
|
55
|
+
"data-color": k,
|
|
55
56
|
"data-interactive": a,
|
|
56
|
-
"data-size":
|
|
57
|
-
"data-has-active-child":
|
|
57
|
+
"data-size": h,
|
|
58
|
+
"data-has-active-child": d,
|
|
58
59
|
"aria-disabled": r,
|
|
59
60
|
children: [
|
|
60
61
|
/* @__PURE__ */ i(
|
|
61
|
-
|
|
62
|
+
R,
|
|
62
63
|
{
|
|
63
|
-
as:
|
|
64
|
+
as: f,
|
|
64
65
|
href: L,
|
|
65
|
-
onClick:
|
|
66
|
-
onKeyPress:
|
|
66
|
+
onClick: N,
|
|
67
|
+
onKeyPress: b,
|
|
67
68
|
tabIndex: S,
|
|
68
69
|
loading: s,
|
|
69
70
|
disabled: r || s,
|
|
70
|
-
active:
|
|
71
|
-
ariaLabel:
|
|
71
|
+
active: d,
|
|
72
|
+
ariaLabel: B,
|
|
72
73
|
className: o.link,
|
|
74
|
+
expanded: l,
|
|
75
|
+
ariaControlsId: x,
|
|
76
|
+
collapsible: c,
|
|
73
77
|
children: [
|
|
74
|
-
a && /* @__PURE__ */
|
|
75
|
-
|
|
76
|
-
/* @__PURE__ */
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
78
|
+
a && /* @__PURE__ */ t("div", { className: o.linkFocus, "aria-hidden": "true" }),
|
|
79
|
+
m && /* @__PURE__ */ t(G, { ...m, className: o.select }),
|
|
80
|
+
/* @__PURE__ */ t(V, { loading: s, icon: y }),
|
|
81
|
+
/* @__PURE__ */ t(
|
|
82
|
+
U,
|
|
79
83
|
{
|
|
80
|
-
size:
|
|
84
|
+
size: h,
|
|
81
85
|
loading: s,
|
|
82
|
-
highlightWords:
|
|
86
|
+
highlightWords: I,
|
|
83
87
|
title: n,
|
|
84
88
|
description: C,
|
|
85
|
-
id:
|
|
89
|
+
id: E,
|
|
86
90
|
className: o.label,
|
|
87
|
-
children:
|
|
91
|
+
children: j
|
|
88
92
|
}
|
|
89
93
|
)
|
|
90
94
|
]
|
|
91
95
|
}
|
|
92
96
|
),
|
|
93
|
-
/* @__PURE__ */ i(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
/* @__PURE__ */ i(q, { className: o.controls, children: [
|
|
98
|
+
_ && !s && /* @__PURE__ */ t("span", { className: o.customControls, children: _ }),
|
|
99
|
+
g(),
|
|
100
|
+
v && !r && /* @__PURE__ */ t("span", { className: o.linkIcon, children: /* @__PURE__ */ t(
|
|
101
|
+
D,
|
|
98
102
|
{
|
|
99
|
-
svgElement:
|
|
103
|
+
svgElement: v,
|
|
100
104
|
style: {
|
|
101
105
|
fontSize: "1.5rem"
|
|
102
106
|
}
|
|
@@ -108,5 +112,5 @@ import '../../assets/ListItemHeader.css';const M = "_header_29hv7_1", O = "_labe
|
|
|
108
112
|
);
|
|
109
113
|
};
|
|
110
114
|
export {
|
|
111
|
-
|
|
115
|
+
_o as ListItemHeader
|
|
112
116
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c as
|
|
3
|
-
import '../../assets/ListItemLink.css';const
|
|
4
|
-
link:
|
|
5
|
-
},
|
|
1
|
+
import { jsx as v } from "react/jsx-runtime";
|
|
2
|
+
import { c as p } from "../../index-L8X2o7IH.js";
|
|
3
|
+
import '../../assets/ListItemLink.css';const I = "_link_c8adz_1", l = {
|
|
4
|
+
link: I
|
|
5
|
+
}, z = ({
|
|
6
6
|
as: u,
|
|
7
7
|
loading: a,
|
|
8
8
|
disabled: e,
|
|
@@ -10,35 +10,40 @@ import '../../assets/ListItemLink.css';const f = "_link_c8adz_1", l = {
|
|
|
10
10
|
href: s,
|
|
11
11
|
onClick: t,
|
|
12
12
|
onKeyPress: i,
|
|
13
|
-
className:
|
|
14
|
-
active:
|
|
13
|
+
className: d,
|
|
14
|
+
active: _,
|
|
15
15
|
ariaLabel: n,
|
|
16
16
|
children: c,
|
|
17
|
-
tabIndex:
|
|
17
|
+
tabIndex: b = 0,
|
|
18
|
+
expanded: m,
|
|
19
|
+
collapsible: f,
|
|
20
|
+
ariaControlsId: k
|
|
18
21
|
}) => {
|
|
19
22
|
const r = u || "div";
|
|
20
23
|
if (r === "div")
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
const
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
+
return /* @__PURE__ */ v("div", { className: p(l.link, d), children: c });
|
|
25
|
+
const A = !a && s || r !== "a" && n;
|
|
26
|
+
return /* @__PURE__ */ v(
|
|
24
27
|
r,
|
|
25
28
|
{
|
|
26
|
-
className:
|
|
29
|
+
className: p(l.link, d),
|
|
27
30
|
href: s,
|
|
28
|
-
onKeyPress: (
|
|
29
|
-
|
|
31
|
+
onKeyPress: (o) => {
|
|
32
|
+
o.key === "Enter" && (t == null || t()), i == null || i(o);
|
|
30
33
|
},
|
|
31
34
|
onClick: t,
|
|
32
35
|
"data-interactive": "true",
|
|
33
36
|
"aria-disabled": a || e,
|
|
34
37
|
"aria-selected": x,
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
+
"aria-expanded": f ? m : void 0,
|
|
39
|
+
"aria-controls": m ? k : void 0,
|
|
40
|
+
...A && { "aria-label": n },
|
|
41
|
+
"data-active": _,
|
|
42
|
+
tabIndex: a || e ? -1 : b,
|
|
38
43
|
children: c
|
|
39
44
|
}
|
|
40
45
|
);
|
|
41
46
|
};
|
|
42
47
|
export {
|
|
43
|
-
|
|
48
|
+
z as ListItemLink
|
|
44
49
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as m, jsxs as L } from "react/jsx-runtime";
|
|
3
3
|
import { u as k } from "../../index-D-VWMqlv.js";
|
|
4
|
-
import { useRef as R, useState as A, useEffect as y, useMemo as
|
|
4
|
+
import { useRef as R, useState as A, useEffect as y, useMemo as W } from "react";
|
|
5
5
|
import "../../index-L8X2o7IH.js";
|
|
6
|
-
import { useMenu as
|
|
6
|
+
import { useMenu as D } from "../../hooks/useMenu.js";
|
|
7
7
|
import "../RootProvider/RootProvider.js";
|
|
8
|
-
import { MenuItem as
|
|
9
|
-
import { MenuSearch as
|
|
8
|
+
import { MenuItem as K } from "./MenuItem.js";
|
|
9
|
+
import { MenuSearch as V } from "./MenuSearch.js";
|
|
10
10
|
import { MenuHeader as j } from "./MenuHeader.js";
|
|
11
|
-
import { MenuList as N, MenuListItem as
|
|
11
|
+
import { MenuList as N, MenuListItem as F } from "./MenuBase.js";
|
|
12
12
|
import "../Snackbar/useSnackbar.js";
|
|
13
|
-
import '../../assets/MenuItemsVirtual.css';const
|
|
14
|
-
virtualScrollRef:
|
|
15
|
-
virtualMenuListItem:
|
|
13
|
+
import '../../assets/MenuItemsVirtual.css';const O = "_virtualScrollRef_nmoqo_1", U = "_virtualMenuListItem_nmoqo_8", M = {
|
|
14
|
+
virtualScrollRef: O,
|
|
15
|
+
virtualMenuListItem: U
|
|
16
16
|
}, se = ({
|
|
17
17
|
level: E = 0,
|
|
18
18
|
search: g,
|
|
19
19
|
items: z,
|
|
20
20
|
groups: T = {},
|
|
21
|
-
defaultItemSize:
|
|
22
|
-
defaultItemColor:
|
|
21
|
+
defaultItemSize: b,
|
|
22
|
+
defaultItemColor: P,
|
|
23
23
|
defaultItemVariant: q,
|
|
24
24
|
defaultIconTheme: $,
|
|
25
25
|
keyboardEvents: f,
|
|
@@ -35,12 +35,12 @@ import '../../assets/MenuItemsVirtual.css';const Y = "_virtualScrollRef_nmoqo_1"
|
|
|
35
35
|
window.removeEventListener("resize", n);
|
|
36
36
|
};
|
|
37
37
|
}, []);
|
|
38
|
-
const I =
|
|
38
|
+
const I = W(() => x && S - x - 8 || 400, [S, x]), C = {
|
|
39
39
|
...{
|
|
40
40
|
maxHeight: I <= 300 ? 300 : I
|
|
41
41
|
},
|
|
42
42
|
...H
|
|
43
|
-
}, { menu: _ } =
|
|
43
|
+
}, { menu: _ } = D({
|
|
44
44
|
items: z,
|
|
45
45
|
groups: T,
|
|
46
46
|
groupByKey: "groupId",
|
|
@@ -68,6 +68,7 @@ import '../../assets/MenuItemsVirtual.css';const Y = "_virtualScrollRef_nmoqo_1"
|
|
|
68
68
|
];
|
|
69
69
|
}), d = k({
|
|
70
70
|
count: v.length,
|
|
71
|
+
useAnimationFrameWithResizeObserver: !0,
|
|
71
72
|
gap: 8,
|
|
72
73
|
estimateSize: () => 44,
|
|
73
74
|
getScrollElement: () => c.current
|
|
@@ -128,7 +129,7 @@ import '../../assets/MenuItemsVirtual.css';const Y = "_virtualScrollRef_nmoqo_1"
|
|
|
128
129
|
zIndex: 10,
|
|
129
130
|
marginTop: "-0.5rem"
|
|
130
131
|
},
|
|
131
|
-
children: /* @__PURE__ */ m(
|
|
132
|
+
children: /* @__PURE__ */ m(V, { ...g })
|
|
132
133
|
}
|
|
133
134
|
),
|
|
134
135
|
/* @__PURE__ */ m(
|
|
@@ -141,7 +142,7 @@ import '../../assets/MenuItemsVirtual.css';const Y = "_virtualScrollRef_nmoqo_1"
|
|
|
141
142
|
children: h.map((n) => {
|
|
142
143
|
const t = v[n.index];
|
|
143
144
|
return t ? /* @__PURE__ */ L(
|
|
144
|
-
|
|
145
|
+
F,
|
|
145
146
|
{
|
|
146
147
|
dataIndex: n.index,
|
|
147
148
|
className: M.virtualMenuListItem,
|
|
@@ -150,11 +151,11 @@ import '../../assets/MenuItemsVirtual.css';const Y = "_virtualScrollRef_nmoqo_1"
|
|
|
150
151
|
children: [
|
|
151
152
|
t.type === "title" && /* @__PURE__ */ m(j, { title: t.title }),
|
|
152
153
|
t.type === "item" && /* @__PURE__ */ m(
|
|
153
|
-
|
|
154
|
+
K,
|
|
154
155
|
{
|
|
155
156
|
...t.itemProps,
|
|
156
|
-
size: t.itemProps.size ||
|
|
157
|
-
color: t.itemProps.color ||
|
|
157
|
+
size: t.itemProps.size || b,
|
|
158
|
+
color: t.itemProps.color || P,
|
|
158
159
|
variant: t.itemProps.variant || q,
|
|
159
160
|
iconTheme: t.itemProps.iconTheme || $,
|
|
160
161
|
active: t.active,
|
|
@@ -8,14 +8,14 @@ import { Menu as x } from "../Menu/Menu.js";
|
|
|
8
8
|
import "../Snackbar/useSnackbar.js";
|
|
9
9
|
import { ToolbarButton as T } from "./ToolbarButton.js";
|
|
10
10
|
import { ToolbarFilterBase as B } from "./ToolbarFilterBase.js";
|
|
11
|
-
const v = ({ label: t = "Legg til", items:
|
|
12
|
-
const { currentId:
|
|
13
|
-
return /* @__PURE__ */ c(B, { expanded: o, onBlurCapture: (
|
|
14
|
-
const
|
|
15
|
-
(!
|
|
11
|
+
const v = ({ label: t = "Legg til", items: a, id: e }) => {
|
|
12
|
+
const { currentId: l, closeAll: n, toggleId: d } = f(), o = l === e, m = () => d(e), s = u();
|
|
13
|
+
return /* @__PURE__ */ c(B, { expanded: o, onBlurCapture: (p) => {
|
|
14
|
+
const i = p.relatedTarget;
|
|
15
|
+
s && (!i || !p.currentTarget.contains(i)) && n();
|
|
16
16
|
}, children: [
|
|
17
|
-
/* @__PURE__ */ r(T, { type: "add", onToggle:
|
|
18
|
-
/* @__PURE__ */ r(g, { drawerTitle: t, open: o, children: /* @__PURE__ */ r(x, { color: "neutral", items:
|
|
17
|
+
/* @__PURE__ */ r(T, { type: "add", onToggle: m, "aria-expanded": o, children: t }),
|
|
18
|
+
/* @__PURE__ */ r(g, { drawerTitle: t, open: o, onClose: n, children: /* @__PURE__ */ r(x, { color: "neutral", items: a, keyboardEvents: o && s }) })
|
|
19
19
|
] });
|
|
20
20
|
};
|
|
21
21
|
export {
|
|
@@ -13,26 +13,26 @@ const G = (u, n) => Array.isArray(n) ? n.join(", ") : n, Q = ({
|
|
|
13
13
|
label: n,
|
|
14
14
|
name: o,
|
|
15
15
|
filterState: s,
|
|
16
|
-
options:
|
|
17
|
-
optionGroups:
|
|
18
|
-
onChange:
|
|
19
|
-
onRemove:
|
|
16
|
+
options: y,
|
|
17
|
+
optionGroups: b,
|
|
18
|
+
onChange: x,
|
|
19
|
+
onRemove: A,
|
|
20
20
|
buttonAltText: l = "Remove button",
|
|
21
21
|
getSelectedLabel: a,
|
|
22
|
-
showResultsLabel:
|
|
23
|
-
optionType:
|
|
22
|
+
showResultsLabel: f = "Show results",
|
|
23
|
+
optionType: h,
|
|
24
24
|
id: e = `toolbar-filter-${o}`
|
|
25
25
|
}) => {
|
|
26
|
-
const { currentId:
|
|
26
|
+
const { currentId: v, toggleId: I, closeAll: d } = j(), m = g(), k = (y ?? []).map((r) => {
|
|
27
27
|
const t = s == null ? void 0 : s[r.name || o];
|
|
28
28
|
return {
|
|
29
29
|
name: o,
|
|
30
30
|
...r,
|
|
31
31
|
checked: Array.isArray(t) ? t.includes(r.value) : r.value === t
|
|
32
32
|
};
|
|
33
|
-
}), c = s == null ? void 0 : s[o], w = (a == null ? void 0 : a(o, c)) ?? G(o, c),
|
|
33
|
+
}), c = s == null ? void 0 : s[o], w = (a == null ? void 0 : a(o, c)) ?? G(o, c), T = () => I(e), p = v === e, B = (r) => {
|
|
34
34
|
const t = r.relatedTarget;
|
|
35
|
-
(!t || !r.currentTarget.contains(t)) && d();
|
|
35
|
+
m && (!t || !r.currentTarget.contains(t)) && d();
|
|
36
36
|
}, C = Array.isArray(c) ? c.length > 0 : typeof c < "u";
|
|
37
37
|
return /* @__PURE__ */ D(R, { expanded: p, onBlurCapture: B, dataTestId: "filter-base-" + e, children: [
|
|
38
38
|
/* @__PURE__ */ i(
|
|
@@ -41,10 +41,10 @@ const G = (u, n) => Array.isArray(n) ? n.join(", ") : n, Q = ({
|
|
|
41
41
|
type: "select",
|
|
42
42
|
removable: u,
|
|
43
43
|
active: C,
|
|
44
|
-
onToggle:
|
|
44
|
+
onToggle: T,
|
|
45
45
|
ariaLabel: l,
|
|
46
46
|
iconAltText: l,
|
|
47
|
-
onRemove:
|
|
47
|
+
onRemove: A,
|
|
48
48
|
dataTestId: e,
|
|
49
49
|
tabIndex: p ? -1 : 0,
|
|
50
50
|
children: w || n
|
|
@@ -57,18 +57,18 @@ const G = (u, n) => Array.isArray(n) ? n.join(", ") : n, Q = ({
|
|
|
57
57
|
drawerTitle: n,
|
|
58
58
|
onClose: d,
|
|
59
59
|
drawerButton: {
|
|
60
|
-
onClick:
|
|
61
|
-
label:
|
|
60
|
+
onClick: T,
|
|
61
|
+
label: f
|
|
62
62
|
},
|
|
63
63
|
children: /* @__PURE__ */ i(
|
|
64
64
|
E,
|
|
65
65
|
{
|
|
66
66
|
name: o,
|
|
67
67
|
options: k,
|
|
68
|
-
optionGroups:
|
|
69
|
-
onChange:
|
|
70
|
-
optionType:
|
|
71
|
-
keyboardEvents: p &&
|
|
68
|
+
optionGroups: b,
|
|
69
|
+
onChange: x,
|
|
70
|
+
optionType: h,
|
|
71
|
+
keyboardEvents: p && m
|
|
72
72
|
}
|
|
73
73
|
)
|
|
74
74
|
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
function e(r) {
|
|
2
2
|
if (r)
|
|
3
3
|
try {
|
|
4
|
-
const t =
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
year: "numeric"
|
|
9
|
-
});
|
|
10
|
-
} catch (t) {
|
|
11
|
-
return console.warn("Error formatting date:", t), r;
|
|
4
|
+
const [o, t, n] = r.split("-");
|
|
5
|
+
return !o || !t || !n ? r : `${n}.${t}.${o}`;
|
|
6
|
+
} catch (o) {
|
|
7
|
+
return console.warn("Error formatting date:", o), r;
|
|
12
8
|
}
|
|
13
9
|
}
|
|
14
10
|
export {
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { describe as d, test as o, expect as e } from "vitest";
|
|
1
|
+
import { describe as a, beforeEach as i, vi as d, test as o, expect as e } from "vitest";
|
|
2
2
|
import { formatDate as t } from "./date.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
a("dateUtils", () => {
|
|
4
|
+
i(() => {
|
|
5
|
+
d.stubEnv("TZ", "UTC");
|
|
6
|
+
}), a("formatDate", () => {
|
|
5
7
|
o("should format ISO date to Norwegian DD.MM.YYYY format", () => {
|
|
6
|
-
e(t("1990-12-25")).toBe("25.12.1990"), e(t("2000-01-01")).toBe("01.01.2000"), e(t("1985-06-15")).toBe("15.06.1985");
|
|
8
|
+
e(t("1990-12-25")).toBe("25.12.1990"), e(t("2000-01-01")).toBe("01.01.2000"), e(t("1985-06-15")).toBe("15.06.1985"), d.stubEnv("TZ", "EST"), e(t("1990-12-25")).toBe("25.12.1990"), e(t("2000-01-01")).toBe("01.01.2000"), e(t("1985-06-15")).toBe("15.06.1985");
|
|
7
9
|
}), o("should handle undefined input", () => {
|
|
8
10
|
e(t(void 0)).toBeUndefined();
|
|
9
11
|
}), o("should handle invalid date strings", () => {
|
|
10
12
|
e(t("invalid-date")).toBe("invalid-date"), e(t("")).toBe(void 0);
|
|
11
13
|
}), o("should handle edge cases", () => {
|
|
12
|
-
e(t("2024-02-29")).toBe("29.02.2024"), e(t("2023-12-31")).toBe("31.12.2023");
|
|
14
|
+
e(t("2024-02-29")).toBe("29.02.2024"), e(t("2023-12-31")).toBe("31.12.2023"), d.stubEnv("TZ", "EST"), e(t("2024-02-29")).toBe("29.02.2024"), e(t("2023-12-31")).toBe("31.12.2023");
|
|
13
15
|
});
|
|
14
16
|
});
|
|
15
17
|
});
|
|
@@ -59,6 +59,7 @@ declare const meta: {
|
|
|
59
59
|
href?: string | undefined;
|
|
60
60
|
onClick?: (() => void) | undefined;
|
|
61
61
|
onKeyPress?: React.KeyboardEventHandler | undefined;
|
|
62
|
+
ariaControlsId?: string | undefined;
|
|
62
63
|
favourite?: boolean | undefined;
|
|
63
64
|
favouriteLabel?: string | undefined;
|
|
64
65
|
onToggleFavourite?: ((id: string) => void) | undefined;
|
|
@@ -40,4 +40,4 @@ export interface ListItemHeaderProps extends ListItemLinkProps {
|
|
|
40
40
|
/** Used as decerning text for the ListItem without title, defaults to title */
|
|
41
41
|
ariaLabel?: string;
|
|
42
42
|
}
|
|
43
|
-
export declare const ListItemHeader: ({ as, highlightWords, interactive, color, loading, disabled, collapsible, linkIcon, expanded, select, href, onClick, onKeyPress, tabIndex, size, title, description, icon, active, badge, controls, className, children, ariaLabel, }: ListItemHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export declare const ListItemHeader: ({ as, highlightWords, interactive, color, loading, disabled, collapsible, linkIcon, expanded, select, href, onClick, onKeyPress, tabIndex, size, title, description, icon, active, badge, controls, className, children, ariaLabel, ariaControlsId, }: ListItemHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,5 +12,8 @@ export interface ListItemLinkProps {
|
|
|
12
12
|
className?: string;
|
|
13
13
|
active?: boolean;
|
|
14
14
|
children?: React.ReactNode;
|
|
15
|
+
expanded?: boolean;
|
|
16
|
+
collapsible?: boolean;
|
|
17
|
+
ariaControlsId?: string;
|
|
15
18
|
}
|
|
16
|
-
export declare const ListItemLink: ({ as, loading, disabled, selected, href, onClick, onKeyPress, className, active, ariaLabel, children, tabIndex, }: ListItemLinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const ListItemLink: ({ as, loading, disabled, selected, href, onClick, onKeyPress, className, active, ariaLabel, children, tabIndex, expanded, collapsible, ariaControlsId, }: ListItemLinkProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -50,6 +50,7 @@ declare const meta: {
|
|
|
50
50
|
href?: string | undefined;
|
|
51
51
|
onClick?: (() => void) | undefined;
|
|
52
52
|
onKeyPress?: React.KeyboardEventHandler | undefined;
|
|
53
|
+
ariaControlsId?: string | undefined;
|
|
53
54
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
54
55
|
};
|
|
55
56
|
export default meta;
|