@altinn/altinn-components 0.67.1 → 0.67.2

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 +1 @@
1
- ._tooltip_10ebf_1{padding:.5em}._tooltip_10ebf_1[aria-hidden=true]{display:none}
1
+ ._tooltip_t2itc_1{padding:.5em}
@@ -1,81 +1,91 @@
1
1
  "use client";
2
2
  import { jsx as a } from "react/jsx-runtime";
3
- import u, { forwardRef as c, useMemo as f } from "react";
4
- import { Button as g } from "../Button/Button.js";
3
+ import s, { forwardRef as v, useRef as O, useEffect as h, useMemo as w } from "react";
4
+ import { Button as y } from "../Button/Button.js";
5
5
  import "../../index-p1eeF8LQ.js";
6
6
  import "../../tooltip-Ct39-719.js";
7
- import { w as h, g as b, M as x } from "../../ToolbarSearch-bv2opbAj.js";
7
+ import { w as x, g as C, M as R } from "../../ToolbarSearch-bv2opbAj.js";
8
8
  import "../Typography/Link.js";
9
- import { Tooltip as v } from "../Tooltip/Tooltip.js";
9
+ import { Tooltip as I } from "../Tooltip/Tooltip.js";
10
10
  import "../GlobalMenu/GlobalMenuBase.js";
11
11
  import "../Snackbar/useSnackbar.js";
12
- import { useDropdownMenuController as w } from "../Menu/useDropdownMenuController.js";
13
- import { u as y } from "../../useId-BVFxCjkq.js";
14
- var O = function(t, i) {
15
- var r = {};
16
- for (var e in t) Object.prototype.hasOwnProperty.call(t, e) && i.indexOf(e) < 0 && (r[e] = t[e]);
17
- if (t != null && typeof Object.getOwnPropertySymbols == "function")
18
- for (var o = 0, e = Object.getOwnPropertySymbols(t); o < e.length; o++)
19
- i.indexOf(e[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, e[o]) && (r[e[o]] = t[e[o]]);
20
- return r;
12
+ import { useDropdownMenuController as M } from "../Menu/useDropdownMenuController.js";
13
+ import { u as A } from "../../useId-BVFxCjkq.js";
14
+ var E = function(r, i) {
15
+ var o = {};
16
+ for (var t in r) Object.prototype.hasOwnProperty.call(r, t) && i.indexOf(t) < 0 && (o[t] = r[t]);
17
+ if (r != null && typeof Object.getOwnPropertySymbols == "function")
18
+ for (var n = 0, t = Object.getOwnPropertySymbols(r); n < t.length; n++)
19
+ i.indexOf(t[n]) < 0 && Object.prototype.propertyIsEnumerable.call(r, t[n]) && (o[t[n]] = r[t[n]]);
20
+ return o;
21
21
  };
22
- const C = c((t, i) => {
23
- var { title: r, titleId: e } = t, o = O(t, ["title", "titleId"]);
24
- let l = y();
25
- return l = r ? e || "title-" + l : void 0, u.createElement(
22
+ const j = v((r, i) => {
23
+ var { title: o, titleId: t } = r, n = E(r, ["title", "titleId"]);
24
+ let l = A();
25
+ return l = o ? t || "title-" + l : void 0, s.createElement(
26
26
  "svg",
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: i, "aria-labelledby": l }, o),
28
- r ? u.createElement("title", { id: l }, r) : null,
29
- 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" })
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: i, "aria-labelledby": l }, n),
28
+ o ? s.createElement("title", { id: l }, o) : null,
29
+ s.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
- }), F = ({
32
- groups: t = {},
31
+ }), G = ({
32
+ groups: r = {},
33
33
  items: i,
34
- title: r,
35
- color: e,
36
- id: o = "context-menu",
34
+ title: o,
35
+ color: t,
36
+ id: n = "context-menu",
37
37
  placement: l = "right",
38
- "aria-label": p
38
+ "aria-label": m
39
39
  }) => {
40
- const n = w({ id: o, returnFocusOnClose: !0 }), { languageCode: d } = h(), m = f(() => i.map((s) => ({
41
- ...s,
40
+ const e = M({ id: n, returnFocusOnClose: !0 }), { languageCode: f } = x(), c = O(e.open);
41
+ h(() => {
42
+ const u = c.current;
43
+ if (c.current = e.open, !u || e.open) return;
44
+ const p = e.triggerRef.current, d = p?.getAttribute("data-tooltip");
45
+ if (!p || d == null) return;
46
+ p.removeAttribute("data-tooltip");
47
+ const b = requestAnimationFrame(() => p.setAttribute("data-tooltip", d));
48
+ return () => cancelAnimationFrame(b);
49
+ }, [e.open, e.triggerRef]);
50
+ const g = w(() => i.map((u) => ({
51
+ ...u,
42
52
  onClick: () => {
43
- n.setOpen(!1), s.onClick?.();
53
+ e.setOpen(!1), u.onClick?.();
44
54
  }
45
- })), [i, n]);
55
+ })), [i, e]);
46
56
  return /* @__PURE__ */ a(
47
- b,
57
+ C,
48
58
  {
49
59
  backdrop: !1,
50
- color: e,
51
- trigger: /* @__PURE__ */ a(() => /* @__PURE__ */ a(v, { content: r || M(d).title, hidden: n.open, children: /* @__PURE__ */ a(
52
- g,
60
+ color: t,
61
+ trigger: /* @__PURE__ */ a(I, { content: e.open ? "" : o || P(f).title, children: /* @__PURE__ */ a(
62
+ y,
53
63
  {
54
- ref: n.triggerRef,
64
+ ref: e.triggerRef,
55
65
  icon: !0,
56
66
  variant: "ghost",
57
67
  rounded: !0,
58
68
  size: "xs",
59
- "aria-label": p,
60
- onClick: () => n.toggleMenu(),
69
+ "aria-label": m,
70
+ onClick: () => e.toggleMenu(),
61
71
  "aria-haspopup": "menu",
62
- "aria-expanded": n.open,
63
- "aria-controls": n.open ? n.menuId : void 0,
64
- color: e,
65
- children: /* @__PURE__ */ a(C, { "aria-hidden": "true" })
72
+ "aria-expanded": e.open,
73
+ "aria-controls": e.open ? e.menuId : void 0,
74
+ color: t,
75
+ children: /* @__PURE__ */ a(j, { "aria-hidden": "true" })
66
76
  }
67
- ) }), {}),
68
- open: n.open,
69
- onClose: () => n.setOpen(!1),
70
- id: n.menuId,
77
+ ) }),
78
+ open: e.open,
79
+ onClose: () => e.setOpen(!1),
80
+ id: e.menuId,
71
81
  placement: l,
72
82
  useFixedPosition: !0,
73
- ...n.dropdownA11yProps,
74
- children: /* @__PURE__ */ a(x, { groups: t, items: m, maxLevels: 1, keyboardEvents: n.open, ...n.menuA11yProps })
83
+ ...e.dropdownA11yProps,
84
+ children: /* @__PURE__ */ a(R, { groups: r, items: g, maxLevels: 1, keyboardEvents: e.open, ...e.menuA11yProps })
75
85
  }
76
86
  );
77
- }, M = (t) => {
78
- switch (t) {
87
+ }, P = (r) => {
88
+ switch (r) {
79
89
  case "nb":
80
90
  return {
81
91
  title: "Åpne meny"
@@ -91,5 +101,5 @@ const C = c((t, i) => {
91
101
  }
92
102
  };
93
103
  export {
94
- F as ContextMenu
104
+ G as ContextMenu
95
105
  };
@@ -1,5 +1,5 @@
1
1
  import { jsxs as p, jsx as o } from "react/jsx-runtime";
2
- import { createElement as u } from "react";
2
+ import { createElement as h } from "react";
3
3
  import "../../index-p1eeF8LQ.js";
4
4
  import "../../tooltip-Ct39-719.js";
5
5
  import "../../ToolbarSearch-bv2opbAj.js";
@@ -13,7 +13,7 @@ import "../GlobalMenu/GlobalMenuBase.js";
13
13
  import "../Snackbar/useSnackbar.js";
14
14
  import { ModalBase as j } from "../Modal/ModalBase.js";
15
15
  import { ModalHeader as y } from "../Modal/ModalHeader.js";
16
- import { ModalBody as E } from "../Modal/ModalBody.js";
16
+ import { ModalBody as w } from "../Modal/ModalBody.js";
17
17
  const K = ({
18
18
  icon: e,
19
19
  title: n,
@@ -25,17 +25,17 @@ const K = ({
25
25
  ...d
26
26
  }) => /* @__PURE__ */ p(j, { ...d, open: l, onClose: r, children: [
27
27
  /* @__PURE__ */ o(y, { icon: e, title: n, description: c, onClose: r }),
28
- /* @__PURE__ */ p(E, { children: [
28
+ /* @__PURE__ */ p(w, { children: [
29
29
  a,
30
- m?.length && /* @__PURE__ */ o(g, { children: m?.map((t, f) => {
31
- const { icon: i, label: s, ...B } = t;
32
- return /* @__PURE__ */ u(
30
+ m?.length && /* @__PURE__ */ o(g, { wrap: !0, children: m?.map((t, f) => {
31
+ const { icon: i, label: s, ...u } = t;
32
+ return /* @__PURE__ */ h(
33
33
  M,
34
34
  {
35
- ...B,
35
+ ...u,
36
36
  key: f,
37
- onClick: (h) => {
38
- t?.onClick?.(h), t?.close && r?.();
37
+ onClick: (B) => {
38
+ t?.onClick?.(B), t?.close && r?.();
39
39
  }
40
40
  },
41
41
  i && /* @__PURE__ */ o(k, { icon: i }),
@@ -1,9 +1,9 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { v as a } from "../../tooltip-Ct39-719.js";
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { v as r } from "../../tooltip-Ct39-719.js";
3
3
  import "react";
4
- import '../../assets/Tooltip.css';const l = "_tooltip_10ebf_1", e = {
4
+ import '../../assets/Tooltip.css';const l = "_tooltip_t2itc_1", m = {
5
5
  tooltip: l
6
- }, x = ({ size: i = "xs", placement: s, children: o, content: t, hidden: p }) => t ? /* @__PURE__ */ r(a, { "aria-hidden": p, "data-size": i, content: t, placement: s, className: e.tooltip, children: o }) : o;
6
+ }, f = ({ size: i = "xs", placement: s, children: t, content: o }) => o ? /* @__PURE__ */ p(r, { "data-size": i, content: o, placement: s, className: m.tooltip, children: t }) : t;
7
7
  export {
8
- x as Tooltip
8
+ f as Tooltip
9
9
  };
@@ -2,7 +2,6 @@ import { TooltipProps as DsTooltipProps, Size } from '@digdir/designsystemet-rea
2
2
  export type TooltipProps = {
3
3
  children: React.ReactNode;
4
4
  content: string;
5
- hidden?: boolean;
6
5
  size?: Size;
7
6
  } & Omit<DsTooltipProps, 'content | children'>;
8
- export declare const Tooltip: ({ size, placement, children, content, hidden }: TooltipProps) => string | import("react/jsx-runtime").JSX.Element;
7
+ export declare const Tooltip: ({ size, placement, children, content }: TooltipProps) => string | import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  declare const meta: {
2
2
  title: string;
3
- component: ({ size, placement, children, content, hidden }: import('./Tooltip').TooltipProps) => string | import("react/jsx-runtime").JSX.Element;
3
+ component: ({ size, placement, children, content }: import('./Tooltip').TooltipProps) => string | import("react/jsx-runtime").JSX.Element;
4
4
  tags: string[];
5
5
  parameters: {};
6
6
  args: {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.67.1",
3
+ "version": "0.67.2",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",