@xylabs/sdk-react 2.7.6 → 2.7.10

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 (94) hide show
  1. package/dist/components/AppBarEx/AppBarEx.stories.d.ts +2 -2
  2. package/dist/components/AppBarEx/AppBarEx.stories.d.ts.map +1 -1
  3. package/dist/components/AppBarEx/AppBarEx.stories.js +5 -5
  4. package/dist/components/AppBarEx/AppBarEx.stories.js.map +1 -1
  5. package/dist/components/BasePage/BasePage.stories.d.ts +1 -1
  6. package/dist/components/BasePage/BasePage.stories.d.ts.map +1 -1
  7. package/dist/components/BasePage/BasePage.stories.js +3 -2
  8. package/dist/components/BasePage/BasePage.stories.js.map +1 -1
  9. package/dist/components/Breadcrumbs/BreadcrumbsEx.stories.js +1 -1
  10. package/dist/components/Breadcrumbs/BreadcrumbsEx.stories.js.map +1 -1
  11. package/dist/components/ButtonEx/ButtonEx.stories.js +1 -1
  12. package/dist/components/ButtonEx/ButtonEx.stories.js.map +1 -1
  13. package/dist/components/CookieConsent/CookieConsent.stories.js +1 -1
  14. package/dist/components/CookieConsent/CookieConsent.stories.js.map +1 -1
  15. package/dist/components/Errors/ErrorViewer.stories.js +1 -1
  16. package/dist/components/Errors/ErrorViewer.stories.js.map +1 -1
  17. package/dist/components/Errors/ErrorsViewer.stories.js +1 -1
  18. package/dist/components/Errors/ErrorsViewer.stories.js.map +1 -1
  19. package/dist/components/EthAccount/EthAccount.d.ts.map +1 -1
  20. package/dist/components/EthAccount/EthAccount.js +30 -10
  21. package/dist/components/EthAccount/EthAccount.js.map +1 -1
  22. package/dist/components/EthAccount/EthAccount.stories.d.ts +7 -2
  23. package/dist/components/EthAccount/EthAccount.stories.d.ts.map +1 -1
  24. package/dist/components/EthAccount/EthAccount.stories.js +44 -6
  25. package/dist/components/EthAccount/EthAccount.stories.js.map +1 -1
  26. package/dist/components/EthAccount/EthAccountProps.d.ts +5 -7
  27. package/dist/components/EthAccount/EthAccountProps.d.ts.map +1 -1
  28. package/dist/components/FlexBox/BusyBox.stories.js +1 -1
  29. package/dist/components/FlexBox/BusyBox.stories.js.map +1 -1
  30. package/dist/components/FlexBox/FlexCol.stories.js +1 -1
  31. package/dist/components/FlexBox/FlexCol.stories.js.map +1 -1
  32. package/dist/components/FlexBox/FlexRow.stories.js +1 -1
  33. package/dist/components/FlexBox/FlexRow.stories.js.map +1 -1
  34. package/dist/components/Identicon.d.ts +3 -2
  35. package/dist/components/Identicon.d.ts.map +1 -1
  36. package/dist/components/Identicon.js +21 -10
  37. package/dist/components/Identicon.js.map +1 -1
  38. package/dist/components/InvertableThemeProvider/InvertableThemeProvider.stories.js +1 -1
  39. package/dist/components/InvertableThemeProvider/InvertableThemeProvider.stories.js.map +1 -1
  40. package/dist/components/NumberStatus/NumberStatus.stories.js +1 -1
  41. package/dist/components/NumberStatus/NumberStatus.stories.js.map +1 -1
  42. package/dist/components/QuickTipButton/QuickTipButton.stories.js +1 -1
  43. package/dist/components/QuickTipButton/QuickTipButton.stories.js.map +1 -1
  44. package/dist/components/TokenAmount/TokenAmount.stories.js +1 -1
  45. package/dist/components/TokenAmount/TokenAmount.stories.js.map +1 -1
  46. package/dist/components/dialogs/ErrorDialog.d.ts +4 -4
  47. package/dist/components/dialogs/ErrorDialog.d.ts.map +1 -1
  48. package/dist/components/dialogs/ErrorDialog.js +21 -11
  49. package/dist/components/dialogs/ErrorDialog.js.map +1 -1
  50. package/dist/components/dialogs/ErrorDialog.stories.d.ts +7 -0
  51. package/dist/components/dialogs/ErrorDialog.stories.d.ts.map +1 -0
  52. package/dist/components/dialogs/ErrorDialog.stories.js +22 -0
  53. package/dist/components/dialogs/ErrorDialog.stories.js.map +1 -0
  54. package/dist/components/dialogs/MessageDialog.d.ts +2 -3
  55. package/dist/components/dialogs/MessageDialog.d.ts.map +1 -1
  56. package/dist/components/dialogs/MessageDialog.js +1 -2
  57. package/dist/components/dialogs/MessageDialog.js.map +1 -1
  58. package/dist/components/dialogs/MessageDialog.stories.d.ts +7 -0
  59. package/dist/components/dialogs/MessageDialog.stories.d.ts.map +1 -0
  60. package/dist/components/dialogs/MessageDialog.stories.js +22 -0
  61. package/dist/components/dialogs/MessageDialog.stories.js.map +1 -0
  62. package/package.json +13 -15
  63. package/src/components/AppBarEx/AppBarEx.stories.tsx +5 -5
  64. package/src/components/BasePage/BasePage.stories.tsx +3 -2
  65. package/src/components/Breadcrumbs/BreadcrumbsEx.stories.tsx +1 -1
  66. package/src/components/ButtonEx/ButtonEx.stories.tsx +1 -1
  67. package/src/components/CookieConsent/CookieConsent.stories.tsx +1 -1
  68. package/src/components/Errors/ErrorViewer.stories.tsx +1 -1
  69. package/src/components/Errors/ErrorsViewer.stories.tsx +1 -1
  70. package/src/components/EthAccount/EthAccount.stories.tsx +53 -6
  71. package/src/components/EthAccount/EthAccount.tsx +71 -7
  72. package/src/components/EthAccount/EthAccountProps.tsx +6 -7
  73. package/src/components/FlexBox/BusyBox.stories.tsx +1 -1
  74. package/src/components/FlexBox/FlexCol.stories.tsx +1 -1
  75. package/src/components/FlexBox/FlexRow.stories.tsx +1 -1
  76. package/src/components/Identicon.tsx +26 -13
  77. package/src/components/InvertableThemeProvider/InvertableThemeProvider.stories.tsx +1 -1
  78. package/src/components/NumberStatus/NumberStatus.stories.tsx +1 -1
  79. package/src/components/QuickTipButton/QuickTipButton.stories.tsx +1 -1
  80. package/src/components/TokenAmount/TokenAmount.stories.tsx +1 -1
  81. package/src/components/dialogs/ErrorDialog.stories.tsx +27 -0
  82. package/src/components/dialogs/ErrorDialog.tsx +14 -14
  83. package/src/components/dialogs/MessageDialog.stories.tsx +27 -0
  84. package/src/components/dialogs/MessageDialog.tsx +2 -4
  85. package/dist/components/EthAccount/EthAccountBase.d.ts +0 -5
  86. package/dist/components/EthAccount/EthAccountBase.d.ts.map +0 -1
  87. package/dist/components/EthAccount/EthAccountBase.js +0 -42
  88. package/dist/components/EthAccount/EthAccountBase.js.map +0 -1
  89. package/dist/components/EthAccount/EthAccountTo.d.ts +0 -5
  90. package/dist/components/EthAccount/EthAccountTo.d.ts.map +0 -1
  91. package/dist/components/EthAccount/EthAccountTo.js +0 -30
  92. package/dist/components/EthAccount/EthAccountTo.js.map +0 -1
  93. package/src/components/EthAccount/EthAccountBase.tsx +0 -60
  94. package/src/components/EthAccount/EthAccountTo.tsx +0 -30
@@ -1,23 +1,25 @@
1
1
  import md5 from 'md5'
2
2
  import React, { useEffect, useRef } from 'react'
3
3
 
4
+ import { FlexBoxProps, FlexRow } from './FlexBox'
5
+
4
6
  const range = (n: number, in_min: number, in_max: number, out_min: number, out_max: number) => {
5
7
  return ((n - in_min) * (out_max - out_min)) / (in_max - in_min) + out_min
6
8
  }
7
9
 
8
- interface IdenticonProps {
10
+ interface IdenticonProps extends FlexBoxProps {
9
11
  bg?: string
10
12
  className?: string
11
13
  count?: number
12
14
  fg?: string
13
- padding?: number
15
+ iconPadding?: number
14
16
  palette?: string[]
15
17
  size?: number
16
18
  value?: string
17
19
  }
18
20
 
19
21
  const updateCanvas = (canvas: React.RefObject<HTMLCanvasElement>, props: IdenticonProps) => {
20
- const { value = '', size = 400, bg = 'transparent', count = 5, palette, padding = 0 } = props
22
+ const { value = '', size = 400, bg = 'transparent', count = 5, palette, iconPadding = 0 } = props
21
23
  let { fg } = props
22
24
  const hash = md5(value)
23
25
  const block = Math.floor(size / count)
@@ -34,9 +36,8 @@ const updateCanvas = (canvas: React.RefObject<HTMLCanvasElement>, props: Identic
34
36
  fg = palette[index]
35
37
  }
36
38
 
37
- const pad = padding
38
- current.width = block * count + pad
39
- current.height = block * count + pad
39
+ current.width = block * count + iconPadding
40
+ current.height = block * count + iconPadding
40
41
  const arr = hash.split('').map((el) => {
41
42
  const parsedEl = parseInt(el, 16)
42
43
  if (parsedEl < 8) {
@@ -61,26 +62,38 @@ const updateCanvas = (canvas: React.RefObject<HTMLCanvasElement>, props: Identic
61
62
  row.forEach((el, j) => {
62
63
  if (el) {
63
64
  ctx.fillStyle = fg ? fg : '#' + hashcolor
64
- ctx.fillRect(block * i + pad, block * j + pad, block - pad, block - pad)
65
+ ctx.fillRect(block * i + iconPadding, block * j + iconPadding, block - iconPadding, block - iconPadding)
65
66
  } else {
66
67
  ctx.fillStyle = bg
67
- ctx.fillRect(block * i + pad, block * j + pad, block - pad, block - pad)
68
+ ctx.fillRect(block * i + iconPadding, block * j + iconPadding, block - iconPadding, block - iconPadding)
68
69
  }
69
70
  })
70
71
  })
71
72
  }
72
73
  }
73
74
 
74
- const Identicon: React.FC<IdenticonProps> = (props) => {
75
- const { size = 400, className = 'identicon' } = props
76
-
75
+ const Identicon: React.FC<IdenticonProps> = ({
76
+ size = 400,
77
+ className = 'identicon',
78
+ bg,
79
+ count,
80
+ fg,
81
+ iconPadding,
82
+ palette,
83
+ value,
84
+ ...props
85
+ }) => {
77
86
  const canvas = useRef<HTMLCanvasElement>(null)
78
87
 
79
88
  useEffect(() => {
80
- updateCanvas(canvas, props)
89
+ updateCanvas(canvas, { bg, className, count, fg, iconPadding, palette, size, value })
81
90
  })
82
91
 
83
- return <canvas className={className} ref={canvas} style={{ height: size, width: size }} />
92
+ return (
93
+ <FlexRow {...props}>
94
+ <canvas className={className} ref={canvas} style={{ height: size, width: size }} />
95
+ </FlexRow>
96
+ )
84
97
  }
85
98
 
86
99
  export { Identicon }
@@ -10,7 +10,7 @@ const StorybookEntry = {
10
10
  page: null,
11
11
  },
12
12
  },
13
- title: 'InvertableThemeProvider',
13
+ title: 'Components/InvertableThemeProvider',
14
14
  } as ComponentMeta<typeof InvertableThemeProvider>
15
15
 
16
16
  const Template: ComponentStory<typeof InvertableThemeProvider> = (args) => (
@@ -10,7 +10,7 @@ const StorybookEntry = {
10
10
  page: null,
11
11
  },
12
12
  },
13
- title: 'NumberStatus',
13
+ title: 'Components/NumberStatus',
14
14
  } as ComponentMeta<typeof NumberStatus>
15
15
 
16
16
  const NumberStatusTemplate: ComponentStory<typeof NumberStatus> = (args) => <NumberStatus {...args}></NumberStatus>
@@ -11,7 +11,7 @@ const StorybookEntry = {
11
11
  page: null,
12
12
  },
13
13
  },
14
- title: 'QuickTipButton',
14
+ title: 'Components/QuickTipButton',
15
15
  } as ComponentMeta<typeof QuickTipButton>
16
16
 
17
17
  const Template: ComponentStory<typeof QuickTipButton> = (args) => <QuickTipButton {...args}></QuickTipButton>
@@ -11,7 +11,7 @@ const StorybookEntry = {
11
11
  page: null,
12
12
  },
13
13
  },
14
- title: 'TokenAmount',
14
+ title: 'Components/TokenAmount',
15
15
  } as ComponentMeta<typeof TokenAmount>
16
16
 
17
17
  const Template: ComponentStory<typeof TokenAmount> = (args) => <TokenAmount {...args}></TokenAmount>
@@ -0,0 +1,27 @@
1
+ import { ComponentMeta, ComponentStory } from '@storybook/react'
2
+
3
+ import { ErrorDialog } from './ErrorDialog'
4
+
5
+ const StorybookEntry = {
6
+ argTypes: {},
7
+ component: ErrorDialog,
8
+ parameters: {
9
+ docs: {
10
+ page: null,
11
+ },
12
+ },
13
+ title: 'Dialogs/ErrorDialog',
14
+ } as ComponentMeta<typeof ErrorDialog>
15
+
16
+ const Template: ComponentStory<typeof ErrorDialog> = (args) => <ErrorDialog {...args}></ErrorDialog>
17
+
18
+ const Default = Template.bind({})
19
+ Default.args = {
20
+ error: Error('Test Error'),
21
+ title: 'Test Error',
22
+ }
23
+
24
+ export { Default }
25
+
26
+ // eslint-disable-next-line import/no-default-export
27
+ export default StorybookEntry
@@ -1,13 +1,13 @@
1
- import { Dialog, DialogActions, DialogContent, DialogTitle, Typography } from '@mui/material'
1
+ import { Dialog, DialogActions, DialogContent, DialogProps, DialogTitle, Typography } from '@mui/material'
2
2
  import { AxiosError } from 'axios'
3
3
  import React from 'react'
4
4
 
5
5
  import { ButtonEx } from '../ButtonEx'
6
6
  import { FlexRow } from '../FlexBox'
7
7
 
8
- interface Props {
8
+ export interface ErrorDialogProps extends DialogProps {
9
9
  error?: Error
10
- onClose?: (retry: boolean) => void
10
+ onAction?: (retry: boolean) => void
11
11
  title?: string
12
12
  }
13
13
 
@@ -15,22 +15,25 @@ const toAxiosError = (error: Error) => {
15
15
  return (error as AxiosError).isAxiosError ? (error as AxiosError) : undefined
16
16
  }
17
17
 
18
- const ErrorDialogOpen: React.FC<Props> = (props) => {
19
- const { onClose, title = 'Oops. Something went wrong.', error = Error('Unknown Error') } = props
20
-
18
+ const ErrorDialogOpen: React.FC<ErrorDialogProps> = ({
19
+ onAction,
20
+ title = 'Oops. Something went wrong.',
21
+ error = Error('Unknown Error'),
22
+ ...props
23
+ }) => {
21
24
  const onCloseClicked = () => {
22
- onClose?.(false)
25
+ onAction?.(false)
23
26
  }
24
27
 
25
28
  const onRetryClicked = () => {
26
- onClose?.(true)
29
+ onAction?.(true)
27
30
  }
28
31
 
29
32
  const axiosError = toAxiosError(error)
30
33
  const message = error.message ?? error.toString()
31
34
 
32
35
  return (
33
- <Dialog onClose={onClose} open={!!error}>
36
+ <Dialog {...props}>
34
37
  <DialogTitle>{title}</DialogTitle>
35
38
  <DialogContent>
36
39
  <FlexRow>
@@ -53,13 +56,10 @@ const ErrorDialogOpen: React.FC<Props> = (props) => {
53
56
  )
54
57
  }
55
58
 
56
- const ErrorDialog: React.FC<Props> = (props) => {
57
- const { error } = props
59
+ export const ErrorDialog: React.FC<ErrorDialogProps> = ({ open, error, ...props }) => {
58
60
  if (error) {
59
- return <ErrorDialogOpen {...props} />
61
+ return <ErrorDialogOpen open={!!error || open} error={error} {...props} />
60
62
  } else {
61
63
  return null
62
64
  }
63
65
  }
64
-
65
- export { ErrorDialog }
@@ -0,0 +1,27 @@
1
+ import { ComponentMeta, ComponentStory } from '@storybook/react'
2
+
3
+ import { MessageDialog } from './MessageDialog'
4
+
5
+ const StorybookEntry = {
6
+ argTypes: {},
7
+ component: MessageDialog,
8
+ parameters: {
9
+ docs: {
10
+ page: null,
11
+ },
12
+ },
13
+ title: 'Dialogs/MessageDialog',
14
+ } as ComponentMeta<typeof MessageDialog>
15
+
16
+ const Template: ComponentStory<typeof MessageDialog> = (args) => <MessageDialog {...args}>Test Message</MessageDialog>
17
+
18
+ const Default = Template.bind({})
19
+ Default.args = {
20
+ open: true,
21
+ title: 'Test Error',
22
+ }
23
+
24
+ export { Default }
25
+
26
+ // eslint-disable-next-line import/no-default-export
27
+ export default StorybookEntry
@@ -2,12 +2,12 @@ import { Button, Dialog, DialogActions, DialogContent, DialogProps, DialogTitle
2
2
 
3
3
  import { FlexCol, FlexRow } from '../FlexBox'
4
4
 
5
- interface Props extends DialogProps {
5
+ export interface MessageDialogProps extends DialogProps {
6
6
  onOk?: () => void
7
7
  onCancel?: () => void
8
8
  }
9
9
 
10
- const MessageDialog: React.FC<Props> = ({ onOk, onCancel, children, title, ...props }) => {
10
+ export const MessageDialog: React.FC<MessageDialogProps> = ({ onOk, onCancel, children, title, ...props }) => {
11
11
  return (
12
12
  <Dialog {...props}>
13
13
  <DialogTitle>{title}</DialogTitle>
@@ -27,5 +27,3 @@ const MessageDialog: React.FC<Props> = ({ onOk, onCancel, children, title, ...pr
27
27
  </Dialog>
28
28
  )
29
29
  }
30
-
31
- export { MessageDialog }
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { EthAccountProps } from './EthAccountProps';
3
- declare const EthAccountBase: React.FC<EthAccountProps>;
4
- export { EthAccountBase };
5
- //# sourceMappingURL=EthAccountBase.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EthAccountBase.d.ts","sourceRoot":"","sources":["../../../src/components/EthAccount/EthAccountBase.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA+C7C,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -1,42 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { Typography, useTheme } from '@mui/material';
14
- import { useContext } from 'react';
15
- import { EthersContext } from '../../contexts';
16
- import { useMediaQuery } from '../../hooks';
17
- import { ButtonEx } from '../ButtonEx';
18
- import { FlexGrowRow, FlexRow } from '../FlexBox';
19
- import { Identicon } from '../Identicon';
20
- const EthAccountBase = (_a) => {
21
- var { address, icon = false, iconOnly = false, full = false, auto, size = 16, toEtherScan, onButtonClick } = _a, props = __rest(_a, ["address", "icon", "iconOnly", "full", "auto", "size", "toEtherScan", "onButtonClick"]);
22
- const { localAddress } = useContext(EthersContext);
23
- const theme = useTheme();
24
- const large = useMediaQuery(theme.breakpoints.up('md'));
25
- const fontFamily = '"Source Code Pro",monospace';
26
- if (address) {
27
- const isLocalAddress = (localAddress === null || localAddress === void 0 ? void 0 : localAddress.toString()) === address.toString();
28
- const onClickLocal = (event) => {
29
- onButtonClick === null || onButtonClick === void 0 ? void 0 : onButtonClick(event);
30
- if (toEtherScan) {
31
- window.open(`https://etherscan.io/address/${address.toString()}`, '_blank');
32
- }
33
- };
34
- const testToDisplay = full || !auto ? address.toString() : large ? address.toString() : address.toShortString();
35
- return (_jsx(FlexRow, Object.assign({ margin: 0.5, padding: 0.5, title: `0x${address === null || address === void 0 ? void 0 : address.toHex()}` }, props, { children: _jsx(ButtonEx, Object.assign({ fullWidth: true, onClick: onClickLocal, variant: "outlined" }, { children: _jsxs(FlexGrowRow, Object.assign({ justifyContent: "space-between", alignItems: "center" }, { children: [icon ? _jsx(Identicon, { size: size, value: address === null || address === void 0 ? void 0 : address.toHex() }, void 0) : null, iconOnly ? null : (_jsx(Typography, Object.assign({ variant: "body1", fontFamily: fontFamily, style: { textTransform: 'none' } }, { children: testToDisplay }), void 0)), isLocalAddress ? _jsx(FlexRow, Object.assign({ marginLeft: 0.5 }, { children: "(You)" }), void 0) : null] }), void 0) }), void 0) }), void 0));
36
- }
37
- else {
38
- return _jsx(FlexRow, Object.assign({}, props, { children: ' - - ' }), void 0);
39
- }
40
- };
41
- export { EthAccountBase };
42
- //# sourceMappingURL=EthAccountBase.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EthAccountBase.js","sourceRoot":"","sources":["../../../src/components/EthAccount/EthAccountBase.tsx"],"names":[],"mappings":"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"}
@@ -1,5 +0,0 @@
1
- /// <reference types="react" />
2
- import { EthAccountProps } from './EthAccountProps';
3
- declare const EthAccountTo: React.FC<EthAccountProps>;
4
- export { EthAccountTo };
5
- //# sourceMappingURL=EthAccountTo.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EthAccountTo.d.ts","sourceRoot":"","sources":["../../../src/components/EthAccount/EthAccountTo.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqB3C,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -1,30 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { useNavigateToEthAddress } from '../../hooks';
14
- import { EthAccountBase } from './EthAccountBase';
15
- const EthAccountTo = (_a) => {
16
- var { address, to, page, toOptions, toEtherScan, onButtonClick } = _a, props = __rest(_a, ["address", "to", "page", "toOptions", "toEtherScan", "onButtonClick"]);
17
- const { navigateToEthAddress } = useNavigateToEthAddress();
18
- if (address) {
19
- const localOnClick = (event) => {
20
- onButtonClick === null || onButtonClick === void 0 ? void 0 : onButtonClick(event);
21
- if (to) {
22
- navigateToEthAddress(address, event, page, to, toOptions, toEtherScan);
23
- }
24
- };
25
- return _jsx(EthAccountBase, Object.assign({ onButtonClick: localOnClick }, props), void 0);
26
- }
27
- return null;
28
- };
29
- export { EthAccountTo };
30
- //# sourceMappingURL=EthAccountTo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EthAccountTo.js","sourceRoot":"","sources":["../../../src/components/EthAccount/EthAccountTo.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGjD,MAAM,YAAY,GAA8B,CAAC,EAQhD,EAAE,EAAE;QAR4C,EAC/C,OAAO,EACP,EAAE,EACF,IAAI,EACJ,SAAS,EACT,WAAW,EACX,aAAa,OAEd,EADI,KAAK,cAPuC,sEAQhD,CADS;IAER,MAAM,EAAE,oBAAoB,EAAE,GAAG,uBAAuB,EAAE,CAAA;IAC1D,IAAI,OAAO,EAAE;QACX,MAAM,YAAY,GAAG,CAAC,KAAoC,EAAE,EAAE;YAC5D,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAG,KAAK,CAAC,CAAA;YACtB,IAAI,EAAE,EAAE;gBACN,oBAAoB,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,CAAA;aACvE;QACH,CAAC,CAAA;QAED,OAAO,KAAC,cAAc,kBAAC,aAAa,EAAE,YAAY,IAAM,KAAK,UAAI,CAAA;KAClE;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -1,60 +0,0 @@
1
- import { Typography, useTheme } from '@mui/material'
2
- import { MouseEvent, useContext } from 'react'
3
-
4
- import { EthersContext } from '../../contexts'
5
- import { useMediaQuery } from '../../hooks'
6
- import { ButtonEx } from '../ButtonEx'
7
- import { FlexGrowRow, FlexRow } from '../FlexBox'
8
- import { Identicon } from '../Identicon'
9
- import { EthAccountProps } from './EthAccountProps'
10
-
11
- const EthAccountBase: React.FC<EthAccountProps> = ({
12
- address,
13
- icon = false,
14
- iconOnly = false,
15
- full = false,
16
- auto,
17
- size = 16,
18
- toEtherScan,
19
- onButtonClick,
20
- ...props
21
- }) => {
22
- const { localAddress } = useContext(EthersContext)
23
- const theme = useTheme()
24
-
25
- const large = useMediaQuery(theme.breakpoints.up('md'))
26
- const fontFamily = '"Source Code Pro",monospace'
27
-
28
- if (address) {
29
- const isLocalAddress = localAddress?.toString() === address.toString()
30
-
31
- const onClickLocal = (event: MouseEvent<HTMLButtonElement>) => {
32
- onButtonClick?.(event)
33
- if (toEtherScan) {
34
- window.open(`https://etherscan.io/address/${address.toString()}`, '_blank')
35
- }
36
- }
37
-
38
- const testToDisplay = full || !auto ? address.toString() : large ? address.toString() : address.toShortString()
39
-
40
- return (
41
- <FlexRow margin={0.5} padding={0.5} title={`0x${address?.toHex()}`} {...props}>
42
- <ButtonEx fullWidth onClick={onClickLocal} variant="outlined">
43
- <FlexGrowRow justifyContent="space-between" alignItems="center">
44
- {icon ? <Identicon size={size} value={address?.toHex()} /> : null}
45
- {iconOnly ? null : (
46
- <Typography variant="body1" fontFamily={fontFamily} style={{ textTransform: 'none' }}>
47
- {testToDisplay}
48
- </Typography>
49
- )}
50
- {isLocalAddress ? <FlexRow marginLeft={0.5}>(You)</FlexRow> : null}
51
- </FlexGrowRow>
52
- </ButtonEx>
53
- </FlexRow>
54
- )
55
- } else {
56
- return <FlexRow {...props}>{' - - '}</FlexRow>
57
- }
58
- }
59
-
60
- export { EthAccountBase }
@@ -1,30 +0,0 @@
1
- import { MouseEvent } from 'react'
2
-
3
- import { useNavigateToEthAddress } from '../../hooks'
4
- import { EthAccountBase } from './EthAccountBase'
5
- import { EthAccountProps } from './EthAccountProps'
6
-
7
- const EthAccountTo: React.FC<EthAccountProps> = ({
8
- address,
9
- to,
10
- page,
11
- toOptions,
12
- toEtherScan,
13
- onButtonClick,
14
- ...props
15
- }) => {
16
- const { navigateToEthAddress } = useNavigateToEthAddress()
17
- if (address) {
18
- const localOnClick = (event: MouseEvent<HTMLButtonElement>) => {
19
- onButtonClick?.(event)
20
- if (to) {
21
- navigateToEthAddress(address, event, page, to, toOptions, toEtherScan)
22
- }
23
- }
24
-
25
- return <EthAccountBase onButtonClick={localOnClick} {...props} />
26
- }
27
- return null
28
- }
29
-
30
- export { EthAccountTo }