@bigbinary/neeto-molecules 3.16.28 → 3.16.29
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/dist/NavigationHeader.js +2 -4
- package/dist/NavigationHeader.js.map +1 -1
- package/dist/PublishBlock.js +77 -189
- package/dist/PublishBlock.js.map +1 -1
- package/dist/cjs/NavigationHeader.js +2 -4
- package/dist/cjs/NavigationHeader.js.map +1 -1
- package/dist/cjs/PublishBlock.js +76 -188
- package/dist/cjs/PublishBlock.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +4 -3
- package/types/PublishBlock.d.ts +35 -54
package/dist/NavigationHeader.js
CHANGED
|
@@ -31,15 +31,13 @@ import './MoreDropdown.js';
|
|
|
31
31
|
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
32
32
|
import '@bigbinary/neeto-icons/MenuHorizontal';
|
|
33
33
|
import '@bigbinary/neeto-icons/MenuVertical';
|
|
34
|
-
import '@babel/runtime/helpers/asyncToGenerator';
|
|
35
|
-
import '@babel/runtime/regenerator';
|
|
36
34
|
import '@bigbinary/neeto-commons-frontend/react-utils/withT';
|
|
35
|
+
import '@bigbinary/neeto-commons-frontend/utils';
|
|
37
36
|
import '@bigbinary/neeto-icons/ExternalLink';
|
|
38
37
|
import '@bigbinary/neeto-icons/Undo';
|
|
38
|
+
import '@bigbinary/neeto-icons/Clock';
|
|
39
39
|
import '@bigbinary/neetoui/Alert';
|
|
40
40
|
import '@bigbinary/neetoui/Pane';
|
|
41
|
-
import '@bigbinary/neetoui/Switch';
|
|
42
|
-
import '@bigbinary/neeto-commons-frontend/utils';
|
|
43
41
|
import '@bigbinary/neeto-team-members-frontend/Profile';
|
|
44
42
|
import '@bigbinary/neetoui/DatePicker';
|
|
45
43
|
import '@bigbinary/neeto-commons-frontend/initializers';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationHeader.js","sources":["../src/components/NavigationHeader/constants.jsx","../src/components/NavigationHeader/LeftBlock.jsx","../src/components/NavigationHeader/Navigation.jsx","../src/components/NavigationHeader/utils.js","../src/components/NavigationHeader/RightBlock.jsx","../src/components/NavigationHeader/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport { Home } from \"neetoicons\";\n\nexport const DEFAULT_HOME_BUTTON_PROPS = {\n tooltip: {\n content: t(\"neetoMolecules.navigationHeader.home\"),\n position: \"bottom\",\n },\n homeUrl: \"/\",\n icon: <Home />,\n};\n","import { isPresent } from \"neetocist\";\nimport { Tooltip } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { mergeDeepRight } from \"ramda\";\nimport { Link } from \"react-router-dom\";\n\nimport Rename from \"components/Rename\";\n\nimport { DEFAULT_HOME_BUTTON_PROPS } from \"./constants\";\n\nconst LeftBlock = ({\n homeButtonProps: customHomeButtonProps,\n homeUrl,\n renameProps,\n children,\n}) => {\n const homeButtonProps = mergeDeepRight(\n DEFAULT_HOME_BUTTON_PROPS,\n customHomeButtonProps\n );\n\n return (\n <div\n className=\"flex items-center gap-1 md:gap-2\"\n data-cy=\"navigation-header-left-block\"\n data-testid=\"navigation-header-left-block\"\n >\n <Tooltip\n content={homeButtonProps.tooltip.content}\n position={homeButtonProps.tooltip.position}\n touch={[\"hold\", 500]}\n >\n <Link data-cy=\"home-button\" data-testid=\"home-button\" to={homeUrl}>\n <div className=\"neeto-ui-rounded hover:neeto-ui-bg-gray-200 p-1\">\n {homeButtonProps.icon}\n </div>\n </Link>\n </Tooltip>\n {isPresent(renameProps) && (\n <Rename\n dropdownItems={renameProps.dropdownItems}\n value={renameProps.value}\n {...renameProps}\n />\n )}\n {children}\n </div>\n );\n};\n\nLeftBlock.propTypes = {\n /**\n * Object containing the home button icon and the props to be passed to the tooltip of the home button.\n */\n homeButtonProps: PropTypes.shape({\n tooltip: PropTypes.shape({\n content: PropTypes.string,\n postition: PropTypes.string,\n }),\n icon: PropTypes.node,\n }),\n /**\n * URL to navigate when the home button is clicked.\n */\n homeUrl: PropTypes.string.isRequired,\n /**\n * Props to be passed to the `Rename` component. Please check the `Rename` component props for more details\n */\n renameProps: PropTypes.object,\n /**\n * To render extra content in the block.\n */\n children: PropTypes.node,\n};\n\nexport default LeftBlock;\n","import classNames from \"classnames\";\nimport { existsBy, isNotEmpty } from \"neetocist\";\nimport { joinHyphenCase } from \"neetocommons/utils/general\";\nimport { Dropdown, Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\nimport { NavLink, useLocation } from \"react-router-dom\";\n\nconst { Menu, MenuItem } = Dropdown;\n\nconst NavigationLinks = ({ headerLinks, maxVisibleLinks = 5 }) => {\n const { pathname } = useLocation();\n const { t } = useTranslation();\n\n const visibleLinks = headerLinks.slice(0, maxVisibleLinks);\n const overflowLinks = headerLinks.slice(maxVisibleLinks);\n\n const isMoreButtonActive = existsBy({ to: pathname }, overflowLinks);\n\n return (\n <div\n className=\"font- flex w-full items-center justify-between gap-4 md:justify-center md:gap-3 lg:gap-6\"\n data-cy=\"navigation-header-navigation-links\"\n data-testid=\"navigation-header-navigation-links\"\n >\n {visibleLinks.map(headerLink => (\n <NavLink\n activeClassName=\"active\"\n className=\"neeto-molecules-navigation-header__link px-2 capitalize no-underline md:px-0\"\n data-cy={`${joinHyphenCase(headerLink.key)}-tab`}\n key={headerLink.key}\n {...headerLink}\n >\n <Typography\n component=\"span\"\n lineHeight=\"normal\"\n style=\"h4\"\n weight=\"semibold\"\n >\n {headerLink.label}\n </Typography>\n </NavLink>\n ))}\n {isNotEmpty(overflowLinks) && (\n <Dropdown\n buttonStyle=\"text\"\n label={t(\"neetoMolecules.navigationHeader.more\")}\n position=\"bottom-end\"\n buttonProps={{\n className: classNames(\n \"neeto-molecules-navigation-header__link neeto-molecules-navigation-header__link--more neeto-ui-typography neeto-ui-text-h4 neeto-ui-font-semibold neeto-ui-leading-normal px-2 capitalize no-underline md:px-0\",\n { active: isMoreButtonActive }\n ),\n }}\n >\n <Menu>\n {overflowLinks.map(headerLink => (\n <MenuItem.Button\n data-cy={`${joinHyphenCase(headerLink.key)}-more-tab`}\n isActive={headerLink.to === pathname}\n key={headerLink.key}\n to={headerLink.to}\n {...headerLink}\n >\n {headerLink.label}\n </MenuItem.Button>\n ))}\n </Menu>\n </Dropdown>\n )}\n </div>\n );\n};\n\nNavigationLinks.propTypes = {\n /**\n * Links to be rendered in the center of the navigation header. It is an array of objects.\n * Each object should have the properties `key`, `to` and `label`. Other props will be passed on to the `Navlink` component from\n `react-router-dom`.\n */\n headerLinks: PropTypes.arrayOf(\n PropTypes.shape({\n key: PropTypes.string,\n to: PropTypes.string,\n label: PropTypes.string,\n })\n ),\n /**\n * Maximum number of links to be visible in the navigation header. Remaining links will be shown in a more dropdown.\n */\n maxVisibleLinks: PropTypes.number,\n};\n\nexport default NavigationLinks;\n","export const isAbsoluteUrl = url => /^https?:\\/\\//.test(url);\n","import classNames from \"classnames\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport PublishBlock from \"components/PublishBlock\";\n\nimport \"./navigation-header.scss\";\nimport { isAbsoluteUrl } from \"./utils\";\n\nconst RightBlock = ({\n isDraftBlockHidden,\n previewDraftUrl,\n isResetDraftButtonVisible,\n onResetClick,\n isResetting,\n isPublishDisabled,\n isPublishing,\n handlePublish,\n isPublishPreviewDisabled,\n previewPublishedUrl,\n isPublishButtonVisible,\n isResetAlertOpen,\n setIsResetAlertOpen,\n handleReset,\n publishAlertTitle,\n publishAlertDescription,\n publishButtonProps = {},\n}) => {\n const { t } = useTranslation();\n\n const renderDraftButtons = ({ ViewDraftButton, ResetDraftButton }) =>\n !isDraftBlockHidden && (\n <>\n <ViewDraftButton\n {...(isAbsoluteUrl(previewDraftUrl)\n ? { href: previewDraftUrl }\n : { to: previewDraftUrl })}\n />\n {isResetDraftButtonVisible && (\n <ResetDraftButton\n loading={isResetting}\n onClick={() => onResetClick()}\n />\n )}\n </>\n );\n\n const renderPublishButtons = ({ PublishButton, PublishPreviewButton }) => (\n <>\n {isPublishButtonVisible && (\n <PublishButton\n disabled={isPublishDisabled}\n loading={isPublishing}\n onClick={() => handlePublish()}\n {...publishButtonProps}\n />\n )}\n <PublishPreviewButton\n {...(isAbsoluteUrl(previewPublishedUrl)\n ? { href: previewPublishedUrl }\n : { to: previewPublishedUrl })}\n disabled={isPublishPreviewDisabled}\n className={classNames({\n \"standalone-publish-preview-button\": !isPublishButtonVisible,\n })}\n />\n </>\n );\n\n return (\n <>\n <PublishBlock {...{ renderDraftButtons, renderPublishButtons }} />\n <PublishBlock.Alert\n isOpen={isResetAlertOpen}\n isSubmitting={isResetting}\n message={\n publishAlertDescription ||\n t(\"neetoMolecules.navigationHeader.resetDescription\")\n }\n title={\n publishAlertTitle || t(\"neetoMolecules.navigationHeader.resetTitle\")\n }\n onClose={() => setIsResetAlertOpen(false)}\n onSubmit={handleReset}\n />\n </>\n );\n};\n\nRightBlock.propTypes = {\n /**\n * To show/hide the draft block.\n */\n isDraftBlockHidden: PropTypes.bool,\n /**\n * Draft preview URL, when the draft button is clicked user will be redirected to this URL.\n */\n previewDraftUrl: PropTypes.string,\n /**\n * Boolean to control the visibility of reset draft button.\n */\n isResetDraftButtonVisible: PropTypes.bool,\n /**\n * Callback function that will be called when the reset button is clicked.\n */\n onResetClick: PropTypes.func,\n /**\n * Setting this to `true` will show a spinner on the reset button. Use when the reset process is in progress.\n */\n isResetting: PropTypes.bool,\n /**\n * To disable the publish button.\n */\n isPublishDisabled: PropTypes.bool,\n /**\n * Setting this to `true` will show a spinner on the publish button. Use when the publish process is in progress.\n */\n isPublishing: PropTypes.bool,\n /**\n * Callback function that will be called when the publish button is clicked.\n */\n handlePublish: PropTypes.func,\n /**\n * To disable the publish preview button.\n */\n isPublishPreviewDisabled: PropTypes.bool,\n /**\n * Publish preview URL, when the preview publish button is clicked user will be redirected to this URL.\n */\n previewPublishedUrl: PropTypes.string,\n /**\n * Boolean to control whether the user have the ability to publish.\n */\n isPublishButtonVisible: PropTypes.bool,\n /**\n * Boolean to control whether the reset alert is open.\n */\n isResetAlertOpen: PropTypes.bool,\n /**\n * Handler to control the `isResetAlert` state variable.\n */\n setIsResetAlertOpen: PropTypes.func,\n /**\n * Callback function that will be called when the reset button is clicked.\n */\n handleReset: PropTypes.func,\n /**\n * Description to be shown in the publish alert\n */\n publishAlertDescription: PropTypes.string,\n /**\n * Title of the publish alert\n */\n publishAlertTitle: PropTypes.string,\n /**\n * Props to be passed to the publish button\n */\n publishButtonProps: PropTypes.object,\n};\n\nexport default RightBlock;\n","import { isPresent } from \"neetocist\";\nimport useBreakpoints from \"neetocommons/react-utils/useBreakpoints\";\nimport PropTypes from \"prop-types\";\nimport { filter, length } from \"ramda\";\n\nimport LeftBlock from \"./LeftBlock\";\nimport NavigationLinks from \"./Navigation\";\nimport RightBlock from \"./RightBlock\";\n\nconst NavigationHeader = ({\n leftActionBlock,\n navigationLinks,\n rightActionBlock,\n}) => {\n const { isSize } = useBreakpoints();\n const isMobile = isSize(\"mobile\");\n\n const numberOfChildren = length(\n filter(isPresent, [leftActionBlock, navigationLinks, rightActionBlock])\n );\n\n const gridStyle = {\n gridTemplateColumns: isMobile\n ? `repeat(${\n navigationLinks ? numberOfChildren - 1 : numberOfChildren\n }, auto)`\n : `repeat(${numberOfChildren}, 1fr)`,\n };\n\n return (\n <div className=\"w-full\">\n <div\n className=\"neeto-molecules-navigation-header neeto-ui-border-gray-200 neeto-ui-bg-white flex h-16 w-full flex-shrink-0 items-center overflow-x-auto border-b px-2 py-2 md:px-4 lg:px-6\"\n data-cy=\"navigation-header\"\n data-testid=\"navigation-header\"\n >\n <div className=\"grid w-full gap-4\" style={gridStyle}>\n {leftActionBlock}\n {!isMobile && navigationLinks}\n {rightActionBlock}\n </div>\n </div>\n {isMobile && (\n <div className=\"neeto-molecules-navigation-header neeto-ui-border-gray-200 neeto-ui-bg-white flex flex-shrink-0 items-center overflow-x-auto border-b px-4 py-2 lg:px-6\">\n {navigationLinks}\n </div>\n )}\n </div>\n );\n};\n\nNavigationHeader.LeftActionBlock = LeftBlock;\nNavigationHeader.NavigationLinks = NavigationLinks;\nNavigationHeader.RightActionBlock = RightBlock;\n\nNavigationHeader.propTypes = {\n /**\n * To specify the content to be rendered in the left side of the `NavigationHeader`.\n */\n leftActionBlock: PropTypes.node,\n /**\n * To specify the content to be rendered at the center of the `NavigationHeader`.\n */\n navigationLinks: PropTypes.node,\n /**\n * To specify the content to be rendered in the right side of the `NavigationHeader`.\n */\n rightActionBlock: PropTypes.node,\n};\n\nexport default NavigationHeader;\n"],"names":["DEFAULT_HOME_BUTTON_PROPS","tooltip","content","t","position","homeUrl","icon","_jsx","Home","LeftBlock","_ref","customHomeButtonProps","homeButtonProps","renameProps","children","mergeDeepRight","_jsxs","className","Tooltip","touch","Link","to","isPresent","Rename","_objectSpread","dropdownItems","value","Menu","Dropdown","MenuItem","NavigationLinks","headerLinks","_ref$maxVisibleLinks","maxVisibleLinks","_useLocation","useLocation","pathname","_useTranslation","useTranslation","visibleLinks","slice","overflowLinks","isMoreButtonActive","existsBy","map","headerLink","NavLink","activeClassName","concat","joinHyphenCase","key","Typography","component","lineHeight","style","weight","label","isNotEmpty","buttonStyle","buttonProps","classNames","active","Button","isActive","isAbsoluteUrl","url","test","RightBlock","isDraftBlockHidden","previewDraftUrl","isResetDraftButtonVisible","onResetClick","isResetting","isPublishDisabled","isPublishing","handlePublish","isPublishPreviewDisabled","previewPublishedUrl","isPublishButtonVisible","isResetAlertOpen","setIsResetAlertOpen","handleReset","publishAlertTitle","publishAlertDescription","_ref$publishButtonPro","publishButtonProps","renderDraftButtons","_ref2","ViewDraftButton","ResetDraftButton","_Fragment","href","loading","onClick","renderPublishButtons","_ref3","PublishButton","PublishPreviewButton","disabled","PublishBlock","Alert","isOpen","isSubmitting","message","title","onClose","onSubmit","NavigationHeader","leftActionBlock","navigationLinks","rightActionBlock","_useBreakpoints","useBreakpoints","isSize","isMobile","numberOfChildren","length","filter","gridStyle","gridTemplateColumns","Left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MAAAA,QAAA,eAE/BE,IAAA,CAAA,KAAA,EAAA;AAAKC,QAAAA,SAAS,EAAC,mBAAmB;AAACqC,QAAAA,KAAK,EAAEgE,SAAU;QAAAxG,QAAA,EAAA,CACjD8F,eAAe,EACf,CAACM,QAAQ,IAAIL,eAAe,EAC5BC,gBAAgB,CAAA;OACd,CAAA;AAAC,KACH,CAAC,EACLI,QAAQ,iBACP3G,GAAA,CAAA,KAAA,EAAA;AAAKU,MAAAA,SAAS,EAAC,yJAAyJ;AAAAH,MAAAA,QAAA,EACrK+F,eAAAA;AAAe,KACb,CACN,CAAA;AAAA,GACE,CAAC,CAAA;AAEV,EAAC;AAEDF,gBAAgB,CAACa,eAAe,GAAG/G,SAAS,CAAA;AAC5CkG,gBAAgB,CAAC7E,eAAe,GAAGA,eAAe,CAAA;AAClD6E,gBAAgB,CAACc,gBAAgB,GAAGtD,UAAU;;;;"}
|
|
1
|
+
{"version":3,"file":"NavigationHeader.js","sources":["../src/components/NavigationHeader/constants.jsx","../src/components/NavigationHeader/LeftBlock.jsx","../src/components/NavigationHeader/Navigation.jsx","../src/components/NavigationHeader/utils.js","../src/components/NavigationHeader/RightBlock.jsx","../src/components/NavigationHeader/index.jsx"],"sourcesContent":["import { t } from \"i18next\";\nimport { Home } from \"neetoicons\";\n\nexport const DEFAULT_HOME_BUTTON_PROPS = {\n tooltip: {\n content: t(\"neetoMolecules.navigationHeader.home\"),\n position: \"bottom\",\n },\n homeUrl: \"/\",\n icon: <Home />,\n};\n","import { isPresent } from \"neetocist\";\nimport { Tooltip } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { mergeDeepRight } from \"ramda\";\nimport { Link } from \"react-router-dom\";\n\nimport Rename from \"components/Rename\";\n\nimport { DEFAULT_HOME_BUTTON_PROPS } from \"./constants\";\n\nconst LeftBlock = ({\n homeButtonProps: customHomeButtonProps,\n homeUrl,\n renameProps,\n children,\n}) => {\n const homeButtonProps = mergeDeepRight(\n DEFAULT_HOME_BUTTON_PROPS,\n customHomeButtonProps\n );\n\n return (\n <div\n className=\"flex items-center gap-1 md:gap-2\"\n data-cy=\"navigation-header-left-block\"\n data-testid=\"navigation-header-left-block\"\n >\n <Tooltip\n content={homeButtonProps.tooltip.content}\n position={homeButtonProps.tooltip.position}\n touch={[\"hold\", 500]}\n >\n <Link data-cy=\"home-button\" data-testid=\"home-button\" to={homeUrl}>\n <div className=\"neeto-ui-rounded hover:neeto-ui-bg-gray-200 p-1\">\n {homeButtonProps.icon}\n </div>\n </Link>\n </Tooltip>\n {isPresent(renameProps) && (\n <Rename\n dropdownItems={renameProps.dropdownItems}\n value={renameProps.value}\n {...renameProps}\n />\n )}\n {children}\n </div>\n );\n};\n\nLeftBlock.propTypes = {\n /**\n * Object containing the home button icon and the props to be passed to the tooltip of the home button.\n */\n homeButtonProps: PropTypes.shape({\n tooltip: PropTypes.shape({\n content: PropTypes.string,\n postition: PropTypes.string,\n }),\n icon: PropTypes.node,\n }),\n /**\n * URL to navigate when the home button is clicked.\n */\n homeUrl: PropTypes.string.isRequired,\n /**\n * Props to be passed to the `Rename` component. Please check the `Rename` component props for more details\n */\n renameProps: PropTypes.object,\n /**\n * To render extra content in the block.\n */\n children: PropTypes.node,\n};\n\nexport default LeftBlock;\n","import classNames from \"classnames\";\nimport { existsBy, isNotEmpty } from \"neetocist\";\nimport { joinHyphenCase } from \"neetocommons/utils/general\";\nimport { Dropdown, Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\nimport { NavLink, useLocation } from \"react-router-dom\";\n\nconst { Menu, MenuItem } = Dropdown;\n\nconst NavigationLinks = ({ headerLinks, maxVisibleLinks = 5 }) => {\n const { pathname } = useLocation();\n const { t } = useTranslation();\n\n const visibleLinks = headerLinks.slice(0, maxVisibleLinks);\n const overflowLinks = headerLinks.slice(maxVisibleLinks);\n\n const isMoreButtonActive = existsBy({ to: pathname }, overflowLinks);\n\n return (\n <div\n className=\"font- flex w-full items-center justify-between gap-4 md:justify-center md:gap-3 lg:gap-6\"\n data-cy=\"navigation-header-navigation-links\"\n data-testid=\"navigation-header-navigation-links\"\n >\n {visibleLinks.map(headerLink => (\n <NavLink\n activeClassName=\"active\"\n className=\"neeto-molecules-navigation-header__link px-2 capitalize no-underline md:px-0\"\n data-cy={`${joinHyphenCase(headerLink.key)}-tab`}\n key={headerLink.key}\n {...headerLink}\n >\n <Typography\n component=\"span\"\n lineHeight=\"normal\"\n style=\"h4\"\n weight=\"semibold\"\n >\n {headerLink.label}\n </Typography>\n </NavLink>\n ))}\n {isNotEmpty(overflowLinks) && (\n <Dropdown\n buttonStyle=\"text\"\n label={t(\"neetoMolecules.navigationHeader.more\")}\n position=\"bottom-end\"\n buttonProps={{\n className: classNames(\n \"neeto-molecules-navigation-header__link neeto-molecules-navigation-header__link--more neeto-ui-typography neeto-ui-text-h4 neeto-ui-font-semibold neeto-ui-leading-normal px-2 capitalize no-underline md:px-0\",\n { active: isMoreButtonActive }\n ),\n }}\n >\n <Menu>\n {overflowLinks.map(headerLink => (\n <MenuItem.Button\n data-cy={`${joinHyphenCase(headerLink.key)}-more-tab`}\n isActive={headerLink.to === pathname}\n key={headerLink.key}\n to={headerLink.to}\n {...headerLink}\n >\n {headerLink.label}\n </MenuItem.Button>\n ))}\n </Menu>\n </Dropdown>\n )}\n </div>\n );\n};\n\nNavigationLinks.propTypes = {\n /**\n * Links to be rendered in the center of the navigation header. It is an array of objects.\n * Each object should have the properties `key`, `to` and `label`. Other props will be passed on to the `Navlink` component from\n `react-router-dom`.\n */\n headerLinks: PropTypes.arrayOf(\n PropTypes.shape({\n key: PropTypes.string,\n to: PropTypes.string,\n label: PropTypes.string,\n })\n ),\n /**\n * Maximum number of links to be visible in the navigation header. Remaining links will be shown in a more dropdown.\n */\n maxVisibleLinks: PropTypes.number,\n};\n\nexport default NavigationLinks;\n","export const isAbsoluteUrl = url => /^https?:\\/\\//.test(url);\n","import classNames from \"classnames\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport PublishBlock from \"components/PublishBlock\";\n\nimport \"./navigation-header.scss\";\nimport { isAbsoluteUrl } from \"./utils\";\n\nconst RightBlock = ({\n isDraftBlockHidden,\n previewDraftUrl,\n isResetDraftButtonVisible,\n onResetClick,\n isResetting,\n isPublishDisabled,\n isPublishing,\n handlePublish,\n isPublishPreviewDisabled,\n previewPublishedUrl,\n isPublishButtonVisible,\n isResetAlertOpen,\n setIsResetAlertOpen,\n handleReset,\n publishAlertTitle,\n publishAlertDescription,\n publishButtonProps = {},\n}) => {\n const { t } = useTranslation();\n\n const renderDraftButtons = ({ ViewDraftButton, ResetDraftButton }) =>\n !isDraftBlockHidden && (\n <>\n <ViewDraftButton\n {...(isAbsoluteUrl(previewDraftUrl)\n ? { href: previewDraftUrl }\n : { to: previewDraftUrl })}\n />\n {isResetDraftButtonVisible && (\n <ResetDraftButton\n loading={isResetting}\n onClick={() => onResetClick()}\n />\n )}\n </>\n );\n\n const renderPublishButtons = ({ PublishButton, PublishPreviewButton }) => (\n <>\n {isPublishButtonVisible && (\n <PublishButton\n disabled={isPublishDisabled}\n loading={isPublishing}\n onClick={() => handlePublish()}\n {...publishButtonProps}\n />\n )}\n <PublishPreviewButton\n {...(isAbsoluteUrl(previewPublishedUrl)\n ? { href: previewPublishedUrl }\n : { to: previewPublishedUrl })}\n disabled={isPublishPreviewDisabled}\n className={classNames({\n \"standalone-publish-preview-button\": !isPublishButtonVisible,\n })}\n />\n </>\n );\n\n return (\n <>\n <PublishBlock {...{ renderDraftButtons, renderPublishButtons }} />\n <PublishBlock.Alert\n isOpen={isResetAlertOpen}\n isSubmitting={isResetting}\n message={\n publishAlertDescription ||\n t(\"neetoMolecules.navigationHeader.resetDescription\")\n }\n title={\n publishAlertTitle || t(\"neetoMolecules.navigationHeader.resetTitle\")\n }\n onClose={() => setIsResetAlertOpen(false)}\n onSubmit={handleReset}\n />\n </>\n );\n};\n\nRightBlock.propTypes = {\n /**\n * To show/hide the draft block.\n */\n isDraftBlockHidden: PropTypes.bool,\n /**\n * Draft preview URL, when the draft button is clicked user will be redirected to this URL.\n */\n previewDraftUrl: PropTypes.string,\n /**\n * Boolean to control the visibility of reset draft button.\n */\n isResetDraftButtonVisible: PropTypes.bool,\n /**\n * Callback function that will be called when the reset button is clicked.\n */\n onResetClick: PropTypes.func,\n /**\n * Setting this to `true` will show a spinner on the reset button. Use when the reset process is in progress.\n */\n isResetting: PropTypes.bool,\n /**\n * To disable the publish button.\n */\n isPublishDisabled: PropTypes.bool,\n /**\n * Setting this to `true` will show a spinner on the publish button. Use when the publish process is in progress.\n */\n isPublishing: PropTypes.bool,\n /**\n * Callback function that will be called when the publish button is clicked.\n */\n handlePublish: PropTypes.func,\n /**\n * To disable the publish preview button.\n */\n isPublishPreviewDisabled: PropTypes.bool,\n /**\n * Publish preview URL, when the preview publish button is clicked user will be redirected to this URL.\n */\n previewPublishedUrl: PropTypes.string,\n /**\n * Boolean to control whether the user have the ability to publish.\n */\n isPublishButtonVisible: PropTypes.bool,\n /**\n * Boolean to control whether the reset alert is open.\n */\n isResetAlertOpen: PropTypes.bool,\n /**\n * Handler to control the `isResetAlert` state variable.\n */\n setIsResetAlertOpen: PropTypes.func,\n /**\n * Callback function that will be called when the reset button is clicked.\n */\n handleReset: PropTypes.func,\n /**\n * Description to be shown in the publish alert\n */\n publishAlertDescription: PropTypes.string,\n /**\n * Title of the publish alert\n */\n publishAlertTitle: PropTypes.string,\n /**\n * Props to be passed to the publish button\n */\n publishButtonProps: PropTypes.object,\n};\n\nexport default RightBlock;\n","import { isPresent } from \"neetocist\";\nimport useBreakpoints from \"neetocommons/react-utils/useBreakpoints\";\nimport PropTypes from \"prop-types\";\nimport { filter, length } from \"ramda\";\n\nimport LeftBlock from \"./LeftBlock\";\nimport NavigationLinks from \"./Navigation\";\nimport RightBlock from \"./RightBlock\";\n\nconst NavigationHeader = ({\n leftActionBlock,\n navigationLinks,\n rightActionBlock,\n}) => {\n const { isSize } = useBreakpoints();\n const isMobile = isSize(\"mobile\");\n\n const numberOfChildren = length(\n filter(isPresent, [leftActionBlock, navigationLinks, rightActionBlock])\n );\n\n const gridStyle = {\n gridTemplateColumns: isMobile\n ? `repeat(${\n navigationLinks ? numberOfChildren - 1 : numberOfChildren\n }, auto)`\n : `repeat(${numberOfChildren}, 1fr)`,\n };\n\n return (\n <div className=\"w-full\">\n <div\n className=\"neeto-molecules-navigation-header neeto-ui-border-gray-200 neeto-ui-bg-white flex h-16 w-full flex-shrink-0 items-center overflow-x-auto border-b px-2 py-2 md:px-4 lg:px-6\"\n data-cy=\"navigation-header\"\n data-testid=\"navigation-header\"\n >\n <div className=\"grid w-full gap-4\" style={gridStyle}>\n {leftActionBlock}\n {!isMobile && navigationLinks}\n {rightActionBlock}\n </div>\n </div>\n {isMobile && (\n <div className=\"neeto-molecules-navigation-header neeto-ui-border-gray-200 neeto-ui-bg-white flex flex-shrink-0 items-center overflow-x-auto border-b px-4 py-2 lg:px-6\">\n {navigationLinks}\n </div>\n )}\n </div>\n );\n};\n\nNavigationHeader.LeftActionBlock = LeftBlock;\nNavigationHeader.NavigationLinks = NavigationLinks;\nNavigationHeader.RightActionBlock = RightBlock;\n\nNavigationHeader.propTypes = {\n /**\n * To specify the content to be rendered in the left side of the `NavigationHeader`.\n */\n leftActionBlock: PropTypes.node,\n /**\n * To specify the content to be rendered at the center of the `NavigationHeader`.\n */\n navigationLinks: PropTypes.node,\n /**\n * To specify the content to be rendered in the right side of the `NavigationHeader`.\n */\n rightActionBlock: PropTypes.node,\n};\n\nexport default NavigationHeader;\n"],"names":["DEFAULT_HOME_BUTTON_PROPS","tooltip","content","t","position","homeUrl","icon","_jsx","Home","LeftBlock","_ref","customHomeButtonProps","homeButtonProps","renameProps","children","mergeDeepRight","_jsxs","className","Tooltip","touch","Link","to","isPresent","Rename","_objectSpread","dropdownItems","value","Menu","Dropdown","MenuItem","NavigationLinks","headerLinks","_ref$maxVisibleLinks","maxVisibleLinks","_useLocation","useLocation","pathname","_useTranslation","useTranslation","visibleLinks","slice","overflowLinks","isMoreButtonActive","existsBy","map","headerLink","NavLink","activeClassName","concat","joinHyphenCase","key","Typography","component","lineHeight","style","weight","label","isNotEmpty","buttonStyle","buttonProps","classNames","active","Button","isActive","isAbsoluteUrl","url","test","RightBlock","isDraftBlockHidden","previewDraftUrl","isResetDraftButtonVisible","onResetClick","isResetting","isPublishDisabled","isPublishing","handlePublish","isPublishPreviewDisabled","previewPublishedUrl","isPublishButtonVisible","isResetAlertOpen","setIsResetAlertOpen","handleReset","publishAlertTitle","publishAlertDescription","_ref$publishButtonPro","publishButtonProps","renderDraftButtons","_ref2","ViewDraftButton","ResetDraftButton","_Fragment","href","loading","onClick","renderPublishButtons","_ref3","PublishButton","PublishPreviewButton","disabled","PublishBlock","Alert","isOpen","isSubmitting","message","title","onClose","onSubmit","NavigationHeader","leftActionBlock","navigationLinks","rightActionBlock","_useBreakpoints","useBreakpoints","isSize","isMobile","numberOfChildren","length","filter","gridStyle","gridTemplateColumns","LeftActionBlock","RightActionBlock"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAMA,yBAAyB,GAAG;AACvCC,EAAAA,OAAO,EAAE;AACPC,IAAAA,OAAO,EAAEC,CAAC,CAAC,sCAAsC,CAAC;AAClDC,IAAAA,QAAQ,EAAE,QAAA;GACX;AACDC,EAAAA,OAAO,EAAE,GAAG;AACZC,EAAAA,IAAI,eAAEC,GAAA,CAACC,IAAI,EAAE,EAAA,CAAA;AACf,CAAC;;;;ACAD,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,EAKT;AAAA,EAAA,IAJaC,qBAAqB,GAAAD,IAAA,CAAtCE,eAAe;IACfP,OAAO,GAAAK,IAAA,CAAPL,OAAO;IACPQ,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ,CAAA;AAER,EAAA,IAAMF,eAAe,GAAGG,cA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@
|
|
|
1
|
-
import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
|
|
2
|
-
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
2
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
|
-
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
6
|
-
import { useState, useEffect } from 'react';
|
|
7
3
|
import classnames from 'classnames';
|
|
4
|
+
import { dynamicArray, noop, isPresent } from '@bigbinary/neeto-cist';
|
|
8
5
|
import withT$1 from '@bigbinary/neeto-commons-frontend/react-utils/withT';
|
|
6
|
+
import { dayjs, dateFormat } from '@bigbinary/neeto-commons-frontend/utils';
|
|
9
7
|
import ExternalLink from '@bigbinary/neeto-icons/ExternalLink';
|
|
10
8
|
import Undo from '@bigbinary/neeto-icons/Undo';
|
|
9
|
+
import Clock from '@bigbinary/neeto-icons/Clock';
|
|
11
10
|
import Button from '@bigbinary/neetoui/Button';
|
|
12
11
|
import Tooltip from '@bigbinary/neetoui/Tooltip';
|
|
13
12
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
14
|
-
import { omit
|
|
13
|
+
import { omit } from 'ramda';
|
|
15
14
|
import { useTranslation, Trans } from 'react-i18next';
|
|
16
15
|
import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
17
16
|
import Alert from '@bigbinary/neetoui/Alert';
|
|
18
17
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
19
18
|
import { n } from './inject-css-DmrvuTKK.js';
|
|
20
|
-
import
|
|
19
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
20
|
+
import { useState, useEffect } from 'react';
|
|
21
21
|
import Pane from '@bigbinary/neetoui/Pane';
|
|
22
|
-
import Switch from '@bigbinary/neetoui/Switch';
|
|
23
|
-
import { dayjs } from '@bigbinary/neeto-commons-frontend/utils';
|
|
24
22
|
import Profile from '@bigbinary/neeto-team-members-frontend/Profile';
|
|
25
23
|
import DatePicker from '@bigbinary/neetoui/DatePicker';
|
|
26
24
|
import { globalProps as globalProps$1 } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
@@ -72,14 +70,6 @@ var disabledTime = function disabledTime(selectedDate) {
|
|
|
72
70
|
}
|
|
73
71
|
return {};
|
|
74
72
|
};
|
|
75
|
-
var getDefaultDate = function getDefaultDate() {
|
|
76
|
-
var currDate = dayjs();
|
|
77
|
-
currDate = currDate.hour(currDate.hour() + 1);
|
|
78
|
-
if (currDate.minute() > 30) {
|
|
79
|
-
currDate = currDate.hour(currDate.hour() + 1);
|
|
80
|
-
}
|
|
81
|
-
return currDate;
|
|
82
|
-
};
|
|
83
73
|
|
|
84
74
|
var Form = function Form(_ref) {
|
|
85
75
|
var _globalProps$user$tim, _globalProps$user;
|
|
@@ -136,69 +126,19 @@ var Form = function Form(_ref) {
|
|
|
136
126
|
});
|
|
137
127
|
};
|
|
138
128
|
|
|
139
|
-
var PublishLater = function PublishLater(_ref) {
|
|
140
|
-
var setDatetimeValue = _ref.setDatetimeValue,
|
|
141
|
-
datetimeValue = _ref.datetimeValue,
|
|
142
|
-
onClose = _ref.onClose,
|
|
143
|
-
isPublishLaterChecked = _ref.isPublishLaterChecked,
|
|
144
|
-
setIsPublishLaterChecked = _ref.setIsPublishLaterChecked;
|
|
145
|
-
var _useTranslation = useTranslation(),
|
|
146
|
-
t = _useTranslation.t;
|
|
147
|
-
var handleChangeSwitch = function handleChangeSwitch(event) {
|
|
148
|
-
var checked = event.target.checked;
|
|
149
|
-
setDatetimeValue(checked ? getDefaultDate() : "");
|
|
150
|
-
setIsPublishLaterChecked(checked);
|
|
151
|
-
};
|
|
152
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
153
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
154
|
-
className: "mb-6",
|
|
155
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
156
|
-
className: "flex w-full items-center space-x-2 py-1",
|
|
157
|
-
children: [/*#__PURE__*/jsx(Switch, {
|
|
158
|
-
checked: isPublishLaterChecked,
|
|
159
|
-
"data-cy": "publish-later-switch",
|
|
160
|
-
"data-testid": "publish-later-switch",
|
|
161
|
-
onChange: handleChangeSwitch
|
|
162
|
-
}), /*#__PURE__*/jsx(Typography, {
|
|
163
|
-
style: "h4",
|
|
164
|
-
weight: "medium",
|
|
165
|
-
children: t("neetoMolecules.publishBlock.publishLater")
|
|
166
|
-
})]
|
|
167
|
-
}), /*#__PURE__*/jsx(Typography, {
|
|
168
|
-
className: "mb-6",
|
|
169
|
-
style: "body3",
|
|
170
|
-
weight: "medium",
|
|
171
|
-
children: t("neetoMolecules.publishBlock.helperText")
|
|
172
|
-
})]
|
|
173
|
-
}), isPublishLaterChecked && /*#__PURE__*/jsx(Form, {
|
|
174
|
-
datetimeValue: datetimeValue,
|
|
175
|
-
onClose: onClose,
|
|
176
|
-
setDatetimeValue: setDatetimeValue
|
|
177
|
-
})]
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
|
|
181
129
|
var PublishSettings = withT(function (_ref) {
|
|
182
130
|
var t = _ref.t,
|
|
183
|
-
|
|
184
|
-
|
|
131
|
+
isOpen = _ref.isOpen,
|
|
132
|
+
onClose = _ref.onClose,
|
|
185
133
|
_ref$isSubmitting = _ref.isSubmitting,
|
|
186
134
|
isSubmitting = _ref$isSubmitting === void 0 ? false : _ref$isSubmitting,
|
|
187
135
|
_ref$onPublish = _ref.onPublish,
|
|
188
136
|
onPublish = _ref$onPublish === void 0 ? noop : _ref$onPublish,
|
|
189
137
|
datetimeValue = _ref.datetimeValue,
|
|
190
|
-
setDatetimeValue = _ref.setDatetimeValue
|
|
191
|
-
_ref$onCancel = _ref.onCancel,
|
|
192
|
-
onCancel = _ref$onCancel === void 0 ? noop : _ref$onCancel,
|
|
193
|
-
isPublishLaterChecked = _ref.isPublishLaterChecked,
|
|
194
|
-
setIsPublishLaterChecked = _ref.setIsPublishLaterChecked;
|
|
138
|
+
setDatetimeValue = _ref.setDatetimeValue;
|
|
195
139
|
return /*#__PURE__*/jsxs(Pane, {
|
|
196
|
-
isOpen:
|
|
197
|
-
onClose:
|
|
198
|
-
return onCancel({
|
|
199
|
-
onClose: _onClose
|
|
200
|
-
});
|
|
201
|
-
},
|
|
140
|
+
isOpen: isOpen,
|
|
141
|
+
onClose: onClose,
|
|
202
142
|
children: [/*#__PURE__*/jsx(Pane.Header, {
|
|
203
143
|
children: /*#__PURE__*/jsx(Typography, {
|
|
204
144
|
"data-cy": "publish-pane-heading",
|
|
@@ -206,17 +146,15 @@ var PublishSettings = withT(function (_ref) {
|
|
|
206
146
|
lineHeight: "normal",
|
|
207
147
|
style: "h2",
|
|
208
148
|
weight: "semibold",
|
|
209
|
-
children: t("neetoMolecules.publishBlock.
|
|
149
|
+
children: t("neetoMolecules.publishBlock.publishLater")
|
|
210
150
|
})
|
|
211
151
|
}), /*#__PURE__*/jsx(Pane.Body, {
|
|
212
152
|
children: /*#__PURE__*/jsx("div", {
|
|
213
153
|
className: "w-full space-y-1",
|
|
214
|
-
children: /*#__PURE__*/jsx(
|
|
154
|
+
children: /*#__PURE__*/jsx(Form, {
|
|
215
155
|
datetimeValue: datetimeValue,
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
setDatetimeValue: setDatetimeValue,
|
|
219
|
-
setIsPublishLaterChecked: setIsPublishLaterChecked
|
|
156
|
+
onClose: onClose,
|
|
157
|
+
setDatetimeValue: setDatetimeValue
|
|
220
158
|
})
|
|
221
159
|
})
|
|
222
160
|
}), /*#__PURE__*/jsxs(Pane.Footer, {
|
|
@@ -225,13 +163,11 @@ var PublishSettings = withT(function (_ref) {
|
|
|
225
163
|
"data-cy": "publish-submit-button",
|
|
226
164
|
"data-testid": "publish-submit-button",
|
|
227
165
|
disabled: isSubmitting,
|
|
166
|
+
label: t("neetoMolecules.publishBlock.publishLater"),
|
|
228
167
|
loading: isSubmitting,
|
|
229
|
-
label: isPublishLaterChecked ? t("neetoMolecules.publishBlock.publishLater") : t("neetoMolecules.publishBlock.publishNow"),
|
|
230
168
|
onClick: function onClick() {
|
|
231
169
|
return onPublish({
|
|
232
|
-
|
|
233
|
-
datetimeValue: datetimeValue,
|
|
234
|
-
onClose: _onClose
|
|
170
|
+
datetimeValue: datetimeValue
|
|
235
171
|
});
|
|
236
172
|
}
|
|
237
173
|
}), /*#__PURE__*/jsx(Button, {
|
|
@@ -239,19 +175,38 @@ var PublishSettings = withT(function (_ref) {
|
|
|
239
175
|
"data-testid": "publish-cancel-button",
|
|
240
176
|
label: t("neetoMolecules.common.actions.cancel"),
|
|
241
177
|
style: "text",
|
|
242
|
-
onClick:
|
|
243
|
-
return onCancel({
|
|
244
|
-
onClose: _onClose
|
|
245
|
-
});
|
|
246
|
-
}
|
|
178
|
+
onClick: onClose
|
|
247
179
|
})]
|
|
248
180
|
})]
|
|
249
181
|
});
|
|
250
182
|
});
|
|
251
183
|
|
|
184
|
+
var PublishSchedulePane = function PublishSchedulePane(_ref) {
|
|
185
|
+
var onPublish = _ref.onPublish,
|
|
186
|
+
onClose = _ref.onClose,
|
|
187
|
+
isSubmitting = _ref.isSubmitting,
|
|
188
|
+
datetime = _ref.datetime,
|
|
189
|
+
isOpen = _ref.isOpen;
|
|
190
|
+
var _useState = useState(datetime),
|
|
191
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
192
|
+
datetimeValue = _useState2[0],
|
|
193
|
+
setDatetimeValue = _useState2[1];
|
|
194
|
+
useEffect(function () {
|
|
195
|
+
setDatetimeValue(datetime);
|
|
196
|
+
}, [datetime]);
|
|
197
|
+
return /*#__PURE__*/jsx(PublishSettings, {
|
|
198
|
+
datetimeValue: datetimeValue,
|
|
199
|
+
isOpen: isOpen,
|
|
200
|
+
isSubmitting: isSubmitting,
|
|
201
|
+
onClose: onClose,
|
|
202
|
+
onPublish: onPublish,
|
|
203
|
+
setDatetimeValue: setDatetimeValue
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
|
|
252
207
|
var _excluded = ["t"],
|
|
253
208
|
_excluded2 = ["t"],
|
|
254
|
-
_excluded3 = ["
|
|
209
|
+
_excluded3 = ["t", "tooltipProps", "showTooltipWhenDisabled", "disabled"],
|
|
255
210
|
_excluded4 = ["t"];
|
|
256
211
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
257
212
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -287,107 +242,30 @@ var ResetDraftButton = withT$1(function (_ref2) {
|
|
|
287
242
|
}
|
|
288
243
|
}, omit(unUsedI18nProps, props)));
|
|
289
244
|
});
|
|
290
|
-
var PublishButton = function
|
|
291
|
-
var
|
|
245
|
+
var PublishButton = withT$1(function (_ref3) {
|
|
246
|
+
var t = _ref3.t,
|
|
247
|
+
tooltipProps = _ref3.tooltipProps,
|
|
292
248
|
_ref3$showTooltipWhen = _ref3.showTooltipWhenDisabled,
|
|
293
249
|
showTooltipWhenDisabled = _ref3$showTooltipWhen === void 0 ? false : _ref3$showTooltipWhen,
|
|
294
250
|
_ref3$disabled = _ref3.disabled,
|
|
295
251
|
disabled = _ref3$disabled === void 0 ? false : _ref3$disabled,
|
|
296
|
-
_ref3$publishPaneProp = _ref3.publishPaneProps,
|
|
297
|
-
publishPaneProps = _ref3$publishPaneProp === void 0 ? {} : _ref3$publishPaneProp,
|
|
298
|
-
onClick = _ref3.onClick,
|
|
299
252
|
props = _objectWithoutProperties(_ref3, _excluded3);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
317
|
-
isPublishLaterChecked = _useState6[0],
|
|
318
|
-
setIsPublishLaterChecked = _useState6[1];
|
|
319
|
-
var handleClick = /*#__PURE__*/function () {
|
|
320
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
321
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
322
|
-
while (1) switch (_context.prev = _context.next) {
|
|
323
|
-
case 0:
|
|
324
|
-
if (!isPublishLaterDisabled) {
|
|
325
|
-
_context.next = 5;
|
|
326
|
-
break;
|
|
327
|
-
}
|
|
328
|
-
_context.next = 3;
|
|
329
|
-
return onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
330
|
-
case 3:
|
|
331
|
-
_context.next = 7;
|
|
332
|
-
break;
|
|
333
|
-
case 5:
|
|
334
|
-
_context.next = 7;
|
|
335
|
-
return onClick === null || onClick === void 0 ? void 0 : onClick({
|
|
336
|
-
setIsSettingsPaneOpen: setIsSettingsPaneOpen
|
|
337
|
-
});
|
|
338
|
-
case 7:
|
|
339
|
-
if (!isPublishLaterDisabled) {
|
|
340
|
-
_context.next = 9;
|
|
341
|
-
break;
|
|
342
|
-
}
|
|
343
|
-
return _context.abrupt("return");
|
|
344
|
-
case 9:
|
|
345
|
-
setDatetimeValue(datetime || "");
|
|
346
|
-
setIsPublishLaterChecked(!!datetime);
|
|
347
|
-
case 11:
|
|
348
|
-
case "end":
|
|
349
|
-
return _context.stop();
|
|
350
|
-
}
|
|
351
|
-
}, _callee);
|
|
352
|
-
}));
|
|
353
|
-
return function handleClick() {
|
|
354
|
-
return _ref4.apply(this, arguments);
|
|
355
|
-
};
|
|
356
|
-
}();
|
|
357
|
-
useEffect(function () {
|
|
358
|
-
setDatetimeValue(datetime);
|
|
359
|
-
}, [datetime]);
|
|
360
|
-
return /*#__PURE__*/jsxs(Fragment, {
|
|
361
|
-
children: [/*#__PURE__*/jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
|
|
362
|
-
disabled: !tooltipProps || !showTooltipWhenDisabled && disabled,
|
|
363
|
-
children: /*#__PURE__*/jsx("div", {
|
|
364
|
-
children: /*#__PURE__*/jsx(Button, _objectSpread({
|
|
365
|
-
"data-cy": "publish-button",
|
|
366
|
-
"data-testid": "publish-button",
|
|
367
|
-
label: t("neetoMolecules.common.actions.publish"),
|
|
368
|
-
onClick: handleClick
|
|
369
|
-
}, _objectSpread({
|
|
370
|
-
disabled: disabled
|
|
371
|
-
}, props)))
|
|
372
|
-
})
|
|
373
|
-
})), /*#__PURE__*/jsx(PublishSettings, {
|
|
374
|
-
datetimeValue: datetimeValue,
|
|
375
|
-
isPublishLaterChecked: isPublishLaterChecked,
|
|
376
|
-
isSettingsPaneOpen: isSettingsPaneOpen,
|
|
377
|
-
isSubmitting: isSubmitting,
|
|
378
|
-
onCancel: onCancel,
|
|
379
|
-
onPublish: onPublish,
|
|
380
|
-
setDatetimeValue: setDatetimeValue,
|
|
381
|
-
setIsPublishLaterChecked: setIsPublishLaterChecked,
|
|
382
|
-
onClose: function onClose() {
|
|
383
|
-
return setIsSettingsPaneOpen(false);
|
|
384
|
-
}
|
|
385
|
-
})]
|
|
386
|
-
});
|
|
387
|
-
};
|
|
388
|
-
var PublishPreviewButton = withT$1(function (_ref5) {
|
|
389
|
-
var t = _ref5.t,
|
|
390
|
-
props = _objectWithoutProperties(_ref5, _excluded4);
|
|
253
|
+
return /*#__PURE__*/jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipProps), {}, {
|
|
254
|
+
disabled: !tooltipProps || !showTooltipWhenDisabled && disabled,
|
|
255
|
+
children: /*#__PURE__*/jsx("div", {
|
|
256
|
+
children: /*#__PURE__*/jsx(Button, _objectSpread({
|
|
257
|
+
"data-cy": "publish-button",
|
|
258
|
+
"data-testid": "publish-button",
|
|
259
|
+
label: t("neetoMolecules.common.actions.publish")
|
|
260
|
+
}, _objectSpread({
|
|
261
|
+
disabled: disabled
|
|
262
|
+
}, omit(unUsedI18nProps, props))))
|
|
263
|
+
})
|
|
264
|
+
}));
|
|
265
|
+
});
|
|
266
|
+
var PublishPreviewButton = withT$1(function (_ref4) {
|
|
267
|
+
var t = _ref4.t,
|
|
268
|
+
props = _objectWithoutProperties(_ref4, _excluded4);
|
|
391
269
|
return /*#__PURE__*/jsx(Button, _objectSpread({
|
|
392
270
|
"data-cy": "publish-preview-button",
|
|
393
271
|
"data-testid": "publish-preview-button",
|
|
@@ -403,11 +281,12 @@ var PublishPreviewButton = withT$1(function (_ref5) {
|
|
|
403
281
|
}
|
|
404
282
|
}, omit(unUsedI18nProps, props)));
|
|
405
283
|
});
|
|
406
|
-
var PublishBlock = function PublishBlock(
|
|
407
|
-
var renderDraftButtons =
|
|
408
|
-
renderPublishButtons =
|
|
409
|
-
|
|
410
|
-
|
|
284
|
+
var PublishBlock = function PublishBlock(_ref5) {
|
|
285
|
+
var renderDraftButtons = _ref5.renderDraftButtons,
|
|
286
|
+
renderPublishButtons = _ref5.renderPublishButtons,
|
|
287
|
+
datetime = _ref5.datetime;
|
|
288
|
+
var _useTranslation = useTranslation(),
|
|
289
|
+
t = _useTranslation.t;
|
|
411
290
|
var draftBlockButtons = renderDraftButtons({
|
|
412
291
|
ViewDraftButton: ViewDraftButton,
|
|
413
292
|
ResetDraftButton: ResetDraftButton
|
|
@@ -416,7 +295,15 @@ var PublishBlock = function PublishBlock(_ref6) {
|
|
|
416
295
|
className: "neeto-molecules-publish-block",
|
|
417
296
|
"data-cy": "neeto-molecules-publish-block",
|
|
418
297
|
"data-testid": "neeto-molecules-publish-block",
|
|
419
|
-
children: [
|
|
298
|
+
children: [isPresent(datetime) && /*#__PURE__*/jsx(Tooltip, {
|
|
299
|
+
position: "bottom",
|
|
300
|
+
content: t("neetoMolecules.publishBlock.tooltip.publishLater", {
|
|
301
|
+
date: dateFormat.dateTime(datetime)
|
|
302
|
+
}),
|
|
303
|
+
children: /*#__PURE__*/jsx("div", {
|
|
304
|
+
children: /*#__PURE__*/jsx(Clock, {})
|
|
305
|
+
})
|
|
306
|
+
}), draftBlockButtons && /*#__PURE__*/jsxs(Fragment, {
|
|
420
307
|
children: [/*#__PURE__*/jsxs("div", {
|
|
421
308
|
className: "flex items-center gap-2",
|
|
422
309
|
children: [/*#__PURE__*/jsx(Typography, {
|
|
@@ -442,6 +329,7 @@ var PublishBlock = function PublishBlock(_ref6) {
|
|
|
442
329
|
});
|
|
443
330
|
};
|
|
444
331
|
PublishBlock.Alert = AlertBlock;
|
|
332
|
+
PublishBlock.SchedulePane = PublishSchedulePane;
|
|
445
333
|
|
|
446
334
|
export { PublishBlock as default };
|
|
447
335
|
//# sourceMappingURL=PublishBlock.js.map
|