@arcblock/ux 2.10.49 → 2.10.51

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useSize } from 'ahooks';
3
3
  import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
4
+ import { Box } from '@mui/material';
4
5
  import { styled } from '../Theme';
5
6
  import DidAddress from './did-address';
6
7
 
@@ -60,7 +61,7 @@ const ResponsiveDidAddress = /*#__PURE__*/forwardRef(({
60
61
  });
61
62
  });
62
63
  export default ResponsiveDidAddress;
63
- const Root = styled('div')`
64
+ const Root = styled(Box)`
64
65
  display: block;
65
66
  overflow: hidden;
66
67
  ${({
@@ -1,7 +1,8 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import PropTypes from 'prop-types';
3
3
  import { useSize } from 'ahooks';
4
4
  import Tooltip from '@mui/material/Tooltip';
5
+ import { useSnackbar } from 'notistack';
5
6
  import useCopy from './hook';
6
7
  import Toast, { ToastProvider } from '../Toast';
7
8
  import { mergeProps } from '../Util';
@@ -46,6 +47,7 @@ export default function ClickToCopy(props) {
46
47
  });
47
48
  const _tip = tip || texts.copy;
48
49
  const _copiedTip = copiedTip || texts.copied;
50
+ const snackbarContext = useSnackbar();
49
51
  const size = useSize(document.body);
50
52
  const width = size?.width || 0;
51
53
  const onCopy = e => {
@@ -55,20 +57,27 @@ export default function ClickToCopy(props) {
55
57
  }
56
58
  };
57
59
  const ContainerComponent = unstyled ? UnstyledContainer : Container;
58
- return /*#__PURE__*/_jsx(ToastProvider, {
59
- children: /*#__PURE__*/_jsx(Tooltip, {
60
- title: copied ? _copiedTip : _tip,
61
- ...rest,
62
- placement: tipPlacement,
63
- disableFocusListener: true,
64
- children: /*#__PURE__*/_jsx(ContainerComponent, {
65
- ref: containerRef,
66
- style: style,
67
- onClick: onCopy,
68
- children: children || content
69
- })
60
+ const contentChild = /*#__PURE__*/_jsx(Tooltip, {
61
+ title: copied ? _copiedTip : _tip,
62
+ ...rest,
63
+ placement: tipPlacement,
64
+ disableFocusListener: true,
65
+ children: /*#__PURE__*/_jsx(ContainerComponent, {
66
+ ref: containerRef,
67
+ style: style,
68
+ onClick: onCopy,
69
+ children: children || content
70
70
  })
71
71
  });
72
+ if (!snackbarContext) {
73
+ return /*#__PURE__*/_jsx(ToastProvider, {
74
+ children: contentChild
75
+ });
76
+ }
77
+ // eslint-disable-next-line react/jsx-no-useless-fragment
78
+ return /*#__PURE__*/_jsx(_Fragment, {
79
+ children: contentChild
80
+ });
72
81
  }
73
82
  ClickToCopy.propTypes = {
74
83
  children: PropTypes.any.isRequired,
package/lib/DID/index.js CHANGED
@@ -83,7 +83,10 @@ const DID = /*#__PURE__*/forwardRef((props, ref) => {
83
83
  append = null,
84
84
  compact = false,
85
85
  startChars = 6,
86
- endChars = 6
86
+ endChars = 6,
87
+ style,
88
+ className,
89
+ sx
87
90
  } = props;
88
91
  const rest = {
89
92
  size,
@@ -95,7 +98,10 @@ const DID = /*#__PURE__*/forwardRef((props, ref) => {
95
98
  append,
96
99
  compact,
97
100
  startChars,
98
- endChars
101
+ endChars,
102
+ style,
103
+ className,
104
+ sx
99
105
  };
100
106
  const addressRef = useRef(null);
101
107
  const t = useMemoizedFn((key, data = {}) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.10.49",
3
+ "version": "2.10.51",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -64,12 +64,12 @@
64
64
  "react": ">=18.2.0",
65
65
  "react-router-dom": ">=6.22.3"
66
66
  },
67
- "gitHead": "206b3e502e292b9ad87f8f9d47efd7d5dc49ac28",
67
+ "gitHead": "50d25c76d0450bf7e2a471dcec83a38a4afca2e8",
68
68
  "dependencies": {
69
69
  "@arcblock/did-motif": "^1.1.13",
70
- "@arcblock/icons": "^2.10.49",
71
- "@arcblock/nft-display": "^2.10.49",
72
- "@arcblock/react-hooks": "^2.10.49",
70
+ "@arcblock/icons": "^2.10.51",
71
+ "@arcblock/nft-display": "^2.10.51",
72
+ "@arcblock/react-hooks": "^2.10.51",
73
73
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
74
74
  "@fontsource/inter": "^5.0.16",
75
75
  "@fontsource/ubuntu-mono": "^5.0.18",
@@ -1,7 +1,7 @@
1
1
  import { useSize } from 'ahooks';
2
2
  import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
3
+ import { Box } from '@mui/material';
3
4
  import { styled } from '../Theme';
4
-
5
5
  import DidAddress, { HTMLDidAddressElement, IDidAddressProps } from './did-address';
6
6
 
7
7
  /**
@@ -66,7 +66,7 @@ export interface IResponsiveDidAddressProps extends IDidAddressProps {
66
66
  component?: React.ElementType;
67
67
  }
68
68
 
69
- const Root = styled('div')`
69
+ const Root = styled(Box)`
70
70
  display: block;
71
71
  overflow: hidden;
72
72
  ${({ inline }: any) =>
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types';
2
2
  import { useSize } from 'ahooks';
3
3
  import Tooltip from '@mui/material/Tooltip';
4
4
 
5
+ import { useSnackbar } from 'notistack';
5
6
  import useCopy from './hook';
6
7
  import Toast, { ToastProvider } from '../Toast';
7
8
  import { mergeProps } from '../Util';
@@ -32,6 +33,7 @@ export default function ClickToCopy(props) {
32
33
  const { containerRef, copied, copy, texts } = useCopy({ content, locale });
33
34
  const _tip = tip || texts.copy;
34
35
  const _copiedTip = copiedTip || texts.copied;
36
+ const snackbarContext = useSnackbar();
35
37
 
36
38
  const size = useSize(document.body);
37
39
  const width = size?.width || 0;
@@ -45,16 +47,18 @@ export default function ClickToCopy(props) {
45
47
  };
46
48
 
47
49
  const ContainerComponent = unstyled ? UnstyledContainer : Container;
48
-
49
- return (
50
- <ToastProvider>
51
- <Tooltip title={copied ? _copiedTip : _tip} {...rest} placement={tipPlacement} disableFocusListener>
52
- <ContainerComponent ref={containerRef} style={style} onClick={onCopy}>
53
- {children || content}
54
- </ContainerComponent>
55
- </Tooltip>
56
- </ToastProvider>
50
+ const contentChild = (
51
+ <Tooltip title={copied ? _copiedTip : _tip} {...rest} placement={tipPlacement} disableFocusListener>
52
+ <ContainerComponent ref={containerRef} style={style} onClick={onCopy}>
53
+ {children || content}
54
+ </ContainerComponent>
55
+ </Tooltip>
57
56
  );
57
+ if (!snackbarContext) {
58
+ return <ToastProvider>{contentChild}</ToastProvider>;
59
+ }
60
+ // eslint-disable-next-line react/jsx-no-useless-fragment
61
+ return <>{contentChild}</>;
58
62
  }
59
63
 
60
64
  ClickToCopy.propTypes = {
package/src/DID/index.tsx CHANGED
@@ -119,6 +119,9 @@ const DID = forwardRef<HTMLDIDElement, IDIDPropTypes>((props, ref) => {
119
119
  compact = false,
120
120
  startChars = 6,
121
121
  endChars = 6,
122
+ style,
123
+ className,
124
+ sx,
122
125
  } = props;
123
126
 
124
127
  const rest = {
@@ -132,6 +135,9 @@ const DID = forwardRef<HTMLDIDElement, IDIDPropTypes>((props, ref) => {
132
135
  compact,
133
136
  startChars,
134
137
  endChars,
138
+ style,
139
+ className,
140
+ sx,
135
141
  };
136
142
 
137
143
  const addressRef = useRef<any>(null);