@bigbinary/neeto-molecules 1.1.44 → 1.1.46
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/README.md +1 -0
- package/dist/CustomDomainDashboard.js +23 -10
- package/dist/CustomDomainDashboard.js.map +1 -1
- package/dist/Header.js +57 -3
- package/dist/Header.js.map +1 -1
- package/dist/InlineInput.js +142 -97
- package/dist/InlineInput.js.map +1 -1
- package/dist/Security.js +57 -44
- package/dist/Security.js.map +1 -1
- package/dist/Taxonomy.js +57 -44
- package/dist/Taxonomy.js.map +1 -1
- package/package.json +1 -1
- package/types/InlineInput.d.ts +44 -11
package/dist/Header.js
CHANGED
|
@@ -21,6 +21,47 @@ function _extends() {
|
|
|
21
21
|
return _extends.apply(this, arguments);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
function _typeof(obj) {
|
|
25
|
+
"@babel/helpers - typeof";
|
|
26
|
+
|
|
27
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
28
|
+
return typeof obj;
|
|
29
|
+
} : function (obj) {
|
|
30
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
31
|
+
}, _typeof(obj);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function _toPrimitive(input, hint) {
|
|
35
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
36
|
+
var prim = input[Symbol.toPrimitive];
|
|
37
|
+
if (prim !== undefined) {
|
|
38
|
+
var res = prim.call(input, hint || "default");
|
|
39
|
+
if (_typeof(res) !== "object") return res;
|
|
40
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
41
|
+
}
|
|
42
|
+
return (hint === "string" ? String : Number)(input);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function _toPropertyKey(arg) {
|
|
46
|
+
var key = _toPrimitive(arg, "string");
|
|
47
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function _defineProperty(obj, key, value) {
|
|
51
|
+
key = _toPropertyKey(key);
|
|
52
|
+
if (key in obj) {
|
|
53
|
+
Object.defineProperty(obj, key, {
|
|
54
|
+
value: value,
|
|
55
|
+
enumerable: true,
|
|
56
|
+
configurable: true,
|
|
57
|
+
writable: true
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
obj[key] = value;
|
|
61
|
+
}
|
|
62
|
+
return obj;
|
|
63
|
+
}
|
|
64
|
+
|
|
24
65
|
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
25
66
|
|
|
26
67
|
var css = ":root{--neeto-molecules-main-header-height:98px;--neeto-molecules-main-header-with-breadcrumbs-height:170px}.neeto-molecules-header{align-items:flex-start!important;background:rgb(var(--neeto-ui-white));display:flex;flex-direction:row;justify-content:space-between;min-height:98px;min-height:var(--neeto-molecules-main-header-height);padding:40px 0 24px!important;width:100%}.neeto-molecules-header .neeto-molecules-header__toggle-menubar-btn{margin-right:8px}.neeto-molecules-header .neeto-molecules-header__left{align-items:flex-start!important;display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-start}.neeto-molecules-header .neeto-molecules-header__left-data-wrap{display:flex;flex-wrap:wrap}.neeto-molecules-header .neeto-molecules-header__page-title{align-items:center;display:flex;flex-direction:row;gap:12px;margin-top:-16px;width:100%}.neeto-molecules-header .neeto-molecules-header__page-title h2{font-size:40px;line-height:var(--neeto-ui-leading-tight)}.neeto-molecules-header .neeto-molecules-header__breadcrumbs-wrap{display:flex;margin:0 0 40px}.neeto-molecules-header .neeto-molecules-header__breadcrumb{align-items:center;display:flex;flex-direction:row;justify-content:flex-start;line-height:1}.neeto-molecules-header .neeto-molecules-header__breadcrumb a{text-decoration:none;transition:all .3s ease-in-out}.neeto-molecules-header .neeto-molecules-header__breadcrumb a:focus-visible{border-radius:var(--neeto-ui-rounded-sm);outline:3px solid rgba(var(--neeto-ui-primary-500),50%)}.neeto-molecules-header .neeto-molecules-header__breadcrumb-separator{font-size:12px;line-height:16px;margin:0 12px!important}.neeto-molecules-header .neeto-molecules-header__right{align-items:center;display:flex;flex-direction:row;justify-content:flex-end}.neeto-molecules-header--has-breadcrumbs{min-height:170px;min-height:var(--neeto-molecules-main-header-with-breadcrumbs-height)}.neeto-molecules-header--has-breadcrumbs .neeto-molecules-header__page-title{margin-top:0}.neeto-molecules-header--nano,.neeto-molecules-header--small{flex-shrink:0;min-height:0}.neeto-molecules-header--nano .neeto-molecules-header__breadcrumbs-wrap,.neeto-molecules-header--small .neeto-molecules-header__breadcrumbs-wrap{margin:0 0 16px}.neeto-molecules-header--small .neeto-molecules-header__page-title{margin-top:-4px}.neeto-molecules-header--small .neeto-molecules-header__page-title h2{font-size:32px}.neeto-molecules-header--nano .neeto-molecules-header__page-title{margin-top:0}.neeto-molecules-header--nano .neeto-molecules-header__page-title h2{font-size:24px}";
|
|
@@ -59,15 +100,24 @@ var SIZES = {
|
|
|
59
100
|
small: "small",
|
|
60
101
|
large: "large"
|
|
61
102
|
};
|
|
103
|
+
var DROPDOWN_BUTTON_SIZES = {
|
|
104
|
+
nano: "small",
|
|
105
|
+
small: "medium",
|
|
106
|
+
large: "large"
|
|
107
|
+
};
|
|
62
108
|
|
|
63
109
|
var Dropdown = function Dropdown(props) {
|
|
64
110
|
return /*#__PURE__*/React.createElement(Dropdown$1, _extends({
|
|
65
|
-
|
|
111
|
+
buttonSize: DROPDOWN_BUTTON_SIZES[props.size],
|
|
112
|
+
buttonStyle: "secondary",
|
|
66
113
|
icon: MenuHorizontal,
|
|
67
|
-
position: "bottom-
|
|
114
|
+
position: "bottom-start",
|
|
115
|
+
strategy: "fixed"
|
|
68
116
|
}, props));
|
|
69
117
|
};
|
|
70
118
|
|
|
119
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
120
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
71
121
|
var Header = function Header(_ref) {
|
|
72
122
|
var title = _ref.title,
|
|
73
123
|
searchProps = _ref.searchProps,
|
|
@@ -104,7 +154,11 @@ var Header = function Header(_ref) {
|
|
|
104
154
|
lineHeight: "tight",
|
|
105
155
|
style: "h2",
|
|
106
156
|
weight: "semibold"
|
|
107
|
-
}, title), renderDropdown(
|
|
157
|
+
}, title), renderDropdown(function (props) {
|
|
158
|
+
return /*#__PURE__*/React.createElement(Dropdown, _objectSpread({
|
|
159
|
+
size: size
|
|
160
|
+
}, props));
|
|
161
|
+
})))), /*#__PURE__*/React.createElement("div", {
|
|
108
162
|
className: "neeto-ui-gap-3 neeto-molecules-header__right"
|
|
109
163
|
}, searchProps && /*#__PURE__*/React.createElement(Search, _extends({
|
|
110
164
|
className: classnames(["neeto-molecules-header__search-input", searchProps.className])
|
package/dist/Header.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.js","sources":["../node_modules/@babel/runtime/helpers/esm/extends.js","../node_modules/rollup-plugin-styles/dist/runtime/inject-css.js","../src/components/Header/Breadcrumbs.jsx","../src/components/Header/constants.js","../src/components/Header/Dropdown.jsx","../src/components/Header/index.jsx"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","var e=[],t=[];function n(n,r){if(n&&\"undefined\"!=typeof document){var a,s=!0===r.prepend?\"prepend\":\"append\",d=!0===r.singleTag,i=\"string\"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName(\"head\")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c()}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n))}function c(){var e=document.createElement(\"style\");if(e.setAttribute(\"type\",\"text/css\"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a=\"prepend\"===s?\"afterbegin\":\"beforeend\";return i.insertAdjacentElement(a,e),e}}export{n as default};\n","import React from \"react\";\n\nimport { Typography } from \"neetoui\";\nimport { Link } from \"react-router-dom\";\n\nimport \"./header.scss\";\n\nconst Breadcrumbs = ({ breadcrumbs }) => (\n <div className=\"neeto-molecules-header__breadcrumbs-wrap\">\n {breadcrumbs.map(({ text, link = \"#\" }, index) => (\n <div\n className=\"neeto-molecules-header__breadcrumb\"\n data-cy=\"header-breadcrumb\"\n key={index}\n >\n <Link to={link}>\n <Typography\n className=\"neeto-ui-text-gray-700 hover:neeto-ui-text-gray-800 neeto-molecules-header__breadcrumb-link\"\n component=\"span\"\n data-cy={text}\n data-test-id={text}\n style=\"body2\"\n weight=\"normal\"\n >\n {text}\n </Typography>\n </Link>\n {index !== breadcrumbs.length - 1 && (\n <span className=\"neeto-molecules-header__breadcrumb-separator neeto-ui-text-black\">\n /\n </span>\n )}\n </div>\n ))}\n </div>\n);\n\nexport default React.memo(Breadcrumbs);\n","const SIZES = { nano: \"nano\", small: \"small\", large: \"large\" };\n\nexport { SIZES };\n","import React from \"react\";\n\nimport { MenuHorizontal } from \"neetoicons\";\nimport { Dropdown as NeetoUIDropdown } from \"neetoui\";\n\nconst Dropdown = props => (\n <NeetoUIDropdown\n buttonStyle=\"text\"\n icon={MenuHorizontal}\n position=\"bottom-end\"\n {...props}\n />\n);\n\nexport default Dropdown;\n","import React from \"react\";\n\nimport classnames from \"classnames\";\nimport { noop, isNotEmpty } from \"neetocist\";\nimport Search from \"neetomolecules/Search\";\nimport { Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\n\nimport Breadcrumbs from \"./Breadcrumbs\";\nimport { SIZES } from \"./constants\";\nimport Dropdown from \"./Dropdown\";\nimport \"./header.scss\";\n\nconst Header = ({\n title,\n searchProps,\n className = \"\",\n actionBlock,\n breadcrumbs = [],\n renderDropdown = noop,\n size = \"large\",\n \"data-testid\": dataTestId = \"neeto-molecules-header\",\n}) => (\n <div\n data-testid={dataTestId}\n className={classnames([\n \"neeto-molecules-header\",\n {\n \"neeto-molecules-header--has-breadcrumbs\": isNotEmpty(breadcrumbs),\n \"neeto-molecules-header--large\": size === SIZES.large,\n \"neeto-molecules-header--small\": size === SIZES.small,\n \"neeto-molecules-header--nano\": size === SIZES.nano,\n },\n className,\n ])}\n >\n <div className=\"neeto-molecules-header__left\">\n <div className=\"neeto-molecules-header__left-data-wrap\">\n {isNotEmpty(breadcrumbs) && <Breadcrumbs {...{ breadcrumbs }} />}\n <div className=\"neeto-molecules-header__page-title\">\n <Typography\n data-cy=\"main-header\"\n data-test-id=\"main-header\"\n lineHeight=\"tight\"\n style=\"h2\"\n weight=\"semibold\"\n >\n {title}\n </Typography>\n {renderDropdown(Dropdown)}\n </div>\n </div>\n </div>\n <div className=\"neeto-ui-gap-3 neeto-molecules-header__right\">\n {searchProps && (\n <Search\n className={classnames([\n \"neeto-molecules-header__search-input\",\n searchProps.className,\n ])}\n {...searchProps}\n />\n )}\n {actionBlock}\n </div>\n </div>\n);\n\nHeader.propTypes = {\n /**\n * To set a title in the Header section.\n */\n title: PropTypes.node,\n /**\n * To specify additional class names.\n */\n className: PropTypes.string,\n /**\n * To specify the content to be rendered in the right side of the Header section.\n */\n\n actionBlock: PropTypes.node,\n /**\n * To add **Search** molecule to the subheader section.\n */\n searchProps: PropTypes.object,\n /**\n * To show breadcrumbs in the Header section. `text` accepts a text string to be shown as the breadcrumb and `link` accepts relative URL path for the breadcrumb.\n */\n breadcrumbs: PropTypes.arrayOf(\n PropTypes.shape({\n text: PropTypes.string,\n link: PropTypes.string,\n })\n ),\n /**\n * A function to render the Dropdown next to the title. It provides the Dropdown component as argument.\n */\n renderDropdown: PropTypes.func,\n /**\n * To specify size of the Header.\n *\n * `large` - Default size. To be used in index pages.\n *\n * `small` - To be used in inner pages.\n *\n * `nano` - To be used in inner pages with menubar.\n */\n size: PropTypes.oneOf([\"nano\", \"small\", \"large\"]),\n};\n\nexport default Header;\n"],"names":["Breadcrumbs","_ref","breadcrumbs","React","createElement","className","map","_ref2","index","text","_ref2$link","link","key","Link","to","Typography","component","style","weight","length","memo","SIZES","nano","small","large","Dropdown","props","NeetoUIDropdown","_extends","buttonStyle","icon","MenuHorizontal","position","Header","title","searchProps","_ref$className","actionBlock","_ref$breadcrumbs","_ref$renderDropdown","renderDropdown","noop","_ref$size","size","_ref$dataTestid","dataTestId","classnames","isNotEmpty","lineHeight","Search"],"mappings":";;;;;;;;AAAe,SAAS,Q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,WAAW,iBACVhC,KAAA,CAAAC,aAAA,CAAC6C,MAAM,EAAArB,QAAA,CAAA;IACLvB,SAAS,EAAEyC,UAAU,CAAC,CACpB,sCAAsC,EACtCX,WAAW,CAAC9B,SAAS,CACtB,CAAA;AAAE,GAAA,EACC8B,WAAW,CAAA,CAElB,EACAE,WAAW,CACR,CACF,CAAA;AAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"Header.js","sources":["../node_modules/@babel/runtime/helpers/esm/extends.js","../node_modules/@babel/runtime/helpers/esm/typeof.js","../node_modules/@babel/runtime/helpers/esm/toPrimitive.js","../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","../node_modules/@babel/runtime/helpers/esm/defineProperty.js","../node_modules/rollup-plugin-styles/dist/runtime/inject-css.js","../src/components/Header/Breadcrumbs.jsx","../src/components/Header/constants.js","../src/components/Header/Dropdown.jsx","../src/components/Header/index.jsx"],"sourcesContent":["export default function _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","var e=[],t=[];function n(n,r){if(n&&\"undefined\"!=typeof document){var a,s=!0===r.prepend?\"prepend\":\"append\",d=!0===r.singleTag,i=\"string\"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName(\"head\")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c()}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n))}function c(){var e=document.createElement(\"style\");if(e.setAttribute(\"type\",\"text/css\"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a=\"prepend\"===s?\"afterbegin\":\"beforeend\";return i.insertAdjacentElement(a,e),e}}export{n as default};\n","import React from \"react\";\n\nimport { Typography } from \"neetoui\";\nimport { Link } from \"react-router-dom\";\n\nimport \"./header.scss\";\n\nconst Breadcrumbs = ({ breadcrumbs }) => (\n <div className=\"neeto-molecules-header__breadcrumbs-wrap\">\n {breadcrumbs.map(({ text, link = \"#\" }, index) => (\n <div\n className=\"neeto-molecules-header__breadcrumb\"\n data-cy=\"header-breadcrumb\"\n key={index}\n >\n <Link to={link}>\n <Typography\n className=\"neeto-ui-text-gray-700 hover:neeto-ui-text-gray-800 neeto-molecules-header__breadcrumb-link\"\n component=\"span\"\n data-cy={text}\n data-test-id={text}\n style=\"body2\"\n weight=\"normal\"\n >\n {text}\n </Typography>\n </Link>\n {index !== breadcrumbs.length - 1 && (\n <span className=\"neeto-molecules-header__breadcrumb-separator neeto-ui-text-black\">\n /\n </span>\n )}\n </div>\n ))}\n </div>\n);\n\nexport default React.memo(Breadcrumbs);\n","const SIZES = { nano: \"nano\", small: \"small\", large: \"large\" };\n\nconst DROPDOWN_BUTTON_SIZES = {\n nano: \"small\",\n small: \"medium\",\n large: \"large\",\n};\n\nexport { SIZES, DROPDOWN_BUTTON_SIZES };\n","import React from \"react\";\n\nimport { MenuHorizontal } from \"neetoicons\";\nimport { Dropdown as NeetoUIDropdown } from \"neetoui\";\n\nimport { DROPDOWN_BUTTON_SIZES } from \"./constants\";\n\nconst Dropdown = props => (\n <NeetoUIDropdown\n buttonSize={DROPDOWN_BUTTON_SIZES[props.size]}\n buttonStyle=\"secondary\"\n icon={MenuHorizontal}\n position=\"bottom-start\"\n strategy=\"fixed\"\n {...props}\n />\n);\n\nexport default Dropdown;\n","import React from \"react\";\n\nimport classnames from \"classnames\";\nimport { noop, isNotEmpty } from \"neetocist\";\nimport Search from \"neetomolecules/Search\";\nimport { Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\n\nimport Breadcrumbs from \"./Breadcrumbs\";\nimport { SIZES } from \"./constants\";\nimport Dropdown from \"./Dropdown\";\nimport \"./header.scss\";\n\nconst Header = ({\n title,\n searchProps,\n className = \"\",\n actionBlock,\n breadcrumbs = [],\n renderDropdown = noop,\n size = \"large\",\n \"data-testid\": dataTestId = \"neeto-molecules-header\",\n}) => (\n <div\n data-testid={dataTestId}\n className={classnames([\n \"neeto-molecules-header\",\n {\n \"neeto-molecules-header--has-breadcrumbs\": isNotEmpty(breadcrumbs),\n \"neeto-molecules-header--large\": size === SIZES.large,\n \"neeto-molecules-header--small\": size === SIZES.small,\n \"neeto-molecules-header--nano\": size === SIZES.nano,\n },\n className,\n ])}\n >\n <div className=\"neeto-molecules-header__left\">\n <div className=\"neeto-molecules-header__left-data-wrap\">\n {isNotEmpty(breadcrumbs) && <Breadcrumbs {...{ breadcrumbs }} />}\n <div className=\"neeto-molecules-header__page-title\">\n <Typography\n data-cy=\"main-header\"\n data-test-id=\"main-header\"\n lineHeight=\"tight\"\n style=\"h2\"\n weight=\"semibold\"\n >\n {title}\n </Typography>\n {renderDropdown(props => (\n <Dropdown {...{ size, ...props }} />\n ))}\n </div>\n </div>\n </div>\n <div className=\"neeto-ui-gap-3 neeto-molecules-header__right\">\n {searchProps && (\n <Search\n className={classnames([\n \"neeto-molecules-header__search-input\",\n searchProps.className,\n ])}\n {...searchProps}\n />\n )}\n {actionBlock}\n </div>\n </div>\n);\n\nHeader.propTypes = {\n /**\n * To set a title in the Header section.\n */\n title: PropTypes.node,\n /**\n * To specify additional class names.\n */\n className: PropTypes.string,\n /**\n * To specify the content to be rendered in the right side of the Header section.\n */\n\n actionBlock: PropTypes.node,\n /**\n * To add **Search** molecule to the subheader section.\n */\n searchProps: PropTypes.object,\n /**\n * To show breadcrumbs in the Header section. `text` accepts a text string to be shown as the breadcrumb and `link` accepts relative URL path for the breadcrumb.\n */\n breadcrumbs: PropTypes.arrayOf(\n PropTypes.shape({\n text: PropTypes.string,\n link: PropTypes.string,\n })\n ),\n /**\n * A function to render the Dropdown next to the title. It provides the Dropdown component as argument.\n */\n renderDropdown: PropTypes.func,\n /**\n * To specify size of the Header.\n *\n * `large` - Default size. To be used in index pages.\n *\n * `small` - To be used in inner pages.\n *\n * `nano` - To be used in inner pages with menubar.\n */\n size: PropTypes.oneOf([\"nano\", \"small\", \"large\"]),\n};\n\nexport default Header;\n"],"names":["toPrimitive","toPropertyKey","Breadcrumbs","_ref","breadcrumbs","React","createElement","className","map","_ref2","index","text","_ref2$link","link","key","Link","to","Typography","component","style","weight","length","memo","SIZES","nano","small","large","DROPDOWN_BUTTON_SIZES","Dropdown","props","NeetoUIDropdown","_extends","buttonSize","size","buttonStyle","icon","MenuHorizontal","position","strategy","Header","title","searchProps","_ref$className","actionBlock","_ref$breadcrumbs","_ref$renderDropdown","renderDropdown","noop","_ref$size","_ref$dataTestid","dataT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AA,CAElB,EACAE,WAAW,CACR,CACF,CAAA;AAAA;;;;"}
|
package/dist/InlineInput.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from 'react';
|
|
2
|
+
import { useField, useFormikContext } from 'formik';
|
|
3
|
+
import { isNotNil, omit } from 'ramda';
|
|
2
4
|
import classnames from 'classnames';
|
|
3
5
|
import { isNotEmpty, noop } from '@bigbinary/neeto-cist';
|
|
4
|
-
import { useStateWithDependency, useHotKeys } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
6
|
+
import { useStateWithDependency, useOnClickOutside, useHotKeys } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
5
7
|
import { Check, Close } from '@bigbinary/neeto-icons';
|
|
6
8
|
import { Input, Button } from '@bigbinary/neetoui';
|
|
7
|
-
import { isNotNil } from 'ramda';
|
|
8
9
|
import { t as t$1 } from 'i18next';
|
|
9
10
|
|
|
10
11
|
function _extends() {
|
|
@@ -22,78 +23,6 @@ function _extends() {
|
|
|
22
23
|
return _extends.apply(this, arguments);
|
|
23
24
|
}
|
|
24
25
|
|
|
25
|
-
function _typeof$1(obj) {
|
|
26
|
-
"@babel/helpers - typeof";
|
|
27
|
-
|
|
28
|
-
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
29
|
-
return typeof obj;
|
|
30
|
-
} : function (obj) {
|
|
31
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
32
|
-
}, _typeof$1(obj);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function _toPrimitive(input, hint) {
|
|
36
|
-
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
37
|
-
var prim = input[Symbol.toPrimitive];
|
|
38
|
-
if (prim !== undefined) {
|
|
39
|
-
var res = prim.call(input, hint || "default");
|
|
40
|
-
if (_typeof$1(res) !== "object") return res;
|
|
41
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
42
|
-
}
|
|
43
|
-
return (hint === "string" ? String : Number)(input);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function _toPropertyKey(arg) {
|
|
47
|
-
var key = _toPrimitive(arg, "string");
|
|
48
|
-
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function _defineProperty(obj, key, value) {
|
|
52
|
-
key = _toPropertyKey(key);
|
|
53
|
-
if (key in obj) {
|
|
54
|
-
Object.defineProperty(obj, key, {
|
|
55
|
-
value: value,
|
|
56
|
-
enumerable: true,
|
|
57
|
-
configurable: true,
|
|
58
|
-
writable: true
|
|
59
|
-
});
|
|
60
|
-
} else {
|
|
61
|
-
obj[key] = value;
|
|
62
|
-
}
|
|
63
|
-
return obj;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
67
|
-
try {
|
|
68
|
-
var info = gen[key](arg);
|
|
69
|
-
var value = info.value;
|
|
70
|
-
} catch (error) {
|
|
71
|
-
reject(error);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (info.done) {
|
|
75
|
-
resolve(value);
|
|
76
|
-
} else {
|
|
77
|
-
Promise.resolve(value).then(_next, _throw);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function _asyncToGenerator(fn) {
|
|
81
|
-
return function () {
|
|
82
|
-
var self = this,
|
|
83
|
-
args = arguments;
|
|
84
|
-
return new Promise(function (resolve, reject) {
|
|
85
|
-
var gen = fn.apply(self, args);
|
|
86
|
-
function _next(value) {
|
|
87
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
88
|
-
}
|
|
89
|
-
function _throw(err) {
|
|
90
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
91
|
-
}
|
|
92
|
-
_next(undefined);
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
26
|
function _arrayWithHoles(arr) {
|
|
98
27
|
if (Array.isArray(arr)) return arr;
|
|
99
28
|
}
|
|
@@ -178,6 +107,78 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
178
107
|
return target;
|
|
179
108
|
}
|
|
180
109
|
|
|
110
|
+
function _typeof$1(obj) {
|
|
111
|
+
"@babel/helpers - typeof";
|
|
112
|
+
|
|
113
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
114
|
+
return typeof obj;
|
|
115
|
+
} : function (obj) {
|
|
116
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
117
|
+
}, _typeof$1(obj);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function _toPrimitive(input, hint) {
|
|
121
|
+
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
122
|
+
var prim = input[Symbol.toPrimitive];
|
|
123
|
+
if (prim !== undefined) {
|
|
124
|
+
var res = prim.call(input, hint || "default");
|
|
125
|
+
if (_typeof$1(res) !== "object") return res;
|
|
126
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
127
|
+
}
|
|
128
|
+
return (hint === "string" ? String : Number)(input);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function _toPropertyKey(arg) {
|
|
132
|
+
var key = _toPrimitive(arg, "string");
|
|
133
|
+
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function _defineProperty(obj, key, value) {
|
|
137
|
+
key = _toPropertyKey(key);
|
|
138
|
+
if (key in obj) {
|
|
139
|
+
Object.defineProperty(obj, key, {
|
|
140
|
+
value: value,
|
|
141
|
+
enumerable: true,
|
|
142
|
+
configurable: true,
|
|
143
|
+
writable: true
|
|
144
|
+
});
|
|
145
|
+
} else {
|
|
146
|
+
obj[key] = value;
|
|
147
|
+
}
|
|
148
|
+
return obj;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
152
|
+
try {
|
|
153
|
+
var info = gen[key](arg);
|
|
154
|
+
var value = info.value;
|
|
155
|
+
} catch (error) {
|
|
156
|
+
reject(error);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (info.done) {
|
|
160
|
+
resolve(value);
|
|
161
|
+
} else {
|
|
162
|
+
Promise.resolve(value).then(_next, _throw);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
function _asyncToGenerator(fn) {
|
|
166
|
+
return function () {
|
|
167
|
+
var self = this,
|
|
168
|
+
args = arguments;
|
|
169
|
+
return new Promise(function (resolve, reject) {
|
|
170
|
+
var gen = fn.apply(self, args);
|
|
171
|
+
function _next(value) {
|
|
172
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
173
|
+
}
|
|
174
|
+
function _throw(err) {
|
|
175
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
176
|
+
}
|
|
177
|
+
_next(undefined);
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
181
182
|
var regeneratorRuntime$1 = {exports: {}};
|
|
182
183
|
|
|
183
184
|
var _typeof = {exports: {}};
|
|
@@ -546,7 +547,7 @@ var mergeRefs = function mergeRefs() {
|
|
|
546
547
|
};
|
|
547
548
|
};
|
|
548
549
|
|
|
549
|
-
var _excluded = ["saveOnBlur", "clearOnSave", "nullable", "value", "isSaving", "className", "handleSubmit", "handleCancel"];
|
|
550
|
+
var _excluded$1 = ["saveOnBlur", "clearOnSave", "nullable", "value", "isSaving", "className", "handleSubmit", "handleCancel", "submitButtonProps", "cancelButtonProps"];
|
|
550
551
|
var InlineInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
551
552
|
var _props$saveOnBlur = props.saveOnBlur,
|
|
552
553
|
saveOnBlur = _props$saveOnBlur === void 0 ? false : _props$saveOnBlur,
|
|
@@ -563,7 +564,11 @@ var InlineInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
563
564
|
handleSubmit = _props$handleSubmit === void 0 ? noop : _props$handleSubmit,
|
|
564
565
|
_props$handleCancel = props.handleCancel,
|
|
565
566
|
handleCancel = _props$handleCancel === void 0 ? noop : _props$handleCancel,
|
|
566
|
-
|
|
567
|
+
_props$submitButtonPr = props.submitButtonProps,
|
|
568
|
+
submitButtonProps = _props$submitButtonPr === void 0 ? {} : _props$submitButtonPr,
|
|
569
|
+
_props$cancelButtonPr = props.cancelButtonProps,
|
|
570
|
+
cancelButtonProps = _props$cancelButtonPr === void 0 ? {} : _props$cancelButtonPr,
|
|
571
|
+
otherProps = _objectWithoutProperties(props, _excluded$1);
|
|
567
572
|
var _useState = useState(false),
|
|
568
573
|
_useState2 = _slicedToArray(_useState, 2),
|
|
569
574
|
isSubmitting = _useState2[0],
|
|
@@ -573,12 +578,18 @@ var InlineInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
573
578
|
inputValue = _useStateWithDependen2[0],
|
|
574
579
|
setInputValue = _useStateWithDependen2[1];
|
|
575
580
|
var inputRef = useRef(null);
|
|
581
|
+
var inputWrapperRef = useRef(null);
|
|
576
582
|
var trimmedValue = inputValue && (inputValue === null || inputValue === void 0 ? void 0 : inputValue.trim());
|
|
577
583
|
var isValidValue = nullable || isNotEmpty(trimmedValue) && isNotNil(trimmedValue);
|
|
578
584
|
var handleFocusOut = function handleFocusOut() {
|
|
579
585
|
if (!isValidValue || isSubmitting) return;
|
|
580
|
-
|
|
586
|
+
if (saveOnBlur) {
|
|
587
|
+
inputValue !== value ? onSubmit() : onCancel();
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
onCancel();
|
|
581
591
|
};
|
|
592
|
+
useOnClickOutside(inputWrapperRef, handleFocusOut);
|
|
582
593
|
var onSubmit = /*#__PURE__*/function () {
|
|
583
594
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
584
595
|
return regenerator.wrap(function _callee$(_context) {
|
|
@@ -600,6 +611,10 @@ var InlineInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
600
611
|
return _ref.apply(this, arguments);
|
|
601
612
|
};
|
|
602
613
|
}();
|
|
614
|
+
var onCancel = function onCancel() {
|
|
615
|
+
handleCancel(inputValue);
|
|
616
|
+
setInputValue(value);
|
|
617
|
+
};
|
|
603
618
|
var closeRef = useHotKeys("escape", function (event) {
|
|
604
619
|
event.stopPropagation();
|
|
605
620
|
handleCancel(inputValue);
|
|
@@ -612,38 +627,32 @@ var InlineInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
612
627
|
mode: "scoped",
|
|
613
628
|
enabled: isValidValue
|
|
614
629
|
});
|
|
630
|
+
var isDirty = inputValue !== value;
|
|
615
631
|
useEffect(function () {
|
|
616
632
|
return inputRef.current && inputRef.current.focus();
|
|
617
633
|
}, [isSubmitting]);
|
|
618
634
|
return /*#__PURE__*/React.createElement("div", {
|
|
619
|
-
className: classnames("flex flex-grow", _defineProperty({}, className, className))
|
|
635
|
+
className: classnames("flex flex-grow", _defineProperty({}, className, className)),
|
|
636
|
+
ref: inputWrapperRef
|
|
620
637
|
}, /*#__PURE__*/React.createElement(Input, _extends({
|
|
621
638
|
className: "neeto-molecules-autosave-input",
|
|
622
639
|
"data-testid": "neeto-molecules-autosave-input",
|
|
623
640
|
disabled: isSubmitting,
|
|
624
641
|
ref: mergeRefs(inputRef, closeRef, submitRef),
|
|
625
|
-
value: inputValue
|
|
626
|
-
onChange: function onChange(e) {
|
|
627
|
-
return setInputValue(e.target.value);
|
|
628
|
-
},
|
|
629
|
-
onBlur: function onBlur(event) {
|
|
630
|
-
var _otherProps$onBlur;
|
|
631
|
-
otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$onBlur = otherProps.onBlur) === null || _otherProps$onBlur === void 0 ? void 0 : _otherProps$onBlur.call(otherProps, event);
|
|
632
|
-
handleFocusOut();
|
|
633
|
-
}
|
|
642
|
+
value: inputValue
|
|
634
643
|
}, otherProps, {
|
|
635
|
-
suffix: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
644
|
+
suffix: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, _extends({
|
|
636
645
|
"data-testid": "neeto-molecules-autosave-input-save",
|
|
637
|
-
disabled: !isValidValue || isSubmitting || isSaving,
|
|
638
646
|
icon: Check,
|
|
639
647
|
loading: isSubmitting || isSaving,
|
|
640
648
|
size: "small",
|
|
641
649
|
style: "text",
|
|
642
650
|
tabIndex: -1,
|
|
643
651
|
tooltipProps: TOOLTIP_PROPS["save"],
|
|
644
|
-
|
|
645
|
-
}
|
|
646
|
-
disabled: isSubmitting || isSaving
|
|
652
|
+
onClick: onSubmit
|
|
653
|
+
}, submitButtonProps, {
|
|
654
|
+
disabled: !isValidValue || isSubmitting || isSaving || submitButtonProps.disabled || !isDirty
|
|
655
|
+
})), /*#__PURE__*/React.createElement(Button, _extends({
|
|
647
656
|
icon: Close,
|
|
648
657
|
ref: ref,
|
|
649
658
|
"data-testid": "neeto-molecules-autosave-input-cancel",
|
|
@@ -651,13 +660,49 @@ var InlineInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
651
660
|
style: "text",
|
|
652
661
|
tabIndex: -1,
|
|
653
662
|
tooltipProps: TOOLTIP_PROPS["cancel"],
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
}))
|
|
663
|
+
onClick: onCancel
|
|
664
|
+
}, cancelButtonProps, {
|
|
665
|
+
disabled: isSubmitting || isSaving || cancelButtonProps.disabled || !isDirty
|
|
666
|
+
}))),
|
|
667
|
+
onChange: function onChange(e) {
|
|
668
|
+
var _otherProps$onChange;
|
|
669
|
+
otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$onChange = otherProps.onChange) === null || _otherProps$onChange === void 0 ? void 0 : _otherProps$onChange.call(otherProps, e);
|
|
670
|
+
setInputValue(e.target.value);
|
|
671
|
+
}
|
|
658
672
|
})));
|
|
659
673
|
});
|
|
660
674
|
InlineInput.displayName = "InlineInput";
|
|
661
675
|
|
|
662
|
-
|
|
676
|
+
var _excluded = ["name"];
|
|
677
|
+
var FormikInlineInput = function FormikInlineInput(_ref) {
|
|
678
|
+
var name = _ref.name,
|
|
679
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
680
|
+
var _useField = useField(name),
|
|
681
|
+
_useField2 = _slicedToArray(_useField, 3),
|
|
682
|
+
field = _useField2[0],
|
|
683
|
+
meta = _useField2[1],
|
|
684
|
+
setValue = _useField2[2].setValue;
|
|
685
|
+
var _useFormikContext = useFormikContext(),
|
|
686
|
+
submitForm = _useFormikContext.submitForm,
|
|
687
|
+
isSubmitting = _useFormikContext.isSubmitting,
|
|
688
|
+
resetForm = _useFormikContext.resetForm;
|
|
689
|
+
return /*#__PURE__*/React.createElement(InlineInput, _extends({
|
|
690
|
+
error: meta.touched ? meta.error : "",
|
|
691
|
+
isSaving: isSubmitting
|
|
692
|
+
}, props, {
|
|
693
|
+
handleCancel: function handleCancel() {
|
|
694
|
+
var _props$handleCancel;
|
|
695
|
+
resetForm();
|
|
696
|
+
(_props$handleCancel = props.handleCancel) === null || _props$handleCancel === void 0 ? void 0 : _props$handleCancel.call(props);
|
|
697
|
+
},
|
|
698
|
+
handleSubmit: function handleSubmit(value) {
|
|
699
|
+
var _props$handleSubmit;
|
|
700
|
+
setValue(value);
|
|
701
|
+
(_props$handleSubmit = props.handleSubmit) === null || _props$handleSubmit === void 0 ? void 0 : _props$handleSubmit.call(props, value);
|
|
702
|
+
return submitForm();
|
|
703
|
+
}
|
|
704
|
+
}, omit(["onChange"], field)));
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
export { FormikInlineInput, InlineInput };
|
|
663
708
|
//# sourceMappingURL=InlineInput.js.map
|