@xyo-network/react-appbar 2.23.7
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/LICENSE +165 -0
- package/README.md +69 -0
- package/babel.config.json +5 -0
- package/dist/cjs/components/AppBar/Application.d.ts +8 -0
- package/dist/cjs/components/AppBar/Application.js +16 -0
- package/dist/cjs/components/AppBar/Application.js.map +1 -0
- package/dist/cjs/components/AppBar/index.d.ts +1 -0
- package/dist/cjs/components/AppBar/index.js +5 -0
- package/dist/cjs/components/AppBar/index.js.map +1 -0
- package/dist/cjs/components/MobileSystemControls/SystemControls.d.ts +4 -0
- package/dist/cjs/components/MobileSystemControls/SystemControls.js +11 -0
- package/dist/cjs/components/MobileSystemControls/SystemControls.js.map +1 -0
- package/dist/cjs/components/MobileSystemControls/SystemControlsRoot.d.ts +3 -0
- package/dist/cjs/components/MobileSystemControls/SystemControlsRoot.js +62 -0
- package/dist/cjs/components/MobileSystemControls/SystemControlsRoot.js.map +1 -0
- package/dist/cjs/components/MobileSystemControls/SystemControlsType.d.ts +5 -0
- package/dist/cjs/components/MobileSystemControls/SystemControlsType.js +10 -0
- package/dist/cjs/components/MobileSystemControls/SystemControlsType.js.map +1 -0
- package/dist/cjs/components/MobileSystemControls/SystemControlsUnstyled.d.ts +10 -0
- package/dist/cjs/components/MobileSystemControls/SystemControlsUnstyled.js +25 -0
- package/dist/cjs/components/MobileSystemControls/SystemControlsUnstyled.js.map +1 -0
- package/dist/cjs/components/MobileSystemControls/controls/SystemControl.d.ts +9 -0
- package/dist/cjs/components/MobileSystemControls/controls/SystemControl.js +23 -0
- package/dist/cjs/components/MobileSystemControls/controls/SystemControl.js.map +1 -0
- package/dist/cjs/components/MobileSystemControls/controls/SystemControlText.d.ts +7 -0
- package/dist/cjs/components/MobileSystemControls/controls/SystemControlText.js +13 -0
- package/dist/cjs/components/MobileSystemControls/controls/SystemControlText.js.map +1 -0
- package/dist/cjs/components/MobileSystemControls/controls/index.d.ts +2 -0
- package/dist/cjs/components/MobileSystemControls/controls/index.js +6 -0
- package/dist/cjs/components/MobileSystemControls/controls/index.js.map +1 -0
- package/dist/cjs/components/MobileSystemControls/index.d.ts +3 -0
- package/dist/cjs/components/MobileSystemControls/index.js +7 -0
- package/dist/cjs/components/MobileSystemControls/index.js.map +1 -0
- package/dist/cjs/components/SearchBar/SearchBar.d.ts +6 -0
- package/dist/cjs/components/SearchBar/SearchBar.js +19 -0
- package/dist/cjs/components/SearchBar/SearchBar.js.map +1 -0
- package/dist/cjs/components/SearchBar/index.d.ts +1 -0
- package/dist/cjs/components/SearchBar/index.js +5 -0
- package/dist/cjs/components/SearchBar/index.js.map +1 -0
- package/dist/cjs/components/Toolbar/Context/ContextToolbar.d.ts +8 -0
- package/dist/cjs/components/Toolbar/Context/ContextToolbar.js +13 -0
- package/dist/cjs/components/Toolbar/Context/ContextToolbar.js.map +1 -0
- package/dist/cjs/components/Toolbar/Context/XyoLogo.d.ts +2 -0
- package/dist/cjs/components/Toolbar/Context/XyoLogo.js +12 -0
- package/dist/cjs/components/Toolbar/Context/XyoLogo.js.map +1 -0
- package/dist/cjs/components/Toolbar/Context/XyoLogoLinkEx.d.ts +6 -0
- package/dist/cjs/components/Toolbar/Context/XyoLogoLinkEx.js +15 -0
- package/dist/cjs/components/Toolbar/Context/XyoLogoLinkEx.js.map +1 -0
- package/dist/cjs/components/Toolbar/Context/index.d.ts +1 -0
- package/dist/cjs/components/Toolbar/Context/index.js +5 -0
- package/dist/cjs/components/Toolbar/Context/index.js.map +1 -0
- package/dist/cjs/components/Toolbar/System/SiteMenu.d.ts +14 -0
- package/dist/cjs/components/Toolbar/System/SiteMenu.js +41 -0
- package/dist/cjs/components/Toolbar/System/SiteMenu.js.map +1 -0
- package/dist/cjs/components/Toolbar/System/SystemToolbar.d.ts +16 -0
- package/dist/cjs/components/Toolbar/System/SystemToolbar.js +18 -0
- package/dist/cjs/components/Toolbar/System/SystemToolbar.js.map +1 -0
- package/dist/cjs/components/Toolbar/System/index.d.ts +2 -0
- package/dist/cjs/components/Toolbar/System/index.js +6 -0
- package/dist/cjs/components/Toolbar/System/index.js.map +1 -0
- package/dist/cjs/components/Toolbar/index.d.ts +2 -0
- package/dist/cjs/components/Toolbar/index.js +6 -0
- package/dist/cjs/components/Toolbar/index.js.map +1 -0
- package/dist/cjs/components/index.d.ts +4 -0
- package/dist/cjs/components/index.js +8 -0
- package/dist/cjs/components/index.js.map +1 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/docs.json +103419 -0
- package/dist/esm/components/AppBar/Application.d.ts +8 -0
- package/dist/esm/components/AppBar/Application.js +10 -0
- package/dist/esm/components/AppBar/Application.js.map +1 -0
- package/dist/esm/components/AppBar/index.d.ts +1 -0
- package/dist/esm/components/AppBar/index.js +2 -0
- package/dist/esm/components/AppBar/index.js.map +1 -0
- package/dist/esm/components/MobileSystemControls/SystemControls.d.ts +4 -0
- package/dist/esm/components/MobileSystemControls/SystemControls.js +8 -0
- package/dist/esm/components/MobileSystemControls/SystemControls.js.map +1 -0
- package/dist/esm/components/MobileSystemControls/SystemControlsRoot.d.ts +3 -0
- package/dist/esm/components/MobileSystemControls/SystemControlsRoot.js +59 -0
- package/dist/esm/components/MobileSystemControls/SystemControlsRoot.js.map +1 -0
- package/dist/esm/components/MobileSystemControls/SystemControlsType.d.ts +5 -0
- package/dist/esm/components/MobileSystemControls/SystemControlsType.js +7 -0
- package/dist/esm/components/MobileSystemControls/SystemControlsType.js.map +1 -0
- package/dist/esm/components/MobileSystemControls/SystemControlsUnstyled.d.ts +10 -0
- package/dist/esm/components/MobileSystemControls/SystemControlsUnstyled.js +20 -0
- package/dist/esm/components/MobileSystemControls/SystemControlsUnstyled.js.map +1 -0
- package/dist/esm/components/MobileSystemControls/controls/SystemControl.d.ts +9 -0
- package/dist/esm/components/MobileSystemControls/controls/SystemControl.js +18 -0
- package/dist/esm/components/MobileSystemControls/controls/SystemControl.js.map +1 -0
- package/dist/esm/components/MobileSystemControls/controls/SystemControlText.d.ts +7 -0
- package/dist/esm/components/MobileSystemControls/controls/SystemControlText.js +8 -0
- package/dist/esm/components/MobileSystemControls/controls/SystemControlText.js.map +1 -0
- package/dist/esm/components/MobileSystemControls/controls/index.d.ts +2 -0
- package/dist/esm/components/MobileSystemControls/controls/index.js +3 -0
- package/dist/esm/components/MobileSystemControls/controls/index.js.map +1 -0
- package/dist/esm/components/MobileSystemControls/index.d.ts +3 -0
- package/dist/esm/components/MobileSystemControls/index.js +4 -0
- package/dist/esm/components/MobileSystemControls/index.js.map +1 -0
- package/dist/esm/components/SearchBar/SearchBar.d.ts +6 -0
- package/dist/esm/components/SearchBar/SearchBar.js +13 -0
- package/dist/esm/components/SearchBar/SearchBar.js.map +1 -0
- package/dist/esm/components/SearchBar/index.d.ts +1 -0
- package/dist/esm/components/SearchBar/index.js +2 -0
- package/dist/esm/components/SearchBar/index.js.map +1 -0
- package/dist/esm/components/Toolbar/Context/ContextToolbar.d.ts +8 -0
- package/dist/esm/components/Toolbar/Context/ContextToolbar.js +7 -0
- package/dist/esm/components/Toolbar/Context/ContextToolbar.js.map +1 -0
- package/dist/esm/components/Toolbar/Context/XyoLogo.d.ts +2 -0
- package/dist/esm/components/Toolbar/Context/XyoLogo.js +8 -0
- package/dist/esm/components/Toolbar/Context/XyoLogo.js.map +1 -0
- package/dist/esm/components/Toolbar/Context/XyoLogoLinkEx.d.ts +6 -0
- package/dist/esm/components/Toolbar/Context/XyoLogoLinkEx.js +9 -0
- package/dist/esm/components/Toolbar/Context/XyoLogoLinkEx.js.map +1 -0
- package/dist/esm/components/Toolbar/Context/index.d.ts +1 -0
- package/dist/esm/components/Toolbar/Context/index.js +2 -0
- package/dist/esm/components/Toolbar/Context/index.js.map +1 -0
- package/dist/esm/components/Toolbar/System/SiteMenu.d.ts +14 -0
- package/dist/esm/components/Toolbar/System/SiteMenu.js +35 -0
- package/dist/esm/components/Toolbar/System/SiteMenu.js.map +1 -0
- package/dist/esm/components/Toolbar/System/SystemToolbar.d.ts +16 -0
- package/dist/esm/components/Toolbar/System/SystemToolbar.js +12 -0
- package/dist/esm/components/Toolbar/System/SystemToolbar.js.map +1 -0
- package/dist/esm/components/Toolbar/System/index.d.ts +2 -0
- package/dist/esm/components/Toolbar/System/index.js +3 -0
- package/dist/esm/components/Toolbar/System/index.js.map +1 -0
- package/dist/esm/components/Toolbar/index.d.ts +2 -0
- package/dist/esm/components/Toolbar/index.js +3 -0
- package/dist/esm/components/Toolbar/index.js.map +1 -0
- package/dist/esm/components/index.d.ts +4 -0
- package/dist/esm/components/index.js +5 -0
- package/dist/esm/components/index.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/package.json +116 -0
- package/src/components/AppBar/Application.stories.tsx +45 -0
- package/src/components/AppBar/Application.tsx +28 -0
- package/src/components/AppBar/index.ts +1 -0
- package/src/components/MobileSystemControls/SystemControls.stories.tsx +47 -0
- package/src/components/MobileSystemControls/SystemControls.tsx +14 -0
- package/src/components/MobileSystemControls/SystemControlsRoot.tsx +61 -0
- package/src/components/MobileSystemControls/SystemControlsType.ts +5 -0
- package/src/components/MobileSystemControls/SystemControlsUnstyled.tsx +45 -0
- package/src/components/MobileSystemControls/controls/SystemControl.tsx +36 -0
- package/src/components/MobileSystemControls/controls/SystemControlText.tsx +18 -0
- package/src/components/MobileSystemControls/controls/index.ts +2 -0
- package/src/components/MobileSystemControls/index.ts +3 -0
- package/src/components/SearchBar/SearchBar.tsx +33 -0
- package/src/components/SearchBar/index.ts +1 -0
- package/src/components/Toolbar/Context/ContextToolbar.stories.tsx +32 -0
- package/src/components/Toolbar/Context/ContextToolbar.tsx +17 -0
- package/src/components/Toolbar/Context/XyoLogo.tsx +7 -0
- package/src/components/Toolbar/Context/XyoLogoLinkEx.tsx +35 -0
- package/src/components/Toolbar/Context/index.ts +1 -0
- package/src/components/Toolbar/System/SiteMenu.tsx +77 -0
- package/src/components/Toolbar/System/SystemToolbar.tsx +51 -0
- package/src/components/Toolbar/System/index.ts +2 -0
- package/src/components/Toolbar/index.ts +2 -0
- package/src/components/index.ts +4 -0
- package/src/index.ts +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xyo-network/react-appbar",
|
|
3
|
+
"author": {
|
|
4
|
+
"email": "support@xyo.network",
|
|
5
|
+
"name": "XYO Development Team",
|
|
6
|
+
"url": "https://xyo.network"
|
|
7
|
+
},
|
|
8
|
+
"bugs": {
|
|
9
|
+
"email": "support@xyo.network",
|
|
10
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
|
|
11
|
+
},
|
|
12
|
+
"workspaces": [
|
|
13
|
+
"packages/*"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@emotion/react": "^11.9.0",
|
|
17
|
+
"@emotion/styled": "^11.8.1",
|
|
18
|
+
"@mui/icons-material": "^5.8.0",
|
|
19
|
+
"@mui/material": "^5.8.1",
|
|
20
|
+
"@xylabs/sdk-react": "^2.12.7",
|
|
21
|
+
"@xyo-network/core": "^2.20.33",
|
|
22
|
+
"@xyo-network/react-archive": "^2.23.7",
|
|
23
|
+
"@xyo-network/react-archivist-api": "^2.23.7",
|
|
24
|
+
"@xyo-network/react-auth": "^2.23.7",
|
|
25
|
+
"@xyo-network/react-network": "^2.23.7",
|
|
26
|
+
"@xyo-network/react-shared": "^2.23.7",
|
|
27
|
+
"@xyo-network/react-theme": "^2.23.7",
|
|
28
|
+
"lodash": "^4.17.21",
|
|
29
|
+
"react": "^18.1.0",
|
|
30
|
+
"react-dom": "^18.1.0",
|
|
31
|
+
"react-router-dom": "^6.3.0",
|
|
32
|
+
"tslib": "^2.4.0",
|
|
33
|
+
"typedoc": "^0.22.15"
|
|
34
|
+
},
|
|
35
|
+
"description": "Common React library for all XYO projects that use React",
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@babel/core": "^7.18.0",
|
|
38
|
+
"@babel/preset-env": "^7.18.0",
|
|
39
|
+
"@storybook/addons": "^6.5.4",
|
|
40
|
+
"@storybook/api": "^6.5.4",
|
|
41
|
+
"@storybook/components": "^6.5.4",
|
|
42
|
+
"@storybook/core-events": "^6.5.4",
|
|
43
|
+
"@storybook/react": "^6.5.4",
|
|
44
|
+
"@storybook/theming": "^6.5.4",
|
|
45
|
+
"@types/lodash": "^4.14.182",
|
|
46
|
+
"@xylabs/sdk-react": "^2.12.7",
|
|
47
|
+
"@xylabs/ts-scripts": "^1.0.66",
|
|
48
|
+
"@xylabs/tsconfig": "^1.0.13",
|
|
49
|
+
"axios": "^0.27.2",
|
|
50
|
+
"storybook-dark-mode": "^1.1.0",
|
|
51
|
+
"typescript": "^4.6.4"
|
|
52
|
+
},
|
|
53
|
+
"browser": "dist/esm/index.js",
|
|
54
|
+
"docs": "dist/docs.json",
|
|
55
|
+
"exports": {
|
|
56
|
+
".": {
|
|
57
|
+
"node": {
|
|
58
|
+
"import": "./dist/esm/index.js",
|
|
59
|
+
"require": "./dist/cjs/index.js"
|
|
60
|
+
},
|
|
61
|
+
"browser": {
|
|
62
|
+
"import": "./dist/esm/index.js",
|
|
63
|
+
"require": "./dist/cjs/index.js"
|
|
64
|
+
},
|
|
65
|
+
"default": "./dist/esm/index.js"
|
|
66
|
+
},
|
|
67
|
+
"./dist/docs.json": {
|
|
68
|
+
"default": "./dist/docs.json"
|
|
69
|
+
},
|
|
70
|
+
"./package.json": "./package.json"
|
|
71
|
+
},
|
|
72
|
+
"main": "dist/cjs/index.js",
|
|
73
|
+
"module": "dist/esm/index.js",
|
|
74
|
+
"homepage": "https://xyo.network",
|
|
75
|
+
"keywords": [
|
|
76
|
+
"xyo",
|
|
77
|
+
"utility",
|
|
78
|
+
"typescript",
|
|
79
|
+
"react"
|
|
80
|
+
],
|
|
81
|
+
"license": "LGPL-3.0",
|
|
82
|
+
"peerDependencies": {
|
|
83
|
+
"axios": ">0.26",
|
|
84
|
+
"typedoc": "^0.22.13"
|
|
85
|
+
},
|
|
86
|
+
"peerDependenciesMeta": {
|
|
87
|
+
"typedoc": {
|
|
88
|
+
"optional": true
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"resolutions": {
|
|
92
|
+
"@storybook/react/webpack": "^5",
|
|
93
|
+
"bn.js": "^5.2.0",
|
|
94
|
+
"react": "^18.1.0",
|
|
95
|
+
"react-dom": "^18.1.0",
|
|
96
|
+
"webpack": "^5"
|
|
97
|
+
},
|
|
98
|
+
"publishConfig": {
|
|
99
|
+
"access": "public"
|
|
100
|
+
},
|
|
101
|
+
"repository": {
|
|
102
|
+
"type": "git",
|
|
103
|
+
"url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js.git"
|
|
104
|
+
},
|
|
105
|
+
"scripts": {
|
|
106
|
+
"deploy": "yarn deploy3",
|
|
107
|
+
"lint-pkg": "npmPkgJsonLint .",
|
|
108
|
+
"build": "yarn clean && tsc -p tsconfig.build.cjs.json && tsc -p tsconfig.build.esm.json && yarn gen:docs",
|
|
109
|
+
"gen:docs": "typedoc ./src/index.ts --json ./dist/docs.json --tsconfig ./tsconfig.json",
|
|
110
|
+
"license": "yarn license-checker --exclude \"MIT, ISC, Apache-2.0, BSD, BSD-2-Clause, CC-BY-4.0, Unlicense, CC-BY-3.0, CC0-1.0\""
|
|
111
|
+
},
|
|
112
|
+
"sideEffects": false,
|
|
113
|
+
"types": "dist/esm/index.d.ts",
|
|
114
|
+
"version": "2.23.7",
|
|
115
|
+
"packageManager": "yarn@3.1.1"
|
|
116
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react'
|
|
2
|
+
import { ArchiveProvider, ArchivesProvider } from '@xyo-network/react-archive'
|
|
3
|
+
import { ArchivistApiProvider } from '@xyo-network/react-archivist-api'
|
|
4
|
+
import { NetworkMemoryProvider } from '@xyo-network/react-network'
|
|
5
|
+
import { BrowserRouter } from 'react-router-dom'
|
|
6
|
+
|
|
7
|
+
import { SearchBar } from '../SearchBar'
|
|
8
|
+
import { SystemToolbar } from '../Toolbar'
|
|
9
|
+
import { ApplicationAppBar } from './Application'
|
|
10
|
+
|
|
11
|
+
const StorybookEntry = {
|
|
12
|
+
argTypes: {},
|
|
13
|
+
component: ApplicationAppBar,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
page: null,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
title: 'AppBar/Application',
|
|
20
|
+
} as ComponentMeta<typeof ApplicationAppBar>
|
|
21
|
+
|
|
22
|
+
const Template: ComponentStory<typeof ApplicationAppBar> = (args) => (
|
|
23
|
+
<BrowserRouter>
|
|
24
|
+
<NetworkMemoryProvider>
|
|
25
|
+
<ArchiveProvider>
|
|
26
|
+
<ArchivistApiProvider apiDomain="https://beta.api.archivist.xyo.network">
|
|
27
|
+
<ArchivesProvider>
|
|
28
|
+
<ApplicationAppBar {...args}></ApplicationAppBar>
|
|
29
|
+
</ArchivesProvider>
|
|
30
|
+
</ArchivistApiProvider>
|
|
31
|
+
</ArchiveProvider>
|
|
32
|
+
</NetworkMemoryProvider>
|
|
33
|
+
</BrowserRouter>
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
const Default = Template.bind({})
|
|
37
|
+
Default.args = {}
|
|
38
|
+
|
|
39
|
+
const WithSearchBar = Template.bind({})
|
|
40
|
+
WithSearchBar.args = { children: <SearchBar flexGrow={1} onSearch={(term) => alert(term)} />, color: 'primary', systemToolbar: <SystemToolbar darkModeButton authButton /> }
|
|
41
|
+
|
|
42
|
+
export { Default, WithSearchBar }
|
|
43
|
+
|
|
44
|
+
// eslint-disable-next-line import/no-default-export
|
|
45
|
+
export default StorybookEntry
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AppBar, AppBarProps, Container, Toolbar, ToolbarProps, useMediaQuery, useTheme } from '@mui/material'
|
|
2
|
+
import { FlexGrowRow, FlexRow } from '@xylabs/sdk-react'
|
|
3
|
+
import React, { ReactElement } from 'react'
|
|
4
|
+
|
|
5
|
+
import { ContextToolbar, SystemToolbar } from '../Toolbar'
|
|
6
|
+
|
|
7
|
+
export interface ApplicationAppBarProps extends AppBarProps {
|
|
8
|
+
contextToolbar?: ReactElement<ToolbarProps>
|
|
9
|
+
systemToolbar?: ReactElement<ToolbarProps>
|
|
10
|
+
responsive?: boolean
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const ApplicationAppBar: React.FC<ApplicationAppBarProps> = ({ systemToolbar, contextToolbar, children, responsive = true, ...props }) => {
|
|
14
|
+
const { breakpoints } = useTheme()
|
|
15
|
+
const belowSm = useMediaQuery(breakpoints.down('sm'))
|
|
16
|
+
return (
|
|
17
|
+
<AppBar position="sticky" {...props}>
|
|
18
|
+
<Container maxWidth="xl" disableGutters>
|
|
19
|
+
<FlexRow flexWrap="nowrap" justifyContent="flex-start">
|
|
20
|
+
{contextToolbar ?? <ContextToolbar version />}
|
|
21
|
+
<FlexGrowRow>{belowSm && responsive ? null : children}</FlexGrowRow>
|
|
22
|
+
{systemToolbar ?? <SystemToolbar />}
|
|
23
|
+
</FlexRow>
|
|
24
|
+
{belowSm && children && responsive ? <Toolbar>{children}</Toolbar> : null}
|
|
25
|
+
</Container>
|
|
26
|
+
</AppBar>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Application'
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ComponentStory, Meta } from '@storybook/react'
|
|
2
|
+
import { ArchivesProvider } from '@xyo-network/react-archive'
|
|
3
|
+
import { ArchivistApiProvider } from '@xyo-network/react-archivist-api'
|
|
4
|
+
import { NetworkMemoryProvider } from '@xyo-network/react-network'
|
|
5
|
+
|
|
6
|
+
import { SystemControls } from './SystemControls'
|
|
7
|
+
import { SystemControlsType } from './SystemControlsType'
|
|
8
|
+
|
|
9
|
+
const StorybookEntry: Meta = {
|
|
10
|
+
argTypes: {},
|
|
11
|
+
component: SystemControls,
|
|
12
|
+
parameters: {
|
|
13
|
+
docs: {
|
|
14
|
+
page: null,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
title: 'System/SystemControls',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const Template: ComponentStory<typeof SystemControls> = (props) => {
|
|
21
|
+
return (
|
|
22
|
+
<NetworkMemoryProvider>
|
|
23
|
+
<ArchivistApiProvider apiDomain="http://localhost:8080">
|
|
24
|
+
<ArchivesProvider>
|
|
25
|
+
<SystemControls {...props} />
|
|
26
|
+
</ArchivesProvider>
|
|
27
|
+
</ArchivistApiProvider>
|
|
28
|
+
</NetworkMemoryProvider>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const Left = Template.bind({})
|
|
33
|
+
Left.args = {
|
|
34
|
+
systemControlsType: SystemControlsType.Left,
|
|
35
|
+
visible: true,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const Top = Template.bind({})
|
|
39
|
+
Top.args = {
|
|
40
|
+
systemControlsType: SystemControlsType.WindowShade,
|
|
41
|
+
visible: true,
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { Left, Top }
|
|
45
|
+
|
|
46
|
+
// eslint-disable-next-line import/no-default-export
|
|
47
|
+
export default StorybookEntry
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FlexCol } from '@xylabs/sdk-react'
|
|
2
|
+
|
|
3
|
+
import { SystemControlsRoot } from './SystemControlsRoot'
|
|
4
|
+
import { SystemControlsUnstyledProps } from './SystemControlsUnstyled'
|
|
5
|
+
|
|
6
|
+
const SystemControls: React.FC<SystemControlsUnstyledProps> = (props) => {
|
|
7
|
+
return (
|
|
8
|
+
<FlexCol>
|
|
9
|
+
<SystemControlsRoot {...props} />
|
|
10
|
+
</FlexCol>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { SystemControls }
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { styled } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
import { SystemControlsType } from './SystemControlsType'
|
|
4
|
+
import { SystemControlsUnstyled, SystemControlsUnstyledProps } from './SystemControlsUnstyled'
|
|
5
|
+
|
|
6
|
+
const SystemControlsRoot = styled(SystemControlsUnstyled, { name: 'SystemControls', slot: 'Root' })<SystemControlsUnstyledProps>(({ theme }) => ({
|
|
7
|
+
// shared defaults
|
|
8
|
+
['&']: {
|
|
9
|
+
'.toggle': {
|
|
10
|
+
backgroundColor: theme.palette.primary.main,
|
|
11
|
+
},
|
|
12
|
+
alignItems: 'start',
|
|
13
|
+
zIndex: 1,
|
|
14
|
+
},
|
|
15
|
+
// WindowShade System Controls styles
|
|
16
|
+
[`&.system-controls-type-${SystemControlsType.WindowShade}`]: {
|
|
17
|
+
'.control': {
|
|
18
|
+
borderRadius: '0 0 5px 5px',
|
|
19
|
+
flexDirection: 'row',
|
|
20
|
+
flexGrow: 1,
|
|
21
|
+
justifyContent: 'space-around',
|
|
22
|
+
padding: `${theme.spacing(2)} ${theme.spacing(2.5)}`,
|
|
23
|
+
},
|
|
24
|
+
'.controls': {
|
|
25
|
+
alignItems: 'stretch',
|
|
26
|
+
flexDirection: 'column',
|
|
27
|
+
flexGrow: 1,
|
|
28
|
+
},
|
|
29
|
+
'.toggle': {
|
|
30
|
+
borderRadius: '0 0 5px 5px',
|
|
31
|
+
padding: `${theme.spacing(0.5)} ${theme.spacing(1)}`,
|
|
32
|
+
},
|
|
33
|
+
flexDirection: 'row',
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
top: 0,
|
|
36
|
+
width: '100%',
|
|
37
|
+
},
|
|
38
|
+
// Left System Control styles
|
|
39
|
+
[`&.system-controls-type-${SystemControlsType.Left}`]: {
|
|
40
|
+
'.control': {
|
|
41
|
+
alignItems: 'start',
|
|
42
|
+
flexDirection: 'column',
|
|
43
|
+
padding: `${theme.spacing(2)} ${theme.spacing(2.5)}`,
|
|
44
|
+
},
|
|
45
|
+
'.control-wrap': {
|
|
46
|
+
marginBottom: `${theme.spacing(2)}`,
|
|
47
|
+
},
|
|
48
|
+
'.toggle': {
|
|
49
|
+
borderRadius: '0 5px 5px 0',
|
|
50
|
+
padding: `${theme.spacing(1)} ${theme.spacing(0.5)}`,
|
|
51
|
+
writingMode: 'vertical-rl',
|
|
52
|
+
},
|
|
53
|
+
flexDirection: 'column',
|
|
54
|
+
left: 0,
|
|
55
|
+
position: 'fixed',
|
|
56
|
+
top: '30vh',
|
|
57
|
+
width: 'auto',
|
|
58
|
+
},
|
|
59
|
+
}))
|
|
60
|
+
|
|
61
|
+
export { SystemControlsRoot }
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Theme, useMediaQuery } from '@mui/material'
|
|
2
|
+
import { FlexBoxProps, FlexCol, FlexRow } from '@xylabs/sdk-react'
|
|
3
|
+
import { ArchiveSelectEx, useArchive } from '@xyo-network/react-archive'
|
|
4
|
+
import { NetworkSelectEx, useNetwork } from '@xyo-network/react-network'
|
|
5
|
+
|
|
6
|
+
import { ControlText, SystemControl } from './controls'
|
|
7
|
+
import { SystemControlsType } from './SystemControlsType'
|
|
8
|
+
|
|
9
|
+
interface SystemControlsUnstyledProps extends FlexBoxProps {
|
|
10
|
+
visible?: boolean
|
|
11
|
+
systemControlsType?: SystemControlsType
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const SystemControlsUnstyled: React.FC<SystemControlsUnstyledProps> = ({ systemControlsType = SystemControlsType.WindowShade, visible, ...props }) => {
|
|
15
|
+
const { network } = useNetwork()
|
|
16
|
+
const { archive } = useArchive()
|
|
17
|
+
const isSmall = useMediaQuery<Theme>((theme) => theme.breakpoints.down('sm'))
|
|
18
|
+
|
|
19
|
+
if (visible || isSmall) {
|
|
20
|
+
return (
|
|
21
|
+
<FlexCol {...props} className={`${props.className} system-controls-type-${systemControlsType}`}>
|
|
22
|
+
<SystemControl
|
|
23
|
+
systemControlsType={systemControlsType}
|
|
24
|
+
controlElement={
|
|
25
|
+
<>
|
|
26
|
+
<FlexRow paper className={'control-wrap'}>
|
|
27
|
+
<NetworkSelectEx responsive={false} className="network-ex" />
|
|
28
|
+
</FlexRow>
|
|
29
|
+
<FlexRow paper>
|
|
30
|
+
<ArchiveSelectEx />
|
|
31
|
+
</FlexRow>
|
|
32
|
+
</>
|
|
33
|
+
}
|
|
34
|
+
>
|
|
35
|
+
<ControlText value={`${network?.name} : ${archive ?? 'temp'} `} />
|
|
36
|
+
</SystemControl>
|
|
37
|
+
</FlexCol>
|
|
38
|
+
)
|
|
39
|
+
} else {
|
|
40
|
+
return <FlexCol />
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type { SystemControlsUnstyledProps }
|
|
45
|
+
export { SystemControlsUnstyled }
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Collapse, CollapseProps } from '@mui/material'
|
|
2
|
+
import { FlexBoxProps, FlexCol, FlexRow, WithChildren } from '@xylabs/sdk-react'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import { SystemControlsType } from '../SystemControlsType'
|
|
6
|
+
|
|
7
|
+
interface SystemControlProps extends FlexBoxProps {
|
|
8
|
+
controlElement: React.ReactNode
|
|
9
|
+
systemControlsType?: SystemControlsType
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const SystemControl: React.FC<WithChildren<SystemControlProps>> = ({ children, controlElement, systemControlsType = SystemControlsType.WindowShade, ...props }) => {
|
|
13
|
+
const [toggleControls, setToggleControls] = useState(false)
|
|
14
|
+
|
|
15
|
+
let orientation: CollapseProps['orientation'] = 'vertical'
|
|
16
|
+
|
|
17
|
+
switch (systemControlsType) {
|
|
18
|
+
case SystemControlsType.Left: {
|
|
19
|
+
orientation = 'horizontal'
|
|
20
|
+
break
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<FlexRow className="controls" {...props}>
|
|
26
|
+
<Collapse in={toggleControls} orientation={orientation} timeout={500}>
|
|
27
|
+
<FlexRow bgcolor="primary.main" className="control">
|
|
28
|
+
{controlElement}
|
|
29
|
+
</FlexRow>
|
|
30
|
+
</Collapse>
|
|
31
|
+
<FlexCol onClick={() => setToggleControls(!toggleControls)}>{children}</FlexCol>
|
|
32
|
+
</FlexRow>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { SystemControl }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Typography } from '@mui/material'
|
|
2
|
+
import { FlexBoxProps, FlexCol } from '@xylabs/sdk-react'
|
|
3
|
+
|
|
4
|
+
interface SystemControlTextProps extends FlexBoxProps {
|
|
5
|
+
value?: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const ControlText: React.FC<SystemControlTextProps> = ({ value, ...props }) => {
|
|
9
|
+
return (
|
|
10
|
+
<FlexCol className={`${props.className} toggle`} {...props}>
|
|
11
|
+
<Typography variant="caption" color="white" fontWeight="bold">
|
|
12
|
+
{value}
|
|
13
|
+
</Typography>
|
|
14
|
+
</FlexCol>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { ControlText }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import SearchIcon from '@mui/icons-material/Search'
|
|
2
|
+
import { Paper, TextField } from '@mui/material'
|
|
3
|
+
import { ButtonEx, FlexBoxProps, FlexRow } from '@xylabs/sdk-react'
|
|
4
|
+
import { useState } from 'react'
|
|
5
|
+
|
|
6
|
+
export interface SearchBarProps extends FlexBoxProps {
|
|
7
|
+
onSearch?: (term?: string) => void
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const SearchBar: React.FC<SearchBarProps> = ({ defaultValue, onSearch, ...props }) => {
|
|
11
|
+
const [term, setTerm] = useState<string>()
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<FlexRow alignItems="stretch" {...props}>
|
|
15
|
+
<Paper style={{ display: 'flex', flexGrow: 1, overflow: 'hidden' }}>
|
|
16
|
+
<TextField
|
|
17
|
+
InputProps={{ color: 'secondary', style: { borderBottomRightRadius: 0, borderTopRightRadius: 0, borderWidth: 0 } }}
|
|
18
|
+
variant="outlined"
|
|
19
|
+
size="small"
|
|
20
|
+
defaultValue={defaultValue}
|
|
21
|
+
fullWidth
|
|
22
|
+
onChange={(event) => setTerm(event.target.value)}
|
|
23
|
+
onKeyDown={(event) => {
|
|
24
|
+
if (event.key === 'Enter') onSearch?.(term)
|
|
25
|
+
}}
|
|
26
|
+
/>
|
|
27
|
+
<ButtonEx variant="contained" style={{ borderRadius: 0, borderTopLeftRadius: 0 }} color="secondary" onClick={() => onSearch?.(term)}>
|
|
28
|
+
<SearchIcon />
|
|
29
|
+
</ButtonEx>
|
|
30
|
+
</Paper>
|
|
31
|
+
</FlexRow>
|
|
32
|
+
)
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SearchBar'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react'
|
|
2
|
+
import { BrowserRouter } from 'react-router-dom'
|
|
3
|
+
|
|
4
|
+
import { ContextToolbar } from './ContextToolbar'
|
|
5
|
+
|
|
6
|
+
const StorybookEntry = {
|
|
7
|
+
argTypes: {},
|
|
8
|
+
component: ContextToolbar,
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
page: null,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
title: 'Toolbar/Context',
|
|
15
|
+
} as ComponentMeta<typeof ContextToolbar>
|
|
16
|
+
|
|
17
|
+
const Template: ComponentStory<typeof ContextToolbar> = (args) => (
|
|
18
|
+
<BrowserRouter>
|
|
19
|
+
<ContextToolbar {...args}></ContextToolbar>
|
|
20
|
+
</BrowserRouter>
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
const Default = Template.bind({})
|
|
24
|
+
Default.args = {}
|
|
25
|
+
|
|
26
|
+
const WithVersion = Template.bind({})
|
|
27
|
+
WithVersion.args = { version: true }
|
|
28
|
+
|
|
29
|
+
export { Default, WithVersion }
|
|
30
|
+
|
|
31
|
+
// eslint-disable-next-line import/no-default-export
|
|
32
|
+
export default StorybookEntry
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Toolbar, ToolbarProps } from '@mui/material'
|
|
2
|
+
import { To } from 'react-router-dom'
|
|
3
|
+
|
|
4
|
+
import { XyoLogoLinkEx } from './XyoLogoLinkEx'
|
|
5
|
+
|
|
6
|
+
export interface ContextToolbarProps extends ToolbarProps {
|
|
7
|
+
logoTo?: To
|
|
8
|
+
version?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ContextToolbar: React.FC<ContextToolbarProps> = ({ logoTo = '/', version = false, ...props }) => {
|
|
12
|
+
return (
|
|
13
|
+
<Toolbar {...props}>
|
|
14
|
+
<XyoLogoLinkEx version={version} to={logoTo} />
|
|
15
|
+
</Toolbar>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useTheme } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
export const XyoLogo: React.FC<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>> = (props) => {
|
|
4
|
+
const theme = useTheme()
|
|
5
|
+
const logoUrl = theme.palette.mode === 'dark' ? 'https://cdn.xy.company/img/brand/XYO/XYO_icon_white.svg' : 'https://cdn.xy.company/img/brand/XYO/XYO_icon_white.svg'
|
|
6
|
+
return <img src={logoUrl} {...props} />
|
|
7
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Typography, useTheme } from '@mui/material'
|
|
2
|
+
import { FlexRow, LinkEx, LinkExProps } from '@xylabs/sdk-react'
|
|
3
|
+
|
|
4
|
+
import { XyoLogo } from './XyoLogo'
|
|
5
|
+
|
|
6
|
+
export interface XyoLogoLinkExProps extends LinkExProps {
|
|
7
|
+
version?: boolean | string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const XyoLogoLinkEx: React.FC<XyoLogoLinkExProps> = ({ to = '/', version = false, ...props }) => {
|
|
11
|
+
const theme = useTheme()
|
|
12
|
+
return (
|
|
13
|
+
<LinkEx to={to} {...props}>
|
|
14
|
+
<FlexRow paddingX="4px">
|
|
15
|
+
<XyoLogo height="40" width="43" />
|
|
16
|
+
{version ? (
|
|
17
|
+
<Typography
|
|
18
|
+
position="absolute"
|
|
19
|
+
borderRadius={1}
|
|
20
|
+
right={6}
|
|
21
|
+
color={theme.palette.getContrastText(theme.palette.text.primary)}
|
|
22
|
+
bottom={0}
|
|
23
|
+
bgcolor={theme.palette.text.primary}
|
|
24
|
+
paddingX="2px"
|
|
25
|
+
lineHeight={1}
|
|
26
|
+
variant="caption"
|
|
27
|
+
border={`1px ${theme.palette.getContrastText(theme.palette.primary.main)} solid`}
|
|
28
|
+
>
|
|
29
|
+
{typeof version === 'string' ? version : '2.0'}
|
|
30
|
+
</Typography>
|
|
31
|
+
) : null}
|
|
32
|
+
</FlexRow>
|
|
33
|
+
</LinkEx>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ContextToolbar'
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Menu as MenuIcon } from '@mui/icons-material'
|
|
2
|
+
import { Menu, MenuItem } from '@mui/material'
|
|
3
|
+
import { FlexBoxProps, FlexRow, LinkEx } from '@xylabs/sdk-react'
|
|
4
|
+
import { useRef, useState } from 'react'
|
|
5
|
+
import { To, useNavigate } from 'react-router-dom'
|
|
6
|
+
|
|
7
|
+
export interface SiteMenuItem {
|
|
8
|
+
name: string
|
|
9
|
+
to?: To
|
|
10
|
+
href?: string
|
|
11
|
+
onClick?: () => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface SiteMenuProps extends FlexBoxProps {
|
|
15
|
+
hideSettingsMenuItem?: boolean
|
|
16
|
+
menuItems?: SiteMenuItem[]
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const SiteMenu: React.FC<SiteMenuProps> = ({ hideSettingsMenuItem, menuItems, ...props }) => {
|
|
20
|
+
const [menuElement, setMenuElement] = useState<HTMLButtonElement | null>(null)
|
|
21
|
+
const open = Boolean(menuElement)
|
|
22
|
+
const navigate = useNavigate()
|
|
23
|
+
|
|
24
|
+
const handleMenuClose = () => {
|
|
25
|
+
setMenuElement(null)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const ref = useRef(null)
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<FlexRow alignItems="stretch" {...props}>
|
|
32
|
+
<LinkEx
|
|
33
|
+
color="inherit"
|
|
34
|
+
onClick={() => {
|
|
35
|
+
setMenuElement(ref.current)
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<div style={{ alignItems: 'center', cursor: 'pointer', display: 'flex' }} ref={ref}>
|
|
39
|
+
<MenuIcon fontSize="large" />
|
|
40
|
+
</div>
|
|
41
|
+
</LinkEx>
|
|
42
|
+
<Menu anchorEl={menuElement} open={open} onClose={handleMenuClose}>
|
|
43
|
+
{menuItems?.map(({ name, to, href, onClick }) => {
|
|
44
|
+
return (
|
|
45
|
+
<MenuItem
|
|
46
|
+
key={name}
|
|
47
|
+
onClick={() => {
|
|
48
|
+
if (onClick) {
|
|
49
|
+
onClick()
|
|
50
|
+
} else if (to) {
|
|
51
|
+
navigate(to)
|
|
52
|
+
} else if (href) {
|
|
53
|
+
window.open(href)
|
|
54
|
+
}
|
|
55
|
+
handleMenuClose()
|
|
56
|
+
}}
|
|
57
|
+
disableRipple
|
|
58
|
+
>
|
|
59
|
+
{name}
|
|
60
|
+
</MenuItem>
|
|
61
|
+
)
|
|
62
|
+
})}
|
|
63
|
+
{hideSettingsMenuItem ? null : (
|
|
64
|
+
<MenuItem
|
|
65
|
+
onClick={() => {
|
|
66
|
+
navigate('/settings')
|
|
67
|
+
handleMenuClose()
|
|
68
|
+
}}
|
|
69
|
+
disableRipple
|
|
70
|
+
>
|
|
71
|
+
Settings
|
|
72
|
+
</MenuItem>
|
|
73
|
+
)}
|
|
74
|
+
</Menu>
|
|
75
|
+
</FlexRow>
|
|
76
|
+
)
|
|
77
|
+
}
|