@ckb-ccc/connector-react 0.0.4-alpha.8 → 0.0.4-alpha.9

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.
@@ -1,8 +1,8 @@
1
1
  import { ccc } from "@ckb-ccc/connector";
2
- import * as React from "react";
3
- import { ReactNode } from "react";
4
- export declare function Provider({ children }: {
5
- children: ReactNode;
2
+ import React from "react";
3
+ export declare function Provider({ children, connectorProps, }: {
4
+ children: React.ReactNode;
5
+ connectorProps?: React.HTMLAttributes<{}>;
6
6
  }): React.JSX.Element;
7
7
  export declare function useCcc(): {
8
8
  open: () => unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"useCcc.d.ts","sourceRoot":"","sources":["../../src/hooks/useCcc.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAA2B,MAAM,OAAO,CAAC;AAe3D,wBAAgB,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,qBAgD7D;AAED,wBAAgB,MAAM;;;;;;EAErB"}
1
+ {"version":3,"file":"useCcc.d.ts","sourceRoot":"","sources":["../../src/hooks/useCcc.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACzC,OAAO,KAAkC,MAAM,OAAO,CAAC;AAevD,wBAAgB,QAAQ,CAAC,EACvB,QAAQ,EACR,cAAc,GACf,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,cAAc,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;CAC3C,qBAuDA;AAED,wBAAgB,MAAM;;;;;;EAErB"}
@@ -1,13 +1,12 @@
1
1
  import { ccc } from "@ckb-ccc/connector";
2
- import * as React from "react";
3
- import { createContext, useState } from "react";
2
+ import React, { createContext, useState } from "react";
4
3
  import { Connector } from "../components";
5
4
  const CCC_CONTEXT = createContext({
6
5
  open: () => { },
7
6
  disconnect: () => { },
8
7
  status: ccc.ConnectorStatus.SelectingSigner,
9
8
  });
10
- export function Provider({ children }) {
9
+ export function Provider({ children, connectorProps, }) {
11
10
  const [isOpen, setIsOpen] = useState(false);
12
11
  const [wallet, setWallet] = useState();
13
12
  const [signerInfo, setSignerInfo] = useState();
@@ -36,7 +35,11 @@ export function Provider({ children }) {
36
35
  React.createElement(Connector, { isOpen: isOpen, wallet: wallet, signer: signerInfo, status: status, onClose: () => setIsOpen(false), onSignerChanged: ({ wallet, signerInfo }) => {
37
36
  setWallet(wallet);
38
37
  setSignerInfo(signerInfo);
39
- }, onStatusChanged: ({ status }) => setStatus(status) }),
38
+ }, onStatusChanged: ({ status }) => setStatus(status), ...connectorProps,
39
+ style: {
40
+ ...connectorProps?.style,
41
+ zIndex: connectorProps?.style?.zIndex ?? 999,
42
+ } }),
40
43
  children));
41
44
  }
42
45
  export function useCcc() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckb-ccc/connector-react",
3
- "version": "0.0.4-alpha.8",
3
+ "version": "0.0.4-alpha.9",
4
4
  "description": "Common Chains Connector UI Component for React",
5
5
  "author": "Hanssen0 <hanssen0@hanssen0.com>",
6
6
  "license": "MIT",
@@ -42,5 +42,5 @@
42
42
  "@lit/react": "^1.0.5",
43
43
  "react": "^18"
44
44
  },
45
- "gitHead": "98556e415832a41aeedb467e8a72b8861fe6a32d"
45
+ "gitHead": "89ce073e2a1033f3044776863787711f14bec596"
46
46
  }
@@ -1,6 +1,5 @@
1
1
  import { ccc } from "@ckb-ccc/connector";
2
- import * as React from "react";
3
- import { ReactNode, createContext, useState } from "react";
2
+ import React, { createContext, useState } from "react";
4
3
  import { Connector } from "../components";
5
4
 
6
5
  const CCC_CONTEXT = createContext<{
@@ -15,7 +14,13 @@ const CCC_CONTEXT = createContext<{
15
14
  status: ccc.ConnectorStatus.SelectingSigner,
16
15
  });
17
16
 
18
- export function Provider({ children }: { children: ReactNode }) {
17
+ export function Provider({
18
+ children,
19
+ connectorProps,
20
+ }: {
21
+ children: React.ReactNode;
22
+ connectorProps?: React.HTMLAttributes<{}>;
23
+ }) {
19
24
  const [isOpen, setIsOpen] = useState(false);
20
25
  const [wallet, setWallet] = useState<ccc.Wallet | undefined>();
21
26
  const [signerInfo, setSignerInfo] = useState<ccc.SignerInfo | undefined>();
@@ -59,6 +64,13 @@ export function Provider({ children }: { children: ReactNode }) {
59
64
  setSignerInfo(signerInfo);
60
65
  }}
61
66
  onStatusChanged={({ status }) => setStatus(status)}
67
+ {...{
68
+ ...connectorProps,
69
+ style: {
70
+ ...connectorProps?.style,
71
+ zIndex: connectorProps?.style?.zIndex ?? 999,
72
+ },
73
+ }}
62
74
  />
63
75
  {children}
64
76
  </CCC_CONTEXT.Provider>