@bigbinary/neeto-molecules 1.1.59 → 1.1.60
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.
|
@@ -2,7 +2,7 @@ import React, { useRef } from 'react';
|
|
|
2
2
|
import { Modal, Typography } from '@bigbinary/neetoui';
|
|
3
3
|
import { Form, Input, ActionBlock } from '@bigbinary/neetoui/formik';
|
|
4
4
|
import { type } from 'ramda';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { useTranslation, Trans } from 'react-i18next';
|
|
6
6
|
import * as yup from 'yup';
|
|
7
7
|
|
|
8
8
|
var INITIAL_VALUES = {
|
|
@@ -36,8 +36,14 @@ var ConfirmationModal = function ConfirmationModal(_ref) {
|
|
|
36
36
|
validationSchema: deletionValidationSchema(confirmationText),
|
|
37
37
|
onSubmit: onSubmit
|
|
38
38
|
};
|
|
39
|
-
var deleteInputLabel = deleteConfirmationMessage ||
|
|
40
|
-
|
|
39
|
+
var deleteInputLabel = deleteConfirmationMessage || /*#__PURE__*/React.createElement(Trans, {
|
|
40
|
+
components: {
|
|
41
|
+
strong: /*#__PURE__*/React.createElement("strong", null)
|
|
42
|
+
},
|
|
43
|
+
i18nKey: "neetoMolecules.confirmationModal.deleteConfirmationMessage",
|
|
44
|
+
values: {
|
|
45
|
+
value: confirmationText
|
|
46
|
+
}
|
|
41
47
|
});
|
|
42
48
|
var initialFocusRef = useRef(null);
|
|
43
49
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmationModal.js","sources":["../src/components/ConfirmationModal/constants.js","../src/components/ConfirmationModal/utils.js","../src/components/ConfirmationModal/index.jsx"],"sourcesContent":["export const INITIAL_VALUES = { confirmationText: \"\" };\n","import * as yup from \"yup\";\n\nexport const deletionValidationSchema = confirmationText =>\n yup.object({\n confirmationText: yup.string().required(\"\").oneOf([confirmationText], \"\"),\n });\n","import React, { useRef } from \"react\";\n\nimport { Modal, Typography } from \"neetoui\";\nimport { ActionBlock, Form, Input } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { type } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { INITIAL_VALUES } from \"./constants\";\nimport { deletionValidationSchema } from \"./utils\";\n\nconst ConfirmationModal = ({\n buttonLabel,\n confirmationText,\n description = \"\",\n isOpen = true,\n isSubmitting = false,\n title = \"\",\n onClose,\n onSubmit,\n deleteConfirmationMessage,\n}) => {\n const { t } = useTranslation();\n const formikProps = {\n initialValues: INITIAL_VALUES,\n validationSchema: deletionValidationSchema(confirmationText),\n onSubmit,\n };\n\n const deleteInputLabel
|
|
1
|
+
{"version":3,"file":"ConfirmationModal.js","sources":["../src/components/ConfirmationModal/constants.js","../src/components/ConfirmationModal/utils.js","../src/components/ConfirmationModal/index.jsx"],"sourcesContent":["export const INITIAL_VALUES = { confirmationText: \"\" };\n","import * as yup from \"yup\";\n\nexport const deletionValidationSchema = confirmationText =>\n yup.object({\n confirmationText: yup.string().required(\"\").oneOf([confirmationText], \"\"),\n });\n","import React, { useRef } from \"react\";\n\nimport { Modal, Typography } from \"neetoui\";\nimport { ActionBlock, Form, Input } from \"neetoui/formik\";\nimport PropTypes from \"prop-types\";\nimport { type } from \"ramda\";\nimport { Trans, useTranslation } from \"react-i18next\";\n\nimport { INITIAL_VALUES } from \"./constants\";\nimport { deletionValidationSchema } from \"./utils\";\n\nconst ConfirmationModal = ({\n buttonLabel,\n confirmationText,\n description = \"\",\n isOpen = true,\n isSubmitting = false,\n title = \"\",\n onClose,\n onSubmit,\n deleteConfirmationMessage,\n}) => {\n const { t } = useTranslation();\n const formikProps = {\n initialValues: INITIAL_VALUES,\n validationSchema: deletionValidationSchema(confirmationText),\n onSubmit,\n };\n\n const deleteInputLabel = deleteConfirmationMessage || (\n <Trans\n components={{ strong: <strong /> }}\n i18nKey=\"neetoMolecules.confirmationModal.deleteConfirmationMessage\"\n values={{ value: confirmationText }}\n />\n );\n\n const initialFocusRef = useRef(null);\n\n return (\n <Modal\n {...{ initialFocusRef, isOpen, onClose }}\n data-testid=\"confirmation-modal\"\n >\n <Modal.Header>\n <Typography data-cy=\"confirmation-modal\" style=\"h2\">\n {title}\n </Typography>\n </Modal.Header>\n <Form {...{ formikProps }}>\n {({ values }) => (\n <>\n <Modal.Body className=\"space-y-4\">\n {type(description) === \"String\" ? (\n <Typography style=\"body2\">{description}</Typography>\n ) : (\n description\n )}\n <Input\n data-testid=\"confirmation-modal-input\"\n label={deleteInputLabel}\n labelProps={{ className: \"block\" }}\n name=\"confirmationText\"\n ref={initialFocusRef}\n type=\"text\"\n />\n </Modal.Body>\n <Modal.Footer>\n <ActionBlock\n className=\"space-x-2\"\n cancelButtonProps={{\n label: t(\"neetoMolecules.common.actions.cancel\"),\n style: \"text\",\n onClick: onClose,\n disabled: false,\n type: \"button\",\n }}\n submitButtonProps={{\n \"data-cy\": \"delete-continue-button\",\n label: buttonLabel,\n loading: isSubmitting,\n style: \"danger\",\n disabled:\n isSubmitting ||\n confirmationText !== values.confirmationText,\n }}\n />\n </Modal.Footer>\n </>\n )}\n </Form>\n </Modal>\n );\n};\n\nConfirmationModal.propTypes = {\n /**\n * Label of the action button in the Modal\n */\n buttonLabel: PropTypes.string,\n /**\n * Text that is expected to be entered by the user\n */\n confirmationText: PropTypes.string,\n /**\n * Modal description\n */\n description: PropTypes.oneOfType([\n PropTypes.arrayOf(PropTypes.node),\n PropTypes.node,\n PropTypes.string,\n ]),\n /**\n * To be passed to loading prop of the action button\n */\n isSubmitting: PropTypes.bool,\n /**\n * To specify whether the modal should be opened or closed.\n */\n isOpen: PropTypes.bool,\n /**\n * Title of the modal\n */\n title: PropTypes.string,\n /**\n * Handler function that is invoked when the close button is clicked\n */\n onClose: PropTypes.func,\n /**\n * Handler function that is invoked when the action button is clicked\n */\n onSubmit: PropTypes.func,\n /**\n * Message that will be shown as the label of the confirmation input field.\n */\n deleteConfirmationMessage: PropTypes.string,\n};\n\nexport default ConfirmationModal;\n"],"names":["INITIAL_VALUES","confirmationText","deletionValidationSchema","yup","object","string","required","oneOf","ConfirmationModal","_ref","buttonLabel","_ref$description","description","_ref$isOpen","isOpen","_ref$isSubmitting","isSubmitting","_ref$title","title","onClose","onSubmit","deleteConfirmationMessage","_useTranslation","useTranslation","t","formikProps","initialValues","validationSchema","deleteInputLabel","React","createElement","Trans","components","strong","i18nKey","values","value","initialFocusRef","useRef","Modal","Header","Typography","style","Form","_ref2","Fragment","Body","className","type","Input","label","labelProps","name","ref","Footer","ActionBlock","cancelButtonProps","onClick","disabled","submitButtonProps","loading"],"mappings":";;;;;;;AAAO,IAAMA,cAAc,GAAG;AAAEC,EAAAA,gBAAgB,EAAE,EAAA;AAAG,CAAC;;ACE/C,IAAMC,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAGD,gBAAgB,EAAA;EAAA,OACtDE,GAAG,CAACC,MAAM,CAAC;AACTH,IAAAA,gBAAgB,EAAEE,GAAG,CAACE,MAAM,EAAE,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAACN,gBAAgB,CAAC,EAAE,EAAE,CAAA;AAC1E,GAAC,CAAC,CAAA;AAAA,CAAA;;ACMJ,IAAMO,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAUjB;AAAA,EAAA,IATJC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXT,gBAAgB,GAAAQ,IAAA,CAAhBR,gBAAgB;IAAAU,gBAAA,GAAAF,IAAA,CAChBG,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAG,KAAA,CAAA,GAAA,EAAE,GAAAA,gBAAA;IAAAE,WAAA,GAAAJ,IAAA,CAChBK,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAG,KAAA,CAAA,GAAA,IAAI,GAAAA,WAAA;IAAAE,iBAAA,GAAAN,IAAA,CACbO,YAAY;AAAZA,IAAAA,YAAY,GAAAD,iBA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A,QAAQ,EAAE,KAAK;AACfV,QAAAA,IAAI,EAAE,QAAA;OACN;AACFW,MAAAA,iBAAiB,EAAE;AACjB,QAAA,SAAS,EAAE,wBAAwB;AACnCT,QAAAA,KAAK,EAAExC,WAAW;AAClBkD,QAAAA,OAAO,EAAE5C,YAAY;AACrB0B,QAAAA,KAAK,EAAE,QAAQ;AACfgB,QAAAA,QAAQ,EACN1C,YAAY,IACZf,gBAAgB,KAAKkC,MAAM,CAAClC,gBAAAA;AAChC,OAAA;AAAE,KAAA,CACF,CACW,CACd,CAAA;AAAA,GACJ,CACI,CACD,CAAA;AAEZ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-molecules",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.60",
|
|
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>",
|