@xyo-network/react-connected-accounts 3.0.1 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. package/dist/browser/classes/EnabledWallets.d.ts +30 -0
  2. package/dist/browser/classes/EnabledWallets.d.ts.map +1 -0
  3. package/dist/browser/classes/index.d.ts +2 -0
  4. package/dist/browser/classes/index.d.ts.map +1 -0
  5. package/dist/browser/components/ConnectedAccountsFlexbox.d.ts +8 -0
  6. package/dist/browser/components/ConnectedAccountsFlexbox.d.ts.map +1 -0
  7. package/dist/browser/components/index.d.ts +3 -0
  8. package/dist/browser/components/index.d.ts.map +1 -0
  9. package/dist/browser/components/wallet/dialogs/connect/CheckboxFormControl.d.ts +7 -0
  10. package/dist/browser/components/wallet/dialogs/connect/CheckboxFormControl.d.ts.map +1 -0
  11. package/dist/browser/components/wallet/dialogs/connect/Dialog.d.ts +9 -0
  12. package/dist/browser/components/wallet/dialogs/connect/Dialog.d.ts.map +1 -0
  13. package/dist/browser/components/wallet/dialogs/connect/LinkedProvidersFlexbox.d.ts +8 -0
  14. package/dist/browser/components/wallet/dialogs/connect/LinkedProvidersFlexbox.d.ts.map +1 -0
  15. package/dist/browser/components/wallet/dialogs/connect/Permissions.d.ts +6 -0
  16. package/dist/browser/components/wallet/dialogs/connect/Permissions.d.ts.map +1 -0
  17. package/dist/browser/components/wallet/dialogs/connect/index.d.ts +3 -0
  18. package/dist/browser/components/wallet/dialogs/connect/index.d.ts.map +1 -0
  19. package/dist/browser/components/wallet/dialogs/index.d.ts +3 -0
  20. package/dist/browser/components/wallet/dialogs/index.d.ts.map +1 -0
  21. package/dist/browser/components/wallet/dialogs/revoke/Dialog.d.ts +8 -0
  22. package/dist/browser/components/wallet/dialogs/revoke/Dialog.d.ts.map +1 -0
  23. package/dist/browser/components/wallet/dialogs/revoke/index.d.ts +2 -0
  24. package/dist/browser/components/wallet/dialogs/revoke/index.d.ts.map +1 -0
  25. package/dist/browser/components/wallet/index.d.ts +3 -0
  26. package/dist/browser/components/wallet/index.d.ts.map +1 -0
  27. package/dist/browser/components/wallet/lib/ActiveProvider.d.ts +7 -0
  28. package/dist/browser/components/wallet/lib/ActiveProvider.d.ts.map +1 -0
  29. package/dist/browser/components/wallet/lib/TableHeadData.d.ts +3 -0
  30. package/dist/browser/components/wallet/lib/TableHeadData.d.ts.map +1 -0
  31. package/dist/browser/components/wallet/lib/index.d.ts +3 -0
  32. package/dist/browser/components/wallet/lib/index.d.ts.map +1 -0
  33. package/dist/browser/components/wallet/table/ConnectedWalletsTable.d.ts +10 -0
  34. package/dist/browser/components/wallet/table/ConnectedWalletsTable.d.ts.map +1 -0
  35. package/dist/browser/components/wallet/table/ConnectedWalletsTableRow.d.ts +12 -0
  36. package/dist/browser/components/wallet/table/ConnectedWalletsTableRow.d.ts.map +1 -0
  37. package/dist/browser/components/wallet/table/cells/Accounts.d.ts +4 -0
  38. package/dist/browser/components/wallet/table/cells/Accounts.d.ts.map +1 -0
  39. package/dist/browser/components/wallet/table/cells/Actions.d.ts +4 -0
  40. package/dist/browser/components/wallet/table/cells/Actions.d.ts.map +1 -0
  41. package/dist/browser/components/wallet/table/cells/Cells.d.ts +4 -0
  42. package/dist/browser/components/wallet/table/cells/Cells.d.ts.map +1 -0
  43. package/dist/browser/components/wallet/table/cells/ChainName.d.ts +4 -0
  44. package/dist/browser/components/wallet/table/cells/ChainName.d.ts.map +1 -0
  45. package/dist/browser/components/wallet/table/cells/State.d.ts +4 -0
  46. package/dist/browser/components/wallet/table/cells/State.d.ts.map +1 -0
  47. package/dist/browser/components/wallet/table/cells/Wallet.d.ts +4 -0
  48. package/dist/browser/components/wallet/table/cells/Wallet.d.ts.map +1 -0
  49. package/dist/browser/components/wallet/table/cells/index.d.ts +7 -0
  50. package/dist/browser/components/wallet/table/cells/index.d.ts.map +1 -0
  51. package/dist/browser/components/wallet/table/cells/lib/ConnectedWalletTableCellProps.d.ts +15 -0
  52. package/dist/browser/components/wallet/table/cells/lib/ConnectedWalletTableCellProps.d.ts.map +1 -0
  53. package/dist/browser/components/wallet/table/cells/lib/index.d.ts +2 -0
  54. package/dist/browser/components/wallet/table/cells/lib/index.d.ts.map +1 -0
  55. package/dist/browser/components/wallet/table/hooks/index.d.ts +2 -0
  56. package/dist/browser/components/wallet/table/hooks/index.d.ts.map +1 -0
  57. package/dist/browser/components/wallet/table/hooks/useActiveProviderDialogState.d.ts +4 -0
  58. package/dist/browser/components/wallet/table/hooks/useActiveProviderDialogState.d.ts.map +1 -0
  59. package/dist/browser/components/wallet/table/index.d.ts +5 -0
  60. package/dist/browser/components/wallet/table/index.d.ts.map +1 -0
  61. package/dist/browser/hooks/index.d.ts +3 -0
  62. package/dist/browser/hooks/index.d.ts.map +1 -0
  63. package/dist/browser/hooks/useDetectWallets.d.ts +6 -0
  64. package/dist/browser/hooks/useDetectWallets.d.ts.map +1 -0
  65. package/dist/browser/hooks/useEnabledWallets.d.ts +9 -0
  66. package/dist/browser/hooks/useEnabledWallets.d.ts.map +1 -0
  67. package/dist/browser/img/index.d.ts +3 -0
  68. package/dist/browser/img/index.d.ts.map +1 -0
  69. package/dist/browser/index.d.ts +4 -119
  70. package/dist/browser/index.d.ts.map +1 -0
  71. package/dist/browser/index.mjs.map +1 -1
  72. package/package.json +49 -43
  73. package/src/classes/EnabledWallets.ts +1 -1
  74. package/src/components/ConnectedAccountsFlexbox.stories.tsx +2 -4
  75. package/src/components/ConnectedAccountsFlexbox.tsx +5 -2
  76. package/src/components/wallet/dialogs/connect/CheckboxFormControl.tsx +4 -1
  77. package/src/components/wallet/dialogs/connect/Dialog.tsx +16 -5
  78. package/src/components/wallet/dialogs/connect/LinkedProvidersFlexbox.tsx +11 -3
  79. package/src/components/wallet/dialogs/connect/Permissions.tsx +2 -1
  80. package/src/components/wallet/dialogs/revoke/Dialog.tsx +5 -2
  81. package/src/components/wallet/lib/ActiveProvider.ts +1 -1
  82. package/src/components/wallet/lib/TableHeadData.ts +1 -1
  83. package/src/components/wallet/table/ConnectedWalletsTable.tsx +13 -5
  84. package/src/components/wallet/table/ConnectedWalletsTableRow.tsx +13 -5
  85. package/src/components/wallet/table/cells/Accounts.tsx +4 -2
  86. package/src/components/wallet/table/cells/Actions.tsx +7 -3
  87. package/src/components/wallet/table/cells/Cells.tsx +2 -2
  88. package/src/components/wallet/table/cells/ChainName.tsx +1 -1
  89. package/src/components/wallet/table/cells/State.tsx +9 -4
  90. package/src/components/wallet/table/cells/Wallet.tsx +4 -2
  91. package/src/components/wallet/table/cells/lib/ConnectedWalletTableCellProps.tsx +1 -1
  92. package/src/components/wallet/table/hooks/useActiveProviderDialogState.tsx +3 -2
  93. package/src/hooks/useDetectWallets.tsx +6 -2
  94. package/src/hooks/useEnabledWallets.tsx +2 -1
  95. package/xy.config.ts +2 -4
@@ -1,7 +1,9 @@
1
- import { TableCell, Tooltip, Typography } from '@mui/material'
1
+ import {
2
+ TableCell, Tooltip, Typography,
3
+ } from '@mui/material'
2
4
  import React from 'react'
3
5
 
4
- import { ConnectedWalletTableCellProps } from './lib/index.ts'
6
+ import type { ConnectedWalletTableCellProps } from './lib/index.ts'
5
7
 
6
8
  export const ConnectedWalletsAccountsTableCell: React.FC<ConnectedWalletTableCellProps> = ({
7
9
  additionalAccounts,
@@ -1,11 +1,15 @@
1
1
  import { Check, InfoOutlined } from '@mui/icons-material'
2
- import { Button, IconButton, TableCell, Typography } from '@mui/material'
2
+ import {
3
+ Button, IconButton, TableCell, Typography,
4
+ } from '@mui/material'
3
5
  import { FlexRow } from '@xylabs/react-flexbox'
4
6
  import React from 'react'
5
7
 
6
- import { ConnectedWalletTableCellProps } from './lib/index.ts'
8
+ import type { ConnectedWalletTableCellProps } from './lib/index.ts'
7
9
 
8
- export const ConnectedWalletsActionsTableCell: React.FC<ConnectedWalletTableCellProps> = ({ connected, onConnect, onRevoke, tableCellProps }) => {
10
+ export const ConnectedWalletsActionsTableCell: React.FC<ConnectedWalletTableCellProps> = ({
11
+ connected, onConnect, onRevoke, tableCellProps,
12
+ }) => {
9
13
  return (
10
14
  <TableCell {...tableCellProps}>
11
15
  <FlexRow gap={2} justifyContent="start">
@@ -1,9 +1,9 @@
1
- import { ComponentType } from 'react'
1
+ import type { ComponentType } from 'react'
2
2
 
3
3
  import { ConnectedWalletsAccountsTableCell } from './Accounts.tsx'
4
4
  import { ConnectedWalletsActionsTableCell } from './Actions.tsx'
5
5
  import { ConnectedWalletsChainNameTableCell } from './ChainName.tsx'
6
- import { ConnectedWalletTableCellProps } from './lib/index.ts'
6
+ import type { ConnectedWalletTableCellProps } from './lib/index.ts'
7
7
  import { ConnectedWalletState } from './State.tsx'
8
8
  import { ConnectedWalletsWalletTableCell } from './Wallet.tsx'
9
9
 
@@ -1,7 +1,7 @@
1
1
  import { TableCell } from '@mui/material'
2
2
  import React from 'react'
3
3
 
4
- import { ConnectedWalletTableCellProps } from './lib/index.ts'
4
+ import type { ConnectedWalletTableCellProps } from './lib/index.ts'
5
5
 
6
6
  export const ConnectedWalletsChainNameTableCell: React.FC<ConnectedWalletTableCellProps> = ({ chainName, tableCellProps }) => {
7
7
  return <TableCell {...tableCellProps}>{chainName}</TableCell>
@@ -1,11 +1,16 @@
1
1
  import { Switch, TableCell } from '@mui/material'
2
- import React, { ChangeEvent, useMemo } from 'react'
2
+ import type { ChangeEvent } from 'react'
3
+ import React, { useMemo } from 'react'
3
4
 
4
5
  import { useEnabledWallets } from '../../../../hooks/index.ts'
5
- import { ConnectedWalletTableCellProps } from './lib/index.ts'
6
+ import type { ConnectedWalletTableCellProps } from './lib/index.ts'
6
7
 
7
- export const ConnectedWalletState: React.FC<ConnectedWalletTableCellProps> = ({ connected, walletRdns, tableCellProps }) => {
8
- const { disableWallet, enableWallet, wallets } = useEnabledWallets()
8
+ export const ConnectedWalletState: React.FC<ConnectedWalletTableCellProps> = ({
9
+ connected, walletRdns, tableCellProps,
10
+ }) => {
11
+ const {
12
+ disableWallet, enableWallet, wallets,
13
+ } = useEnabledWallets()
9
14
 
10
15
  const enabled = useMemo(() => (walletRdns ? wallets[walletRdns].enabled : false), [wallets, walletRdns])
11
16
 
@@ -3,9 +3,11 @@ import { ConstrainedImage } from '@xylabs/react-crypto'
3
3
  import { FlexRow } from '@xylabs/react-flexbox'
4
4
  import React from 'react'
5
5
 
6
- import { ConnectedWalletTableCellProps } from './lib/index.ts'
6
+ import type { ConnectedWalletTableCellProps } from './lib/index.ts'
7
7
 
8
- export const ConnectedWalletsWalletTableCell: React.FC<ConnectedWalletTableCellProps> = ({ icon, walletName, tableCellProps }) => {
8
+ export const ConnectedWalletsWalletTableCell: React.FC<ConnectedWalletTableCellProps> = ({
9
+ icon, walletName, tableCellProps,
10
+ }) => {
9
11
  const theme = useTheme()
10
12
 
11
13
  return (
@@ -1,4 +1,4 @@
1
- import { TableCellProps } from '@mui/material'
1
+ import type { TableCellProps } from '@mui/material'
2
2
 
3
3
  export interface ConnectedWalletTableCellProps {
4
4
  additionalAccounts?: string[]
@@ -1,6 +1,7 @@
1
- import { Dispatch, SetStateAction, useState } from 'react'
1
+ import type { Dispatch, SetStateAction } from 'react'
2
+ import { useState } from 'react'
2
3
 
3
- import { ActiveProvider } from '../../lib/index.ts'
4
+ import type { ActiveProvider } from '../../lib/index.ts'
4
5
 
5
6
  export const useActiveProviderDialogState = (
6
7
  setActiveProvider: Dispatch<SetStateAction<ActiveProvider | undefined>>,
@@ -1,5 +1,8 @@
1
- import { AccountsChangedEventName, DiscoveredWallets, EIP6963Connector, useWalletDiscovery } from '@xylabs/react-crypto'
2
- import { useEffect, useMemo, useState } from 'react'
1
+ import type { DiscoveredWallets, EIP6963Connector } from '@xylabs/react-crypto'
2
+ import { AccountsChangedEventName, useWalletDiscovery } from '@xylabs/react-crypto'
3
+ import {
4
+ useEffect, useMemo, useState,
5
+ } from 'react'
3
6
 
4
7
  const sortWallets = (wallets: DiscoveredWallets) =>
5
8
  // eslint-disable-next-line unicorn/no-array-reduce
@@ -26,6 +29,7 @@ export const useDetectedWallets = () => {
26
29
  const listener: (event: CustomEventInit) => void = () => {
27
30
  setRefresh(refresh => refresh + 1)
28
31
  }
32
+ // eslint-disable-next-line @eslint-react/web-api/no-leaked-event-listener
29
33
  window.addEventListener(AccountsChangedEventName, listener)
30
34
 
31
35
  return () => {
@@ -1,7 +1,8 @@
1
1
  import { useWalletDiscovery } from '@xylabs/react-crypto'
2
2
  import { useMemo, useSyncExternalStore } from 'react'
3
3
 
4
- import { EnabledEthWalletConnections, EnabledEthWalletsState, EnabledWalletsSavedState } from '../classes/index.ts'
4
+ import type { EnabledEthWalletsState, EnabledWalletsSavedState } from '../classes/index.ts'
5
+ import { EnabledEthWalletConnections } from '../classes/index.ts'
5
6
 
6
7
  let enabledEthWallets: EnabledEthWalletConnections | undefined
7
8
 
package/xy.config.ts CHANGED
@@ -1,9 +1,7 @@
1
- import { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
1
+ import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
2
  const config: XyTsupConfig = {
3
3
  compile: {
4
- browser: {
5
- src: true,
6
- },
4
+ browser: { src: true },
7
5
  node: {},
8
6
  neutral: {},
9
7
  },