@bigbinary/neeto-molecules 4.0.124 → 4.0.125

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.
@@ -20,11 +20,13 @@ var TOOLTIP_CONFIG = {
20
20
  hideAfter: TIME_OUT,
21
21
  position: "top"
22
22
  };
23
+ var BUTTON_SIZES = {
24
+ medium: "medium"};
23
25
 
24
26
  var css = ".neeto-molecules-copy-button{display:flex;justify-content:space-between}.neeto-molecules-copy-button .neeto-ui-btn:active,.neeto-molecules-copy-button .neeto-ui-btn:focus,.neeto-molecules-copy-button .neeto-ui-btn:hover{box-shadow:none}.neeto-molecules-copy-button--active{background:rgba(var(--neeto-ui-success-500));color:rgba(var(--neeto-ui-white))}.neeto-molecules-copy-button--active.neeto-ui-btn:active,.neeto-molecules-copy-button--active.neeto-ui-btn:focus,.neeto-molecules-copy-button--active.neeto-ui-btn:hover{background:rgba(var(--neeto-ui-success-500));box-shadow:none;color:rgba(var(--neeto-ui-white))}";
25
27
  injectCss.n(css,{});
26
28
 
27
- var _excluded = ["className", "icon", "label", "successLabel", "tooltipContent", "successTooltipContent", "value", "style", "tooltipProps", "onClick"];
29
+ var _excluded = ["className", "icon", "label", "successLabel", "tooltipContent", "successTooltipContent", "value", "style", "size", "tooltipProps", "onClick"];
28
30
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
29
31
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
30
32
  var CopyToClipboardButton = function CopyToClipboardButton(_ref) {
@@ -38,6 +40,8 @@ var CopyToClipboardButton = function CopyToClipboardButton(_ref) {
38
40
  successTooltipContent = _ref.successTooltipContent,
39
41
  value = _ref.value,
40
42
  style = _ref.style,
43
+ _ref$size = _ref.size,
44
+ size = _ref$size === void 0 ? BUTTON_SIZES.medium : _ref$size,
41
45
  tooltipProps = _ref.tooltipProps,
42
46
  onClick = _ref.onClick,
43
47
  otherProps = _objectWithoutProperties(_ref, _excluded);
@@ -59,11 +63,12 @@ var CopyToClipboardButton = function CopyToClipboardButton(_ref) {
59
63
  setIsChecked(false);
60
64
  }, TIME_OUT); // Reset copied state after 2 seconds
61
65
  };
62
- React.useEffect(function () {
66
+ React.useLayoutEffect(function () {
63
67
  if (!ref.current) return;
68
+ ref.current.style.minWidth = "";
64
69
  var buttonWidth = ref.current.clientWidth;
65
70
  ref.current.style.minWidth = "".concat(buttonWidth, "px");
66
- }, []);
71
+ }, [size]);
67
72
  var tooltipOptions = label ? null : ramda.mergeAll([TOOLTIP_CONFIG, {
68
73
  content: isChecked ? successTooltipContent || t("neetoMolecules.common.copied") : tooltipContent || t("neetoMolecules.common.copyToClipboard")
69
74
  }, tooltipProps]);
@@ -71,13 +76,14 @@ var CopyToClipboardButton = function CopyToClipboardButton(_ref) {
71
76
  var buttonIcon = isChecked ? Check : icon;
72
77
  return /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread({
73
78
  ref: ref,
79
+ size: size,
74
80
  style: style,
75
81
  "data-cy": "copy-to-clipboard-button",
76
82
  "data-testid": "copy-button",
77
83
  icon: buttonIcon,
78
84
  label: buttonLabel,
79
85
  tooltipProps: tooltipOptions,
80
- className: classnames("neeto-molecules-copy-button", _defineProperty(_defineProperty({}, className, className), "neeto-molecules-copy-button--active", isChecked)),
86
+ className: classnames("neeto-molecules-copy-button", _defineProperty(_defineProperty(_defineProperty({}, className, className), "neeto-molecules-copy-button--active", isChecked), "neeto-molecules-copy-button--".concat(size), size)),
81
87
  onClick: onHandleClick
82
88
  }, otherProps));
83
89
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CopyToClipboardButton.js","sources":["../../src/components/CopyToClipboardButton/constants.js","../../src/components/CopyToClipboardButton/index.jsx"],"sourcesContent":["const TIME_OUT = 2000;\n\nconst TOOLTIP_CONFIG = {\n trigger: \"click mouseenter\",\n hideAfter: TIME_OUT,\n position: \"top\",\n};\n\nconst BUTTON_STYLES = {\n primary: \"primary\",\n secondary: \"secondary\",\n text: \"text\",\n};\n\nexport { TOOLTIP_CONFIG, TIME_OUT, BUTTON_STYLES };\n","import { useState, useEffect, useRef } from \"react\";\n\nimport classnames from \"classnames\";\nimport { copyToClipboard } from \"neetocommons/utils/general\";\nimport { Copy, Check } from \"neetoicons\";\nimport { Button } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { mergeAll } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { TOOLTIP_CONFIG, TIME_OUT, BUTTON_STYLES } from \"./constants\";\nimport \"./copyToClipboard.scss\";\n\nconst CopyToClipboardButton = ({\n className,\n icon = Copy,\n label = \"\",\n successLabel,\n tooltipContent,\n successTooltipContent,\n value,\n style,\n tooltipProps,\n onClick,\n ...otherProps\n}) => {\n const { t } = useTranslation();\n\n const [isChecked, setIsChecked] = useState(false);\n\n const ref = useRef();\n\n const onHandleClick = event => {\n event.preventDefault();\n event.stopPropagation();\n\n if (onClick) onClick(event);\n else copyToClipboard(value, { showToastr: false });\n\n setIsChecked(true);\n setTimeout(() => {\n setIsChecked(false);\n }, TIME_OUT); // Reset copied state after 2 seconds\n };\n\n useEffect(() => {\n if (!ref.current) return;\n const buttonWidth = ref.current.clientWidth;\n ref.current.style.minWidth = `${buttonWidth}px`;\n }, []);\n\n const tooltipOptions = label\n ? null\n : mergeAll([\n TOOLTIP_CONFIG,\n {\n content: isChecked\n ? successTooltipContent || t(\"neetoMolecules.common.copied\")\n : tooltipContent || t(\"neetoMolecules.common.copyToClipboard\"),\n },\n tooltipProps,\n ]);\n\n const buttonLabel =\n isChecked && label\n ? successLabel || t(\"neetoMolecules.common.copied\")\n : label;\n const buttonIcon = isChecked ? Check : icon;\n\n return (\n <Button\n {...{ ref, style }}\n data-cy=\"copy-to-clipboard-button\"\n data-testid=\"copy-button\"\n icon={buttonIcon}\n label={buttonLabel}\n tooltipProps={tooltipOptions}\n className={classnames(\"neeto-molecules-copy-button\", {\n [className]: className,\n \"neeto-molecules-copy-button--active\": isChecked,\n })}\n onClick={onHandleClick}\n {...otherProps}\n />\n );\n};\n\nCopyToClipboardButton.propTypes = {\n /**\n * To provide additional classnames to the button.\n */\n className: PropTypes.string,\n /**\n * To provide the icon to be passed to the button. Defaults to the Copy icon.\n */\n icon: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n /**\n * To provide the label to the button. By default there is no label.\n */\n label: PropTypes.string,\n /**\n * The label of button when the value is copied to clipboard. Defaults to 'Copied'.\n */\n successLabel: PropTypes.string,\n /**\n * The value to be copied to clipboard. (required)\n */\n value: PropTypes.string,\n /**\n * To specify the style of the Button.\n */\n style: PropTypes.oneOf(Object.values(BUTTON_STYLES)),\n /**\n * The content of the tooltip when the value is copied to clipboard. Defaults to 'Copy to clipboard'.\n */\n tooltipContent: PropTypes.string,\n /**\n * The content of the tooltip when the value is copied to clipboard. Defaults to 'Copied'.\n */\n successTooltipContent: PropTypes.string,\n};\n\nexport default CopyToClipboardButton;\n"],"names":["TIME_OUT","TOOLTIP_CONFIG","trigger","hideAfter","position","CopyToClipboardButton","_ref","className","_ref$icon","icon","Copy","_ref$label","label","successLabel","tooltipContent","successTooltipContent","value","style","tooltipProps","onClick","otherProps","_objectWithoutProperties","_excluded","_useTranslation","useTranslation","t","_useState","useState","_useState2","_slicedToArray","isChecked","setIsChecked","ref","useRef","onHandleClick","event","preventDefault","stopPropagation","copyToClipboard","showToastr","setTimeout","useEffect","current","buttonWidth","clientWidth","minWidth","concat","tooltipOptions","mergeAll","content","buttonLabel","button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B,IAAAA,GAAG,EAAHA,GAAG;AAAEf,IAAAA,KAAK,EAALA,KAAK;AAChB,IAAA,SAAA,EAAQ,0BAA0B;AAClC,IAAA,aAAA,EAAY,aAAa;AACzBR,IAAAA,IAAI,EAAE0C,UAAW;AACjBvC,IAAAA,KAAK,EAAEsC,WAAY;AACnBhC,IAAAA,YAAY,EAAE6B,cAAe;AAC7BxC,IAAAA,SAAS,EAAEiD,UAAU,CAAC,6BAA6B,EAAAC,eAAA,CAAAA,eAAA,CAAA,EAAA,EAChDlD,SAAS,EAAGA,SAAS,CAAA,EACtB,qCAAqC,EAAEuB,SAAS,CACjD,CAAE;AACHX,IAAAA,OAAO,EAAEe;GAAc,EACnBd,UAAU,CACf,CAAC;AAEN;;;;"}
1
+ {"version":3,"file":"CopyToClipboardButton.js","sources":["../../src/components/CopyToClipboardButton/constants.js","../../src/components/CopyToClipboardButton/index.jsx"],"sourcesContent":["const TIME_OUT = 2000;\n\nconst TOOLTIP_CONFIG = {\n trigger: \"click mouseenter\",\n hideAfter: TIME_OUT,\n position: \"top\",\n};\n\nconst BUTTON_STYLES = {\n primary: \"primary\",\n secondary: \"secondary\",\n text: \"text\",\n};\n\nconst BUTTON_SIZES = {\n small: \"small\",\n medium: \"medium\",\n large: \"large\",\n};\n\nexport { TOOLTIP_CONFIG, TIME_OUT, BUTTON_STYLES, BUTTON_SIZES };\n","import { useState, useLayoutEffect, useRef } from \"react\";\n\nimport classnames from \"classnames\";\nimport { copyToClipboard } from \"neetocommons/utils/general\";\nimport { Copy, Check } from \"neetoicons\";\nimport { Button } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { mergeAll } from \"ramda\";\nimport { useTranslation } from \"react-i18next\";\n\nimport {\n TOOLTIP_CONFIG,\n TIME_OUT,\n BUTTON_STYLES,\n BUTTON_SIZES,\n} from \"./constants\";\nimport \"./copyToClipboard.scss\";\n\nconst CopyToClipboardButton = ({\n className,\n icon = Copy,\n label = \"\",\n successLabel,\n tooltipContent,\n successTooltipContent,\n value,\n style,\n size = BUTTON_SIZES.medium,\n tooltipProps,\n onClick,\n ...otherProps\n}) => {\n const { t } = useTranslation();\n\n const [isChecked, setIsChecked] = useState(false);\n\n const ref = useRef();\n\n const onHandleClick = event => {\n event.preventDefault();\n event.stopPropagation();\n\n if (onClick) onClick(event);\n else copyToClipboard(value, { showToastr: false });\n\n setIsChecked(true);\n setTimeout(() => {\n setIsChecked(false);\n }, TIME_OUT); // Reset copied state after 2 seconds\n };\n\n useLayoutEffect(() => {\n if (!ref.current) return;\n ref.current.style.minWidth = \"\";\n const buttonWidth = ref.current.clientWidth;\n ref.current.style.minWidth = `${buttonWidth}px`;\n }, [size]);\n\n const tooltipOptions = label\n ? null\n : mergeAll([\n TOOLTIP_CONFIG,\n {\n content: isChecked\n ? successTooltipContent || t(\"neetoMolecules.common.copied\")\n : tooltipContent || t(\"neetoMolecules.common.copyToClipboard\"),\n },\n tooltipProps,\n ]);\n\n const buttonLabel =\n isChecked && label\n ? successLabel || t(\"neetoMolecules.common.copied\")\n : label;\n const buttonIcon = isChecked ? Check : icon;\n\n return (\n <Button\n {...{ ref, size, style }}\n data-cy=\"copy-to-clipboard-button\"\n data-testid=\"copy-button\"\n icon={buttonIcon}\n label={buttonLabel}\n tooltipProps={tooltipOptions}\n className={classnames(\"neeto-molecules-copy-button\", {\n [className]: className,\n \"neeto-molecules-copy-button--active\": isChecked,\n [`neeto-molecules-copy-button--${size}`]: size,\n })}\n onClick={onHandleClick}\n {...otherProps}\n />\n );\n};\n\nCopyToClipboardButton.propTypes = {\n /**\n * To provide additional classnames to the button.\n */\n className: PropTypes.string,\n /**\n * To provide the icon to be passed to the button. Defaults to the Copy icon.\n */\n icon: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),\n /**\n * To provide the label to the button. By default there is no label.\n */\n label: PropTypes.string,\n /**\n * The label of button when the value is copied to clipboard. Defaults to 'Copied'.\n */\n successLabel: PropTypes.string,\n /**\n * The value to be copied to clipboard. (required)\n */\n value: PropTypes.string,\n /**\n * To specify the style of the Button.\n */\n style: PropTypes.oneOf(Object.values(BUTTON_STYLES)),\n /**\n * To specify the size of the Button. Defaults to 'medium'.\n */\n size: PropTypes.oneOf(Object.values(BUTTON_SIZES)),\n /**\n * The content of the tooltip when the value is copied to clipboard. Defaults to 'Copy to clipboard'.\n */\n tooltipContent: PropTypes.string,\n /**\n * The content of the tooltip when the value is copied to clipboard. Defaults to 'Copied'.\n */\n successTooltipContent: PropTypes.string,\n};\n\nexport default CopyToClipboardButton;\n"],"names":["TIME_OUT","TOOLTIP_CONFIG","trigger","hideAfter","position","BUTTON_SIZES","small","medium","CopyToClipboardButton","_ref","className","_ref$icon","icon","Copy","_ref$label","label","successLabel","tooltipContent","successTooltipContent","value","style","_ref$size","size","tooltipProps","onClick","otherProps","_objectWithoutProperties","_excluded","_useTranslation","useTranslation","t","_useState","useState","_useState2","_slicedToArray","isChecked","setIsChecked","ref","useRef","onHandleClick","event","preventDefault","stopPropagation","copyToClipboard","showToastr","setTimeout","useLayoutEffect","current","minWidth","buttonWidth","clientWidth","concat","tooltipOptions","mergeAll","content","buttonLabel","buttonIcon","Check","_jsx","Button","_objectSpread","classnames","_defineProperty"],"mappings":";;;;;;;;;;;;;;;;AAAA,IAAMA,QAAQ,GAAG,IAAI;AAErB,IAAMC,cAAc,GAAG;AACrBC,EAAAA,OAAO,EAAE,kBAAkB;AAC3BC,EAAAA,SAAS,EAAEH,QAAQ;AACnBI,EAAAA,QAAQ,EAAE;AACZ,CAAC;AAQD,IAAMC,YAAY,GAAG;AACnBC,EACAC,MAAM,EAAE,QAEV,CAAC;;;;;;;;ACAD,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAqBA,CAAAC,IAAA,EAarB;AAAA,EAAA,IAZJC,SAAS,GAAAD,IAAA,CAATC,SAAS;IAAAC,SAAA,GAAAF,IAAA,CACTG,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAGE,IAAI,GAAAF,SAAA;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AAA,YAAY,EAAE6B,cAAe;IAC7B1C,SAAS,EAAEmD,UAAU,CAAC,6BAA6B,EAAAC,eAAA,CAAAA,eAAA,CAAAA,eAAA,CAAA,EAAA,EAChDpD,SAAS,EAAGA,SAAS,CAAA,EACtB,qCAAqC,EAAEyB,SAAS,CAAA,EAAA,+BAAA,CAAAgB,MAAA,CACf7B,IAAI,CAAA,EAAKA,IAAI,CAC/C,CAAE;AACHE,IAAAA,OAAO,EAAEe;GAAc,EACnBd,UAAU,CACf,CAAC;AAEN;;;;"}
@@ -9,7 +9,6 @@ var classnames = require('classnames');
9
9
  var formik = require('formik');
10
10
  var neetoCist = require('@bigbinary/neeto-cist');
11
11
  var FormikEditor = require('@bigbinary/neeto-editor/FormikEditor');
12
- var Typography = require('@bigbinary/neetoui/Typography');
13
12
  var Button = require('@bigbinary/neetoui/Button');
14
13
  var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
15
14
  var Radio = require('@bigbinary/neetoui/formik/Radio');
@@ -36,6 +35,7 @@ var injectCss = require('./inject-css-B6qYtOJe.js');
36
35
  var Form = require('@bigbinary/neetoui/formik/Form');
37
36
  require('@bigbinary/neeto-commons-frontend/react-utils/withT');
38
37
  require('@bigbinary/neeto-editor/EditorContent');
38
+ require('@bigbinary/neetoui/Typography');
39
39
  require('./index-JY2zVpnv.js');
40
40
  require('./_commonjsHelpers-BJu3ubxk.js');
41
41
  require('@babel/runtime/helpers/toConsumableArray');
@@ -134,7 +134,9 @@ var EDITOR_ADDONS = ["highlight", "emoji", "code-block", "block-quote", "image-u
134
134
  var EmailFormContext = /*#__PURE__*/React.createContext({
135
135
  showSendToField: false,
136
136
  showSendToAsRadio: false,
137
- showReplyToField: false
137
+ showReplyToField: false,
138
+ showCcField: false,
139
+ showBccField: false
138
140
  });
139
141
 
140
142
  function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -213,6 +215,7 @@ var ReplyToField = function ReplyToField(_ref) {
213
215
  return /*#__PURE__*/jsxRuntime.jsx(Input, {
214
216
  labelProps: labelProps,
215
217
  autoFocus: true,
218
+ nakedInput: true,
216
219
  required: true,
217
220
  className: "w-full",
218
221
  "data-testid": "replyToInput",
@@ -284,43 +287,30 @@ var SubjectField = function SubjectField(_ref) {
284
287
  var updatedSubject = [text.slice(0, splitIndex), " {{".concat(variable, "}}"), text.slice(splitIndex)].join("");
285
288
  updateText(updatedSubject);
286
289
  };
287
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
288
- children: [/*#__PURE__*/jsxRuntime.jsx(Input$1, {
289
- error: error,
290
- name: name,
291
- onBlur: onBlur,
292
- required: required,
293
- label: t("neetoMolecules.emailForm.labels.subject"),
294
- size: "large",
295
- value: text,
296
- suffix: /*#__PURE__*/jsxRuntime.jsx(DynamicVariables, {
297
- variables: subjectVariables,
298
- dropdownProps: {
299
- className: "neeto-ui-dropdown__popup overflow-y-auto",
300
- buttonSize: "small"
301
- },
302
- onVariableClick: tagClickHandler
303
- }),
304
- onChange: general.withEventTargetValue(updateText),
305
- onFocus: function onFocus() {
306
- return setIsFieldFocusedOnce(true);
307
- }
308
- }), /*#__PURE__*/jsxRuntime.jsx(Typography, {
309
- className: "neeto-ui-text-gray-600 mt-2",
310
- "data-cy": "subject-input-variable-label",
311
- style: "body3",
312
- children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
313
- components: {
314
- span: /*#__PURE__*/jsxRuntime.jsx("span", {
315
- className: "font-semibold"
316
- })
317
- },
318
- i18nKey: "neetoMolecules.emailForm.helpText",
319
- values: {
320
- type: "subject"
321
- }
322
- })
323
- })]
290
+ return /*#__PURE__*/jsxRuntime.jsx(Input$1, {
291
+ error: error,
292
+ name: name,
293
+ onBlur: onBlur,
294
+ required: required,
295
+ nakedInput: true,
296
+ label: t("neetoMolecules.emailForm.labels.subject"),
297
+ placeholder: t("neetoMolecules.emailForm.placeholders.subject"),
298
+ value: text,
299
+ suffix: /*#__PURE__*/jsxRuntime.jsx(DynamicVariables, {
300
+ buttonProps: {
301
+ className: "m-1"
302
+ },
303
+ variables: subjectVariables,
304
+ dropdownProps: {
305
+ className: "neeto-ui-dropdown__popup overflow-y-auto",
306
+ buttonSize: "small"
307
+ },
308
+ onVariableClick: tagClickHandler
309
+ }),
310
+ onChange: general.withEventTargetValue(updateText),
311
+ onFocus: function onFocus() {
312
+ return setIsFieldFocusedOnce(true);
313
+ }
324
314
  });
325
315
  };
326
316
 
@@ -381,86 +371,80 @@ var EmailForm = function EmailForm(_ref) {
381
371
  "data-cy": "email-form",
382
372
  "data-testid": "email-form",
383
373
  className: classnames("neeto-notification-email-wrapper__form-container flex flex-1 flex-col items-start gap-2 !pb-0", _defineProperty({}, className, className)),
384
- children: [showFields && /*#__PURE__*/jsxRuntime.jsxs("div", {
385
- className: "flex w-full flex-col items-start justify-start gap-6",
386
- children: [/*#__PURE__*/jsxRuntime.jsx(formik.Field, {
387
- name: "subject",
388
- children: function children(_ref2) {
389
- var _ref2$field = _ref2.field,
390
- value = _ref2$field.value,
391
- onBlur = _ref2$field.onBlur,
392
- _ref2$meta = _ref2.meta,
393
- error = _ref2$meta.error,
394
- touched = _ref2$meta.touched;
395
- return /*#__PURE__*/jsxRuntime.jsx("div", {
396
- className: "w-full",
397
- children: /*#__PURE__*/jsxRuntime.jsx(SubjectField, {
398
- onBlur: onBlur,
399
- subjectVariables: subjectVariables,
400
- required: true,
401
- error: touched && error ? t(error) : undefined,
402
- name: "subject",
403
- text: value,
404
- updateText: function updateText(text) {
405
- return setFieldValue("subject", text);
406
- }
407
- })
408
- });
409
- }
410
- }), showSendToRadioField && /*#__PURE__*/jsxRuntime.jsx(Radio, {
411
- "data-testid": "send-to-id",
412
- label: t("neetoMolecules.emailForm.labels.sendTo"),
413
- labelProps: {
414
- required: true
415
- },
416
- name: "sendToId",
417
- children: sendToFieldOptions.map(function (_ref3) {
418
- var label = _ref3.label,
419
- value = _ref3.value;
420
- return /*#__PURE__*/React.createElement(Radio.Item, {
421
- label: label,
422
- value: value,
423
- key: value
424
- });
425
- })
426
- }), /*#__PURE__*/jsxRuntime.jsx(SendToField, {
427
- showBccField: showBccField,
428
- showCcField: showCcField,
429
- showSendToTextField: showSendToTextField
430
- }), showReplyToField && /*#__PURE__*/jsxRuntime.jsx(ReplyToField, _objectSpread$2({
431
- options: replyToOptions
432
- }, replyToFieldProps)), /*#__PURE__*/jsxRuntime.jsxs("div", {
433
- className: "w-full",
434
- "data-cy": "message-input-container",
435
- children: [/*#__PURE__*/jsxRuntime.jsx(FormikEditor, {
436
- required: true,
437
- addons: editorAddons,
438
- "data-cy": "message-input-field",
439
- id: "form_message",
440
- label: t("neetoMolecules.emailForm.labels.message"),
441
- name: "message",
442
- ref: editorRef,
443
- variables: messageVariables,
444
- shouldUpdate: function shouldUpdate(nextProps, prevProps) {
445
- return neetoCist.notEqualsDeep(nextProps.variables, prevProps.variables);
446
- }
447
- }), /*#__PURE__*/jsxRuntime.jsx(Typography, {
448
- className: "neeto-ui-text-gray-500 mt-2",
449
- "data-cy": "message-input-variable-label",
450
- style: "body3",
451
- children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
452
- i18nKey: "neetoMolecules.emailForm.helpText",
453
- values: {
454
- type: "message"
455
- },
456
- components: {
457
- span: /*#__PURE__*/jsxRuntime.jsx("span", {
458
- className: "font-semibold"
374
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
375
+ className: "w-full grow",
376
+ children: showFields && /*#__PURE__*/jsxRuntime.jsxs("div", {
377
+ className: "flex w-full flex-col items-start justify-start gap-5",
378
+ children: [showSendToRadioField && /*#__PURE__*/jsxRuntime.jsx(Radio, {
379
+ className: "pb-2",
380
+ "data-testid": "send-to-id",
381
+ label: t("neetoMolecules.emailForm.labels.sendTo"),
382
+ labelProps: {
383
+ required: true
384
+ },
385
+ name: "sendToId",
386
+ children: sendToFieldOptions.map(function (_ref2) {
387
+ var label = _ref2.label,
388
+ value = _ref2.value;
389
+ return /*#__PURE__*/React.createElement(Radio.Item, {
390
+ label: label,
391
+ value: value,
392
+ key: value
393
+ });
394
+ })
395
+ }), /*#__PURE__*/jsxRuntime.jsx(SendToField, {
396
+ showBccField: showBccField,
397
+ showCcField: showCcField,
398
+ showSendToTextField: showSendToTextField
399
+ }), showReplyToField && /*#__PURE__*/jsxRuntime.jsx("div", {
400
+ className: "neeto-ui-border-gray-200 w-full border-b pb-1",
401
+ children: /*#__PURE__*/jsxRuntime.jsx(ReplyToField, _objectSpread$2({
402
+ options: replyToOptions
403
+ }, replyToFieldProps))
404
+ }), /*#__PURE__*/jsxRuntime.jsx(formik.Field, {
405
+ name: "subject",
406
+ children: function children(_ref3) {
407
+ var _ref3$field = _ref3.field,
408
+ value = _ref3$field.value,
409
+ onBlur = _ref3$field.onBlur,
410
+ _ref3$meta = _ref3.meta,
411
+ error = _ref3$meta.error,
412
+ touched = _ref3$meta.touched;
413
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
414
+ className: "neeto-notification-email-subject-block neeto-ui-border-gray-200 w-full border-b pb-1",
415
+ children: /*#__PURE__*/jsxRuntime.jsx(SubjectField, {
416
+ onBlur: onBlur,
417
+ subjectVariables: subjectVariables,
418
+ required: true,
419
+ error: touched && error ? t(error) : undefined,
420
+ name: "subject",
421
+ text: value,
422
+ updateText: function updateText(text) {
423
+ return setFieldValue("subject", text);
424
+ }
459
425
  })
426
+ });
427
+ }
428
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
429
+ className: "neeto-notification-email-message-block w-full",
430
+ "data-cy": "message-input-container",
431
+ children: /*#__PURE__*/jsxRuntime.jsx(FormikEditor, {
432
+ required: true,
433
+ addons: editorAddons,
434
+ "data-cy": "message-input-field",
435
+ hideSlashCommands: false,
436
+ id: "form_message",
437
+ menuType: "none",
438
+ name: "message",
439
+ placeholder: t("neetoMolecules.emailForm.placeholders.message"),
440
+ ref: editorRef,
441
+ variables: messageVariables,
442
+ shouldUpdate: function shouldUpdate(nextProps, prevProps) {
443
+ return neetoCist.notEqualsDeep(nextProps.variables, prevProps.variables);
460
444
  }
461
445
  })
462
446
  })]
463
- })]
447
+ })
464
448
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
465
449
  className: "neeto-ui-bg-white neeto-notification-email-wrapper__action-block z-10 flex w-full justify-between py-6 lg:sticky lg:bottom-0",
466
450
  children: [/*#__PURE__*/jsxRuntime.jsx(ActionBlock, {
@@ -486,7 +470,7 @@ var EmailForm = function EmailForm(_ref) {
486
470
  });
487
471
  };
488
472
 
489
- var css = ".neeto-notification-email-wrapper{height:calc(100vh - 64px);height:calc(100dvh - 64px)}";
473
+ var css = ".neeto-notification-email-wrapper{height:calc(100vh - 64px);height:calc(100dvh - 64px)}.neeto-notification-email-outer-wrapper .neeto-ui-react-select__container .neeto-ui-react-select__control{border:none}.neeto-notification-email-outer-wrapper .neeto-ui-react-select__container .neeto-ui-react-select__control--is-focused{box-shadow:none!important}.neeto-notification-email-outer-wrapper .neeto-ui-react-select__container .neeto-ui-react-select__value-container{padding-left:0}.neeto-notification-email-message-block .neeto-editor,.neeto-notification-email-message-block .neeto-editor-error{border:none;padding:0}.neeto-notification-email-message-block p.is-editor-empty{font-size:14px}.neeto-notification-email-subject-block .neeto-ui-input__suffix{padding:0}.neeto-molecules-email-preview-ribbon{background:#ffee6a;border-bottom-left-radius:6px;border-top-left-radius:6px;border-top-right-radius:6px;box-shadow:0 3px 4px 0 rgba(0,0,0,.149);color:#49545c;font-size:14px;font-weight:500;min-width:-moz-max-content;min-width:max-content;padding:6px 12px;position:absolute;right:-6px;text-align:center;top:-6px;z-index:10}.neeto-molecules-email-preview-ribbon:after{border-color:transparent #ddd06b;border-style:solid;border-width:0 0 12px 6px;content:\"\";left:auto;position:absolute;right:0;top:100%;z-index:-20}";
490
474
  injectCss.n(css,{});
491
475
 
492
476
  function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }