@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: f,
14
- searchable: k,
15
- keyboardEvents: v,
16
- items: l,
17
- groups: E,
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 s = A(null), [a, u] = p(!1), [t, T] = p(o?.fromDate?.[0] || ""), [r, w] = p(o?.toDate?.[0] || ""), b = () => {
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
- }, i = C(() => {
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" && i();
37
+ m.key === "Escape" && s();
38
38
  }, D = (m) => {
39
- const h = m.target;
40
- s.current && !s.current.contains(h) && i();
41
- }, g = setTimeout(() => {
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(g), document.removeEventListener("mousedown", D), document.removeEventListener("keydown", e);
45
+ clearTimeout(h), document.removeEventListener("mousedown", D), document.removeEventListener("keydown", e);
46
46
  };
47
- }, [a, i]);
48
- const y = (e) => {
49
- T(e?.fromDate || ""), w(e?.toDate || "");
50
- }, L = j(t, r), O = l?.map((e) => e.role === "datepicker" ? {
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: L,
52
+ description: O,
53
53
  selected: o?.[n]?.[0] === "fromAndToDate",
54
- onClick: b
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: s, children: /* @__PURE__ */ d(M, { formData: { fromDate: t, toDate: r }, onChange: y, onSubmit: i }) }) : /* @__PURE__ */ d(x, { size: f, searchable: k, keyboardEvents: v, items: O, groups: E });
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 d } from "react/jsx-runtime";
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 c } from "../Dropdown/Dropdown.js";
5
+ import { Dropdown as b } from "../Dropdown/Dropdown.js";
6
6
  import "../RootProvider/RootProvider.js";
7
- import { M as b } from "../../SearchField-QTfebYdU.js";
8
- import { useDropdownMenuController as f } from "../Menu/useDropdownMenuController.js";
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 h } from "../../ChevronUpDown-DqGsU4MC.js";
11
- const D = ({
12
- title: a = "Title",
10
+ import { S as g } from "../../ChevronUpDown-DqGsU4MC.js";
11
+ const I = ({
12
+ title: s = "Title",
13
13
  label: i = "Label",
14
- items: s = [],
15
- dropdownSize: l = "sm",
16
- onSelectId: p,
14
+ items: l = [],
15
+ dropdownSize: p = "sm",
16
+ id: t = "toolbar-menu",
17
+ onSelectId: m,
17
18
  ...e
18
19
  }) => {
19
- const o = f({ id: "toolbar-menu", returnFocusOnClose: !0 }), t = e.searchable ? "combobox" : "menu", m = s.map((n) => ({
20
+ const o = h({ id: t, returnFocusOnClose: !0 }), a = e.searchable ? "combobox" : "menu", d = l.map((n) => ({
20
21
  ...n,
21
22
  onClick: () => {
22
- p?.(n?.id ?? ""), n?.role !== "checkbox" && o.setOpen(!1);
23
+ m?.(n?.id ?? ""), n?.role !== "checkbox" && o.setOpen(!1);
23
24
  }
24
25
  }));
25
26
  return /* @__PURE__ */ r(
26
- c,
27
+ b,
27
28
  {
28
- id: "toolbar-menu",
29
+ id: t,
29
30
  variant: "drawer-dropdown",
30
- title: a,
31
- size: l,
32
- trigger: /* @__PURE__ */ d(
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(h, { "aria-hidden": "true", focusable: "false" })
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
- b,
52
+ f,
52
53
  {
53
54
  ...e,
54
- items: m,
55
+ items: d,
55
56
  keyboardEvents: o.open,
56
- a11yMode: t,
57
+ a11yMode: a,
57
58
  open: o.open,
58
59
  scrollToTopOnOpen: e.virtualized,
59
- ...t === "combobox" ? { id: o.menuId } : o.menuA11yProps
60
+ ...a === "combobox" ? { id: o.menuId } : o.menuA11yProps
60
61
  }
61
62
  )
62
63
  }
63
64
  );
64
65
  };
65
66
  export {
66
- D as ToolbarMenu
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.56.27",
3
+ "version": "0.56.29",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",