@bigbinary/neeto-molecules 5.8.0-beta1 → 5.9.0

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.
@@ -3,8 +3,8 @@
3
3
  var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
4
4
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
5
5
  var React = require('react');
6
- var neetoAtoms = require('@bigbinary/neeto-atoms');
7
6
  var classnames = require('classnames');
7
+ var neetoAtoms = require('@bigbinary/neeto-atoms');
8
8
  var neetoCist = require('@bigbinary/neeto-cist');
9
9
  var v2_Breadcrumbs = require('./Breadcrumbs.js');
10
10
  var v2_HelpPopover = require('./HelpPopover.js');
@@ -73,7 +73,7 @@ var Header = function Header(_ref) {
73
73
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
74
74
  "data-testid": dataTestId,
75
75
  ref: headerRef,
76
- className: classnames("flex min-h-0 w-full shrink-0 flex-row items-start justify-between gap-4 pt-10 pb-6", "flex-wrap lg:flex-nowrap", className),
76
+ className: classnames("flex min-h-0 w-full shrink-0 flex-col items-stretch justify-between gap-4 pt-10 pb-6", "md:flex-row md:flex-wrap md:items-start lg:flex-nowrap", className),
77
77
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
78
78
  className: "flex flex-wrap",
79
79
  children: [hasBreadcrumbs && /*#__PURE__*/jsxRuntime.jsx(v2_Breadcrumbs, {
@@ -109,7 +109,7 @@ var Header = function Header(_ref) {
109
109
  className: classnames("flex items-center gap-3 empty:hidden", "flex-wrap justify-start md:flex-nowrap md:justify-end"),
110
110
  children: [searchProps && /*#__PURE__*/jsxRuntime.jsx(v2_Search, _objectSpread({
111
111
  enableUrlSync: true,
112
- className: classnames("min-w-[12.6rem] grow-0", searchProps.className)
112
+ className: classnames("w-[12.6rem] shrink-0 grow-0", searchProps.className)
113
113
  }, searchProps)), actionBlock && /*#__PURE__*/jsxRuntime.jsx("div", {
114
114
  className: "flex shrink-0 items-center justify-end gap-3 max-[360px]:shrink max-[360px]:flex-wrap max-[360px]:justify-start",
115
115
  children: actionBlock
@@ -1 +1 @@
1
- {"version":3,"file":"Header.js","sources":["../../../src/v2/components/Header/constants.js","../../../src/v2/components/Header/index.jsx"],"sourcesContent":["const SIZES = { nano: \"nano\", small: \"small\" };\n\nconst DROPDOWN_BUTTON_SIZES = { nano: \"icon-sm\", small: \"icon\" };\n\nexport { SIZES, DROPDOWN_BUTTON_SIZES };\n","import { useLayoutEffect, useRef } from \"react\";\n\nimport { Typography } from \"@bigbinary/neeto-atoms\";\nimport classnames from \"classnames\";\nimport { noop, isNotEmpty, isPresent } from \"neetocist\";\nimport PropTypes from \"prop-types\";\n\nimport { DROPDOWN_BUTTON_SIZES, SIZES } from \"./constants\";\n\nimport Breadcrumbs from \"../Breadcrumbs\";\nimport HelpPopover from \"../HelpPopover\";\nimport MoreDropdown from \"../MoreDropdown\";\nimport Search from \"../Search\";\n\nconst Header = ({\n title,\n titleHelpPopoverProps = {},\n searchProps,\n className = \"\",\n actionBlock,\n breadcrumbs = [],\n renderDropdown = noop,\n size = \"small\",\n \"data-testid\": dataTestId = \"neeto-molecules-header\",\n}) => {\n const headerRef = useRef(null);\n\n useLayoutEffect(() => {\n const updateHeaderHeight = () => {\n if (!headerRef.current) return;\n const height = headerRef.current.offsetHeight;\n document.body.style.setProperty(\"--nv-header-height\", `${height}px`);\n };\n\n updateHeaderHeight();\n\n window.addEventListener(\"resize\", updateHeaderHeight);\n\n return () => {\n window.removeEventListener(\"resize\", updateHeaderHeight);\n document.body.style.removeProperty(\"--nv-header-height\");\n };\n }, []);\n\n const isNano = size === SIZES.nano;\n const hasBreadcrumbs = isNotEmpty(breadcrumbs);\n const TitleTag = isNano ? \"h3\" : \"h1\";\n\n return (\n <div\n data-testid={dataTestId}\n ref={headerRef}\n className={classnames(\n \"flex min-h-0 w-full shrink-0 flex-row items-start justify-between gap-4 pt-10 pb-6\",\n \"flex-wrap lg:flex-nowrap\",\n className\n )}\n >\n <div className=\"flex flex-wrap\">\n {hasBreadcrumbs && <Breadcrumbs {...{ breadcrumbs }} />}\n <div\n className={classnames(\n \"flex w-full flex-row items-center gap-3\",\n hasBreadcrumbs\n ? \"mt-0\"\n : \"-mt-1 max-lg:-mt-2.5 max-md:-mt-2 max-sm:-mt-1\"\n )}\n >\n <Typography asChild variant={isNano ? \"h4\" : \"h2\"} weight=\"semibold\">\n <TitleTag data-testid=\"main-header\">\n {title}\n {isPresent(titleHelpPopoverProps) && (\n <HelpPopover\n className=\"ms-2 inline-flex align-middle\"\n side=\"right\"\n {...titleHelpPopoverProps}\n />\n )}\n {renderDropdown(\n ({ dropdownButtonProps = {}, ...dropdownProps }) => (\n <span className=\"ms-2 inline-flex align-middle\">\n <MoreDropdown\n dropdownButtonProps={{\n size: DROPDOWN_BUTTON_SIZES[size],\n ...dropdownButtonProps,\n }}\n {...dropdownProps}\n />\n </span>\n )\n )}\n </TitleTag>\n </Typography>\n </div>\n </div>\n <div\n className={classnames(\n \"flex items-center gap-3 empty:hidden\",\n \"flex-wrap justify-start md:flex-nowrap md:justify-end\"\n )}\n >\n {searchProps && (\n <Search\n enableUrlSync\n className={classnames(\n \"min-w-[12.6rem] grow-0\",\n searchProps.className\n )}\n {...searchProps}\n />\n )}\n {actionBlock && (\n <div className=\"flex shrink-0 items-center justify-end gap-3 max-[360px]:shrink max-[360px]:flex-wrap max-[360px]:justify-start\">\n {actionBlock}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nHeader.propTypes = {\n /**\n * To set a title in the Header section.\n */\n title: PropTypes.node,\n /**\n * To set props for the HelpPopover component in the title.\n */\n titleHelpPopoverProps: PropTypes.object,\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 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 MoreDropdown component as argument.\n */\n renderDropdown: PropTypes.func,\n /**\n * To specify size of the Header.\n * `small` - Default size.\n *\n * `nano` - To be used in inner pages with menubar.\n */\n size: PropTypes.oneOf([\"nano\", \"small\"]),\n};\n\nexport default Header;\n"],"names":["SIZES","nano","DROPDOWN_BUTTON_SIZES","small","Header","_ref","title","_ref$titleHelpPopover","titleHelpPopoverProps","searchProps","_ref$className","className","actionBlock","_ref$breadcrumbs","breadcrumbs","_ref$renderDropdown","renderDropdown","noop","_ref$size","size","_ref$dataTestid","dataTestId","headerRef","useRef","useLayoutEffect","updateHeaderHeight","current","height","offsetHeight","document","body","style","setProperty","concat","window","addEventListener","removeEventListener","removeProperty","isNano","hasBreadcrumbs","isNotEmpty","TitleTag","_jsxs","ref","classnames","children","_jsx","Breadcrumbs","Typography","asChild","variant","weight","isPresent","HelpPopover","_objectSpread","side","_ref2","_ref2$dropdownButtonP","dropdownButtonProps","dropdownProps","_objectWithoutProperties","_excluded","MoreDropdown","Search","enableUrlSync"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,KAAK,GAAG;AAAEC,EAAAA,IAAI,EAAE,MAAuB,CAAC;AAE9C,IAAMC,qBAAqB,GAAG;AAAED,EAAAA,IAAI,EAAE,SAAS;AAAEE,EAAAA,KAAK,EAAE;AAAO,CAAC;;;;;ACYhE,IAAMC,MAAM,GAAG,SAATA,MAAMA,CAAAC,IAAA,EAUN;AAAA,EAAA,IATJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAAC,qBAAA,GAAAF,IAAA,CACLG,qBAAqB;AAArBA,IAAAA,qBAAqB,GAAAD,qBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,qBAAA;IAC1BE,WAAW,GAAAJ,IAAA,CAAXI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CAC1B,CACF,EACAQ,cAAc,CACb,UAAAwC,KAAA,EAAA;AAAA,cAAA,IAAAC,qBAAA,GAAAD,KAAA,CAAGE,mBAAmB;AAAnBA,gBAAAA,mBAAmB,GAAAD,qBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,qBAAA;AAAKE,gBAAAA,aAAa,GAAAC,wBAAA,CAAAJ,KAAA,EAAAK,SAAA,CAAA;AAAA,cAAA,oBAC3Cf,cAAA,CAAA,MAAA,EAAA;AAAMnC,gBAAAA,SAAS,EAAC,+BAA+B;AAAAkC,gBAAAA,QAAA,eAC7CC,cAAA,CAACgB,eAAY,EAAAR,aAAA,CAAA;AACXI,kBAAAA,mBAAmB,EAAAJ,aAAA,CAAA;oBACjBnC,IAAI,EAAEjB,qBAAqB,CAACiB,IAAI;AAAC,mBAAA,EAC9BuC,mBAAmB;AACtB,iBAAA,EACEC,aAAa,CAClB;AAAC,eACE,CAAC;AAAA,YAAA,CAEX,CAAC;WACO;SACA;AAAC,OACV,CAAC;KACH,CAAC,eACNjB,eAAA,CAAA,KAAA,EAAA;AACE/B,MAAAA,SAAS,EAAEiC,UAAU,CACnB,sCAAsC,EACtC,uDACF,CAAE;AAAAC,MAAAA,QAAA,GAEDpC,WAAW,iBACVqC,cAAA,CAACiB,SAAM,EAAAT,aAAA,CAAA;QACLU,aAAa,EAAA,IAAA;AACbrD,QAAAA,SAAS,EAAEiC,UAAU,CACnB,wBAAwB,EACxBnC,WAAW,CAACE,SACd;AAAE,OAAA,EACEF,WAAW,CAChB,CACF,EACAG,WAAW,iBACVkC,cAAA,CAAA,KAAA,EAAA;AAAKnC,QAAAA,SAAS,EAAC,iHAAiH;AAAAkC,QAAAA,QAAA,EAC7HjC;AAAW,OACT,CACN;AAAA,KACE,CAAC;AAAA,GACH,CAAC;AAEV;;;;"}
1
+ {"version":3,"file":"Header.js","sources":["../../../src/v2/components/Header/constants.js","../../../src/v2/components/Header/index.jsx"],"sourcesContent":["const SIZES = { nano: \"nano\", small: \"small\" };\n\nconst DROPDOWN_BUTTON_SIZES = { nano: \"icon-sm\", small: \"icon\" };\n\nexport { SIZES, DROPDOWN_BUTTON_SIZES };\n","import { useLayoutEffect, useRef } from \"react\";\n\nimport classnames from \"classnames\";\nimport { Typography } from \"neetoatoms\";\nimport { noop, isNotEmpty, isPresent } from \"neetocist\";\nimport PropTypes from \"prop-types\";\n\nimport { DROPDOWN_BUTTON_SIZES, SIZES } from \"./constants\";\n\nimport Breadcrumbs from \"../Breadcrumbs\";\nimport HelpPopover from \"../HelpPopover\";\nimport MoreDropdown from \"../MoreDropdown\";\nimport Search from \"../Search\";\n\nconst Header = ({\n title,\n titleHelpPopoverProps = {},\n searchProps,\n className = \"\",\n actionBlock,\n breadcrumbs = [],\n renderDropdown = noop,\n size = \"small\",\n \"data-testid\": dataTestId = \"neeto-molecules-header\",\n}) => {\n const headerRef = useRef(null);\n\n useLayoutEffect(() => {\n const updateHeaderHeight = () => {\n if (!headerRef.current) return;\n const height = headerRef.current.offsetHeight;\n document.body.style.setProperty(\"--nv-header-height\", `${height}px`);\n };\n\n updateHeaderHeight();\n\n window.addEventListener(\"resize\", updateHeaderHeight);\n\n return () => {\n window.removeEventListener(\"resize\", updateHeaderHeight);\n document.body.style.removeProperty(\"--nv-header-height\");\n };\n }, []);\n\n const isNano = size === SIZES.nano;\n const hasBreadcrumbs = isNotEmpty(breadcrumbs);\n const TitleTag = isNano ? \"h3\" : \"h1\";\n\n return (\n <div\n data-testid={dataTestId}\n ref={headerRef}\n className={classnames(\n \"flex min-h-0 w-full shrink-0 flex-col items-stretch justify-between gap-4 pt-10 pb-6\",\n \"md:flex-row md:flex-wrap md:items-start lg:flex-nowrap\",\n className\n )}\n >\n <div className=\"flex flex-wrap\">\n {hasBreadcrumbs && <Breadcrumbs {...{ breadcrumbs }} />}\n <div\n className={classnames(\n \"flex w-full flex-row items-center gap-3\",\n hasBreadcrumbs\n ? \"mt-0\"\n : \"-mt-1 max-lg:-mt-2.5 max-md:-mt-2 max-sm:-mt-1\"\n )}\n >\n <Typography asChild variant={isNano ? \"h4\" : \"h2\"} weight=\"semibold\">\n <TitleTag data-testid=\"main-header\">\n {title}\n {isPresent(titleHelpPopoverProps) && (\n <HelpPopover\n className=\"ms-2 inline-flex align-middle\"\n side=\"right\"\n {...titleHelpPopoverProps}\n />\n )}\n {renderDropdown(\n ({ dropdownButtonProps = {}, ...dropdownProps }) => (\n <span className=\"ms-2 inline-flex align-middle\">\n <MoreDropdown\n dropdownButtonProps={{\n size: DROPDOWN_BUTTON_SIZES[size],\n ...dropdownButtonProps,\n }}\n {...dropdownProps}\n />\n </span>\n )\n )}\n </TitleTag>\n </Typography>\n </div>\n </div>\n <div\n className={classnames(\n \"flex items-center gap-3 empty:hidden\",\n \"flex-wrap justify-start md:flex-nowrap md:justify-end\"\n )}\n >\n {searchProps && (\n <Search\n enableUrlSync\n className={classnames(\n \"w-[12.6rem] shrink-0 grow-0\",\n searchProps.className\n )}\n {...searchProps}\n />\n )}\n {actionBlock && (\n <div className=\"flex shrink-0 items-center justify-end gap-3 max-[360px]:shrink max-[360px]:flex-wrap max-[360px]:justify-start\">\n {actionBlock}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nHeader.propTypes = {\n /**\n * To set a title in the Header section.\n */\n title: PropTypes.node,\n /**\n * To set props for the HelpPopover component in the title.\n */\n titleHelpPopoverProps: PropTypes.object,\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 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 MoreDropdown component as argument.\n */\n renderDropdown: PropTypes.func,\n /**\n * To specify size of the Header.\n * `small` - Default size.\n *\n * `nano` - To be used in inner pages with menubar.\n */\n size: PropTypes.oneOf([\"nano\", \"small\"]),\n};\n\nexport default Header;\n"],"names":["SIZES","nano","DROPDOWN_BUTTON_SIZES","small","Header","_ref","title","_ref$titleHelpPopover","titleHelpPopoverProps","searchProps","_ref$className","className","actionBlock","_ref$breadcrumbs","breadcrumbs","_ref$renderDropdown","renderDropdown","noop","_ref$size","size","_ref$dataTestid","dataTestId","headerRef","useRef","useLayoutEffect","updateHeaderHeight","current","height","offsetHeight","document","body","style","setProperty","concat","window","addEventListener","removeEventListener","removeProperty","isNano","hasBreadcrumbs","isNotEmpty","TitleTag","_jsxs","ref","classnames","children","_jsx","Breadcrumbs","Typography","asChild","variant","weight","isPresent","HelpPopover","_objectSpread","side","_ref2","_ref2$dropdownButtonP","dropdownButtonProps","dropdownProps","_objectWithoutProperties","_excluded","MoreDropdown","Search","enableUrlSync"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,KAAK,GAAG;AAAEC,EAAAA,IAAI,EAAE,MAAuB,CAAC;AAE9C,IAAMC,qBAAqB,GAAG;AAAED,EAAAA,IAAI,EAAE,SAAS;AAAEE,EAAAA,KAAK,EAAE;AAAO,CAAC;;;;;ACYhE,IAAMC,MAAM,GAAG,SAATA,MAAMA,CAAAC,IAAA,EAUN;AAAA,EAAA,IATJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAAC,qBAAA,GAAAF,IAAA,CACLG,qBAAqB;AAArBA,IAAAA,qBAAqB,GAAAD,qBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,qBAAA;IAC1BE,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IAAAC,cAAA,GAAAL,IAAA,CACXM,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,cAAA;IACdE,WAAW,GAAAP,IAAA,CAAXO,WAAW;IAAAC,gBAAA,GAAAR,IAAA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A;AAAKE,gBAAAA,aAAa,GAAAC,wBAAA,CAAAJ,KAAA,EAAAK,SAAA,CAAA;AAAA,cAAA,oBAC3Cf,cAAA,CAAA,MAAA,EAAA;AAAMnC,gBAAAA,SAAS,EAAC,+BAA+B;AAAAkC,gBAAAA,QAAA,eAC7CC,cAAA,CAACgB,eAAY,EAAAR,aAAA,CAAA;AACXI,kBAAAA,mBAAmB,EAAAJ,aAAA,CAAA;oBACjBnC,IAAI,EAAEjB,qBAAqB,CAACiB,IAAI;AAAC,mBAAA,EAC9BuC,mBAAmB;AACtB,iBAAA,EACEC,aAAa,CAClB;AAAC,eACE,CAAC;AAAA,YAAA,CAEX,CAAC;WACO;SACA;AAAC,OACV,CAAC;KACH,CAAC,eACNjB,eAAA,CAAA,KAAA,EAAA;AACE/B,MAAAA,SAAS,EAAEiC,UAAU,CACnB,sCAAsC,EACtC,uDACF,CAAE;AAAAC,MAAAA,QAAA,GAEDpC,WAAW,iBACVqC,cAAA,CAACiB,SAAM,EAAAT,aAAA,CAAA;QACLU,aAAa,EAAA,IAAA;AACbrD,QAAAA,SAAS,EAAEiC,UAAU,CACnB,6BAA6B,EAC7BnC,WAAW,CAACE,SACd;AAAE,OAAA,EACEF,WAAW,CAChB,CACF,EACAG,WAAW,iBACVkC,cAAA,CAAA,KAAA,EAAA;AAAKnC,QAAAA,SAAS,EAAC,iHAAiH;AAAAkC,QAAAA,QAAA,EAC7HjC;AAAW,OACT,CACN;AAAA,KACE,CAAC;AAAA,GACH,CAAC;AAEV;;;;"}
package/dist/v2/Header.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
2
2
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
3
3
  import { useRef, useLayoutEffect } from 'react';
4
- import { Typography } from '@bigbinary/neeto-atoms';
5
4
  import classnames from 'classnames';
5
+ import { Typography } from '@bigbinary/neeto-atoms';
6
6
  import { isNotEmpty, isPresent, noop } from '@bigbinary/neeto-cist';
7
7
  import Breadcrumbs from './Breadcrumbs.js';
8
8
  import HelpPopover from './HelpPopover.js';
@@ -71,7 +71,7 @@ var Header = function Header(_ref) {
71
71
  return /*#__PURE__*/jsxs("div", {
72
72
  "data-testid": dataTestId,
73
73
  ref: headerRef,
74
- className: classnames("flex min-h-0 w-full shrink-0 flex-row items-start justify-between gap-4 pt-10 pb-6", "flex-wrap lg:flex-nowrap", className),
74
+ className: classnames("flex min-h-0 w-full shrink-0 flex-col items-stretch justify-between gap-4 pt-10 pb-6", "md:flex-row md:flex-wrap md:items-start lg:flex-nowrap", className),
75
75
  children: [/*#__PURE__*/jsxs("div", {
76
76
  className: "flex flex-wrap",
77
77
  children: [hasBreadcrumbs && /*#__PURE__*/jsx(Breadcrumbs, {
@@ -107,7 +107,7 @@ var Header = function Header(_ref) {
107
107
  className: classnames("flex items-center gap-3 empty:hidden", "flex-wrap justify-start md:flex-nowrap md:justify-end"),
108
108
  children: [searchProps && /*#__PURE__*/jsx(Search, _objectSpread({
109
109
  enableUrlSync: true,
110
- className: classnames("min-w-[12.6rem] grow-0", searchProps.className)
110
+ className: classnames("w-[12.6rem] shrink-0 grow-0", searchProps.className)
111
111
  }, searchProps)), actionBlock && /*#__PURE__*/jsx("div", {
112
112
  className: "flex shrink-0 items-center justify-end gap-3 max-[360px]:shrink max-[360px]:flex-wrap max-[360px]:justify-start",
113
113
  children: actionBlock
@@ -1 +1 @@
1
- {"version":3,"file":"Header.js","sources":["../../src/v2/components/Header/constants.js","../../src/v2/components/Header/index.jsx"],"sourcesContent":["const SIZES = { nano: \"nano\", small: \"small\" };\n\nconst DROPDOWN_BUTTON_SIZES = { nano: \"icon-sm\", small: \"icon\" };\n\nexport { SIZES, DROPDOWN_BUTTON_SIZES };\n","import { useLayoutEffect, useRef } from \"react\";\n\nimport { Typography } from \"@bigbinary/neeto-atoms\";\nimport classnames from \"classnames\";\nimport { noop, isNotEmpty, isPresent } from \"neetocist\";\nimport PropTypes from \"prop-types\";\n\nimport { DROPDOWN_BUTTON_SIZES, SIZES } from \"./constants\";\n\nimport Breadcrumbs from \"../Breadcrumbs\";\nimport HelpPopover from \"../HelpPopover\";\nimport MoreDropdown from \"../MoreDropdown\";\nimport Search from \"../Search\";\n\nconst Header = ({\n title,\n titleHelpPopoverProps = {},\n searchProps,\n className = \"\",\n actionBlock,\n breadcrumbs = [],\n renderDropdown = noop,\n size = \"small\",\n \"data-testid\": dataTestId = \"neeto-molecules-header\",\n}) => {\n const headerRef = useRef(null);\n\n useLayoutEffect(() => {\n const updateHeaderHeight = () => {\n if (!headerRef.current) return;\n const height = headerRef.current.offsetHeight;\n document.body.style.setProperty(\"--nv-header-height\", `${height}px`);\n };\n\n updateHeaderHeight();\n\n window.addEventListener(\"resize\", updateHeaderHeight);\n\n return () => {\n window.removeEventListener(\"resize\", updateHeaderHeight);\n document.body.style.removeProperty(\"--nv-header-height\");\n };\n }, []);\n\n const isNano = size === SIZES.nano;\n const hasBreadcrumbs = isNotEmpty(breadcrumbs);\n const TitleTag = isNano ? \"h3\" : \"h1\";\n\n return (\n <div\n data-testid={dataTestId}\n ref={headerRef}\n className={classnames(\n \"flex min-h-0 w-full shrink-0 flex-row items-start justify-between gap-4 pt-10 pb-6\",\n \"flex-wrap lg:flex-nowrap\",\n className\n )}\n >\n <div className=\"flex flex-wrap\">\n {hasBreadcrumbs && <Breadcrumbs {...{ breadcrumbs }} />}\n <div\n className={classnames(\n \"flex w-full flex-row items-center gap-3\",\n hasBreadcrumbs\n ? \"mt-0\"\n : \"-mt-1 max-lg:-mt-2.5 max-md:-mt-2 max-sm:-mt-1\"\n )}\n >\n <Typography asChild variant={isNano ? \"h4\" : \"h2\"} weight=\"semibold\">\n <TitleTag data-testid=\"main-header\">\n {title}\n {isPresent(titleHelpPopoverProps) && (\n <HelpPopover\n className=\"ms-2 inline-flex align-middle\"\n side=\"right\"\n {...titleHelpPopoverProps}\n />\n )}\n {renderDropdown(\n ({ dropdownButtonProps = {}, ...dropdownProps }) => (\n <span className=\"ms-2 inline-flex align-middle\">\n <MoreDropdown\n dropdownButtonProps={{\n size: DROPDOWN_BUTTON_SIZES[size],\n ...dropdownButtonProps,\n }}\n {...dropdownProps}\n />\n </span>\n )\n )}\n </TitleTag>\n </Typography>\n </div>\n </div>\n <div\n className={classnames(\n \"flex items-center gap-3 empty:hidden\",\n \"flex-wrap justify-start md:flex-nowrap md:justify-end\"\n )}\n >\n {searchProps && (\n <Search\n enableUrlSync\n className={classnames(\n \"min-w-[12.6rem] grow-0\",\n searchProps.className\n )}\n {...searchProps}\n />\n )}\n {actionBlock && (\n <div className=\"flex shrink-0 items-center justify-end gap-3 max-[360px]:shrink max-[360px]:flex-wrap max-[360px]:justify-start\">\n {actionBlock}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nHeader.propTypes = {\n /**\n * To set a title in the Header section.\n */\n title: PropTypes.node,\n /**\n * To set props for the HelpPopover component in the title.\n */\n titleHelpPopoverProps: PropTypes.object,\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 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 MoreDropdown component as argument.\n */\n renderDropdown: PropTypes.func,\n /**\n * To specify size of the Header.\n * `small` - Default size.\n *\n * `nano` - To be used in inner pages with menubar.\n */\n size: PropTypes.oneOf([\"nano\", \"small\"]),\n};\n\nexport default Header;\n"],"names":["SIZES","nano","DROPDOWN_BUTTON_SIZES","small","Header","_ref","title","_ref$titleHelpPopover","titleHelpPopoverProps","searchProps","_ref$className","className","actionBlock","_ref$breadcrumbs","breadcrumbs","_ref$renderDropdown","renderDropdown","noop","_ref$size","size","_ref$dataTestid","dataTestId","headerRef","useRef","useLayoutEffect","updateHeaderHeight","current","height","offsetHeight","document","body","style","setProperty","concat","window","addEventListener","removeEventListener","removeProperty","isNano","hasBreadcrumbs","isNotEmpty","TitleTag","_jsxs","ref","classnames","children","_jsx","Breadcrumbs","Typography","asChild","variant","weight","isPresent","HelpPopover","_objectSpread","side","_ref2","_ref2$dropdownButtonP","dropdownButtonProps","dropdownProps","_objectWithoutProperties","_excluded","MoreDropdown","Search","enableUrlSync"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,KAAK,GAAG;AAAEC,EAAAA,IAAI,EAAE,MAAuB,CAAC;AAE9C,IAAMC,qBAAqB,GAAG;AAAED,EAAAA,IAAI,EAAE,SAAS;AAAEE,EAAAA,KAAK,EAAE;AAAO,CAAC;;;;;ACYhE,IAAMC,MAAM,GAAG,SAATA,MAAMA,CAAAC,IAAA,EAUN;AAAA,EAAA,IATJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAAC,qBAAA,GAAAF,IAAA,CACLG,qBAAqB;AAArBA,IAAAA,qBAAqB,GAAAD,qBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,qBAAA;IAC1BE,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IAAAC,cAAA,GAAAL,IAAA,CACXM,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,cAAA;IACdE,WAAW,GAAAP,IAAA,CAAXO,WAAW;IAAAC,gBAAA,GAAAR,IAAA,CACXS,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,gBAAA;IAAAE,mBAAA,GAAAV,IAAA,CAChBW,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAA,MAAA,GAAGE,IAAI,GAAAF,mBAAA;IAAAG,SAAA,GAAAb,IAAA,CACrBc,IAAI;AAAJA,IAAAA,IAA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CAAA;oBACjBnC,IAAI,EAAEjB,qBAAqB,CAACiB,IAAI;AAAC,mBAAA,EAC9BuC,mBAAmB;AACtB,iBAAA,EACEC,aAAa,CAClB;AAAC,eACE,CAAC;AAAA,YAAA,CAEX,CAAC;WACO;SACA;AAAC,OACV,CAAC;KACH,CAAC,eACNjB,IAAA,CAAA,KAAA,EAAA;AACE/B,MAAAA,SAAS,EAAEiC,UAAU,CACnB,sCAAsC,EACtC,uDACF,CAAE;AAAAC,MAAAA,QAAA,GAEDpC,WAAW,iBACVqC,GAAA,CAACiB,MAAM,EAAAT,aAAA,CAAA;QACLU,aAAa,EAAA,IAAA;AACbrD,QAAAA,SAAS,EAAEiC,UAAU,CACnB,wBAAwB,EACxBnC,WAAW,CAACE,SACd;AAAE,OAAA,EACEF,WAAW,CAChB,CACF,EACAG,WAAW,iBACVkC,GAAA,CAAA,KAAA,EAAA;AAAKnC,QAAAA,SAAS,EAAC,iHAAiH;AAAAkC,QAAAA,QAAA,EAC7HjC;AAAW,OACT,CACN;AAAA,KACE,CAAC;AAAA,GACH,CAAC;AAEV;;;;"}
1
+ {"version":3,"file":"Header.js","sources":["../../src/v2/components/Header/constants.js","../../src/v2/components/Header/index.jsx"],"sourcesContent":["const SIZES = { nano: \"nano\", small: \"small\" };\n\nconst DROPDOWN_BUTTON_SIZES = { nano: \"icon-sm\", small: \"icon\" };\n\nexport { SIZES, DROPDOWN_BUTTON_SIZES };\n","import { useLayoutEffect, useRef } from \"react\";\n\nimport classnames from \"classnames\";\nimport { Typography } from \"neetoatoms\";\nimport { noop, isNotEmpty, isPresent } from \"neetocist\";\nimport PropTypes from \"prop-types\";\n\nimport { DROPDOWN_BUTTON_SIZES, SIZES } from \"./constants\";\n\nimport Breadcrumbs from \"../Breadcrumbs\";\nimport HelpPopover from \"../HelpPopover\";\nimport MoreDropdown from \"../MoreDropdown\";\nimport Search from \"../Search\";\n\nconst Header = ({\n title,\n titleHelpPopoverProps = {},\n searchProps,\n className = \"\",\n actionBlock,\n breadcrumbs = [],\n renderDropdown = noop,\n size = \"small\",\n \"data-testid\": dataTestId = \"neeto-molecules-header\",\n}) => {\n const headerRef = useRef(null);\n\n useLayoutEffect(() => {\n const updateHeaderHeight = () => {\n if (!headerRef.current) return;\n const height = headerRef.current.offsetHeight;\n document.body.style.setProperty(\"--nv-header-height\", `${height}px`);\n };\n\n updateHeaderHeight();\n\n window.addEventListener(\"resize\", updateHeaderHeight);\n\n return () => {\n window.removeEventListener(\"resize\", updateHeaderHeight);\n document.body.style.removeProperty(\"--nv-header-height\");\n };\n }, []);\n\n const isNano = size === SIZES.nano;\n const hasBreadcrumbs = isNotEmpty(breadcrumbs);\n const TitleTag = isNano ? \"h3\" : \"h1\";\n\n return (\n <div\n data-testid={dataTestId}\n ref={headerRef}\n className={classnames(\n \"flex min-h-0 w-full shrink-0 flex-col items-stretch justify-between gap-4 pt-10 pb-6\",\n \"md:flex-row md:flex-wrap md:items-start lg:flex-nowrap\",\n className\n )}\n >\n <div className=\"flex flex-wrap\">\n {hasBreadcrumbs && <Breadcrumbs {...{ breadcrumbs }} />}\n <div\n className={classnames(\n \"flex w-full flex-row items-center gap-3\",\n hasBreadcrumbs\n ? \"mt-0\"\n : \"-mt-1 max-lg:-mt-2.5 max-md:-mt-2 max-sm:-mt-1\"\n )}\n >\n <Typography asChild variant={isNano ? \"h4\" : \"h2\"} weight=\"semibold\">\n <TitleTag data-testid=\"main-header\">\n {title}\n {isPresent(titleHelpPopoverProps) && (\n <HelpPopover\n className=\"ms-2 inline-flex align-middle\"\n side=\"right\"\n {...titleHelpPopoverProps}\n />\n )}\n {renderDropdown(\n ({ dropdownButtonProps = {}, ...dropdownProps }) => (\n <span className=\"ms-2 inline-flex align-middle\">\n <MoreDropdown\n dropdownButtonProps={{\n size: DROPDOWN_BUTTON_SIZES[size],\n ...dropdownButtonProps,\n }}\n {...dropdownProps}\n />\n </span>\n )\n )}\n </TitleTag>\n </Typography>\n </div>\n </div>\n <div\n className={classnames(\n \"flex items-center gap-3 empty:hidden\",\n \"flex-wrap justify-start md:flex-nowrap md:justify-end\"\n )}\n >\n {searchProps && (\n <Search\n enableUrlSync\n className={classnames(\n \"w-[12.6rem] shrink-0 grow-0\",\n searchProps.className\n )}\n {...searchProps}\n />\n )}\n {actionBlock && (\n <div className=\"flex shrink-0 items-center justify-end gap-3 max-[360px]:shrink max-[360px]:flex-wrap max-[360px]:justify-start\">\n {actionBlock}\n </div>\n )}\n </div>\n </div>\n );\n};\n\nHeader.propTypes = {\n /**\n * To set a title in the Header section.\n */\n title: PropTypes.node,\n /**\n * To set props for the HelpPopover component in the title.\n */\n titleHelpPopoverProps: PropTypes.object,\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 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 MoreDropdown component as argument.\n */\n renderDropdown: PropTypes.func,\n /**\n * To specify size of the Header.\n * `small` - Default size.\n *\n * `nano` - To be used in inner pages with menubar.\n */\n size: PropTypes.oneOf([\"nano\", \"small\"]),\n};\n\nexport default Header;\n"],"names":["SIZES","nano","DROPDOWN_BUTTON_SIZES","small","Header","_ref","title","_ref$titleHelpPopover","titleHelpPopoverProps","searchProps","_ref$className","className","actionBlock","_ref$breadcrumbs","breadcrumbs","_ref$renderDropdown","renderDropdown","noop","_ref$size","size","_ref$dataTestid","dataTestId","headerRef","useRef","useLayoutEffect","updateHeaderHeight","current","height","offsetHeight","document","body","style","setProperty","concat","window","addEventListener","removeEventListener","removeProperty","isNano","hasBreadcrumbs","isNotEmpty","TitleTag","_jsxs","ref","classnames","children","_jsx","Breadcrumbs","Typography","asChild","variant","weight","isPresent","HelpPopover","_objectSpread","side","_ref2","_ref2$dropdownButtonP","dropdownButtonProps","dropdownProps","_objectWithoutProperties","_excluded","MoreDropdown","Search","enableUrlSync"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAMA,KAAK,GAAG;AAAEC,EAAAA,IAAI,EAAE,MAAuB,CAAC;AAE9C,IAAMC,qBAAqB,GAAG;AAAED,EAAAA,IAAI,EAAE,SAAS;AAAEE,EAAAA,KAAK,EAAE;AAAO,CAAC;;;;;ACYhE,IAAMC,MAAM,GAAG,SAATA,MAAMA,CAAAC,IAAA,EAUN;AAAA,EAAA,IATJC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAAC,qBAAA,GAAAF,IAAA,CACLG,qBAAqB;AAArBA,IAAAA,qBAAqB,GAAAD,qBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,qBAAA;IAC1BE,WAAW,GAAAJ,IAAA,CAAXI,WAAW;IAAAC,cAAA,GAAAL,IAAA,CACXM,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,cAAA;IACdE,WAAW,GAAAP,IAAA,CAAXO,WAAW;IAAAC,gBAAA,GAAAR,IAAA,CACXS,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,gBAAA;IAAAE,mBAAA,GAAAV,IAAA,CAChBW,cAAc;AAAdA,IAAAA,cAAc,GAAAD,mBAAA,KAAA,MAAA,GAAGE,IAAI,GAAAF,mBAAA;IAAAG,SAAA,GAAAb,IAAA,CACrBc,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAA,MAAA,GAAG,OAAO,GAAAA,SAAA;IAAAE,eAAA,GAAAf,IAAA,CACd,aAAa,CAAA;AAAEgB,IAAAA,UAAU,GAAAD,eAAA,KAAA,MAAA,GAAG,wBAAwB,GAAAA,eAAA;AAEpD,EAAA,IAAME,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,eACNjB,IAAA,CAAA,KAAA,EAAA;AACE/B,MAAAA,SAAS,EAAEiC,UAAU,CACnB,sCAAsC,EACtC,uDACF,CAAE;AAAAC,MAAAA,QAAA,GAEDpC,WAAW,iBACVqC,GAAA,CAACiB,MAAM,EAAAT,aAAA,CAAA;QACLU,aAAa,EAAA,IAAA;AACbrD,QAAAA,SAAS,EAAEiC,UAAU,CACnB,6BAA6B,EAC7BnC,WAAW,CAACE,SACd;AAAE,OAAA,EACEF,WAAW,CAChB,CACF,EACAG,WAAW,iBACVkC,GAAA,CAAA,KAAA,EAAA;AAAKnC,QAAAA,SAAS,EAAC,iHAAiH;AAAAkC,QAAAA,QAAA,EAC7HjC;AAAW,OACT,CACN;AAAA,KACE,CAAC;AAAA,GACH,CAAC;AAEV;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-molecules",
3
- "version": "5.8.0-beta1",
3
+ "version": "5.9.0",
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>",
@@ -301,4 +301,4 @@
301
301
  "zustand": "4.4.2"
302
302
  },
303
303
  "packageManager": "yarn@4.9.2"
304
- }
304
+ }