@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.
- package/dist/assets/Tooltip.css +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +60 -50
- package/dist/components/Settings/SettingsModal.js +9 -9
- package/dist/components/Tooltip/Tooltip.js +5 -5
- package/dist/types/lib/components/Tooltip/Tooltip.d.ts +1 -2
- package/dist/types/lib/components/Tooltip/Tooltip.stories.d.ts +1 -1
- package/package.json +1 -1
package/dist/assets/Tooltip.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
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
|
|
4
|
-
import { Button as
|
|
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
|
|
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
|
|
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
|
|
13
|
-
import { u as
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
for (var
|
|
17
|
-
if (
|
|
18
|
-
for (var
|
|
19
|
-
i.indexOf(
|
|
20
|
-
return
|
|
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
|
|
23
|
-
var { title:
|
|
24
|
-
let l =
|
|
25
|
-
return l =
|
|
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 },
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
}),
|
|
32
|
-
groups:
|
|
31
|
+
}), G = ({
|
|
32
|
+
groups: r = {},
|
|
33
33
|
items: i,
|
|
34
|
-
title:
|
|
35
|
-
color:
|
|
36
|
-
id:
|
|
34
|
+
title: o,
|
|
35
|
+
color: t,
|
|
36
|
+
id: n = "context-menu",
|
|
37
37
|
placement: l = "right",
|
|
38
|
-
"aria-label":
|
|
38
|
+
"aria-label": m
|
|
39
39
|
}) => {
|
|
40
|
-
const
|
|
41
|
-
|
|
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
|
-
|
|
53
|
+
e.setOpen(!1), u.onClick?.();
|
|
44
54
|
}
|
|
45
|
-
})), [i,
|
|
55
|
+
})), [i, e]);
|
|
46
56
|
return /* @__PURE__ */ a(
|
|
47
|
-
|
|
57
|
+
C,
|
|
48
58
|
{
|
|
49
59
|
backdrop: !1,
|
|
50
|
-
color:
|
|
51
|
-
trigger: /* @__PURE__ */ a(
|
|
52
|
-
|
|
60
|
+
color: t,
|
|
61
|
+
trigger: /* @__PURE__ */ a(I, { content: e.open ? "" : o || P(f).title, children: /* @__PURE__ */ a(
|
|
62
|
+
y,
|
|
53
63
|
{
|
|
54
|
-
ref:
|
|
64
|
+
ref: e.triggerRef,
|
|
55
65
|
icon: !0,
|
|
56
66
|
variant: "ghost",
|
|
57
67
|
rounded: !0,
|
|
58
68
|
size: "xs",
|
|
59
|
-
"aria-label":
|
|
60
|
-
onClick: () =>
|
|
69
|
+
"aria-label": m,
|
|
70
|
+
onClick: () => e.toggleMenu(),
|
|
61
71
|
"aria-haspopup": "menu",
|
|
62
|
-
"aria-expanded":
|
|
63
|
-
"aria-controls":
|
|
64
|
-
color:
|
|
65
|
-
children: /* @__PURE__ */ a(
|
|
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:
|
|
69
|
-
onClose: () =>
|
|
70
|
-
id:
|
|
77
|
+
) }),
|
|
78
|
+
open: e.open,
|
|
79
|
+
onClose: () => e.setOpen(!1),
|
|
80
|
+
id: e.menuId,
|
|
71
81
|
placement: l,
|
|
72
82
|
useFixedPosition: !0,
|
|
73
|
-
...
|
|
74
|
-
children: /* @__PURE__ */ a(
|
|
83
|
+
...e.dropdownA11yProps,
|
|
84
|
+
children: /* @__PURE__ */ a(R, { groups: r, items: g, maxLevels: 1, keyboardEvents: e.open, ...e.menuA11yProps })
|
|
75
85
|
}
|
|
76
86
|
);
|
|
77
|
-
},
|
|
78
|
-
switch (
|
|
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
|
-
|
|
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
|
|
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
|
|
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(
|
|
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, ...
|
|
32
|
-
return /* @__PURE__ */
|
|
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
|
-
...
|
|
35
|
+
...u,
|
|
36
36
|
key: f,
|
|
37
|
-
onClick: (
|
|
38
|
-
t?.onClick?.(
|
|
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
|
|
2
|
-
import { v as
|
|
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 = "
|
|
4
|
+
import '../../assets/Tooltip.css';const l = "_tooltip_t2itc_1", m = {
|
|
5
5
|
tooltip: l
|
|
6
|
-
},
|
|
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
|
-
|
|
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
|
|
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
|
|
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: {};
|