Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
chaance authored Sep 26, 2024
2 parents 354f9c8 + 6ac3863 commit a9e167f
Show file tree
Hide file tree
Showing 237 changed files with 12,970 additions and 13,156 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
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
14 changes: 7 additions & 7 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,40 +55,40 @@ cd primitives
git remote add upstream https://github.com/radix-ui/primitives.git
```

1. Synchronize your local `main` branch with the upstream remote:
3. Synchronize your local `main` branch with the upstream remote:

```sh
git checkout main
git pull upstream main
```

1. Make sure your Node version matches the [.nvmrc](../.nvmrc).
4. Make sure your Node version matches the [.nvmrc](../.nvmrc).

```
node -v
```

1. Install dependencies with [yarn](https://yarnpkg.com):
5. Install dependencies with [yarn](https://yarnpkg.com):

```sh
yarn install
```

1. Create a new branch related to your PR:
6. Create a new branch related to your PR:

```sh
git checkout -b my-bug-fix
```

6. Make changes, then commit and push to your forked repository:
7. Make changes, then commit and push to your forked repository:

```sh
git push -u origin HEAD
```

7. Go to [the repository](https://github.com/radix-ui/primitives) and [make a Pull Request](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).
8. Go to [the repository](https://github.com/radix-ui/primitives) and [make a Pull Request](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).

8. We will review your Pull Request and either merge it, request changes to it, or close it with an explanation.
9. We will review your Pull Request and either merge it, request changes to it, or close it with an explanation.

## Working locally

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.17.0
18
34 changes: 0 additions & 34 deletions .storybook/main.js

This file was deleted.

64 changes: 64 additions & 0 deletions .storybook/main.ts
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;
}, {});
}
5 changes: 0 additions & 5 deletions .storybook/manager.js

This file was deleted.

7 changes: 7 additions & 0 deletions .storybook/manager.ts
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,
});
9 changes: 0 additions & 9 deletions .storybook/preview.js

This file was deleted.

19 changes: 19 additions & 0 deletions .storybook/preview.ts
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;
9 changes: 0 additions & 9 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

This file was deleted.

367 changes: 0 additions & 367 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

This file was deleted.

28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

631 changes: 0 additions & 631 deletions .yarn/releases/yarn-3.0.1.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.0.cjs

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .yarn/versions/19bdd400.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
releases:
"@radix-ui/react-avatar": patch

declined:
- primitives
22 changes: 22 additions & 0 deletions .yarn/versions/8a3bd6ee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
releases:
"@radix-ui/react-accordion": patch
"@radix-ui/react-alert-dialog": patch
"@radix-ui/react-checkbox": patch
"@radix-ui/react-collapsible": patch
"@radix-ui/react-context-menu": patch
"@radix-ui/react-dialog": patch
"@radix-ui/react-dropdown-menu": patch
"@radix-ui/react-hover-card": patch
"@radix-ui/react-menu": patch
"@radix-ui/react-menubar": patch
"@radix-ui/react-navigation-menu": patch
"@radix-ui/react-popover": patch
"@radix-ui/react-presence": patch
"@radix-ui/react-radio-group": patch
"@radix-ui/react-scroll-area": patch
"@radix-ui/react-tabs": patch
"@radix-ui/react-toast": patch
"@radix-ui/react-tooltip": patch

declined:
- primitives
2 changes: 2 additions & 0 deletions .yarn/versions/96c502e7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declined:
- primitives
5 changes: 5 additions & 0 deletions .yarn/versions/a0df87d9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
releases:
"@radix-ui/react-checkbox": patch

declined:
- primitives
6 changes: 6 additions & 0 deletions .yarn/versions/a54ad5a9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
releases:
"@radix-ui/react-scroll-area": minor

declined:
- primitives
- ssr-testing
5 changes: 5 additions & 0 deletions .yarn/versions/cc138cf5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
releases:
"@radix-ui/react-select": patch

declined:
- primitives
5 changes: 5 additions & 0 deletions .yarn/versions/cccc0adb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
releases:
"@radix-ui/react-select": patch

declined:
- primitives
2 changes: 2 additions & 0 deletions .yarn/versions/f24f9512.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
releases:
"@radix-ui/react-select": patch
14 changes: 5 additions & 9 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ changesetIgnorePatterns:
- '**/*.test.{ts,tsx}'
- '**/*.stories.{ts,tsx}'

nodeLinker: node-modules
compressionLevel: mixed

enableGlobalCache: false

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: '@yarnpkg/plugin-typescript'
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: '@yarnpkg/plugin-version'
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.0.1.cjs
yarnPath: .yarn/releases/yarn-4.1.0.cjs
42 changes: 0 additions & 42 deletions babel.config.js

This file was deleted.

48 changes: 48 additions & 0 deletions build.mjs
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);
1 change: 1 addition & 0 deletions cypress/integration/Form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('Form', () => {
});

function checkControlMessageAssociation() {
cy.get('@control').should('have.attr', 'aria-describedby');
cy.get('@control')
.invoke('attr', 'aria-describedby')
.then((ariaDescribedby) =>
Expand Down
Loading

0 comments on commit a9e167f

Please sign in to comment.