@mezo-org/passport 0.4.0-dev.12 → 0.4.0-dev.14
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/dist/src/components/Dropdown/ConnectedTrigger.d.ts +2 -1
- package/dist/src/components/Dropdown/ConnectedTrigger.d.ts.map +1 -1
- package/dist/src/components/Dropdown/ConnectedTrigger.js +29 -20
- package/dist/src/components/Dropdown/ConnectedTrigger.js.map +1 -1
- package/dist/src/components/Dropdown/Dropdown.d.ts +8 -1
- package/dist/src/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/src/components/Dropdown/Dropdown.js +3 -3
- package/dist/src/components/Dropdown/Dropdown.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Dropdown/ConnectedTrigger.tsx +52 -32
- package/src/components/Dropdown/Dropdown.tsx +14 -1
- package/src/components/Dropdown/README.md +4 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ButtonProps } from "@mezo-org/mezo-clay";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
|
-
declare const ConnectedTrigger: React.ForwardRefExoticComponent<Omit<ButtonProps, "children"> & {
|
|
3
|
+
declare const ConnectedTrigger: React.ForwardRefExoticComponent<Omit<ButtonProps, "size" | "children"> & {
|
|
4
4
|
avatar: ReactNode;
|
|
5
|
+
size?: "medium" | "large";
|
|
5
6
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
6
7
|
export default ConnectedTrigger;
|
|
7
8
|
//# sourceMappingURL=ConnectedTrigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectedTrigger.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/ConnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ConnectedTrigger.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/ConnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAgB,MAAM,qBAAqB,CAAA;AAC9E,OAAO,KAAK,EAAE,EAAc,SAAS,EAAW,MAAM,OAAO,CAAA;AAO7D,QAAA,MAAM,gBAAgB;YAJZ,SAAS;WACV,QAAQ,GAAG,OAAO;2CAoE1B,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -1,30 +1,39 @@
|
|
|
1
|
-
import { Block, useStyletron } from "@mezo-org/mezo-clay";
|
|
2
|
-
import React, { forwardRef } from "react";
|
|
1
|
+
import { Block, Button, useStyletron } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { forwardRef, useMemo } from "react";
|
|
3
3
|
const ConnectedTrigger = forwardRef((props, ref) => {
|
|
4
|
-
const { onClick, avatar, ...restProps } = props;
|
|
4
|
+
const { onClick, avatar, size = "medium", ...restProps } = props;
|
|
5
5
|
const [, theme] = useStyletron();
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const avatarSize = useMemo(() => {
|
|
7
|
+
const sizeMap = {
|
|
8
|
+
medium: theme.sizing.scale950,
|
|
9
|
+
large: theme.sizing.scale1400,
|
|
10
|
+
};
|
|
11
|
+
return sizeMap[size];
|
|
12
|
+
}, [theme, size]);
|
|
13
|
+
const buttonPadding = useMemo(() => {
|
|
14
|
+
const paddingMap = {
|
|
15
|
+
medium: theme.sizing.scale0,
|
|
16
|
+
large: theme.sizing.scale100,
|
|
17
|
+
};
|
|
18
|
+
return paddingMap[size];
|
|
19
|
+
}, [theme, size]);
|
|
20
|
+
return (React.createElement(Button, { overrides: {
|
|
21
|
+
BaseButton: {
|
|
8
22
|
props: { ref, ...restProps },
|
|
9
23
|
style: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
padding:
|
|
13
|
-
margin: 0,
|
|
14
|
-
cursor: "pointer",
|
|
24
|
+
borderRadius: "100%",
|
|
25
|
+
overflow: "hidden",
|
|
26
|
+
padding: buttonPadding,
|
|
15
27
|
},
|
|
16
28
|
},
|
|
17
|
-
}, onClick: onClick },
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
border: `2px solid ${theme.colors.contentPrimary}`,
|
|
23
|
-
boxSizing: "border-box",
|
|
24
|
-
overflow: "hidden",
|
|
25
|
-
},
|
|
29
|
+
}, onClick: onClick }, typeof avatar === "string" ? (React.createElement(Block, { width: avatarSize, height: avatarSize, as: "img", src: avatar, alt: "" })) : (React.createElement(Block, { width: avatarSize, height: avatarSize, overrides: {
|
|
30
|
+
Block: {
|
|
31
|
+
style: {
|
|
32
|
+
borderRadius: "100%",
|
|
33
|
+
overflow: "hidden",
|
|
26
34
|
},
|
|
27
|
-
}
|
|
35
|
+
},
|
|
36
|
+
} }, avatar))));
|
|
28
37
|
});
|
|
29
38
|
export default ConnectedTrigger;
|
|
30
39
|
//# sourceMappingURL=ConnectedTrigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectedTrigger.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/ConnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"ConnectedTrigger.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/ConnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,KAAK,EAAE,EAAE,UAAU,EAAa,OAAO,EAAE,MAAM,OAAO,CAAA;AAO7D,MAAM,gBAAgB,GAAG,UAAU,CACjC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAA;IAEhE,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,YAAY,EAAE,CAAA;IAEhC,MAAM,UAAU,GAAG,OAAO,C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AAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StatefulPopoverProps } from "@mezo-org/mezo-clay";
|
|
1
|
+
import { ButtonProps, StatefulPopoverProps } from "@mezo-org/mezo-clay";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { DropdownCryptoAsset } from "../../hooks/useDropdownData";
|
|
4
4
|
export type DropdownProps = {
|
|
@@ -10,6 +10,13 @@ export type DropdownProps = {
|
|
|
10
10
|
evmNativeAssets?: DropdownCryptoAsset<"tbtc" | "wbtc">[];
|
|
11
11
|
/** The set of Matsnet assets to be displayed in the dropdown */
|
|
12
12
|
matsnetAssets?: DropdownCryptoAsset<"mbtc" | "musd">[];
|
|
13
|
+
/** The props to be passed to the trigger button */
|
|
14
|
+
triggerProps?: {
|
|
15
|
+
signedIn?: Omit<ButtonProps, "onClick" | "size"> & {
|
|
16
|
+
size: "medium" | "large";
|
|
17
|
+
};
|
|
18
|
+
signedOut?: Omit<ButtonProps, "onClick">;
|
|
19
|
+
};
|
|
13
20
|
} & Omit<StatefulPopoverProps, "children" | "content">;
|
|
14
21
|
/**
|
|
15
22
|
* Passport Dropdown component that displays user's wallet and assets information.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,oBAAoB,EAErB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAoB,MAAM,OAAO,CAAA;AAGxC,OAAwB,EACtB,mBAAmB,EACpB,MAAM,6BAA6B,CAAA;AAOpC,MAAM,MAAM,aAAa,GAAG;IAC1B,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,mEAAmE;IACnE,eAAe,CAAC,EAAE,mBAAmB,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACxD,gEAAgE;IAChE,aAAa,CAAC,EAAE,mBAAmB,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACtD,mDAAmD;IACnD,YAAY,CAAC,EAAE;QACb,QAAQ,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,GAAG;YACjD,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAA;SACzB,CAAA;QACD,SAAS,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;KACzC,CAAA;CACF,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,SAAS,CAAC,CAAA;AAEtD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,qBAiF5C"}
|
|
@@ -15,7 +15,7 @@ import { useSignInWithWallet } from "../../hooks";
|
|
|
15
15
|
* @returns {JSX.Element}
|
|
16
16
|
*/
|
|
17
17
|
export function Dropdown(props) {
|
|
18
|
-
const { placement = "bottomRight", animateOutTime = 120, onSignIn, onSignOut, evmNativeAssets, matsnetAssets, overrides, ...restProps } = props;
|
|
18
|
+
const { placement = "bottomRight", animateOutTime = 120, onSignIn, onSignOut, evmNativeAssets, matsnetAssets, overrides, triggerProps, ...restProps } = props;
|
|
19
19
|
const [, theme] = useStyletron();
|
|
20
20
|
const dropdownData = useDropdownData({ evmNativeAssets, matsnetAssets });
|
|
21
21
|
const { openConnectModal } = useConnectModal();
|
|
@@ -44,7 +44,7 @@ export function Dropdown(props) {
|
|
|
44
44
|
, {
|
|
45
45
|
// If connect wallet flow is not provided it fallbacks to RainbowKit's
|
|
46
46
|
// connect modal
|
|
47
|
-
onClick: onSignIn || openConnectModal, isLoading: isPending }, "Sign in"));
|
|
47
|
+
onClick: onSignIn || openConnectModal, isLoading: isPending, ...triggerProps?.signedOut }, "Sign in"));
|
|
48
48
|
}
|
|
49
49
|
return (React.createElement(StatefulPopover, { content: React.createElement(Content, { data: dropdownData, onSignOut: onSignOut }), placement: placement, animateOutTime: animateOutTime, overrides: {
|
|
50
50
|
...overrides,
|
|
@@ -59,6 +59,6 @@ export function Dropdown(props) {
|
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
61
|
}, ...restProps },
|
|
62
|
-
React.createElement(ConnectedTrigger, { avatar: React.createElement(DefaultAvatar, null) })));
|
|
62
|
+
React.createElement(ConnectedTrigger, { avatar: React.createElement(DefaultAvatar, null), ...triggerProps?.signedIn })));
|
|
63
63
|
}
|
|
64
64
|
//# sourceMappingURL=Dropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Dropdown.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEf,YAAY,GACb,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,aAAa,MAAM,4BAA4B,CAAA;AACtD,OAAO,eAEN,MAAM,6BAA6B,CAAA;AACpC,OAAO,gBAAgB,MAAM,8BAA8B,CAAA;AAC3D,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,OAAO,MAAM,WAAW,CAAA;AAC/B,OAAO,mBAAmB,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAoBj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,SAAS,cAGP,CACvB,CAAA;IACH,CAAC;IAED,OAAO,CACL,oBAAC,eAAe,IACd,OAAO,EAAE,oBAAC,OAAO,IAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,GAAI,EAC9D,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE;YACT,GAAG,SAAS;YACZ,IAAI,EAAE;gBACJ,GAAG,SAAS,EAAE,IAAI;gBAClB,KAAK,EAAE;oBACL,QAAQ,EAAE,OAAO;oBACjB,YAAY,EAAE,KAAK,CAAC,OAAO,CAAC,SAAS;oBACrC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,SAAS;oBACnC,QAAQ,EAAE,QAAQ;oBAClB,GAAG,SAAS,EAAE,IAAI,EAAE,KAAK;iBAC1B;aACF;SACF,KACG,SAAS;QAEb,oBAAC,gBAAgB,IACf,MAAM,EAAE,oBAAC,aAAa,OAAG,KACrB,YAAY,EAAE,QAAQ,GAC1B,CACc,CACnB,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mezo-org/passport",
|
|
3
|
-
"version": "0.4.0-dev.
|
|
3
|
+
"version": "0.4.0-dev.14",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"scripts": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"typescript": "^5.4.3"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@mezo-org/mezo-clay": "0.1.0-dev.
|
|
40
|
+
"@mezo-org/mezo-clay": "0.1.0-dev.24",
|
|
41
41
|
"@mezo-org/orangekit": "1.0.0-beta.40-dev.1",
|
|
42
42
|
"@mezo-org/sign-in-with-wallet": "1.0.0-beta.8"
|
|
43
43
|
},
|
|
@@ -1,54 +1,74 @@
|
|
|
1
|
-
import { Block, ButtonProps, useStyletron } from "@mezo-org/mezo-clay"
|
|
2
|
-
import React, { forwardRef, ReactNode } from "react"
|
|
1
|
+
import { Block, Button, ButtonProps, useStyletron } from "@mezo-org/mezo-clay"
|
|
2
|
+
import React, { forwardRef, ReactNode, useMemo } from "react"
|
|
3
3
|
|
|
4
|
-
type ConnectedTriggerProps = Omit<ButtonProps, "children"> & {
|
|
4
|
+
type ConnectedTriggerProps = Omit<ButtonProps, "children" | "size"> & {
|
|
5
5
|
avatar: ReactNode
|
|
6
|
+
size?: "medium" | "large"
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
const ConnectedTrigger = forwardRef<HTMLButtonElement, ConnectedTriggerProps>(
|
|
9
10
|
(props, ref) => {
|
|
10
|
-
const { onClick, avatar, ...restProps } = props
|
|
11
|
+
const { onClick, avatar, size = "medium", ...restProps } = props
|
|
11
12
|
|
|
12
13
|
const [, theme] = useStyletron()
|
|
13
14
|
|
|
15
|
+
const avatarSize = useMemo(() => {
|
|
16
|
+
const sizeMap = {
|
|
17
|
+
medium: theme.sizing.scale950,
|
|
18
|
+
large: theme.sizing.scale1400,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return sizeMap[size]
|
|
22
|
+
}, [theme, size])
|
|
23
|
+
|
|
24
|
+
const buttonPadding = useMemo(() => {
|
|
25
|
+
const paddingMap = {
|
|
26
|
+
medium: theme.sizing.scale0,
|
|
27
|
+
large: theme.sizing.scale100,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return paddingMap[size]
|
|
31
|
+
}, [theme, size])
|
|
32
|
+
|
|
14
33
|
return (
|
|
15
|
-
<
|
|
16
|
-
as="button"
|
|
34
|
+
<Button
|
|
17
35
|
overrides={{
|
|
18
|
-
|
|
36
|
+
BaseButton: {
|
|
19
37
|
props: { ref, ...restProps },
|
|
20
38
|
style: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
padding:
|
|
24
|
-
margin: 0,
|
|
25
|
-
cursor: "pointer",
|
|
39
|
+
borderRadius: "100%",
|
|
40
|
+
overflow: "hidden",
|
|
41
|
+
padding: buttonPadding,
|
|
26
42
|
},
|
|
27
43
|
},
|
|
28
44
|
}}
|
|
29
45
|
onClick={onClick}
|
|
30
46
|
>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
{typeof avatar === "string" ? (
|
|
48
|
+
<Block
|
|
49
|
+
width={avatarSize}
|
|
50
|
+
height={avatarSize}
|
|
51
|
+
as="img"
|
|
52
|
+
src={avatar}
|
|
53
|
+
alt=""
|
|
54
|
+
/>
|
|
55
|
+
) : (
|
|
56
|
+
<Block
|
|
57
|
+
width={avatarSize}
|
|
58
|
+
height={avatarSize}
|
|
59
|
+
overrides={{
|
|
60
|
+
Block: {
|
|
61
|
+
style: {
|
|
62
|
+
borderRadius: "100%",
|
|
63
|
+
overflow: "hidden",
|
|
64
|
+
},
|
|
41
65
|
},
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
avatar
|
|
49
|
-
)}
|
|
50
|
-
</Block>
|
|
51
|
-
</Block>
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
{avatar}
|
|
69
|
+
</Block>
|
|
70
|
+
)}
|
|
71
|
+
</Button>
|
|
52
72
|
)
|
|
53
73
|
},
|
|
54
74
|
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ButtonProps,
|
|
2
3
|
StatefulPopover,
|
|
3
4
|
StatefulPopoverProps,
|
|
4
5
|
useStyletron,
|
|
@@ -25,6 +26,13 @@ export type DropdownProps = {
|
|
|
25
26
|
evmNativeAssets?: DropdownCryptoAsset<"tbtc" | "wbtc">[]
|
|
26
27
|
/** The set of Matsnet assets to be displayed in the dropdown */
|
|
27
28
|
matsnetAssets?: DropdownCryptoAsset<"mbtc" | "musd">[]
|
|
29
|
+
/** The props to be passed to the trigger button */
|
|
30
|
+
triggerProps?: {
|
|
31
|
+
signedIn?: Omit<ButtonProps, "onClick" | "size"> & {
|
|
32
|
+
size: "medium" | "large"
|
|
33
|
+
}
|
|
34
|
+
signedOut?: Omit<ButtonProps, "onClick">
|
|
35
|
+
}
|
|
28
36
|
} & Omit<StatefulPopoverProps, "children" | "content">
|
|
29
37
|
|
|
30
38
|
/**
|
|
@@ -41,6 +49,7 @@ export function Dropdown(props: DropdownProps) {
|
|
|
41
49
|
evmNativeAssets,
|
|
42
50
|
matsnetAssets,
|
|
43
51
|
overrides,
|
|
52
|
+
triggerProps,
|
|
44
53
|
...restProps
|
|
45
54
|
} = props
|
|
46
55
|
|
|
@@ -79,6 +88,7 @@ export function Dropdown(props: DropdownProps) {
|
|
|
79
88
|
// connect modal
|
|
80
89
|
onClick={onSignIn || openConnectModal}
|
|
81
90
|
isLoading={isPending}
|
|
91
|
+
{...triggerProps?.signedOut}
|
|
82
92
|
>
|
|
83
93
|
Sign in
|
|
84
94
|
</DisconnectedTrigger>
|
|
@@ -105,7 +115,10 @@ export function Dropdown(props: DropdownProps) {
|
|
|
105
115
|
}}
|
|
106
116
|
{...restProps}
|
|
107
117
|
>
|
|
108
|
-
<ConnectedTrigger
|
|
118
|
+
<ConnectedTrigger
|
|
119
|
+
avatar={<DefaultAvatar />}
|
|
120
|
+
{...triggerProps?.signedIn}
|
|
121
|
+
/>
|
|
109
122
|
</StatefulPopover>
|
|
110
123
|
)
|
|
111
124
|
}
|
|
@@ -28,6 +28,10 @@ component. It allows to establish the session and interact with the API.
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
```
|
|
31
|
+
- `triggerProps.signedIn` (`ButtonProps`) - Props to be passed to the trigger
|
|
32
|
+
button in signed-in state.
|
|
33
|
+
- `triggerProps.signedOut` (`ButtonProps`) - Props to be passed to the trigger
|
|
34
|
+
button in signed-out state
|
|
31
35
|
|
|
32
36
|
Besides that, component allows
|
|
33
37
|
[Clay's `StatefulPopover` props](https://baseweb.design/components/popover/)
|