Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(semantic-tokens): add support for DarkMode/LightMode components
- Loading branch information
1 parent
21e1e3a
commit ac54330
Showing
20 changed files
with
333 additions
and
169 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@chakra-ui/color-mode": major | ||
--- | ||
|
||
Moved components `LightMode` and `DarkMode` to package `@chakra-ui/system` to | ||
prevent circular dependencies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@chakra-ui/styled-system": minor | ||
--- | ||
|
||
Updated `_dark` and `_light` pseudo selectors to allow semantic tokens to change | ||
with the `DarkMode` and `LightMode` component. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
"@chakra-ui/color-mode": major | ||
--- | ||
|
||
The `LightMode` and `DarkMode` components are now able to toggle semantic tokens | ||
as well. | ||
|
||
For backward compatibility reasons this needs to be enabled by passing the | ||
boolean prop `withSemanticTokens`. | ||
|
||
```tsx live=false | ||
<DarkMode withSemanticTokens> | ||
<chakra.div color="your-semantic-token"> | ||
This uses always the _dark value of your semantic token | ||
</chakra.div> | ||
</DarkMode> | ||
``` | ||
|
||
Please note that by adding the prop `withSemanticTokens` the ColorMode | ||
components will render a DOM element which accepts style props as usual. | ||
|
||
```tsx | ||
<DarkMode withSemanticTokens p="4" flex="1"> | ||
... | ||
</DarkMode> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.