@altinn/altinn-components 0.56.27 → 0.56.29
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.
|
@@ -10,20 +10,20 @@ import { DatepickerFilter as M } from "./DatepickerFilter.js";
|
|
|
10
10
|
import { formatDateRange as j } from "./formatDateRange.js";
|
|
11
11
|
const P = ({
|
|
12
12
|
name: n = "time",
|
|
13
|
-
size:
|
|
14
|
-
searchable:
|
|
15
|
-
keyboardEvents:
|
|
16
|
-
items:
|
|
17
|
-
groups:
|
|
13
|
+
size: k,
|
|
14
|
+
searchable: v,
|
|
15
|
+
keyboardEvents: l,
|
|
16
|
+
items: E,
|
|
17
|
+
groups: T,
|
|
18
18
|
filterState: o = {},
|
|
19
19
|
onFilterStateChange: c
|
|
20
20
|
}) => {
|
|
21
|
-
const
|
|
21
|
+
const i = A(null), [a, u] = p(!1), [t, w] = p(o?.fromDate?.[0] || ""), [r, b] = p(o?.toDate?.[0] || ""), y = () => {
|
|
22
22
|
c?.({
|
|
23
23
|
...o,
|
|
24
24
|
[n]: ["fromAndToDate"]
|
|
25
25
|
}), u(!0);
|
|
26
|
-
},
|
|
26
|
+
}, s = C(() => {
|
|
27
27
|
c?.({
|
|
28
28
|
...o,
|
|
29
29
|
fromDate: t ? [t] : void 0,
|
|
@@ -34,24 +34,24 @@ const P = ({
|
|
|
34
34
|
R(() => {
|
|
35
35
|
if (!a) return;
|
|
36
36
|
const e = (m) => {
|
|
37
|
-
m.key === "Escape" &&
|
|
37
|
+
m.key === "Escape" && s();
|
|
38
38
|
}, D = (m) => {
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
},
|
|
39
|
+
const f = m.target;
|
|
40
|
+
i.current && !i.current.contains(f) && !f.contains(i.current) && s();
|
|
41
|
+
}, h = setTimeout(() => {
|
|
42
42
|
document.addEventListener("mousedown", D), document.addEventListener("keydown", e);
|
|
43
43
|
}, 0);
|
|
44
44
|
return () => {
|
|
45
|
-
clearTimeout(
|
|
45
|
+
clearTimeout(h), document.removeEventListener("mousedown", D), document.removeEventListener("keydown", e);
|
|
46
46
|
};
|
|
47
|
-
}, [a,
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
},
|
|
47
|
+
}, [a, s]);
|
|
48
|
+
const L = (e) => {
|
|
49
|
+
w(e?.fromDate || ""), b(e?.toDate || "");
|
|
50
|
+
}, O = j(t, r), g = E?.map((e) => e.role === "datepicker" ? {
|
|
51
51
|
...e,
|
|
52
|
-
description:
|
|
52
|
+
description: O,
|
|
53
53
|
selected: o?.[n]?.[0] === "fromAndToDate",
|
|
54
|
-
onClick:
|
|
54
|
+
onClick: y
|
|
55
55
|
} : {
|
|
56
56
|
...e,
|
|
57
57
|
onChange: () => {
|
|
@@ -63,7 +63,7 @@ const P = ({
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
return a ? /* @__PURE__ */ d("div", { ref:
|
|
66
|
+
return a ? /* @__PURE__ */ d("div", { ref: i, children: /* @__PURE__ */ d(M, { formData: { fromDate: t, toDate: r }, onChange: L, onSubmit: s }) }) : /* @__PURE__ */ d(x, { size: k, searchable: v, keyboardEvents: l, items: g, groups: T });
|
|
67
67
|
};
|
|
68
68
|
export {
|
|
69
69
|
P as SelectDateFilter
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
1
|
+
import { jsx as r, jsxs as c } from "react/jsx-runtime";
|
|
2
2
|
import { Button as u } from "../Button/Button.js";
|
|
3
3
|
import "../../index-p1eeF8LQ.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import { Dropdown as
|
|
5
|
+
import { Dropdown as b } from "../Dropdown/Dropdown.js";
|
|
6
6
|
import "../RootProvider/RootProvider.js";
|
|
7
|
-
import { M as
|
|
8
|
-
import { useDropdownMenuController as
|
|
7
|
+
import { M as f } from "../../SearchField-QTfebYdU.js";
|
|
8
|
+
import { useDropdownMenuController as h } from "../Menu/useDropdownMenuController.js";
|
|
9
9
|
import "../Snackbar/useSnackbar.js";
|
|
10
|
-
import { S as
|
|
11
|
-
const
|
|
12
|
-
title:
|
|
10
|
+
import { S as g } from "../../ChevronUpDown-DqGsU4MC.js";
|
|
11
|
+
const I = ({
|
|
12
|
+
title: s = "Title",
|
|
13
13
|
label: i = "Label",
|
|
14
|
-
items:
|
|
15
|
-
dropdownSize:
|
|
16
|
-
|
|
14
|
+
items: l = [],
|
|
15
|
+
dropdownSize: p = "sm",
|
|
16
|
+
id: t = "toolbar-menu",
|
|
17
|
+
onSelectId: m,
|
|
17
18
|
...e
|
|
18
19
|
}) => {
|
|
19
|
-
const o =
|
|
20
|
+
const o = h({ id: t, returnFocusOnClose: !0 }), a = e.searchable ? "combobox" : "menu", d = l.map((n) => ({
|
|
20
21
|
...n,
|
|
21
22
|
onClick: () => {
|
|
22
|
-
|
|
23
|
+
m?.(n?.id ?? ""), n?.role !== "checkbox" && o.setOpen(!1);
|
|
23
24
|
}
|
|
24
25
|
}));
|
|
25
26
|
return /* @__PURE__ */ r(
|
|
26
|
-
|
|
27
|
+
b,
|
|
27
28
|
{
|
|
28
|
-
id:
|
|
29
|
+
id: t,
|
|
29
30
|
variant: "drawer-dropdown",
|
|
30
|
-
title:
|
|
31
|
-
size:
|
|
32
|
-
trigger: /* @__PURE__ */
|
|
31
|
+
title: s,
|
|
32
|
+
size: p,
|
|
33
|
+
trigger: /* @__PURE__ */ c(
|
|
33
34
|
u,
|
|
34
35
|
{
|
|
35
36
|
variant: "solid",
|
|
@@ -40,7 +41,7 @@ const D = ({
|
|
|
40
41
|
ref: o.triggerRef,
|
|
41
42
|
children: [
|
|
42
43
|
/* @__PURE__ */ r("span", { children: i }),
|
|
43
|
-
/* @__PURE__ */ r(
|
|
44
|
+
/* @__PURE__ */ r(g, { "aria-hidden": "true", focusable: "false" })
|
|
44
45
|
]
|
|
45
46
|
}
|
|
46
47
|
),
|
|
@@ -48,20 +49,20 @@ const D = ({
|
|
|
48
49
|
onClose: () => o.setOpen(!1),
|
|
49
50
|
...e?.searchable ? {} : o.dropdownA11yProps,
|
|
50
51
|
children: /* @__PURE__ */ r(
|
|
51
|
-
|
|
52
|
+
f,
|
|
52
53
|
{
|
|
53
54
|
...e,
|
|
54
|
-
items:
|
|
55
|
+
items: d,
|
|
55
56
|
keyboardEvents: o.open,
|
|
56
|
-
a11yMode:
|
|
57
|
+
a11yMode: a,
|
|
57
58
|
open: o.open,
|
|
58
59
|
scrollToTopOnOpen: e.virtualized,
|
|
59
|
-
...
|
|
60
|
+
...a === "combobox" ? { id: o.menuId } : o.menuA11yProps
|
|
60
61
|
}
|
|
61
62
|
)
|
|
62
63
|
}
|
|
63
64
|
);
|
|
64
65
|
};
|
|
65
66
|
export {
|
|
66
|
-
|
|
67
|
+
I as ToolbarMenu
|
|
67
68
|
};
|
|
@@ -6,4 +6,4 @@ export interface ToolbarMenuProps extends Omit<MenuProps, 'variant'> {
|
|
|
6
6
|
dropdownSize?: DropdownProps['size'];
|
|
7
7
|
onSelectId?: (id: string) => void;
|
|
8
8
|
}
|
|
9
|
-
export declare const ToolbarMenu: ({ title, label, items, dropdownSize, onSelectId, ...props }: ToolbarMenuProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const ToolbarMenu: ({ title, label, items, dropdownSize, id, onSelectId, ...props }: ToolbarMenuProps) => import("react/jsx-runtime").JSX.Element;
|