@dynamic-labs/sdk-react-core 4.0.0-alpha.20 → 4.0.0-alpha.22
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/CHANGELOG.md +14 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/components/Button/Button.cjs +2 -2
- package/src/lib/components/Button/Button.d.ts +2 -1
- package/src/lib/components/Button/Button.js +2 -2
- package/src/lib/components/CopyButton/CopyButton.cjs +5 -5
- package/src/lib/components/CopyButton/CopyButton.js +7 -7
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +1 -1
- package/src/lib/components/NetworkPicker/NetworkPicker.js +1 -1
- package/src/lib/components/Tooltip/Tooltip.cjs +38 -6
- package/src/lib/components/Tooltip/Tooltip.d.ts +16 -1
- package/src/lib/components/Tooltip/Tooltip.js +38 -6
- package/src/lib/components/index.d.ts +1 -0
- package/src/lib/locale/en/translation.cjs +31 -1
- package/src/lib/locale/en/translation.d.ts +31 -1
- package/src/lib/locale/en/translation.js +31 -1
- package/src/lib/shared/assets/eye-outline.cjs +54 -0
- package/src/lib/shared/assets/eye-outline.js +30 -0
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/useHover/useHover.types.d.ts +1 -4
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +20 -11
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +20 -11
- package/src/lib/widgets/DynamicWidget/components/WalletDetailsCard/WalletDetailsCard.cjs +99 -0
- package/src/lib/widgets/DynamicWidget/components/WalletDetailsCard/WalletDetailsCard.d.ts +12 -0
- package/src/lib/widgets/DynamicWidget/components/WalletDetailsCard/WalletDetailsCard.js +95 -0
- package/src/lib/widgets/DynamicWidget/components/WalletDetailsCard/index.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.22](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.21...v4.0.0-alpha.22) (2024-10-30)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **QNTM-522:** add wallet details card ([#7239](https://github.com/dynamic-labs/dynamic-auth/issues/7239)) ([0181c87](https://github.com/dynamic-labs/dynamic-auth/commit/0181c8727af575620525b8ea47b196945c347846))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* update check for wallet provider event listeners support ([#7303](https://github.com/dynamic-labs/dynamic-auth/issues/7303)) ([c5f3766](https://github.com/dynamic-labs/dynamic-auth/commit/c5f376691c87a0999991e477f9acd07eed4774aa))
|
|
13
|
+
|
|
14
|
+
## [4.0.0-alpha.21](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.20...v4.0.0-alpha.21) (2024-10-30)
|
|
15
|
+
|
|
2
16
|
## [4.0.0-alpha.20](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.19...v4.0.0-alpha.20) (2024-10-30)
|
|
3
17
|
|
|
4
18
|
## [4.0.0-alpha.19](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.18...v4.0.0-alpha.19) (2024-10-29)
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.22",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.559",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
"react-i18next": "13.5.0",
|
|
13
13
|
"yup": "0.32.11",
|
|
14
14
|
"react-international-phone": "4.2.5",
|
|
15
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
16
|
-
"@dynamic-labs/iconic": "4.0.0-alpha.
|
|
17
|
-
"@dynamic-labs/logger": "4.0.0-alpha.
|
|
18
|
-
"@dynamic-labs/multi-wallet": "4.0.0-alpha.
|
|
19
|
-
"@dynamic-labs/rpc-providers": "4.0.0-alpha.
|
|
20
|
-
"@dynamic-labs/store": "4.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/types": "4.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/utils": "4.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/wallet-book": "4.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.
|
|
15
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.22",
|
|
16
|
+
"@dynamic-labs/iconic": "4.0.0-alpha.22",
|
|
17
|
+
"@dynamic-labs/logger": "4.0.0-alpha.22",
|
|
18
|
+
"@dynamic-labs/multi-wallet": "4.0.0-alpha.22",
|
|
19
|
+
"@dynamic-labs/rpc-providers": "4.0.0-alpha.22",
|
|
20
|
+
"@dynamic-labs/store": "4.0.0-alpha.22",
|
|
21
|
+
"@dynamic-labs/types": "4.0.0-alpha.22",
|
|
22
|
+
"@dynamic-labs/utils": "4.0.0-alpha.22",
|
|
23
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.22",
|
|
24
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.22",
|
|
25
25
|
"eventemitter3": "5.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
@@ -9,7 +9,7 @@ var React = require('react');
|
|
|
9
9
|
var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
10
10
|
var spinner = require('../Spinner/spinner.cjs');
|
|
11
11
|
|
|
12
|
-
const Button = ({ buttonClassName = '', buttonPadding = 'medium', buttonVariant = 'primary', children, feedback, expanded, dataTestId, disabled = false, showInternalLoading = true, loading = false, onClick, type, startSlot, endSlot, }) => {
|
|
12
|
+
const Button = ({ buttonClassName = '', buttonPadding = 'medium', buttonVariant = 'primary', buttonRef, children, feedback, expanded, dataTestId, disabled = false, showInternalLoading = true, loading = false, onClick, type, startSlot, endSlot, }) => {
|
|
13
13
|
const [internalButtonLoading, setInternalButtonLoading] = React.useState(false);
|
|
14
14
|
const [isFeedbackVisible, setIsFeedbackVisible] = React.useState(false);
|
|
15
15
|
const buttonVariantClassNameMap = {
|
|
@@ -54,7 +54,7 @@ const Button = ({ buttonClassName = '', buttonPadding = 'medium', buttonVariant
|
|
|
54
54
|
});
|
|
55
55
|
const buttonContent = (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [startSlot && jsxRuntime.jsx("div", { className: 'button__start-slot', children: startSlot }), (feedback || children) &&
|
|
56
56
|
(isFeedbackVisible && feedback ? feedback : children), endSlot && jsxRuntime.jsx("div", { className: 'button__end-slot', children: endSlot })] }));
|
|
57
|
-
return (jsxRuntime.jsxs("button", { type: type, onClick: handleClick, className: buttonEffectiveClassName, disabled: disabled || internalButtonLoading || loading, "data-testid": dataTestId, children: [(internalButtonLoading || loading) && (jsxRuntime.jsx("div", { className: 'button__spinner-container', "data-testid": 'button__spinner', children: jsxRuntime.jsx(spinner.Spinner, { className: 'button__spinner' }) })), buttonContent] }));
|
|
57
|
+
return (jsxRuntime.jsxs("button", { type: type, ref: buttonRef, onClick: handleClick, className: buttonEffectiveClassName, disabled: disabled || internalButtonLoading || loading, "data-testid": dataTestId, children: [(internalButtonLoading || loading) && (jsxRuntime.jsx("div", { className: 'button__spinner-container', "data-testid": 'button__spinner', children: jsxRuntime.jsx(spinner.Spinner, { className: 'button__spinner' }) })), buttonContent] }));
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
exports.Button = Button;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, FC, MouseEventHandler, ReactNode } from 'react';
|
|
1
|
+
import { ButtonHTMLAttributes, FC, MouseEventHandler, ReactNode, RefObject } from 'react';
|
|
2
2
|
type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'brand-primary';
|
|
3
3
|
type ButtonPadding = 'small' | 'medium' | 'large' | 'none' | 'default' | 'login-screen-height';
|
|
4
4
|
export type ButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'> & {
|
|
5
5
|
buttonClassName?: string;
|
|
6
6
|
buttonPadding?: ButtonPadding;
|
|
7
7
|
buttonVariant?: ButtonVariant;
|
|
8
|
+
buttonRef?: RefObject<HTMLButtonElement>;
|
|
8
9
|
dataTestId?: string;
|
|
9
10
|
disabled?: boolean;
|
|
10
11
|
endSlot?: JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { useState } from 'react';
|
|
|
5
5
|
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
6
6
|
import { Spinner } from '../Spinner/spinner.js';
|
|
7
7
|
|
|
8
|
-
const Button = ({ buttonClassName = '', buttonPadding = 'medium', buttonVariant = 'primary', children, feedback, expanded, dataTestId, disabled = false, showInternalLoading = true, loading = false, onClick, type, startSlot, endSlot, }) => {
|
|
8
|
+
const Button = ({ buttonClassName = '', buttonPadding = 'medium', buttonVariant = 'primary', buttonRef, children, feedback, expanded, dataTestId, disabled = false, showInternalLoading = true, loading = false, onClick, type, startSlot, endSlot, }) => {
|
|
9
9
|
const [internalButtonLoading, setInternalButtonLoading] = useState(false);
|
|
10
10
|
const [isFeedbackVisible, setIsFeedbackVisible] = useState(false);
|
|
11
11
|
const buttonVariantClassNameMap = {
|
|
@@ -50,7 +50,7 @@ const Button = ({ buttonClassName = '', buttonPadding = 'medium', buttonVariant
|
|
|
50
50
|
});
|
|
51
51
|
const buttonContent = (jsxs(Fragment, { children: [startSlot && jsx("div", { className: 'button__start-slot', children: startSlot }), (feedback || children) &&
|
|
52
52
|
(isFeedbackVisible && feedback ? feedback : children), endSlot && jsx("div", { className: 'button__end-slot', children: endSlot })] }));
|
|
53
|
-
return (jsxs("button", { type: type, onClick: handleClick, className: buttonEffectiveClassName, disabled: disabled || internalButtonLoading || loading, "data-testid": dataTestId, children: [(internalButtonLoading || loading) && (jsx("div", { className: 'button__spinner-container', "data-testid": 'button__spinner', children: jsx(Spinner, { className: 'button__spinner' }) })), buttonContent] }));
|
|
53
|
+
return (jsxs("button", { type: type, ref: buttonRef, onClick: handleClick, className: buttonEffectiveClassName, disabled: disabled || internalButtonLoading || loading, "data-testid": dataTestId, children: [(internalButtonLoading || loading) && (jsx("div", { className: 'button__spinner-container', "data-testid": 'button__spinner', children: jsx(Spinner, { className: 'button__spinner' }) })), buttonContent] }));
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
export { Button };
|
|
@@ -12,16 +12,16 @@ var Tooltip = require('../Tooltip/Tooltip.cjs');
|
|
|
12
12
|
|
|
13
13
|
const CopyButton = ({ children, className = '', textToCopy, onClick, variant = 'text', copykey, buttonPadding = 'small', buttonVariant = 'primary', buttonClassName = '', startSlot, disabled, }) => {
|
|
14
14
|
const [copied, setCopied] = React.useState(false);
|
|
15
|
+
const buttonRef = React.useRef(null);
|
|
15
16
|
const copyToClipboard = () => {
|
|
16
17
|
navigator.clipboard.writeText(textToCopy);
|
|
17
18
|
setCopied(true);
|
|
18
19
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
20
|
+
setTimeout(() => {
|
|
21
|
+
setCopied(false);
|
|
22
|
+
}, 5000);
|
|
19
23
|
};
|
|
20
|
-
|
|
21
|
-
if (variant === 'text') {
|
|
22
|
-
return (jsxRuntime.jsx(TextButton.TextButton, { className: classNames.classNames('copy-button__container', className), onClick: () => copyToClipboard(), onMouseLeave: () => setCopied(false), copykey: copykey, disabled: disabled, children: jsxRuntime.jsx(CopyButtonTooltip, {}) }));
|
|
23
|
-
}
|
|
24
|
-
return (jsxRuntime.jsx(TypographyButton.TypographyButton, { expanded: true, buttonPadding: buttonPadding, buttonVariant: buttonVariant, buttonClassName: buttonClassName, onClick: () => copyToClipboard(), copykey: copykey, startSlot: startSlot, disabled: disabled, children: jsxRuntime.jsx(CopyButtonTooltip, {}) }));
|
|
24
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [variant === 'text' ? (jsxRuntime.jsx(TextButton.TextButton, { className: classNames.classNames('copy-button__container', className), onClick: () => copyToClipboard(), onMouseLeave: () => setCopied(false), copykey: copykey, disabled: disabled, children: children })) : (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonRef: buttonRef, expanded: true, buttonPadding: buttonPadding, buttonVariant: buttonVariant, buttonClassName: buttonClassName, onClick: () => copyToClipboard(), copykey: copykey, startSlot: startSlot, disabled: disabled, children: children })), jsxRuntime.jsx(Tooltip.Tooltip, { className: 'copy-button__tooltip', content: copied ? 'Copied' : 'Copy', targetRef: buttonRef })] }));
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
exports.CopyButton = CopyButton;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useState } from 'react';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef } from 'react';
|
|
4
4
|
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
5
5
|
import { TextButton } from '../TextButton/TextButton.js';
|
|
6
6
|
import { TypographyButton } from '../TypographyButton/TypographyButton.js';
|
|
@@ -8,16 +8,16 @@ import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
|
8
8
|
|
|
9
9
|
const CopyButton = ({ children, className = '', textToCopy, onClick, variant = 'text', copykey, buttonPadding = 'small', buttonVariant = 'primary', buttonClassName = '', startSlot, disabled, }) => {
|
|
10
10
|
const [copied, setCopied] = useState(false);
|
|
11
|
+
const buttonRef = useRef(null);
|
|
11
12
|
const copyToClipboard = () => {
|
|
12
13
|
navigator.clipboard.writeText(textToCopy);
|
|
13
14
|
setCopied(true);
|
|
14
15
|
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
setCopied(false);
|
|
18
|
+
}, 5000);
|
|
15
19
|
};
|
|
16
|
-
|
|
17
|
-
if (variant === 'text') {
|
|
18
|
-
return (jsx(TextButton, { className: classNames('copy-button__container', className), onClick: () => copyToClipboard(), onMouseLeave: () => setCopied(false), copykey: copykey, disabled: disabled, children: jsx(CopyButtonTooltip, {}) }));
|
|
19
|
-
}
|
|
20
|
-
return (jsx(TypographyButton, { expanded: true, buttonPadding: buttonPadding, buttonVariant: buttonVariant, buttonClassName: buttonClassName, onClick: () => copyToClipboard(), copykey: copykey, startSlot: startSlot, disabled: disabled, children: jsx(CopyButtonTooltip, {}) }));
|
|
20
|
+
return (jsxs(Fragment, { children: [variant === 'text' ? (jsx(TextButton, { className: classNames('copy-button__container', className), onClick: () => copyToClipboard(), onMouseLeave: () => setCopied(false), copykey: copykey, disabled: disabled, children: children })) : (jsx(TypographyButton, { buttonRef: buttonRef, expanded: true, buttonPadding: buttonPadding, buttonVariant: buttonVariant, buttonClassName: buttonClassName, onClick: () => copyToClipboard(), copykey: copykey, startSlot: startSlot, disabled: disabled, children: children })), jsx(Tooltip, { className: 'copy-button__tooltip', content: copied ? 'Copied' : 'Copy', targetRef: buttonRef })] }));
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export { CopyButton };
|
|
@@ -62,6 +62,7 @@ var MenuList = require('../MenuList/MenuList/MenuList.cjs');
|
|
|
62
62
|
require('../Transition/ZoomTransition/ZoomTransition.cjs');
|
|
63
63
|
require('../Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
64
64
|
require('../Transition/OpacityTransition/OpacityTransition.cjs');
|
|
65
|
+
require('../OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
65
66
|
require('../PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
66
67
|
require('../Popper/Popper/Popper.cjs');
|
|
67
68
|
require('../Popper/PopperContext/PopperContext.cjs');
|
|
@@ -79,7 +80,6 @@ require('@hcaptcha/react-hcaptcha');
|
|
|
79
80
|
require('../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
80
81
|
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
81
82
|
require('../../store/state/sendBalances.cjs');
|
|
82
|
-
require('../OverlayCard/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
83
83
|
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
84
84
|
require('../../views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs');
|
|
85
85
|
require('../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
@@ -58,6 +58,7 @@ import { MenuList } from '../MenuList/MenuList/MenuList.js';
|
|
|
58
58
|
import '../Transition/ZoomTransition/ZoomTransition.js';
|
|
59
59
|
import '../Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
60
60
|
import '../Transition/OpacityTransition/OpacityTransition.js';
|
|
61
|
+
import '../OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
61
62
|
import '../PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
62
63
|
import '../Popper/Popper/Popper.js';
|
|
63
64
|
import '../Popper/PopperContext/PopperContext.js';
|
|
@@ -75,7 +76,6 @@ import '@hcaptcha/react-hcaptcha';
|
|
|
75
76
|
import '../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
76
77
|
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
77
78
|
import '../../store/state/sendBalances.js';
|
|
78
|
-
import '../OverlayCard/OverlayCardTarget/OverlayCardTarget.js';
|
|
79
79
|
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
80
80
|
import '../../views/TransactionConfirmationView/helpers/transactionErrorMessage.js';
|
|
81
81
|
import '../../widgets/DynamicWidget/views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
@@ -86,21 +86,37 @@ require('../../../index.cjs');
|
|
|
86
86
|
require('../../store/state/tokenBalances.cjs');
|
|
87
87
|
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
/** Map from useHover React handlers to JS ones */
|
|
90
|
+
const handlerMapping = {
|
|
91
|
+
onMouseDown: 'mousedown',
|
|
92
|
+
onMouseEnter: 'mouseenter',
|
|
93
|
+
onMouseLeave: 'mouseleave',
|
|
94
|
+
onMouseUp: 'mouseup',
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Sets up a Tooltip that appears on hover
|
|
98
|
+
*
|
|
99
|
+
* Note: Prefer to use targetRef instead of nesting children!
|
|
100
|
+
* Children of Tooltip will eventually replace content.
|
|
101
|
+
*/
|
|
102
|
+
const Tooltip = ({ children, content, className, as: Tag = 'span', copykey, targetRef, }) => {
|
|
90
103
|
const { createRootElement } = useElementById.useElementById();
|
|
91
104
|
const portalRoot = createRootElement('dynamic-tooltips');
|
|
92
105
|
const [vector, setVector] = React.useState([0, 0]);
|
|
93
|
-
const childrenRef = React.useRef(null);
|
|
94
106
|
const [visible, setVisible] = React.useState(false);
|
|
107
|
+
/** If targetRef is not set, fall back to this ref */
|
|
108
|
+
const childrenWrapperRef = React.useRef(null);
|
|
109
|
+
/** Centers the tooltip to top-center of the target */
|
|
95
110
|
const calcPosition = React.useCallback(() => {
|
|
96
|
-
|
|
97
|
-
|
|
111
|
+
const ref = targetRef !== null && targetRef !== void 0 ? targetRef : childrenWrapperRef;
|
|
112
|
+
if (ref.current) {
|
|
113
|
+
const childrenBounding = ref.current.getBoundingClientRect();
|
|
98
114
|
setVector([
|
|
99
115
|
childrenBounding.left + childrenBounding.width / 2,
|
|
100
116
|
childrenBounding.top - 6, //add 6px margin over the children
|
|
101
117
|
]);
|
|
102
118
|
}
|
|
103
|
-
}, []);
|
|
119
|
+
}, [targetRef]);
|
|
104
120
|
const [, childrenHoverHandlers] = useHover.useHover({
|
|
105
121
|
falseOnClick: true,
|
|
106
122
|
initialValue: false,
|
|
@@ -123,9 +139,25 @@ const Tooltip = ({ children, content, className, as: Tag = 'span', copykey, }) =
|
|
|
123
139
|
window.removeEventListener('resize', resizeListener);
|
|
124
140
|
};
|
|
125
141
|
}, [calcPosition]);
|
|
142
|
+
// Set handlers manually
|
|
143
|
+
React.useEffect(() => {
|
|
144
|
+
var _a;
|
|
145
|
+
const element = (_a = targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) !== null && _a !== void 0 ? _a : childrenWrapperRef.current;
|
|
146
|
+
if (element) {
|
|
147
|
+
for (const handler in childrenHoverHandlers) {
|
|
148
|
+
element.addEventListener(handlerMapping[handler], childrenHoverHandlers[handler]);
|
|
149
|
+
}
|
|
150
|
+
return () => {
|
|
151
|
+
for (const handler in childrenHoverHandlers) {
|
|
152
|
+
element.removeEventListener(handlerMapping[handler], childrenHoverHandlers[handler]);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return undefined;
|
|
157
|
+
}, [targetRef, childrenHoverHandlers]);
|
|
126
158
|
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [reactDom.createPortal(jsxRuntime.jsx(ShadowDOM.ShadowDOM, { zIndex: index.tooltipZIndex, children: jsxRuntime.jsxs("div", { "data-testid": 'dynamicTooltip', className: classNames.classNames('dynamic-tooltip', {
|
|
127
159
|
'dynamic-tooltip--visible': visible,
|
|
128
|
-
}, className), style: { left: vector[0], top: vector[1] }, copykey: copykey, children: [content, jsxRuntime.jsx(tooltipArrow.ReactComponent, { className: 'dynamic-tooltip__arrow' })] }) }), portalRoot.current), jsxRuntime.jsx(Tag,
|
|
160
|
+
}, className), style: { left: vector[0], top: vector[1] }, copykey: copykey, children: [content, jsxRuntime.jsx(tooltipArrow.ReactComponent, { className: 'dynamic-tooltip__arrow' })] }) }), portalRoot.current), targetRef === undefined && (jsxRuntime.jsx(Tag, { ref: childrenWrapperRef, children: children }))] }));
|
|
129
161
|
};
|
|
130
162
|
|
|
131
163
|
exports.Tooltip = Tooltip;
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
-
import { FC, PropsWithChildren, ReactElement, ElementType } from 'react';
|
|
1
|
+
import { FC, PropsWithChildren, ReactElement, ElementType, RefObject } from 'react';
|
|
2
2
|
import { CopyKey } from '../../shared';
|
|
3
3
|
export type TooltipProps = {
|
|
4
|
+
/** DEPRECATED: Generate an element to use as a wrapper for children */
|
|
4
5
|
as?: ElementType;
|
|
6
|
+
/** Classnames string */
|
|
5
7
|
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Content rendered inside the Tooltip
|
|
10
|
+
*
|
|
11
|
+
* Note that this will eventually be replaced by children
|
|
12
|
+
*/
|
|
6
13
|
content: string | ReactElement;
|
|
14
|
+
/** If set, use this element as the ref instead */
|
|
15
|
+
targetRef?: RefObject<HTMLElement>;
|
|
7
16
|
} & CopyKey;
|
|
17
|
+
/**
|
|
18
|
+
* Sets up a Tooltip that appears on hover
|
|
19
|
+
*
|
|
20
|
+
* Note: Prefer to use targetRef instead of nesting children!
|
|
21
|
+
* Children of Tooltip will eventually replace content.
|
|
22
|
+
*/
|
|
8
23
|
export declare const Tooltip: FC<PropsWithChildren<TooltipProps>>;
|
|
@@ -82,21 +82,37 @@ import '../../../index.js';
|
|
|
82
82
|
import '../../store/state/tokenBalances.js';
|
|
83
83
|
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
/** Map from useHover React handlers to JS ones */
|
|
86
|
+
const handlerMapping = {
|
|
87
|
+
onMouseDown: 'mousedown',
|
|
88
|
+
onMouseEnter: 'mouseenter',
|
|
89
|
+
onMouseLeave: 'mouseleave',
|
|
90
|
+
onMouseUp: 'mouseup',
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Sets up a Tooltip that appears on hover
|
|
94
|
+
*
|
|
95
|
+
* Note: Prefer to use targetRef instead of nesting children!
|
|
96
|
+
* Children of Tooltip will eventually replace content.
|
|
97
|
+
*/
|
|
98
|
+
const Tooltip = ({ children, content, className, as: Tag = 'span', copykey, targetRef, }) => {
|
|
86
99
|
const { createRootElement } = useElementById();
|
|
87
100
|
const portalRoot = createRootElement('dynamic-tooltips');
|
|
88
101
|
const [vector, setVector] = useState([0, 0]);
|
|
89
|
-
const childrenRef = useRef(null);
|
|
90
102
|
const [visible, setVisible] = useState(false);
|
|
103
|
+
/** If targetRef is not set, fall back to this ref */
|
|
104
|
+
const childrenWrapperRef = useRef(null);
|
|
105
|
+
/** Centers the tooltip to top-center of the target */
|
|
91
106
|
const calcPosition = useCallback(() => {
|
|
92
|
-
|
|
93
|
-
|
|
107
|
+
const ref = targetRef !== null && targetRef !== void 0 ? targetRef : childrenWrapperRef;
|
|
108
|
+
if (ref.current) {
|
|
109
|
+
const childrenBounding = ref.current.getBoundingClientRect();
|
|
94
110
|
setVector([
|
|
95
111
|
childrenBounding.left + childrenBounding.width / 2,
|
|
96
112
|
childrenBounding.top - 6, //add 6px margin over the children
|
|
97
113
|
]);
|
|
98
114
|
}
|
|
99
|
-
}, []);
|
|
115
|
+
}, [targetRef]);
|
|
100
116
|
const [, childrenHoverHandlers] = useHover({
|
|
101
117
|
falseOnClick: true,
|
|
102
118
|
initialValue: false,
|
|
@@ -119,9 +135,25 @@ const Tooltip = ({ children, content, className, as: Tag = 'span', copykey, }) =
|
|
|
119
135
|
window.removeEventListener('resize', resizeListener);
|
|
120
136
|
};
|
|
121
137
|
}, [calcPosition]);
|
|
138
|
+
// Set handlers manually
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
var _a;
|
|
141
|
+
const element = (_a = targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) !== null && _a !== void 0 ? _a : childrenWrapperRef.current;
|
|
142
|
+
if (element) {
|
|
143
|
+
for (const handler in childrenHoverHandlers) {
|
|
144
|
+
element.addEventListener(handlerMapping[handler], childrenHoverHandlers[handler]);
|
|
145
|
+
}
|
|
146
|
+
return () => {
|
|
147
|
+
for (const handler in childrenHoverHandlers) {
|
|
148
|
+
element.removeEventListener(handlerMapping[handler], childrenHoverHandlers[handler]);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return undefined;
|
|
153
|
+
}, [targetRef, childrenHoverHandlers]);
|
|
122
154
|
return (jsxs(Fragment, { children: [createPortal(jsx(ShadowDOM, { zIndex: tooltipZIndex, children: jsxs("div", { "data-testid": 'dynamicTooltip', className: classNames('dynamic-tooltip', {
|
|
123
155
|
'dynamic-tooltip--visible': visible,
|
|
124
|
-
}, className), style: { left: vector[0], top: vector[1] }, copykey: copykey, children: [content, jsx(SvgTooltipArrow, { className: 'dynamic-tooltip__arrow' })] }) }), portalRoot.current), jsx(Tag,
|
|
156
|
+
}, className), style: { left: vector[0], top: vector[1] }, copykey: copykey, children: [content, jsx(SvgTooltipArrow, { className: 'dynamic-tooltip__arrow' })] }) }), portalRoot.current), targetRef === undefined && (jsx(Tag, { ref: childrenWrapperRef, children: children }))] }));
|
|
125
157
|
};
|
|
126
158
|
|
|
127
159
|
export { Tooltip };
|
|
@@ -33,6 +33,7 @@ export * from './ModalCard';
|
|
|
33
33
|
export * from './ModalHeader';
|
|
34
34
|
export * from './ModalHeaderBanner';
|
|
35
35
|
export * from './NeedHelpSection';
|
|
36
|
+
export * from './OverlayCard';
|
|
36
37
|
export * from './OTPVerificationView';
|
|
37
38
|
export * from './PasskeyCreatedSuccessBanner';
|
|
38
39
|
export * from './PhoneNumberField';
|
|
@@ -36,12 +36,42 @@ const translation = {
|
|
|
36
36
|
testnet_warning: 'A testnet network has been selected. Please only use testnet funds or they will be lost.',
|
|
37
37
|
ordinals_address: 'Ordinals address',
|
|
38
38
|
payment_address: 'Payment address',
|
|
39
|
-
|
|
39
|
+
balance: 'Balance',
|
|
40
|
+
options: {
|
|
41
|
+
copy_ens: 'Copy ENS',
|
|
42
|
+
view_address: 'View address',
|
|
43
|
+
settings: 'Wallet settings',
|
|
44
|
+
export: 'Export private keys',
|
|
45
|
+
},
|
|
46
|
+
}
|
|
40
47
|
*/
|
|
41
48
|
dyn_active_wallet_info: {
|
|
42
49
|
testnet_warning: 'A testnet network has been selected. Please only use testnet funds or they will be lost.',
|
|
43
50
|
ordinals_address: 'Ordinals address',
|
|
44
51
|
payment_address: 'Payment address',
|
|
52
|
+
balance: 'Balance',
|
|
53
|
+
options: {
|
|
54
|
+
copy_ens: 'Copy ENS',
|
|
55
|
+
view_address: 'View address',
|
|
56
|
+
settings: 'Wallet settings',
|
|
57
|
+
export: 'Export private keys',
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* @description copy keys for wallet details card
|
|
62
|
+
* @default
|
|
63
|
+
* {
|
|
64
|
+
header: 'Wallet Details',
|
|
65
|
+
address: 'Address',
|
|
66
|
+
copy: 'Copy',
|
|
67
|
+
copied: 'Copied!',
|
|
68
|
+
}
|
|
69
|
+
*/
|
|
70
|
+
dyn_wallet_details_card: {
|
|
71
|
+
header: 'Wallet Details',
|
|
72
|
+
address: 'Address',
|
|
73
|
+
copy: 'Copy',
|
|
74
|
+
copied: 'Copied!',
|
|
45
75
|
},
|
|
46
76
|
/**
|
|
47
77
|
* @description copy keys for add network view
|
|
@@ -30,12 +30,42 @@ export declare const translation: {
|
|
|
30
30
|
testnet_warning: 'A testnet network has been selected. Please only use testnet funds or they will be lost.',
|
|
31
31
|
ordinals_address: 'Ordinals address',
|
|
32
32
|
payment_address: 'Payment address',
|
|
33
|
-
|
|
33
|
+
balance: 'Balance',
|
|
34
|
+
options: {
|
|
35
|
+
copy_ens: 'Copy ENS',
|
|
36
|
+
view_address: 'View address',
|
|
37
|
+
settings: 'Wallet settings',
|
|
38
|
+
export: 'Export private keys',
|
|
39
|
+
},
|
|
40
|
+
}
|
|
34
41
|
*/
|
|
35
42
|
dyn_active_wallet_info: {
|
|
36
43
|
testnet_warning: string;
|
|
37
44
|
ordinals_address: string;
|
|
38
45
|
payment_address: string;
|
|
46
|
+
balance: string;
|
|
47
|
+
options: {
|
|
48
|
+
copy_ens: string;
|
|
49
|
+
view_address: string;
|
|
50
|
+
settings: string;
|
|
51
|
+
export: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* @description copy keys for wallet details card
|
|
56
|
+
* @default
|
|
57
|
+
* {
|
|
58
|
+
header: 'Wallet Details',
|
|
59
|
+
address: 'Address',
|
|
60
|
+
copy: 'Copy',
|
|
61
|
+
copied: 'Copied!',
|
|
62
|
+
}
|
|
63
|
+
*/
|
|
64
|
+
dyn_wallet_details_card: {
|
|
65
|
+
header: string;
|
|
66
|
+
address: string;
|
|
67
|
+
copy: string;
|
|
68
|
+
copied: string;
|
|
39
69
|
};
|
|
40
70
|
/**
|
|
41
71
|
* @description copy keys for add network view
|
|
@@ -32,12 +32,42 @@ const translation = {
|
|
|
32
32
|
testnet_warning: 'A testnet network has been selected. Please only use testnet funds or they will be lost.',
|
|
33
33
|
ordinals_address: 'Ordinals address',
|
|
34
34
|
payment_address: 'Payment address',
|
|
35
|
-
|
|
35
|
+
balance: 'Balance',
|
|
36
|
+
options: {
|
|
37
|
+
copy_ens: 'Copy ENS',
|
|
38
|
+
view_address: 'View address',
|
|
39
|
+
settings: 'Wallet settings',
|
|
40
|
+
export: 'Export private keys',
|
|
41
|
+
},
|
|
42
|
+
}
|
|
36
43
|
*/
|
|
37
44
|
dyn_active_wallet_info: {
|
|
38
45
|
testnet_warning: 'A testnet network has been selected. Please only use testnet funds or they will be lost.',
|
|
39
46
|
ordinals_address: 'Ordinals address',
|
|
40
47
|
payment_address: 'Payment address',
|
|
48
|
+
balance: 'Balance',
|
|
49
|
+
options: {
|
|
50
|
+
copy_ens: 'Copy ENS',
|
|
51
|
+
view_address: 'View address',
|
|
52
|
+
settings: 'Wallet settings',
|
|
53
|
+
export: 'Export private keys',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* @description copy keys for wallet details card
|
|
58
|
+
* @default
|
|
59
|
+
* {
|
|
60
|
+
header: 'Wallet Details',
|
|
61
|
+
address: 'Address',
|
|
62
|
+
copy: 'Copy',
|
|
63
|
+
copied: 'Copied!',
|
|
64
|
+
}
|
|
65
|
+
*/
|
|
66
|
+
dyn_wallet_details_card: {
|
|
67
|
+
header: 'Wallet Details',
|
|
68
|
+
address: 'Address',
|
|
69
|
+
copy: 'Copy',
|
|
70
|
+
copied: 'Copied!',
|
|
41
71
|
},
|
|
42
72
|
/**
|
|
43
73
|
* @description copy keys for add network view
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var React = require('react');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n["default"] = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
|
+
|
|
28
|
+
var _path;
|
|
29
|
+
var _excluded = ["title", "titleId"];
|
|
30
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
31
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
32
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
33
|
+
var SvgEyeOutline = function SvgEyeOutline(_ref) {
|
|
34
|
+
var title = _ref.title,
|
|
35
|
+
titleId = _ref.titleId,
|
|
36
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
38
|
+
width: 24,
|
|
39
|
+
height: 24,
|
|
40
|
+
viewBox: "0 0 24 24",
|
|
41
|
+
fill: "none",
|
|
42
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
43
|
+
"aria-labelledby": titleId
|
|
44
|
+
}, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
|
|
45
|
+
id: titleId
|
|
46
|
+
}, title) : null, _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
47
|
+
fillRule: "evenodd",
|
|
48
|
+
clipRule: "evenodd",
|
|
49
|
+
d: "M3.512 12a9.004 9.004 0 0 0 16.977 0 9.004 9.004 0 0 0-16.977 0Zm-2.008-.3C2.906 7.238 7.074 4 12 4c4.927 0 9.095 3.238 10.497 7.7a1 1 0 0 1 0 .6C21.095 16.762 16.927 20 12 20c-4.927 0-9.095-3.238-10.497-7.7a1 1 0 0 1 0-.6ZM12 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z",
|
|
50
|
+
fill: "#ABACB2"
|
|
51
|
+
})));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
exports.ReactComponent = SvgEyeOutline;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
var _path;
|
|
5
|
+
var _excluded = ["title", "titleId"];
|
|
6
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
7
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
|
+
var SvgEyeOutline = function SvgEyeOutline(_ref) {
|
|
10
|
+
var title = _ref.title,
|
|
11
|
+
titleId = _ref.titleId,
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
14
|
+
width: 24,
|
|
15
|
+
height: 24,
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
fill: "none",
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19
|
+
"aria-labelledby": titleId
|
|
20
|
+
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
|
21
|
+
id: titleId
|
|
22
|
+
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
fillRule: "evenodd",
|
|
24
|
+
clipRule: "evenodd",
|
|
25
|
+
d: "M3.512 12a9.004 9.004 0 0 0 16.977 0 9.004 9.004 0 0 0-16.977 0Zm-2.008-.3C2.906 7.238 7.074 4 12 4c4.927 0 9.095 3.238 10.497 7.7a1 1 0 0 1 0 .6C21.095 16.762 16.927 20 12 20c-4.927 0-9.095-3.238-10.497-7.7a1 1 0 0 1 0-.6ZM12 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z",
|
|
26
|
+
fill: "#ABACB2"
|
|
27
|
+
})));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { SvgEyeOutline as ReactComponent };
|
|
@@ -36,6 +36,7 @@ export { ReactComponent as ExportPrivateKeyIcon } from './export-private-key.svg
|
|
|
36
36
|
export { ReactComponent as ExportRecoveryPhraseIcon } from './export-recovery-phrase.svg';
|
|
37
37
|
export { ReactComponent as ExternalLinkIcon } from './externalLink.svg';
|
|
38
38
|
export { ReactComponent as EyeOffIcon } from './eye-off-icon.svg';
|
|
39
|
+
export { ReactComponent as EyeOutlineIcon } from './eye-outline.svg';
|
|
39
40
|
export { ReactComponent as ArrowCircleRight } from './arrow-circle-right.svg';
|
|
40
41
|
export { ReactComponent as FaceIdIcon } from './face-id.svg';
|
|
41
42
|
export { ReactComponent as WarningRedIcon } from './warning-red.svg';
|