Skip to content

Commit 56011e4

Browse files
authored
Merge pull request #10278 from TylerAPfledderer/refactor/theme-nested-semantic-tokens
refactor(theme): implement nested semantic tokens
2 parents 6640661 + 0027d53 commit 56011e4

File tree

87 files changed

+462
-414
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+462
-414
lines changed

docs/chakra-migration-guide.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ const Text = styled.p`
118118
`
119119

120120
// now
121-
<Text color="primary" bg="background" />
121+
<Text color="primary.base" bg="background.base" />
122122
```
123123

124+
> Note the dotted notation. In Chakra, the values are referred to as "semantic tokens" and the new theme applies a nested structure of like tokens for better organization. See [semanticTokens.ts](../src/%40chakra-ui/gatsby-plugin/semanticTokens.ts)
125+
124126
<aside>
125127
💡 In the **next iteration** we will refactor all the colors with the correct color from the new Design System
126128
</aside>

src/@chakra-ui/gatsby-plugin/components/Button.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,21 @@ const commonOutline = defineStyle({
4141
bg: "transparent",
4242
borderColor: "text",
4343
_hover: {
44-
color: "primary",
45-
bg: "background",
46-
borderColor: "primary",
44+
color: "primary.base",
45+
bg: "background.base",
46+
borderColor: "primary.base",
4747
_disabled: {
4848
...disabledStylesOutline,
4949
},
5050
},
5151
_active: {
52-
color: "primary",
53-
bg: "primaryLight",
54-
borderColor: "primary",
52+
color: "primary.base",
53+
bg: "primary.light",
54+
borderColor: "primary.base",
5555
},
5656
_focus: {
57-
color: "primary",
58-
borderColor: "background",
57+
color: "primary.base",
58+
borderColor: "background.base",
5959
_disabled: {
6060
...disabledStylesOutline,
6161
},
@@ -68,17 +68,17 @@ const commonOutline = defineStyle({
6868
const variantSolid = defineStyle((props) =>
6969
defineMergeStyles(defaultVariants?.solid(props), {
7070
color: "buttonColor",
71-
bg: "primary",
71+
bg: "primary.base",
7272
border: 0,
7373
_hover: {
74-
bg: "primary",
74+
bg: "primary.base",
7575
opacity: 0.8,
7676
_disabled: {
7777
...disabledStylesSolid,
7878
},
7979
},
8080
_active: {
81-
bg: "primaryHover",
81+
bg: "primary.hover",
8282
},
8383
_disabled: {
8484
...disabledStylesSolid,
@@ -92,8 +92,8 @@ const variantOutline = defineStyle((props) =>
9292

9393
const variantOutlineColor = defineStyle({
9494
...commonOutline,
95-
color: "primary",
96-
borderColor: "primary",
95+
color: "primary.base",
96+
borderColor: "primary.base",
9797
})
9898

9999
const variantIcon = defineStyle({
@@ -104,7 +104,7 @@ const variantIcon = defineStyle({
104104
color: "inherit",
105105
boxShadow: "none",
106106
_hover: {
107-
color: "primary",
107+
color: "primary.base",
108108
boxShadow: "none",
109109
},
110110
})

src/@chakra-ui/gatsby-plugin/components/Checkbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const { definePartsStyle, defineMultiStyleConfig } =
99

1010
const baseStyleControl = defineStyle((props) =>
1111
defineMergeStyles(defaultBaseStyle?.(props).control, {
12-
bg: "background",
12+
bg: "background.base",
1313
_checked: {
1414
bg: "primary400",
1515
_hover: {

src/@chakra-ui/gatsby-plugin/components/Link.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { defineMergeStyles, linkDefaultTheme } from "./components.utils"
33

44
export const Link = defineStyleConfig({
55
baseStyle: defineMergeStyles(linkDefaultTheme.baseStyle, {
6-
color: "primary",
6+
color: "primary.base",
77
textDecoration: "underline",
88
_focus: {
99
boxShadow: "none",

src/@chakra-ui/gatsby-plugin/components/Progress.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ const { definePartsStyle } = createMultiStyleConfigHelpers(parts.keys)
66

77
const baseStyle = definePartsStyle(() => ({
88
track: {
9-
bg: "primaryLight",
9+
bg: "primary.light",
1010
// `borderRadius` applies to both track and `filledTrack` (https://github.com/chakra-ui/chakra-ui/pull/2946)
1111
borderRadius: "full",
1212
},
1313
filledTrack: {
14-
bgColor: "primary",
14+
bgColor: "primary.base",
1515
},
1616
}))
1717

src/@chakra-ui/gatsby-plugin/components/Tabs.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ const variantPrimary = definePartsStyle({
1111
tab: {
1212
borderTopRadius: "0.3rem",
1313
borderBottom: "1px solid",
14-
borderBottomColor: "primary",
14+
borderBottomColor: "primary.base",
1515
px: 4,
1616
py: "0.3rem",
1717
_selected: {
18-
color: "background",
19-
bg: "primary",
18+
color: "background.base",
19+
bg: "primary.base",
2020
},
2121
},
2222
tabpanels: {

0 commit comments

Comments
 (0)