Skip to content

Commit e3d5e0f

Browse files
committed
Merge branch 'dev' into ashiskumar-dev
2 parents 694d193 + a293232 commit e3d5e0f

File tree

17 files changed

+213
-37
lines changed

17 files changed

+213
-37
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12006,6 +12006,15 @@
1200612006
"contributions": [
1200712007
"content"
1200812008
]
12009+
},
12010+
{
12011+
"login": "ecabras",
12012+
"name": "ecabras",
12013+
"avatar_url": "https://avatars.githubusercontent.com/u/126670074?v=4",
12014+
"profile": "https://github.com/ecabras",
12015+
"contributions": [
12016+
"content"
12017+
]
1200912018
}
1201012019
],
1201112020
"contributorsPerLine": 7,

.github/ISSUE_TEMPLATE/suggest_wallet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ body:
293293
id: wallet_eip_1559_support
294294
attributes:
295295
label: Does the wallet support EIP-1559 (type 2) transactions?
296-
description: Please provide information on the type of transactions this wallet supports.
296+
description: Does your wallet support EIP-1559 (type 2) transactions for Ethereum Mainnet. Please provide information on the type of transactions this wallet supports. If this is not applicable, please explain.
297297
validations:
298298
required: true
299299
- type: textarea

.storybook/ChakraDecorator.tsx

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import {
2+
ChakraBaseProvider,
3+
extendBaseTheme,
4+
useColorMode,
5+
} from "@chakra-ui/react"
6+
import type { Decorator } from "@storybook/react"
7+
8+
import theme from "../src/@chakra-ui/theme"
9+
import { useEffect, useMemo, useState } from "react"
10+
import i18n from "./i18next"
11+
12+
type DecoratorProps = Parameters<Decorator>
13+
14+
const ColorModeSync = ({ context }: { context: DecoratorProps[1] }) => {
15+
const { setColorMode } = useColorMode()
16+
17+
useEffect(() => {
18+
const isDarkMode = localStorage.getItem("chakra-ui-color-mode") === "dark"
19+
20+
context.globals.colorMode = isDarkMode ? "dark" : "light"
21+
}, [])
22+
23+
useEffect(() => {
24+
setColorMode(context.globals.colorMode)
25+
}, [setColorMode, context])
26+
27+
return null
28+
}
29+
30+
/**
31+
* This is a custom local setup of the official Chakra UI Storybook addon.
32+
*
33+
* A local version was created in response to provide a better sync between
34+
* updated local direction to the Chakra theme.
35+
*
36+
* (This would most likely not be updated in the addon due to ongoing creation of Chakra v3 at the time this
37+
* setup was created.)
38+
*
39+
* Will be deprecated and removed when Chakra v3 is available for migration.
40+
*
41+
*/
42+
export const ChakraDecorator: Decorator = (getStory, context) => {
43+
const [dir, updateDir] = useState<"ltr" | "rtl">()
44+
45+
i18n.on("languageChanged", (locale) => {
46+
const direction = i18n.dir(locale)
47+
document.documentElement.dir = direction
48+
updateDir(direction)
49+
})
50+
51+
const themeWithDirectionOverride = useMemo(() => {
52+
return extendBaseTheme({ direction: dir }, theme)
53+
}, [dir])
54+
55+
return (
56+
<ChakraBaseProvider theme={themeWithDirectionOverride}>
57+
<>
58+
<ColorModeSync context={context} />
59+
{getStory(context)}
60+
</>
61+
</ChakraBaseProvider>
62+
)
63+
}

.storybook/i18next.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const baseLocales = {
66
zh: { title: "中国人", left: "Zh" },
77
ru: { title: "Русский", left: "Ru" },
88
uk: { title: "українська", left: "Uk" },
9+
fa: { title: "فارسی", left: "Fa" },
910
}
1011

1112
// Only i18n files named in this array are being exposed to Storybook. Add filenames as necessary.

.storybook/main.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import path from "path"
2-
31
import type { StorybookConfig } from "@storybook/nextjs"
42
import { propNames } from "@chakra-ui/react"
53

4+
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin"
5+
66
/**
77
* Note regarding package.json settings related to Storybook:
88
*
@@ -21,7 +21,6 @@ const config: StorybookConfig = {
2121
"@storybook/addon-links",
2222
"@storybook/addon-essentials",
2323
"@storybook/addon-interactions",
24-
"@chakra-ui/storybook-addon",
2524
"storybook-react-i18next",
2625
],
2726
staticDirs: ["../public"],
@@ -37,11 +36,15 @@ const config: StorybookConfig = {
3736
disable: true,
3837
},
3938
},
40-
webpackFinal: async (config: any) => {
41-
// Add path aliases
42-
config.resolve.alias["@"] = path.resolve(__dirname, "../src")
43-
config.resolve.alias["@/public"] = path.resolve(__dirname, "../public")
44-
39+
webpackFinal: async (config) => {
40+
if (config.resolve) {
41+
config.resolve.plugins = [
42+
...(config.resolve.plugins || []),
43+
new TsconfigPathsPlugin({
44+
extensions: config.resolve.extensions,
45+
}),
46+
]
47+
}
4548
return config
4649
},
4750
typescript: {

.storybook/preview.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
import { extendBaseTheme } from "@chakra-ui/react"
21
import type { Preview } from "@storybook/react"
32

43
import theme from "../src/@chakra-ui/theme"
54

5+
import { ChakraDecorator } from "./ChakraDecorator"
66
import i18n, { baseLocales } from "./i18next"
77

88
import "../src/styles/global.css"
99

10-
const extendedTheme = extendBaseTheme(theme)
11-
12-
const chakraBreakpointArray = Object.entries(extendedTheme.breakpoints) as [
10+
const chakraBreakpointArray = Object.entries(theme.breakpoints) as [
1311
string,
1412
string
1513
][]
@@ -19,6 +17,20 @@ const preview: Preview = {
1917
locale: "en",
2018
locales: baseLocales,
2119
},
20+
globalTypes: {
21+
colorMode: {
22+
name: "Color Mode",
23+
description: "Change the color mode",
24+
toolbar: {
25+
icon: "circlehollow",
26+
items: [
27+
{ value: "light", icon: "circlehollow", title: "Light Mode" },
28+
{ value: "dark", icon: "circle", title: "Dark Mode" },
29+
],
30+
},
31+
},
32+
},
33+
decorators: [ChakraDecorator],
2234
parameters: {
2335
i18n,
2436
actions: { argTypesRegex: "^on[A-Z].*" },
@@ -36,9 +48,6 @@ const preview: Preview = {
3648
order: ["Atoms", "Molecules", "Organisms", "Templates", "Pages"],
3749
},
3850
},
39-
chakra: {
40-
theme: extendedTheme,
41-
},
4251
layout: "centered",
4352
// Modify viewport selection to match Chakra breakpoints (or custom breakpoints)
4453
viewport: {

.storybook/types.ts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import type { ArgTypes } from "@storybook/react"
2+
import type { ThemingProps } from "@chakra-ui/react"
3+
4+
// Type declarations below pulled directly from `@chakra-ui/storybook-addon`
5+
// with some alteration
6+
// (Subject to deprecation and removal upon release of Chakra v3)
7+
8+
/**
9+
* `keyof` alternative which omits non-string keys
10+
*/
11+
type KeyOf<T> = [T] extends [never]
12+
? never
13+
: T extends object
14+
? Extract<keyof T, string>
15+
: never
16+
17+
export type ThemingArgTypeKey = "variant" | "size"
18+
19+
/**
20+
* Create Storybook controls based on a Chakra UI theme component.
21+
*
22+
* @example
23+
* export default {
24+
* title: "Components / Forms / Button",
25+
* argTypes: getThemingArgTypes(theme, "Button"),
26+
* }
27+
*
28+
* @example full example
29+
* import { Meta, StoryFn } from "@storybook/react"
30+
* import { getThemingArgTypes } from "@chakra-ui/storybook-addon"
31+
* import { theme } from "<your-theme>"
32+
*
33+
* export default {
34+
* title: "Components / Forms / Button",
35+
* argTypes: {
36+
* ...getThemingArgTypes(theme, "Button"),
37+
* children: "string"
38+
* },
39+
* args: { children: "Button" },
40+
* } as Meta
41+
*
42+
* interface StoryProps extends ThemingProps<"Button"> {
43+
* children?: React.ReactNode
44+
* }
45+
*
46+
* export const Basic: StoryFn<StoryProps> = (props) => <Button {...props} />
47+
*
48+
* @param theme same Chakra UI theme used in .storybook/preview.tsx
49+
* @param componentName component name to create the ArgTypes for
50+
*/
51+
export function getThemingArgTypes<
52+
Theme extends Record<string, any>,
53+
ComponentName extends KeyOf<Theme["components"]>
54+
>(theme: Theme, componentName: ComponentName) {
55+
const component = theme.components[componentName]
56+
if (!component) {
57+
return undefined
58+
}
59+
60+
const argTypes: ArgTypes<
61+
Partial<Pick<ThemingProps<ComponentName>, ThemingArgTypeKey>>
62+
> = {}
63+
64+
const variantOptions = Object.keys(component.variants || {})
65+
if (variantOptions.length) {
66+
argTypes.variant = {
67+
type: { name: "enum", value: variantOptions },
68+
defaultValue: component.defaultProps?.variant,
69+
}
70+
}
71+
72+
const sizeOptions = Object.keys(component.sizes || {})
73+
if (sizeOptions.length) {
74+
argTypes.size = {
75+
type: { name: "enum", value: sizeOptions },
76+
defaultValue: component.defaultProps?.size,
77+
}
78+
}
79+
80+
return argTypes
81+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,6 +1838,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
18381838
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ZakGriffith"><img src="https://avatars.githubusercontent.com/u/12072395?v=4?s=100" width="100px;" alt="Zak G"/><br /><sub><b>Zak G</b></sub></a><br /><a href="#tutorial-ZakGriffith" title="Tutorials">✅</a></td>
18391839
<td align="center" valign="top" width="14.28%"><a href="http://fanniebarskhian.com"><img src="https://avatars.githubusercontent.com/u/42990794?v=4?s=100" width="100px;" alt="Fannie Barskhian"/><br /><sub><b>Fannie Barskhian</b></sub></a><br /><a href="#maintenance-barskhianfannie" title="Maintenance">🚧</a></td>
18401840
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ksdumont"><img src="https://avatars.githubusercontent.com/u/51958351?v=4?s=100" width="100px;" alt="Keith Dumont"/><br /><sub><b>Keith Dumont</b></sub></a><br /><a href="#content-ksdumont" title="Content">🖋</a></td>
1841+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ecabras"><img src="https://avatars.githubusercontent.com/u/126670074?v=4?s=100" width="100px;" alt="ecabras"/><br /><sub><b>ecabras</b></sub></a><br /><a href="#content-ecabras" title="Content">🖋</a></td>
18411842
</tr>
18421843
</tbody>
18431844
</table>

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
},
6262
"devDependencies": {
6363
"@chakra-ui/cli": "^2.4.1",
64-
"@chakra-ui/storybook-addon": "5.1.0",
6564
"@netlify/plugin-nextjs": "^4.41.3",
6665
"@storybook/addon-essentials": "7.6.6",
6766
"@storybook/addon-interactions": "7.6.6",
@@ -91,11 +90,12 @@
9190
"storybook": "7.6.6",
9291
"storybook-react-i18next": "^2.0.9",
9392
"ts-node": "^10.9.1",
93+
"tsconfig-paths-webpack-plugin": "4.1.0",
9494
"typescript": "^5.4.2",
9595
"unified": "^10.0.0",
9696
"unist-util-visit": "^5.0.0"
9797
},
9898
"resolutions": {
9999
"jackspeak": "2.1.1"
100100
}
101-
}
101+
}

public/content/contributing/adding-wallets/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Wallets are rapidly changing in Ethereum. We've tried to create a fair framework
2525
- **Worked on by an active team** - this helps to ensure quality and that a user will get support for their queries.
2626
- **Honest and accurate listing information** - it is expected that any suggested listings from projects come with honest and accurate information. Products that falsify listing information, such as declaring your product is “open source” when it is not, will be removed.
2727
- **Point of contact** - A point of contact for the wallet will greatly help us get accurate information when changes are made. This will keep updating ethereum.org manageable when gathering future information.
28-
- **EIP-1559 (type 2) transactions** - your wallet must support EIP-1559 (type 2) transactions.
28+
- **EIP-1559 (type 2) transactions** - your wallet must support EIP-1559 (type 2) transactions for transactions on Mainnet Ethereum.
2929
- **Good user experience** - While UX is subjective, if several core team members test the product and find it difficult to use, we reserve the right to reject the wallet and will instead provide useful suggestions to improve. This is done to protect our user base that is mostly comprised of beginners.
3030

3131
### Product removals {#product-removals}

0 commit comments

Comments
 (0)