asma-ui-core 3.130.1 → 3.130.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.
- package/dist/asma-ui-core.css +1 -1
- package/dist/components/inputs/emoji-choice/StyledEmojiChoice.js +162 -172
- package/dist/datetime/components/date-picker/components/StyledCalendarPicker.module.js +17 -18
- package/dist/datetime/components/date-picker/components/StyledDayPicker.js +10 -9
- package/dist/src/components/inputs/emoji-choice/StyledEmojiChoice.d.ts +3 -2
- package/dist/table/components/columns/action-column/components/RowActionMenu.js +71 -60
- package/dist/table/shared-components/StyledMenuItem.js +16 -16
- package/package.json +1 -1
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
import { DotsVerticalIcon as
|
|
2
|
-
import { CircleWarningOutlineIcon as
|
|
3
|
-
import { StyledPopover as
|
|
4
|
-
import { StyledMenuList as
|
|
5
|
-
import { isCustomAction as
|
|
6
|
-
import { StyledTooltip as
|
|
7
|
-
import { useToggleMenuVisibility as
|
|
8
|
-
import { StyledButton as
|
|
9
|
-
import { StyledMenuItem as
|
|
10
|
-
import
|
|
11
|
-
import { jsx as t, jsxs as
|
|
12
|
-
function
|
|
13
|
-
const { anchorEl: P, open:
|
|
14
|
-
if (!(n.state !== "hidden" && (
|
|
15
|
-
const
|
|
1
|
+
import { DotsVerticalIcon as T } from "../../../../../components/icons/dots-vertical-icon/DotsVerticalIcon.js";
|
|
2
|
+
import { CircleWarningOutlineIcon as S } from "../../../../../components/icons/warning-circle-icon/CircleWarningOutlineIcon.js";
|
|
3
|
+
import { StyledPopover as k } from "../../../../../components/utils/popover/StyledPopover.js";
|
|
4
|
+
import { StyledMenuList as I } from "../../../../../components/navigation/menu/StyledMenuList.js";
|
|
5
|
+
import { isCustomAction as j } from "../../../../types.js";
|
|
6
|
+
import { StyledTooltip as h } from "../../../../shared-components/tooltip/index.js";
|
|
7
|
+
import { useToggleMenuVisibility as O } from "../../../../hooks/useToggleMenuVisibility.hook.js";
|
|
8
|
+
import { StyledButton as R } from "../../../../shared-components/button/StyledButton.js";
|
|
9
|
+
import { StyledMenuItem as g } from "../../../../shared-components/StyledMenuItem.js";
|
|
10
|
+
import b, { useId as B, useMemo as U, useState as V } from "react";
|
|
11
|
+
import { jsx as t, jsxs as w } from "react/jsx-runtime";
|
|
12
|
+
function X({ tableData: l, actions: v, rowActionsState: y }) {
|
|
13
|
+
const { anchorEl: P, open: i, handleClose: s, handleOpen: D } = O(), [x, C] = V(!1), d = B(), a = v(l.row), n = y?.(l.row) ?? { state: "enabled" }, c = l.table.options.meta?.locale, N = c === "no" ? "Ingen handlinger tilgjengelig" : "No actions available", A = c === "no" ? "Radhandlinger" : "Row actions", M = U(() => a.every((e) => "component" in e ? !1 : e.hide), [a]), u = a.length > 0 && !M, m = n.state === "enabled" && !u;
|
|
14
|
+
if (!(n.state !== "hidden" && (u || m || n.state === "disabled"))) return /* @__PURE__ */ t("div", { className: "flex w-[40px] items-center justify-center" });
|
|
15
|
+
const p = n.state === "disabled", f = /* @__PURE__ */ t(R, {
|
|
16
16
|
dataTest: "row-actions-button",
|
|
17
|
-
"aria-label":
|
|
17
|
+
"aria-label": A,
|
|
18
18
|
"aria-haspopup": "true",
|
|
19
|
-
"aria-expanded":
|
|
19
|
+
"aria-expanded": i,
|
|
20
20
|
variant: "text",
|
|
21
21
|
size: "small",
|
|
22
|
-
"aria-disabled":
|
|
22
|
+
"aria-disabled": p || void 0,
|
|
23
23
|
onClick: (e) => {
|
|
24
|
-
e.stopPropagation(), e.preventDefault(), !
|
|
24
|
+
e.stopPropagation(), e.preventDefault(), !p && (e.currentTarget.focus({ preventScroll: !0 }), i ? s() : (C(e.detail === 0), D(e)));
|
|
25
|
+
},
|
|
26
|
+
onKeyDown: (e) => {
|
|
27
|
+
if (!i || e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
|
|
28
|
+
e.preventDefault(), e.stopPropagation();
|
|
29
|
+
const r = document.getElementById(d)?.querySelectorAll('[role="menuitem"]');
|
|
30
|
+
r?.length && r[e.key === "ArrowDown" ? 0 : r.length - 1]?.focus();
|
|
25
31
|
},
|
|
26
32
|
onMouseDown: (e) => {
|
|
27
33
|
e.stopPropagation(), e.preventDefault();
|
|
@@ -29,17 +35,17 @@ function q({ tableData: l, actions: v, rowActionsState: w }) {
|
|
|
29
35
|
onMouseUp: (e) => {
|
|
30
36
|
e.stopPropagation(), e.preventDefault();
|
|
31
37
|
},
|
|
32
|
-
children: /* @__PURE__ */ t(
|
|
33
|
-
className:
|
|
38
|
+
children: /* @__PURE__ */ t(T, {
|
|
39
|
+
className: p ? "text-delta-300" : "text-delta-700",
|
|
34
40
|
width: 20,
|
|
35
41
|
height: 20
|
|
36
42
|
})
|
|
37
43
|
});
|
|
38
44
|
return /* @__PURE__ */ t("div", {
|
|
39
45
|
className: "flex w-[40px] items-center justify-center",
|
|
40
|
-
children: /* @__PURE__ */
|
|
46
|
+
children: /* @__PURE__ */ w("div", {
|
|
41
47
|
className: "flex items-center justify-center",
|
|
42
|
-
children: [n.state === "disabled" ? /* @__PURE__ */ t(
|
|
48
|
+
children: [n.state === "disabled" ? /* @__PURE__ */ t(h, {
|
|
43
49
|
title: n.tooltipTitle,
|
|
44
50
|
arrow: !0,
|
|
45
51
|
placement: n.tooltipPlacement ?? "top",
|
|
@@ -53,13 +59,15 @@ function q({ tableData: l, actions: v, rowActionsState: w }) {
|
|
|
53
59
|
onClick: (e) => {
|
|
54
60
|
e.stopPropagation(), e.preventDefault();
|
|
55
61
|
},
|
|
56
|
-
children:
|
|
62
|
+
children: f
|
|
57
63
|
})
|
|
58
|
-
}) :
|
|
59
|
-
|
|
64
|
+
}) : f, n.state === "enabled" && /* @__PURE__ */ t(k, {
|
|
65
|
+
id: d,
|
|
66
|
+
open: i,
|
|
60
67
|
anchorEl: P,
|
|
61
|
-
onClose:
|
|
62
|
-
onClick:
|
|
68
|
+
onClose: s,
|
|
69
|
+
onClick: s,
|
|
70
|
+
tabIntoContent: !1,
|
|
63
71
|
anchorOrigin: {
|
|
64
72
|
horizontal: "right",
|
|
65
73
|
vertical: "bottom"
|
|
@@ -68,39 +76,24 @@ function q({ tableData: l, actions: v, rowActionsState: w }) {
|
|
|
68
76
|
horizontal: "right",
|
|
69
77
|
vertical: "top"
|
|
70
78
|
},
|
|
71
|
-
children: m ? /* @__PURE__ */
|
|
79
|
+
children: m ? /* @__PURE__ */ w("div", {
|
|
72
80
|
className: "flex items-center gap-2 p-3 text-base text-delta-700",
|
|
73
|
-
children: [/* @__PURE__ */ t(
|
|
81
|
+
children: [/* @__PURE__ */ t(S, {
|
|
74
82
|
width: 20,
|
|
75
83
|
height: 20
|
|
76
84
|
}), /* @__PURE__ */ t("span", { children: N })]
|
|
77
|
-
}) : /* @__PURE__ */ t(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
disabledReason: e.tooltipTitle,
|
|
86
|
-
reasonPlacement: e.tooltipPlacement ?? "left",
|
|
87
|
-
onMouseDown: (o) => {
|
|
88
|
-
o.stopPropagation(), o.preventDefault();
|
|
89
|
-
},
|
|
90
|
-
onMouseUp: (o) => {
|
|
91
|
-
o.stopPropagation(), o.preventDefault();
|
|
92
|
-
},
|
|
93
|
-
children: e.label
|
|
94
|
-
}, p) : /* @__PURE__ */ t(f, {
|
|
95
|
-
title: e?.tooltipTitle,
|
|
96
|
-
arrow: !0,
|
|
97
|
-
placement: e?.tooltipPlacement ?? "left",
|
|
98
|
-
children: /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(h, {
|
|
85
|
+
}) : /* @__PURE__ */ t(I, {
|
|
86
|
+
autoFocus: x,
|
|
87
|
+
children: a.map((e, r) => {
|
|
88
|
+
if (j(e)) {
|
|
89
|
+
const o = e.component(l.row, s);
|
|
90
|
+
return b.isValidElement(o) ? /* @__PURE__ */ t(b.Fragment, { children: o }, r) : null;
|
|
91
|
+
}
|
|
92
|
+
return e.hide ? null : e.disabled && e.tooltipTitle ? /* @__PURE__ */ t(g, {
|
|
99
93
|
className: e.className,
|
|
100
|
-
disabled:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
},
|
|
94
|
+
disabled: !0,
|
|
95
|
+
disabledReason: e.tooltipTitle,
|
|
96
|
+
reasonPlacement: e.tooltipPlacement ?? "left",
|
|
104
97
|
onMouseDown: (o) => {
|
|
105
98
|
o.stopPropagation(), o.preventDefault();
|
|
106
99
|
},
|
|
@@ -108,13 +101,31 @@ function q({ tableData: l, actions: v, rowActionsState: w }) {
|
|
|
108
101
|
o.stopPropagation(), o.preventDefault();
|
|
109
102
|
},
|
|
110
103
|
children: e.label
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
}, r) : /* @__PURE__ */ t(h, {
|
|
105
|
+
title: e?.tooltipTitle,
|
|
106
|
+
arrow: !0,
|
|
107
|
+
placement: e?.tooltipPlacement ?? "left",
|
|
108
|
+
children: /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(g, {
|
|
109
|
+
className: e.className,
|
|
110
|
+
disabled: e.disabled,
|
|
111
|
+
onClick: () => {
|
|
112
|
+
e.disabled || e.onClick?.(l.row);
|
|
113
|
+
},
|
|
114
|
+
onMouseDown: (o) => {
|
|
115
|
+
o.stopPropagation(), o.preventDefault();
|
|
116
|
+
},
|
|
117
|
+
onMouseUp: (o) => {
|
|
118
|
+
o.stopPropagation(), o.preventDefault();
|
|
119
|
+
},
|
|
120
|
+
children: e.label
|
|
121
|
+
}) })
|
|
122
|
+
}, r);
|
|
123
|
+
})
|
|
124
|
+
})
|
|
114
125
|
})]
|
|
115
126
|
})
|
|
116
127
|
});
|
|
117
128
|
}
|
|
118
129
|
export {
|
|
119
|
-
|
|
130
|
+
X as RowActionMenu
|
|
120
131
|
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { cn as
|
|
2
|
-
import { StyledTooltip as
|
|
3
|
-
import { jsx as
|
|
4
|
-
var
|
|
1
|
+
import { cn as d } from "../../helpers/cn.js";
|
|
2
|
+
import { StyledTooltip as y } from "../../components/data-display/tooltip/StyledTooltip.js";
|
|
3
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
|
+
var k = ({ children: i, disabled: e, disabledReason: o, reasonPlacement: l = "left", selected: c, className: s, classes: p, onClick: u, onMouseDown: m, onMouseUp: f }) => {
|
|
5
5
|
const x = (t) => {
|
|
6
|
-
e || (t.key === "Enter" || t.key === " ") && (t.preventDefault(),
|
|
7
|
-
},
|
|
6
|
+
e || (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.currentTarget.click());
|
|
7
|
+
}, r = !!e && !!o, n = /* @__PURE__ */ a("li", {
|
|
8
8
|
role: "menuitem",
|
|
9
9
|
"aria-disabled": e ? !0 : void 0,
|
|
10
|
-
"data-has-reason":
|
|
10
|
+
"data-has-reason": r || void 0,
|
|
11
11
|
tabIndex: -1,
|
|
12
|
-
onClick: e ? (t) => t.stopPropagation() :
|
|
12
|
+
onClick: e ? (t) => t.stopPropagation() : u,
|
|
13
13
|
onKeyDown: x,
|
|
14
|
-
onMouseDown:
|
|
14
|
+
onMouseDown: m,
|
|
15
15
|
onMouseUp: f,
|
|
16
|
-
className:
|
|
17
|
-
children:
|
|
16
|
+
className: d("box-border flex min-h-10 items-center px-3 py-2 text-base text-delta-700 outline-none", "focus-visible:shadow-[inset_3px_0_var(--colors-focus-ring)]", e ? "cursor-not-allowed" : "cursor-pointer hover:bg-delta-50", c && "bg-gama-50", p?.root, s, e && "aria-disabled:text-delta-300"),
|
|
17
|
+
children: i
|
|
18
18
|
});
|
|
19
|
-
return
|
|
19
|
+
return r ? /* @__PURE__ */ a(y, {
|
|
20
20
|
title: o,
|
|
21
21
|
arrow: !0,
|
|
22
|
-
placement:
|
|
22
|
+
placement: l,
|
|
23
23
|
openOnTap: !0,
|
|
24
24
|
persistentDescription: !0,
|
|
25
|
-
children:
|
|
26
|
-
}) :
|
|
25
|
+
children: n
|
|
26
|
+
}) : n;
|
|
27
27
|
};
|
|
28
28
|
export {
|
|
29
|
-
|
|
29
|
+
k as StyledMenuItem
|
|
30
30
|
};
|