Skip to content

Commit f0b62ae

Browse files
authored
Merge branch 'master' into docs/async-combobox
Signed-off-by: atomiks <cc.glows@gmail.com>
2 parents dbbfcf3 + 0e8ecf2 commit f0b62ae

File tree

720 files changed

+13789
-8467
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

720 files changed

+13789
-8467
lines changed

.circleci/config.yml

Lines changed: 24 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -72,43 +72,30 @@ commands:
7272
name: Install pnpm package manager
7373
# See https://stackoverflow.com/a/73411601
7474
command: corepack enable --install-directory ~/bin
75-
- run:
76-
name: Resolve React version
77-
command: |
78-
echo 'Using React version: << parameters.react-version >>'
79-
node scripts/useReactVersion.mjs
80-
# log a patch for maintainers who want to check out this change
81-
git --no-pager diff HEAD
8275
- run:
8376
name: View install environment
8477
command: |
8578
node --version
8679
pnpm --version
87-
- when:
88-
condition:
89-
equal: [<< parameters.react-version >>, stable]
90-
steps:
91-
- run:
92-
name: Install JS dependencies
93-
command: pnpm install
94-
- unless:
95-
condition:
96-
equal: [<< parameters.react-version >>, stable]
97-
steps:
98-
- run:
99-
name: Install JS dependencies (without frozen lockfile)
100-
command: pnpm install --no-frozen-lockfile
101-
- run:
102-
name: Restore clean working copy
103-
command: git restore .
80+
- run:
81+
name: Install js dependencies
82+
command: |
83+
args=""
84+
if [ -n "$REACT_VERSION" ] && [ "$REACT_VERSION" != "stable" ]; then
85+
args="react@$REACT_VERSION"
86+
fi
87+
if [ -n "$args" ]; then
88+
pnpm dlx @mui/internal-code-infra@canary set-version-overrides --pkg $args
89+
else
90+
pnpm install
91+
fi
10492
10593
jobs:
10694
test_unit:
10795
<<: *default-job
10896
steps:
10997
- checkout
110-
- install_js:
111-
react-version: << parameters.react-version >>
98+
- install_js
11299
- run:
113100
name: Run tests on JSDOM
114101
command: pnpm test:jsdom:coverage
@@ -129,8 +116,7 @@ jobs:
129116
<<: *default-job
130117
steps:
131118
- checkout
132-
- install_js:
133-
react-version: << parameters.react-version >>
119+
- install_js
134120
- run:
135121
name: '`pnpm prettier` changes committed?'
136122
command: |
@@ -147,18 +133,14 @@ jobs:
147133
- run:
148134
name: Stylelint
149135
command: pnpm stylelint
150-
- run:
151-
name: Lint JSON
152-
command: pnpm jsonlint
153136
- run:
154137
name: Lint Markdown
155138
command: pnpm markdownlint
156139
test_static:
157140
<<: *default-job
158141
steps:
159142
- checkout
160-
- install_js:
161-
react-version: << parameters.react-version >>
143+
- install_js
162144
- run:
163145
name: '`pnpm dedupe` was run?'
164146
command: |
@@ -195,16 +177,15 @@ jobs:
195177
resource_class: 'medium+'
196178
steps:
197179
- checkout
198-
- install_js:
199-
react-version: << parameters.react-version >>
180+
- install_js
200181
- run:
201182
name: Tests TypeScript definitions
202183
command: pnpm typescript
203184
environment:
204185
NODE_OPTIONS: --max-old-space-size=3072
205186
- run:
206187
name: Any defect declaration files?
207-
command: node scripts/testBuiltTypes.mjs
188+
command: pnpm code-infra validate-built-types
208189
- save_cache:
209190
name: Save generated declaration files
210191
key: typescript-declaration-files-{{ .Branch }}-{{ .Revision }}
@@ -216,8 +197,7 @@ jobs:
216197
resource_class: 'medium+'
217198
steps:
218199
- checkout
219-
- install_js:
220-
react-version: << parameters.react-version >>
200+
- install_js
221201
- run:
222202
name: Resolve typescript version
223203
command: |
@@ -240,17 +220,16 @@ jobs:
240220
# Fixing these takes some effort that isn't viable to merge in a single PR.
241221
# We'll simply monitor them for now.
242222
set +e
243-
node scripts/testBuiltTypes.mjs
223+
pnpm code-infra validate-built-types
244224
exit 0
245225
test_browser:
246226
<<: *default-job
247227
resource_class: 'medium+'
248228
docker:
249-
- image: mcr.microsoft.com/playwright:v1.55.1-noble
229+
- image: mcr.microsoft.com/playwright:v1.56.1-noble
250230
steps:
251231
- checkout
252232
- install_js:
253-
react-version: << parameters.react-version >>
254233
browsers: true
255234
- run:
256235
name: Run tests on headless Chromium
@@ -271,11 +250,10 @@ jobs:
271250
test_regressions:
272251
<<: *default-job
273252
docker:
274-
- image: mcr.microsoft.com/playwright:v1.55.1-noble
253+
- image: mcr.microsoft.com/playwright:v1.56.1-noble
275254
steps:
276255
- checkout
277256
- install_js:
278-
react-version: << parameters.react-version >>
279257
browsers: true
280258
- run:
281259
name: Run visual regression tests
@@ -286,7 +264,7 @@ jobs:
286264
test_e2e:
287265
<<: *default-job
288266
docker:
289-
- image: mcr.microsoft.com/playwright:v1.55.1-noble
267+
- image: mcr.microsoft.com/playwright:v1.56.1-noble
290268
steps:
291269
- checkout
292270
- install_js:
@@ -299,14 +277,13 @@ jobs:
299277
<<: *default-job
300278
steps:
301279
- checkout
302-
- install_js:
303-
react-version: << parameters.react-version >>
280+
- install_js
304281
- run:
305282
name: Build packages
306283
command: pnpm release:build
307284
- run:
308285
name: Validate type declarations
309-
command: pnpm validate-declarations
286+
command: pnpm code-infra validate-built-types
310287
- run:
311288
name: Check public types
312289
command: pnpm -r run release:test

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ jobs:
2727
# fetch all tags which are required for `pnpm release:changelog`
2828
fetch-depth: 0
2929
- name: Set up pnpm
30-
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
30+
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
3131
- name: Use Node.js 22.x
32-
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
32+
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
3333
with:
3434
node-version: '22.18'
3535
cache: 'pnpm' # https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-dependencies

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2020
# Initializes the CodeQL tools for scanning.
2121
- name: Initialize CodeQL
22-
uses: github/codeql-action/init@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.30.6
22+
uses: github/codeql-action/init@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0
2323
with:
2424
languages: typescript
2525
config-file: ./.github/codeql/codeql-config.yml
@@ -30,4 +30,4 @@ jobs:
3030
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
3131
# queries: security-extended,security-and-quality
3232
- name: Perform CodeQL Analysis
33-
uses: github/codeql-action/analyze@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.30.6
33+
uses: github/codeql-action/analyze@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0

.github/workflows/scorecards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ jobs:
4040
publish_results: true
4141
# Upload the results to GitHub's code scanning dashboard.
4242
- name: Upload to code-scanning
43-
uses: github/codeql-action/upload-sarif@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.30.6
43+
uses: github/codeql-action/upload-sarif@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0
4444
with:
4545
sarif_file: results.sarif

.markdownlint-cli2.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ export default {
77
config: {
88
...baseline.config,
99
MD038: false, // false positives in MDX
10+
MD041: false, // false positives in MDX
1011
},
1112
};

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This repository contains the source code and documentation for Base UI: a headl
1313
## Code guidelines
1414

1515
- Always use the `useTimeout` utility from `@base-ui-components/utils/useTimeout` instead of `window.setTimeout`, and `useAnimationFrame` from `@base-ui-components/utils/useAnimationFrame` instead of `requestAnimationFrame`. Search for other example usage in the codebase if unsure how to use them.
16-
- Use the `useEventCallback` utility from `@base-ui-components/utils/useEventCallback` instead of `React.useCallback` if the function is called within an effect or event handler. The utility cannot be used to memoize functions that are called directly in the body of a component (during render), so continue with `React.useCallback` in those scenarios.
16+
- Use the `useStableCallback` utility from `@base-ui-components/utils/useStableCallback` instead of `React.useCallback` if the function is called within an effect or event handler. The utility cannot be used to memoize functions that are called directly in the body of a component (during render), so continue with `React.useCallback` in those scenarios.
1717
- Always use the `useIsoLayoutEffect` utility from `@base-ui-components/utils/useIsoLayoutEffect` instead of `React.useLayoutEffect`.
1818
- Avoid duplicating logic where necessary. If two components can share logic (such as event handlers), define the logic/handlers in the parent and share it through a context to the child; use the existing context if it exists.
1919

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ To see the latest updates, check out the [releases](https://base-ui.com/react/ov
2525
## Team
2626

2727
- **Colm Tuite** (Radix) [@colmtuite](https://x.com/colmtuite)
28-
- **Vlad Moroz** (Radix) [@vladyslavmoroz](https://x.com/vladyslavmoroz)
2928
- **James Nelson** (Floating UI) [@atomiksdev](https://x.com/atomiksdev)
3029
- **Michał Dudak** (Material UI) [@michaldudak](https://x.com/michaldudak)
3130
- **Marija Najdova** (Material UI + Fluent UI) [@marijanajdova](https://x.com/marijanajdova)
3231
- **Albert Yu** (Material UI) [@mj12albert](https://github.com/mj12albert)
32+
- **Lukas Tyla** (Material UI) [@LukasTy](https://github.com/LukasTy)
3333

3434
## License
3535

babel.config.mjs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
import getBaseConfig from '@mui/internal-code-infra/babel-config';
2+
import * as path from 'node:path';
3+
import { fileURLToPath } from 'node:url';
4+
5+
const dirname = path.dirname(fileURLToPath(import.meta.url));
6+
7+
const errorCodesPath = path.join(dirname, 'docs/src/error-codes.json');
28

39
export default function getBabelConfig(api) {
410
const baseConfig = getBaseConfig(api);
511

12+
const plugins = [
13+
[
14+
'@mui/internal-babel-plugin-minify-errors',
15+
{
16+
missingError: 'annotate',
17+
runtimeModule: '#formatErrorMessage',
18+
detection: 'opt-out',
19+
errorCodesPath,
20+
},
21+
],
22+
];
23+
624
return {
725
...baseConfig,
26+
plugins: [...baseConfig.plugins, ...plugins],
827
overrides: [
928
{
1029
exclude: /\.test\.(js|ts|tsx)$/,

docs/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,20 @@ Package managers other than pnpm (like npm or Yarn) are not supported and will n
1616

1717
[You can follow this guide](https://github.com/mui/base-ui/blob/HEAD/CONTRIBUTING.md)
1818
on how to get started contributing to Base UI.
19+
20+
## Error code extraction
21+
22+
Errors in production are minified. They are extracted out of the source code by running the command
23+
24+
```bash
25+
pnpm extract-error-codes
26+
```
27+
28+
This updates the `./src/error-codes.json` file with the newly extracted errors.
29+
30+
Important: If you just altered the text of an error, you are allowed to update the existing error code with the new text in `./src/error-codes.json`, but only under the following conditions:
31+
32+
1. There hasn't been an update to the semantic meaning of the error message. Error codes need to outlive Base UI versions, so the same code must mean the same thing across versions.
33+
2. There hasn't been a change in parameters, no added and no removed.
34+
35+
In both of those cases, always create a new error code lline in `./src/error-codes.json`.

docs/next.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import * as path from 'path';
33
import * as url from 'url';
44
import * as fs from 'fs';
5-
import withDocsInfra from '@mui/monorepo/docs/nextConfigDocsInfra.js';
5+
import { withDeploymentConfig } from '@mui/internal-docs-infra/withDocsInfra';
66
import nextMdx from '@next/mdx';
77
import rehypeExtractToc from '@stefanprobst/rehype-extract-toc';
88
import remarkGfm from 'remark-gfm';
@@ -59,7 +59,7 @@ const nextConfig = {
5959
devIndicators: false,
6060
};
6161

62-
const mergedConfig = withMdx(withDocsInfra(nextConfig));
62+
const mergedConfig = withMdx(withDeploymentConfig(nextConfig));
6363

6464
if (!process.env.CI) {
6565
delete mergedConfig.experimental?.cpus;

0 commit comments

Comments
 (0)