@xyo-network/react-shared 2.27.21 → 2.27.24

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 (27) hide show
  1. package/dist/cjs/components/TokenBar/TokenBar.d.ts +6 -2
  2. package/dist/cjs/components/TokenBar/TokenBar.d.ts.map +1 -1
  3. package/dist/cjs/components/TokenBar/TokenBar.js +2 -2
  4. package/dist/cjs/components/TokenBar/TokenBar.js.map +1 -1
  5. package/dist/cjs/components/TokenData/img/sol.png +0 -0
  6. package/dist/cjs/components/TokenData/img/weth.png +0 -0
  7. package/dist/cjs/components/TokenSummary/TokenSummary.d.ts +3 -5
  8. package/dist/cjs/components/TokenSummary/TokenSummary.d.ts.map +1 -1
  9. package/dist/cjs/components/TokenSummary/TokenSummary.js +4 -4
  10. package/dist/cjs/components/TokenSummary/TokenSummary.js.map +1 -1
  11. package/dist/docs.json +1368 -17332
  12. package/dist/esm/components/TokenBar/TokenBar.d.ts +6 -2
  13. package/dist/esm/components/TokenBar/TokenBar.d.ts.map +1 -1
  14. package/dist/esm/components/TokenBar/TokenBar.js +3 -3
  15. package/dist/esm/components/TokenBar/TokenBar.js.map +1 -1
  16. package/dist/esm/components/TokenData/img/sol.png +0 -0
  17. package/dist/esm/components/TokenData/img/weth.png +0 -0
  18. package/dist/esm/components/TokenSummary/TokenSummary.d.ts +3 -5
  19. package/dist/esm/components/TokenSummary/TokenSummary.d.ts.map +1 -1
  20. package/dist/esm/components/TokenSummary/TokenSummary.js +9 -7
  21. package/dist/esm/components/TokenSummary/TokenSummary.js.map +1 -1
  22. package/package.json +3 -2
  23. package/src/components/TokenBar/TokenBar.stories.tsx +5 -1
  24. package/src/components/TokenBar/TokenBar.tsx +11 -4
  25. package/src/components/TokenData/img/sol.png +0 -0
  26. package/src/components/TokenData/img/weth.png +0 -0
  27. package/src/components/TokenSummary/TokenSummary.tsx +18 -16
@@ -1,8 +1,12 @@
1
- /// <reference types="react" />
2
- import { PaperProps } from '@mui/material';
1
+ import { PaperProps, TypographyProps } from '@mui/material';
2
+ import { ReactNode } from 'react';
3
3
  export interface TokenBarProps extends PaperProps {
4
4
  text1?: string | number;
5
+ text1Props?: TypographyProps;
6
+ text1Suffix?: ReactNode;
5
7
  text2?: string | number;
8
+ text2Props?: TypographyProps;
9
+ text2Suffix?: ReactNode;
6
10
  }
7
11
  export declare const TokenBar: React.FC<TokenBarProps>;
8
12
  //# sourceMappingURL=TokenBar.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TokenBar.d.ts","sourceRoot":"","sources":["../../../../src/components/TokenBar/TokenBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAS,UAAU,EAAc,MAAM,eAAe,CAAA;AAE7D,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAa5C,CAAA"}
1
+ {"version":3,"file":"TokenBar.d.ts","sourceRoot":"","sources":["../../../../src/components/TokenBar/TokenBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,UAAU,EAAc,eAAe,EAAE,MAAM,eAAe,CAAA;AAE9E,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,WAAW,CAAC,EAAE,SAAS,CAAA;CACxB;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAe5C,CAAA"}
@@ -1,7 +1,7 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Paper, Typography } from '@mui/material';
3
3
  import { FlexRow } from '@xylabs/react-flexbox';
4
- export const TokenBar = ({ text1, text2, ...props }) => {
5
- return (_jsx(Paper, { elevation: 0, className: "TokenBar-root", ...props, children: _jsxs(FlexRow, { justifyContent: "space-between", children: [_jsx(Typography, { variant: "body1", fontWeight: 300, margin: 1, children: text1 }), _jsx(Typography, { variant: "body1", fontWeight: 300, textTransform: "uppercase", color: "gray", margin: 1, children: text2 })] }) }));
4
+ export const TokenBar = ({ text1, text1Props, text1Suffix, text2, text2Props, text2Suffix, ...props }) => {
5
+ return (_jsx(Paper, { elevation: 0, className: "TokenBar-root", ...props, children: _jsxs(FlexRow, { justifyContent: "space-between", children: [_jsxs(Typography, { variant: "body1", fontWeight: 300, margin: 1, ...text1Props, children: [text1, text1Suffix] }), _jsxs(Typography, { variant: "body1", fontWeight: 300, textTransform: "uppercase", color: "gray", margin: 1, ...text2Props, children: [text2, text2Suffix] })] }) }));
6
6
  };
7
7
  //# sourceMappingURL=TokenBar.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TokenBar.js","sourceRoot":"","sources":["../../../../src/components/TokenBar/TokenBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAc,UAAU,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAM/C,MAAM,CAAC,MAAM,QAAQ,GAA4B,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAC9E,OAAO,CACL,KAAC,KAAK,IAAC,SAAS,EAAE,CAAC,EAAE,SAAS,EAAC,eAAe,KAAK,KAAK,YACtD,MAAC,OAAO,IAAC,cAAc,EAAC,eAAe,aACrC,KAAC,UAAU,IAAC,OAAO,EAAC,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,YACnD,KAAK,GACK,EACb,KAAC,UAAU,IAAC,OAAO,EAAC,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,aAAa,EAAC,WAAW,EAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAE,CAAC,YAC1F,KAAK,GACK,IACL,GACJ,CACT,CAAA;AACH,CAAC,CAAA"}
1
+ {"version":3,"file":"TokenBar.js","sourceRoot":"","sources":["../../../../src/components/TokenBar/TokenBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAc,UAAU,EAAmB,MAAM,eAAe,CAAA;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAW/C,MAAM,CAAC,MAAM,QAAQ,GAA4B,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE;IAChI,OAAO,CACL,KAAC,KAAK,IAAC,SAAS,EAAE,CAAC,EAAE,SAAS,EAAC,eAAe,KAAK,KAAK,YACtD,MAAC,OAAO,IAAC,cAAc,EAAC,eAAe,aACrC,MAAC,UAAU,IAAC,OAAO,EAAC,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,KAAM,UAAU,aACnE,KAAK,EACL,WAAW,IACD,EACb,MAAC,UAAU,IAAC,OAAO,EAAC,OAAO,EAAC,UAAU,EAAE,GAAG,EAAE,aAAa,EAAC,WAAW,EAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAE,CAAC,KAAM,UAAU,aAC1G,KAAK,EACL,WAAW,IACD,IACL,GACJ,CACT,CAAA;AACH,CAAC,CAAA"}
@@ -1,11 +1,9 @@
1
1
  /// <reference types="react" />
2
- import { PaperProps } from '@mui/material';
3
- import { FlexBoxProps } from '@xylabs/react-flexbox';
4
- export interface TokenSummaryProps extends FlexBoxProps {
2
+ import { AvatarProps, CardHeaderProps } from '@mui/material';
3
+ export interface TokenSummaryProps extends CardHeaderProps {
5
4
  icon?: string;
6
5
  symbol?: string;
7
- imgBgProps?: PaperProps;
8
- imageMode?: 'circle';
6
+ imgBgProps?: AvatarProps;
9
7
  }
10
8
  export declare const TokenSummary: React.FC<TokenSummaryProps>;
11
9
  //# sourceMappingURL=TokenSummary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TokenSummary.d.ts","sourceRoot":"","sources":["../../../../src/components/TokenSummary/TokenSummary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAS,UAAU,EAAc,MAAM,eAAe,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAoB,MAAM,uBAAuB,CAAA;AAEtE,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,SAAS,CAAC,EAAE,QAAQ,CAAA;CACrB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAqBpD,CAAA"}
1
+ {"version":3,"file":"TokenSummary.d.ts","sourceRoot":"","sources":["../../../../src/components/TokenSummary/TokenSummary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAU,WAAW,EAAc,eAAe,EAAwB,MAAM,eAAe,CAAA;AAEtG,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,WAAW,CAAA;CACzB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAyBpD,CAAA"}
@@ -1,14 +1,16 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Paper, Typography } from '@mui/material';
3
- import { FlexCol, FlexRow } from '@xylabs/react-flexbox';
4
- export const TokenSummary = ({ imageMode = 'circle', imgBgProps = {}, icon, symbol, children, ...props }) => {
5
- const paperProps = {
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Avatar, CardHeader, Typography, useTheme } from '@mui/material';
3
+ export const TokenSummary = ({ imgBgProps = {}, icon, symbol, children, ...props }) => {
4
+ const theme = useTheme();
5
+ const avatarProps = {
6
6
  ...imgBgProps,
7
7
  sx: {
8
+ background: theme.palette.common.white,
9
+ height: '40px',
10
+ padding: theme.spacing(0.25),
8
11
  ...imgBgProps.sx,
9
- borderRadius: imageMode === 'circle' ? '50%' : 'inherit',
10
12
  },
11
13
  };
12
- return (_jsxs(_Fragment, { children: [_jsxs(FlexRow, { className: "TokenSummary-root", paddingBottom: 3, width: "100%", justifyContent: "flex-start", ...props, children: [_jsx(Paper, { component: FlexCol, padding: 1, className: "token-logo-bg", height: "40px", width: "40px", ...paperProps, children: _jsx("img", { src: icon, height: "25px" }) }), _jsx(Typography, { variant: "h6", fontWeight: 300, textTransform: "uppercase", paddingLeft: 1, children: symbol })] }), children] }));
14
+ return (_jsxs(_Fragment, { children: [_jsx(CardHeader, { avatar: _jsx(Avatar, { src: icon, alt: symbol, ...avatarProps }), title: _jsx(Typography, { variant: "h6", fontWeight: 300, textTransform: "uppercase", children: symbol }), ...props }), children] }));
13
15
  };
14
16
  //# sourceMappingURL=TokenSummary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TokenSummary.js","sourceRoot":"","sources":["../../../../src/components/TokenSummary/TokenSummary.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAc,UAAU,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,EAAgB,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAStE,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EAAE,SAAS,GAAG,QAAQ,EAAE,UAAU,GAAG,EAAE,EAA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AAU,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;YACtC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;YAC5B,GAAG,UAAU,CAAC,EAAE;SACjB;KACF,CAAA;IACD,OAAO,CACL,8BACE,KAAC,UAAU,IACT,MAAM,EAAE,KAAC,MAAM,IAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAM,WAAW,GAAI,EAC3D,KAAK,EACH,KAAC,UAAU,IAAC,OAAO,EAAC,IAAI,EAAC,UAAU,EAAE,GAAG,EAAE,aAAa,EAAC,WAAW,YAChE,MAAM,GACI,KAEX,KAAK,GACT,EACD,QAAQ,IACR,CACJ,CAAA;AACH,CAAC,CAAA"}
package/package.json CHANGED
@@ -21,6 +21,7 @@
21
21
  "@xylabs/react-dialogs": "^2.14.11",
22
22
  "@xylabs/react-flexbox": "^2.14.11",
23
23
  "@xylabs/react-link": "^2.14.11",
24
+ "@xylabs/react-quick-tip-button": "^2.14.11",
24
25
  "@xylabs/react-shared": "^2.14.11",
25
26
  "@xyo-network/core": "^2.25.2",
26
27
  "axios": "^0.27.2",
@@ -36,7 +37,7 @@
36
37
  "@xylabs/pixel": "^1.4.5",
37
38
  "@xylabs/tsconfig-dom": "^2.5.92",
38
39
  "@xyo-network/api": "^2.25.2",
39
- "@xyo-network/react-storybook": "^2.27.21"
40
+ "@xyo-network/react-storybook": "^2.27.24"
40
41
  },
41
42
  "browser": "dist/esm/index.js",
42
43
  "docs": "dist/docs.json",
@@ -80,5 +81,5 @@
80
81
  },
81
82
  "sideEffects": false,
82
83
  "types": "dist/esm/index.d.ts",
83
- "version": "2.27.21"
84
+ "version": "2.27.24"
84
85
  }
@@ -1,4 +1,5 @@
1
1
  import { ComponentMeta, ComponentStory } from '@storybook/react'
2
+ import { QuickTipButton } from '@xylabs/react-quick-tip-button'
2
3
  import { BrowserRouter } from 'react-router-dom'
3
4
 
4
5
  import { TokenBar } from './TokenBar'
@@ -22,10 +23,13 @@ const Template: ComponentStory<typeof TokenBar> = (args) => (
22
23
  const WithData = Template.bind({})
23
24
  WithData.args = { text1: 'Hello', text2: 'World' }
24
25
 
26
+ const WithSuffixes = Template.bind({})
27
+ WithSuffixes.args = { text1: 'ETH', text2: '0.062342', text2Suffix: <QuickTipButton title="0.06234298345834958" /> }
28
+
25
29
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
26
30
  //@ts-ignore
27
31
 
28
- export { WithData }
32
+ export { WithData, WithSuffixes }
29
33
 
30
34
  // eslint-disable-next-line import/no-default-export
31
35
  export default StorybookEntry
@@ -1,19 +1,26 @@
1
- import { Paper, PaperProps, Typography } from '@mui/material'
1
+ import { Paper, PaperProps, Typography, TypographyProps } from '@mui/material'
2
2
  import { FlexRow } from '@xylabs/react-flexbox'
3
+ import { ReactNode } from 'react'
3
4
  export interface TokenBarProps extends PaperProps {
4
5
  text1?: string | number
6
+ text1Props?: TypographyProps
7
+ text1Suffix?: ReactNode
5
8
  text2?: string | number
9
+ text2Props?: TypographyProps
10
+ text2Suffix?: ReactNode
6
11
  }
7
12
 
8
- export const TokenBar: React.FC<TokenBarProps> = ({ text1, text2, ...props }) => {
13
+ export const TokenBar: React.FC<TokenBarProps> = ({ text1, text1Props, text1Suffix, text2, text2Props, text2Suffix, ...props }) => {
9
14
  return (
10
15
  <Paper elevation={0} className="TokenBar-root" {...props}>
11
16
  <FlexRow justifyContent="space-between">
12
- <Typography variant="body1" fontWeight={300} margin={1}>
17
+ <Typography variant="body1" fontWeight={300} margin={1} {...text1Props}>
13
18
  {text1}
19
+ {text1Suffix}
14
20
  </Typography>
15
- <Typography variant="body1" fontWeight={300} textTransform="uppercase" color="gray" margin={1}>
21
+ <Typography variant="body1" fontWeight={300} textTransform="uppercase" color="gray" margin={1} {...text2Props}>
16
22
  {text2}
23
+ {text2Suffix}
17
24
  </Typography>
18
25
  </FlexRow>
19
26
  </Paper>
@@ -1,31 +1,33 @@
1
- import { Paper, PaperProps, Typography } from '@mui/material'
2
- import { FlexBoxProps, FlexCol, FlexRow } from '@xylabs/react-flexbox'
1
+ import { Avatar, AvatarProps, CardHeader, CardHeaderProps, Typography, useTheme } from '@mui/material'
3
2
 
4
- export interface TokenSummaryProps extends FlexBoxProps {
3
+ export interface TokenSummaryProps extends CardHeaderProps {
5
4
  icon?: string
6
5
  symbol?: string
7
- imgBgProps?: PaperProps
8
- imageMode?: 'circle'
6
+ imgBgProps?: AvatarProps
9
7
  }
10
8
 
11
- export const TokenSummary: React.FC<TokenSummaryProps> = ({ imageMode = 'circle', imgBgProps = {}, icon, symbol, children, ...props }) => {
12
- const paperProps = {
9
+ export const TokenSummary: React.FC<TokenSummaryProps> = ({ imgBgProps = {}, icon, symbol, children, ...props }) => {
10
+ const theme = useTheme()
11
+ const avatarProps = {
13
12
  ...imgBgProps,
14
13
  sx: {
14
+ background: theme.palette.common.white,
15
+ height: '40px',
16
+ padding: theme.spacing(0.25),
15
17
  ...imgBgProps.sx,
16
- borderRadius: imageMode === 'circle' ? '50%' : 'inherit',
17
18
  },
18
19
  }
19
20
  return (
20
21
  <>
21
- <FlexRow className="TokenSummary-root" paddingBottom={3} width="100%" justifyContent="flex-start" {...props}>
22
- <Paper component={FlexCol} padding={1} className="token-logo-bg" height="40px" width="40px" {...paperProps}>
23
- <img src={icon} height="25px" />
24
- </Paper>
25
- <Typography variant="h6" fontWeight={300} textTransform="uppercase" paddingLeft={1}>
26
- {symbol}
27
- </Typography>
28
- </FlexRow>
22
+ <CardHeader
23
+ avatar={<Avatar src={icon} alt={symbol} {...avatarProps} />}
24
+ title={
25
+ <Typography variant="h6" fontWeight={300} textTransform="uppercase">
26
+ {symbol}
27
+ </Typography>
28
+ }
29
+ {...props}
30
+ />
29
31
  {children}
30
32
  </>
31
33
  )