@bosonprotocol/react-kit 0.32.0-alpha.3 → 0.32.0-alpha.4

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.
Files changed (89) hide show
  1. package/dist/cjs/components/buttons/BaseButton.d.ts +1 -0
  2. package/dist/cjs/components/buttons/BaseButton.d.ts.map +1 -1
  3. package/dist/cjs/components/buttons/BaseButton.js +2 -2
  4. package/dist/cjs/components/buttons/BaseButton.js.map +1 -1
  5. package/dist/cjs/components/modal/Modal.d.ts.map +1 -1
  6. package/dist/cjs/components/modal/Modal.js +0 -8
  7. package/dist/cjs/components/modal/Modal.js.map +1 -1
  8. package/dist/cjs/components/modal/ModalProvider.d.ts +1 -1
  9. package/dist/cjs/components/modal/ModalProvider.d.ts.map +1 -1
  10. package/dist/cjs/components/modal/ModalProvider.js +3 -2
  11. package/dist/cjs/components/modal/ModalProvider.js.map +1 -1
  12. package/dist/cjs/components/wallet2/accountDrawer/AuthenticatedHeader.d.ts +4 -3
  13. package/dist/cjs/components/wallet2/accountDrawer/AuthenticatedHeader.d.ts.map +1 -1
  14. package/dist/cjs/components/wallet2/accountDrawer/AuthenticatedHeader.js +4 -39
  15. package/dist/cjs/components/wallet2/accountDrawer/AuthenticatedHeader.js.map +1 -1
  16. package/dist/cjs/components/wallet2/accountDrawer/IconButton.d.ts +2 -1
  17. package/dist/cjs/components/wallet2/accountDrawer/IconButton.d.ts.map +1 -1
  18. package/dist/cjs/components/wallet2/accountDrawer/IconButton.js +6 -6
  19. package/dist/cjs/components/wallet2/accountDrawer/IconButton.js.map +1 -1
  20. package/dist/cjs/components/wallet2/walletModal/Option.d.ts +2 -1
  21. package/dist/cjs/components/wallet2/walletModal/Option.d.ts.map +1 -1
  22. package/dist/cjs/components/wallet2/walletModal/Option.js +3 -3
  23. package/dist/cjs/components/wallet2/walletModal/Option.js.map +1 -1
  24. package/dist/cjs/components/wallet2/walletModal/index.d.ts +4 -1
  25. package/dist/cjs/components/wallet2/walletModal/index.d.ts.map +1 -1
  26. package/dist/cjs/components/wallet2/walletModal/index.js +3 -3
  27. package/dist/cjs/components/wallet2/walletModal/index.js.map +1 -1
  28. package/dist/cjs/components/wallet2/web3Status/index.d.ts.map +1 -1
  29. package/dist/cjs/components/wallet2/web3Status/index.js +1 -54
  30. package/dist/cjs/components/wallet2/web3Status/index.js.map +1 -1
  31. package/dist/cjs/components/widgets/commit/CommitWidgetProviders.d.ts +1 -1
  32. package/dist/cjs/components/widgets/commit/CommitWidgetProviders.d.ts.map +1 -1
  33. package/dist/cjs/components/widgets/commit/CommitWidgetProviders.js +3 -3
  34. package/dist/cjs/components/widgets/commit/CommitWidgetProviders.js.map +1 -1
  35. package/dist/cjs/components/widgets/finance/FinanceWidgetProviders.js +2 -2
  36. package/dist/cjs/components/widgets/finance/FinanceWidgetProviders.js.map +1 -1
  37. package/dist/cjs/components/widgets/redemption/RedemptionWidgetProviders.js +2 -2
  38. package/dist/cjs/components/widgets/redemption/RedemptionWidgetProviders.js.map +1 -1
  39. package/dist/esm/components/buttons/BaseButton.d.ts +1 -0
  40. package/dist/esm/components/buttons/BaseButton.d.ts.map +1 -1
  41. package/dist/esm/components/buttons/BaseButton.js +2 -2
  42. package/dist/esm/components/buttons/BaseButton.js.map +1 -1
  43. package/dist/esm/components/modal/Modal.d.ts.map +1 -1
  44. package/dist/esm/components/modal/Modal.js +0 -8
  45. package/dist/esm/components/modal/Modal.js.map +1 -1
  46. package/dist/esm/components/modal/ModalProvider.d.ts +1 -1
  47. package/dist/esm/components/modal/ModalProvider.d.ts.map +1 -1
  48. package/dist/esm/components/modal/ModalProvider.js +2 -2
  49. package/dist/esm/components/modal/ModalProvider.js.map +1 -1
  50. package/dist/esm/components/wallet2/accountDrawer/AuthenticatedHeader.d.ts +4 -3
  51. package/dist/esm/components/wallet2/accountDrawer/AuthenticatedHeader.d.ts.map +1 -1
  52. package/dist/esm/components/wallet2/accountDrawer/AuthenticatedHeader.js +4 -39
  53. package/dist/esm/components/wallet2/accountDrawer/AuthenticatedHeader.js.map +1 -1
  54. package/dist/esm/components/wallet2/accountDrawer/IconButton.d.ts +2 -1
  55. package/dist/esm/components/wallet2/accountDrawer/IconButton.d.ts.map +1 -1
  56. package/dist/esm/components/wallet2/accountDrawer/IconButton.js +6 -6
  57. package/dist/esm/components/wallet2/accountDrawer/IconButton.js.map +1 -1
  58. package/dist/esm/components/wallet2/walletModal/Option.d.ts +2 -1
  59. package/dist/esm/components/wallet2/walletModal/Option.d.ts.map +1 -1
  60. package/dist/esm/components/wallet2/walletModal/Option.js +3 -3
  61. package/dist/esm/components/wallet2/walletModal/Option.js.map +1 -1
  62. package/dist/esm/components/wallet2/walletModal/index.d.ts +4 -1
  63. package/dist/esm/components/wallet2/walletModal/index.d.ts.map +1 -1
  64. package/dist/esm/components/wallet2/walletModal/index.js +3 -3
  65. package/dist/esm/components/wallet2/walletModal/index.js.map +1 -1
  66. package/dist/esm/components/wallet2/web3Status/index.d.ts.map +1 -1
  67. package/dist/esm/components/wallet2/web3Status/index.js +1 -54
  68. package/dist/esm/components/wallet2/web3Status/index.js.map +1 -1
  69. package/dist/esm/components/widgets/commit/CommitWidgetProviders.d.ts +1 -1
  70. package/dist/esm/components/widgets/commit/CommitWidgetProviders.d.ts.map +1 -1
  71. package/dist/esm/components/widgets/commit/CommitWidgetProviders.js +2 -2
  72. package/dist/esm/components/widgets/commit/CommitWidgetProviders.js.map +1 -1
  73. package/dist/esm/components/widgets/finance/FinanceWidgetProviders.js +1 -1
  74. package/dist/esm/components/widgets/finance/FinanceWidgetProviders.js.map +1 -1
  75. package/dist/esm/components/widgets/redemption/RedemptionWidgetProviders.js +1 -1
  76. package/dist/esm/components/widgets/redemption/RedemptionWidgetProviders.js.map +1 -1
  77. package/package.json +4 -4
  78. package/src/components/buttons/BaseButton.tsx +3 -2
  79. package/src/components/modal/Modal.tsx +0 -8
  80. package/src/components/modal/ModalProvider.tsx +2 -2
  81. package/src/components/wallet2/accountDrawer/AuthenticatedHeader.tsx +10 -47
  82. package/src/components/wallet2/accountDrawer/IconButton.tsx +11 -2
  83. package/src/components/wallet2/walletModal/Option.tsx +8 -4
  84. package/src/components/wallet2/walletModal/index.tsx +14 -6
  85. package/src/components/wallet2/web3Status/index.tsx +3 -61
  86. package/src/components/widgets/commit/CommitWidgetProviders.tsx +2 -2
  87. package/src/components/widgets/finance/FinanceWidgetProviders.tsx +1 -1
  88. package/src/components/widgets/redemption/RedemptionWidgetProviders.tsx +1 -1
  89. package/src/stories/ConnectWallet.stories.tsx +63 -28
@@ -25,65 +25,8 @@ import { Tooltip } from "../../tooltip/Tooltip";
25
25
  import { Grid } from "../../ui/Grid";
26
26
  import { useAccountDrawer } from "../accountDrawer";
27
27
  import StatusIcon from "../identicon/StatusIcon";
28
- import { flexRowNoWrap } from "../styles";
29
-
30
- const Web3StatusGeneric = styled.button`
31
- ${flexRowNoWrap};
32
- width: 100%;
33
- align-items: center;
34
- padding: 0.5rem;
35
- cursor: pointer;
36
- user-select: none;
37
-
38
- margin-right: 2px;
39
- margin-left: 2px;
40
- &:focus {
41
- outline: none;
42
- }
43
- `;
44
28
 
45
29
  const breakpointWhenConnectButtonOverflows = "1300px";
46
- const Web3StatusConnected = styled(Web3StatusGeneric)<{
47
- $color: string;
48
- $backgroundColor: string;
49
- }>`
50
- border: 2px solid transparent;
51
- width: auto;
52
- font-weight: 500;
53
- color: ${({ $color }) => $color};
54
- &:hover,
55
- &:focus {
56
- border: 2px solid
57
- color-mix(
58
- in srgb,
59
- ${({ $backgroundColor }) => $backgroundColor} 90%,
60
- black
61
- );
62
- }
63
- @media (min-width: ${breakpointNumbers.xs}px) and (max-width: ${breakpointNumbers.l -
64
- 1}px) {
65
- background-color: ${({ $backgroundColor }) => $backgroundColor};
66
- border: 2px solid ${({ $backgroundColor }) => $backgroundColor};
67
- }
68
- @media (min-width: ${breakpointWhenConnectButtonOverflows}) {
69
- background-color: ${({ $backgroundColor }) => $backgroundColor};
70
- border: 2px solid ${({ $backgroundColor }) => $backgroundColor};
71
- }
72
- ${breakpoint.xxs} {
73
- border-radius: 8px;
74
- margin: initial;
75
- * {
76
- margin: initial;
77
- }
78
- }
79
- @media (min-width: ${breakpointNumbers.l}px) and (max-width: ${breakpointWhenConnectButtonOverflows}) {
80
- border-radius: 8px;
81
- margin: initial;
82
- * {
83
- margin: initial;
84
- }
85
- }
86
- `;
87
30
 
88
31
  const AddressAndChevronContainer = styled.div`
89
32
  display: flex;
@@ -174,12 +117,11 @@ function Web3StatusInner({
174
117
 
175
118
  if (!connectedToWrongChainId && account) {
176
119
  return (
177
- <Web3StatusConnected
120
+ <BaseButton
178
121
  disabled={Boolean(switchingChain)}
179
122
  data-testid="web3-status-connected"
180
123
  onClick={handleWalletDropdownClick}
181
- $color={successButtonTheme.color}
182
- $backgroundColor={successButtonTheme.background}
124
+ theme={successButtonTheme}
183
125
  >
184
126
  <StatusIcon
185
127
  account={account}
@@ -191,7 +133,7 @@ function Web3StatusInner({
191
133
  <AddressAndChevronContainer>
192
134
  <Text>{ENSName || formatAddress(account)}</Text>
193
135
  </AddressAndChevronContainer>
194
- </Web3StatusConnected>
136
+ </BaseButton>
195
137
  );
196
138
  }
197
139
 
@@ -3,13 +3,14 @@ import { useProvider } from "../../../hooks/connection/connection";
3
3
  import { useIsWindowVisible } from "../../../hooks/uniswap/useIsWindowVisible";
4
4
  import { CONFIG } from "../../../lib/config/config";
5
5
  import { Updaters } from "../../../state/updaters";
6
+ import { BosonProvider, BosonProviderProps } from "../../boson/BosonProvider";
6
7
  import ChatProvider from "../../chat/ChatProvider/ChatProvider";
7
8
  import {
8
9
  ConfigProvider,
9
10
  ConfigProviderProps
10
11
  } from "../../config/ConfigProvider";
11
12
  import { IpfsProvider, IpfsProviderProps } from "../../ipfs/IpfsProvider";
12
- import ModalProvider from "../../modal/ModalProvider";
13
+ import { ModalProvider } from "../../modal/ModalProvider";
13
14
  import { withQueryClientProvider } from "../../queryClient/withQueryClientProvider";
14
15
  import { WalletConnectionProviderProps } from "../../wallet/WalletConnectionProvider";
15
16
  import {
@@ -20,7 +21,6 @@ import {
20
21
  import ConvertionRateProvider, {
21
22
  ConvertionRateProviderProps
22
23
  } from "../finance/convertion-rate/ConvertionRateProvider";
23
- import { BosonProvider, BosonProviderProps } from "../../boson/BosonProvider";
24
24
 
25
25
  export type CommitWidgetProvidersProps = IpfsProviderProps &
26
26
  Omit<ConfigProviderProps, "magicLinkKey" | "infuraKey"> &
@@ -5,7 +5,7 @@ import {
5
5
  ConfigProvider,
6
6
  ConfigProviderProps
7
7
  } from "../../config/ConfigProvider";
8
- import ModalProvider from "../../modal/ModalProvider";
8
+ import { ModalProvider } from "../../modal/ModalProvider";
9
9
  import { withQueryClientProvider } from "../../queryClient/withQueryClientProvider";
10
10
  import { SignerProvider } from "../../signer/SignerProvider";
11
11
  import GlobalStyle from "../../styles/GlobalStyle";
@@ -6,7 +6,7 @@ import {
6
6
  ConfigProviderProps
7
7
  } from "../../config/ConfigProvider";
8
8
  import { IpfsProvider, IpfsProviderProps } from "../../ipfs/IpfsProvider";
9
- import ModalProvider from "../../modal/ModalProvider";
9
+ import { ModalProvider } from "../../modal/ModalProvider";
10
10
  import { withQueryClientProvider } from "../../queryClient/withQueryClientProvider";
11
11
  import { SignerProvider } from "../../signer/SignerProvider";
12
12
  import GlobalStyle from "../../styles/GlobalStyle";
@@ -39,34 +39,44 @@ const ColorGlobalStyle = createGlobalStyle<{ color: CSSProperties["color"] }>`
39
39
  const Component = ({
40
40
  textColor,
41
41
  chainSelectorBackgroundColor,
42
+ connectWalletBorderRadius,
42
43
  connectWalletSuccessButtonThemeKey,
43
44
  connectWalletErrorButtonThemeKey,
45
+ accountDrawerBuyCryptoBorderRadiusPx,
44
46
  accountDrawerBackgroundColor,
45
- accountDrawerBuyCryptoColor,
46
- accountDrawerBuyCryptoBackgroundColor,
47
+ accountDrawerBuyCryptoThemeKey,
47
48
  accountDrawerDisconnectBackgroundColor,
49
+ accountDrawerDisconnectBorderRadius,
48
50
  accountDrawerDisconnectColor,
51
+ walletBorderRadius,
52
+ walletIconBorderRadius,
49
53
  walletBackgroundColor,
50
54
  walletColor,
51
55
  walletHoverFocusBackgroundColor,
52
56
  walletHoverColor,
53
57
  magicLoginButtonThemeKey,
58
+ magicLoginButtonBorderRadiusPx,
54
59
  onUserDisconnect
55
60
  }: {
56
61
  textColor: string;
57
62
  chainSelectorBackgroundColor: string | undefined;
63
+ connectWalletBorderRadius: string | undefined;
58
64
  connectWalletSuccessButtonThemeKey: string | undefined;
59
65
  connectWalletErrorButtonThemeKey: string | undefined;
60
66
  accountDrawerBackgroundColor: string | undefined;
61
- accountDrawerBuyCryptoColor: string | undefined;
62
- accountDrawerBuyCryptoBackgroundColor: string | undefined;
67
+ accountDrawerBuyCryptoBorderRadiusPx: string | undefined;
68
+ accountDrawerBuyCryptoThemeKey: string | undefined;
69
+ accountDrawerDisconnectBorderRadius: string | undefined;
63
70
  accountDrawerDisconnectBackgroundColor: string | undefined;
64
71
  accountDrawerDisconnectColor: string | undefined;
72
+ walletBorderRadius: string | undefined;
73
+ walletIconBorderRadius: string | undefined;
65
74
  walletBackgroundColor: string | undefined;
66
75
  walletColor: string | undefined;
67
76
  walletHoverFocusBackgroundColor: string | undefined;
68
77
  walletHoverColor: string | undefined;
69
78
  magicLoginButtonThemeKey: string | undefined;
79
+ magicLoginButtonBorderRadiusPx: string | undefined;
70
80
  onUserDisconnect: () => unknown;
71
81
  }) => {
72
82
  return (
@@ -106,29 +116,38 @@ const Component = ({
106
116
  backgroundColor={chainSelectorBackgroundColor}
107
117
  />
108
118
  <ConnectWallet
109
- successButtonTheme={
110
- connectWalletSuccessButtonThemeKey
119
+ successButtonTheme={{
120
+ ...(connectWalletSuccessButtonThemeKey
111
121
  ? bosonButtonThemes({ withBosonStyle: false })[
112
122
  connectWalletSuccessButtonThemeKey
113
123
  ]
114
- : successButtonTheme
115
- }
116
- errorButtonTheme={
117
- connectWalletErrorButtonThemeKey
124
+ : successButtonTheme),
125
+ borderRadius: connectWalletBorderRadius,
126
+ gap: "2px"
127
+ }}
128
+ errorButtonTheme={{
129
+ ...(connectWalletErrorButtonThemeKey
118
130
  ? bosonButtonThemes({ withBosonStyle: false })[
119
131
  connectWalletErrorButtonThemeKey
120
132
  ]
121
- : errorButtonTheme
122
- }
133
+ : errorButtonTheme),
134
+ borderRadius: connectWalletBorderRadius,
135
+ gap: "2px"
136
+ }}
123
137
  />
124
138
  </Grid>
125
139
  <Portal>
126
140
  <AccountDrawer
127
141
  backgroundColor={accountDrawerBackgroundColor}
128
- buyCryptoColor={accountDrawerBuyCryptoColor}
129
- buyCryptoBackgroundColor={
130
- accountDrawerBuyCryptoBackgroundColor
131
- }
142
+ buyCryptoTheme={{
143
+ ...(accountDrawerBuyCryptoThemeKey
144
+ ? bosonButtonThemes({ withBosonStyle: false })[
145
+ accountDrawerBuyCryptoThemeKey
146
+ ]
147
+ : successButtonTheme),
148
+ borderRadius: accountDrawerBuyCryptoBorderRadiusPx
149
+ }}
150
+ disconnectBorderRadius={accountDrawerDisconnectBorderRadius}
132
151
  disconnectBackgroundColor={
133
152
  accountDrawerDisconnectBackgroundColor
134
153
  }
@@ -138,17 +157,22 @@ const Component = ({
138
157
  optionProps: {
139
158
  backgroundColor: walletBackgroundColor,
140
159
  color: walletColor,
160
+ borderRadius: walletBorderRadius,
161
+ iconBorderRadius: walletIconBorderRadius,
141
162
  hoverFocusBackgroundColor:
142
163
  walletHoverFocusBackgroundColor,
143
164
  hoverColor: walletHoverColor
144
165
  },
145
166
  magicLoginButtonProps: {
146
167
  buttonProps: {
147
- theme: magicLoginButtonThemeKey
148
- ? bosonButtonThemes({ withBosonStyle: false })[
149
- magicLoginButtonThemeKey
150
- ]
151
- : successButtonTheme
168
+ theme: {
169
+ ...(magicLoginButtonThemeKey
170
+ ? bosonButtonThemes({ withBosonStyle: false })[
171
+ magicLoginButtonThemeKey
172
+ ]
173
+ : successButtonTheme),
174
+ borderRadius: magicLoginButtonBorderRadiusPx
175
+ }
152
176
  }
153
177
  },
154
178
  PrivacyPolicy: () => <div>privacy policy</div>
@@ -187,8 +211,10 @@ export default {
187
211
  options: bosonButtonThemeKeys
188
212
  },
189
213
  accountDrawerBackgroundColor: { control: "color" },
190
- accountDrawerBuyCryptoColor: { control: "color" },
191
- accountDrawerBuyCryptoBackgroundColor: { control: "color" },
214
+ accountDrawerBuyCryptoThemeKey: {
215
+ control: "select",
216
+ options: bosonButtonThemeKeys
217
+ },
192
218
  accountDrawerDisconnectBackgroundColor: { control: "color" },
193
219
  accountDrawerDisconnectColor: { control: "color" },
194
220
  walletBackgroundColor: { control: "color" },
@@ -217,13 +243,17 @@ export const BosonTheme = {
217
243
  ...BASE_ARGS,
218
244
  textColor: colors.black,
219
245
  chainSelectorBackgroundColor: "var(--buttonBgColor)",
246
+ connectWalletBorderRadius: undefined,
220
247
  connectWalletSuccessButtonThemeKey: undefined,
221
248
  connectWalletErrorButtonThemeKey: "orangeInverse",
249
+ accountDrawerBuyCryptoBorderRadiusPx: "0",
222
250
  accountDrawerBackgroundColor: "var(--primaryBgColor)",
223
- accountDrawerBuyCryptoColor: colors.black,
224
- accountDrawerBuyCryptoBackgroundColor: "var(--buttonBgColor)",
251
+ accountDrawerBuyCryptoThemeKey: undefined,
225
252
  accountDrawerDisconnectBackgroundColor: colors.green,
226
253
  accountDrawerDisconnectColor: colors.black,
254
+ accountDrawerDisconnectBorderRadius: "0px",
255
+ walletBorderRadius: "0px",
256
+ walletIconBorderRadius: "0px",
227
257
  walletBackgroundColor: "var(--secondaryBgColor)",
228
258
  walletColor: colors.white,
229
259
  walletHoverFocusBackgroundColor: colors.black,
@@ -237,17 +267,22 @@ export const CustomTheme = {
237
267
  ...BASE_ARGS,
238
268
  textColor: colors.white,
239
269
  chainSelectorBackgroundColor: "#00e1ff",
270
+ connectWalletBorderRadius: "50",
240
271
  connectWalletSuccessButtonThemeKey: "accentFill",
241
272
  connectWalletErrorButtonThemeKey: "orangeInverse",
273
+ accountDrawerBuyCryptoBorderRadiusPx: "50",
242
274
  accountDrawerBackgroundColor: "#123123",
243
- accountDrawerBuyCryptoColor: "#ff7b00",
244
- accountDrawerBuyCryptoBackgroundColor: "#bf00ff",
275
+ accountDrawerBuyCryptoThemeKey: "accentFill",
276
+ accountDrawerDisconnectBorderRadius: "50px",
245
277
  accountDrawerDisconnectBackgroundColor: "#9b05ff",
246
278
  accountDrawerDisconnectColor: "#0dff00",
279
+ walletBorderRadius: "10px",
280
+ walletIconBorderRadius: "50px",
247
281
  walletBackgroundColor: "#ffd693",
248
282
  walletColor: "#ff00ea",
249
283
  walletHoverFocusBackgroundColor: "#e89f0e",
250
284
  walletHoverColor: "#ff0000",
251
- magicLoginButtonThemeKey: "#0f9a5b"
285
+ magicLoginButtonThemeKey: "orangeInverse",
286
+ magicLoginButtonBorderRadiusPx: "50"
252
287
  }
253
288
  };