@lnco-ai/ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1323 -0
- package/LICENSE +661 -0
- package/README.md +60 -0
- package/dist/Authorization/PreventGuestWrapper.d.ts +19 -0
- package/dist/Authorization/PreventGuestWrapper.js +15 -0
- package/dist/Authorization/RedirectionContent.d.ts +9 -0
- package/dist/Authorization/RedirectionContent.js +24 -0
- package/dist/Authorization/SignedInWrapper.d.ts +10 -0
- package/dist/Authorization/SignedInWrapper.js +21 -0
- package/dist/Avatar/Avatar.d.ts +24 -0
- package/dist/Avatar/Avatar.js +22 -0
- package/dist/Avatar/stringToColor.d.ts +12 -0
- package/dist/Avatar/stringToColor.js +31 -0
- package/dist/Avatar/stringToColor.test.d.ts +1 -0
- package/dist/Avatar/stringToColor.test.js +8 -0
- package/dist/Card/Card.d.ts +39 -0
- package/dist/Card/Card.js +76 -0
- package/dist/Card/CardHeader.d.ts +12 -0
- package/dist/Card/CardHeader.js +8 -0
- package/dist/Card/CardThumbnail.d.ts +10 -0
- package/dist/Card/CardThumbnail.js +14 -0
- package/dist/Card/FolderCard.d.ts +14 -0
- package/dist/Card/FolderCard.js +44 -0
- package/dist/Card/LinkCard.d.ts +11 -0
- package/dist/Card/LinkCard.js +41 -0
- package/dist/Card/components/CardThumbnail.d.ts +8 -0
- package/dist/Card/components/CardThumbnail.js +15 -0
- package/dist/Card/constants.d.ts +1 -0
- package/dist/Card/constants.js +1 -0
- package/dist/Collapse/Collapse.d.ts +10 -0
- package/dist/Collapse/Collapse.js +48 -0
- package/dist/Collapse/withCollapse.d.ts +7 -0
- package/dist/Collapse/withCollapse.js +8 -0
- package/dist/CookiesBanner/CookiesBanner.d.ts +10 -0
- package/dist/CookiesBanner/CookiesBanner.js +60 -0
- package/dist/CreativeCommons/CreativeCommons.d.ts +14 -0
- package/dist/CreativeCommons/CreativeCommons.js +75 -0
- package/dist/CreativeCommons/icons/By.d.ts +3 -0
- package/dist/CreativeCommons/icons/By.js +3 -0
- package/dist/CreativeCommons/icons/CCIconsProps.d.ts +3 -0
- package/dist/CreativeCommons/icons/CCIconsProps.js +1 -0
- package/dist/CreativeCommons/icons/Cc.d.ts +3 -0
- package/dist/CreativeCommons/icons/Cc.js +3 -0
- package/dist/CreativeCommons/icons/Cc0.d.ts +3 -0
- package/dist/CreativeCommons/icons/Cc0.js +3 -0
- package/dist/CreativeCommons/icons/Nc.d.ts +3 -0
- package/dist/CreativeCommons/icons/Nc.js +3 -0
- package/dist/CreativeCommons/icons/Nd.d.ts +3 -0
- package/dist/CreativeCommons/icons/Nd.js +3 -0
- package/dist/CreativeCommons/icons/Sa.d.ts +3 -0
- package/dist/CreativeCommons/icons/Sa.js +3 -0
- package/dist/CustomInitialLoader/CustomInitialLoader.d.ts +5 -0
- package/dist/CustomInitialLoader/CustomInitialLoader.js +25 -0
- package/dist/DrawerHeader/DrawerHeader.d.ts +7 -0
- package/dist/DrawerHeader/DrawerHeader.js +16 -0
- package/dist/GraaspLogo/EpflLogo.d.ts +5 -0
- package/dist/GraaspLogo/EpflLogo.js +3 -0
- package/dist/GraaspLogo/GraaspLogo.d.ts +8 -0
- package/dist/GraaspLogo/GraaspLogo.js +5 -0
- package/dist/Header/Header.d.ts +21 -0
- package/dist/Header/Header.js +33 -0
- package/dist/HeaderUserInformation/HeaderUserInformation.d.ts +22 -0
- package/dist/HeaderUserInformation/HeaderUserInformation.js +23 -0
- package/dist/ItemBadges/ItemBadges.d.ts +17 -0
- package/dist/ItemBadges/ItemBadges.js +10 -0
- package/dist/ItemFlag/ItemFlagButton.d.ts +9 -0
- package/dist/ItemFlag/ItemFlagButton.js +11 -0
- package/dist/ItemFlag/ItemFlagDialog.d.ts +14 -0
- package/dist/ItemFlag/ItemFlagDialog.js +25 -0
- package/dist/Loader/Loader.d.ts +7 -0
- package/dist/Loader/Loader.js +4 -0
- package/dist/Main/LogoHeader.d.ts +2 -0
- package/dist/Main/LogoHeader.js +5 -0
- package/dist/Main/Main.d.ts +59 -0
- package/dist/Main/Main.js +82 -0
- package/dist/MainMenu/MainMenu.d.ts +10 -0
- package/dist/MainMenu/MainMenu.js +6 -0
- package/dist/MainMenu/MenuItem/MenuItem.d.ts +16 -0
- package/dist/MainMenu/MenuItem/MenuItem.js +16 -0
- package/dist/MainMenu/hooks.d.ts +10 -0
- package/dist/MainMenu/hooks.js +21 -0
- package/dist/Navigation/CurrentItemNavigation.d.ts +15 -0
- package/dist/Navigation/CurrentItemNavigation.js +12 -0
- package/dist/Navigation/ExtraItemsMenu.d.ts +10 -0
- package/dist/Navigation/ExtraItemsMenu.js +24 -0
- package/dist/Navigation/ExtraItemsNavigation.d.ts +11 -0
- package/dist/Navigation/ExtraItemsNavigation.js +11 -0
- package/dist/Navigation/HomeMenu.d.ts +17 -0
- package/dist/Navigation/HomeMenu.js +28 -0
- package/dist/Navigation/ItemMenu.d.ts +16 -0
- package/dist/Navigation/ItemMenu.js +32 -0
- package/dist/Navigation/Navigation.d.ts +26 -0
- package/dist/Navigation/Navigation.js +15 -0
- package/dist/Navigation/ParentsNavigation.d.ts +10 -0
- package/dist/Navigation/ParentsNavigation.js +8 -0
- package/dist/Navigation/common/CenterAlignWrapper.d.ts +3 -0
- package/dist/Navigation/common/CenterAlignWrapper.js +7 -0
- package/dist/Navigation/common/NavigationLink.d.ts +8 -0
- package/dist/Navigation/common/NavigationLink.js +7 -0
- package/dist/Navigation/common/constants.d.ts +1 -0
- package/dist/Navigation/common/constants.js +1 -0
- package/dist/PlatformSwitch/PlatformSwitch.d.ts +57 -0
- package/dist/PlatformSwitch/PlatformSwitch.js +66 -0
- package/dist/PlatformSwitch/hooks.d.ts +30 -0
- package/dist/PlatformSwitch/hooks.js +49 -0
- package/dist/SearchInput/SearchInput.d.ts +20 -0
- package/dist/SearchInput/SearchInput.js +14 -0
- package/dist/Select/Select.d.ts +24 -0
- package/dist/Select/Select.js +7 -0
- package/dist/Sidebar/Sidebar.d.ts +11 -0
- package/dist/Sidebar/Sidebar.js +25 -0
- package/dist/StyledComponents/StyledBaseComponents.d.ts +11 -0
- package/dist/StyledComponents/StyledBaseComponents.js +11 -0
- package/dist/TextDisplay/TextDisplay.d.ts +5 -0
- package/dist/TextDisplay/TextDisplay.js +24 -0
- package/dist/TextDisplay/fixtures.d.ts +3 -0
- package/dist/TextDisplay/fixtures.js +84 -0
- package/dist/TextDisplay/withFlavor.d.ts +8 -0
- package/dist/TextDisplay/withFlavor.js +25 -0
- package/dist/TextEditor/TextEditor.d.ts +16 -0
- package/dist/TextEditor/TextEditor.js +74 -0
- package/dist/ThemeContext/LanguageSelect.d.ts +15 -0
- package/dist/ThemeContext/LanguageSelect.js +19 -0
- package/dist/ThemeContext/ThemeContext.d.ts +22 -0
- package/dist/ThemeContext/ThemeContext.js +31 -0
- package/dist/Thumbnail/Thumbnail.d.ts +28 -0
- package/dist/Thumbnail/Thumbnail.js +27 -0
- package/dist/Tree/Breadcrumbs.d.ts +14 -0
- package/dist/Tree/Breadcrumbs.js +30 -0
- package/dist/Tree/RowMenu.d.ts +12 -0
- package/dist/Tree/RowMenu.js +37 -0
- package/dist/Tree/RowMenus.d.ts +18 -0
- package/dist/Tree/RowMenus.js +7 -0
- package/dist/Tree/types.d.ts +6 -0
- package/dist/Tree/types.js +1 -0
- package/dist/UserSwitch/UserSwitch.d.ts +17 -0
- package/dist/UserSwitch/UserSwitch.js +46 -0
- package/dist/UserSwitch/UserSwitchWrapper.d.ts +37 -0
- package/dist/UserSwitch/UserSwitchWrapper.js +74 -0
- package/dist/appComponents/ErrorFallback.d.ts +57 -0
- package/dist/appComponents/ErrorFallback.js +72 -0
- package/dist/appComponents/QuestionLabel.d.ts +9 -0
- package/dist/appComponents/QuestionLabel.js +4 -0
- package/dist/appComponents/index.d.ts +6 -0
- package/dist/appComponents/index.js +5 -0
- package/dist/appComponents/statusChips/RequiredChip.d.ts +3 -0
- package/dist/appComponents/statusChips/RequiredChip.js +5 -0
- package/dist/appComponents/statusChips/SavedChip.d.ts +3 -0
- package/dist/appComponents/statusChips/SavedChip.js +5 -0
- package/dist/appComponents/statusChips/SubmittedChip.d.ts +3 -0
- package/dist/appComponents/statusChips/SubmittedChip.js +5 -0
- package/dist/appComponents/statusChips/types.d.ts +5 -0
- package/dist/appComponents/statusChips/types.js +1 -0
- package/dist/appComponents/types.d.ts +8 -0
- package/dist/appComponents/types.js +1 -0
- package/dist/apps.d.ts +1 -0
- package/dist/apps.js +1 -0
- package/dist/buttons/BookmarkButton/BookmarkButton.d.ts +24 -0
- package/dist/buttons/BookmarkButton/BookmarkButton.js +24 -0
- package/dist/buttons/Button/Button.d.ts +37 -0
- package/dist/buttons/Button/Button.js +4 -0
- package/dist/buttons/ChatboxButton/ChatboxButton.d.ts +15 -0
- package/dist/buttons/ChatboxButton/ChatboxButton.js +21 -0
- package/dist/buttons/CopyButton/CopyButton.d.ts +13 -0
- package/dist/buttons/CopyButton/CopyButton.js +14 -0
- package/dist/buttons/DeleteButton/DeleteButton.d.ts +12 -0
- package/dist/buttons/DeleteButton/DeleteButton.js +17 -0
- package/dist/buttons/DownloadButton/DownloadButton.d.ts +30 -0
- package/dist/buttons/DownloadButton/DownloadButton.js +20 -0
- package/dist/buttons/EditButton/EditButton.d.ts +13 -0
- package/dist/buttons/EditButton/EditButton.js +17 -0
- package/dist/buttons/LikeButton/LikeButton.d.ts +28 -0
- package/dist/buttons/LikeButton/LikeButton.js +10 -0
- package/dist/buttons/MenuItemButton.d.ts +11 -0
- package/dist/buttons/MenuItemButton.js +12 -0
- package/dist/buttons/MoveButton/MoveButton.d.ts +13 -0
- package/dist/buttons/MoveButton/MoveButton.js +19 -0
- package/dist/buttons/PinButton/PinButton.d.ts +15 -0
- package/dist/buttons/PinButton/PinButton.js +21 -0
- package/dist/buttons/SaveButton/SaveButton.d.ts +24 -0
- package/dist/buttons/SaveButton/SaveButton.js +4 -0
- package/dist/buttons/ShareButton/ShareButton.d.ts +14 -0
- package/dist/buttons/ShareButton/ShareButton.js +17 -0
- package/dist/buttons/hooks.d.ts +5 -0
- package/dist/buttons/hooks.js +14 -0
- package/dist/buttons/index.d.ts +12 -0
- package/dist/buttons/index.js +12 -0
- package/dist/constants.d.ts +11 -0
- package/dist/constants.js +12 -0
- package/dist/draggable/DraggableElement.d.ts +11 -0
- package/dist/draggable/DraggableElement.js +42 -0
- package/dist/draggable/DraggingWrapper.d.ts +23 -0
- package/dist/draggable/DraggingWrapper.js +20 -0
- package/dist/draggable/InBetween.d.ts +10 -0
- package/dist/draggable/InBetween.js +34 -0
- package/dist/draggable/types.d.ts +10 -0
- package/dist/draggable/types.js +1 -0
- package/dist/enums/errors.d.ts +3 -0
- package/dist/enums/errors.js +3 -0
- package/dist/hooks/useFullscreen.d.ts +5 -0
- package/dist/hooks/useFullscreen.js +37 -0
- package/dist/hooks/useMobileView.d.ts +4 -0
- package/dist/hooks/useMobileView.js +6 -0
- package/dist/icons/AnalyticsIcon.d.ts +15 -0
- package/dist/icons/AnalyticsIcon.js +7 -0
- package/dist/icons/BuildIcon.d.ts +15 -0
- package/dist/icons/BuildIcon.js +7 -0
- package/dist/icons/EtherpadIcon.d.ts +7 -0
- package/dist/icons/EtherpadIcon.js +7 -0
- package/dist/icons/H5PIcon.d.ts +6 -0
- package/dist/icons/H5PIcon.js +6 -0
- package/dist/icons/ItemIcon.d.ts +23 -0
- package/dist/icons/ItemIcon.js +75 -0
- package/dist/icons/LibraryIcon.d.ts +16 -0
- package/dist/icons/LibraryIcon.js +7 -0
- package/dist/icons/PlayIcon.d.ts +15 -0
- package/dist/icons/PlayIcon.js +7 -0
- package/dist/icons/ResizingIcon.d.ts +2 -0
- package/dist/icons/ResizingIcon.js +21 -0
- package/dist/icons/StyledSVGComponents.d.ts +35 -0
- package/dist/icons/StyledSVGComponents.js +53 -0
- package/dist/icons/index.d.ts +6 -0
- package/dist/icons/index.js +6 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +60 -0
- package/dist/itemLogin/ForbiddenContent.d.ts +20 -0
- package/dist/itemLogin/ForbiddenContent.js +4 -0
- package/dist/itemLogin/ForbiddenText.d.ts +8 -0
- package/dist/itemLogin/ForbiddenText.js +6 -0
- package/dist/itemLogin/ItemLoginScreen.d.ts +26 -0
- package/dist/itemLogin/ItemLoginScreen.js +72 -0
- package/dist/itemLogin/ItemLoginWrapper.d.ts +23 -0
- package/dist/itemLogin/ItemLoginWrapper.js +43 -0
- package/dist/itemLogin/constants.d.ts +1 -0
- package/dist/itemLogin/constants.js +1 -0
- package/dist/items/AppItem.d.ts +60 -0
- package/dist/items/AppItem.js +69 -0
- package/dist/items/DocumentItem.d.ts +19 -0
- package/dist/items/DocumentItem.js +25 -0
- package/dist/items/DownloadButtonFileItem.d.ts +9 -0
- package/dist/items/DownloadButtonFileItem.js +10 -0
- package/dist/items/EtherpadItem.d.ts +26 -0
- package/dist/items/EtherpadItem.js +15 -0
- package/dist/items/FileAudio.d.ts +9 -0
- package/dist/items/FileAudio.js +10 -0
- package/dist/items/FileImage.d.ts +7 -0
- package/dist/items/FileImage.js +10 -0
- package/dist/items/FileItem.d.ts +25 -0
- package/dist/items/FileItem.js +81 -0
- package/dist/items/FilePdf.d.ts +14 -0
- package/dist/items/FilePdf.js +29 -0
- package/dist/items/FileVideo.d.ts +8 -0
- package/dist/items/FileVideo.js +9 -0
- package/dist/items/H5PItem.d.ts +20 -0
- package/dist/items/H5PItem.js +80 -0
- package/dist/items/ItemSkeleton/ItemSkeleton.d.ts +12 -0
- package/dist/items/ItemSkeleton/ItemSkeleton.js +35 -0
- package/dist/items/LinkItem.d.ts +43 -0
- package/dist/items/LinkItem.js +97 -0
- package/dist/items/SizingWrapper.d.ts +6 -0
- package/dist/items/SizingWrapper.js +23 -0
- package/dist/items/appItemHooks.d.ts +27 -0
- package/dist/items/appItemHooks.js +124 -0
- package/dist/items/constants.d.ts +1 -0
- package/dist/items/constants.js +1 -0
- package/dist/items/iframeStyles.d.ts +4 -0
- package/dist/items/iframeStyles.js +5 -0
- package/dist/items/index.d.ts +5 -0
- package/dist/items/index.js +5 -0
- package/dist/items/withCaption.d.ts +19 -0
- package/dist/items/withCaption.js +58 -0
- package/dist/items/withResizing.d.ts +9 -0
- package/dist/items/withResizing.js +42 -0
- package/dist/text-editor.d.ts +2 -0
- package/dist/text-editor.js +2 -0
- package/dist/theme.d.ts +108 -0
- package/dist/theme.js +214 -0
- package/dist/types.d.ts +43 -0
- package/dist/types.js +32 -0
- package/dist/upload/FileDropper/FileDropper.d.ts +50 -0
- package/dist/upload/FileDropper/FileDropper.js +43 -0
- package/dist/upload/UploadFileButton/UploadFileButton.d.ts +35 -0
- package/dist/upload/UploadFileButton/UploadFileButton.js +17 -0
- package/dist/utils/fixtures.d.ts +3 -0
- package/dist/utils/fixtures.js +7 -0
- package/dist/utils/storybook.d.ts +5 -0
- package/dist/utils/storybook.js +5 -0
- package/package.json +172 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Stack, Typography } from '@mui/material';
|
|
3
|
+
import GraaspLogo from '../GraaspLogo/GraaspLogo.js';
|
|
4
|
+
const LogoHeader = () => (_jsxs(Stack, { direction: 'row', alignItems: 'center', textTransform: 'none', color: 'inherit', sx: { marginRight: '8px' }, children: [_jsx(GraaspLogo, { height: 50 }), _jsx(Typography, { sx: { display: { xs: 'none', sm: 'block' } }, color: 'currentcolor', variant: 'h6', children: "LNCO.ai" })] }));
|
|
5
|
+
export default LogoHeader;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AllowedContext } from '../types.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
/**
|
|
5
|
+
* Platform value which defines what color to use in the header.
|
|
6
|
+
*/
|
|
7
|
+
context?: `${AllowedContext}` | AllowedContext;
|
|
8
|
+
/**
|
|
9
|
+
* Content to display inside the drawer / sidebar
|
|
10
|
+
*/
|
|
11
|
+
drawerContent: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Content to display inside the footer
|
|
14
|
+
*/
|
|
15
|
+
footerContent?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Content to display inside the main area.
|
|
18
|
+
* This is usually the page content
|
|
19
|
+
*/
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Left content presented in the header
|
|
23
|
+
*/
|
|
24
|
+
headerLeftContent?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Right content presented in the header
|
|
27
|
+
*/
|
|
28
|
+
headerRightContent?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Override the state of the drawer
|
|
31
|
+
* defaults to `false`
|
|
32
|
+
*/
|
|
33
|
+
open?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Wrapper component that supplies a link facility wrapping the logo
|
|
36
|
+
*/
|
|
37
|
+
LinkComponent?: (props: {
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
}) => JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* Component that should be rendered to show the platform switch
|
|
42
|
+
*/
|
|
43
|
+
PlatformComponent?: JSX.Element;
|
|
44
|
+
/**
|
|
45
|
+
* Id of the header element for testing purposes
|
|
46
|
+
*/
|
|
47
|
+
headerId?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Aria label to put on the button that opens and closes the drawer
|
|
50
|
+
* This should be a translated string reading i.e: `open drawer`
|
|
51
|
+
*/
|
|
52
|
+
drawerOpenAriaLabel: string;
|
|
53
|
+
/**
|
|
54
|
+
* Color of the background
|
|
55
|
+
*/
|
|
56
|
+
backgroundColor?: string;
|
|
57
|
+
};
|
|
58
|
+
declare const MainWithDrawerWrapper: (props: Props) => JSX.Element;
|
|
59
|
+
export default MainWithDrawerWrapper;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { MenuIcon } from 'lucide-react';
|
|
3
|
+
import { MenuOpen } from '@mui/icons-material';
|
|
4
|
+
import { AppBar, Box, CssBaseline, Drawer, IconButton, Stack, Toolbar, styled, } from '@mui/material';
|
|
5
|
+
import { useEffect } from 'react';
|
|
6
|
+
import { MainMenuOpenContextProvider, useMainMenuOpenContext, } from '../MainMenu/hooks.js';
|
|
7
|
+
import { AccentColors, DEFAULT_BACKGROUND_COLOR, PRIMARY_COLOR, } from '../theme.js';
|
|
8
|
+
import LogoHeader from './LogoHeader.js';
|
|
9
|
+
const DRAWER_WIDTH = 240;
|
|
10
|
+
const buildHeaderGradient = (color) => `linear-gradient(90deg, ${PRIMARY_COLOR} 35%, ${color} 100%);`;
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
12
|
+
const openDrawerStyles = (theme) => ({
|
|
13
|
+
width: '100%',
|
|
14
|
+
// conditional styles applied when screen is larger than mobile
|
|
15
|
+
[theme.breakpoints.up('sm')]: {
|
|
16
|
+
marginLeft: `${DRAWER_WIDTH}px`,
|
|
17
|
+
width: `calc(100% - ${DRAWER_WIDTH}px)`,
|
|
18
|
+
},
|
|
19
|
+
// create transition for width and margin property
|
|
20
|
+
transition: theme.transitions.create(['width', 'margin'], {
|
|
21
|
+
easing: theme.transitions.easing.easeOut,
|
|
22
|
+
duration: theme.transitions.duration.enteringScreen,
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
const StyledMain = styled('main', {
|
|
26
|
+
shouldForwardProp: (prop) => !['open', 'backgroundColor'].includes(prop),
|
|
27
|
+
})(({ theme, open, backgroundColor }) => ({
|
|
28
|
+
position: 'relative',
|
|
29
|
+
flexGrow: 1,
|
|
30
|
+
backgroundColor,
|
|
31
|
+
// create transition for width and margin property
|
|
32
|
+
transition: theme.transitions.create(['width', 'margin'], {
|
|
33
|
+
easing: theme.transitions.easing.easeIn,
|
|
34
|
+
duration: theme.transitions.duration.leavingScreen,
|
|
35
|
+
}),
|
|
36
|
+
// conditional styled applied only when drawer is opened
|
|
37
|
+
...(open && openDrawerStyles(theme)),
|
|
38
|
+
}));
|
|
39
|
+
const StyledFooter = styled('footer', {
|
|
40
|
+
shouldForwardProp: (prop) => prop !== 'open',
|
|
41
|
+
})(({ theme, open }) => ({
|
|
42
|
+
...(open && openDrawerStyles(theme)),
|
|
43
|
+
}));
|
|
44
|
+
const MainWithDrawerContent = ({ context, drawerContent, footerContent, children, headerLeftContent, headerRightContent, open: openOverride, headerId, drawerOpenAriaLabel, LinkComponent, PlatformComponent, backgroundColor = DEFAULT_BACKGROUND_COLOR, }) => {
|
|
45
|
+
const { open, setOpen } = useMainMenuOpenContext();
|
|
46
|
+
const handleDrawerClose = () => {
|
|
47
|
+
setOpen(false);
|
|
48
|
+
};
|
|
49
|
+
const handleDrawerToggle = () => {
|
|
50
|
+
setOpen((state) => !state);
|
|
51
|
+
};
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (openOverride !== undefined) {
|
|
54
|
+
setOpen(openOverride);
|
|
55
|
+
}
|
|
56
|
+
}, [openOverride]);
|
|
57
|
+
return (_jsxs(_Fragment, { children: [_jsx(CssBaseline, {}), _jsx(AppBar, { id: headerId, position: 'fixed', sx: {
|
|
58
|
+
background: context
|
|
59
|
+
? buildHeaderGradient(AccentColors[context])
|
|
60
|
+
: PRIMARY_COLOR,
|
|
61
|
+
}, children: _jsx(Toolbar, { children: _jsxs(Stack, { width: '100%', direction: 'row', alignItems: 'center', justifyContent: 'space-between', spacing: 2, flex: 1, minWidth: 0, children: [_jsxs(Stack, { direction: 'row', alignItems: 'center', flex: 1, minWidth: 0, spacing: 1, children: [_jsx(IconButton, { color: 'inherit', "aria-label": drawerOpenAriaLabel, onClick: handleDrawerToggle, edge: 'start', "data-umami-event": 'header-drawer-toggle', "data-umami-event-context": context, "data-umami-event-open": open, children: open ? _jsx(MenuOpen, {}) : _jsx(MenuIcon, {}) }), LinkComponent && LinkComponent({ children: _jsx(LogoHeader, {}) }), PlatformComponent, headerLeftContent] }), headerRightContent] }) }) }), _jsxs(Box, { component: 'nav', "aria-label": 'navigation', children: [_jsxs(Drawer, { variant: 'temporary', open: open, onClose: handleDrawerClose, ModalProps: {
|
|
62
|
+
keepMounted: true, // Better open performance on mobile.
|
|
63
|
+
}, sx: {
|
|
64
|
+
display: { xs: 'block', sm: 'none' },
|
|
65
|
+
'& .MuiDrawer-paper': {
|
|
66
|
+
boxSizing: 'border-box',
|
|
67
|
+
width: DRAWER_WIDTH,
|
|
68
|
+
backgroundColor,
|
|
69
|
+
},
|
|
70
|
+
}, children: [_jsx(Toolbar, {}), drawerContent] }), _jsxs(Drawer, { variant: 'persistent', sx: {
|
|
71
|
+
display: { xs: 'none', sm: 'block' },
|
|
72
|
+
'& .MuiDrawer-paper': {
|
|
73
|
+
boxSizing: 'border-box',
|
|
74
|
+
width: DRAWER_WIDTH,
|
|
75
|
+
backgroundColor,
|
|
76
|
+
},
|
|
77
|
+
}, open: open, children: [_jsx(Toolbar, {}), drawerContent] })] }), _jsx(Toolbar, {}), _jsx(StyledMain, { open: open, backgroundColor: backgroundColor, children: children }), _jsx(StyledFooter, { open: open, children: footerContent })] }));
|
|
78
|
+
};
|
|
79
|
+
// this wrapper is necessary because we use the `useMainMenuOpenContext` in the
|
|
80
|
+
// Content and we need to define the provider before using the hook.
|
|
81
|
+
const MainWithDrawerWrapper = (props) => (_jsx(Box, { height: '100vh', overflow: 'auto', display: 'flex', flexDirection: 'column', children: _jsx(MainMenuOpenContextProvider, { open: props.open, children: _jsx(MainWithDrawerContent, { ...props }) }) }));
|
|
82
|
+
export default MainWithDrawerWrapper;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type MainMenuProps = {
|
|
3
|
+
id?: string;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
/** whether container is full height
|
|
6
|
+
* this allows possible footer elements */
|
|
7
|
+
fullHeight?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const MainMenu: ({ id, children, fullHeight, }: MainMenuProps) => JSX.Element;
|
|
10
|
+
export default MainMenu;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { List } from '@mui/material';
|
|
3
|
+
export const MainMenu = ({ id, children, fullHeight, }) => {
|
|
4
|
+
return (_jsx(List, { id: id, sx: { height: fullHeight ? '100%' : undefined }, children: children }));
|
|
5
|
+
};
|
|
6
|
+
export default MainMenu;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactElement, SyntheticEvent } from 'react';
|
|
2
|
+
export type MenuItemProps = {
|
|
3
|
+
icon?: ReactElement;
|
|
4
|
+
id?: string;
|
|
5
|
+
key?: string;
|
|
6
|
+
onClick?: (event?: SyntheticEvent) => void;
|
|
7
|
+
text?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Name of the event that will be sent to Umami for tracking user actions
|
|
12
|
+
*/
|
|
13
|
+
dataUmamiEvent?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const MenuItem: ({ icon, id, key, onClick, text, selected, disabled, dataUmamiEvent, }: MenuItemProps) => JSX.Element;
|
|
16
|
+
export default MenuItem;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ListItem, ListItemButton, ListItemIcon, ListItemText, } from '@mui/material';
|
|
3
|
+
import { useMobileView } from '../../hooks/useMobileView.js';
|
|
4
|
+
import { useMainMenuOpenContext } from '../hooks.js';
|
|
5
|
+
export const MenuItem = ({ icon, id, key, onClick, text, selected, disabled, dataUmamiEvent, }) => {
|
|
6
|
+
const { setOpen } = useMainMenuOpenContext();
|
|
7
|
+
const { isMobile } = useMobileView();
|
|
8
|
+
const onNavigate = () => {
|
|
9
|
+
if (isMobile) {
|
|
10
|
+
setOpen(false);
|
|
11
|
+
}
|
|
12
|
+
onClick?.();
|
|
13
|
+
};
|
|
14
|
+
return (_jsx(ListItem, { disablePadding: true, id: id, children: _jsxs(ListItemButton, { onClick: onNavigate, disabled: disabled, selected: selected, "data-umami-event": dataUmamiEvent, children: [icon && _jsx(ListItemIcon, { children: icon }), text && _jsx(ListItemText, { primary: text })] }) }, key));
|
|
15
|
+
};
|
|
16
|
+
export default MenuItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type MainMenuOpenContextType = {
|
|
2
|
+
open: boolean;
|
|
3
|
+
setOpen: (newState: boolean | ((state: boolean) => boolean)) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare const MainMenuOpenContextProvider: ({ open: initialOpen, children, }: {
|
|
6
|
+
open?: boolean;
|
|
7
|
+
children: JSX.Element | JSX.Element[];
|
|
8
|
+
}) => JSX.Element;
|
|
9
|
+
export declare const useMainMenuOpenContext: () => MainMenuOpenContextType;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useState } from 'react';
|
|
3
|
+
import { useMobileView } from '../hooks/useMobileView.js';
|
|
4
|
+
const MainMenuOpenContext = createContext({
|
|
5
|
+
open: true,
|
|
6
|
+
setOpen: () => {
|
|
7
|
+
console.error('No Provider found for this context. Check your tree');
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export const MainMenuOpenContextProvider = ({ open: initialOpen = true, children, }) => {
|
|
11
|
+
const { isMobile } = useMobileView();
|
|
12
|
+
// the initial open state is:
|
|
13
|
+
// on mobile: always closed by default
|
|
14
|
+
// on desktop: initialized by the state passed by the parent, or open if not specified
|
|
15
|
+
const [open, setOpen] = useState(isMobile ? false : initialOpen);
|
|
16
|
+
return (_jsx(MainMenuOpenContext.Provider, { value: {
|
|
17
|
+
open,
|
|
18
|
+
setOpen,
|
|
19
|
+
}, children: children }));
|
|
20
|
+
};
|
|
21
|
+
export const useMainMenuOpenContext = () => useContext(MainMenuOpenContext);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LinkProps } from 'react-router-dom';
|
|
2
|
+
import { DiscriminatedItem } from '@lnco-ai/sdk';
|
|
3
|
+
import { ItemMenuProps } from './ItemMenu.js';
|
|
4
|
+
export type CurrentItemProps = {
|
|
5
|
+
item: DiscriminatedItem;
|
|
6
|
+
buildBreadcrumbsItemLinkId?: (id: string) => string;
|
|
7
|
+
buildIconId?: (id: string) => string;
|
|
8
|
+
buildMenuId?: (id: string) => string;
|
|
9
|
+
buildMenuItemId?: (id: string) => string;
|
|
10
|
+
useChildren: ItemMenuProps['useChildren'];
|
|
11
|
+
buildToItemPath: (id: string) => LinkProps['to'];
|
|
12
|
+
showArrow: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const CurrentItemNavigation: ({ item, buildBreadcrumbsItemLinkId, buildToItemPath, useChildren, buildIconId, buildMenuId, buildMenuItemId, showArrow, }: CurrentItemProps) => JSX.Element | null;
|
|
15
|
+
export default CurrentItemNavigation;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import truncate from 'lodash.truncate';
|
|
3
|
+
import { Typography } from '@mui/material';
|
|
4
|
+
import { ItemType } from '@lnco-ai/sdk';
|
|
5
|
+
import ItemMenu from './ItemMenu.js';
|
|
6
|
+
import CenterAlignWrapper from './common/CenterAlignWrapper.js';
|
|
7
|
+
import NavigationLink from './common/NavigationLink.js';
|
|
8
|
+
import { ITEM_NAME_MAX_LENGTH } from './common/constants.js';
|
|
9
|
+
const CurrentItemNavigation = ({ item, buildBreadcrumbsItemLinkId, buildToItemPath, useChildren, buildIconId, buildMenuId, buildMenuItemId, showArrow, }) => {
|
|
10
|
+
return (_jsxs(CenterAlignWrapper, { children: [_jsx(NavigationLink, { id: buildBreadcrumbsItemLinkId?.(item.id), to: buildToItemPath(item?.id), children: _jsx(Typography, { children: truncate(item.name, { length: ITEM_NAME_MAX_LENGTH }) }) }, item.id), (item.type === ItemType.FOLDER || showArrow) && (_jsx(ItemMenu, { useChildren: useChildren, itemId: item.id, buildToItemPath: buildToItemPath, buildIconId: buildIconId, buildMenuItemId: buildMenuItemId, buildMenuId: buildMenuId, renderArrow: showArrow }))] }));
|
|
11
|
+
};
|
|
12
|
+
export default CurrentItemNavigation;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MenuItemType } from './Navigation.js';
|
|
2
|
+
export type ExtraItemsMenuProps = {
|
|
3
|
+
icon?: JSX.Element;
|
|
4
|
+
menuItems: MenuItemType[];
|
|
5
|
+
buildIconId?: (id: string) => string;
|
|
6
|
+
buildMenuId?: (itemId: string) => string;
|
|
7
|
+
name: string;
|
|
8
|
+
};
|
|
9
|
+
declare const ExtraItemsMenu: ({ icon, menuItems, buildIconId, buildMenuId, name, }: ExtraItemsMenuProps) => JSX.Element;
|
|
10
|
+
export default ExtraItemsMenu;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronRightIcon } from 'lucide-react';
|
|
3
|
+
import { IconButton, Menu, MenuItem, Typography, } from '@mui/material';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { Link } from 'react-router-dom';
|
|
6
|
+
const Separator = _jsx(ChevronRightIcon, { "data-testid": 'NavigateNextIcon' });
|
|
7
|
+
const ExtraItemsMenu = ({ icon = Separator, menuItems, buildIconId, buildMenuId, name, }) => {
|
|
8
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
9
|
+
const open = Boolean(anchorEl);
|
|
10
|
+
const handleClick = (event) => {
|
|
11
|
+
setAnchorEl(event.currentTarget);
|
|
12
|
+
};
|
|
13
|
+
const handleClose = () => {
|
|
14
|
+
setAnchorEl(null);
|
|
15
|
+
};
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx(IconButton, { onClick: handleClick, "aria-haspopup": 'true', id: buildIconId?.(name), "aria-expanded": open ? true : undefined, children: icon }), _jsx(Menu, { anchorEl: anchorEl, open: open, id: buildMenuId?.(name), onClose: handleClose, onClick: handleClose, anchorOrigin: {
|
|
17
|
+
vertical: 'bottom',
|
|
18
|
+
horizontal: 'right',
|
|
19
|
+
}, transformOrigin: {
|
|
20
|
+
vertical: 'top',
|
|
21
|
+
horizontal: 'left',
|
|
22
|
+
}, children: menuItems?.map(({ name, path }) => (_jsx(MenuItem, { component: Link, to: path, children: _jsx(Typography, { children: name }) }, name))) })] }));
|
|
23
|
+
};
|
|
24
|
+
export default ExtraItemsMenu;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MenuItemType } from './Navigation.js';
|
|
2
|
+
export interface ExtraItem {
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
icon?: JSX.Element;
|
|
6
|
+
menuItems?: MenuItemType[];
|
|
7
|
+
}
|
|
8
|
+
declare const ExtraItemsNavigation: ({ extraItems, }: {
|
|
9
|
+
extraItems: ExtraItem[];
|
|
10
|
+
}) => JSX.Element[] | null;
|
|
11
|
+
export default ExtraItemsNavigation;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import truncate from 'lodash.truncate';
|
|
3
|
+
import { Box, Typography } from '@mui/material';
|
|
4
|
+
import ExtraItemsMenu from './ExtraItemsMenu.js';
|
|
5
|
+
import CenterAlignWrapper from './common/CenterAlignWrapper.js';
|
|
6
|
+
import NavigationLink from './common/NavigationLink.js';
|
|
7
|
+
import { ITEM_NAME_MAX_LENGTH } from './common/constants.js';
|
|
8
|
+
const ExtraItemsNavigation = ({ extraItems, }) => {
|
|
9
|
+
return extraItems.map(({ icon, name, path, menuItems }) => (_jsxs(CenterAlignWrapper, { children: [_jsxs(Box, { display: 'flex', gap: 1, children: [icon, _jsx(NavigationLink, { to: path, children: _jsx(Typography, { children: truncate(name, { length: ITEM_NAME_MAX_LENGTH }) }) })] }), menuItems && menuItems.length > 0 && (_jsx(ExtraItemsMenu, { menuItems: menuItems, name: name }))] })));
|
|
10
|
+
};
|
|
11
|
+
export default ExtraItemsNavigation;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
selected: {
|
|
3
|
+
name: string;
|
|
4
|
+
id: string;
|
|
5
|
+
to: string;
|
|
6
|
+
};
|
|
7
|
+
elements: {
|
|
8
|
+
name: string;
|
|
9
|
+
id: string;
|
|
10
|
+
to: string;
|
|
11
|
+
}[];
|
|
12
|
+
menuId?: string;
|
|
13
|
+
buildMenuItemId?: (itemId: string) => string;
|
|
14
|
+
homeDropdownId?: string;
|
|
15
|
+
};
|
|
16
|
+
declare const HomeMenu: ({ buildMenuItemId, elements, homeDropdownId, menuId, selected, }: Props) => JSX.Element;
|
|
17
|
+
export default HomeMenu;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronRightIcon, HomeIcon } from 'lucide-react';
|
|
3
|
+
import { IconButton, Menu, MenuItem, Typography, } from '@mui/material';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Link } from 'react-router-dom';
|
|
6
|
+
import NavigationLink from './common/NavigationLink.js';
|
|
7
|
+
const Separator = _jsx(ChevronRightIcon, { "data-testid": 'NavigateNextIcon' });
|
|
8
|
+
const HomeMenu = ({ buildMenuItemId, elements, homeDropdownId, menuId, selected, }) => {
|
|
9
|
+
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
10
|
+
const open = Boolean(anchorEl);
|
|
11
|
+
const handleClick = (event) => {
|
|
12
|
+
setAnchorEl(event.currentTarget);
|
|
13
|
+
};
|
|
14
|
+
const handleClose = () => {
|
|
15
|
+
setAnchorEl(null);
|
|
16
|
+
};
|
|
17
|
+
const onClick = () => {
|
|
18
|
+
handleClose();
|
|
19
|
+
};
|
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsx(HomeIcon, {}), _jsx(IconButton, { onClick: handleClick, id: homeDropdownId, "aria-controls": open ? 'root' : undefined, "aria-haspopup": 'true', "aria-expanded": open ? true : undefined, children: Separator }), _jsx(Menu, { anchorEl: anchorEl, open: open, id: menuId, onClose: handleClose, onClick: onClick, anchorOrigin: {
|
|
21
|
+
vertical: 'bottom',
|
|
22
|
+
horizontal: 'right',
|
|
23
|
+
}, transformOrigin: {
|
|
24
|
+
vertical: 'top',
|
|
25
|
+
horizontal: 'left',
|
|
26
|
+
}, children: elements.map(({ name, id, to }) => (_jsx(MenuItem, { component: Link, to: to, id: buildMenuItemId?.(id), children: _jsx(Typography, { children: name }) }, id))) }), _jsx(NavigationLink, { to: selected.to, children: _jsx(Typography, { children: selected.name }) }, selected.id)] }));
|
|
27
|
+
};
|
|
28
|
+
export default HomeMenu;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
+
import { LinkProps } from 'react-router-dom';
|
|
3
|
+
import { DiscriminatedItem } from '@lnco-ai/sdk';
|
|
4
|
+
export declare const Separator: import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export type ItemMenuProps = {
|
|
6
|
+
buildIconId?: (id: string) => string;
|
|
7
|
+
buildMenuId?: (itemId: string) => string;
|
|
8
|
+
buildMenuItemId?: (itemId: string) => string;
|
|
9
|
+
buildToItemPath: (itemId: string) => LinkProps['to'];
|
|
10
|
+
icon?: JSX.Element;
|
|
11
|
+
itemId: string;
|
|
12
|
+
useChildren: (...args: unknown[]) => UseQueryResult<DiscriminatedItem[]>;
|
|
13
|
+
renderArrow?: boolean;
|
|
14
|
+
};
|
|
15
|
+
declare const ItemMenu: ({ buildIconId, buildMenuId, buildMenuItemId, buildToItemPath, icon, itemId, useChildren, renderArrow, }: ItemMenuProps) => JSX.Element | null;
|
|
16
|
+
export default ItemMenu;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronRightIcon } from 'lucide-react';
|
|
3
|
+
import { IconButton, Menu, MenuItem, Typography, } from '@mui/material';
|
|
4
|
+
import { useState } from 'react';
|
|
5
|
+
import { Link } from 'react-router-dom';
|
|
6
|
+
export const Separator = _jsx(ChevronRightIcon, { "data-testid": 'NavigateNextIcon' });
|
|
7
|
+
const ItemMenu = ({ buildIconId, buildMenuId, buildMenuItemId, buildToItemPath, icon = Separator, itemId, useChildren, renderArrow, }) => {
|
|
8
|
+
const [anchorEl, setAnchorEl] = useState(null);
|
|
9
|
+
const open = Boolean(anchorEl);
|
|
10
|
+
const { data: items } = useChildren(itemId);
|
|
11
|
+
const handleClick = (event) => {
|
|
12
|
+
setAnchorEl(event.currentTarget);
|
|
13
|
+
};
|
|
14
|
+
const handleClose = () => {
|
|
15
|
+
setAnchorEl(null);
|
|
16
|
+
};
|
|
17
|
+
if (!items?.length && renderArrow) {
|
|
18
|
+
// to display icon as a separator specially if there's an extra items after items menu
|
|
19
|
+
return icon;
|
|
20
|
+
}
|
|
21
|
+
if (!items?.length) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsx(IconButton, { onClick: handleClick, id: buildIconId?.(itemId), "aria-controls": open ? buildMenuId?.(itemId) : undefined, "aria-haspopup": 'true', "aria-expanded": open ? true : undefined, children: icon }), _jsx(Menu, { anchorEl: anchorEl, id: buildMenuId?.(itemId), open: open, onClose: handleClose, onClick: handleClose, anchorOrigin: {
|
|
25
|
+
vertical: 'bottom',
|
|
26
|
+
horizontal: 'right',
|
|
27
|
+
}, transformOrigin: {
|
|
28
|
+
vertical: 'top',
|
|
29
|
+
horizontal: 'left',
|
|
30
|
+
}, children: items?.map(({ name, id }) => (_jsx(MenuItem, { id: buildMenuItemId?.(id), component: Link, to: buildToItemPath(id), children: _jsx(Typography, { children: name }) }, id))) })] }));
|
|
31
|
+
};
|
|
32
|
+
export default ItemMenu;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SxProps } from '@mui/material';
|
|
2
|
+
import { DiscriminatedItem } from '@lnco-ai/sdk';
|
|
3
|
+
import { ExtraItem } from './ExtraItemsNavigation.js';
|
|
4
|
+
import { ItemMenuProps } from './ItemMenu.js';
|
|
5
|
+
export type NavigationProps = {
|
|
6
|
+
backgroundColor?: string;
|
|
7
|
+
buildBreadcrumbsItemLinkId?: (id: string) => string;
|
|
8
|
+
buildIconId?: (id: string) => string;
|
|
9
|
+
buildMenuItemId?: (id: string) => string;
|
|
10
|
+
buildToItemPath: (id: string) => string;
|
|
11
|
+
buildMenuId?: (id: string) => string;
|
|
12
|
+
id?: string;
|
|
13
|
+
item?: DiscriminatedItem;
|
|
14
|
+
parents?: DiscriminatedItem[];
|
|
15
|
+
renderRoot?: (item?: DiscriminatedItem) => JSX.Element | null;
|
|
16
|
+
sx?: SxProps;
|
|
17
|
+
useChildren: ItemMenuProps['useChildren'];
|
|
18
|
+
maxItems?: number;
|
|
19
|
+
extraItems?: ExtraItem[];
|
|
20
|
+
};
|
|
21
|
+
export interface MenuItemType {
|
|
22
|
+
name: string;
|
|
23
|
+
path: string;
|
|
24
|
+
}
|
|
25
|
+
declare const Navigation: ({ backgroundColor, buildBreadcrumbsItemLinkId, buildIconId, buildMenuItemId, buildToItemPath, id, item, parents, renderRoot, sx, useChildren, buildMenuId, maxItems, extraItems, }: NavigationProps) => JSX.Element | null;
|
|
26
|
+
export default Navigation;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Breadcrumbs, styled } from '@mui/material';
|
|
3
|
+
import CurrentItemNavigation from './CurrentItemNavigation.js';
|
|
4
|
+
import ExtraItemsNavigation from './ExtraItemsNavigation.js';
|
|
5
|
+
import ParentsNavigation from './ParentsNavigation.js';
|
|
6
|
+
import CenterAlignWrapper from './common/CenterAlignWrapper.js';
|
|
7
|
+
const StyledBreadcrumbs = styled(Breadcrumbs)(() => ({
|
|
8
|
+
'.MuiBreadcrumbs-separator': {
|
|
9
|
+
margin: 0,
|
|
10
|
+
},
|
|
11
|
+
}));
|
|
12
|
+
const Navigation = ({ backgroundColor, buildBreadcrumbsItemLinkId, buildIconId, buildMenuItemId, buildToItemPath, id, item, parents, renderRoot, sx, useChildren, buildMenuId, maxItems = 4, extraItems, }) => {
|
|
13
|
+
return (_jsxs(StyledBreadcrumbs, { sx: sx, id: id, maxItems: maxItems, separator: '', "aria-label": 'breadcrumb', style: { backgroundColor }, children: [_jsx(CenterAlignWrapper, { children: renderRoot?.(item) }), item?.id && parents && (_jsx(ParentsNavigation, { useChildren: useChildren, parents: parents, buildToItemPath: buildToItemPath, buildBreadcrumbsItemLinkId: buildBreadcrumbsItemLinkId })), item?.id && item && (_jsx(CurrentItemNavigation, { item: item, useChildren: useChildren, buildToItemPath: buildToItemPath, buildBreadcrumbsItemLinkId: buildBreadcrumbsItemLinkId, buildIconId: buildIconId, buildMenuId: buildMenuId, buildMenuItemId: buildMenuItemId, showArrow: Boolean(extraItems?.length) })), extraItems && _jsx(ExtraItemsNavigation, { extraItems: extraItems })] }));
|
|
14
|
+
};
|
|
15
|
+
export default Navigation;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DiscriminatedItem } from '@lnco-ai/sdk';
|
|
2
|
+
import { ItemMenuProps } from './ItemMenu.js';
|
|
3
|
+
export type ParentsProps = {
|
|
4
|
+
parents: DiscriminatedItem[];
|
|
5
|
+
buildBreadcrumbsItemLinkId?: (id: string) => string;
|
|
6
|
+
useChildren: ItemMenuProps['useChildren'];
|
|
7
|
+
buildToItemPath: (id: string) => string;
|
|
8
|
+
};
|
|
9
|
+
declare const ParentsNavigation: ({ parents, useChildren, buildBreadcrumbsItemLinkId, buildToItemPath, }: ParentsProps) => JSX.Element;
|
|
10
|
+
export default ParentsNavigation;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import truncate from 'lodash.truncate';
|
|
3
|
+
import { Stack, Typography } from '@mui/material';
|
|
4
|
+
import ItemMenu from './ItemMenu.js';
|
|
5
|
+
import NavigationLink from './common/NavigationLink.js';
|
|
6
|
+
import { ITEM_NAME_MAX_LENGTH } from './common/constants.js';
|
|
7
|
+
const ParentsNavigation = ({ parents, useChildren, buildBreadcrumbsItemLinkId, buildToItemPath, }) => (_jsx(Stack, { direction: 'row', children: parents.map(({ name, id }) => (_jsxs(Stack, { direction: 'row', alignItems: 'center', justifyContent: 'center', children: [_jsx(NavigationLink, { id: buildBreadcrumbsItemLinkId?.(id), to: buildToItemPath(id), children: _jsx(Typography, { children: truncate(name, { length: ITEM_NAME_MAX_LENGTH }) }) }), _jsx(ItemMenu, { useChildren: useChildren, itemId: id, buildToItemPath: buildToItemPath })] }, id))) }));
|
|
8
|
+
export default ParentsNavigation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ITEM_NAME_MAX_LENGTH = 15;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const ITEM_NAME_MAX_LENGTH = 15;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SxProps, TooltipProps } from '@mui/material';
|
|
2
|
+
import { Platform } from './hooks.js';
|
|
3
|
+
export type PlatformSwitchProps = {
|
|
4
|
+
/** Element ID of the Platform Switch */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** Size of the icons (default: 32) */
|
|
7
|
+
size?: number;
|
|
8
|
+
/** Spacing in-between icons as well as padding inside the switch frame */
|
|
9
|
+
spacing?: number;
|
|
10
|
+
/** Color of the switch controls */
|
|
11
|
+
color?: string;
|
|
12
|
+
/** Color of the icons when highlighted */
|
|
13
|
+
accentColor?: string;
|
|
14
|
+
/** Color of the icons when the corresponding platform is disabled */
|
|
15
|
+
disabledColor?: string;
|
|
16
|
+
/** Style overrides to apply to the switch frame */
|
|
17
|
+
sx?: SxProps;
|
|
18
|
+
/** Platform that should be currently highlighted */
|
|
19
|
+
selected?: Platform;
|
|
20
|
+
/** Platform-specific icon props */
|
|
21
|
+
platformsProps?: Partial<Record<Platform, {
|
|
22
|
+
/** Element ID of this specific platform button */
|
|
23
|
+
id?: string;
|
|
24
|
+
/** Whether this platform should be disabled (non-clickable) */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** Tooltips to add to the buttons, in order left to right */
|
|
27
|
+
tooltip?: string;
|
|
28
|
+
/** Placements of tooltips, in order left to right */
|
|
29
|
+
placement?: TooltipProps['placement'];
|
|
30
|
+
/** Target when this platform button is clicked */
|
|
31
|
+
href?: string;
|
|
32
|
+
/** Style overrides for this platform's icon */
|
|
33
|
+
sx?: SxProps;
|
|
34
|
+
}>>;
|
|
35
|
+
/**
|
|
36
|
+
* Custom icon to show as selected in mobile
|
|
37
|
+
*/
|
|
38
|
+
CustomMobileIcon?: (props: IconProps) => JSX.Element;
|
|
39
|
+
};
|
|
40
|
+
/** Common props for all platform icons */
|
|
41
|
+
type IconProps = {
|
|
42
|
+
size?: number;
|
|
43
|
+
primaryColor?: string;
|
|
44
|
+
primaryOpacity?: number;
|
|
45
|
+
secondaryColor?: string;
|
|
46
|
+
secondaryOpacity?: number;
|
|
47
|
+
sx?: SxProps;
|
|
48
|
+
disabledColor?: string;
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
selected?: boolean;
|
|
51
|
+
disableHover?: boolean;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* PlatformSwitch allows the user to change between the platforms
|
|
55
|
+
*/
|
|
56
|
+
export declare const PlatformSwitch: ({ id, spacing, size, color, accentColor, disabledColor, sx, selected, platformsProps, CustomMobileIcon, }: PlatformSwitchProps) => JSX.Element;
|
|
57
|
+
export default PlatformSwitch;
|