@bigbinary/neeto-molecules 4.0.59 → 4.0.61
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/FloatingActionMenu.js +160 -47
- package/dist/FloatingActionMenu.js.map +1 -1
- package/dist/NavigationHeader.js +88 -48
- package/dist/NavigationHeader.js.map +1 -1
- package/dist/cjs/FloatingActionMenu.js +157 -44
- package/dist/cjs/FloatingActionMenu.js.map +1 -1
- package/dist/cjs/NavigationHeader.js +88 -48
- package/dist/cjs/NavigationHeader.js.map +1 -1
- package/package.json +1 -1
- package/types/NavigationHeader.d.ts +66 -4
|
@@ -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(({ key, label, disabled, ...rest }) => (\n <NavLink\n activeClassName=\"active\"\n data-cy={`${joinHyphenCase(key)}-tab`}\n data-testid={`${joinHyphenCase(key)}-tab`}\n key={key}\n className={classNames(\n \"neeto-molecules-navigation-header__link px-2 capitalize no-underline md:px-0\",\n { disabled }\n )}\n onClick={e => disabled && e.preventDefault()}\n {...rest}\n >\n <Typography\n component=\"span\"\n lineHeight=\"normal\"\n style=\"h4\"\n weight=\"semibold\"\n >\n {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(({ key, to, label, disabled, ...rest }) => (\n <MenuItem.Button\n {...{ to }}\n data-cy={`${joinHyphenCase(key)}-more-tab`}\n isActive={to === pathname}\n isDisabled={disabled}\n key={key}\n onClick={e => disabled && e.preventDefault()}\n {...rest}\n >\n {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","_ref2","key","label","disabled","rest","_objectWithoutProperties","_excluded","NavLink","activeClassName","concat","joinHyphenCase","classNames","onClick","e","preventDefault","Typography","component","lineHeight","style","weight","isNotEmpty","buttonStyle","buttonProps","active","_ref3","_excluded2","_createElement","Button","isActive","isDisabled","isAbsoluteUrl","url","test","RightBlock","isDraftBlockHidden","previewDraftUrl","isResetDraftButtonVisible","onResetClick","isResetting","isPublishDisabled","isPublishing","handlePublish","isPublishPreviewDisabled","previewPublishedUrl","isPublishButtonVisible","isResetAlertOpen","setIsResetAlertOpen","handleReset","publishAlertTitle","publishAlertDescription","_ref$publishButtonPro","publishButtonProps","renderDraftButtons","ViewDraftButton","ResetDraftButton","_Fragment","href","loading","renderPublishButtons","PublishButton","PublishPreviewButton","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;GACX;AACDC,EAAAA,OAAO,EAAE,GAAG;AACZC,EAAAA,IAAI,eAAEC,GAAA,CAACC,IAAI,EAAA,EAAE;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;AAER,EAAA,IAAMF,eAAe,GAAGG,cAAc,CACpCf,y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AAe,EAC5BC,gBAAgB;OACd;AAAC,KACH,CAAC,EACLI,QAAQ,iBACPlH,GAAA,CAAA,KAAA,EAAA;AAAKU,MAAAA,SAAS,EAAC,yJAAyJ;AAAAH,MAAAA,QAAA,EACrKsG;AAAe,KACb,CACN;AAAA,GACE,CAAC;AAEV;AAEAF,gBAAgB,CAACa,eAAe,GAAGtH,SAAS;AAC5CyG,gBAAgB,CAACpF,eAAe,GAAGA,eAAe;AAClDoF,gBAAgB,CAACc,gBAAgB,GAAGlD,UAAU;;;;"}
|
|
1
|
+
{"version":3,"file":"NavigationHeader.js","sources":["../src/components/NavigationHeader/constants.jsx","../src/components/NavigationHeader/LeftBlock.jsx","../src/components/NavigationHeader/OverflowLinks.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 } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\nimport { useLocation } from \"react-router-dom\";\n\nconst { Menu, MenuItem } = Dropdown;\n\nconst OverflowLinks = ({ overflowLinks }) => {\n const { pathname } = useLocation();\n const { t } = useTranslation();\n\n const isMoreButtonActive = existsBy({ to: pathname }, overflowLinks);\n\n if (!isNotEmpty(overflowLinks)) {\n return null;\n }\n\n return (\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(({ key, to, label, disabled, ...rest }) => {\n const isActive = to === pathname;\n const menuButton = (\n <MenuItem.Button\n {...{ isActive, to }}\n data-cy={`${joinHyphenCase(key)}-more-tab`}\n isDisabled={disabled}\n key={key}\n onClick={e => disabled && e.preventDefault()}\n {...rest}\n >\n {label}\n </MenuItem.Button>\n );\n\n if (\n isActive &&\n rest.moreOptions &&\n isNotEmpty(rest.moreOptions.menuItems)\n ) {\n return (\n <Dropdown\n customTarget={menuButton}\n key={`${key}-nested-dropdown`}\n position=\"right-start\"\n trigger=\"hover\"\n >\n <Menu>\n {rest.moreOptions.menuItems.map(\n ({ key, label, ...itemProps }) => (\n <MenuItem.Button key={key} {...itemProps}>\n {label}\n </MenuItem.Button>\n )\n )}\n </Menu>\n </Dropdown>\n );\n }\n\n return menuButton;\n })}\n </Menu>\n </Dropdown>\n );\n};\n\nOverflowLinks.propTypes = {\n /**\n * Array of overflow links to be displayed in the more dropdown\n */\n overflowLinks: PropTypes.arrayOf(\n PropTypes.shape({\n key: PropTypes.string,\n to: PropTypes.string,\n label: PropTypes.string,\n disabled: PropTypes.bool,\n moreOptions: PropTypes.shape({\n menuItems: PropTypes.arrayOf(\n PropTypes.shape({\n key: PropTypes.string,\n label: PropTypes.string,\n onClick: PropTypes.func,\n disabled: PropTypes.bool,\n isDisabled: PropTypes.bool,\n tooltipProps: PropTypes.shape({\n content: PropTypes.string,\n }),\n })\n ),\n }),\n })\n ),\n};\n\nexport default OverflowLinks;\n","import classNames from \"classnames\";\nimport { joinHyphenCase } from \"neetocommons/utils/general\";\nimport { Typography } from \"neetoui\";\nimport PropTypes from \"prop-types\";\nimport { NavLink, useLocation } from \"react-router-dom\";\n\nimport MoreDropdown from \"components/MoreDropdown\";\n\nimport OverflowLinks from \"./OverflowLinks\";\n\nconst NavigationLinks = ({ headerLinks, maxVisibleLinks = 5 }) => {\n const { pathname } = useLocation();\n\n const visibleLinks = headerLinks.slice(0, maxVisibleLinks);\n const overflowLinks = headerLinks.slice(maxVisibleLinks);\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(\n ({\n className = \"\",\n key,\n label,\n disabled,\n labelProps,\n moreOptions,\n ...rest\n }) => (\n <NavLink\n activeClassName=\"active\"\n data-cy={`${joinHyphenCase(key)}-tab`}\n data-testid={`${joinHyphenCase(key)}-tab`}\n key={key}\n className={classNames(\n \"neeto-molecules-navigation-header__link px-2 capitalize no-underline md:px-0\",\n className,\n { disabled }\n )}\n onClick={e => disabled && e.preventDefault()}\n {...rest}\n >\n <Typography\n component=\"span\"\n lineHeight=\"normal\"\n style=\"h4\"\n weight=\"semibold\"\n {...(labelProps || {})}\n >\n {label}\n </Typography>\n {(rest.isActive?.() || rest.to === pathname) && moreOptions && (\n <MoreDropdown {...moreOptions} />\n )}\n </NavLink>\n )\n )}\n <OverflowLinks {...{ overflowLinks }} />\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 className: PropTypes.string,\n labelProps: PropTypes.shape({ lineHeight: PropTypes.string }),\n moreOptions: PropTypes.shape({\n isVertical: PropTypes.bool,\n dropdownButtonProps: PropTypes.shape({\n size: PropTypes.string,\n className: PropTypes.string,\n }),\n menuItems: PropTypes.arrayOf(\n PropTypes.shape({\n key: PropTypes.string,\n label: PropTypes.string,\n onClick: PropTypes.func,\n disabled: PropTypes.bool,\n isDisabled: PropTypes.bool,\n tooltipProps: PropTypes.shape({\n content: PropTypes.string,\n }),\n })\n ),\n }),\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","OverflowLinks","overflowLinks","_useLocation","useLocation","pathname","_useTranslation","useTranslation","isMoreButtonActive","existsBy","isNotEmpty","buttonStyle","label","buttonProps","classNames","active","map","_ref2","key","disabled","rest","_objectWithoutProperties","_excluded","isActive","menuButton","_createElement","Button","concat","joinHyphenCase","isDisabled","onClick","e","preventDefault","moreOptions","menuItems","customTarget","trigger","_ref3","itemProps","_excluded2","NavigationLinks","headerLinks","_ref$maxVisibleLinks","maxVisibleLinks","visibleLinks","slice","_rest$isActive","_ref2$className","labelProps","NavLink","activeClassName","Typography","component","lineHeight","style","weight","call","MoreDropdown","isAbsoluteUrl","url","test","RightBlock","isDraftBlockHidden","previewDraftUrl","isResetDraftButtonVisible","onResetClick","isResetting","isPublishDisabled","isPublishing","handlePublish","isPublishPreviewDisabled","previewPublishedUrl","isPublishButtonVisible","isResetAlertOpen","setIsResetAlertOpen","handleReset","publishAlertTitle","publishAlertDescription","_ref$publishButtonPro","publishButtonProps","renderDraftButtons","ViewDraftButton","ResetDraftButton","_Fragment","href","loading","renderPublishButtons","PublishButton","PublishPreviewButton","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;GACX;AACDC,EAAAA,OAAO,EAAE,GAAG;AACZC,EAAAA,IAAI,eAAEC,GAAA,CAACC,IAAI,EAAA,EAAE;AACf,CAAC;;;;ACAD,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAAC,IAAA,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,gBAAgB,GAAGlD,UAAU;;;;"}
|
|
@@ -21,12 +21,12 @@ var Input = require('@bigbinary/neetoui/Input');
|
|
|
21
21
|
var Typography = require('@bigbinary/neetoui/Typography');
|
|
22
22
|
var reactI18next = require('react-i18next');
|
|
23
23
|
var Spinner = require('@bigbinary/neetoui/Spinner');
|
|
24
|
-
var reactQuery = require('@tanstack/react-query');
|
|
25
|
-
var axios = require('axios');
|
|
26
24
|
var Neeto = require('@bigbinary/neeto-icons/typeface-logos/Neeto');
|
|
27
25
|
var AppIcons = require('@bigbinary/neeto-icons/typeface-logos');
|
|
28
26
|
var injectCss = require('./inject-css-B6qYtOJe.js');
|
|
29
27
|
var jsxRuntime = require('react/jsx-runtime');
|
|
28
|
+
var reactQuery = require('@tanstack/react-query');
|
|
29
|
+
var axios = require('axios');
|
|
30
30
|
var i18next = require('i18next');
|
|
31
31
|
var Book = require('@bigbinary/neeto-icons/Book');
|
|
32
32
|
var Community = require('@bigbinary/neeto-icons/Community');
|
|
@@ -70,44 +70,32 @@ function _interopNamespaceDefault(e) {
|
|
|
70
70
|
|
|
71
71
|
var AppIcons__namespace = /*#__PURE__*/_interopNamespaceDefault(AppIcons);
|
|
72
72
|
|
|
73
|
-
var
|
|
74
|
-
return axios.get("/api/v1/neeto_apps");
|
|
75
|
-
};
|
|
76
|
-
var neetoAppsApi = {
|
|
77
|
-
fetch: fetch$1
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
var QUERY_KEYS$1 = {
|
|
81
|
-
NEETO_APPS_LIST: "neeto-apps-list"
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
function ownKeys$5(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; }
|
|
85
|
-
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
86
|
-
var useFetchNeetoApps = function useFetchNeetoApps(options) {
|
|
87
|
-
return reactQuery.useQuery(_objectSpread$5({
|
|
88
|
-
queryKey: [QUERY_KEYS$1.NEETO_APPS_LIST],
|
|
89
|
-
queryFn: neetoAppsApi.fetch
|
|
90
|
-
}, options));
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
var css$1 = ".neeto-molecules-product-switcher__wrapper{align-items:flex-start;background-color:rgb(var(--neeto-ui-white));display:flex;flex-direction:column;justify-content:flex-start;max-width:100%;overflow-y:auto;padding:24px;position:relative;transition:all .3s;width:100%}@media screen and (max-width:768px){.neeto-molecules-product-switcher__wrapper{padding:16px}}.neeto-molecules-product-switcher__grid{grid-gap:12px;display:grid;gap:12px;grid-template-columns:repeat(auto-fill,minmax(288px,1fr))}@media only screen and (max-width:992px){.neeto-molecules-product-switcher__grid{grid-template-columns:repeat(auto-fill,minmax(248px,1fr))}}@media only screen and (max-width:640px){.neeto-molecules-product-switcher__grid{grid-template-columns:repeat(auto-fill,minmax(100%,1fr))}}.neeto-molecules-product-switcher__header{align-items:center;display:flex;gap:32px;justify-content:space-between;margin-bottom:32px;position:relative;width:100%}@media only screen and (max-width:768px){.neeto-molecules-product-switcher__header{align-items:flex-start;flex-direction:column;gap:24px}}@media only screen and (max-width:640px){.neeto-molecules-product-switcher__header h1{font-size:24px}}@media only screen and (max-width:768px){.neeto-molecules-product-switcher_modal-container .neeto-molecules-product-switcher__header-mobile{align-items:flex-start;margin-bottom:24px}}.neeto-molecules-product-switcher_modal-container .neeto-molecules-product-switcher__wrapper{padding:0}.neeto-molecules-product-switcher__close-btn{position:absolute;right:12px;top:12px}.neeto-molecules-product-switcher__search-wrapper{flex-grow:1}@media only screen and (min-width:992px){.neeto-molecules-product-switcher__search-wrapper{flex-grow:0;width:296px}}.neeto-molecules-product-switcher__body{display:flex;flex-direction:column;font-size:var(--neeto-ui-text-sm);gap:12px;margin-bottom:24px;width:100%}.neeto-molecules-product-switcher-link{background-color:rgb(var(--neeto-ui-white));border-color:rgb(var(--neeto-ui-gray-200));border-radius:var(--neeto-ui-rounded-lg);border-style:solid;border-width:1px;cursor:pointer;display:flex;flex-direction:column;gap:16px;max-width:100%;padding:10px 8px;text-decoration:none;transition:all .3s ease-in-out;width:100%}.neeto-molecules-product-switcher-link:focus,.neeto-molecules-product-switcher-link:focus-visible{outline:none}.neeto-molecules-product-switcher-link:focus-visible{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-product-switcher-link:not(.neeto-molecules-product-switcher-link--active):hover{border-color:rgb(var(--neeto-ui-primary-500))}.neeto-molecules-product-switcher-link--active{background-color:rgb(var(--neeto-ui-primary-50));border-color:rgb(var(--neeto-ui-primary-500))}.neeto-molecules-product-switcher-link__icon-holder{flex-grow:1;flex-shrink:0}.neeto-molecules-product-switcher-link__icon-holder svg{height:36px;width:auto}.neeto-molecules-product-switcher-link__icon-holder .neeto-molecules-product-switcher-link__icon-default{height:24px}.neeto-molecules-product-switcher-link__content{flex-shrink:0}.neeto-molecules-product-switcher-link__content span{display:block}.neeto-molecules-product-switcher_modal{z-index:100000}.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper--fullscreen{display:flex;flex-direction:column;height:100dvh!important;width:100vw!important}.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper--fullscreen .neeto-ui-modal__header{flex-shrink:0}.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper--fullscreen .neeto-ui-modal__body{--neeto-ui-modal-body-padding-top:24px;flex-grow:1;min-height:0;overflow-y:auto}.neeto-ui-theme--dark .neeto-molecules-product-switcher__wrapper [data-dark-mode-color=true]{fill:rgb(var(--neeto-ui-black))}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal{--neeto-molecules-product-switcher-modal-padding-y:24px;align-items:flex-start;padding-bottom:var(--neeto-molecules-product-switcher-modal-padding-y);padding-top:var(--neeto-molecules-product-switcher-modal-padding-y)}@media only screen and (min-width:1024px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal{--neeto-molecules-product-switcher-modal-padding-y:40px}}@media only screen and (min-width:1536px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal{--neeto-molecules-product-switcher-modal-padding-y:80px}}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large{--neeto-ui-modal-body-padding-top:24px;--neeto-ui-modal-body-padding-bottom:24px;--neeto-ui-modal-close-btn-top:12px;--neeto-ui-modal-close-btn-right:12px;--neeto-ui-modal-body-padding-x:0;--neeto-ui-text-h1:24px}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher-link__icon-holder svg{height:32px}@media only screen and (min-width:1024px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large{--neeto-ui-modal-wrapper-width:960px}}@media only screen and (min-width:1280px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large{--neeto-ui-modal-wrapper-width:1024px}}@media only screen and (min-width:1536px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large{--neeto-ui-modal-wrapper-width:1280px}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher-link__icon-holder svg{height:36px}}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__header{background-color:rgb(var(--neeto-ui-white));margin-bottom:32px;padding-left:24px;padding-right:56px}@media only screen and (max-width:768px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__header{gap:16px;margin-bottom:16px}}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__body{height:calc(100vh - var(--neeto-molecules-product-switcher-modal-padding-y) - 164px);margin-bottom:0;overflow-y:auto;padding-left:24px;padding-right:24px}@media only screen and (max-width:768px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__body{height:calc(90vh - var(--neeto-molecules-product-switcher-modal-padding-y) - 164px)}}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-ui-modal__close{z-index:2}";
|
|
73
|
+
var css$1 = ".neeto-molecules-product-switcher__wrapper{align-items:flex-start;background-color:rgb(var(--neeto-ui-white));display:flex;flex-direction:column;justify-content:flex-start;max-width:100%;overflow-y:auto;padding:24px;position:relative;transition:all .3s;width:100%}@media screen and (max-width:768px){.neeto-molecules-product-switcher__wrapper{padding:16px}}.neeto-molecules-product-switcher__grid{grid-gap:12px;display:grid;gap:12px;grid-template-columns:repeat(auto-fill,minmax(288px,1fr))}@media only screen and (max-width:992px){.neeto-molecules-product-switcher__grid{grid-template-columns:repeat(auto-fill,minmax(248px,1fr))}}@media only screen and (max-width:640px){.neeto-molecules-product-switcher__grid{grid-template-columns:repeat(auto-fill,minmax(100%,1fr))}}.neeto-molecules-product-switcher__header{align-items:center;display:flex;gap:32px;justify-content:space-between;margin-bottom:32px;position:relative;width:100%}@media only screen and (max-width:768px){.neeto-molecules-product-switcher__header{align-items:flex-start;flex-direction:column;gap:24px}}@media only screen and (max-width:640px){.neeto-molecules-product-switcher__header h1{font-size:24px}}@media only screen and (max-width:768px){.neeto-molecules-product-switcher_modal-container .neeto-molecules-product-switcher__header-mobile{align-items:flex-start;margin-bottom:24px}}.neeto-molecules-product-switcher_modal-container .neeto-molecules-product-switcher__wrapper{padding:0}.neeto-molecules-product-switcher__close-btn{position:absolute;right:12px;top:12px}.neeto-molecules-product-switcher__search-wrapper{flex-grow:1}@media only screen and (min-width:992px){.neeto-molecules-product-switcher__search-wrapper{flex-grow:0;width:296px}}.neeto-molecules-product-switcher__body{display:flex;flex-direction:column;font-size:var(--neeto-ui-text-sm);gap:12px;margin-bottom:24px;width:100%}.neeto-molecules-product-switcher-link{background-color:rgb(var(--neeto-ui-white));border-color:rgb(var(--neeto-ui-gray-200));border-radius:var(--neeto-ui-rounded-lg);border-style:solid;border-width:1px;cursor:pointer;display:flex;flex-direction:column;gap:16px;max-width:100%;padding:10px 8px;text-decoration:none;transition:all .3s ease-in-out;width:100%}.neeto-molecules-product-switcher-link:focus,.neeto-molecules-product-switcher-link:focus-visible{outline:none}.neeto-molecules-product-switcher-link:focus-visible{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-product-switcher-link:not(.neeto-molecules-product-switcher-link--active):hover{border-color:rgb(var(--neeto-ui-primary-500))}.neeto-molecules-product-switcher-link--active{background-color:rgb(var(--neeto-ui-primary-50));border-color:rgb(var(--neeto-ui-primary-500))}.neeto-molecules-product-switcher-link--highlighted{background-color:rgb(var(--neeto-ui-gray-200))}.neeto-molecules-product-switcher-link__icon-holder{flex-grow:1;flex-shrink:0}.neeto-molecules-product-switcher-link__icon-holder svg{height:36px;width:auto}.neeto-molecules-product-switcher-link__icon-holder .neeto-molecules-product-switcher-link__icon-default{height:24px}.neeto-molecules-product-switcher-link__content{flex-shrink:0}.neeto-molecules-product-switcher-link__content span{display:block}.neeto-molecules-product-switcher_modal{z-index:100000}.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper--fullscreen{display:flex;flex-direction:column;height:100dvh!important;width:100vw!important}.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper--fullscreen .neeto-ui-modal__header{flex-shrink:0}.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper--fullscreen .neeto-ui-modal__body{--neeto-ui-modal-body-padding-top:24px;flex-grow:1;min-height:0;overflow-y:auto}.neeto-ui-theme--dark .neeto-molecules-product-switcher__wrapper [data-dark-mode-color=true]{fill:rgb(var(--neeto-ui-black))}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal{--neeto-molecules-product-switcher-modal-padding-y:24px;align-items:flex-start;padding-bottom:var(--neeto-molecules-product-switcher-modal-padding-y);padding-top:var(--neeto-molecules-product-switcher-modal-padding-y)}@media only screen and (min-width:1024px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal{--neeto-molecules-product-switcher-modal-padding-y:40px}}@media only screen and (min-width:1536px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal{--neeto-molecules-product-switcher-modal-padding-y:80px}}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large{--neeto-ui-modal-body-padding-top:24px;--neeto-ui-modal-body-padding-bottom:24px;--neeto-ui-modal-close-btn-top:12px;--neeto-ui-modal-close-btn-right:12px;--neeto-ui-modal-body-padding-x:0;--neeto-ui-text-h1:24px}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher-link__icon-holder svg{height:32px}@media only screen and (min-width:1024px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large{--neeto-ui-modal-wrapper-width:960px}}@media only screen and (min-width:1280px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large{--neeto-ui-modal-wrapper-width:1024px}}@media only screen and (min-width:1536px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large{--neeto-ui-modal-wrapper-width:1280px}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher-link__icon-holder svg{height:36px}}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__header{background-color:rgb(var(--neeto-ui-white));margin-bottom:32px;padding-left:24px;padding-right:56px}@media only screen and (max-width:768px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__header{gap:16px;margin-bottom:16px}}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__body{height:calc(100dvh - var(--neeto-molecules-product-switcher-modal-padding-y)*2 - 124px);margin-bottom:0;overflow-y:auto;padding-left:24px;padding-right:24px}@media only screen and (max-width:768px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__body{height:calc(90dvh - var(--neeto-molecules-product-switcher-modal-padding-y)*2 - 124px)}}.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-ui-modal__close{z-index:2}@media only screen and (min-width:1280px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__search-wrapper{width:420px}}@media only screen and (min-width:1536px){.neeto-ui-modal__backdrop.neeto-molecules-product-switcher_modal .neeto-ui-modal__wrapper.neeto-ui-modal__wrapper--large .neeto-molecules-product-switcher__search-wrapper{width:500px}}";
|
|
94
74
|
injectCss.n(css$1,{});
|
|
95
75
|
|
|
76
|
+
var _excluded$2 = ["name", "description", "url", "isHighlighted"];
|
|
77
|
+
function ownKeys$6(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; }
|
|
78
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
96
79
|
var ProductLink = function ProductLink(_ref) {
|
|
97
80
|
var name = _ref.name,
|
|
98
81
|
description = _ref.description,
|
|
99
|
-
url = _ref.url
|
|
82
|
+
url = _ref.url,
|
|
83
|
+
_ref$isHighlighted = _ref.isHighlighted,
|
|
84
|
+
isHighlighted = _ref$isHighlighted === void 0 ? false : _ref$isHighlighted,
|
|
85
|
+
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
100
86
|
var appName = "Neeto".concat(name.charAt(0)).concat(name.slice(1).toLowerCase());
|
|
101
87
|
var AppIcon = AppIcons__namespace[appName];
|
|
102
|
-
return /*#__PURE__*/jsxRuntime.jsxs("a", {
|
|
88
|
+
return /*#__PURE__*/jsxRuntime.jsxs("a", _objectSpread$6(_objectSpread$6({
|
|
103
89
|
"data-cy": "".concat(name, "-app-link"),
|
|
104
|
-
"data-
|
|
90
|
+
"data-testid": "neetoapp-link-".concat(name),
|
|
105
91
|
href: url,
|
|
106
92
|
rel: "noreferrer",
|
|
107
93
|
target: "_blank",
|
|
108
94
|
className: classnames("neeto-molecules-product-switcher-link", {
|
|
109
|
-
"neeto-molecules-product-switcher-link--active": globalProps.appName.includes(name)
|
|
110
|
-
|
|
95
|
+
"neeto-molecules-product-switcher-link--active": globalProps.appName.includes(name),
|
|
96
|
+
"neeto-molecules-product-switcher-link--highlighted": isHighlighted
|
|
97
|
+
})
|
|
98
|
+
}, props), {}, {
|
|
111
99
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
112
100
|
className: "neeto-molecules-product-switcher-link__icon-holder",
|
|
113
101
|
children: AppIcon ? /*#__PURE__*/jsxRuntime.jsx(AppIcon, {}) : /*#__PURE__*/jsxRuntime.jsx(Neeto, {
|
|
@@ -123,24 +111,18 @@ var ProductLink = function ProductLink(_ref) {
|
|
|
123
111
|
children: description
|
|
124
112
|
})
|
|
125
113
|
})]
|
|
126
|
-
});
|
|
114
|
+
}));
|
|
127
115
|
};
|
|
128
116
|
var ProductLink$1 = /*#__PURE__*/React.memo(ProductLink);
|
|
129
117
|
|
|
130
|
-
function ownKeys$
|
|
131
|
-
function _objectSpread$
|
|
118
|
+
function ownKeys$5(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; }
|
|
119
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
132
120
|
var Content = function Content(_ref) {
|
|
133
|
-
var
|
|
121
|
+
var highlightedIndex = _ref.highlightedIndex,
|
|
122
|
+
filteredApps = _ref.filteredApps,
|
|
123
|
+
isLoading = _ref.isLoading;
|
|
134
124
|
var _useTranslation = reactI18next.useTranslation(),
|
|
135
125
|
t = _useTranslation.t;
|
|
136
|
-
var _useFetchNeetoApps = useFetchNeetoApps(),
|
|
137
|
-
data = _useFetchNeetoApps.data,
|
|
138
|
-
isLoading = _useFetchNeetoApps.isLoading;
|
|
139
|
-
var substring = searchTerm.replace(/ /g, "").toLowerCase();
|
|
140
|
-
var filteredApps = data === null || data === void 0 ? void 0 : data.neetoApps.filter(function (_ref2) {
|
|
141
|
-
var name = _ref2.name;
|
|
142
|
-
return name.toLowerCase().includes(substring);
|
|
143
|
-
});
|
|
144
126
|
if (isLoading) {
|
|
145
127
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
146
128
|
className: "flex items-center justify-center py-8",
|
|
@@ -149,8 +131,11 @@ var Content = function Content(_ref) {
|
|
|
149
131
|
}
|
|
150
132
|
return (filteredApps === null || filteredApps === void 0 ? void 0 : filteredApps.length) > 0 ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
151
133
|
className: "neeto-molecules-product-switcher__grid",
|
|
152
|
-
children: filteredApps.map(function (app) {
|
|
153
|
-
return /*#__PURE__*/jsxRuntime.jsx(ProductLink$1, _objectSpread$
|
|
134
|
+
children: filteredApps.map(function (app, index) {
|
|
135
|
+
return /*#__PURE__*/jsxRuntime.jsx(ProductLink$1, _objectSpread$5(_objectSpread$5({}, app), {}, {
|
|
136
|
+
"data-highlighted-index": index,
|
|
137
|
+
isHighlighted: index === highlightedIndex
|
|
138
|
+
}), app.name);
|
|
154
139
|
})
|
|
155
140
|
}) : /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
156
141
|
className: "neeto-ui-text-center",
|
|
@@ -160,6 +145,115 @@ var Content = function Content(_ref) {
|
|
|
160
145
|
});
|
|
161
146
|
};
|
|
162
147
|
|
|
148
|
+
var fetch$1 = function fetch() {
|
|
149
|
+
return axios.get("/api/v1/neeto_apps");
|
|
150
|
+
};
|
|
151
|
+
var neetoAppsApi = {
|
|
152
|
+
fetch: fetch$1
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
var QUERY_KEYS$1 = {
|
|
156
|
+
NEETO_APPS_LIST: "neeto-apps-list"
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
function ownKeys$4(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; }
|
|
160
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
161
|
+
var useFetchNeetoApps = function useFetchNeetoApps(options) {
|
|
162
|
+
return reactQuery.useQuery(_objectSpread$4({
|
|
163
|
+
queryKey: [QUERY_KEYS$1.NEETO_APPS_LIST],
|
|
164
|
+
queryFn: neetoAppsApi.fetch
|
|
165
|
+
}, options));
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
var useProductSwitcherNavigation = function useProductSwitcherNavigation() {
|
|
169
|
+
var filteredApps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
170
|
+
var _useState = React.useState(0),
|
|
171
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
172
|
+
highlightedIndex = _useState2[0],
|
|
173
|
+
setHighlightedIndex = _useState2[1];
|
|
174
|
+
var scrollContainerRef = React.useRef(null);
|
|
175
|
+
React.useEffect(function () {
|
|
176
|
+
return setHighlightedIndex(0);
|
|
177
|
+
}, [filteredApps]);
|
|
178
|
+
React.useEffect(function () {
|
|
179
|
+
if (!scrollContainerRef.current || ramda.isEmpty(filteredApps)) return;
|
|
180
|
+
var container = scrollContainerRef.current;
|
|
181
|
+
var highlightedElement = container.querySelector("[data-highlighted-index=\"".concat(highlightedIndex, "\"]"));
|
|
182
|
+
if (!highlightedElement) return;
|
|
183
|
+
var containerRect = container.getBoundingClientRect();
|
|
184
|
+
var elRect = highlightedElement.getBoundingClientRect();
|
|
185
|
+
if (elRect.top < containerRect.top) {
|
|
186
|
+
container.scrollTop += elRect.top - containerRect.top;
|
|
187
|
+
} else if (elRect.bottom > containerRect.bottom) {
|
|
188
|
+
container.scrollTop += elRect.bottom - containerRect.bottom;
|
|
189
|
+
}
|
|
190
|
+
}, [highlightedIndex, filteredApps]);
|
|
191
|
+
var getColumnsPerRow = function getColumnsPerRow() {
|
|
192
|
+
var width = window.innerWidth;
|
|
193
|
+
if (width < 768) return 1;
|
|
194
|
+
if (width < 1024) return 2;
|
|
195
|
+
if (width < 1536) return 3;
|
|
196
|
+
return 4;
|
|
197
|
+
};
|
|
198
|
+
var handleOpenHighlightedApp = function handleOpenHighlightedApp() {
|
|
199
|
+
var app = filteredApps[highlightedIndex];
|
|
200
|
+
if (!(app !== null && app !== void 0 && app.url)) return;
|
|
201
|
+
window.open(app.url, "_blank", "noopener,noreferrer");
|
|
202
|
+
};
|
|
203
|
+
var navigationHandlers = {
|
|
204
|
+
left: function left(prev) {
|
|
205
|
+
return prev === 0 ? filteredApps.length - 1 : prev - 1;
|
|
206
|
+
},
|
|
207
|
+
right: function right(prev) {
|
|
208
|
+
return prev === filteredApps.length - 1 ? 0 : prev + 1;
|
|
209
|
+
},
|
|
210
|
+
up: function up(prev) {
|
|
211
|
+
var columnsPerRow = getColumnsPerRow();
|
|
212
|
+
var newIndex = prev - columnsPerRow;
|
|
213
|
+
if (newIndex >= 0) return newIndex;
|
|
214
|
+
var currentCol = prev % columnsPerRow;
|
|
215
|
+
var lastIndex = filteredApps.length - 1;
|
|
216
|
+
return lastIndex - (lastIndex - currentCol) % columnsPerRow;
|
|
217
|
+
},
|
|
218
|
+
down: function down(prev) {
|
|
219
|
+
var columnsPerRow = getColumnsPerRow();
|
|
220
|
+
var newIndex = prev + columnsPerRow;
|
|
221
|
+
if (newIndex < filteredApps.length) return newIndex;
|
|
222
|
+
return prev % columnsPerRow;
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
var keyActions = {
|
|
226
|
+
Enter: handleOpenHighlightedApp,
|
|
227
|
+
ArrowLeft: function ArrowLeft() {
|
|
228
|
+
return setHighlightedIndex(navigationHandlers["left"]);
|
|
229
|
+
},
|
|
230
|
+
ArrowRight: function ArrowRight() {
|
|
231
|
+
return setHighlightedIndex(navigationHandlers["right"]);
|
|
232
|
+
},
|
|
233
|
+
ArrowUp: function ArrowUp() {
|
|
234
|
+
return setHighlightedIndex(navigationHandlers["up"]);
|
|
235
|
+
},
|
|
236
|
+
ArrowDown: function ArrowDown() {
|
|
237
|
+
return setHighlightedIndex(navigationHandlers["down"]);
|
|
238
|
+
},
|
|
239
|
+
Tab: function Tab(e) {
|
|
240
|
+
return setHighlightedIndex(navigationHandlers[e.shiftKey ? "left" : "right"]);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
var handleKeyDown = function handleKeyDown(e) {
|
|
244
|
+
var action = keyActions[e.key];
|
|
245
|
+
if (!action) return;
|
|
246
|
+
e.preventDefault();
|
|
247
|
+
e.stopPropagation();
|
|
248
|
+
if (neetoCist.isNotEmpty(filteredApps)) action(e);
|
|
249
|
+
};
|
|
250
|
+
return {
|
|
251
|
+
highlightedIndex: highlightedIndex,
|
|
252
|
+
handleKeyDown: handleKeyDown,
|
|
253
|
+
scrollContainerRef: scrollContainerRef
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
|
|
163
257
|
var Menu$3 = function Menu(_ref) {
|
|
164
258
|
var _ref$isMobile = _ref.isMobile,
|
|
165
259
|
isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile,
|
|
@@ -170,6 +264,21 @@ var Menu$3 = function Menu(_ref) {
|
|
|
170
264
|
_useState2 = _slicedToArray(_useState, 2),
|
|
171
265
|
searchTerm = _useState2[0],
|
|
172
266
|
setSearchTerm = _useState2[1];
|
|
267
|
+
var _useFetchNeetoApps = useFetchNeetoApps(),
|
|
268
|
+
data = _useFetchNeetoApps.data,
|
|
269
|
+
isLoading = _useFetchNeetoApps.isLoading;
|
|
270
|
+
var substring = searchTerm.replace(/ /g, "").toLowerCase();
|
|
271
|
+
var filteredApps = React.useMemo(function () {
|
|
272
|
+
if (!data) return [];
|
|
273
|
+
return data === null || data === void 0 ? void 0 : data.neetoApps.filter(function (_ref2) {
|
|
274
|
+
var name = _ref2.name;
|
|
275
|
+
return name.toLowerCase().includes(substring);
|
|
276
|
+
});
|
|
277
|
+
}, [data, substring]);
|
|
278
|
+
var _useProductSwitcherNa = useProductSwitcherNavigation(filteredApps),
|
|
279
|
+
highlightedIndex = _useProductSwitcherNa.highlightedIndex,
|
|
280
|
+
handleKeyDown = _useProductSwitcherNa.handleKeyDown,
|
|
281
|
+
scrollContainerRef = _useProductSwitcherNa.scrollContainerRef;
|
|
173
282
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
174
283
|
className: "neeto-molecules-product-switcher__wrapper",
|
|
175
284
|
"data-cy": "switcher-wrapper",
|
|
@@ -195,13 +304,17 @@ var Menu$3 = function Menu(_ref) {
|
|
|
195
304
|
value: searchTerm,
|
|
196
305
|
onChange: function onChange(e) {
|
|
197
306
|
return setSearchTerm(e.target.value);
|
|
198
|
-
}
|
|
307
|
+
},
|
|
308
|
+
onKeyDown: handleKeyDown
|
|
199
309
|
})
|
|
200
310
|
})]
|
|
201
311
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
312
|
+
ref: scrollContainerRef,
|
|
202
313
|
className: classnames("neeto-molecules-product-switcher__body", _defineProperty({}, "neeto-molecules-product-switcher__body-mobile", isMobile)),
|
|
203
314
|
children: /*#__PURE__*/jsxRuntime.jsx(Content, {
|
|
204
|
-
|
|
315
|
+
filteredApps: filteredApps,
|
|
316
|
+
highlightedIndex: highlightedIndex,
|
|
317
|
+
isLoading: isLoading
|
|
205
318
|
})
|
|
206
319
|
})]
|
|
207
320
|
}, "switcher-wrapper");
|