@altinn/altinn-components 0.25.5 → 0.25.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.
@@ -1,41 +1,41 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
- import { useRef as v, createElement as A } from "react";
2
+ import { useRef as I, createElement as k } from "react";
3
3
  import "../../index-L8X2o7IH.js";
4
- import { useMenu as I } from "../../hooks/useMenu.js";
4
+ import { useMenu as l } from "../../hooks/useMenu.js";
5
5
  import "../RootProvider/RootProvider.js";
6
- import { AutocompleteBase as l } from "./AutocompleteBase.js";
7
- import { AutocompleteGroup as x } from "./AutocompleteGroup.js";
6
+ import { AutocompleteBase as y } from "./AutocompleteBase.js";
7
+ import { AutocompleteGroup as E } from "./AutocompleteGroup.js";
8
8
  import { AutocompleteItem as h } from "./AutocompleteItem.js";
9
9
  import "../Snackbar/useSnackbar.js";
10
- import { useEnterKey as k } from "../../hooks/useEnterKey.js";
11
- const C = ({ className: s, items: i, groups: n = {}, expanded: u, onSelect: r }) => {
12
- const p = v(null);
13
- k(() => {
14
- var t;
15
- if (u) {
16
- const e = (t = p.current) == null ? void 0 : t.querySelector('[data-active="true"]');
17
- e == null || e.dispatchEvent(new MouseEvent("click", { bubbles: !0 })), r == null || r();
10
+ import { useEnterKey as x } from "../../hooks/useEnterKey.js";
11
+ const R = ({ className: p, items: n, groups: a = {}, expanded: i, onSelect: r }) => {
12
+ const u = I(null);
13
+ x(() => {
14
+ var e;
15
+ if (i) {
16
+ const t = (e = u.current) == null ? void 0 : e.querySelector('[data-active="true"]');
17
+ t && (t.tagName === "A" && t.hasAttribute("href") ? t.click() : t.dispatchEvent(new MouseEvent("click", { bubbles: !0 }))), r == null || r();
18
18
  }
19
19
  });
20
- const { menu: a, setActiveIndex: c } = I({
21
- items: i,
22
- groups: n,
20
+ const { menu: c, setActiveIndex: f } = l({
21
+ items: n,
22
+ groups: a,
23
23
  groupByKey: "groupId",
24
24
  keyboardEvents: !0
25
25
  });
26
- return /* @__PURE__ */ m(l, { className: s, expanded: u, ref: p, children: a.map((t, e) => /* @__PURE__ */ A(x, { ...t.props, key: e }, /* @__PURE__ */ m("ul", { children: t.items.map((f, d) => {
26
+ return /* @__PURE__ */ m(y, { className: p, expanded: i, ref: u, children: c.map((e, t) => /* @__PURE__ */ k(E, { ...e.props, key: t }, /* @__PURE__ */ m("ul", { children: e.items.map((s, d) => {
27
27
  const {
28
28
  active: b,
29
- menuIndex: y,
30
- props: { groupId: M, onClick: o, ...E }
31
- } = f;
29
+ menuIndex: v,
30
+ props: { groupId: g, onClick: o, ...A }
31
+ } = s;
32
32
  return /* @__PURE__ */ m(
33
33
  h,
34
34
  {
35
35
  as: "button",
36
36
  tabIndex: -1,
37
- onMouseEnter: () => c(y),
38
- ...E,
37
+ onMouseEnter: () => f(v),
38
+ ...A,
39
39
  onClick: () => {
40
40
  o == null || o(), r == null || r();
41
41
  },
@@ -46,5 +46,5 @@ const C = ({ className: s, items: i, groups: n = {}, expanded: u, onSelect: r })
46
46
  }) }))) });
47
47
  };
48
48
  export {
49
- C as Autocomplete
49
+ R as Autocomplete
50
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.25.5",
3
+ "version": "0.25.6",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",