-
Notifications
You must be signed in to change notification settings - Fork 625
feat: add @primer/styled-react package #6417
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
17 commits
Select commit
Hold shift + click to select a range
a5dbefa
feat: add @primer/styled-react package
joshblack 2034662
Merge branch 'main' of github.com:primer/react into feat/add-styled-r…
joshblack ad4b7c9
docs: add package docs
joshblack 165f271
feat: add support for deprecated, experimental, and additional compon…
joshblack 6d8842d
chore: set explicit babel helpers option
joshblack 0d1e801
chore: remove TextProps export
joshblack fd92156
test: add export tests for package
joshblack 5c57d43
chore: add lint disable
joshblack 6ea1c21
Merge branch 'main' of github.com:primer/react into feat/add-styled-r…
joshblack a4bf6ee
feat: add initial batch of sx components
joshblack 27fcb0d
chore: add changeset
joshblack 0faadad
chore: fix lint errors
joshblack 6ce63e0
docs: update readme
joshblack 8463b5e
Merge branch 'main' into feat/add-styled-react-package
joshblack c941367
Merge branch 'main' of github.com:primer/react into feat/add-styled-r…
joshblack 0c786ce
feat: add sx helpers
joshblack 1d60b44
Merge branch 'feat/add-styled-react-package' of github.com:primer/rea…
joshblack 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
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,5 @@ | ||
--- | ||
'@primer/styled-react': minor | ||
--- | ||
|
||
Create the `@primer/styled-react` package to help with bridging between styled-components and Primer React |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,33 @@ | ||
# @primer/styled-react | ||
|
||
> A temporary package that bridges the gap between Primer React and styled-components | ||
|
||
## Getting started | ||
|
||
To install `@primer/styled-react` in your project, you will need to run the following | ||
command using [npm](https://www.npmjs.com/): | ||
|
||
```bash | ||
npm install -S @primer/styled-react | ||
``` | ||
|
||
## Usage | ||
|
||
This is a pre-1.0 package designed to interop between Primer and existing | ||
styled-components usage. As a result, expect breaking changes between minor | ||
versions as components will be removed when their `sx` usage goes to zero. | ||
|
||
Each component that is imported from `@primer/styled-react` is a wrapper around | ||
the corresponding component in `@primer/react`. The notable difference is that | ||
these components support the `sx` prop and styled system props. | ||
|
||
By default, each component is deprecated. The intent is to transition code over | ||
to an alternative styling solution, such as CSS Modules. | ||
|
||
## 📖 Documentation | ||
|
||
The documentation for `@primer/react` lives at [primer.style](https://primer.style). There, you'll find detailed documentation on getting started, all of the components, our theme, our principles, and more. | ||
|
||
## 🙌 Contributing | ||
|
||
We love collaborating with folks inside and outside of GitHub and welcome contributions! If you're interested, check out our [contributing docs](contributor-docs/CONTRIBUTING.md) for more info on how to get started. |
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,67 @@ | ||
{ | ||
"name": "@primer/styled-react", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"exports": { | ||
".": { | ||
"types": "dist/index.d.ts", | ||
"default": "dist/index.js" | ||
}, | ||
"./deprecated": { | ||
"types": "dist/deprecated.d.ts", | ||
"default": "dist/deprecated.js" | ||
}, | ||
"./experimental": { | ||
"types": "dist/experimental.d.ts", | ||
"default": "dist/experimental.js" | ||
} | ||
}, | ||
"files": [ | ||
"README.md", | ||
"dist" | ||
], | ||
"scripts": { | ||
"build": "script/build", | ||
"clean": "rimraf dist", | ||
"type-check": "tsc --noEmit" | ||
}, | ||
"devDependencies": { | ||
"@babel/preset-typescript": "^7.27.1", | ||
"@primer/react": "^37.29.1", | ||
"@rollup/plugin-babel": "^6.0.4", | ||
"@types/react": "18.3.11", | ||
"@types/react-dom": "18.3.1", | ||
"react": "18.3.1", | ||
"react-dom": "18.3.1", | ||
"rimraf": "^6.0.1", | ||
"rollup": "4.45.1", | ||
"rollup-plugin-typescript2": "^0.36.0", | ||
"styled-components": "5.3.11", | ||
"typescript": "^5.8.2" | ||
}, | ||
"peerDependencies": { | ||
"@primer/react": "^37.29.1", | ||
"@types/react": "18.x || 19.x", | ||
"@types/react-dom": "18.x || 19.x", | ||
"@types/react-is": "18.x || 19.x", | ||
"@types/styled-components": "^5.1.11", | ||
"react": "18.x || 19.x", | ||
"react-dom": "18.x || 19.x", | ||
"react-is": "18.x || 19.x", | ||
"styled-components": "5.x" | ||
}, | ||
"peerDependenciesMeta": { | ||
"@types/react": { | ||
"optional": true | ||
}, | ||
"@types/react-dom": { | ||
"optional": true | ||
}, | ||
"@types/react-is": { | ||
"optional": true | ||
}, | ||
"@types/styled-components": { | ||
"optional": true | ||
} | ||
} | ||
} |
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,33 @@ | ||
import babel from '@rollup/plugin-babel' | ||
import {defineConfig} from 'rollup' | ||
import typescript from 'rollup-plugin-typescript2' | ||
import packageJson from './package.json' with {type: 'json'} | ||
|
||
const dependencies = [ | ||
...Object.keys(packageJson.peerDependencies ?? {}), | ||
...Object.keys(packageJson.dependencies ?? {}), | ||
...Object.keys(packageJson.devDependencies ?? {}), | ||
] | ||
|
||
function createPackageRegex(name) { | ||
return new RegExp(`^${name}(/.*)?`) | ||
} | ||
|
||
export default defineConfig({ | ||
input: ['src/index.ts', 'src/experimental.ts', 'src/deprecated.ts'], | ||
external: dependencies.map(createPackageRegex), | ||
plugins: [ | ||
typescript({ | ||
tsconfig: 'tsconfig.build.json', | ||
}), | ||
babel({ | ||
presets: ['@babel/preset-typescript'], | ||
extensions: ['.ts', '.tsx'], | ||
babelHelpers: 'bundled', | ||
}), | ||
], | ||
output: { | ||
dir: 'dist', | ||
format: 'esm', | ||
}, | ||
}) |
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,3 @@ | ||
#!/bin/bash | ||
|
||
npx rollup -c |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just double checking we're defaulting minor for all releases of this project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my default but no preference on my end!