@hortiview/shared-components 0.0.11155 → 0.0.11176
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.
|
@@ -49,6 +49,10 @@ type DeleteModalProps = {
|
|
|
49
49
|
* The function to call when the confirm button is clicked.
|
|
50
50
|
*/
|
|
51
51
|
onDelete: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* A optional function to call when the cancel button is clicked.
|
|
54
|
+
*/
|
|
55
|
+
onCancel?: () => void;
|
|
52
56
|
/**
|
|
53
57
|
* If true, the delete button will be enabled.
|
|
54
58
|
* If false, the delete button will be disabled and the {@link impossibleDeleteHeader} will be displayed.
|
|
@@ -70,8 +74,9 @@ type DeleteModalProps = {
|
|
|
70
74
|
* @prop {boolean} open - The state of the modal.
|
|
71
75
|
* @prop {function} setOpen - The function to set the state of the modal.
|
|
72
76
|
* @prop {function} onDelete - The function to call when the confirm button is clicked.
|
|
77
|
+
* @prop {function} onCancel - A optional function to call when the cancel button is clicked.
|
|
73
78
|
* @prop {boolean} isDeletePossible - If true, the delete button will be enabled. If false, the delete button will be disabled and the {@link impossibleDeleteHeader} will be displayed. Default is _true_.
|
|
74
79
|
* @returns {ReactElement} A modal component for deleting items.
|
|
75
80
|
*/
|
|
76
|
-
export declare const DeleteModal: ({ title, confirmButtonLabel, cancelButtonLabel, deleteHeader, deleteBody, deleteText, icon, isIconCrossedOut, impossibleDeleteHeader, open, setOpen, onDelete, isDeletePossible, }: DeleteModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
81
|
+
export declare const DeleteModal: ({ title, confirmButtonLabel, cancelButtonLabel, deleteHeader, deleteBody, deleteText, icon, isIconCrossedOut, impossibleDeleteHeader, open, setOpen, onDelete, onCancel, isDeletePossible, }: DeleteModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
77
82
|
export {};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import "../../assets/DeleteModal.css";
|
|
2
2
|
import { jsx as o, jsxs as p, Fragment as c } from "react/jsx-runtime";
|
|
3
|
-
import { Group as i, Button as u, Icon as
|
|
4
|
-
import { uniqueId as
|
|
5
|
-
import { AvailableCustomIcons as
|
|
6
|
-
import { u as
|
|
7
|
-
import { Iconify as
|
|
8
|
-
import { Modal as
|
|
9
|
-
const
|
|
10
|
-
bulletPoint:
|
|
11
|
-
modal:
|
|
12
|
-
colorDanger:
|
|
13
|
-
crossedOut:
|
|
14
|
-
},
|
|
3
|
+
import { Group as i, Button as u, Icon as I, TypoBody as l } from "@element/react-components";
|
|
4
|
+
import { uniqueId as O } from "lodash";
|
|
5
|
+
import { AvailableCustomIcons as N } from "../../enums/AvailableCustomIcons.js";
|
|
6
|
+
import { u as S } from "../../useBreakpoints-MzTZ0tCT.js";
|
|
7
|
+
import { Iconify as x } from "../Iconify/Iconify.js";
|
|
8
|
+
import { Modal as M } from "../Modal/Modal.js";
|
|
9
|
+
const j = "_bulletPoint_1kyg0_1", z = "_modal_1kyg0_6", B = "_colorDanger_1kyg0_10", P = "_crossedOut_1kyg0_14", t = {
|
|
10
|
+
bulletPoint: j,
|
|
11
|
+
modal: z,
|
|
12
|
+
colorDanger: B,
|
|
13
|
+
crossedOut: P
|
|
14
|
+
}, U = ({
|
|
15
15
|
title: e,
|
|
16
16
|
confirmButtonLabel: r,
|
|
17
17
|
cancelButtonLabel: n,
|
|
@@ -24,18 +24,19 @@ const M = "_bulletPoint_1kyg0_1", j = "_modal_1kyg0_6", z = "_colorDanger_1kyg0_
|
|
|
24
24
|
open: b,
|
|
25
25
|
setOpen: d,
|
|
26
26
|
onDelete: k,
|
|
27
|
+
onCancel: _,
|
|
27
28
|
isDeletePossible: m = !0
|
|
28
29
|
}) => {
|
|
29
|
-
const { isDesktop:
|
|
30
|
-
|
|
30
|
+
const { isDesktop: v } = S(), C = (D) => {
|
|
31
|
+
D.detail.action === "close" && d(!1);
|
|
31
32
|
};
|
|
32
33
|
return /* @__PURE__ */ o(
|
|
33
|
-
|
|
34
|
+
M,
|
|
34
35
|
{
|
|
35
36
|
className: t.modal,
|
|
36
|
-
modalSize:
|
|
37
|
+
modalSize: v ? "small" : "fullscreen",
|
|
37
38
|
open: b,
|
|
38
|
-
onClose:
|
|
39
|
+
onClose: C,
|
|
39
40
|
title: e,
|
|
40
41
|
primaryButton: /* @__PURE__ */ o(
|
|
41
42
|
u,
|
|
@@ -53,33 +54,35 @@ const M = "_bulletPoint_1kyg0_1", j = "_modal_1kyg0_6", z = "_colorDanger_1kyg0_
|
|
|
53
54
|
"data-testid": "cancel-button",
|
|
54
55
|
variant: "text",
|
|
55
56
|
label: n,
|
|
56
|
-
onClick: () =>
|
|
57
|
+
onClick: () => {
|
|
58
|
+
_?.(), d(!1);
|
|
59
|
+
}
|
|
57
60
|
}
|
|
58
61
|
),
|
|
59
62
|
children: /* @__PURE__ */ p(i, { direction: "vertical", secondaryAlign: "center", children: [
|
|
60
|
-
/* @__PURE__ */ o(
|
|
63
|
+
/* @__PURE__ */ o(A, { element: /* @__PURE__ */ o(q, { icon: f }), isCrossedOut: h }),
|
|
61
64
|
/* @__PURE__ */ o(i, { direction: "vertical", children: m ? /* @__PURE__ */ o(
|
|
62
|
-
|
|
65
|
+
F,
|
|
63
66
|
{
|
|
64
67
|
deleteHeader: a,
|
|
65
68
|
deleteText: g,
|
|
66
69
|
deleteBody: s
|
|
67
70
|
}
|
|
68
|
-
) : /* @__PURE__ */ o(
|
|
71
|
+
) : /* @__PURE__ */ o(G, { impossibleDeleteHeader: y }) })
|
|
69
72
|
] })
|
|
70
73
|
}
|
|
71
74
|
);
|
|
72
|
-
},
|
|
75
|
+
}, A = ({
|
|
73
76
|
element: e,
|
|
74
77
|
isCrossedOut: r = !1
|
|
75
|
-
}) => r ? /* @__PURE__ */ o("span", { className: t.crossedOut, children: e }) : e,
|
|
76
|
-
|
|
78
|
+
}) => r ? /* @__PURE__ */ o("span", { className: t.crossedOut, children: e }) : e, q = ({ icon: e }) => e ? typeof e != "string" ? e : Object.values(N).includes(e) ? /* @__PURE__ */ o(
|
|
79
|
+
x,
|
|
77
80
|
{
|
|
78
81
|
icon: e,
|
|
79
82
|
iconSize: "xlarge",
|
|
80
83
|
className: t.colorDanger
|
|
81
84
|
}
|
|
82
|
-
) : /* @__PURE__ */ o(
|
|
85
|
+
) : /* @__PURE__ */ o(I, { icon: e, iconSize: "xlarge", className: t.colorDanger }) : /* @__PURE__ */ o(c, {}), F = ({
|
|
83
86
|
deleteHeader: e,
|
|
84
87
|
deleteText: r,
|
|
85
88
|
deleteBody: n
|
|
@@ -95,11 +98,11 @@ const M = "_bulletPoint_1kyg0_1", j = "_modal_1kyg0_6", z = "_colorDanger_1kyg0_
|
|
|
95
98
|
themeColor: "text-secondary-on-background",
|
|
96
99
|
children: a
|
|
97
100
|
},
|
|
98
|
-
|
|
101
|
+
O(s.toString())
|
|
99
102
|
)) })
|
|
100
|
-
] }),
|
|
103
|
+
] }), G = ({
|
|
101
104
|
impossibleDeleteHeader: e
|
|
102
105
|
}) => /* @__PURE__ */ o(l, { level: 1, themeColor: "text-primary-on-background", children: e });
|
|
103
106
|
export {
|
|
104
|
-
|
|
107
|
+
U as DeleteModal
|
|
105
108
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hortiview/shared-components",
|
|
3
3
|
"description": "This is a shared component library. It should used in the HortiView platform and its modules.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.11176",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared",
|
|
7
7
|
"author": "Falk Menge <falk.menge.ext@bayer.com>",
|