@hortiview/shared-components 0.0.6320 → 0.0.6332

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
- ._bulletPoint_469qk_1{display:list-item;margin-left:1.5rem}._modal_469qk_6 [class*="lmnt-modal__actions mdc-dialog__actions"]{margin-bottom:0!important}._colorDanger_469qk_10{color:var(--lmnt-theme-danger-on-surface)}
1
+ ._bulletPoint_1kyg0_1{display:list-item;margin-left:1.5rem}._modal_1kyg0_6 [class*="lmnt-modal__actions mdc-dialog__actions"]{margin-bottom:0!important}._colorDanger_1kyg0_10{color:var(--lmnt-theme-danger-on-surface)}._crossedOut_1kyg0_14{position:relative;display:inline-block}._crossedOut_1kyg0_14:after{content:"";position:absolute;width:3rem;height:.25rem;left:50%;top:50%;background:var(--lmnt-theme-danger-on-surface);box-shadow:0 0 0 .125rem var(--lmnt-theme-background);transform:translate(-50%,calc(-50% - .25rem)) rotate(45deg);transform-origin:center;z-index:2}
@@ -31,7 +31,12 @@ type DeleteModalProps = {
31
31
  /**
32
32
  * The icon to display in the modal.
33
33
  */
34
- icon?: string;
34
+ icon?: string | JSX.Element;
35
+ /**
36
+ * If true, the icon to display in the modal will be crossed out with a red line.
37
+ * The icon should not be larger than 2.5 rem height and 3 rem width.
38
+ */
39
+ isIconCrossedOut?: boolean;
35
40
  /**
36
41
  * The state of the modal.
37
42
  */
@@ -61,11 +66,12 @@ type DeleteModalProps = {
61
66
  * @prop {string | JSX.Element} deleteText - A text or JSX element to display in the delete modal. If provided the deleteBody will be ignored.
62
67
  * @prop {string} impossibleDeleteHeader - The header to display in the modal if the {@link isDeletePossible} is false.
63
68
  * @prop {string} icon - The icon to display in the modal.
69
+ * @prop {boolean} isIconCrossedOut - If true, the icon to display in the modal will be crossed out with a red line. The icon should not be larger than 2.5 rem height and 3 rem width.
64
70
  * @prop {boolean} open - The state of the modal.
65
71
  * @prop {function} setOpen - The function to set the state of the modal.
66
72
  * @prop {function} onDelete - The function to call when the confirm button is clicked.
67
73
  * @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_.
68
74
  * @returns {ReactElement} A modal component for deleting items.
69
75
  */
70
- export declare const DeleteModal: ({ title, confirmButtonLabel, cancelButtonLabel, deleteHeader, deleteBody, deleteText, icon, impossibleDeleteHeader, open, setOpen, onDelete, isDeletePossible, }: DeleteModalProps) => import("react/jsx-runtime").JSX.Element;
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;
71
77
  export {};
@@ -1,77 +1,94 @@
1
1
  import "../../assets/DeleteModal.css";
2
- import { jsx as o, jsxs as m, Fragment as d } from "react/jsx-runtime";
3
- import { Modal as D, Button as u, Group as i, Icon as j, TypoBody as n } from "@element/react-components";
4
- import { uniqueId as q } from "lodash";
5
- import { AvailableCustomIcons as g } from "../../enums/AvailableCustomIcons.js";
6
- import { Iconify as x } from "../Iconify/Iconify.js";
7
- const I = "_bulletPoint_469qk_1", N = "_modal_469qk_6", S = "_colorDanger_469qk_10", e = {
8
- bulletPoint: I,
9
- modal: N,
10
- colorDanger: S
11
- }, F = ({
12
- title: h,
13
- confirmButtonLabel: p,
14
- cancelButtonLabel: v,
15
- deleteHeader: b,
16
- deleteBody: t,
17
- deleteText: r,
18
- icon: l,
19
- impossibleDeleteHeader: f,
20
- open: y,
21
- setOpen: c,
22
- onDelete: k,
23
- isDeletePossible: s = !0
2
+ import { jsx as o, jsxs as g, Fragment as i } from "react/jsx-runtime";
3
+ import { Modal as C, Button as u, Group as s, Icon as D, TypoBody as t } from "@element/react-components";
4
+ import { uniqueId as I } from "lodash";
5
+ import { AvailableCustomIcons as O } from "../../enums/AvailableCustomIcons.js";
6
+ import { Iconify as N } from "../Iconify/Iconify.js";
7
+ const S = "_bulletPoint_1kyg0_1", x = "_modal_1kyg0_6", M = "_colorDanger_1kyg0_10", j = "_crossedOut_1kyg0_14", n = {
8
+ bulletPoint: S,
9
+ modal: x,
10
+ colorDanger: M,
11
+ crossedOut: j
12
+ }, J = ({
13
+ title: r,
14
+ confirmButtonLabel: e,
15
+ cancelButtonLabel: l,
16
+ deleteHeader: a,
17
+ deleteBody: c,
18
+ deleteText: p,
19
+ icon: f,
20
+ isIconCrossedOut: h,
21
+ impossibleDeleteHeader: y,
22
+ open: b,
23
+ setOpen: d,
24
+ onDelete: v,
25
+ isDeletePossible: m = !0
24
26
  }) => {
25
- const C = (a) => {
26
- a.detail.action === "close" && c(!1);
27
+ const _ = (k) => {
28
+ k.detail.action === "close" && d(!1);
27
29
  };
28
30
  return /* @__PURE__ */ o(
29
- D,
31
+ C,
30
32
  {
31
- className: e.modal,
33
+ className: n.modal,
32
34
  modalSize: "small",
33
- open: y,
34
- onClose: C,
35
- title: h,
35
+ open: b,
36
+ onClose: _,
37
+ title: r,
36
38
  primaryButton: /* @__PURE__ */ o(
37
39
  u,
38
40
  {
39
41
  variant: "danger",
40
- label: p,
41
- onClick: k,
42
- disabled: !s
42
+ label: e,
43
+ onClick: v,
44
+ disabled: !m
43
45
  }
44
46
  ),
45
- dismissiveButton: /* @__PURE__ */ o(u, { variant: "text", label: v, onClick: () => c(!1) }),
46
- children: /* @__PURE__ */ m(i, { direction: "vertical", secondaryAlign: "center", children: [
47
- l && Object.values(g).includes(l) && /* @__PURE__ */ o(
48
- x,
47
+ footerSupplemental: /* @__PURE__ */ o(u, { variant: "text", label: l, onClick: () => d(!1) }),
48
+ children: /* @__PURE__ */ g(s, { direction: "vertical", secondaryAlign: "center", children: [
49
+ /* @__PURE__ */ o(z, { element: /* @__PURE__ */ o(P, { icon: f }), isCrossedOut: h }),
50
+ /* @__PURE__ */ o(s, { direction: "vertical", children: m ? /* @__PURE__ */ o(
51
+ A,
49
52
  {
50
- icon: l,
51
- iconSize: "xlarge",
52
- className: e.colorDanger
53
+ deleteHeader: a,
54
+ deleteText: p,
55
+ deleteBody: c
53
56
  }
54
- ),
55
- l && !Object.values(g).includes(l) && /* @__PURE__ */ o(j, { icon: l, iconSize: "xlarge", className: e.colorDanger }),
56
- /* @__PURE__ */ o(i, { direction: "vertical", children: s ? /* @__PURE__ */ m(d, { children: [
57
- /* @__PURE__ */ o(n, { level: 1, themeColor: "text-primary-on-background", children: b }),
58
- r && typeof r == "string" && /* @__PURE__ */ o(n, { level: 2, themeColor: "text-secondary-on-background", children: r }),
59
- r && typeof r != "string" && /* @__PURE__ */ o(d, { children: r }),
60
- t && r === void 0 && /* @__PURE__ */ o(i, { direction: "vertical", gap: "none", children: t.map((a, _) => /* @__PURE__ */ o(
61
- n,
62
- {
63
- level: 2,
64
- className: e.bulletPoint,
65
- themeColor: "text-secondary-on-background",
66
- children: a
67
- },
68
- q(_.toString())
69
- )) })
70
- ] }) : /* @__PURE__ */ o(n, { level: 1, themeColor: "text-primary-on-background", children: f }) })
57
+ ) : /* @__PURE__ */ o(B, { impossibleDeleteHeader: y }) })
71
58
  ] })
72
59
  }
73
60
  );
74
- };
61
+ }, z = ({
62
+ element: r,
63
+ isCrossedOut: e = !1
64
+ }) => e ? /* @__PURE__ */ o("span", { className: n.crossedOut, children: r }) : r, P = ({ icon: r }) => r ? typeof r != "string" ? r : Object.values(O).includes(r) ? /* @__PURE__ */ o(
65
+ N,
66
+ {
67
+ icon: r,
68
+ iconSize: "xlarge",
69
+ className: n.colorDanger
70
+ }
71
+ ) : /* @__PURE__ */ o(D, { icon: r, iconSize: "xlarge", className: n.colorDanger }) : /* @__PURE__ */ o(i, {}), A = ({
72
+ deleteHeader: r,
73
+ deleteText: e,
74
+ deleteBody: l
75
+ }) => /* @__PURE__ */ g(i, { children: [
76
+ /* @__PURE__ */ o(t, { level: 1, themeColor: "text-primary-on-background", children: r }),
77
+ e && typeof e == "string" && /* @__PURE__ */ o(t, { level: 2, themeColor: "text-secondary-on-background", children: e }),
78
+ e && typeof e != "string" && /* @__PURE__ */ o(i, { children: e }),
79
+ l && e === void 0 && /* @__PURE__ */ o(s, { direction: "vertical", gap: "none", children: l.map((a, c) => /* @__PURE__ */ o(
80
+ t,
81
+ {
82
+ level: 2,
83
+ className: n.bulletPoint,
84
+ themeColor: "text-secondary-on-background",
85
+ children: a
86
+ },
87
+ I(c.toString())
88
+ )) })
89
+ ] }), B = ({
90
+ impossibleDeleteHeader: r
91
+ }) => /* @__PURE__ */ o(t, { level: 1, themeColor: "text-primary-on-background", children: r });
75
92
  export {
76
- F as DeleteModal
93
+ J as DeleteModal
77
94
  };
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.6320",
4
+ "version": "0.0.6332",
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>",