@xyo-network/react-appbar 3.0.2 → 3.0.4
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 +53 -47
- package/src/components/AppBar/Application.stories.tsx +7 -7
- package/src/components/AppBar/Application.tsx +3 -1
- package/src/components/CollapsibleDrawer/CollapseDrawer.stories.tsx +8 -10
- package/src/components/CollapsibleDrawer/CollapseToggle.tsx +3 -1
- package/src/components/CollapsibleDrawer/CollapsibleDrawer.tsx +6 -2
- package/src/components/CollapsibleDrawer/storyExampleMenuData.tsx +9 -3
- package/src/components/MobileSystemControls/SystemControls.stories.tsx +1 -5
- package/src/components/MobileSystemControls/SystemControlsRoot.tsx +2 -6
- package/src/components/SearchBar/SearchBar.tsx +22 -4
- package/src/components/SiteMenu/Menu.tsx +6 -2
- package/src/components/SiteMenu/MenuListItem/MenuListItemContainer.stories.tsx +4 -6
- package/src/components/SiteMenu/MenuListItem/MenuListItemContainer.tsx +3 -1
- package/src/components/SiteMenu/MenuListItem/list-item-components/MenuListItem.tsx +14 -3
- package/src/components/SiteMenu/MenuListItem/sub-nav/SubNavListItemCollapse.tsx +3 -1
- package/src/components/SiteMenu/MenuListItem/sub-nav/SubNavToggleIconButton.tsx +3 -1
- package/src/components/SiteMenu/MenuSection.tsx +3 -1
- package/src/components/SiteMenu/hooks/useMenuItemsShared.tsx +4 -4
- package/src/components/Toolbar/Context/ContextToolbar.stories.tsx +1 -5
- package/src/components/Toolbar/Context/ContextToolbar.tsx +3 -1
- package/src/components/Toolbar/Context/LogoLinkEx.tsx +3 -1
- package/src/components/Toolbar/System/SystemToolbar.stories.tsx +4 -6
- package/src/contexts/Collapsible/provider.tsx +10 -13
- package/xy.config.ts +1 -3
@@ -8,7 +8,9 @@ import { VscArrowSmallLeft, VscArrowSmallRight } from 'react-icons/vsc'
|
|
8
8
|
import { useCollapsible } from '../../contexts/index.ts'
|
9
9
|
|
10
10
|
export const CollapseToggleFlex: React.FC<FlexBoxProps> = (props) => {
|
11
|
-
const {
|
11
|
+
const {
|
12
|
+
collapse, setCollapse, setCollapseEnd,
|
13
|
+
} = useCollapsible()
|
12
14
|
const [hover, setHover] = useState(false)
|
13
15
|
const theme = useTheme()
|
14
16
|
|
@@ -1,11 +1,15 @@
|
|
1
1
|
import type { CollapseProps } from '@mui/material'
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
Collapse, styled, useTheme,
|
4
|
+
} from '@mui/material'
|
3
5
|
import type { WithChildren } from '@xylabs/react-shared'
|
4
6
|
import React from 'react'
|
5
7
|
|
6
8
|
import { useCollapsible } from '../../contexts/index.ts'
|
7
9
|
|
8
|
-
export const CollapsibleDrawer: React.FC<WithChildren<CollapseProps>> = ({
|
10
|
+
export const CollapsibleDrawer: React.FC<WithChildren<CollapseProps>> = ({
|
11
|
+
children, sx, ...props
|
12
|
+
}) => {
|
9
13
|
const { collapse, setCollapseEnd } = useCollapsible()
|
10
14
|
const theme = useTheme()
|
11
15
|
|
@@ -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.',
|
@@ -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
|
|
@@ -7,9 +7,7 @@ import { SystemControlsUnstyled } from './SystemControlsUnstyled.tsx'
|
|
7
7
|
const SystemControlsRoot = styled(SystemControlsUnstyled, { name: 'SystemControls', slot: 'Root' })<SystemControlsUnstyledProps>(({ theme }) => ({
|
8
8
|
// shared defaults
|
9
9
|
['&']: {
|
10
|
-
'.toggle': {
|
11
|
-
backgroundColor: theme.palette.primary.main,
|
12
|
-
},
|
10
|
+
'.toggle': { backgroundColor: theme.palette.primary.main },
|
13
11
|
'alignItems': 'start',
|
14
12
|
'zIndex': 1,
|
15
13
|
},
|
@@ -43,9 +41,7 @@ const SystemControlsRoot = styled(SystemControlsUnstyled, { name: 'SystemControl
|
|
43
41
|
flexDirection: 'column',
|
44
42
|
padding: `${theme.spacing(2)} ${theme.spacing(2.5)}`,
|
45
43
|
},
|
46
|
-
'.control-wrap': {
|
47
|
-
marginBottom: `${theme.spacing(2)}`,
|
48
|
-
},
|
44
|
+
'.control-wrap': { marginBottom: `${theme.spacing(2)}` },
|
49
45
|
'.toggle': {
|
50
46
|
borderRadius: '0 5px 5px 0',
|
51
47
|
padding: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
|
@@ -9,14 +9,27 @@ export interface SearchBarProps extends FlexBoxProps {
|
|
9
9
|
onSearch?: (term?: string) => void
|
10
10
|
}
|
11
11
|
|
12
|
-
export const SearchBar: React.FC<SearchBarProps> = ({
|
12
|
+
export const SearchBar: React.FC<SearchBarProps> = ({
|
13
|
+
defaultValue, onSearch, ...props
|
14
|
+
}) => {
|
13
15
|
const [term, setTerm] = useState<string>()
|
14
16
|
|
15
17
|
return (
|
16
18
|
<FlexRow alignItems="stretch" {...props}>
|
17
|
-
<Paper
|
19
|
+
<Paper
|
20
|
+
variant="elevation"
|
21
|
+
elevation={0}
|
22
|
+
style={{
|
23
|
+
display: 'flex', overflow: 'hidden', width: '100%',
|
24
|
+
}}
|
25
|
+
>
|
18
26
|
<TextField
|
19
|
-
InputProps={{
|
27
|
+
InputProps={{
|
28
|
+
color: 'secondary',
|
29
|
+
style: {
|
30
|
+
borderBottomRightRadius: 0, borderTopRightRadius: 0, borderWidth: 0,
|
31
|
+
},
|
32
|
+
}}
|
20
33
|
variant="outlined"
|
21
34
|
size="small"
|
22
35
|
defaultValue={defaultValue}
|
@@ -26,7 +39,12 @@ export const SearchBar: React.FC<SearchBarProps> = ({ defaultValue, onSearch, ..
|
|
26
39
|
if (event.key === 'Enter') onSearch?.(term)
|
27
40
|
}}
|
28
41
|
/>
|
29
|
-
<ButtonEx
|
42
|
+
<ButtonEx
|
43
|
+
variant="contained"
|
44
|
+
style={{ borderRadius: 0, borderTopLeftRadius: 0 }}
|
45
|
+
color="secondary"
|
46
|
+
onClick={() => onSearch?.(term)}
|
47
|
+
>
|
30
48
|
<SearchIcon />
|
31
49
|
</ButtonEx>
|
32
50
|
</Paper>
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import { Menu as MenuIcon, Settings as SettingsIcon } from '@mui/icons-material'
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
IconButton, List, SwipeableDrawer,
|
4
|
+
} from '@mui/material'
|
3
5
|
import type { FlexBoxProps } from '@xylabs/react-flexbox'
|
4
6
|
import { FlexRow } from '@xylabs/react-flexbox'
|
5
7
|
import React, { useEffect, useState } from 'react'
|
@@ -12,7 +14,9 @@ export interface SiteMenuProps extends FlexBoxProps {
|
|
12
14
|
side?: 'left' | 'right' | 'top' | 'bottom'
|
13
15
|
}
|
14
16
|
|
15
|
-
export const SiteMenu: React.FC<SiteMenuProps> = ({
|
17
|
+
export const SiteMenu: React.FC<SiteMenuProps> = ({
|
18
|
+
children, onMenuToggle, side = 'right', ...props
|
19
|
+
}) => {
|
16
20
|
const [open, setOpen] = useState(false)
|
17
21
|
|
18
22
|
useEffect(() => {
|
@@ -11,11 +11,7 @@ import { MenuListItemContainer } from './MenuListItemContainer.tsx'
|
|
11
11
|
const StorybookEntry = {
|
12
12
|
argTypes: {},
|
13
13
|
component: MenuListItemContainer,
|
14
|
-
parameters: {
|
15
|
-
docs: {
|
16
|
-
page: null,
|
17
|
-
},
|
18
|
-
},
|
14
|
+
parameters: { docs: { page: null } },
|
19
15
|
title: 'appbar/MenuListItemContainer',
|
20
16
|
} as Meta<typeof MenuListItemContainer>
|
21
17
|
|
@@ -47,7 +43,9 @@ const WithChildren = Template.bind({})
|
|
47
43
|
WithChildren.args = {
|
48
44
|
icon: <FaGlobeAmericas />,
|
49
45
|
primary: 'Explore',
|
50
|
-
subNavListItems: [{
|
46
|
+
subNavListItems: [{
|
47
|
+
primary: 'Explore', to: '/explore', tooltip: 'View global archivist data on a world map.',
|
48
|
+
}],
|
51
49
|
tooltip: 'View global archivist data on a world map.',
|
52
50
|
}
|
53
51
|
|
@@ -6,7 +6,9 @@ import React, { useState } from 'react'
|
|
6
6
|
|
7
7
|
import { useCollapsible } from '../../../contexts/index.ts'
|
8
8
|
import type { MenuListItemBase, NavListItemProps } from '../lib/index.ts'
|
9
|
-
import {
|
9
|
+
import {
|
10
|
+
ListItemTooltip, MenuIcon, MenuListItem,
|
11
|
+
} from './list-item-components/index.ts'
|
10
12
|
import { SubNavListItemsCollapse, SubNavToggleIconButton } from './sub-nav/index.ts'
|
11
13
|
|
12
14
|
export interface MenuListItemProps extends NavListItemProps, MenuListItemBase, ListItemProps {
|
@@ -6,14 +6,25 @@ import type { MenuListItemBase } from '../../lib/index.ts'
|
|
6
6
|
|
7
7
|
export interface ListItemExProps extends MenuListItemBase, ListItemProps {}
|
8
8
|
|
9
|
-
export const MenuListItem: React.FC<ListItemExProps> = ({
|
10
|
-
|
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%' }
|
11
17
|
// wait till collapseEnds to remove the spacing between items
|
12
18
|
const spacingSx = collapseEnd ? { columnGap: 0 } : { columnGap: 1.5 }
|
13
19
|
// adjusts to the paddingY value which does NOT scale along the theme.spacing
|
14
20
|
const paddingSx = dense ? { px: '8px' } : { px: '12px' }
|
15
21
|
return (
|
16
|
-
<ListItem
|
22
|
+
<ListItem
|
23
|
+
sx={{
|
24
|
+
...listItemSx, ...spacingSx, ...paddingSx, ...sx,
|
25
|
+
}}
|
26
|
+
{...props}
|
27
|
+
>
|
17
28
|
{children}
|
18
29
|
</ListItem>
|
19
30
|
)
|
@@ -11,7 +11,9 @@ export interface SubNavListItemsCollapseProps extends WithChildren, CollapseProp
|
|
11
11
|
subNavListItems?: NavListItemProps[]
|
12
12
|
}
|
13
13
|
|
14
|
-
export const SubNavListItemsCollapse: React.FC<SubNavListItemsCollapseProps> = ({
|
14
|
+
export const SubNavListItemsCollapse: React.FC<SubNavListItemsCollapseProps> = ({
|
15
|
+
collapse, openSubNav, children, ...props
|
16
|
+
}) => {
|
15
17
|
return (
|
16
18
|
<Collapse in={collapse == true ? false : openSubNav} {...props}>
|
17
19
|
<List>{children}</List>
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import type { IconButtonProps } from '@mui/material'
|
2
2
|
import { IconButton, useTheme } from '@mui/material'
|
3
|
-
import type {
|
3
|
+
import type {
|
4
|
+
Dispatch, SetStateAction, SyntheticEvent,
|
5
|
+
} from 'react'
|
4
6
|
import React from 'react'
|
5
7
|
// eslint-disable-next-line import-x/no-internal-modules
|
6
8
|
import { VscChevronDown } from 'react-icons/vsc'
|
@@ -13,7 +13,9 @@ export interface MenuSectionProps extends FlexBoxProps {
|
|
13
13
|
title: string
|
14
14
|
}
|
15
15
|
|
16
|
-
export const MenuSection: React.FC<MenuSectionProps> = ({
|
16
|
+
export const MenuSection: React.FC<MenuSectionProps> = ({
|
17
|
+
iconMenuTextSpacing, listItems, showTitle = true, title, ...props
|
18
|
+
}) => {
|
17
19
|
return (
|
18
20
|
<FlexCol alignItems="stretch" {...props}>
|
19
21
|
<Collapse in={showTitle} timeout={700}>
|
@@ -6,7 +6,9 @@ import type { MenuListItemProps } from '../MenuListItem/index.ts'
|
|
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
|
)
|
@@ -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
|
|
@@ -10,7 +10,9 @@ export interface ContextToolbarProps extends ToolbarProps {
|
|
10
10
|
version?: boolean
|
11
11
|
}
|
12
12
|
|
13
|
-
export const ContextToolbar: React.FC<ContextToolbarProps> = ({
|
13
|
+
export const ContextToolbar: React.FC<ContextToolbarProps> = ({
|
14
|
+
logoTo = '/', version = false, ...props
|
15
|
+
}) => {
|
14
16
|
return (
|
15
17
|
<Toolbar {...props}>
|
16
18
|
<LogoLinkEx version={version} to={logoTo} />
|
@@ -10,7 +10,9 @@ export interface LogoLinkExProps extends LinkExProps {
|
|
10
10
|
version?: boolean | string
|
11
11
|
}
|
12
12
|
|
13
|
-
export const LogoLinkEx: React.FC<LogoLinkExProps> = ({
|
13
|
+
export const LogoLinkEx: React.FC<LogoLinkExProps> = ({
|
14
|
+
to = '/', version = false, ...props
|
15
|
+
}) => {
|
14
16
|
const theme = useTheme()
|
15
17
|
return (
|
16
18
|
<LinkEx to={to} {...props}>
|
@@ -23,11 +23,7 @@ const DefaultMenu = (
|
|
23
23
|
|
24
24
|
const StorybookEntry: Meta = {
|
25
25
|
component: SystemToolbar,
|
26
|
-
parameters: {
|
27
|
-
docs: {
|
28
|
-
page: null,
|
29
|
-
},
|
30
|
-
},
|
26
|
+
parameters: { docs: { page: null } },
|
31
27
|
title: 'appbar/Toolbar/System',
|
32
28
|
}
|
33
29
|
|
@@ -57,6 +53,8 @@ WithOnMenuToggle.args = {
|
|
57
53
|
onMenuToggle: state => console.log(state),
|
58
54
|
}
|
59
55
|
|
60
|
-
export {
|
56
|
+
export {
|
57
|
+
Default, PrecedingChildren, WithOnMenuToggle,
|
58
|
+
}
|
61
59
|
|
62
60
|
export default StorybookEntry
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { WithChildren } from '@xylabs/react-shared'
|
2
|
-
import React, {
|
2
|
+
import React, { useState } from 'react'
|
3
3
|
|
4
4
|
import { CollapsibleContext } from './context.ts'
|
5
5
|
|
@@ -8,21 +8,18 @@ export interface CollapsibleProviderProps extends WithChildren {
|
|
8
8
|
defaultCollapseEnd?: boolean
|
9
9
|
}
|
10
10
|
|
11
|
-
export const CollapsibleProvider: React.FC<CollapsibleProviderProps> = ({
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
setCollapse(defaultCollapse)
|
17
|
-
}, [defaultCollapse])
|
18
|
-
|
19
|
-
useEffect(() => {
|
20
|
-
setCollapseEnd(defaultCollapseEnd)
|
21
|
-
}, [defaultCollapseEnd])
|
11
|
+
export const CollapsibleProvider: React.FC<CollapsibleProviderProps> = ({
|
12
|
+
defaultCollapse = false, defaultCollapseEnd = false, children,
|
13
|
+
}) => {
|
14
|
+
const [collapse, setCollapse] = useState(() => defaultCollapse)
|
15
|
+
const [collapseEnd, setCollapseEnd] = useState(() => defaultCollapseEnd)
|
22
16
|
|
23
17
|
return (
|
24
18
|
// eslint-disable-next-line @eslint-react/no-unstable-context-value
|
25
|
-
<CollapsibleContext.Provider value={{
|
19
|
+
<CollapsibleContext.Provider value={{
|
20
|
+
collapse, collapseEnd, provided: true, setCollapse, setCollapseEnd,
|
21
|
+
}}
|
22
|
+
>
|
26
23
|
{children}
|
27
24
|
</CollapsibleContext.Provider>
|
28
25
|
)
|