-
Notifications
You must be signed in to change notification settings - Fork 60
feat(react-cap-theme): introduce style hook to specifically opt into border radius updates #662
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-contrib-react-cap-theme-9ae06b97-135d-45f6-b610-30ca8ac5e4dc.json
This file contains hidden or 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,7 @@ | ||
| { | ||
| "type": "minor", | ||
| "comment": "Introduce CAP_STYLE_HOOKS_ROUNDED_CORNERS", | ||
| "packageName": "@fluentui-contrib/react-cap-theme", | ||
| "email": "6439050+davezuko@users.noreply.github.com", | ||
| "dependentChangeType": "patch" | ||
| } | ||
This file contains hidden or 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,11 @@ | ||
| /* | ||
| * Constrain the docs reading column to a comfortable width and center it. | ||
| * The shared docs CSS sets `.sbdocs-content` to max-width: 1200px; this | ||
| * package-scoped override narrows it and centers the column. The extra class in | ||
| * the selector raises specificity so it wins regardless of stylesheet order. | ||
| */ | ||
| #storybook-docs .sbdocs.sbdocs-content { | ||
| max-width: 800px; | ||
| margin-left: auto; | ||
| margin-right: auto; | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| export { capTokens } from './tokens'; | ||
| export { capTokens, CAP_THEME_TOKENS } from './tokens'; |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,14 +1,40 @@ | ||
| import { CAPTokens } from './types'; | ||
|
|
||
| export const capTokens: Record<keyof CAPTokens, string> = { | ||
| borderRadius2XLarge: 'var(--borderRadius2XLarge)', | ||
| borderRadius3XLarge: 'var(--borderRadius3XLarge)', | ||
| borderRadius4XLarge: 'var(--borderRadius4XLarge)', | ||
| colorNeutralStroke4: 'var(--colorNeutralStroke4)', | ||
| colorNeutralStroke4Hover: 'var(--colorNeutralStroke4Hover)', | ||
| colorNeutralStroke4Pressed: 'var(--colorNeutralStroke4Pressed)', | ||
| colorNeutralStroke4Selected: 'var(--colorNeutralStroke4Selected)', | ||
| colorNeutralForeground5: 'var(--colorNeutralForeground5)', | ||
| colorNeutralForeground5Hover: 'var(--colorNeutralForeground5Hover)', | ||
| colorNeutralForeground5Pressed: 'var(--colorNeutralForeground5Pressed)', | ||
| /** | ||
| * Default values for the CAP-specific design tokens (the ones Fluent v9 doesn't | ||
| * ship yet). These defaults are baked into the CAP style hooks (see `capTokens`) | ||
| * as CSS-variable fallbacks, so consumers don't have to set them by default. | ||
| * | ||
| * Override a value by defining the matching theme token on your `FluentProvider` | ||
| * theme — that emits the CSS variable, which takes precedence over the fallback. | ||
| * To override several at once, spread these onto your base theme: | ||
| * | ||
| * ```tsx | ||
| * const capTheme = { ...webLightTheme, ...CAP_THEME_TOKENS }; | ||
| * ``` | ||
| */ | ||
| export const CAP_THEME_TOKENS: Record<keyof CAPTokens, string> = { | ||
| borderRadius2XLarge: '12px', | ||
| borderRadius3XLarge: '16px', | ||
| borderRadius4XLarge: '24px', | ||
| colorNeutralStroke4: '#ebebeb', | ||
| colorNeutralStroke4Hover: '#e0e0e0', | ||
| colorNeutralStroke4Pressed: '#d6d6d6', | ||
| colorNeutralStroke4Selected: '#ebebeb', | ||
| colorNeutralForeground5: '#616161', | ||
| colorNeutralForeground5Hover: '#242424', | ||
| colorNeutralForeground5Pressed: '#242424', | ||
| }; | ||
|
|
||
| /** | ||
| * The CAP tokens as CSS-variable references for use inside style hooks. Each one | ||
| * carries its {@link CAP_THEME_TOKENS} default as a fallback, so the hooks work | ||
| * even when the consumer hasn't defined the token on their theme; defining it | ||
| * (e.g. via `CAP_THEME_TOKENS`) overrides the fallback. | ||
| */ | ||
| export const capTokens: Record<keyof CAPTokens, string> = Object.fromEntries( | ||
| (Object.keys(CAP_THEME_TOKENS) as (keyof CAPTokens)[]).map((key) => [ | ||
| key, | ||
| `var(--${key}, ${CAP_THEME_TOKENS[key]})`, | ||
| ]) | ||
| ) as Record<keyof CAPTokens, string>; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.