@altinn/altinn-components 0.56.26 → 0.56.27

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,47 +1,52 @@
1
1
  "use client";
2
2
  import { jsx as a } from "react/jsx-runtime";
3
- import { Button as p } from "../Button/Button.js";
3
+ import u, { forwardRef as m, useMemo as c } from "react";
4
+ import { Button as f } from "../Button/Button.js";
4
5
  import "../../index-p1eeF8LQ.js";
5
- import u, { forwardRef as s } from "react";
6
- import { Dropdown as m } from "../Dropdown/Dropdown.js";
7
- import { useRootContext as c } from "../RootProvider/RootProvider.js";
8
- import { M as f } from "../../SearchField-QTfebYdU.js";
6
+ import { Dropdown as g } from "../Dropdown/Dropdown.js";
7
+ import { useRootContext as h } from "../RootProvider/RootProvider.js";
8
+ import { M as b } from "../../SearchField-QTfebYdU.js";
9
9
  import "../Snackbar/useSnackbar.js";
10
- import { useDropdownMenuController as g } from "../Menu/useDropdownMenuController.js";
11
- import { Tooltip as b } from "../Tooltip/Tooltip.js";
12
- import { u as h } from "../../useId-BVFxCjkq.js";
13
- var x = function(t, l) {
14
- var o = {};
15
- for (var e in t) Object.prototype.hasOwnProperty.call(t, e) && l.indexOf(e) < 0 && (o[e] = t[e]);
10
+ import { useDropdownMenuController as x } from "../Menu/useDropdownMenuController.js";
11
+ import { Tooltip as v } from "../Tooltip/Tooltip.js";
12
+ import { u as y } from "../../useId-BVFxCjkq.js";
13
+ var O = function(t, l) {
14
+ var r = {};
15
+ for (var e in t) Object.prototype.hasOwnProperty.call(t, e) && l.indexOf(e) < 0 && (r[e] = t[e]);
16
16
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
17
- for (var r = 0, e = Object.getOwnPropertySymbols(t); r < e.length; r++)
18
- l.indexOf(e[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, e[r]) && (o[e[r]] = t[e[r]]);
19
- return o;
17
+ for (var o = 0, e = Object.getOwnPropertySymbols(t); o < e.length; o++)
18
+ l.indexOf(e[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, e[o]) && (r[e[o]] = t[e[o]]);
19
+ return r;
20
20
  };
21
- const v = s((t, l) => {
22
- var { title: o, titleId: e } = t, r = x(t, ["title", "titleId"]);
23
- let i = h();
24
- return i = o ? e || "title-" + i : void 0, u.createElement(
21
+ const w = m((t, l) => {
22
+ var { title: r, titleId: e } = t, o = O(t, ["title", "titleId"]);
23
+ let i = y();
24
+ return i = r ? e || "title-" + i : void 0, u.createElement(
25
25
  "svg",
26
- 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": i }, r),
27
- o ? u.createElement("title", { id: i }, o) : null,
26
+ 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": i }, o),
27
+ r ? u.createElement("title", { id: i }, r) : null,
28
28
  u.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" })
29
29
  );
30
- }), S = ({
30
+ }), A = ({
31
31
  groups: t = {},
32
32
  items: l,
33
- title: o,
33
+ title: r,
34
34
  id: e = "context-menu",
35
- placement: r = "right",
35
+ placement: o = "right",
36
36
  "aria-label": i
37
37
  }) => {
38
- const n = g({ id: e, returnFocusOnClose: !0 }), { languageCode: d } = c();
38
+ const n = x({ id: e, returnFocusOnClose: !0 }), { languageCode: s } = h(), d = c(() => l.map((p) => ({
39
+ ...p,
40
+ onClick: () => {
41
+ n.setOpen(!1), p.onClick?.();
42
+ }
43
+ })), [l, n]);
39
44
  return /* @__PURE__ */ a(
40
- m,
45
+ g,
41
46
  {
42
47
  backdrop: !1,
43
- trigger: /* @__PURE__ */ a(() => /* @__PURE__ */ a(b, { content: o || y(d).title, hidden: n.open, children: /* @__PURE__ */ a(
44
- p,
48
+ trigger: /* @__PURE__ */ a(() => /* @__PURE__ */ a(v, { content: r || C(s).title, hidden: n.open, children: /* @__PURE__ */ a(
49
+ f,
45
50
  {
46
51
  ref: n.triggerRef,
47
52
  icon: !0,
@@ -53,19 +58,19 @@ const v = s((t, l) => {
53
58
  "aria-haspopup": "menu",
54
59
  "aria-expanded": n.open,
55
60
  "aria-controls": n.open ? n.menuId : void 0,
56
- children: /* @__PURE__ */ a(v, { "aria-hidden": "true" })
61
+ children: /* @__PURE__ */ a(w, { "aria-hidden": "true" })
57
62
  }
58
63
  ) }), {}),
59
64
  open: n.open,
60
65
  onClose: () => n.setOpen(!1),
61
66
  id: n.menuId,
62
- placement: r,
67
+ placement: o,
63
68
  useFixedPosition: !0,
64
69
  ...n.dropdownA11yProps,
65
- children: /* @__PURE__ */ a(f, { groups: t, items: l, maxLevels: 1, keyboardEvents: n.open, ...n.menuA11yProps })
70
+ children: /* @__PURE__ */ a(b, { groups: t, items: d, maxLevels: 1, keyboardEvents: n.open, ...n.menuA11yProps })
66
71
  }
67
72
  );
68
- }, y = (t) => {
73
+ }, C = (t) => {
69
74
  switch (t) {
70
75
  case "nb":
71
76
  return {
@@ -82,5 +87,5 @@ const v = s((t, l) => {
82
87
  }
83
88
  };
84
89
  export {
85
- S as ContextMenu
90
+ A as ContextMenu
86
91
  };
@@ -1,27 +1,32 @@
1
1
  "use client";
2
- import { jsxs as d, jsx as n } from "react/jsx-runtime";
3
- import { useMemo as p } from "react";
2
+ import { jsxs as p, jsx as n } from "react/jsx-runtime";
3
+ import { useMemo as m } from "react";
4
4
  import "../../index-p1eeF8LQ.js";
5
- import { Button as c } from "../Button/Button.js";
6
- import { ButtonGroup as C } from "../Button/ButtonGroup.js";
5
+ import { Button as s } from "../Button/Button.js";
6
+ import { ButtonGroup as g } from "../Button/ButtonGroup.js";
7
7
  import { ButtonGroupDivider as B } from "../Button/ButtonGroupDivider.js";
8
- import { DropdownBase as x } from "../Dropdown/DropdownBase.js";
8
+ import { DropdownBase as k } from "../Dropdown/DropdownBase.js";
9
9
  import "react-dom";
10
- import { useRootContext as _ } from "../RootProvider/RootProvider.js";
11
- import { M as v } from "../../SearchField-QTfebYdU.js";
10
+ import { useRootContext as x } from "../RootProvider/RootProvider.js";
11
+ import { M as _ } from "../../SearchField-QTfebYdU.js";
12
12
  import "../Snackbar/useSnackbar.js";
13
- import { S as k, a as D } from "../../ChevronUp-_BBfEirx.js";
14
- import '../../assets/DialogActions.css';const I = "_action_1n930_1", M = "_comboButton_1n930_8", m = {
13
+ import { S as v, a as D } from "../../ChevronUp-_BBfEirx.js";
14
+ import '../../assets/DialogActions.css';const I = "_action_1n930_1", M = "_comboButton_1n930_8", u = {
15
15
  action: I,
16
16
  comboButton: M
17
- }, H = ({ items: i, maxItems: l = 2, id: a = "dialog-actions", expandAltLabel: u }) => {
18
- const { currentId: f, closeAll: h, toggleId: b } = _(), e = f === a, t = p(() => (i || []).filter((o) => !o.hidden).sort((o, r) => {
19
- const s = ["primary", "secondary", "tertiary"];
20
- return s.indexOf(o?.priority) - s.indexOf(r?.priority);
21
- }), [i]), y = p(() => i.find((o) => o.priority === "primary")?.disabled, [i]);
22
- if (!t.length || l <= 0)
17
+ }, H = ({ items: i, maxItems: a = 2, id: l = "dialog-actions", expandAltLabel: f }) => {
18
+ const { currentId: h, closeAll: b, toggleId: d } = x(), e = h === l, t = m(() => (i || []).filter((o) => !o.hidden).sort((o, r) => {
19
+ const c = ["primary", "secondary", "tertiary"];
20
+ return c.indexOf(o?.priority) - c.indexOf(r?.priority);
21
+ }).map((o) => ({
22
+ ...o,
23
+ onClick: () => {
24
+ o.onClick?.(), d(l);
25
+ }
26
+ })), [i]), y = m(() => i.find((o) => o.priority === "primary")?.disabled, [i]);
27
+ if (!t.length || a <= 0)
23
28
  return null;
24
- if (t.length > l) {
29
+ if (t.length > a) {
25
30
  const o = t.slice(1).map((r) => ({
26
31
  id: r.id,
27
32
  title: r.label,
@@ -29,18 +34,18 @@ import '../../assets/DialogActions.css';const I = "_action_1n930_1", M = "_combo
29
34
  group: r.priority,
30
35
  hidden: r.hidden
31
36
  }));
32
- return /* @__PURE__ */ d("section", { className: m.comboButton, children: [
33
- /* @__PURE__ */ d(C, { connected: !0, size: "md", children: [
34
- /* @__PURE__ */ n(c, { disabled: y, onClick: t[0].onClick, children: t[0].label }),
37
+ return /* @__PURE__ */ p("section", { className: u.comboButton, children: [
38
+ /* @__PURE__ */ p(g, { connected: !0, size: "md", children: [
39
+ /* @__PURE__ */ n(s, { disabled: y, onClick: t[0].onClick, children: t[0].label }),
35
40
  /* @__PURE__ */ n(B, {}),
36
- /* @__PURE__ */ n(c, { "aria-label": u, onClick: () => b(a), "aria-expanded": e ? "true" : "false", children: e ? /* @__PURE__ */ n(k, {}) : /* @__PURE__ */ n(D, {}) })
41
+ /* @__PURE__ */ n(s, { "aria-label": f, onClick: () => d(l), "aria-expanded": e ? "true" : "false", children: e ? /* @__PURE__ */ n(v, {}) : /* @__PURE__ */ n(D, {}) })
37
42
  ] }),
38
- e && /* @__PURE__ */ n(x, { open: e, onClose: h, children: /* @__PURE__ */ n(v, { items: o }) })
43
+ e && /* @__PURE__ */ n(k, { open: e, onClose: b, children: /* @__PURE__ */ n(_, { items: o }) })
39
44
  ] });
40
45
  }
41
- return /* @__PURE__ */ n("section", { className: m.action, children: t.map((o, r) => {
42
- const { priority: s, id: O, ...g } = o;
43
- return /* @__PURE__ */ n(c, { variant: s === "primary" ? "solid" : "outline", size: "md", ...g, children: o.label }, "button-" + r);
46
+ return /* @__PURE__ */ n("section", { className: u.action, children: t.map((o, r) => {
47
+ const { priority: c, id: O, ...C } = o;
48
+ return /* @__PURE__ */ n(s, { variant: c === "primary" ? "solid" : "outline", size: "md", ...C, children: o.label }, "button-" + r);
44
49
  }) });
45
50
  };
46
51
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.56.26",
3
+ "version": "0.56.27",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",