-
Notifications
You must be signed in to change notification settings - Fork 823
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 select-empty-items
- Loading branch information
Showing
224 changed files
with
12,376 additions
and
13,059 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Add the following users as reviewers on new pull requests | ||
|
||
* @benoitgrelard @jjenzz @andy-hook | ||
* @StephenHaney @vladmoroz @lucasmotta @hadihallak @chaance |
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 |
---|---|---|
@@ -1 +1 @@ | ||
16.17.0 | ||
18 |
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,64 @@ | ||
import type { StorybookConfig } from '@storybook/react-webpack5'; | ||
import path from 'path'; | ||
|
||
const config: StorybookConfig = { | ||
stories: ['../packages/core/**/*.stories.tsx', '../packages/react/**/*.stories.tsx'], | ||
addons: [ | ||
getAbsolutePath('@storybook/addon-essentials'), | ||
getAbsolutePath('@storybook/addon-storysource'), | ||
], | ||
framework: { | ||
name: getAbsolutePath('@storybook/react-webpack5'), | ||
options: { | ||
builder: { | ||
useSWC: true, | ||
}, | ||
// enable React strict mode | ||
strictMode: true, | ||
}, | ||
}, | ||
swc: () => ({ | ||
jsc: { | ||
transform: { | ||
react: { | ||
// Do not require importing React into scope to use JSX | ||
runtime: 'automatic', | ||
}, | ||
}, | ||
}, | ||
}), | ||
|
||
// we need to add aliases to webpack so it knows how to follow | ||
// to the source of the packages rather than the built version (dist) | ||
webpackFinal: async (config) => ({ | ||
...config, | ||
resolve: { | ||
...config.resolve, | ||
alias: { | ||
...config.resolve.alias, | ||
...convertTsConfigPathsToWebpackAliases(), | ||
}, | ||
}, | ||
}), | ||
}; | ||
|
||
export default config; | ||
|
||
/** | ||
* This function is used to resolve the absolute path of a package. | ||
* It is needed in projects that use Yarn PnP or are set up within a monorepo. | ||
*/ | ||
function getAbsolutePath(value: string): any { | ||
return path.dirname(require.resolve(path.join(value, 'package.json'))); | ||
} | ||
|
||
function convertTsConfigPathsToWebpackAliases() { | ||
const rootDir = path.resolve(__dirname, '../'); | ||
const tsconfig = require('../tsconfig.json'); | ||
const tsconfigPaths: Array<string | string[]> = Object.entries(tsconfig.compilerOptions.paths); | ||
|
||
return tsconfigPaths.reduce((aliases, [realPath, mappedPath]) => { | ||
aliases[realPath] = path.join(rootDir, mappedPath[0]); | ||
return aliases; | ||
}, {}); | ||
} |
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,7 @@ | ||
import { addons } from '@storybook/manager-api'; | ||
import { themes } from '@storybook/theming'; | ||
|
||
addons.setConfig({ | ||
enableShortcuts: false, | ||
theme: themes.light, | ||
}); |
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,19 @@ | ||
import type { Preview } from '@storybook/react'; | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
// This should work after upgrading to Storybook 7.6 but doesn't. | ||
// I am leaving it commented out here so we can fix it one day. | ||
// | ||
// options: { | ||
// storySort: { | ||
// order: ['Components', 'Utilities'], | ||
// }, | ||
// }, | ||
|
||
// disables Chromatic on a global level | ||
chromatic: { disable: true }, | ||
}, | ||
}; | ||
|
||
export default preview; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
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,2 @@ | ||
declined: | ||
- primitives |
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,48 @@ | ||
import { globSync } from 'glob'; | ||
import * as esbuild from 'esbuild'; | ||
import * as tsup from 'tsup'; | ||
|
||
async function build(path) { | ||
const file = `${path}/src/index.ts`; | ||
const dist = `${path}/dist`; | ||
|
||
const esbuildConfig = { | ||
entryPoints: [file], | ||
external: ['@radix-ui/*'], | ||
packages: 'external', | ||
bundle: true, | ||
sourcemap: true, | ||
format: 'cjs', | ||
target: 'es2022', | ||
outdir: dist, | ||
}; | ||
|
||
await esbuild.build(esbuildConfig); | ||
console.log(`Built ${path}/dist/index.js`); | ||
|
||
await esbuild.build({ | ||
...esbuildConfig, | ||
format: 'esm', | ||
outExtension: { '.js': '.mjs' }, | ||
}); | ||
console.log(`Built ${path}/dist/index.mjs`); | ||
|
||
// tsup is used to emit d.ts files only (esbuild can't do that). | ||
// | ||
// Notes: | ||
// 1. Emitting d.ts files is super slow for whatever reason. | ||
// 2. It could have fully replaced esbuild (as it uses that internally), | ||
// but at the moment its esbuild version is somewhat outdated. | ||
// It’s also harder to configure and esbuild docs are more thorough. | ||
await tsup.build({ | ||
entry: [file], | ||
format: ['cjs', 'esm'], | ||
dts: { only: true }, | ||
outDir: dist, | ||
silent: true, | ||
external: [/@radix-ui\/.+/], | ||
}); | ||
console.log(`Built ${path}/dist/index.d.ts`); | ||
} | ||
|
||
globSync('packages/*/*').forEach(build); |
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 |
---|---|---|
|
@@ -12,47 +12,37 @@ | |
"types:check": "tsc --skipLibCheck --noEmit", | ||
"test": "jest", | ||
"test:ci": "yarn types:check && jest --ci && yarn cypress:ci", | ||
"storybook": "start-storybook -p 9009 --ci", | ||
"storybook": "BROWSER=none storybook dev -p 9009", | ||
"cypress:ci": "start-server-and-test storybook http://localhost:9009 cypress:run", | ||
"cypress:run": "cypress run", | ||
"cypress:dev": "cypress open", | ||
"dev": "yarn storybook", | ||
"build-storybook": "build-storybook", | ||
"// build": "For context on tsconfig replacements in build scripts, see https://github.com/radix-ui/primitives/pull/361#discussion_r555004944", | ||
"build": "yarn build:config && yarn build:packages && yarn build:cleanup", | ||
"build:config": "mv tsconfig.json tsconfig.tmp.json && mv tsconfig.production.json tsconfig.json", | ||
"build:packages": "parcel build 'packages/*/*/' --no-cache && yarn build:fix-type-defs", | ||
"build:fix-type-defs": "node ./scripts/fix-type-defs-imports", | ||
"build:cleanup": "mv tsconfig.json tsconfig.production.json && mv tsconfig.tmp.json tsconfig.json", | ||
"publish:stable": "yarn bump:stable && yarn clean && yarn build && yarn workspaces foreach -pv --exclude primitives --exclude ssr-testing npm publish --tolerate-republish --access public", | ||
"publish:next": "yarn bump:next && yarn clean && yarn build && yarn workspaces foreach -pv --exclude primitives --exclude ssr-testing npm publish --tolerate-republish --access public --tag next", | ||
"clean": "yarn workspaces foreach -pv --exclude primitives --exclude ssr-testing run clean", | ||
"reset": "yarn clean && rm -rf node_modules .yarn/cache .parcel-cache", | ||
"build-storybook": "storybook build", | ||
"build": "node build.mjs", | ||
"publish:stable": "yarn bump:stable && yarn clean && yarn build && yarn workspaces foreach -pvW --exclude primitives --exclude ssr-testing npm publish --tolerate-republish --access public", | ||
"publish:next": "yarn bump:next && yarn clean && yarn build && yarn workspaces foreach -pvW --exclude primitives --exclude ssr-testing npm publish --tolerate-republish --access public --tag next", | ||
"clean": "yarn workspaces foreach -pvW --exclude primitives --exclude ssr-testing run clean", | ||
"reset": "yarn clean && rm -rf node_modules .yarn/cache", | ||
"bump:stable": "yarn version apply --all", | ||
"bump:next": "yarn version apply --all --prerelease", | ||
"bump:check": "yarn version check" | ||
}, | ||
"dependencies": { | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0" | ||
"react": "^18.3.1", | ||
"react-dom": "^18.3.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.17.9", | ||
"@babel/plugin-transform-typescript": "^7.16.8", | ||
"@babel/preset-react": "^7.16.7", | ||
"@babel/template": "^7.16.7", | ||
"@parcel/babel-plugin-transform-runtime": "^2.4.1", | ||
"@parcel/babel-preset-env": "^2.4.1", | ||
"@parcel/packager-ts": "2.4.1", | ||
"@parcel/transformer-typescript-types": "2.4.1", | ||
"@stitches/core": "^1.2.8", | ||
"@storybook/addon-storysource": "^6.5.0-alpha.63", | ||
"@storybook/react": "^6.5.0-alpha.63", | ||
"@storybook/addon-essentials": "^7.6.17", | ||
"@storybook/addon-storysource": "^7.6.17", | ||
"@storybook/react": "^7.6.17", | ||
"@storybook/react-webpack5": "^7.6.17", | ||
"@storybook/test": "^7.6.17", | ||
"@testing-library/cypress": "^7.0.6", | ||
"@testing-library/dom": "^10.1.0", | ||
"@testing-library/jest-dom": "^5.16.4", | ||
"@testing-library/react": "^13.0.1", | ||
"@testing-library/react": "^16.0.0", | ||
"@testing-library/user-event": "^14.1.0", | ||
"@types/babel__template": "^7.4.1", | ||
"@types/eslint": "^7.28.0", | ||
"@types/fs-extra": "^11", | ||
"@types/jest": "^27.4.1", | ||
|
@@ -62,10 +52,9 @@ | |
"@types/react-test-renderer": "^18.0.0", | ||
"@typescript-eslint/eslint-plugin": "^5.19.0", | ||
"@typescript-eslint/parser": "^5.19.0", | ||
"babel-eslint": "^10.1.0", | ||
"babel-loader": "^8.2.4", | ||
"cypress": "^8.0.0", | ||
"cypress-real-events": "^1.5.0", | ||
"esbuild": "0.21.4", | ||
"eslint": "^7.32.0", | ||
"eslint-config-react-app": "^6.0.0", | ||
"eslint-plugin-cypress": "^2.11.3", | ||
|
@@ -74,20 +63,22 @@ | |
"eslint-plugin-jsx-a11y": "^6.3.1", | ||
"eslint-plugin-react": "^7.24.0", | ||
"eslint-plugin-react-hooks": "^4.2.0", | ||
"eslint-plugin-storybook": "^0.8.0", | ||
"fs-extra": "^11.1.1", | ||
"glob": "^10.2.2", | ||
"husky": "^4.3.6", | ||
"jest": "^27.5.1", | ||
"jest-axe": "^6.0.0", | ||
"jest-watch-typeahead": "^1.0.0", | ||
"lint-staged": "^10.5.3", | ||
"parcel": "2.4.1", | ||
"prettier": "^2.0.5", | ||
"pretty-quick": "^2.0.1", | ||
"react-test-renderer": "^18.0.0", | ||
"replace-in-files": "^3.0.0", | ||
"start-server-and-test": "^1.12.5", | ||
"start-server-and-test": "2.0.3", | ||
"storybook": "^7.6.17", | ||
"ts-jest": "^27.1.4", | ||
"tsup": "8.0.2", | ||
"typescript": "^4.6.3" | ||
}, | ||
"resolutions": { | ||
|
@@ -128,7 +119,8 @@ | |
"eslintConfig": { | ||
"extends": [ | ||
"react-app", | ||
"plugin:jsx-a11y/recommended" | ||
"plugin:jsx-a11y/recommended", | ||
"plugin:storybook/recommended" | ||
], | ||
"plugins": [ | ||
"jsx-a11y" | ||
|
@@ -182,5 +174,6 @@ | |
}, | ||
"lint-staged": { | ||
"*.{js,ts,tsx}": "eslint --quiet --fix --cache" | ||
} | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
Oops, something went wrong.