@bigbinary/neeto-molecules 3.7.30 → 3.7.32

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.
@@ -19,7 +19,7 @@ var DEFAULT_EDITOR_PROPS = {
19
19
  addons: []
20
20
  };
21
21
 
22
- var css = ".neeto-molecules-document__wrapper{height:100%}@media screen and (max-width:768px){.neeto-molecules-document__wrapper{width:100%}}.neeto-molecules-document__wrapper .neeto-molecules-document__container{margin:0 auto;max-width:768px!important;width:100%}.neeto-molecules-document__wrapper .neeto-molecules-document-editor__menubar{position:sticky;top:0;width:100%;z-index:20}.neeto-molecules-document__wrapper .neeto-molecules-document__title{margin:24px 0 0;width:100%}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input{padding:0!important}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea{color:rgb(var(--neeto-ui-black));font-size:42px;font-weight:700;line-height:48px;max-height:none;resize:none}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea::-moz-placeholder{color:rgb(var(--neeto-ui-gray-300))}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea::placeholder{color:rgb(var(--neeto-ui-gray-300))}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea{font-size:36px}}.neeto-molecules-document__wrapper .neeto-molecules-editor-content__error{margin:12px auto}.neeto-molecules-document__wrapper .ProseMirror{flex-grow:1;height:auto;max-height:none;overflow-y:hidden}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu{border:thin solid rgb(var(--neeto-ui-gray-200));border-left:none;border-right:none}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-editor-fixed-menu button.neeto-editor-fixed-menu__item{padding:6px}}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{margin:0 auto;max-width:750px;padding-left:0!important;padding-right:0!important}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper button.neeto-editor-fixed-menu__item{flex-shrink:0}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{overflow-x:auto}}.neeto-molecules-document__wrapper .editor-content__wrapper{border:none!important;padding:12px 16px 0!important;width:100%!important}.neeto-molecules-document__wrapper .editor-content-attachments{border:none;margin:12px auto 0;max-width:768px!important;padding-left:16px;padding-right:16px}.neeto-molecules-document__wrapper .editor-content-attachments--no-attachments{display:none!important}.neeto-molecules-document__wrapper .neeto-editor-character-count{margin:0 auto;max-width:768px!important;padding-left:16px;padding-right:16px}.neeto-molecules-document__wrapper .ne-attachments__wrapper{width:100%}.editor-content__wrapper.neeto-editor{padding:0 16px}.editor-content__wrapper.neeto-editor h1{font-size:var(--neeto-ui-text-h1);margin:2rem 0 .25rem}.editor-content__wrapper.neeto-editor h2{font-size:var(--neeto-ui-text-h2);margin:1.5rem 0 .25rem}.editor-content__wrapper.neeto-editor h3{font-size:var(--neeto-ui-text-h3);margin:1rem 0 .25rem}.editor-content__wrapper.neeto-editor h4{font-size:var(--neeto-ui-text-h4);margin:.75rem 0 .25rem}.editor-content__wrapper.neeto-editor h5{font-size:var(--neeto-ui-text-h5);margin:.75rem 0 .25rem}.editor-content__wrapper.neeto-editor h6{font-size:var(--neeto-ui-text-h6);margin:.75rem 0 .25rem}.editor-content__wrapper.neeto-editor h1,.editor-content__wrapper.neeto-editor h2,.editor-content__wrapper.neeto-editor h3,.editor-content__wrapper.neeto-editor h4,.editor-content__wrapper.neeto-editor h5,.editor-content__wrapper.neeto-editor h6{font-weight:var(--neeto-ui-font-semibold)}.editor-content__wrapper.neeto-editor p{font-size:var(--neeto-ui-text-body1);line-height:var(--neeto-ui-leading-normal)}.editor-content__wrapper.neeto-editor ol,.editor-content__wrapper.neeto-editor ul{margin-bottom:1rem;padding-left:24px}.editor-content__wrapper.neeto-editor ol li,.editor-content__wrapper.neeto-editor ul li{margin-bottom:.5rem}.editor-content__wrapper.neeto-editor ol li p,.editor-content__wrapper.neeto-editor ul li p{margin-bottom:0}.editor-content__wrapper.neeto-editor ol li:last-child,.editor-content__wrapper.neeto-editor ul li:last-child{margin-bottom:.5rem}.editor-content__wrapper.neeto-editor .neeto-editor-table{margin:8px 0 0}.editor-content__wrapper.neeto-editor .neeto-editor-table table{border-radius:0}.editor-content__wrapper.neeto-editor .neeto-editor-table p{margin-bottom:0}.editor-content__wrapper.neeto-editor .neeto-editor-table .neeto-editor-table__add-column,.editor-content__wrapper.neeto-editor .neeto-editor-table .neeto-editor-table__add-row{visibility:hidden}.editor-content__wrapper.neeto-editor .neeto-editor-table:hover .neeto-editor-table__add-column,.editor-content__wrapper.neeto-editor .neeto-editor-table:hover .neeto-editor-table__add-row{visibility:visible}ins{background-color:#c1f4cb!important;text-decoration:none!important}del{background-color:#faa!important}";
22
+ var css = ".neeto-molecules-document__wrapper{height:100%}@media screen and (max-width:768px){.neeto-molecules-document__wrapper{width:100%}}.neeto-molecules-document__wrapper .neeto-molecules-document__container{margin:0 auto;max-width:768px!important;width:100%}.neeto-molecules-document__wrapper .neeto-molecules-document-editor__menubar{position:sticky;top:0;width:100%;z-index:20}.neeto-molecules-document__wrapper .neeto-molecules-document__title{margin:24px 0 0;width:100%}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input{padding:0!important}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea{color:rgb(var(--neeto-ui-black));font-size:42px;font-weight:700;line-height:48px;max-height:none;resize:none}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea::-moz-placeholder{color:rgb(var(--neeto-ui-gray-300))}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea::placeholder{color:rgb(var(--neeto-ui-gray-300))}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea{font-size:36px}}.neeto-molecules-document__wrapper .neeto-molecules-editor-content__error{margin:12px auto}.neeto-molecules-document__wrapper .ProseMirror{flex-grow:1;height:auto;max-height:none;overflow-y:hidden}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu{border:thin solid rgb(var(--neeto-ui-gray-200));border-left:none;border-right:none}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-editor-fixed-menu button.neeto-editor-fixed-menu__item{padding:6px}}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{margin:0 auto;max-width:750px;padding-left:0!important;padding-right:0!important}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper button.neeto-editor-fixed-menu__item{flex-shrink:0}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{overflow-x:auto}}.neeto-molecules-document__wrapper .editor-content__wrapper{border:none!important;padding:12px 16px 0!important;width:100%!important}.neeto-molecules-document__wrapper .editor-content-attachments{border:none;margin:12px auto 0;max-width:768px!important;padding-left:16px;padding-right:16px}.neeto-molecules-document__wrapper .editor-content-attachments--no-attachments{display:none!important}.neeto-molecules-document__wrapper .neeto-editor-character-count{margin:0 auto;max-width:768px!important;padding-left:16px;padding-right:16px}.neeto-molecules-document__wrapper .ne-attachments__wrapper{width:100%}.neeto-molecules-document__wrapper ins{background-color:#c1f4cb!important;text-decoration:none!important}.neeto-molecules-document__wrapper del{background-color:#faa!important}";
23
23
  n(css,{});
24
24
 
25
25
  var useEditor = function useEditor(_ref) {
@@ -6,7 +6,7 @@ import { joinHyphenCase } from '@bigbinary/neeto-commons-frontend/utils/general'
6
6
  import Braces from '@bigbinary/neeto-icons/Braces';
7
7
  import Dropdown from '@bigbinary/neetoui/Dropdown';
8
8
  import Typography from '@bigbinary/neetoui/Typography';
9
- import { assoc, uniqBy, prop, isEmpty } from 'ramda';
9
+ import { mergeLeft, uniqBy, prop, isEmpty } from 'ramda';
10
10
  import { n } from './inject-css-DmrvuTKK.js';
11
11
  import { jsx, jsxs } from 'react/jsx-runtime';
12
12
 
@@ -23,7 +23,10 @@ var parseVariables = function parseVariables() {
23
23
  label = variable.label,
24
24
  variables = variable.variables;
25
25
  if (category && variables) {
26
- var parsedVariables = variables.map(assoc("category", category));
26
+ var parsedVariables = variables.map(mergeLeft({
27
+ category: category,
28
+ categoryLabel: label
29
+ }));
27
30
  if (!categorySet.has(category)) {
28
31
  categorySet.add(category);
29
32
  groupedVariables.push({
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicVariables.js","sources":["../src/components/DynamicVariables/utils.js","../src/components/DynamicVariables/index.jsx"],"sourcesContent":["import { findBy } from \"neetocist\";\nimport { prop, assoc, isEmpty, uniqBy } from \"ramda\";\n\nexport const parseVariables = (variableArr = []) => {\n const uncategorized = [];\n const groupedVariables = [];\n const categorySet = new Set();\n\n variableArr.forEach(variable => {\n const { category, label, variables } = variable;\n if (category && variables) {\n const parsedVariables = variables.map(assoc(\"category\", category));\n\n if (!categorySet.has(category)) {\n categorySet.add(category);\n groupedVariables.push({ label, variables: parsedVariables });\n } else {\n const existingGroup = findBy({ label }, groupedVariables);\n\n existingGroup.variables = uniqBy(\n prop(\"key\"),\n existingGroup.variables.concat(parsedVariables)\n );\n }\n } else {\n uncategorized.push(variable);\n }\n });\n\n if (!isEmpty(uncategorized)) {\n groupedVariables.push({\n label: !isEmpty(groupedVariables) ? \"Others\" : null,\n variables: uncategorized,\n });\n }\n\n return groupedVariables;\n};\n","import { Fragment } from \"react\";\n\nimport { noop } from \"neetocist\";\nimport { joinHyphenCase } from \"neetocommons/utils/general\";\nimport { Braces } from \"neetoicons\";\nimport { Dropdown, Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { isEmpty } from \"ramda\";\n\nimport \"./dynamic-variables.scss\";\nimport { parseVariables } from \"./utils\";\n\nconst { Menu } = Dropdown;\n\nconst DynamicVariables = ({\n onVariableClick = noop,\n variables = [],\n buttonProps,\n ...dropdownProps\n}) => {\n if (isEmpty(variables)) {\n return null;\n }\n\n const parsedVariables = parseVariables(variables);\n\n return (\n <Dropdown\n appendTo={() => document.body}\n buttonStyle=\"secondary\"\n icon={Braces}\n strategy=\"fixed\"\n zIndex={99999}\n buttonProps={{\n \"data-testid\": \"variables-dropdown\",\n \"data-cy\": \"dynamic-variables-button\",\n ...buttonProps,\n }}\n {...dropdownProps}\n >\n <Menu>\n <div\n className=\"neeto-molecules-dynamic-variables\"\n data-testid=\"variables-list\"\n >\n {parsedVariables.map(({ label, variables }) => (\n <Fragment key={label}>\n {label && <Typography style=\"h6\">{label}</Typography>}\n <div\n className=\"neeto-molecules-dynamic-variables__list\"\n data-cy=\"dynamic-variables-list\"\n >\n {variables.map(item => (\n <button\n key={item.label}\n data-cy={joinHyphenCase(\n \"dynamic-variables-list-item\",\n item.label\n )}\n onClick={() => onVariableClick(item)}\n >\n {item.label}\n </button>\n ))}\n </div>\n </Fragment>\n ))}\n </div>\n </Menu>\n </Dropdown>\n );\n};\n\nDynamicVariables.propTypes = {\n /**\n * A function that is triggered when a dynamic variable button is clicked. It receives an object containing information about the clicked variable.\n */\n onVariableClick: PropTypes.func,\n /**\n * An array of objects, each representing a category or standalone variable, with the ability to define a label, key, and default value for each variable.\n */\n variables: PropTypes.arrayOf(\n PropTypes.shape({ label: PropTypes.string, key: PropTypes.string })\n ),\n};\n\nexport default DynamicVariables;\n"],"names":["parseVariables","variableArr","arguments","length","undefined","uncategorized","groupedVariables","categorySet","Set","forEach","variable","category","label","variables","parsedVariables","map","assoc","has","add","push","existingGroup","findBy","uniqBy","prop","concat","isEmpty","Menu","Dropdown","DynamicVariables","_ref","_ref$onVariableClick","onVariableClick","noop","_ref$variables","buttonProps","dropdownProps","_objectWithoutProperties","_excluded","_jsx","_objectSpread","appendTo","document","body","buttonStyle","icon","Braces","strategy","zIndex","children","className","_ref2","_jsxs","Fragment","Typography","style","item","joinHyphenCase","onClick"],"mappings":";;;;;;;;;;;;;;;AAGO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,GAAyB;AAAA,EAAA,IAArBC,WAAW,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,S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AA,WAAA,EAlBOA,KAmBL,CAAC,CAAA;SACZ,CAAA;OACE,CAAA;KACD,CAAA;AAAC,GAAA,CACC,CAAC,CAAA;AAEf;;;;"}
1
+ {"version":3,"file":"DynamicVariables.js","sources":["../src/components/DynamicVariables/utils.js","../src/components/DynamicVariables/index.jsx"],"sourcesContent":["import { findBy } from \"neetocist\";\nimport { prop, isEmpty, uniqBy, mergeLeft } from \"ramda\";\n\nexport const parseVariables = (variableArr = []) => {\n const uncategorized = [];\n const groupedVariables = [];\n const categorySet = new Set();\n\n variableArr.forEach(variable => {\n const { category, label, variables } = variable;\n if (category && variables) {\n const parsedVariables = variables.map(\n mergeLeft({ category, categoryLabel: label })\n );\n\n if (!categorySet.has(category)) {\n categorySet.add(category);\n groupedVariables.push({ label, variables: parsedVariables });\n } else {\n const existingGroup = findBy({ label }, groupedVariables);\n\n existingGroup.variables = uniqBy(\n prop(\"key\"),\n existingGroup.variables.concat(parsedVariables)\n );\n }\n } else {\n uncategorized.push(variable);\n }\n });\n\n if (!isEmpty(uncategorized)) {\n groupedVariables.push({\n label: !isEmpty(groupedVariables) ? \"Others\" : null,\n variables: uncategorized,\n });\n }\n\n return groupedVariables;\n};\n","import { Fragment } from \"react\";\n\nimport { noop } from \"neetocist\";\nimport { joinHyphenCase } from \"neetocommons/utils/general\";\nimport { Braces } from \"neetoicons\";\nimport { Dropdown, Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { isEmpty } from \"ramda\";\n\nimport \"./dynamic-variables.scss\";\nimport { parseVariables } from \"./utils\";\n\nconst { Menu } = Dropdown;\n\nconst DynamicVariables = ({\n onVariableClick = noop,\n variables = [],\n buttonProps,\n ...dropdownProps\n}) => {\n if (isEmpty(variables)) {\n return null;\n }\n\n const parsedVariables = parseVariables(variables);\n\n return (\n <Dropdown\n appendTo={() => document.body}\n buttonStyle=\"secondary\"\n icon={Braces}\n strategy=\"fixed\"\n zIndex={99999}\n buttonProps={{\n \"data-testid\": \"variables-dropdown\",\n \"data-cy\": \"dynamic-variables-button\",\n ...buttonProps,\n }}\n {...dropdownProps}\n >\n <Menu>\n <div\n className=\"neeto-molecules-dynamic-variables\"\n data-testid=\"variables-list\"\n >\n {parsedVariables.map(({ label, variables }) => (\n <Fragment key={label}>\n {label && <Typography style=\"h6\">{label}</Typography>}\n <div\n className=\"neeto-molecules-dynamic-variables__list\"\n data-cy=\"dynamic-variables-list\"\n >\n {variables.map(item => (\n <button\n key={item.label}\n data-cy={joinHyphenCase(\n \"dynamic-variables-list-item\",\n item.label\n )}\n onClick={() => onVariableClick(item)}\n >\n {item.label}\n </button>\n ))}\n </div>\n </Fragment>\n ))}\n </div>\n </Menu>\n </Dropdown>\n );\n};\n\nDynamicVariables.propTypes = {\n /**\n * A function that is triggered when a dynamic variable button is clicked. It receives an object containing information about the clicked variable.\n */\n onVariableClick: PropTypes.func,\n /**\n * An array of objects, each representing a category or standalone variable, with the ability to define a label, key, and default value for each variable.\n */\n variables: PropTypes.arrayOf(\n PropTypes.shape({ label: PropTypes.string, key: PropTypes.string })\n ),\n};\n\nexport default DynamicVariables;\n"],"names":["parseVariables","variableArr","arguments","length","undefined","uncategorized","groupedVariables","categorySet","Set","forEach","variable","category","label","variables","parsedVariables","map","mergeLeft","categoryLabel","has","add","push","existingGroup","findBy","uniqBy","prop","concat","isEmpty","Menu","Dropdown","DynamicVariables","_ref","_ref$onVariableClick","onVariableClick","noop","_ref$variables","buttonProps","dropdownProps","_objectWithoutProperties","_excluded","_jsx","_objectSpread","appendTo","document","body","buttonStyle","icon","Braces","strategy","zIndex","children","className","_ref2","_jsxs","Fragment","Typography","style","item","joinHyphenCase","onClick"],"mappings":";;;;;;;;;;;;;;;AAGO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,GAAyB;AAAA,EAAA,IAArBC,WAAW,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA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AA,EAlBOA,KAmBL,CAAC,CAAA;SACZ,CAAA;OACE,CAAA;KACD,CAAA;AAAC,GAAA,CACC,CAAC,CAAA;AAEf;;;;"}
@@ -21,7 +21,7 @@ var DEFAULT_EDITOR_PROPS = {
21
21
  addons: []
22
22
  };
23
23
 
24
- var css = ".neeto-molecules-document__wrapper{height:100%}@media screen and (max-width:768px){.neeto-molecules-document__wrapper{width:100%}}.neeto-molecules-document__wrapper .neeto-molecules-document__container{margin:0 auto;max-width:768px!important;width:100%}.neeto-molecules-document__wrapper .neeto-molecules-document-editor__menubar{position:sticky;top:0;width:100%;z-index:20}.neeto-molecules-document__wrapper .neeto-molecules-document__title{margin:24px 0 0;width:100%}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input{padding:0!important}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea{color:rgb(var(--neeto-ui-black));font-size:42px;font-weight:700;line-height:48px;max-height:none;resize:none}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea::-moz-placeholder{color:rgb(var(--neeto-ui-gray-300))}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea::placeholder{color:rgb(var(--neeto-ui-gray-300))}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea{font-size:36px}}.neeto-molecules-document__wrapper .neeto-molecules-editor-content__error{margin:12px auto}.neeto-molecules-document__wrapper .ProseMirror{flex-grow:1;height:auto;max-height:none;overflow-y:hidden}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu{border:thin solid rgb(var(--neeto-ui-gray-200));border-left:none;border-right:none}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-editor-fixed-menu button.neeto-editor-fixed-menu__item{padding:6px}}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{margin:0 auto;max-width:750px;padding-left:0!important;padding-right:0!important}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper button.neeto-editor-fixed-menu__item{flex-shrink:0}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{overflow-x:auto}}.neeto-molecules-document__wrapper .editor-content__wrapper{border:none!important;padding:12px 16px 0!important;width:100%!important}.neeto-molecules-document__wrapper .editor-content-attachments{border:none;margin:12px auto 0;max-width:768px!important;padding-left:16px;padding-right:16px}.neeto-molecules-document__wrapper .editor-content-attachments--no-attachments{display:none!important}.neeto-molecules-document__wrapper .neeto-editor-character-count{margin:0 auto;max-width:768px!important;padding-left:16px;padding-right:16px}.neeto-molecules-document__wrapper .ne-attachments__wrapper{width:100%}.editor-content__wrapper.neeto-editor{padding:0 16px}.editor-content__wrapper.neeto-editor h1{font-size:var(--neeto-ui-text-h1);margin:2rem 0 .25rem}.editor-content__wrapper.neeto-editor h2{font-size:var(--neeto-ui-text-h2);margin:1.5rem 0 .25rem}.editor-content__wrapper.neeto-editor h3{font-size:var(--neeto-ui-text-h3);margin:1rem 0 .25rem}.editor-content__wrapper.neeto-editor h4{font-size:var(--neeto-ui-text-h4);margin:.75rem 0 .25rem}.editor-content__wrapper.neeto-editor h5{font-size:var(--neeto-ui-text-h5);margin:.75rem 0 .25rem}.editor-content__wrapper.neeto-editor h6{font-size:var(--neeto-ui-text-h6);margin:.75rem 0 .25rem}.editor-content__wrapper.neeto-editor h1,.editor-content__wrapper.neeto-editor h2,.editor-content__wrapper.neeto-editor h3,.editor-content__wrapper.neeto-editor h4,.editor-content__wrapper.neeto-editor h5,.editor-content__wrapper.neeto-editor h6{font-weight:var(--neeto-ui-font-semibold)}.editor-content__wrapper.neeto-editor p{font-size:var(--neeto-ui-text-body1);line-height:var(--neeto-ui-leading-normal)}.editor-content__wrapper.neeto-editor ol,.editor-content__wrapper.neeto-editor ul{margin-bottom:1rem;padding-left:24px}.editor-content__wrapper.neeto-editor ol li,.editor-content__wrapper.neeto-editor ul li{margin-bottom:.5rem}.editor-content__wrapper.neeto-editor ol li p,.editor-content__wrapper.neeto-editor ul li p{margin-bottom:0}.editor-content__wrapper.neeto-editor ol li:last-child,.editor-content__wrapper.neeto-editor ul li:last-child{margin-bottom:.5rem}.editor-content__wrapper.neeto-editor .neeto-editor-table{margin:8px 0 0}.editor-content__wrapper.neeto-editor .neeto-editor-table table{border-radius:0}.editor-content__wrapper.neeto-editor .neeto-editor-table p{margin-bottom:0}.editor-content__wrapper.neeto-editor .neeto-editor-table .neeto-editor-table__add-column,.editor-content__wrapper.neeto-editor .neeto-editor-table .neeto-editor-table__add-row{visibility:hidden}.editor-content__wrapper.neeto-editor .neeto-editor-table:hover .neeto-editor-table__add-column,.editor-content__wrapper.neeto-editor .neeto-editor-table:hover .neeto-editor-table__add-row{visibility:visible}ins{background-color:#c1f4cb!important;text-decoration:none!important}del{background-color:#faa!important}";
24
+ var css = ".neeto-molecules-document__wrapper{height:100%}@media screen and (max-width:768px){.neeto-molecules-document__wrapper{width:100%}}.neeto-molecules-document__wrapper .neeto-molecules-document__container{margin:0 auto;max-width:768px!important;width:100%}.neeto-molecules-document__wrapper .neeto-molecules-document-editor__menubar{position:sticky;top:0;width:100%;z-index:20}.neeto-molecules-document__wrapper .neeto-molecules-document__title{margin:24px 0 0;width:100%}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input{padding:0!important}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea{color:rgb(var(--neeto-ui-black));font-size:42px;font-weight:700;line-height:48px;max-height:none;resize:none}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea::-moz-placeholder{color:rgb(var(--neeto-ui-gray-300))}.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea::placeholder{color:rgb(var(--neeto-ui-gray-300))}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-molecules-document__title .neeto-ui-input textarea{font-size:36px}}.neeto-molecules-document__wrapper .neeto-molecules-editor-content__error{margin:12px auto}.neeto-molecules-document__wrapper .ProseMirror{flex-grow:1;height:auto;max-height:none;overflow-y:hidden}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu{border:thin solid rgb(var(--neeto-ui-gray-200));border-left:none;border-right:none}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-editor-fixed-menu button.neeto-editor-fixed-menu__item{padding:6px}}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{margin:0 auto;max-width:750px;padding-left:0!important;padding-right:0!important}.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper button.neeto-editor-fixed-menu__item{flex-shrink:0}@media screen and (max-width:768px){.neeto-molecules-document__wrapper .neeto-editor-fixed-menu__wrapper{overflow-x:auto}}.neeto-molecules-document__wrapper .editor-content__wrapper{border:none!important;padding:12px 16px 0!important;width:100%!important}.neeto-molecules-document__wrapper .editor-content-attachments{border:none;margin:12px auto 0;max-width:768px!important;padding-left:16px;padding-right:16px}.neeto-molecules-document__wrapper .editor-content-attachments--no-attachments{display:none!important}.neeto-molecules-document__wrapper .neeto-editor-character-count{margin:0 auto;max-width:768px!important;padding-left:16px;padding-right:16px}.neeto-molecules-document__wrapper .ne-attachments__wrapper{width:100%}.neeto-molecules-document__wrapper ins{background-color:#c1f4cb!important;text-decoration:none!important}.neeto-molecules-document__wrapper del{background-color:#faa!important}";
25
25
  injectCss.n(css,{});
26
26
 
27
27
  var useEditor = function useEditor(_ref) {
@@ -25,7 +25,10 @@ var parseVariables = function parseVariables() {
25
25
  label = variable.label,
26
26
  variables = variable.variables;
27
27
  if (category && variables) {
28
- var parsedVariables = variables.map(ramda.assoc("category", category));
28
+ var parsedVariables = variables.map(ramda.mergeLeft({
29
+ category: category,
30
+ categoryLabel: label
31
+ }));
29
32
  if (!categorySet.has(category)) {
30
33
  categorySet.add(category);
31
34
  groupedVariables.push({
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicVariables.js","sources":["../../src/components/DynamicVariables/utils.js","../../src/components/DynamicVariables/index.jsx"],"sourcesContent":["import { findBy } from \"neetocist\";\nimport { prop, assoc, isEmpty, uniqBy } from \"ramda\";\n\nexport const parseVariables = (variableArr = []) => {\n const uncategorized = [];\n const groupedVariables = [];\n const categorySet = new Set();\n\n variableArr.forEach(variable => {\n const { category, label, variables } = variable;\n if (category && variables) {\n const parsedVariables = variables.map(assoc(\"category\", category));\n\n if (!categorySet.has(category)) {\n categorySet.add(category);\n groupedVariables.push({ label, variables: parsedVariables });\n } else {\n const existingGroup = findBy({ label }, groupedVariables);\n\n existingGroup.variables = uniqBy(\n prop(\"key\"),\n existingGroup.variables.concat(parsedVariables)\n );\n }\n } else {\n uncategorized.push(variable);\n }\n });\n\n if (!isEmpty(uncategorized)) {\n groupedVariables.push({\n label: !isEmpty(groupedVariables) ? \"Others\" : null,\n variables: uncategorized,\n });\n }\n\n return groupedVariables;\n};\n","import { Fragment } from \"react\";\n\nimport { noop } from \"neetocist\";\nimport { joinHyphenCase } from \"neetocommons/utils/general\";\nimport { Braces } from \"neetoicons\";\nimport { Dropdown, Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { isEmpty } from \"ramda\";\n\nimport \"./dynamic-variables.scss\";\nimport { parseVariables } from \"./utils\";\n\nconst { Menu } = Dropdown;\n\nconst DynamicVariables = ({\n onVariableClick = noop,\n variables = [],\n buttonProps,\n ...dropdownProps\n}) => {\n if (isEmpty(variables)) {\n return null;\n }\n\n const parsedVariables = parseVariables(variables);\n\n return (\n <Dropdown\n appendTo={() => document.body}\n buttonStyle=\"secondary\"\n icon={Braces}\n strategy=\"fixed\"\n zIndex={99999}\n buttonProps={{\n \"data-testid\": \"variables-dropdown\",\n \"data-cy\": \"dynamic-variables-button\",\n ...buttonProps,\n }}\n {...dropdownProps}\n >\n <Menu>\n <div\n className=\"neeto-molecules-dynamic-variables\"\n data-testid=\"variables-list\"\n >\n {parsedVariables.map(({ label, variables }) => (\n <Fragment key={label}>\n {label && <Typography style=\"h6\">{label}</Typography>}\n <div\n className=\"neeto-molecules-dynamic-variables__list\"\n data-cy=\"dynamic-variables-list\"\n >\n {variables.map(item => (\n <button\n key={item.label}\n data-cy={joinHyphenCase(\n \"dynamic-variables-list-item\",\n item.label\n )}\n onClick={() => onVariableClick(item)}\n >\n {item.label}\n </button>\n ))}\n </div>\n </Fragment>\n ))}\n </div>\n </Menu>\n </Dropdown>\n );\n};\n\nDynamicVariables.propTypes = {\n /**\n * A function that is triggered when a dynamic variable button is clicked. It receives an object containing information about the clicked variable.\n */\n onVariableClick: PropTypes.func,\n /**\n * An array of objects, each representing a category or standalone variable, with the ability to define a label, key, and default value for each variable.\n */\n variables: PropTypes.arrayOf(\n PropTypes.shape({ label: PropTypes.string, key: PropTypes.string })\n ),\n};\n\nexport default DynamicVariables;\n"],"names":["parseVariables","variableArr","arguments","length","undefined","uncategorized","groupedVariables","categorySet","Set","forEach","variable","category","label","variables","parsedVariables","map","assoc","has","add","push","existingGroup","findBy","uniqBy","prop","concat","isEmpty","Menu","Dropdown","DynamicVariables","_ref","_ref$onVariableClick","onVariableClick","noop","_ref$variables","buttonProps","dropdownProps","_objectWithoutProperties","_excluded","_jsx","_objectSpread","appendTo","document","body","buttonStyle","icon","Braces","strategy","zIndex","children","className","_ref2","_jsxs","Fragment","Typography","style","item","joinHyphenCase","onClick"],"mappings":";;;;;;;;;;;;;;;;;AAGO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,GAAyB;AAAA,EAAA,IAArBC,WAAW,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA;EAC7C,IAAMG,aAAa,GAAG,EAAE,CAAA;EACxB,IAAMC,gBAAgB,GAAG,EAAE,CAAA;AAC3B,EAAA,IAAMC,WAAW,GAAG,IAAIC,GAAG,EAAE,CAAA;AAE7BP,EAAAA,WAAW,CAACQ,OAAO,CAAC,UAAAC,QAAQ,EAAI;AAC9B,IAAA,IAAQC,QAAQ,GAAuBD,QA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Y,gBAAgB;AAAAD,QAAAA,QAAA,EAE3BlC,eAAe,CAACC,GAAG,CAAC,UAAAmC,KAAA,EAAA;AAAA,UAAA,IAAGtC,KAAK,GAAAsC,KAAA,CAALtC,KAAK;YAAEC,SAAS,GAAAqC,KAAA,CAATrC,SAAS,CAAA;UAAA,oBACtCsC,eAAA,CAACC,cAAQ,EAAA;AAAAJ,YAAAA,QAAA,EACNpC,CAAAA,KAAK,iBAAI0B,cAAA,CAACe,UAAU,EAAA;AAACC,cAAAA,KAAK,EAAC,IAAI;AAAAN,cAAAA,QAAA,EAAEpC,KAAAA;aAAkB,CAAC,eACrD0B,cAAA,CAAA,KAAA,EAAA;AACEW,cAAAA,SAAS,EAAC,yCAAyC;AACnD,cAAA,SAAA,EAAQ,wBAAwB;AAAAD,cAAAA,QAAA,EAE/BnC,SAAS,CAACE,GAAG,CAAC,UAAAwC,IAAI,EAAA;AAAA,gBAAA,oBACjBjB,cAAA,CAAA,QAAA,EAAA;AAEE,kBAAA,SAAA,EAASkB,sBAAc,CACrB,6BAA6B,EAC7BD,IAAI,CAAC3C,KACP,CAAE;kBACF6C,OAAO,EAAE,SAATA,OAAOA,GAAA;oBAAA,OAAQ1B,eAAe,CAACwB,IAAI,CAAC,CAAA;mBAAC;kBAAAP,QAAA,EAEpCO,IAAI,CAAC3C,KAAAA;iBAPD2C,EAAAA,IAAI,CAAC3C,KAQJ,CAAC,CAAA;eACV,CAAA;AAAC,aACC,CAAC,CAAA;AAAA,WAAA,EAlBOA,KAmBL,CAAC,CAAA;SACZ,CAAA;OACE,CAAA;KACD,CAAA;AAAC,GAAA,CACC,CAAC,CAAA;AAEf;;;;"}
1
+ {"version":3,"file":"DynamicVariables.js","sources":["../../src/components/DynamicVariables/utils.js","../../src/components/DynamicVariables/index.jsx"],"sourcesContent":["import { findBy } from \"neetocist\";\nimport { prop, isEmpty, uniqBy, mergeLeft } from \"ramda\";\n\nexport const parseVariables = (variableArr = []) => {\n const uncategorized = [];\n const groupedVariables = [];\n const categorySet = new Set();\n\n variableArr.forEach(variable => {\n const { category, label, variables } = variable;\n if (category && variables) {\n const parsedVariables = variables.map(\n mergeLeft({ category, categoryLabel: label })\n );\n\n if (!categorySet.has(category)) {\n categorySet.add(category);\n groupedVariables.push({ label, variables: parsedVariables });\n } else {\n const existingGroup = findBy({ label }, groupedVariables);\n\n existingGroup.variables = uniqBy(\n prop(\"key\"),\n existingGroup.variables.concat(parsedVariables)\n );\n }\n } else {\n uncategorized.push(variable);\n }\n });\n\n if (!isEmpty(uncategorized)) {\n groupedVariables.push({\n label: !isEmpty(groupedVariables) ? \"Others\" : null,\n variables: uncategorized,\n });\n }\n\n return groupedVariables;\n};\n","import { Fragment } from \"react\";\n\nimport { noop } from \"neetocist\";\nimport { joinHyphenCase } from \"neetocommons/utils/general\";\nimport { Braces } from \"neetoicons\";\nimport { Dropdown, Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { isEmpty } from \"ramda\";\n\nimport \"./dynamic-variables.scss\";\nimport { parseVariables } from \"./utils\";\n\nconst { Menu } = Dropdown;\n\nconst DynamicVariables = ({\n onVariableClick = noop,\n variables = [],\n buttonProps,\n ...dropdownProps\n}) => {\n if (isEmpty(variables)) {\n return null;\n }\n\n const parsedVariables = parseVariables(variables);\n\n return (\n <Dropdown\n appendTo={() => document.body}\n buttonStyle=\"secondary\"\n icon={Braces}\n strategy=\"fixed\"\n zIndex={99999}\n buttonProps={{\n \"data-testid\": \"variables-dropdown\",\n \"data-cy\": \"dynamic-variables-button\",\n ...buttonProps,\n }}\n {...dropdownProps}\n >\n <Menu>\n <div\n className=\"neeto-molecules-dynamic-variables\"\n data-testid=\"variables-list\"\n >\n {parsedVariables.map(({ label, variables }) => (\n <Fragment key={label}>\n {label && <Typography style=\"h6\">{label}</Typography>}\n <div\n className=\"neeto-molecules-dynamic-variables__list\"\n data-cy=\"dynamic-variables-list\"\n >\n {variables.map(item => (\n <button\n key={item.label}\n data-cy={joinHyphenCase(\n \"dynamic-variables-list-item\",\n item.label\n )}\n onClick={() => onVariableClick(item)}\n >\n {item.label}\n </button>\n ))}\n </div>\n </Fragment>\n ))}\n </div>\n </Menu>\n </Dropdown>\n );\n};\n\nDynamicVariables.propTypes = {\n /**\n * A function that is triggered when a dynamic variable button is clicked. It receives an object containing information about the clicked variable.\n */\n onVariableClick: PropTypes.func,\n /**\n * An array of objects, each representing a category or standalone variable, with the ability to define a label, key, and default value for each variable.\n */\n variables: PropTypes.arrayOf(\n PropTypes.shape({ label: PropTypes.string, key: PropTypes.string })\n ),\n};\n\nexport default DynamicVariables;\n"],"names":["parseVariables","variableArr","arguments","length","undefined","uncategorized","groupedVariables","categorySet","Set","forEach","variable","category","label","variables","parsedVariables","map","mergeLeft","categoryLabel","has","add","push","existingGroup","findBy","uniqBy","prop","concat","isEmpty","Menu","Dropdown","DynamicVariables","_ref","_ref$onVariableClick","onVariableClick","noop","_ref$variables","buttonProps","dropdownProps","_objectWithoutProperties","_excluded","_jsx","_objectSpread","appendTo","document","body","buttonStyle","icon","Braces","strategy","zIndex","children","className","_ref2","_jsxs","Fragment","Typography","style","item","joinHyphenCase","onClick"],"mappings":";;;;;;;;;;;;;;;;;AAGO,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,GAAyB;AAAA,EAAA,IAArBC,WAAW,GAAAC,SAAA,CAAAC,MAAA,GAAA,CAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,KAAAE,SAAA,GAAAF,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE,CAAA;EAC7C,IAAMG,aAAa,GAAG,EAAE,CAAA;EACxB,IAAMC,gBAAgB,GAAG,EAAE,CAAA;AAC3B,EAAA,IAAMC,WAAW,GAAG,IAAIC,GAAG,EAAE,CAAA;AAE7BP,EAAAA,WAAW,CAACQ,OAAO,CAAC,UAAAC,QAAQ,EAAI;AAC9B,IAAA,IAAQC,QAAQ,GAAuBD,QAAQ,CAAvCC,QAAQ;MAAEC,KAAK,GAAgBF,QAAQ,CAA7BE,K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AAY,gBAAgB;AAAAD,QAAAA,QAAA,EAE3BnC,eAAe,CAACC,GAAG,CAAC,UAAAoC,KAAA,EAAA;AAAA,UAAA,IAAGvC,KAAK,GAAAuC,KAAA,CAALvC,KAAK;YAAEC,SAAS,GAAAsC,KAAA,CAATtC,SAAS,CAAA;UAAA,oBACtCuC,eAAA,CAACC,cAAQ,EAAA;AAAAJ,YAAAA,QAAA,EACNrC,CAAAA,KAAK,iBAAI2B,cAAA,CAACe,UAAU,EAAA;AAACC,cAAAA,KAAK,EAAC,IAAI;AAAAN,cAAAA,QAAA,EAAErC,KAAAA;aAAkB,CAAC,eACrD2B,cAAA,CAAA,KAAA,EAAA;AACEW,cAAAA,SAAS,EAAC,yCAAyC;AACnD,cAAA,SAAA,EAAQ,wBAAwB;AAAAD,cAAAA,QAAA,EAE/BpC,SAAS,CAACE,GAAG,CAAC,UAAAyC,IAAI,EAAA;AAAA,gBAAA,oBACjBjB,cAAA,CAAA,QAAA,EAAA;AAEE,kBAAA,SAAA,EAASkB,sBAAc,CACrB,6BAA6B,EAC7BD,IAAI,CAAC5C,KACP,CAAE;kBACF8C,OAAO,EAAE,SAATA,OAAOA,GAAA;oBAAA,OAAQ1B,eAAe,CAACwB,IAAI,CAAC,CAAA;mBAAC;kBAAAP,QAAA,EAEpCO,IAAI,CAAC5C,KAAAA;iBAPD4C,EAAAA,IAAI,CAAC5C,KAQJ,CAAC,CAAA;eACV,CAAA;AAAC,aACC,CAAC,CAAA;AAAA,WAAA,EAlBOA,KAmBL,CAAC,CAAA;SACZ,CAAA;OACE,CAAA;KACD,CAAA;AAAC,GAAA,CACC,CAAC,CAAA;AAEf;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-molecules",
3
- "version": "3.7.30",
3
+ "version": "3.7.32",
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>",
@@ -38,7 +38,9 @@ interface Variable {
38
38
  * @endexample
39
39
  */
40
40
  const DynamicVariables: React.FC<{
41
- onVariableClick?: (variable: Variable) => void;
41
+ onVariableClick?: (variable: Variable & {
42
+ categoryLabel?: string;
43
+ }) => void;
42
44
  variables: Variable[];
43
45
  } & DropdownProps>;
44
46
  export default DynamicVariables;