@xyo-network/react-appbar 7.5.8 → 7.5.12

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.
Files changed (36) hide show
  1. package/dist/browser/components/MobileSystemControls/SystemControlsRoot.d.ts +2 -1
  2. package/dist/browser/components/MobileSystemControls/SystemControlsRoot.d.ts.map +1 -1
  3. package/dist/browser/index.mjs +217 -197
  4. package/dist/browser/index.mjs.map +1 -1
  5. package/package.json +100 -35
  6. package/src/components/AppBar/Application.stories.tsx +0 -85
  7. package/src/components/AppBar/Application.tsx +0 -27
  8. package/src/components/AppBar/index.ts +0 -1
  9. package/src/components/CollapsibleDrawer/CollapseDrawer.stories.tsx +0 -55
  10. package/src/components/CollapsibleDrawer/CollapseToggle.tsx +0 -35
  11. package/src/components/CollapsibleDrawer/CollapsibleDrawer.tsx +0 -41
  12. package/src/components/CollapsibleDrawer/index.ts +0 -2
  13. package/src/components/CollapsibleDrawer/storyExampleMenuData.tsx +0 -87
  14. package/src/components/MobileSystemControls/SystemControls.stories.tsx +0 -37
  15. package/src/components/MobileSystemControls/SystemControls.tsx +0 -15
  16. package/src/components/MobileSystemControls/SystemControlsRoot.tsx +0 -58
  17. package/src/components/MobileSystemControls/SystemControlsType.ts +0 -10
  18. package/src/components/MobileSystemControls/SystemControlsUnstyled.tsx +0 -42
  19. package/src/components/MobileSystemControls/controls/SystemControl.tsx +0 -46
  20. package/src/components/MobileSystemControls/controls/SystemControlText.tsx +0 -20
  21. package/src/components/MobileSystemControls/controls/index.ts +0 -2
  22. package/src/components/MobileSystemControls/index.ts +0 -3
  23. package/src/components/SearchBar/SearchBar.tsx +0 -55
  24. package/src/components/SearchBar/index.ts +0 -1
  25. package/src/components/Toolbar/Context/ContextToolbar.stories.tsx +0 -28
  26. package/src/components/Toolbar/Context/ContextToolbar.tsx +0 -21
  27. package/src/components/Toolbar/Context/Logo.tsx +0 -7
  28. package/src/components/Toolbar/Context/LogoLinkEx.tsx +0 -45
  29. package/src/components/Toolbar/Context/index.ts +0 -1
  30. package/src/components/Toolbar/System/SystemToolbar.stories.tsx +0 -59
  31. package/src/components/Toolbar/System/SystemToolbar.tsx +0 -43
  32. package/src/components/Toolbar/System/index.ts +0 -1
  33. package/src/components/Toolbar/index.ts +0 -2
  34. package/src/components/index.ts +0 -5
  35. package/src/global.d.ts +0 -1
  36. package/src/index.ts +0 -1
@@ -1,37 +0,0 @@
1
- import type { Meta, StoryFn } from '@storybook/react-vite'
2
- import { NetworkMemoryProvider } from '@xyo-network/react-network'
3
- import React from 'react'
4
-
5
- import { SystemControls } from './SystemControls.tsx'
6
- import { SystemControlsType } from './SystemControlsType.ts'
7
-
8
- const StorybookEntry: Meta = {
9
- argTypes: {},
10
- component: SystemControls,
11
- parameters: { docs: { page: null } },
12
- title: 'appbar/System/SystemControls',
13
- }
14
-
15
- const Template: StoryFn<typeof SystemControls> = (props) => {
16
- return (
17
- <NetworkMemoryProvider>
18
- <SystemControls {...props} />
19
- </NetworkMemoryProvider>
20
- )
21
- }
22
-
23
- const Left = Template.bind({})
24
- Left.args = {
25
- systemControlsType: SystemControlsType.Left,
26
- visible: true,
27
- }
28
-
29
- const Top = Template.bind({})
30
- Top.args = {
31
- systemControlsType: SystemControlsType.WindowShade,
32
- visible: true,
33
- }
34
-
35
- export { Left, Top }
36
-
37
- export default StorybookEntry
@@ -1,15 +0,0 @@
1
- import { FlexCol } from '@xylabs/react-flexbox'
2
- import React from 'react'
3
-
4
- import { SystemControlsRoot } from './SystemControlsRoot.tsx'
5
- import type { SystemControlsUnstyledProps } from './SystemControlsUnstyled.tsx'
6
-
7
- const SystemControls: React.FC<SystemControlsUnstyledProps> = (props) => {
8
- return (
9
- <FlexCol>
10
- <SystemControlsRoot {...props} />
11
- </FlexCol>
12
- )
13
- }
14
-
15
- export { SystemControls }
@@ -1,58 +0,0 @@
1
- import { styled } from '@mui/material'
2
-
3
- import { SystemControlsType } from './SystemControlsType.ts'
4
- import type { SystemControlsUnstyledProps } from './SystemControlsUnstyled.tsx'
5
- import { SystemControlsUnstyled } from './SystemControlsUnstyled.tsx'
6
-
7
- const SystemControlsRoot = styled(SystemControlsUnstyled, { name: 'SystemControls', slot: 'Root' })<SystemControlsUnstyledProps>(({ theme }) => ({
8
- // shared defaults
9
- ['&']: {
10
- '.toggle': { backgroundColor: theme.vars.palette.primary.main },
11
- 'alignItems': 'start',
12
- 'zIndex': 1,
13
- },
14
- // WindowShade System Controls styles
15
- [`&.system-controls-type-${SystemControlsType.WindowShade}`]: {
16
- '.control': {
17
- borderRadius: '0 0 5px 5px',
18
- flexDirection: 'row',
19
- flexGrow: 1,
20
- justifyContent: 'space-around',
21
- padding: `${theme.spacing(2)} ${theme.spacing(2.5)}`,
22
- },
23
- '.controls': {
24
- alignItems: 'stretch',
25
- flexDirection: 'column',
26
- flexGrow: 1,
27
- },
28
- '.toggle': {
29
- borderRadius: '0 0 5px 5px',
30
- padding: `${theme.spacing(0.5)} ${theme.spacing(1)}`,
31
- },
32
- 'flexDirection': 'row',
33
- 'position': 'absolute',
34
- 'top': 0,
35
- 'width': '100%',
36
- },
37
- // Left System Control styles
38
- [`&.system-controls-type-${SystemControlsType.Left}`]: {
39
- '.control': {
40
- alignItems: 'start',
41
- flexDirection: 'column',
42
- padding: `${theme.spacing(2)} ${theme.spacing(2.5)}`,
43
- },
44
- '.control-wrap': { marginBottom: `${theme.spacing(2)}` },
45
- '.toggle': {
46
- borderRadius: '0 5px 5px 0',
47
- padding: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
48
- writingMode: 'vertical-rl',
49
- },
50
- 'flexDirection': 'column',
51
- 'left': 0,
52
- 'position': 'fixed',
53
- 'top': '30vh',
54
- 'width': 'auto',
55
- },
56
- }))
57
-
58
- export { SystemControlsRoot }
@@ -1,10 +0,0 @@
1
- import type { EnumValue } from '@xylabs/sdk-js'
2
- import { Enum } from '@xylabs/sdk-js'
3
-
4
- export const SystemControlsType = Enum({
5
- Left: 'Left',
6
- Right: 'Right',
7
- WindowShade: 'WindowShade',
8
- })
9
-
10
- export type SystemControlsType = EnumValue<typeof SystemControlsType>
@@ -1,42 +0,0 @@
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'
5
- import { NetworkSelectEx } from '@xyo-network/react-network'
6
- import React from 'react'
7
-
8
- import { SystemControl } from './controls/index.ts'
9
- import { SystemControlsType } from './SystemControlsType.ts'
10
-
11
- interface SystemControlsUnstyledProps extends FlexBoxProps {
12
- systemControlsType?: SystemControlsType
13
- visible?: boolean
14
- }
15
-
16
- const SystemControlsUnstyled: React.FC<SystemControlsUnstyledProps> = ({
17
- visible,
18
- systemControlsType = SystemControlsType.WindowShade,
19
- ...props
20
- }) => {
21
- const isSmall = useMediaQuery<Theme>(theme => theme.breakpoints.down('sm'))
22
-
23
- return visible || isSmall
24
- ? (
25
- <FlexCol {...props} className={`${props.className} system-controls-type-${systemControlsType}`}>
26
- <SystemControl
27
- systemControlsType={systemControlsType}
28
- controlElement={(
29
- <FlexRow className="control-wrap">
30
- <Paper variant="elevation" elevation={0}>
31
- <NetworkSelectEx responsive={false} className="network-ex" />
32
- </Paper>
33
- </FlexRow>
34
- )}
35
- />
36
- </FlexCol>
37
- )
38
- : <FlexCol />
39
- }
40
-
41
- export type { SystemControlsUnstyledProps }
42
- export { SystemControlsUnstyled }
@@ -1,46 +0,0 @@
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 { PropsWithChildren } from 'react'
6
- import React, { useState } from 'react'
7
-
8
- import { SystemControlsType } from '../SystemControlsType.ts'
9
-
10
- interface SystemControlProps extends FlexBoxProps {
11
- controlElement: React.ReactNode
12
- systemControlsType?: SystemControlsType
13
- }
14
-
15
- const SystemControl: React.FC<PropsWithChildren<SystemControlProps>> = ({
16
- children,
17
- controlElement,
18
- systemControlsType = SystemControlsType.WindowShade,
19
- ...props
20
- }) => {
21
- const [toggleControls, setToggleControls] = useState(false)
22
-
23
- let orientation: CollapseProps['orientation'] = 'vertical'
24
-
25
- switch (systemControlsType) {
26
- case SystemControlsType.Left: {
27
- orientation = 'horizontal'
28
- break
29
- }
30
- }
31
-
32
- return (
33
- <FlexRow className="controls" {...props}>
34
- <Collapse in={toggleControls} orientation={orientation} timeout={500}>
35
- <FlexRow bgcolor="primary.main" className="control">
36
- {controlElement}
37
- </FlexRow>
38
- </Collapse>
39
- <FlexCol style={{ cursor: 'pointer' }} onClick={() => setToggleControls(!toggleControls)}>
40
- {children}
41
- </FlexCol>
42
- </FlexRow>
43
- )
44
- }
45
-
46
- export { SystemControl }
@@ -1,20 +0,0 @@
1
- import { Typography } from '@mui/material'
2
- import type { FlexBoxProps } from '@xylabs/react-flexbox'
3
- import { FlexCol } from '@xylabs/react-flexbox'
4
- import React from 'react'
5
-
6
- interface SystemControlTextProps extends FlexBoxProps {
7
- value?: string
8
- }
9
-
10
- const ControlText: React.FC<SystemControlTextProps> = ({ value, ...props }) => {
11
- return (
12
- <FlexCol className={`${props.className} toggle`} {...props}>
13
- <Typography variant="caption" color="white" fontWeight="bold">
14
- {value}
15
- </Typography>
16
- </FlexCol>
17
- )
18
- }
19
-
20
- export { ControlText }
@@ -1,2 +0,0 @@
1
- export * from './SystemControl.tsx'
2
- export * from './SystemControlText.tsx'
@@ -1,3 +0,0 @@
1
- export * from './SystemControls.tsx'
2
- export * from './SystemControlsType.ts'
3
- export * from './SystemControlsUnstyled.tsx'
@@ -1,55 +0,0 @@
1
- import { Search as SearchIcon } from '@mui/icons-material'
2
- import { Paper, TextField } from '@mui/material'
3
- import { ButtonEx } from '@xylabs/react-button'
4
- import type { FlexBoxProps } from '@xylabs/react-flexbox'
5
- import { FlexRow } from '@xylabs/react-flexbox'
6
- import React, { useState } from 'react'
7
-
8
- export interface SearchBarProps extends FlexBoxProps {
9
- onSearch?: (term?: string) => void
10
- }
11
-
12
- export const SearchBar: React.FC<SearchBarProps> = ({
13
- defaultValue, onSearch, ...props
14
- }) => {
15
- const [term, setTerm] = useState<string>()
16
-
17
- return (
18
- <FlexRow alignItems="stretch" {...props}>
19
- <Paper
20
- variant="elevation"
21
- elevation={0}
22
- style={{
23
- display: 'flex', overflow: 'hidden', width: '100%',
24
- }}
25
- >
26
- <TextField
27
- variant="outlined"
28
- size="small"
29
- defaultValue={defaultValue}
30
- fullWidth
31
- onChange={event => setTerm(event.target.value)}
32
- onKeyDown={(event) => {
33
- if (event.key === 'Enter') onSearch?.(term)
34
- }}
35
- slotProps={{
36
- input: {
37
- color: 'secondary',
38
- style: {
39
- borderBottomRightRadius: 0, borderTopRightRadius: 0, borderWidth: 0,
40
- },
41
- },
42
- }}
43
- />
44
- <ButtonEx
45
- variant="contained"
46
- style={{ borderRadius: 0, borderTopLeftRadius: 0 }}
47
- color="secondary"
48
- onClick={() => onSearch?.(term)}
49
- >
50
- <SearchIcon />
51
- </ButtonEx>
52
- </Paper>
53
- </FlexRow>
54
- )
55
- }
@@ -1 +0,0 @@
1
- export * from './SearchBar.tsx'
@@ -1,28 +0,0 @@
1
- import type { Meta, StoryFn } from '@storybook/react-vite'
2
- import React from 'react'
3
- import { BrowserRouter } from 'react-router-dom'
4
-
5
- import { XyoContextToolbar } from './ContextToolbar.tsx'
6
-
7
- const StorybookEntry = {
8
- argTypes: {},
9
- component: XyoContextToolbar,
10
- parameters: { docs: { page: null } },
11
- title: 'appbar/Toolbar/XyoContextToolbar',
12
- } as Meta<typeof XyoContextToolbar>
13
-
14
- const Template: StoryFn<typeof XyoContextToolbar> = args => (
15
- <BrowserRouter>
16
- <XyoContextToolbar {...args}></XyoContextToolbar>
17
- </BrowserRouter>
18
- )
19
-
20
- const Default = Template.bind({})
21
- Default.args = {}
22
-
23
- const WithVersion = Template.bind({})
24
- WithVersion.args = { version: true }
25
-
26
- export { Default, WithVersion }
27
-
28
- export default StorybookEntry
@@ -1,21 +0,0 @@
1
- import { Toolbar } from '@mui/material'
2
- import type { ContextToolbarProps } from '@xylabs/react-appbar'
3
- import type { ReactNode } from 'react'
4
- import React from 'react'
5
-
6
- import { LogoLinkEx } from './LogoLinkEx.tsx'
7
-
8
- export interface XyoContextToolbarProps extends ContextToolbarProps {
9
- logo?: ReactNode
10
- }
11
-
12
- export const XyoContextToolbar: React.FC<XyoContextToolbarProps> = ({
13
- children, logo, logoTo = '/', version = false, ...props
14
- }) => {
15
- return (
16
- <Toolbar {...props}>
17
- <LogoLinkEx logo={logo} version={version} to={logoTo} />
18
- {children}
19
- </Toolbar>
20
- )
21
- }
@@ -1,7 +0,0 @@
1
- import React from 'react'
2
-
3
- export const Logo: React.FC<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>> = (props) => {
4
- const logoUrl
5
- = 'https://cdn.xy.company/img/brand/XYO/XYO_icon_white.svg'
6
- return <img src={logoUrl} {...props} />
7
- }
@@ -1,45 +0,0 @@
1
- import { Typography, useTheme } from '@mui/material'
2
- import { FlexRow } from '@xylabs/react-flexbox'
3
- import type { LinkExProps } from '@xylabs/react-link'
4
- import { LinkEx } from '@xylabs/react-link'
5
- import { assertEx } from '@xylabs/sdk-js'
6
- import React from 'react'
7
-
8
- import { Logo } from './Logo.tsx'
9
-
10
- export type LogoLinkExProps = LinkExProps & {
11
- logo?: React.ReactNode
12
- version?: boolean | string
13
- }
14
-
15
- export const LogoLinkEx: React.FC<LogoLinkExProps> = ({
16
- logo, to = '/', href, version = false, ...props
17
- }) => {
18
- const theme = useTheme()
19
- assertEx(href === undefined, () => 'href is not supported')
20
- return (
21
- <LinkEx to={to} sx={{ 'opacity': 0.8, '&:hover': { opacity: 1 } }} {...props}>
22
- <FlexRow paddingX="4px">
23
- {logo ?? <Logo height="40" width="43" />}
24
- {version === undefined
25
- ? null
26
- : (
27
- <Typography
28
- position="absolute"
29
- borderRadius={1}
30
- right={6}
31
- color={theme.vars.palette.primary.main}
32
- bottom={0}
33
- bgcolor={theme.vars.palette.primary.contrastText}
34
- paddingX="2px"
35
- lineHeight={1}
36
- variant="caption"
37
- border={`1px ${theme.vars.palette.primary.main} solid`}
38
- >
39
- {typeof version === 'string' ? version : '2.1'}
40
- </Typography>
41
- )}
42
- </FlexRow>
43
- </LinkEx>
44
- )
45
- }
@@ -1 +0,0 @@
1
- export * from './ContextToolbar.tsx'
@@ -1,59 +0,0 @@
1
- import { List, Typography } from '@mui/material'
2
- import type { Meta, StoryFn } from '@storybook/react-vite'
3
- import { MenuListItemContainer } from '@xylabs/react-appbar'
4
- import { NetworkMemoryProvider } from '@xyo-network/react-network'
5
- import type { SyntheticEvent } from 'react'
6
- import React from 'react'
7
- import { BrowserRouter } from 'react-router-dom'
8
-
9
- import { XyoSystemToolbar } from './SystemToolbar.tsx'
10
-
11
- const DefaultMenu = (
12
- <List>
13
- <MenuListItemContainer primary="Hello" />
14
- <MenuListItemContainer
15
- primary="Click and Keep Open"
16
- onClick={(event: SyntheticEvent) => {
17
- event.stopPropagation()
18
- }}
19
- />
20
- </List>
21
- )
22
-
23
- const StorybookEntry: Meta = {
24
- component: XyoSystemToolbar,
25
- parameters: { docs: { page: null } },
26
- title: 'appbar/Toolbar/System',
27
- }
28
-
29
- const Template: StoryFn<typeof XyoSystemToolbar> = args => (
30
- <BrowserRouter>
31
- <NetworkMemoryProvider>
32
- <XyoSystemToolbar {...args} />
33
- </NetworkMemoryProvider>
34
- </BrowserRouter>
35
- )
36
-
37
- const Default = Template.bind({})
38
- Default.args = {}
39
-
40
- const PrecedingChildren = Template.bind({})
41
- PrecedingChildren.args = {
42
- precedingChildren: (
43
- <Typography variant="body1" mx={0.5}>
44
- Preceding Child Component
45
- </Typography>
46
- ),
47
- }
48
-
49
- const WithOnMenuToggle = Template.bind({})
50
- WithOnMenuToggle.args = {
51
- menuItems: DefaultMenu,
52
- onMenuToggle: state => console.log(state),
53
- }
54
-
55
- export {
56
- Default, PrecedingChildren, WithOnMenuToggle,
57
- }
58
-
59
- export default StorybookEntry
@@ -1,43 +0,0 @@
1
- import { Paper } from '@mui/material'
2
- import {
3
- type SiteMenuProps, SystemToolbar, type SystemToolbarProps,
4
- } from '@xylabs/react-appbar'
5
- import { FlexRow } from '@xylabs/react-flexbox'
6
- import type { NetworkSelectExProps } from '@xyo-network/react-network'
7
- import { NetworkSelectEx } from '@xyo-network/react-network'
8
- import type { ReactNode } from 'react'
9
- import React from 'react'
10
-
11
- export interface XyoSystemToolbarProps extends SystemToolbarProps {
12
- darkModeButton?: boolean
13
- developerMode?: boolean
14
- hideNetworkSelect?: boolean
15
- menuItems?: ReactNode
16
- networkSelectProps?: NetworkSelectExProps
17
- onMenuToggle?: SiteMenuProps['onMenuToggle']
18
- precedingChildren?: ReactNode
19
- }
20
-
21
- export const XyoSystemToolbar: React.FC<XyoSystemToolbarProps> = ({
22
- children,
23
- hideNetworkSelect,
24
- networkSelectProps,
25
- precedingChildren,
26
- ...props
27
- }) => {
28
- return (
29
- <SystemToolbar {...props}>
30
- {precedingChildren}
31
- {hideNetworkSelect
32
- ? null
33
- : (
34
- <FlexRow marginX={0.5}>
35
- <Paper variant="elevation">
36
- <NetworkSelectEx fullWidth {...networkSelectProps} />
37
- </Paper>
38
- </FlexRow>
39
- )}
40
- {children}
41
- </SystemToolbar>
42
- )
43
- }
@@ -1 +0,0 @@
1
- export * from './SystemToolbar.tsx'
@@ -1,2 +0,0 @@
1
- export * from './Context/index.ts'
2
- export * from './System/index.ts'
@@ -1,5 +0,0 @@
1
- export * from './AppBar/index.ts'
2
- export * from './CollapsibleDrawer/index.ts'
3
- export * from './MobileSystemControls/index.ts'
4
- export * from './SearchBar/index.ts'
5
- export * from './Toolbar/index.ts'
package/src/global.d.ts DELETED
@@ -1 +0,0 @@
1
- import '@mui/material/themeCssVarsAugmentation'
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './components/index.ts'