@coorpacademy/components 11.34.2-alpha.74 → 11.34.2-alpha.76
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/es/molecule/translation-modal/index.d.ts.map +1 -1
- package/es/molecule/translation-modal/index.js +6 -24
- package/es/molecule/translation-modal/index.js.map +1 -1
- package/es/template/back-office/brand-update/index.d.ts +731 -2
- package/es/template/back-office/brand-update/index.d.ts.map +1 -1
- package/es/template/back-office/brand-update/index.js +23 -6
- package/es/template/back-office/brand-update/index.js.map +1 -1
- package/lib/molecule/translation-modal/index.d.ts.map +1 -1
- package/lib/molecule/translation-modal/index.js +5 -23
- package/lib/molecule/translation-modal/index.js.map +1 -1
- package/lib/template/back-office/brand-update/index.d.ts +731 -2
- package/lib/template/back-office/brand-update/index.d.ts.map +1 -1
- package/lib/template/back-office/brand-update/index.js +23 -6
- package/lib/template/back-office/brand-update/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/translation-modal/index.js"],"names":[],"mappings":";AAmBA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/molecule/translation-modal/index.js"],"names":[],"mappings":";AAmBA,gFA+EC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
import React, { useMemo, useCallback
|
|
2
|
+
import React, { useMemo, useCallback } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import BaseModal from '../base-modal';
|
|
5
5
|
import Provider from '../../atom/provider';
|
|
@@ -45,23 +45,13 @@ const TranslationModal = (props, context) => {
|
|
|
45
45
|
translate
|
|
46
46
|
} = context;
|
|
47
47
|
const detectScrollbar = true;
|
|
48
|
-
const [inputValue, setInputValue] = useState(targetInputText?.value || '');
|
|
49
|
-
const [textAreaValue, setTextAreaValue] = useState(targetTextArea?.value || '');
|
|
50
48
|
const handleCancel = useCallback(() => {
|
|
51
49
|
onCancel();
|
|
52
50
|
}, [onCancel]);
|
|
53
51
|
const handleClose = useCallback(() => {
|
|
54
52
|
onClose();
|
|
55
53
|
}, [onClose]);
|
|
56
|
-
const
|
|
57
|
-
setInputValue(e.target.value);
|
|
58
|
-
}, []);
|
|
59
|
-
const handleTextAreaChange = useCallback(e => {
|
|
60
|
-
setTextAreaValue(e.target.value);
|
|
61
|
-
}, []);
|
|
62
|
-
const isConfirmDisabled = useMemo(() => {
|
|
63
|
-
return !inputValue.trim() || !textAreaValue.trim();
|
|
64
|
-
}, [inputValue, textAreaValue]);
|
|
54
|
+
const isValid = !targetInputText.value || !targetTextArea.value;
|
|
65
55
|
const footer = useMemo(() => {
|
|
66
56
|
const cancelButton = {
|
|
67
57
|
onCancel: handleCancel,
|
|
@@ -74,12 +64,12 @@ const TranslationModal = (props, context) => {
|
|
|
74
64
|
onConfirm,
|
|
75
65
|
label: translate('confirm'),
|
|
76
66
|
iconName: 'plus',
|
|
77
|
-
disabled:
|
|
67
|
+
disabled: !isValid,
|
|
78
68
|
color: COLORS.cm_primary_blue
|
|
79
69
|
}
|
|
80
70
|
})
|
|
81
71
|
};
|
|
82
|
-
}, [handleCancel, onConfirm, translate,
|
|
72
|
+
}, [handleCancel, onConfirm, translate, readOnly, isValid]);
|
|
83
73
|
if (!isOpen) return null;
|
|
84
74
|
return /*#__PURE__*/React.createElement(BaseModal, {
|
|
85
75
|
title: translate('translation_title'),
|
|
@@ -105,16 +95,8 @@ const TranslationModal = (props, context) => {
|
|
|
105
95
|
className: style.separator
|
|
106
96
|
}), renderInputGroup({
|
|
107
97
|
title: outputLanguage,
|
|
108
|
-
inputProps:
|
|
109
|
-
|
|
110
|
-
value: inputValue,
|
|
111
|
-
onChange: handleInputChange
|
|
112
|
-
},
|
|
113
|
-
textAreaProps: {
|
|
114
|
-
...targetTextArea,
|
|
115
|
-
value: textAreaValue,
|
|
116
|
-
onChange: handleTextAreaChange
|
|
117
|
-
},
|
|
98
|
+
inputProps: targetInputText,
|
|
99
|
+
textAreaProps: targetTextArea,
|
|
118
100
|
disabled: readOnly
|
|
119
101
|
}))));
|
|
120
102
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useMemo","useCallback","
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useMemo","useCallback","PropTypes","BaseModal","Provider","COLORS","InputText","TextArea","style","renderInputGroup","title","inputProps","textAreaProps","disabled","createElement","className","inputGroup","_extends","TranslationModal","props","context","isOpen","onCancel","onConfirm","onClose","source","inputText","sourceInputText","textArea","sourceTextArea","inputLanguage","target","targetInputText","targetTextArea","language","outputLanguage","readOnly","translate","detectScrollbar","handleCancel","handleClose","isValid","value","footer","cancelButton","label","confirmButton","iconName","color","cm_primary_blue","description","headerIcon","name","backgroundColor","translationModal","horizontalSection","separator","contextTypes","childContextTypes","propTypes","process","env","NODE_ENV","bool","func","shape","theme","string"],"sources":["../../../src/molecule/translation-modal/index.js"],"sourcesContent":["import React, {useMemo, useCallback} from 'react';\nimport PropTypes from 'prop-types';\nimport BaseModal from '../base-modal';\nimport Provider from '../../atom/provider';\nimport {COLORS} from '../../variables/colors';\nimport InputText from '../../atom/input-text';\nimport TextArea from '../../atom/input-textarea';\nimport style from './style.css';\n\nconst renderInputGroup = ({title, inputProps, textAreaProps, disabled}) => {\n return (\n <div className={style.inputGroup}>\n <div className={style.title}>{title}</div>\n <InputText {...inputProps} disabled={disabled} />\n <TextArea {...textAreaProps} disabled={disabled} />\n </div>\n );\n};\n\nconst TranslationModal = (props, context) => {\n const {\n isOpen,\n onCancel,\n onConfirm,\n onClose,\n source: {inputText: sourceInputText, textArea: sourceTextArea, inputLanguage},\n target: {inputText: targetInputText, textArea: targetTextArea, language: outputLanguage},\n readOnly = false\n } = props;\n const {translate} = context;\n\n const detectScrollbar = true;\n\n const handleCancel = useCallback(() => {\n onCancel();\n }, [onCancel]);\n\n const handleClose = useCallback(() => {\n onClose();\n }, [onClose]);\n\n const isValid = !targetInputText.value || !targetTextArea.value;\n\n const footer = useMemo(() => {\n const cancelButton = {\n onCancel: handleCancel,\n label: translate(readOnly ? 'close' : 'cancel')\n };\n return {\n cancelButton,\n ...(!readOnly && {\n confirmButton: {\n onConfirm,\n label: translate('confirm'),\n iconName: 'plus',\n disabled: !isValid,\n color: COLORS.cm_primary_blue\n }\n })\n };\n }, [handleCancel, onConfirm, translate, readOnly, isValid]);\n\n if (!isOpen) return null;\n\n return (\n <BaseModal\n title={translate('translation_title')}\n description={translate('translation_description')}\n isOpen={isOpen}\n onClose={handleClose}\n footer={footer}\n headerIcon={{\n name: 'language',\n backgroundColor: '#D6E6FF'\n }}\n detectScrollbar={detectScrollbar}\n >\n <div className={style.translationModal}>\n <div className={style.horizontalSection}>\n {renderInputGroup({\n title: inputLanguage,\n inputProps: sourceInputText,\n textAreaProps: sourceTextArea,\n disabled: true\n })}\n\n <div className={style.separator} />\n\n {renderInputGroup({\n title: outputLanguage,\n inputProps: targetInputText,\n textAreaProps: targetTextArea,\n disabled: readOnly\n })}\n </div>\n </div>\n </BaseModal>\n );\n};\n\nTranslationModal.contextTypes = {\n translate: Provider.childContextTypes.translate\n};\n\nTranslationModal.propTypes = {\n isOpen: PropTypes.bool,\n onCancel: PropTypes.func,\n onConfirm: PropTypes.func,\n onClose: PropTypes.func,\n source: PropTypes.shape({\n inputText: PropTypes.shape({\n ...InputText.propTypes,\n theme: PropTypes.string\n }),\n textArea: PropTypes.shape({\n ...TextArea.propTypes,\n theme: PropTypes.string\n }),\n inputLanguage: PropTypes.string\n }),\n target: PropTypes.shape({\n inputText: PropTypes.shape({\n ...InputText.propTypes,\n theme: PropTypes.string\n }),\n textArea: PropTypes.shape({\n ...TextArea.propT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