@xyo-network/react-appbar 3.0.1 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/browser/components/AppBar/Application.d.ts +11 -0
- package/dist/browser/components/AppBar/Application.d.ts.map +1 -0
- package/dist/browser/components/AppBar/index.d.ts +2 -0
- package/dist/browser/components/AppBar/index.d.ts.map +1 -0
- package/dist/browser/components/CollapsibleDrawer/CollapseToggle.d.ts +4 -0
- package/dist/browser/components/CollapsibleDrawer/CollapseToggle.d.ts.map +1 -0
- package/dist/browser/components/CollapsibleDrawer/CollapsibleDrawer.d.ts +5 -0
- package/dist/browser/components/CollapsibleDrawer/CollapsibleDrawer.d.ts.map +1 -0
- package/dist/browser/components/CollapsibleDrawer/index.d.ts +3 -0
- package/dist/browser/components/CollapsibleDrawer/index.d.ts.map +1 -0
- package/dist/browser/components/CollapsibleDrawer/storyExampleMenuData.d.ts +4 -0
- package/dist/browser/components/CollapsibleDrawer/storyExampleMenuData.d.ts.map +1 -0
- package/dist/browser/components/MobileSystemControls/SystemControls.d.ts +5 -0
- package/dist/browser/components/MobileSystemControls/SystemControls.d.ts.map +1 -0
- package/dist/browser/components/MobileSystemControls/SystemControlsRoot.d.ts +4 -0
- package/dist/browser/components/MobileSystemControls/SystemControlsRoot.d.ts.map +1 -0
- package/dist/browser/components/MobileSystemControls/SystemControlsType.d.ts +6 -0
- package/dist/browser/components/MobileSystemControls/SystemControlsType.d.ts.map +1 -0
- package/dist/browser/components/MobileSystemControls/SystemControlsUnstyled.d.ts +11 -0
- package/dist/browser/components/MobileSystemControls/SystemControlsUnstyled.d.ts.map +1 -0
- package/dist/browser/components/MobileSystemControls/controls/SystemControl.d.ts +11 -0
- package/dist/browser/components/MobileSystemControls/controls/SystemControl.d.ts.map +1 -0
- package/dist/browser/components/MobileSystemControls/controls/SystemControlText.d.ts +8 -0
- package/dist/browser/components/MobileSystemControls/controls/SystemControlText.d.ts.map +1 -0
- package/dist/browser/components/MobileSystemControls/controls/index.d.ts +3 -0
- package/dist/browser/components/MobileSystemControls/controls/index.d.ts.map +1 -0
- package/dist/browser/components/MobileSystemControls/index.d.ts +4 -0
- package/dist/browser/components/MobileSystemControls/index.d.ts.map +1 -0
- package/dist/browser/components/SearchBar/SearchBar.d.ts +7 -0
- package/dist/browser/components/SearchBar/SearchBar.d.ts.map +1 -0
- package/dist/browser/components/SearchBar/index.d.ts +2 -0
- package/dist/browser/components/SearchBar/index.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/Menu.d.ts +9 -0
- package/dist/browser/components/SiteMenu/Menu.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/MenuListItem/MenuListItemContainer.d.ts +11 -0
- package/dist/browser/components/SiteMenu/MenuListItem/MenuListItemContainer.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/MenuListItem/index.d.ts +2 -0
- package/dist/browser/components/SiteMenu/MenuListItem/index.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/ListItemTooltip.d.ts +7 -0
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/ListItemTooltip.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/MenuIcon.d.ts +8 -0
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/MenuIcon.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/MenuListItem.d.ts +7 -0
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/MenuListItem.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/index.d.ts +4 -0
- package/dist/browser/components/SiteMenu/MenuListItem/list-item-components/index.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/MenuListItem/sub-nav/SubNavListItemCollapse.d.ts +11 -0
- package/dist/browser/components/SiteMenu/MenuListItem/sub-nav/SubNavListItemCollapse.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/MenuListItem/sub-nav/SubNavToggleIconButton.d.ts +9 -0
- package/dist/browser/components/SiteMenu/MenuListItem/sub-nav/SubNavToggleIconButton.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/MenuListItem/sub-nav/index.d.ts +3 -0
- package/dist/browser/components/SiteMenu/MenuListItem/sub-nav/index.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/MenuSection.d.ts +11 -0
- package/dist/browser/components/SiteMenu/MenuSection.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/hooks/index.d.ts +2 -0
- package/dist/browser/components/SiteMenu/hooks/index.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/hooks/useMenuItemsShared.d.ts +7 -0
- package/dist/browser/components/SiteMenu/hooks/useMenuItemsShared.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/index.d.ts +6 -0
- package/dist/browser/components/SiteMenu/index.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/lib/MenuListItemBase.d.ts +5 -0
- package/dist/browser/components/SiteMenu/lib/MenuListItemBase.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/lib/NavListItemProps.d.ts +12 -0
- package/dist/browser/components/SiteMenu/lib/NavListItemProps.d.ts.map +1 -0
- package/dist/browser/components/SiteMenu/lib/index.d.ts +3 -0
- package/dist/browser/components/SiteMenu/lib/index.d.ts.map +1 -0
- package/dist/browser/components/Toolbar/Context/ContextToolbar.d.ts +9 -0
- package/dist/browser/components/Toolbar/Context/ContextToolbar.d.ts.map +1 -0
- package/dist/browser/components/Toolbar/Context/Logo.d.ts +3 -0
- package/dist/browser/components/Toolbar/Context/Logo.d.ts.map +1 -0
- package/dist/browser/components/Toolbar/Context/LogoLinkEx.d.ts +7 -0
- package/dist/browser/components/Toolbar/Context/LogoLinkEx.d.ts.map +1 -0
- package/dist/browser/components/Toolbar/Context/index.d.ts +2 -0
- package/dist/browser/components/Toolbar/Context/index.d.ts.map +1 -0
- package/dist/browser/components/Toolbar/System/SystemToolbar.d.ts +16 -0
- package/dist/browser/components/Toolbar/System/SystemToolbar.d.ts.map +1 -0
- package/dist/browser/components/Toolbar/System/index.d.ts +2 -0
- package/dist/browser/components/Toolbar/System/index.d.ts.map +1 -0
- package/dist/browser/components/Toolbar/index.d.ts +3 -0
- package/dist/browser/components/Toolbar/index.d.ts.map +1 -0
- package/dist/browser/components/index.d.ts +7 -0
- package/dist/browser/components/index.d.ts.map +1 -0
- package/dist/browser/contexts/Collapsible/State.d.ts +9 -0
- package/dist/browser/contexts/Collapsible/State.d.ts.map +1 -0
- package/dist/browser/contexts/Collapsible/context.d.ts +3 -0
- package/dist/browser/contexts/Collapsible/context.d.ts.map +1 -0
- package/dist/browser/contexts/Collapsible/index.d.ts +4 -0
- package/dist/browser/contexts/Collapsible/index.d.ts.map +1 -0
- package/dist/browser/contexts/Collapsible/provider.d.ts +8 -0
- package/dist/browser/contexts/Collapsible/provider.d.ts.map +1 -0
- package/dist/browser/contexts/Collapsible/use.d.ts +2 -0
- package/dist/browser/contexts/Collapsible/use.d.ts.map +1 -0
- package/dist/browser/contexts/index.d.ts +2 -0
- package/dist/browser/contexts/index.d.ts.map +1 -0
- package/dist/browser/index.d.ts +3 -116
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.mjs +5 -15
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +59 -53
- package/src/components/AppBar/Application.stories.tsx +8 -8
- package/src/components/AppBar/Application.tsx +8 -4
- package/src/components/CollapsibleDrawer/CollapseDrawer.stories.tsx +8 -10
- package/src/components/CollapsibleDrawer/CollapseToggle.tsx +5 -2
- package/src/components/CollapsibleDrawer/CollapsibleDrawer.tsx +8 -3
- package/src/components/CollapsibleDrawer/storyExampleMenuData.tsx +10 -4
- package/src/components/MobileSystemControls/SystemControls.stories.tsx +2 -6
- package/src/components/MobileSystemControls/SystemControls.tsx +1 -1
- package/src/components/MobileSystemControls/SystemControlsRoot.tsx +4 -7
- package/src/components/MobileSystemControls/SystemControlsUnstyled.tsx +4 -2
- package/src/components/MobileSystemControls/controls/SystemControl.tsx +5 -3
- package/src/components/MobileSystemControls/controls/SystemControlText.tsx +2 -1
- package/src/components/SearchBar/SearchBar.tsx +24 -5
- package/src/components/SiteMenu/Menu.tsx +8 -3
- package/src/components/SiteMenu/MenuListItem/MenuListItemContainer.stories.tsx +7 -8
- package/src/components/SiteMenu/MenuListItem/MenuListItemContainer.tsx +6 -3
- package/src/components/SiteMenu/MenuListItem/list-item-components/ListItemTooltip.tsx +2 -1
- package/src/components/SiteMenu/MenuListItem/list-item-components/MenuIcon.tsx +4 -2
- package/src/components/SiteMenu/MenuListItem/list-item-components/MenuListItem.tsx +17 -5
- package/src/components/SiteMenu/MenuListItem/sub-nav/SubNavListItemCollapse.tsx +7 -4
- package/src/components/SiteMenu/MenuListItem/sub-nav/SubNavToggleIconButton.tsx +6 -2
- package/src/components/SiteMenu/MenuSection.tsx +7 -3
- package/src/components/SiteMenu/hooks/useMenuItemsShared.tsx +5 -5
- package/src/components/SiteMenu/lib/NavListItemProps.ts +3 -3
- package/src/components/Toolbar/Context/ContextToolbar.stories.tsx +2 -6
- package/src/components/Toolbar/Context/ContextToolbar.tsx +6 -3
- package/src/components/Toolbar/Context/LogoLinkEx.tsx +5 -2
- package/src/components/Toolbar/System/SystemToolbar.stories.tsx +7 -8
- package/src/components/Toolbar/System/SystemToolbar.tsx +8 -4
- package/src/contexts/Collapsible/State.ts +2 -2
- package/src/contexts/Collapsible/context.ts +1 -1
- package/src/contexts/Collapsible/provider.tsx +11 -14
- package/xy.config.ts +2 -4
@@ -1,6 +1,10 @@
|
|
1
1
|
import { Divider, useTheme } from '@mui/material'
|
2
|
-
import {
|
3
|
-
|
2
|
+
import type {
|
3
|
+
Decorator, Meta, StoryFn,
|
4
|
+
} from '@storybook/react'
|
5
|
+
import {
|
6
|
+
FlexCol, FlexGrowCol, FlexRow,
|
7
|
+
} from '@xylabs/react-flexbox'
|
4
8
|
import React from 'react'
|
5
9
|
|
6
10
|
import { CollapsibleProvider, useCollapsible } from '../../contexts/index.ts'
|
@@ -21,11 +25,7 @@ const StorybookEntry = {
|
|
21
25
|
argTypes: {},
|
22
26
|
component: CollapsibleDrawer,
|
23
27
|
decorators: [CollapseProviderDecorator],
|
24
|
-
parameters: {
|
25
|
-
docs: {
|
26
|
-
page: null,
|
27
|
-
},
|
28
|
-
},
|
28
|
+
parameters: { docs: { page: null } },
|
29
29
|
title: 'appbar/CollapseDrawer',
|
30
30
|
} as Meta<typeof CollapsibleDrawer>
|
31
31
|
|
@@ -48,9 +48,7 @@ const Template: StoryFn<typeof CollapsibleDrawer> = (args) => {
|
|
48
48
|
}
|
49
49
|
|
50
50
|
const Default = Template.bind({})
|
51
|
-
Default.args = {
|
52
|
-
collapsedSize: '40px',
|
53
|
-
}
|
51
|
+
Default.args = { collapsedSize: '40px' }
|
54
52
|
|
55
53
|
export { Default }
|
56
54
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Icon, useTheme } from '@mui/material'
|
2
|
-
import { FlexBoxProps
|
2
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
3
|
+
import { FlexRow } from '@xylabs/react-flexbox'
|
3
4
|
import React, { useState } from 'react'
|
4
5
|
// eslint-disable-next-line import-x/no-internal-modules
|
5
6
|
import { VscArrowSmallLeft, VscArrowSmallRight } from 'react-icons/vsc'
|
@@ -7,7 +8,9 @@ import { VscArrowSmallLeft, VscArrowSmallRight } from 'react-icons/vsc'
|
|
7
8
|
import { useCollapsible } from '../../contexts/index.ts'
|
8
9
|
|
9
10
|
export const CollapseToggleFlex: React.FC<FlexBoxProps> = (props) => {
|
10
|
-
const {
|
11
|
+
const {
|
12
|
+
collapse, setCollapse, setCollapseEnd,
|
13
|
+
} = useCollapsible()
|
11
14
|
const [hover, setHover] = useState(false)
|
12
15
|
const theme = useTheme()
|
13
16
|
|
@@ -1,10 +1,15 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import type { CollapseProps } from '@mui/material'
|
2
|
+
import {
|
3
|
+
Collapse, styled, useTheme,
|
4
|
+
} from '@mui/material'
|
5
|
+
import type { WithChildren } from '@xylabs/react-shared'
|
3
6
|
import React from 'react'
|
4
7
|
|
5
8
|
import { useCollapsible } from '../../contexts/index.ts'
|
6
9
|
|
7
|
-
export const CollapsibleDrawer: React.FC<WithChildren<CollapseProps>> = ({
|
10
|
+
export const CollapsibleDrawer: React.FC<WithChildren<CollapseProps>> = ({
|
11
|
+
children, sx, ...props
|
12
|
+
}) => {
|
8
13
|
const { collapse, setCollapseEnd } = useCollapsible()
|
9
14
|
const theme = useTheme()
|
10
15
|
|
@@ -15,7 +15,7 @@ import {
|
|
15
15
|
// eslint-disable-next-line import-x/no-internal-modules
|
16
16
|
} from 'react-icons/vsc'
|
17
17
|
|
18
|
-
import { MenuListItemProps } from '../SiteMenu/index.ts'
|
18
|
+
import type { MenuListItemProps } from '../SiteMenu/index.ts'
|
19
19
|
|
20
20
|
export const menuDataTop: MenuListItemProps[] = [
|
21
21
|
{
|
@@ -46,9 +46,15 @@ export const menuDataTop: MenuListItemProps[] = [
|
|
46
46
|
icon: <VscServer fontSize="body1" />,
|
47
47
|
primary: 'Archives',
|
48
48
|
subNavListItems: [
|
49
|
-
{
|
50
|
-
|
51
|
-
|
49
|
+
{
|
50
|
+
icon: <VscDashboard fontSize="body2" />, primary: 'Dashboard', to: '', tooltip: 'View data for all archives on this network.',
|
51
|
+
},
|
52
|
+
{
|
53
|
+
icon: <VscAdd fontSize="body2" />, primary: 'Create Archive', to: '', tooltip: 'Create a new archive on this network.',
|
54
|
+
},
|
55
|
+
{
|
56
|
+
icon: <VscTable fontSize="body2" />, primary: 'Archive Table', to: '', tooltip: 'View all archives on this network as a table.',
|
57
|
+
},
|
52
58
|
],
|
53
59
|
to: '',
|
54
60
|
tooltip: 'The most recent blocks seen in the in temp archive on your current network.',
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react'
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
2
2
|
import { NetworkMemoryProvider } from '@xyo-network/react-network'
|
3
3
|
import React from 'react'
|
4
4
|
|
@@ -8,11 +8,7 @@ import { SystemControlsType } from './SystemControlsType.ts'
|
|
8
8
|
const StorybookEntry: Meta = {
|
9
9
|
argTypes: {},
|
10
10
|
component: SystemControls,
|
11
|
-
parameters: {
|
12
|
-
docs: {
|
13
|
-
page: null,
|
14
|
-
},
|
15
|
-
},
|
11
|
+
parameters: { docs: { page: null } },
|
16
12
|
title: 'appbar/System/SystemControls',
|
17
13
|
}
|
18
14
|
|
@@ -2,7 +2,7 @@ import { FlexCol } from '@xylabs/react-flexbox'
|
|
2
2
|
import React from 'react'
|
3
3
|
|
4
4
|
import { SystemControlsRoot } from './SystemControlsRoot.tsx'
|
5
|
-
import { SystemControlsUnstyledProps } from './SystemControlsUnstyled.tsx'
|
5
|
+
import type { SystemControlsUnstyledProps } from './SystemControlsUnstyled.tsx'
|
6
6
|
|
7
7
|
const SystemControls: React.FC<SystemControlsUnstyledProps> = (props) => {
|
8
8
|
return (
|
@@ -1,14 +1,13 @@
|
|
1
1
|
import { styled } from '@mui/material'
|
2
2
|
|
3
3
|
import { SystemControlsType } from './SystemControlsType.ts'
|
4
|
-
import {
|
4
|
+
import type { SystemControlsUnstyledProps } from './SystemControlsUnstyled.tsx'
|
5
|
+
import { SystemControlsUnstyled } from './SystemControlsUnstyled.tsx'
|
5
6
|
|
6
7
|
const SystemControlsRoot = styled(SystemControlsUnstyled, { name: 'SystemControls', slot: 'Root' })<SystemControlsUnstyledProps>(({ theme }) => ({
|
7
8
|
// shared defaults
|
8
9
|
['&']: {
|
9
|
-
'.toggle': {
|
10
|
-
backgroundColor: theme.palette.primary.main,
|
11
|
-
},
|
10
|
+
'.toggle': { backgroundColor: theme.palette.primary.main },
|
12
11
|
'alignItems': 'start',
|
13
12
|
'zIndex': 1,
|
14
13
|
},
|
@@ -42,9 +41,7 @@ const SystemControlsRoot = styled(SystemControlsUnstyled, { name: 'SystemControl
|
|
42
41
|
flexDirection: 'column',
|
43
42
|
padding: `${theme.spacing(2)} ${theme.spacing(2.5)}`,
|
44
43
|
},
|
45
|
-
'.control-wrap': {
|
46
|
-
marginBottom: `${theme.spacing(2)}`,
|
47
|
-
},
|
44
|
+
'.control-wrap': { marginBottom: `${theme.spacing(2)}` },
|
48
45
|
'.toggle': {
|
49
46
|
borderRadius: '0 5px 5px 0',
|
50
47
|
padding: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
|
@@ -1,5 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import type { Theme } from '@mui/material'
|
2
|
+
import { Paper, useMediaQuery } from '@mui/material'
|
3
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
4
|
+
import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
|
3
5
|
import { NetworkSelectEx } from '@xyo-network/react-network'
|
4
6
|
import React from 'react'
|
5
7
|
|
@@ -1,6 +1,8 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
1
|
+
import type { CollapseProps } from '@mui/material'
|
2
|
+
import { Collapse } from '@mui/material'
|
3
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
4
|
+
import { FlexCol, FlexRow } from '@xylabs/react-flexbox'
|
5
|
+
import type { WithChildren } from '@xylabs/react-shared'
|
4
6
|
import React, { useState } from 'react'
|
5
7
|
|
6
8
|
import { SystemControlsType } from '../SystemControlsType.ts'
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Typography } from '@mui/material'
|
2
|
-
import { FlexBoxProps
|
2
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
3
|
+
import { FlexCol } from '@xylabs/react-flexbox'
|
3
4
|
import React from 'react'
|
4
5
|
|
5
6
|
interface SystemControlTextProps extends FlexBoxProps {
|
@@ -1,21 +1,35 @@
|
|
1
1
|
import { Search as SearchIcon } from '@mui/icons-material'
|
2
2
|
import { Paper, TextField } from '@mui/material'
|
3
3
|
import { ButtonEx } from '@xylabs/react-button'
|
4
|
-
import { FlexBoxProps
|
4
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
5
|
+
import { FlexRow } from '@xylabs/react-flexbox'
|
5
6
|
import React, { useState } from 'react'
|
6
7
|
|
7
8
|
export interface SearchBarProps extends FlexBoxProps {
|
8
9
|
onSearch?: (term?: string) => void
|
9
10
|
}
|
10
11
|
|
11
|
-
export const SearchBar: React.FC<SearchBarProps> = ({
|
12
|
+
export const SearchBar: React.FC<SearchBarProps> = ({
|
13
|
+
defaultValue, onSearch, ...props
|
14
|
+
}) => {
|
12
15
|
const [term, setTerm] = useState<string>()
|
13
16
|
|
14
17
|
return (
|
15
18
|
<FlexRow alignItems="stretch" {...props}>
|
16
|
-
<Paper
|
19
|
+
<Paper
|
20
|
+
variant="elevation"
|
21
|
+
elevation={0}
|
22
|
+
style={{
|
23
|
+
display: 'flex', overflow: 'hidden', width: '100%',
|
24
|
+
}}
|
25
|
+
>
|
17
26
|
<TextField
|
18
|
-
InputProps={{
|
27
|
+
InputProps={{
|
28
|
+
color: 'secondary',
|
29
|
+
style: {
|
30
|
+
borderBottomRightRadius: 0, borderTopRightRadius: 0, borderWidth: 0,
|
31
|
+
},
|
32
|
+
}}
|
19
33
|
variant="outlined"
|
20
34
|
size="small"
|
21
35
|
defaultValue={defaultValue}
|
@@ -25,7 +39,12 @@ export const SearchBar: React.FC<SearchBarProps> = ({ defaultValue, onSearch, ..
|
|
25
39
|
if (event.key === 'Enter') onSearch?.(term)
|
26
40
|
}}
|
27
41
|
/>
|
28
|
-
<ButtonEx
|
42
|
+
<ButtonEx
|
43
|
+
variant="contained"
|
44
|
+
style={{ borderRadius: 0, borderTopLeftRadius: 0 }}
|
45
|
+
color="secondary"
|
46
|
+
onClick={() => onSearch?.(term)}
|
47
|
+
>
|
29
48
|
<SearchIcon />
|
30
49
|
</ButtonEx>
|
31
50
|
</Paper>
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import { Menu as MenuIcon, Settings as SettingsIcon } from '@mui/icons-material'
|
2
|
-
import {
|
3
|
-
|
2
|
+
import {
|
3
|
+
IconButton, List, SwipeableDrawer,
|
4
|
+
} from '@mui/material'
|
5
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
6
|
+
import { FlexRow } from '@xylabs/react-flexbox'
|
4
7
|
import React, { useEffect, useState } from 'react'
|
5
8
|
|
6
9
|
import { MenuListItemContainer } from './MenuListItem/index.ts'
|
@@ -11,7 +14,9 @@ export interface SiteMenuProps extends FlexBoxProps {
|
|
11
14
|
side?: 'left' | 'right' | 'top' | 'bottom'
|
12
15
|
}
|
13
16
|
|
14
|
-
export const SiteMenu: React.FC<SiteMenuProps> = ({
|
17
|
+
export const SiteMenu: React.FC<SiteMenuProps> = ({
|
18
|
+
children, onMenuToggle, side = 'right', ...props
|
19
|
+
}) => {
|
15
20
|
const [open, setOpen] = useState(false)
|
16
21
|
|
17
22
|
useEffect(() => {
|
@@ -1,20 +1,17 @@
|
|
1
1
|
import { List } from '@mui/material'
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
2
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
3
3
|
import React from 'react'
|
4
4
|
// eslint-disable-next-line import-x/no-internal-modules
|
5
5
|
import { FaGlobeAmericas } from 'react-icons/fa'
|
6
6
|
import { BrowserRouter } from 'react-router-dom'
|
7
7
|
|
8
|
-
import {
|
8
|
+
import type { MenuListItemProps } from './MenuListItemContainer.tsx'
|
9
|
+
import { MenuListItemContainer } from './MenuListItemContainer.tsx'
|
9
10
|
|
10
11
|
const StorybookEntry = {
|
11
12
|
argTypes: {},
|
12
13
|
component: MenuListItemContainer,
|
13
|
-
parameters: {
|
14
|
-
docs: {
|
15
|
-
page: null,
|
16
|
-
},
|
17
|
-
},
|
14
|
+
parameters: { docs: { page: null } },
|
18
15
|
title: 'appbar/MenuListItemContainer',
|
19
16
|
} as Meta<typeof MenuListItemContainer>
|
20
17
|
|
@@ -46,7 +43,9 @@ const WithChildren = Template.bind({})
|
|
46
43
|
WithChildren.args = {
|
47
44
|
icon: <FaGlobeAmericas />,
|
48
45
|
primary: 'Explore',
|
49
|
-
subNavListItems: [{
|
46
|
+
subNavListItems: [{
|
47
|
+
primary: 'Explore', to: '/explore', tooltip: 'View global archivist data on a world map.',
|
48
|
+
}],
|
50
49
|
tooltip: 'View global archivist data on a world map.',
|
51
50
|
}
|
52
51
|
|
@@ -1,11 +1,14 @@
|
|
1
|
-
import { ListItemProps
|
1
|
+
import type { ListItemProps } from '@mui/material'
|
2
|
+
import { ListItemText, useTheme } from '@mui/material'
|
2
3
|
import { FlexRow } from '@xylabs/react-flexbox'
|
3
4
|
import { LinkEx } from '@xylabs/react-link'
|
4
5
|
import React, { useState } from 'react'
|
5
6
|
|
6
7
|
import { useCollapsible } from '../../../contexts/index.ts'
|
7
|
-
import { MenuListItemBase, NavListItemProps } from '../lib/index.ts'
|
8
|
-
import {
|
8
|
+
import type { MenuListItemBase, NavListItemProps } from '../lib/index.ts'
|
9
|
+
import {
|
10
|
+
ListItemTooltip, MenuIcon, MenuListItem,
|
11
|
+
} from './list-item-components/index.ts'
|
9
12
|
import { SubNavListItemsCollapse, SubNavToggleIconButton } from './sub-nav/index.ts'
|
10
13
|
|
11
14
|
export interface MenuListItemProps extends NavListItemProps, MenuListItemBase, ListItemProps {
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import type { TooltipProps } from '@mui/material'
|
2
|
+
import { Tooltip } from '@mui/material'
|
2
3
|
import { FlexCol } from '@xylabs/react-flexbox'
|
3
4
|
import React from 'react'
|
4
5
|
// eslint-disable-next-line import-x/no-internal-modules
|
@@ -1,5 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
import
|
1
|
+
import type { TypographyProps } from '@mui/material'
|
2
|
+
import { Typography } from '@mui/material'
|
3
|
+
import type { ReactNode } from 'react'
|
4
|
+
import React from 'react'
|
3
5
|
|
4
6
|
export interface MenuIconProps extends TypographyProps {
|
5
7
|
icon?: ReactNode
|
@@ -1,18 +1,30 @@
|
|
1
|
-
import {
|
1
|
+
import type { ListItemProps } from '@mui/material'
|
2
|
+
import { ListItem } from '@mui/material'
|
2
3
|
import React from 'react'
|
3
4
|
|
4
|
-
import { MenuListItemBase } from '../../lib/index.ts'
|
5
|
+
import type { MenuListItemBase } from '../../lib/index.ts'
|
5
6
|
|
6
7
|
export interface ListItemExProps extends MenuListItemBase, ListItemProps {}
|
7
8
|
|
8
|
-
export const MenuListItem: React.FC<ListItemExProps> = ({
|
9
|
-
|
9
|
+
export const MenuListItem: React.FC<ListItemExProps> = ({
|
10
|
+
iconOnly, collapseEnd, sx, children, dense, ...props
|
11
|
+
}) => {
|
12
|
+
const listItemSx = iconOnly
|
13
|
+
? {
|
14
|
+
borderRadius: '50%', display: 'inline-flex', flexGrow: 0, width: 'auto',
|
15
|
+
}
|
16
|
+
: { width: '100%' }
|
10
17
|
// wait till collapseEnds to remove the spacing between items
|
11
18
|
const spacingSx = collapseEnd ? { columnGap: 0 } : { columnGap: 1.5 }
|
12
19
|
// adjusts to the paddingY value which does NOT scale along the theme.spacing
|
13
20
|
const paddingSx = dense ? { px: '8px' } : { px: '12px' }
|
14
21
|
return (
|
15
|
-
<ListItem
|
22
|
+
<ListItem
|
23
|
+
sx={{
|
24
|
+
...listItemSx, ...spacingSx, ...paddingSx, ...sx,
|
25
|
+
}}
|
26
|
+
{...props}
|
27
|
+
>
|
16
28
|
{children}
|
17
29
|
</ListItem>
|
18
30
|
)
|
@@ -1,8 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import type { CollapseProps } from '@mui/material'
|
2
|
+
import { Collapse, List } from '@mui/material'
|
3
|
+
import type { WithChildren } from '@xylabs/react-shared'
|
3
4
|
import React from 'react'
|
4
5
|
|
5
|
-
import { NavListItemProps } from '../../lib/index.ts'
|
6
|
+
import type { NavListItemProps } from '../../lib/index.ts'
|
6
7
|
|
7
8
|
export interface SubNavListItemsCollapseProps extends WithChildren, CollapseProps {
|
8
9
|
collapse?: boolean
|
@@ -10,7 +11,9 @@ export interface SubNavListItemsCollapseProps extends WithChildren, CollapseProp
|
|
10
11
|
subNavListItems?: NavListItemProps[]
|
11
12
|
}
|
12
13
|
|
13
|
-
export const SubNavListItemsCollapse: React.FC<SubNavListItemsCollapseProps> = ({
|
14
|
+
export const SubNavListItemsCollapse: React.FC<SubNavListItemsCollapseProps> = ({
|
15
|
+
collapse, openSubNav, children, ...props
|
16
|
+
}) => {
|
14
17
|
return (
|
15
18
|
<Collapse in={collapse == true ? false : openSubNav} {...props}>
|
16
19
|
<List>{children}</List>
|
@@ -1,5 +1,9 @@
|
|
1
|
-
import {
|
2
|
-
import
|
1
|
+
import type { IconButtonProps } from '@mui/material'
|
2
|
+
import { IconButton, useTheme } from '@mui/material'
|
3
|
+
import type {
|
4
|
+
Dispatch, SetStateAction, SyntheticEvent,
|
5
|
+
} from 'react'
|
6
|
+
import React from 'react'
|
3
7
|
// eslint-disable-next-line import-x/no-internal-modules
|
4
8
|
import { VscChevronDown } from 'react-icons/vsc'
|
5
9
|
export interface SubNavToggleIconButtonProps extends IconButtonProps {
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import { Collapse, ListSubheader } from '@mui/material'
|
2
|
-
import { FlexBoxProps
|
2
|
+
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
3
|
+
import { FlexCol } from '@xylabs/react-flexbox'
|
3
4
|
import React from 'react'
|
4
5
|
|
5
|
-
import {
|
6
|
+
import type { MenuListItemProps } from './MenuListItem/index.ts'
|
7
|
+
import { MenuListItemContainer } from './MenuListItem/index.ts'
|
6
8
|
|
7
9
|
export interface MenuSectionProps extends FlexBoxProps {
|
8
10
|
iconMenuTextSpacing?: string
|
@@ -11,7 +13,9 @@ export interface MenuSectionProps extends FlexBoxProps {
|
|
11
13
|
title: string
|
12
14
|
}
|
13
15
|
|
14
|
-
export const MenuSection: React.FC<MenuSectionProps> = ({
|
16
|
+
export const MenuSection: React.FC<MenuSectionProps> = ({
|
17
|
+
iconMenuTextSpacing, listItems, showTitle = true, title, ...props
|
18
|
+
}) => {
|
15
19
|
return (
|
16
20
|
<FlexCol alignItems="stretch" {...props}>
|
17
21
|
<Collapse in={showTitle} timeout={700}>
|
@@ -1,12 +1,14 @@
|
|
1
1
|
import { useMemo } from 'react'
|
2
2
|
|
3
3
|
import { useCollapsible } from '../../../contexts/index.ts'
|
4
|
-
import { MenuListItemProps } from '../MenuListItem/index.ts'
|
4
|
+
import type { MenuListItemProps } from '../MenuListItem/index.ts'
|
5
5
|
|
6
6
|
export type DefaultSiteMenuListItemProps = Pick<MenuListItemProps, 'collapseEnd' | 'dense' | 'iconOnly' | 'sx'>
|
7
7
|
|
8
8
|
export const useMenuItemsShared = () => {
|
9
|
-
const {
|
9
|
+
const {
|
10
|
+
collapse, collapseEnd, setCollapse, setCollapseEnd,
|
11
|
+
} = useCollapsible()
|
10
12
|
|
11
13
|
const onMenuItemToggle = (open?: boolean) => {
|
12
14
|
setCollapse?.(previous => (open ? false : previous))
|
@@ -18,9 +20,7 @@ export const useMenuItemsShared = () => {
|
|
18
20
|
collapseEnd,
|
19
21
|
dense: true,
|
20
22
|
iconOnly: collapse,
|
21
|
-
sx: {
|
22
|
-
px: '8px',
|
23
|
-
},
|
23
|
+
sx: { px: '8px' },
|
24
24
|
}),
|
25
25
|
[collapse, collapseEnd],
|
26
26
|
)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { ListItemProps, ListItemTextProps } from '@mui/material'
|
2
|
-
import { ReactNode } from 'react'
|
3
|
-
import { To } from 'react-router-dom'
|
1
|
+
import type { ListItemProps, ListItemTextProps } from '@mui/material'
|
2
|
+
import type { ReactNode } from 'react'
|
3
|
+
import type { To } from 'react-router-dom'
|
4
4
|
|
5
5
|
export interface NavListItemProps {
|
6
6
|
href?: string
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Meta, StoryFn } from '@storybook/react'
|
1
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
2
2
|
import React from 'react'
|
3
3
|
import { BrowserRouter } from 'react-router-dom'
|
4
4
|
|
@@ -7,11 +7,7 @@ import { ContextToolbar } from './ContextToolbar.tsx'
|
|
7
7
|
const StorybookEntry = {
|
8
8
|
argTypes: {},
|
9
9
|
component: ContextToolbar,
|
10
|
-
parameters: {
|
11
|
-
docs: {
|
12
|
-
page: null,
|
13
|
-
},
|
14
|
-
},
|
10
|
+
parameters: { docs: { page: null } },
|
15
11
|
title: 'appbar/Toolbar/Context',
|
16
12
|
} as Meta<typeof ContextToolbar>
|
17
13
|
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import {
|
1
|
+
import type { ToolbarProps } from '@mui/material'
|
2
|
+
import { Toolbar } from '@mui/material'
|
2
3
|
import React from 'react'
|
3
|
-
import { To } from 'react-router-dom'
|
4
|
+
import type { To } from 'react-router-dom'
|
4
5
|
|
5
6
|
import { LogoLinkEx } from './LogoLinkEx.tsx'
|
6
7
|
|
@@ -9,7 +10,9 @@ export interface ContextToolbarProps extends ToolbarProps {
|
|
9
10
|
version?: boolean
|
10
11
|
}
|
11
12
|
|
12
|
-
export const ContextToolbar: React.FC<ContextToolbarProps> = ({
|
13
|
+
export const ContextToolbar: React.FC<ContextToolbarProps> = ({
|
14
|
+
logoTo = '/', version = false, ...props
|
15
|
+
}) => {
|
13
16
|
return (
|
14
17
|
<Toolbar {...props}>
|
15
18
|
<LogoLinkEx version={version} to={logoTo} />
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { Typography, useTheme } from '@mui/material'
|
2
2
|
import { FlexRow } from '@xylabs/react-flexbox'
|
3
|
-
import {
|
3
|
+
import type { LinkExProps } from '@xylabs/react-link'
|
4
|
+
import { LinkEx } from '@xylabs/react-link'
|
4
5
|
import React from 'react'
|
5
6
|
|
6
7
|
import { Logo } from './Logo.tsx'
|
@@ -9,7 +10,9 @@ export interface LogoLinkExProps extends LinkExProps {
|
|
9
10
|
version?: boolean | string
|
10
11
|
}
|
11
12
|
|
12
|
-
export const LogoLinkEx: React.FC<LogoLinkExProps> = ({
|
13
|
+
export const LogoLinkEx: React.FC<LogoLinkExProps> = ({
|
14
|
+
to = '/', version = false, ...props
|
15
|
+
}) => {
|
13
16
|
const theme = useTheme()
|
14
17
|
return (
|
15
18
|
<LinkEx to={to} {...props}>
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { List } from '@mui/material'
|
2
|
-
import { Meta, StoryFn } from '@storybook/react'
|
2
|
+
import type { Meta, StoryFn } from '@storybook/react'
|
3
3
|
import { NetworkMemoryProvider } from '@xyo-network/react-network'
|
4
4
|
import { TypographyEx } from '@xyo-network/react-shared'
|
5
|
-
import
|
5
|
+
import type { SyntheticEvent } from 'react'
|
6
|
+
import React from 'react'
|
6
7
|
import { BrowserRouter } from 'react-router-dom'
|
7
8
|
|
8
9
|
import { MenuListItemContainer } from '../../SiteMenu/index.ts'
|
@@ -22,11 +23,7 @@ const DefaultMenu = (
|
|
22
23
|
|
23
24
|
const StorybookEntry: Meta = {
|
24
25
|
component: SystemToolbar,
|
25
|
-
parameters: {
|
26
|
-
docs: {
|
27
|
-
page: null,
|
28
|
-
},
|
29
|
-
},
|
26
|
+
parameters: { docs: { page: null } },
|
30
27
|
title: 'appbar/Toolbar/System',
|
31
28
|
}
|
32
29
|
|
@@ -56,6 +53,8 @@ WithOnMenuToggle.args = {
|
|
56
53
|
onMenuToggle: state => console.log(state),
|
57
54
|
}
|
58
55
|
|
59
|
-
export {
|
56
|
+
export {
|
57
|
+
Default, PrecedingChildren, WithOnMenuToggle,
|
58
|
+
}
|
60
59
|
|
61
60
|
export default StorybookEntry
|
@@ -1,10 +1,14 @@
|
|
1
|
-
import {
|
1
|
+
import type { ToolbarProps } from '@mui/material'
|
2
|
+
import { Paper, Toolbar } from '@mui/material'
|
2
3
|
import { FlexRow } from '@xylabs/react-flexbox'
|
3
4
|
import { DarkModeIconButton } from '@xyo-network/react-app-settings'
|
4
|
-
import {
|
5
|
-
import
|
5
|
+
import type { NetworkSelectExProps } from '@xyo-network/react-network'
|
6
|
+
import { NetworkSelectEx } from '@xyo-network/react-network'
|
7
|
+
import type { ReactNode } from 'react'
|
8
|
+
import React from 'react'
|
6
9
|
|
7
|
-
import {
|
10
|
+
import type { SiteMenuProps } from '../../SiteMenu/index.ts'
|
11
|
+
import { SiteMenu } from '../../SiteMenu/index.ts'
|
8
12
|
|
9
13
|
export interface SystemToolbarProps extends ToolbarProps {
|
10
14
|
darkModeButton?: boolean
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ContextExState } from '@xyo-network/react-shared'
|
2
|
-
import { Dispatch, SetStateAction } from 'react'
|
1
|
+
import type { ContextExState } from '@xyo-network/react-shared'
|
2
|
+
import type { Dispatch, SetStateAction } from 'react'
|
3
3
|
|
4
4
|
export interface CollapsibleState extends ContextExState {
|
5
5
|
collapse?: boolean
|