Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add semantic token support for data-theme attributes #5532

Merged
merged 5 commits into from Mar 25, 2022

Conversation

TimKolberger
Copy link
Contributor

@TimKolberger TimKolberger commented Feb 5, 2022

Relates to #5526

📝 Description

This PR allows the semantic tokens to react to data-theme="dark" and data-theme="light" DOM attributes.

  • Added [data-theme] to the CSS variables root selector
  • Updated _dark and _light pseudo selector

⛳️ Current behavior (updates)

Semantic tokens can only react to "environmental" / global CSS conditions.

🚀 New behavior

To use the LightMode and DarkMode components with those changes, add an additional DOM element with the attribute data-theme="<color-mode>" attached.

<DarkMode>
  <div data-theme="dark">
    <chakra.div color="your-semantic-token">
      This uses always the _dark value of your semantic token
    </chakra.div>
  </div>
</DarkMode>

💣 Is this a breaking change (Yes/No):

No

  • add docs PR

@changeset-bot
Copy link

changeset-bot bot commented Feb 5, 2022

🦋 Changeset detected

Latest commit: ab16166

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@chakra-ui/styled-system Minor
@chakra-ui/system Minor
@chakra-ui/props-docs Patch
@chakra-ui/provider Patch
@chakra-ui/react Patch
@chakra-ui/skeleton Patch
@chakra-ui/test-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 5, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ab16166:

Sandbox Source
create-react-app-ts Configuration

@vercel
Copy link

vercel bot commented Feb 5, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/chakra-ui/chakra-ui-storybook/4frBTjyEetekobd2SnXEXdVo3hWN
✅ Preview: https://chakra-ui-storybook-git-feat-re-hoist-css-vars-chakra-ui.vercel.app

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2022

📦 A new release has been made for this pull request

To play around with this release, you can install @chakra-ui/react@0.0.0-pr-202215121320 in your project

Latest commit: d2ad43e

@TimKolberger TimKolberger changed the title feat: add [data-css-vars-root=true] as css var root feat: add semantic token support for DarkMode/LightMode components Feb 26, 2022
@TimKolberger TimKolberger marked this pull request as ready for review February 26, 2022 16:16
@TimKolberger TimKolberger added Critical Review Needed: Don't merge 🛑 This needs to be looked into some more before merging Breaking Change 🔨 Changes that break compatibility with previous versions of Chakra UI. review needed 🔬 Kindly review this PR and removed Critical Review Needed: Don't merge 🛑 This needs to be looked into some more before merging labels Feb 26, 2022
@TimKolberger TimKolberger changed the title feat: add semantic token support for DarkMode/LightMode components feat: add semantic token support for data-theme attributes Mar 9, 2022
@TimKolberger TimKolberger removed the Breaking Change 🔨 Changes that break compatibility with previous versions of Chakra UI. label Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants