@bigbinary/neeto-molecules 1.1.13 → 1.1.15
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/ConfirmationModal/index.js +47 -16
- package/dist/ConfirmationModal/utils.js +1 -5
- package/dist/ShareViaEmail/Form.js +4 -1
- package/dist/ShareViaEmail/index.js +4 -1
- package/package.json +1 -1
- package/src/translations/en.json +1 -1
- package/types/ConfirmationModal.d.ts +1 -0
- package/types/ShareViaEmail.d.ts +1 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
2
|
import { Modal, Typography } from "@bigbinary/neetoui";
|
|
3
|
-
import {
|
|
3
|
+
import { ActionBlock, Form, Input } from "@bigbinary/neetoui/formik";
|
|
4
4
|
import { type } from "ramda";
|
|
5
|
+
import { useTranslation } from "react-i18next";
|
|
5
6
|
import { INITIAL_VALUES } from "./constants";
|
|
6
7
|
import { deletionValidationSchema } from "./utils";
|
|
7
8
|
var ConfirmationModal = function ConfirmationModal(_ref) {
|
|
@@ -16,31 +17,61 @@ var ConfirmationModal = function ConfirmationModal(_ref) {
|
|
|
16
17
|
_ref$title = _ref.title,
|
|
17
18
|
title = _ref$title === void 0 ? "" : _ref$title,
|
|
18
19
|
onClose = _ref.onClose,
|
|
19
|
-
onSubmit = _ref.onSubmit
|
|
20
|
+
onSubmit = _ref.onSubmit,
|
|
21
|
+
deleteConfirmationMessage = _ref.deleteConfirmationMessage;
|
|
22
|
+
var _useTranslation = useTranslation(),
|
|
23
|
+
t = _useTranslation.t;
|
|
20
24
|
var formikProps = {
|
|
21
25
|
initialValues: INITIAL_VALUES,
|
|
22
26
|
validationSchema: deletionValidationSchema(confirmationText),
|
|
23
27
|
onSubmit: onSubmit
|
|
24
28
|
};
|
|
29
|
+
var deleteInputLabel = deleteConfirmationMessage || t("neetoMolecules.confirmationModal.deleteConfirmationMessage", {
|
|
30
|
+
value: confirmationText
|
|
31
|
+
});
|
|
32
|
+
var initialFocusRef = useRef(null);
|
|
25
33
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
34
|
+
initialFocusRef: initialFocusRef,
|
|
26
35
|
isOpen: isOpen,
|
|
27
36
|
onClose: onClose,
|
|
28
37
|
"data-testid": "confirmation-modal"
|
|
29
38
|
}, /*#__PURE__*/React.createElement(Modal.Header, null, /*#__PURE__*/React.createElement(Typography, {
|
|
39
|
+
"data-cy": "confirmation-modal",
|
|
30
40
|
style: "h2"
|
|
31
|
-
}, title)), /*#__PURE__*/React.createElement(
|
|
32
|
-
className: "space-y-4"
|
|
33
|
-
}, type(description) === "String" ? /*#__PURE__*/React.createElement(Typography, null, description) : description, /*#__PURE__*/React.createElement(Form, {
|
|
34
|
-
className: "flex items-start space-x-1",
|
|
41
|
+
}, title)), /*#__PURE__*/React.createElement(Form, {
|
|
35
42
|
formikProps: formikProps
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
}, function (_ref2) {
|
|
44
|
+
var values = _ref2.values;
|
|
45
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal.Body, {
|
|
46
|
+
className: "space-y-4"
|
|
47
|
+
}, type(description) === "String" ? /*#__PURE__*/React.createElement(Typography, {
|
|
48
|
+
style: "body2"
|
|
49
|
+
}, description) : description, /*#__PURE__*/React.createElement(Input, {
|
|
50
|
+
"data-testid": "confirmation-modal-input",
|
|
51
|
+
label: deleteInputLabel,
|
|
52
|
+
labelProps: {
|
|
53
|
+
className: "block"
|
|
54
|
+
},
|
|
55
|
+
name: "confirmationText",
|
|
56
|
+
ref: initialFocusRef,
|
|
57
|
+
type: "text"
|
|
58
|
+
})), /*#__PURE__*/React.createElement(Modal.Footer, null, /*#__PURE__*/React.createElement(ActionBlock, {
|
|
59
|
+
className: "space-x-2",
|
|
60
|
+
cancelButtonProps: {
|
|
61
|
+
label: t("neetoMolecules.common.actions.cancel"),
|
|
62
|
+
style: "text",
|
|
63
|
+
onClick: onClose,
|
|
64
|
+
disabled: false,
|
|
65
|
+
type: "button"
|
|
66
|
+
},
|
|
67
|
+
submitButtonProps: {
|
|
68
|
+
"data-cy": "delete-continue-button",
|
|
69
|
+
label: buttonLabel,
|
|
70
|
+
loading: isSubmitting,
|
|
71
|
+
style: "danger",
|
|
72
|
+
disabled: isSubmitting || confirmationText !== values.confirmationText
|
|
73
|
+
}
|
|
74
|
+
})));
|
|
75
|
+
}));
|
|
45
76
|
};
|
|
46
77
|
export default ConfirmationModal;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { t } from "i18next";
|
|
2
1
|
import * as yup from "yup";
|
|
3
2
|
export var deletionValidationSchema = function deletionValidationSchema(confirmationText) {
|
|
4
|
-
var errorMessage = t("neetoMolecules.confirmationModal.required", {
|
|
5
|
-
confirmationText: confirmationText
|
|
6
|
-
});
|
|
7
3
|
return yup.object({
|
|
8
|
-
confirmationText: yup.string().required(
|
|
4
|
+
confirmationText: yup.string().required("").oneOf([confirmationText], "")
|
|
9
5
|
});
|
|
10
6
|
};
|
|
@@ -9,7 +9,8 @@ import EmailBody from "./EmailBodyEditor";
|
|
|
9
9
|
import FormikDatePicker from "./FormikDatePicker";
|
|
10
10
|
import { isPastDate } from "./utils";
|
|
11
11
|
var Form = function Form(_ref) {
|
|
12
|
-
var
|
|
12
|
+
var isSendFromDisabled = _ref.isSendFromDisabled,
|
|
13
|
+
disableReplyTo = _ref.disableReplyTo,
|
|
13
14
|
showVideoEmbedInEditor = _ref.showVideoEmbedInEditor,
|
|
14
15
|
children = _ref.children;
|
|
15
16
|
var _useFormikContext = useFormikContext(),
|
|
@@ -73,6 +74,8 @@ var Form = function Form(_ref) {
|
|
|
73
74
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
74
75
|
required: true,
|
|
75
76
|
className: "col-auto",
|
|
77
|
+
"data-testid": "neeto-molecules-share-via-email-send-from",
|
|
78
|
+
disabled: isSendFromDisabled,
|
|
76
79
|
label: t("neetoMolecules.shareViaEmail.sendFrom"),
|
|
77
80
|
name: "sendFromEmail"
|
|
78
81
|
}), !disableReplyTo && /*#__PURE__*/React.createElement(Input, {
|
|
@@ -7,7 +7,9 @@ import EmailPreview from "../EmailPreview";
|
|
|
7
7
|
import EmailForm from "./Form";
|
|
8
8
|
import { emailFormValidationSchema, generateInitialValues } from "./utils";
|
|
9
9
|
var ShareViaEmail = function ShareViaEmail(_ref) {
|
|
10
|
-
var
|
|
10
|
+
var _ref$isSendFromDisabl = _ref.isSendFromDisabled,
|
|
11
|
+
isSendFromDisabled = _ref$isSendFromDisabl === void 0 ? true : _ref$isSendFromDisabl,
|
|
12
|
+
backToUrl = _ref.backToUrl,
|
|
11
13
|
handleSubmit = _ref.handleSubmit,
|
|
12
14
|
children = _ref.children,
|
|
13
15
|
description = _ref.description,
|
|
@@ -71,6 +73,7 @@ var ShareViaEmail = function ShareViaEmail(_ref) {
|
|
|
71
73
|
style: "body2"
|
|
72
74
|
}, description)), /*#__PURE__*/React.createElement(EmailForm, {
|
|
73
75
|
disableReplyTo: disableReplyTo,
|
|
76
|
+
isSendFromDisabled: isSendFromDisabled,
|
|
74
77
|
showVideoEmbedInEditor: showVideoEmbedInEditor
|
|
75
78
|
}, children)), /*#__PURE__*/React.createElement("div", {
|
|
76
79
|
className: "col-span-7"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-molecules",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.15",
|
|
4
4
|
"description": "A package of reusable molecular components for neeto products.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-molecules.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
package/src/translations/en.json
CHANGED
package/types/ShareViaEmail.d.ts
CHANGED