@xyo-network/react-os 7.5.8 → 7.5.11
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/dist/browser/components/Profile/Profile.d.ts.map +1 -1
- package/dist/browser/components/XyOsClock/XyOsClock.d.ts.map +1 -1
- package/dist/browser/index.mjs +4 -7
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +44 -25
- package/src/components/Profile/Profile.stories.tsx +0 -27
- package/src/components/Profile/Profile.tsx +0 -81
- package/src/components/Profile/StatsModal.tsx +0 -48
- package/src/components/Profile/index.ts +0 -1
- package/src/components/TestComponent.stories.tsx +0 -16
- package/src/components/TestComponent.tsx +0 -9
- package/src/components/XyOsClock/XyOsClock.stories.tsx +0 -32
- package/src/components/XyOsClock/XyOsClock.tsx +0 -119
- package/src/components/XyOsClock/index.ts +0 -1
- package/src/components/index.ts +0 -1
- package/src/index.ts +0 -1
- package/src/types/global.d.ts +0 -1
- package/src/types/images.d.ts +0 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../../../src/components/Profile/Profile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAM/C,OAAO,
|
|
1
|
+
{"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../../../src/components/Profile/Profile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAM/C,OAAO,KAAmB,MAAM,OAAO,CAAA;AAGvC,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAmElD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XyOsClock.d.ts","sourceRoot":"","sources":["../../../../src/components/XyOsClock/XyOsClock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"XyOsClock.d.ts","sourceRoot":"","sources":["../../../../src/components/XyOsClock/XyOsClock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAI7C,OAAO,KAEN,MAAM,OAAO,CAAA;AAEd,UAAU,UAAW,SAAQ,QAAQ;IACnC,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACvC,SAAS,EAAE,QAAQ,GAAG,QAAQ,CAAA;CAC/B;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAyB9C,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAOjD,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAOlD,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAOjD,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CASjD,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CASlD,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAUjD,CAAA"}
|
package/dist/browser/index.mjs
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/components/TestComponent.tsx
|
|
5
2
|
import { FlexRow } from "@xylabs/react-flexbox";
|
|
6
|
-
import
|
|
7
|
-
var TestComponent =
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
}
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var TestComponent = ({ children, ...props }) => {
|
|
5
|
+
return /* @__PURE__ */ jsx(FlexRow, { ...props, children });
|
|
6
|
+
};
|
|
10
7
|
export {
|
|
11
8
|
TestComponent
|
|
12
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/TestComponent.tsx"],"sourcesContent":["import { FlexRow } from '@xylabs/react-flexbox'\nimport type { PropsWithChildren } from 'react'\nimport React from 'react'\n\nexport interface TestComponentProps extends PropsWithChildren {}\n\nexport const TestComponent: React.FC<TestComponentProps> = ({ children, ...props }) => {\n return <FlexRow {...props}>{children}</FlexRow>\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/components/TestComponent.tsx"],"sourcesContent":["import { FlexRow } from '@xylabs/react-flexbox'\nimport type { PropsWithChildren } from 'react'\nimport React from 'react'\n\nexport interface TestComponentProps extends PropsWithChildren {}\n\nexport const TestComponent: React.FC<TestComponentProps> = ({ children, ...props }) => {\n return <FlexRow {...props}>{children}</FlexRow>\n}\n"],"mappings":";AAAA,SAAS,eAAe;AAOf;AADF,IAAM,gBAA8C,CAAC,EAAE,UAAU,GAAG,MAAM,MAAM;AACrF,SAAO,oBAAC,WAAS,GAAG,OAAQ,UAAS;AACvC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-os",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.11",
|
|
4
4
|
"description": "Common React library for all XYO projects that use React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xyo",
|
|
@@ -36,41 +36,60 @@
|
|
|
36
36
|
},
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
|
-
"module": "dist/browser/index.mjs",
|
|
40
|
-
"types": "dist/browser/index.d.ts",
|
|
41
39
|
"files": [
|
|
42
40
|
"dist",
|
|
43
|
-
"
|
|
41
|
+
"README.md"
|
|
44
42
|
],
|
|
45
|
-
"dependencies": {
|
|
46
|
-
"@xylabs/react-flexbox": "~7.1.17"
|
|
47
|
-
},
|
|
48
43
|
"devDependencies": {
|
|
49
|
-
"@mui/icons-material": "
|
|
50
|
-
"@mui/material": "
|
|
51
|
-
"@
|
|
44
|
+
"@mui/icons-material": "^7.3.10",
|
|
45
|
+
"@mui/material": "^7.3.10",
|
|
46
|
+
"@opentelemetry/api": "^1.9.1",
|
|
47
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
48
|
+
"@storybook/react-vite": "~10.3.5",
|
|
49
|
+
"@types/node": "~25.6.0",
|
|
52
50
|
"@types/react": "^19.2.14",
|
|
53
|
-
"@xylabs/
|
|
54
|
-
"@xylabs/
|
|
55
|
-
"@xylabs/
|
|
56
|
-
"@xylabs/
|
|
57
|
-
"@xylabs/tsconfig
|
|
51
|
+
"@xylabs/react-async-effect": "~7.1.20",
|
|
52
|
+
"@xylabs/react-flexbox": "~7.1.20",
|
|
53
|
+
"@xylabs/react-promise": "~7.1.20",
|
|
54
|
+
"@xylabs/toolchain": "~7.11.9",
|
|
55
|
+
"@xylabs/tsconfig": "^7.11.9",
|
|
56
|
+
"@xylabs/tsconfig-dom": "^7.11.9",
|
|
57
|
+
"@xylabs/tsconfig-react": "~7.11.9",
|
|
58
|
+
"async-mutex": "^0.5.0",
|
|
59
|
+
"axios": "^1.15.2",
|
|
60
|
+
"bn.js": "^5.2.3",
|
|
61
|
+
"buffer": "^6.0.3",
|
|
62
|
+
"chalk": "^5.6.2",
|
|
58
63
|
"date-fns": "~4.1.0",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
64
|
+
"esbuild": "~0.28.0",
|
|
65
|
+
"eslint": "^10.2.1",
|
|
66
|
+
"ethers": "^6.16.0",
|
|
67
|
+
"pako": "^2.1.0",
|
|
68
|
+
"react": "^19.2.5",
|
|
69
|
+
"react-dom": "^19.2.5",
|
|
70
|
+
"react-router-dom": "^7.14.2",
|
|
71
|
+
"storybook": "^10.3.5",
|
|
63
72
|
"typescript": "^5.9.3",
|
|
64
|
-
"vite": "
|
|
73
|
+
"vite": "^8.0.10",
|
|
74
|
+
"zod": "^4.3.6"
|
|
65
75
|
},
|
|
66
76
|
"peerDependencies": {
|
|
67
|
-
"@mui/
|
|
68
|
-
"@
|
|
69
|
-
"react": "
|
|
70
|
-
"react-
|
|
77
|
+
"@mui/material": "^7.3.10",
|
|
78
|
+
"@opentelemetry/sdk-trace-base": "^2.7.0",
|
|
79
|
+
"@xylabs/react-async-effect": "~7.1.20",
|
|
80
|
+
"@xylabs/react-flexbox": "~7.1.20",
|
|
81
|
+
"async-mutex": "^0.5.0",
|
|
82
|
+
"bn.js": "^5.2.3",
|
|
83
|
+
"buffer": "^6.0.3",
|
|
84
|
+
"chalk": "^5.6.2",
|
|
85
|
+
"ethers": "^6.16.0",
|
|
86
|
+
"pako": "^2.1.0",
|
|
87
|
+
"react": "^19.2.5",
|
|
88
|
+
"react-dom": "^19.2.5",
|
|
89
|
+
"zod": "^4.3.6"
|
|
71
90
|
},
|
|
72
91
|
"publishConfig": {
|
|
73
92
|
"access": "public"
|
|
74
93
|
},
|
|
75
94
|
"docs": "dist/docs.json"
|
|
76
|
-
}
|
|
95
|
+
}
|
|
@@ -1,27 +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 { XyOsProfile } from './Profile.tsx'
|
|
6
|
-
const StorybookEntry = {
|
|
7
|
-
argTypes: {},
|
|
8
|
-
component: XyOsProfile,
|
|
9
|
-
parameters: { docs: { page: null } },
|
|
10
|
-
title: 'shared/XyOsProfile',
|
|
11
|
-
} as Meta<typeof XyOsProfile>
|
|
12
|
-
|
|
13
|
-
const Template: StoryFn<typeof XyOsProfile> = args => (
|
|
14
|
-
<BrowserRouter>
|
|
15
|
-
<XyOsProfile {...args}></XyOsProfile>
|
|
16
|
-
</BrowserRouter>
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
const Default = Template.bind({})
|
|
20
|
-
Default.args = { xns: '@arietrouw' }
|
|
21
|
-
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
|
|
25
|
-
export { Default }
|
|
26
|
-
|
|
27
|
-
export default StorybookEntry
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import type { PaperProps } from '@mui/material'
|
|
2
|
-
import {
|
|
3
|
-
Avatar, Divider, Paper, Typography, useTheme,
|
|
4
|
-
} from '@mui/material'
|
|
5
|
-
import { FlexGrowCol, FlexGrowRow } from '@xylabs/react-flexbox'
|
|
6
|
-
import { format, subHours } from 'date-fns'
|
|
7
|
-
import React from 'react'
|
|
8
|
-
|
|
9
|
-
import { StatsModal } from './StatsModal.tsx'
|
|
10
|
-
export interface XyOsProfileProps extends PaperProps {
|
|
11
|
-
pfp: string
|
|
12
|
-
xns: string
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const XyOsProfile: React.FC<XyOsProfileProps> = ({ xns }) => {
|
|
16
|
-
const theme = useTheme()
|
|
17
|
-
return (
|
|
18
|
-
<FlexGrowCol gap={1} alignItems="flex-start">
|
|
19
|
-
<FlexGrowRow gap={1}>
|
|
20
|
-
<Avatar
|
|
21
|
-
alt={xns}
|
|
22
|
-
src="https://arietrouw.com/assets/img/arie.jpg"
|
|
23
|
-
sx={{ height: 100, width: 100 }}
|
|
24
|
-
/>
|
|
25
|
-
<FlexGrowCol width="100%" alignItems="flex-start">
|
|
26
|
-
<Typography variant="h5">{xns}</Typography>
|
|
27
|
-
<Typography variant="subtitle2">
|
|
28
|
-
Last Active:
|
|
29
|
-
{format(subHours(Date.now(), 4), 'pp')}
|
|
30
|
-
</Typography>
|
|
31
|
-
</FlexGrowCol>
|
|
32
|
-
</FlexGrowRow>
|
|
33
|
-
<Paper sx={{ padding: 1 }}>
|
|
34
|
-
<FlexGrowRow paddingBottom={1} width="100%" alignItems="center" justifyContent="space-between">
|
|
35
|
-
<Typography variant="body1" fontWeight="medium">
|
|
36
|
-
2024 Stats
|
|
37
|
-
</Typography>
|
|
38
|
-
<StatsModal />
|
|
39
|
-
</FlexGrowRow>
|
|
40
|
-
<FlexGrowRow justifyContent="flex-start" width="100%" gap={1}>
|
|
41
|
-
<FlexGrowCol alignItems="flex-start">
|
|
42
|
-
<Typography variant="h5">3,921</Typography>
|
|
43
|
-
<Typography variant="body2">Bound Witnesses</Typography>
|
|
44
|
-
</FlexGrowCol>
|
|
45
|
-
<Divider flexItem orientation="vertical"></Divider>
|
|
46
|
-
<FlexGrowCol alignItems="flex-start">
|
|
47
|
-
<Typography variant="h5">30</Typography>
|
|
48
|
-
<Typography variant="body2">Connected Bridges</Typography>
|
|
49
|
-
</FlexGrowCol>
|
|
50
|
-
<Divider flexItem orientation="vertical"></Divider>
|
|
51
|
-
<FlexGrowCol alignItems="flex-start">
|
|
52
|
-
<Typography variant="h5">3,921</Typography>
|
|
53
|
-
<Typography variant="body2">Bound Witnesses</Typography>
|
|
54
|
-
</FlexGrowCol>
|
|
55
|
-
</FlexGrowRow>
|
|
56
|
-
</Paper>
|
|
57
|
-
<Paper sx={{ padding: 1 }}>
|
|
58
|
-
<Typography paddingBottom={1} variant="h6">
|
|
59
|
-
Badges
|
|
60
|
-
</Typography>
|
|
61
|
-
<FlexGrowRow justifyContent="flex-start" width="100%" gap={1}>
|
|
62
|
-
<Avatar sx={{
|
|
63
|
-
color: theme.vars.palette.primary.main, height: 50, width: 50,
|
|
64
|
-
}}
|
|
65
|
-
>
|
|
66
|
-
</Avatar>
|
|
67
|
-
<Avatar sx={{
|
|
68
|
-
color: theme.vars.palette.primary.main, height: 50, width: 50,
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
71
|
-
</Avatar>
|
|
72
|
-
<Avatar sx={{
|
|
73
|
-
color: theme.vars.palette.primary.main, height: 50, width: 50,
|
|
74
|
-
}}
|
|
75
|
-
>
|
|
76
|
-
</Avatar>
|
|
77
|
-
</FlexGrowRow>
|
|
78
|
-
</Paper>
|
|
79
|
-
</FlexGrowCol>
|
|
80
|
-
)
|
|
81
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ArrowForwardRounded } from '@mui/icons-material'
|
|
2
|
-
import {
|
|
3
|
-
Avatar, Backdrop, Box, Fade, IconButton, Modal, Typography,
|
|
4
|
-
} from '@mui/material'
|
|
5
|
-
import { FlexGrowCol } from '@xylabs/react-flexbox'
|
|
6
|
-
import * as React from 'react'
|
|
7
|
-
|
|
8
|
-
const style = {
|
|
9
|
-
bgcolor: 'background.paper',
|
|
10
|
-
boxShadow: 24,
|
|
11
|
-
p: 4,
|
|
12
|
-
width: 400,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const StatsModal: React.FC = () => {
|
|
16
|
-
const [open, setOpen] = React.useState(false)
|
|
17
|
-
const handleOpen = () => setOpen(true)
|
|
18
|
-
const handleClose = () => setOpen(false)
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<div>
|
|
22
|
-
<IconButton size="small" color="primary" onClick={handleOpen}>
|
|
23
|
-
<ArrowForwardRounded />
|
|
24
|
-
</IconButton>
|
|
25
|
-
<Modal
|
|
26
|
-
aria-labelledby="transition-modal-title"
|
|
27
|
-
aria-describedby="transition-modal-description"
|
|
28
|
-
open={open}
|
|
29
|
-
onClose={handleClose}
|
|
30
|
-
closeAfterTransition
|
|
31
|
-
slots={{ backdrop: Backdrop }}
|
|
32
|
-
slotProps={{ backdrop: { timeout: 500 } }}
|
|
33
|
-
>
|
|
34
|
-
<Fade in={open}>
|
|
35
|
-
<Box sx={style}>
|
|
36
|
-
<FlexGrowCol alignItems="center">
|
|
37
|
-
<Avatar sx={{ height: '200px', width: '200px' }}>
|
|
38
|
-
</Avatar>
|
|
39
|
-
<Typography id="transition-modal-description" align="center" sx={{ mt: 2 }}>
|
|
40
|
-
Duis mollis, est non commodo luctus, nisi erat porttitor ligula.
|
|
41
|
-
</Typography>
|
|
42
|
-
</FlexGrowCol>
|
|
43
|
-
</Box>
|
|
44
|
-
</Fade>
|
|
45
|
-
</Modal>
|
|
46
|
-
</div>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Profile.tsx'
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import type { TestComponentProps } from './TestComponent.tsx'
|
|
5
|
-
import { TestComponent } from './TestComponent.tsx'
|
|
6
|
-
|
|
7
|
-
export default { title: 'modules/os/TestComponent' } as Meta
|
|
8
|
-
|
|
9
|
-
const Template: StoryFn<React.FC<TestComponentProps>> = (props) => {
|
|
10
|
-
return <TestComponent {...props} />
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const Default = Template.bind({})
|
|
14
|
-
Default.args = {}
|
|
15
|
-
|
|
16
|
-
export { Default }
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FlexRow } from '@xylabs/react-flexbox'
|
|
2
|
-
import type { PropsWithChildren } from 'react'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
|
|
5
|
-
export interface TestComponentProps extends PropsWithChildren {}
|
|
6
|
-
|
|
7
|
-
export const TestComponent: React.FC<TestComponentProps> = ({ children, ...props }) => {
|
|
8
|
-
return <FlexRow {...props}>{children}</FlexRow>
|
|
9
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryFn } from '@storybook/react-vite'
|
|
2
|
-
import { FlexGrowCol } from '@xylabs/react-flexbox'
|
|
3
|
-
import React from 'react'
|
|
4
|
-
import { BrowserRouter } from 'react-router-dom'
|
|
5
|
-
|
|
6
|
-
import { XyOsClock } from './XyOsClock.tsx'
|
|
7
|
-
const StorybookEntry = {
|
|
8
|
-
argTypes: {},
|
|
9
|
-
component: XyOsClock,
|
|
10
|
-
parameters: { docs: { page: null } },
|
|
11
|
-
title: 'shared/XyOsClock',
|
|
12
|
-
} as Meta<typeof XyOsClock>
|
|
13
|
-
|
|
14
|
-
const Template: StoryFn<typeof XyOsClock> = args => (
|
|
15
|
-
<BrowserRouter>
|
|
16
|
-
<FlexGrowCol gap={2} alignItems="center" justifyContent="center">
|
|
17
|
-
<FlexGrowCol alignItems="center" justifyContent="center">
|
|
18
|
-
<XyOsClock {...args}></XyOsClock>
|
|
19
|
-
</FlexGrowCol>
|
|
20
|
-
</FlexGrowCol>
|
|
21
|
-
</BrowserRouter>
|
|
22
|
-
)
|
|
23
|
-
|
|
24
|
-
const Default = Template.bind({})
|
|
25
|
-
Default.args = { clockType: 'appbar' }
|
|
26
|
-
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
28
|
-
// @ts-ignore
|
|
29
|
-
|
|
30
|
-
export { Default }
|
|
31
|
-
|
|
32
|
-
export default StorybookEntry
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import type { BoxProps } from '@mui/material'
|
|
2
|
-
import { Paper, Typography } from '@mui/material'
|
|
3
|
-
import { FlexGrowCol, FlexGrowRow } from '@xylabs/react-flexbox'
|
|
4
|
-
import { format } from 'date-fns'
|
|
5
|
-
import type { ReactElement } from 'react'
|
|
6
|
-
import React, { useEffect, useState } from 'react'
|
|
7
|
-
|
|
8
|
-
interface ClockProps extends BoxProps {
|
|
9
|
-
date: number
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface ComponentSizeProps {
|
|
13
|
-
large: ReactElement<XyOsClockProps>
|
|
14
|
-
medium: ReactElement<XyOsClockProps>
|
|
15
|
-
small: ReactElement<XyOsClockProps>
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface ClockComponentsProps {
|
|
19
|
-
components: ComponentSizeProps
|
|
20
|
-
type: 'appbar' | 'widget'
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface XyOsClockProps {
|
|
24
|
-
clockSize: 'small' | 'medium' | 'large'
|
|
25
|
-
clockType: 'appbar' | 'widget'
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const XyOsClock: React.FC<XyOsClockProps> = ({
|
|
29
|
-
clockType, clockSize, ...props
|
|
30
|
-
}) => {
|
|
31
|
-
const [date, setDate] = useState(Date.now())
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
const timerHandler: TimerHandler = () => setDate(Date.now())
|
|
34
|
-
const timer = setInterval(timerHandler, 500)
|
|
35
|
-
return function cleanup() {
|
|
36
|
-
clearInterval(timer)
|
|
37
|
-
}
|
|
38
|
-
}, [])
|
|
39
|
-
const ClockComponents: ClockComponentsProps[] = [
|
|
40
|
-
{
|
|
41
|
-
components: {
|
|
42
|
-
large: <LargeAppBarClock date={date} {...props} />,
|
|
43
|
-
medium: <MediumAppBarClock date={date} {...props} />,
|
|
44
|
-
small: <SmallAppBarClock date={date} {...props} />,
|
|
45
|
-
},
|
|
46
|
-
type: 'appbar',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
components: {
|
|
50
|
-
large: <LargeWidgetClock date={date} {...props} />,
|
|
51
|
-
medium: <MediumWidgetClock date={date} {...props} />,
|
|
52
|
-
small: <SmallWidgetClock date={date} {...props} />,
|
|
53
|
-
},
|
|
54
|
-
type: 'widget',
|
|
55
|
-
},
|
|
56
|
-
]
|
|
57
|
-
return ClockComponents.find(component => component.type === clockType)?.components[`${clockSize}`]
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export const SmallAppBarClock: React.FC<ClockProps> = ({ date }) => {
|
|
61
|
-
return (
|
|
62
|
-
<FlexGrowRow gap={1}>
|
|
63
|
-
<Typography variant="body1">{format(date, 'E MMM dd')}</Typography>
|
|
64
|
-
<Typography variant="body1">{format(date, 'p')}</Typography>
|
|
65
|
-
</FlexGrowRow>
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export const MediumAppBarClock: React.FC<ClockProps> = ({ date }) => {
|
|
70
|
-
return (
|
|
71
|
-
<FlexGrowRow gap={1}>
|
|
72
|
-
<Typography variant="body1">{format(date, 'E MMM dd')}</Typography>
|
|
73
|
-
<Typography variant="body1">{format(date, 'pp')}</Typography>
|
|
74
|
-
</FlexGrowRow>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export const LargeAppBarClock: React.FC<ClockProps> = ({ date }) => {
|
|
79
|
-
return (
|
|
80
|
-
<FlexGrowRow gap={1}>
|
|
81
|
-
<Typography variant="body1">{format(date, 'EEEE MMM dd, yyy')}</Typography>
|
|
82
|
-
<Typography variant="body1">{format(date, 'ppp')}</Typography>
|
|
83
|
-
</FlexGrowRow>
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export const SmallWidgetClock: React.FC<ClockProps> = ({ date }) => {
|
|
88
|
-
return (
|
|
89
|
-
<Paper sx={{ padding: 1 }}>
|
|
90
|
-
<FlexGrowCol>
|
|
91
|
-
<Typography variant="h6">{format(date, 'p')}</Typography>
|
|
92
|
-
<Typography variant="body2">{format(date, 'E MMM dd')}</Typography>
|
|
93
|
-
</FlexGrowCol>
|
|
94
|
-
</Paper>
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export const MediumWidgetClock: React.FC<ClockProps> = ({ date }) => {
|
|
99
|
-
return (
|
|
100
|
-
<Paper sx={{ padding: 1 }}>
|
|
101
|
-
<FlexGrowCol>
|
|
102
|
-
<Typography variant="h6">{format(date, 'pp')}</Typography>
|
|
103
|
-
<Typography variant="body2">{format(date, 'E MMM dd, yyyy')}</Typography>
|
|
104
|
-
</FlexGrowCol>
|
|
105
|
-
</Paper>
|
|
106
|
-
)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export const LargeWidgetClock: React.FC<ClockProps> = ({ date }) => {
|
|
110
|
-
return (
|
|
111
|
-
<Paper sx={{ padding: 1 }}>
|
|
112
|
-
<FlexGrowCol>
|
|
113
|
-
<Typography variant="body2">{format(date, 'EEEE')}</Typography>
|
|
114
|
-
<Typography variant="h5">{format(date, 'pp')}</Typography>
|
|
115
|
-
<Typography variant="body1">{format(date, 'MMM dd, yyyy')}</Typography>
|
|
116
|
-
</FlexGrowCol>
|
|
117
|
-
</Paper>
|
|
118
|
-
)
|
|
119
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './XyOsClock.tsx'
|
package/src/components/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './TestComponent.tsx'
|
package/src/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './components/index.ts'
|
package/src/types/global.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@mui/material/themeCssVarsAugmentation'
|