@altinn/altinn-components 0.35.1 → 0.35.3

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,17 +1,17 @@
1
1
  "use client";
2
- import { jsxs as v, jsx as s } from "react/jsx-runtime";
3
- import { c as O } from "../../index-L8X2o7IH.js";
4
- import * as a from "react";
5
- import { forwardRef as b, useRef as h, useMemo as w } from "react";
6
- import { IconButton as y } from "../Button/IconButton.js";
7
- import { useClickOutside as I } from "../../hooks/useClickOutside.js";
8
- import { DropdownBase as j } from "../Dropdown/DropdownBase.js";
9
- import { MenuItems as C } from "../Menu/MenuItems.js";
10
- import { useRootContext as _ } from "../RootProvider/RootProvider.js";
2
+ import { jsxs as b, jsx as s } from "react/jsx-runtime";
3
+ import { c as h } from "../../index-L8X2o7IH.js";
4
+ import * as m from "react";
5
+ import { forwardRef as w, useRef as y } from "react";
6
+ import { IconButton as I } from "../Button/IconButton.js";
7
+ import { useClickOutside as j } from "../../hooks/useClickOutside.js";
8
+ import { DropdownBase as C } from "../Dropdown/DropdownBase.js";
9
+ import { MenuItems as _ } from "../Menu/MenuItems.js";
10
+ import { useRootContext as R } from "../RootProvider/RootProvider.js";
11
11
  import "../Searchbar/AutocompleteBase.js";
12
12
  import "../Snackbar/useSnackbar.js";
13
- import { u as R } from "../../useId-BVFxCjkq.js";
14
- import '../../assets/ContextMenu.css';var E = function(e, l) {
13
+ import { u as E } from "../../useId-BVFxCjkq.js";
14
+ import '../../assets/ContextMenu.css';var k = function(e, l) {
15
15
  var r = {};
16
16
  for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && l.indexOf(t) < 0 && (r[t] = e[t]);
17
17
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
@@ -19,18 +19,18 @@ import '../../assets/ContextMenu.css';var E = function(e, l) {
19
19
  l.indexOf(t[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[o]) && (r[t[o]] = e[t[o]]);
20
20
  return r;
21
21
  };
22
- const M = b((e, l) => {
23
- var { title: r, titleId: t } = e, o = E(e, ["title", "titleId"]);
24
- let n = R();
25
- return n = r ? t || "title-" + n : void 0, a.createElement(
22
+ const M = w((e, l) => {
23
+ var { title: r, titleId: t } = e, o = k(e, ["title", "titleId"]);
24
+ let n = E();
25
+ return n = r ? t || "title-" + n : void 0, m.createElement(
26
26
  "svg",
27
27
  Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: l, "aria-labelledby": n }, o),
28
- r ? a.createElement("title", { id: n }, r) : null,
29
- a.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M6 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3m4.5 1.5a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0m6 0a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0", clipRule: "evenodd" })
28
+ r ? m.createElement("title", { id: n }, r) : null,
29
+ m.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M6 10.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3m4.5 1.5a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0m6 0a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0", clipRule: "evenodd" })
30
30
  );
31
- }), k = "_toggle_nol5i_1", B = {
32
- toggle: k
33
- }, F = ({
31
+ }), B = "_toggle_nol5i_1", P = {
32
+ toggle: B
33
+ }, G = ({
34
34
  id: e = "context-menu",
35
35
  ariaLabel: l,
36
36
  placement: r = "right",
@@ -38,20 +38,21 @@ const M = b((e, l) => {
38
38
  className: o,
39
39
  items: n
40
40
  }) => {
41
- const { currentId: d, toggleId: m, closeAll: u } = _(), f = h(null), g = () => m(e), c = d === e;
42
- I(f, () => {
43
- c && m(e);
41
+ const { currentId: u, toggleId: a, closeAll: d } = R(), f = y(null), g = () => a(e), i = u === e;
42
+ j(f, () => {
43
+ i && a(e);
44
44
  });
45
- const x = w(() => n.map((i) => ({
46
- ...i,
45
+ const x = n.map((v, O) => ({
46
+ ...v,
47
47
  onClick: () => {
48
48
  var p;
49
- (p = i.onClick) == null || p.call(i), u();
49
+ const c = n[O];
50
+ (p = c.onClick) == null || p.call(c), d();
50
51
  }
51
- })), [n, u]);
52
- return /* @__PURE__ */ v("div", { className: O(B.toggle, o), "data-color": "neutral", ref: f, children: [
52
+ }));
53
+ return /* @__PURE__ */ b("div", { className: h(P.toggle, o), "data-color": "neutral", ref: f, children: [
53
54
  /* @__PURE__ */ s(
54
- y,
55
+ I,
55
56
  {
56
57
  size: "xs",
57
58
  rounded: !0,
@@ -61,9 +62,9 @@ const M = b((e, l) => {
61
62
  iconAltText: l || `Open ${e}`
62
63
  }
63
64
  ),
64
- c && /* @__PURE__ */ s(j, { placement: r, open: c, children: /* @__PURE__ */ s(C, { groups: t, items: x }) })
65
+ i && /* @__PURE__ */ s(C, { placement: r, open: i, children: /* @__PURE__ */ s(_, { groups: t, items: x }) })
65
66
  ] });
66
67
  };
67
68
  export {
68
- F as ContextMenu
69
+ G as ContextMenu
69
70
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.35.1",
3
+ "version": "0.35.3",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",