-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 3688-remove-wildcard-exports
- Loading branch information
Showing
121 changed files
with
8,593 additions
and
9,487 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,5 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
Add `className` prop to `FormControl.Label` 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/react": patch | ||
--- | ||
|
||
Add support for `aria-disabled` in `Button` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
Add `classname` prop support to `ActionList.Description` 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/react": patch | ||
--- | ||
|
||
Update confirmation dialog body to default color. Removing the muted color override. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/react": patch | ||
--- | ||
|
||
Bug fix: ActionList Group className prop |
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,5 @@ | ||
--- | ||
"@primer/react": minor | ||
--- | ||
|
||
fix(ProgressBar): add aria-valuetext attribute |
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,5 @@ | ||
--- | ||
'@primer/react': patch | ||
--- | ||
|
||
Update CSS styles for CounterLabel to allow overrides for color, background color |
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,5 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
Add 'className' prop to `Dialog` 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@primer/react": patch | ||
--- | ||
|
||
Make sure all components accept `className` as a prop on outermost component element. |
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,5 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
Add `className` prop support to `Textarea` 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 |
---|---|---|
|
@@ -37,3 +37,6 @@ blob-report | |
|
||
# TypeScript | ||
*.tsbuildinfo | ||
|
||
# ESLint | ||
.eslintcache |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file added
BIN
+12.7 KB
...onList.test.ts-snapshots/Group-Heading-with-Classname-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.8 KB
...ActionList.test.ts-snapshots/Group-Heading-with-Classname-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.6 KB
...ist.test.ts-snapshots/Group-Heading-with-Classname-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.7 KB
...onents/ActionList.test.ts-snapshots/Group-Heading-with-Classname-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.7 KB
...onList.test.ts-snapshots/Group-Heading-with-Classname-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.7 KB
...nList.test.ts-snapshots/Group-Heading-with-Classname-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.5 KB
...st.test.ts-snapshots/Group-Heading-with-Classname-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.7 KB
...nents/ActionList.test.ts-snapshots/Group-Heading-with-Classname-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.7 KB
...nList.test.ts-snapshots/Group-Heading-with-Classname-light-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+114 Bytes
(100%)
...el-Height-Initial-with-Underflowing-Items-After-Fetch-dark-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-9 Bytes
(100%)
...derflowing-Items-After-Fetch-dark-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-34 Bytes
(100%)
...tPanel-Height-Initial-with-Underflowing-Items-After-Fetch-dark-dimmed-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-6 Bytes
(100%)
...h-Underflowing-Items-After-Fetch-dark-dimmed-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3 Bytes
(100%)
...Height-Initial-with-Underflowing-Items-After-Fetch-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3 Bytes
(100%)
...flowing-Items-After-Fetch-dark-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+114 Bytes
(100%)
...s/SelectPanel-Height-Initial-with-Underflowing-Items-After-Fetch-dark-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-9 Bytes
(100%)
...ial-with-Underflowing-Items-After-Fetch-dark-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+114 Bytes
(100%)
...el-Height-Initial-with-Underflowing-Items-After-Fetch-dark-tritanopia-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-9 Bytes
(100%)
...derflowing-Items-After-Fetch-dark-tritanopia-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+298 Bytes
(100%)
...l-Height-Initial-with-Underflowing-Items-After-Fetch-light-colorblind-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3 Bytes
(100%)
...erflowing-Items-After-Fetch-light-colorblind-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2 Bytes
(100%)
...eight-Initial-with-Underflowing-Items-After-Fetch-light-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-2 Bytes
(100%)
...lowing-Items-After-Fetch-light-high-contrast-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+298 Bytes
(100%)
.../SelectPanel-Height-Initial-with-Underflowing-Items-After-Fetch-light-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3 Bytes
(100%)
...al-with-Underflowing-Items-After-Fetch-light-modern-action-list--true-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+298 Bytes
(100%)
...l-Height-Initial-with-Underflowing-Items-After-Fetch-light-tritanopia-linux.png
Oops, something went wrong.
Binary file modified
BIN
+3 Bytes
(100%)
...erflowing-Items-After-Fetch-light-tritanopia-modern-action-list--true-linux.png
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
# Primer React Styled Components to CSS Modules Refactoring Guide | ||
|
||
This guide outlines the steps to follow when refactoring Primer React components from Styled Components to CSS Modules. | ||
|
||
--- | ||
|
||
## Table of Contents | ||
|
||
- [Primer React Styled Components to CSS Modules Refactoring Guide](#primer-react-styled-components-to-css-modules-refactoring-guide) | ||
- [Table of Contents](#table-of-contents) | ||
- [Before Refactoring a Component](#before-refactoring-a-component) | ||
- [How to Migrate](#how-to-migrate) | ||
- [Refactoring Styled-Components to CSS Modules](#refactoring-styled-components-to-css-modules) | ||
- [When Refactoring a Component](#when-refactoring-a-component) | ||
- [Testing the Migration](#testing-the-migration) | ||
- [Releasing a Component](#releasing-a-component) | ||
|
||
--- | ||
|
||
## Before Refactoring a Component | ||
|
||
- **Verify VRT (Visual Regression Testing) Coverage:** | ||
- Check for missing VRT coverage. We utilize the VRT tests to make sure we're matching styling in production with current expectations. Components should have a Storybook story for every "feature" or option available that impacts the UI for VRT to capture in a screenshot. | ||
- Make sure there are `dev` stories for any edge cases spotted in production for the component (ie. `sx` prop, custom className, styled system attributes). `dev` stories may include things that we wouldn't normally recommend for the purpose of stress testing what happens when PRC components are overridden with custom styles. | ||
- **Ensure All Visual Changes Are Completed:** | ||
- Make necessary visual changes **before** creating the CSS Modules refactor PR. | ||
|
||
--- | ||
|
||
## How to Migrate | ||
|
||
### Refactoring Styled-Components to CSS Modules | ||
|
||
- **Replace `${get('...')}` Syntax:** | ||
|
||
- Migrate these to CSS variables find the appropriate variable in [our primitives docs](https://primer.style/foundations/primitives/color). | ||
|
||
```diff | ||
{ | ||
- color: `${get('colors.fg.default')}` | ||
+ color: var(--fgColor-default) | ||
} | ||
``` | ||
|
||
- No need for fallbacks in CSS Modules. | ||
|
||
### When Refactoring a Component | ||
|
||
1. **Check for `className` and `style` Prop:** | ||
- Ensure the component accepts a `className` _on the top DOM level only_ for styling from outside of primer/react. | ||
- Ensure the component accepts a `style` prop for more dynamic styling like positioning. | ||
2. **Feature Flagging:** | ||
|
||
- Add a feature flag to toggle the `sx` prop for controlled rollout (staff shipping). How it's used will be based on the implementation of the component. For most you'll be able to `useFeatureFlag` and toggle between components. For more complex styled components, you can use the utility `toggleStyledComponent` which will render based on the feature flag string provided. | ||
|
||
```jsx | ||
/* When there is an exisiting styled component, use the `toggleStyledComponent` utility. */ | ||
const StyledDiv = toggleStyledComponent( | ||
'primer_react_css_modules_team', | ||
'div', | ||
styled.div` | ||
display: flex; | ||
|
||
${sx}; | ||
`, | ||
) | ||
const enabled = useFeatureFlag('primer_react_css_modules_team') | ||
return <StyledDiv className={clsx({[classes.DivStyle]: enabled})} {...props} /> | ||
``` | ||
|
||
3. **Create CSS Module:** | ||
- Add a corresponding `{Component}.module.css` file. | ||
4. **Import CSS Modules:** | ||
|
||
- Use the CSS module in the component. | ||
|
||
```js | ||
import classes from './{Component}.module.css' | ||
``` | ||
|
||
- Add CSS classes behind the `primer_react_css_modules_team` feature flag. For guidelines on how to write styles, see our [CSS authoring guide](./authoring-css.md) | ||
|
||
5. **Ensure Component still accepts `sx` styling** | ||
|
||
- Until we migrate all uses of `sx`, we need to ensure the component will accept `sx` props inside the feature flag. This will often default to using the `Box` component if an `sx` prop is passed in. | ||
|
||
```jsx | ||
const enabled = useFeatureFlag('primer_react_css_modules_team') | ||
if (enabled) { | ||
if (sxProp !== defaultSxProp) { | ||
/* Use of Box here to support sx props */ | ||
return <Box as="div" sx={sxProp} {...props} /> | ||
} | ||
return <div {...props} /> | ||
} | ||
``` | ||
|
||
6. **Ensure Component accepts `className` along with our CSS Module class name** | ||
|
||
### Testing the Migration | ||
|
||
- **Support for `className`:** | ||
- Ensure the component works properly with the `className` prop. This will need a feature flag turned on when testing like this. | ||
```js | ||
it('should support `className` on the outermost element', () => { | ||
const Element = () => <Component className={'test-class-name'} /> | ||
const FeatureFlagElement = () => { | ||
return ( | ||
<FeatureFlags | ||
flags={{ | ||
primer_react_css_modules_team: true, | ||
primer_react_css_modules_staff: true, | ||
primer_react_css_modules_ga: true, | ||
}} | ||
> | ||
<Element /> | ||
</FeatureFlags> | ||
) | ||
} | ||
expect(render(<Element />).container.firstChild).toHaveClass('test-class-name') | ||
expect(render(<FeatureFlagElement />).container.firstChild).toHaveClass('test-class-name') | ||
}) | ||
``` | ||
- **Regression Testing:** | ||
- Validate that no visual regressions occur when the feature flag is enabled. The `vrt*` tests are setup to compare the feature flagged component with the original component and will fail if there is a mismatch. | ||
- **Handling `sx` Prop:** | ||
- Confirm the `sx` prop behaves correctly with the feature flag enabled. | ||
|
||
--- | ||
|
||
## Releasing a Component | ||
|
||
- **Merge Process:** | ||
- Once merged into Dotcom, the component will be part of the `primer_react_css_modules_team` rollout. | ||
- We progress components through levels of feature flags as we roll them out to make sure we address any bugs with the minimum amount of audience. | ||
- **Monitor Team Ship:** | ||
- Watch for any issues or regressions during the team ship phase. If anything is spotted, [create an issue in `github/primer`](https://github.com/github/primer/issues/new?template=04-bug-report.yml) and let us know in the [#primer slack channel](https://github-grid.enterprise.slack.com/archives/CSGAVNZ19). |
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 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.