Skip to content

[WIP] fix: RAC Tree DnD follow-up #8152

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

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f76c445
feat(s2): coachmarks (#7590)
jluyau Apr 22, 2025
2e9061d
fix: spelling mistake in style macros list-style-type (#8124)
ktabors Apr 23, 2025
9fe5629
chore: add portal provider to react-aria monopackage (#8135)
snowystinger Apr 25, 2025
63d4359
chore: TS update 5.8 (#8061)
snowystinger Apr 25, 2025
16ab6bf
support dropping on items
reidbarber Apr 25, 2025
145a58f
remove extraneous onKeyDown
reidbarber Apr 28, 2025
532ec4c
fix imports
reidbarber Apr 28, 2025
f87e28b
fix onInsert call
reidbarber Apr 28, 2025
1dd65ff
refactor: Generate stable style macro class names between versions (#…
devongovett Apr 28, 2025
c7c55cc
add back condition and fix tests
reidbarber Apr 28, 2025
74acbf9
add story for shouldAcceptItemDrop
reidbarber Apr 30, 2025
2951a95
fix rows in story
reidbarber Apr 30, 2025
6328d20
Fix menu keyboard shortcut icons background color when hovered/focuse…
LFDanLu Apr 30, 2025
e3b138d
update optimize-locales plugin types (#8087)
stefanprobst May 5, 2025
542e48d
fix ColorSlider className (#8190)
chirokas May 5, 2025
76debfe
use expand button as activate button
reidbarber May 6, 2025
d1c5587
doc(RAC): FileType docs TypeScript fix (#8172)
ktabors May 6, 2025
b07a79d
fix: Correct the PortalProvider's getContainer typings (#8185)
alexasselin008 May 7, 2025
b0c0454
refactor: Theme updates (#8155)
devongovett May 7, 2025
72fabca
chore: Update to Node 20 (#6385)
snowystinger May 7, 2025
804cc82
fix: react types backwards compat (#8099)
snowystinger May 7, 2025
0548d30
chore: Refactor codemods (#8056)
reidbarber May 7, 2025
e8bf328
fix(s2): Update dialog sizes (#8202)
devongovett May 7, 2025
2a2d571
fix(usePress): add global touch-action style for pressable elements (…
reidbarber May 8, 2025
4a371ec
Merge remote-tracking branch 'origin/main' into rac-tree-dnd-follow-up
reidbarber May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ orbs:
executors:
rsp:
docker:
- image: cimg/node:18.20.3
- image: cimg/node:20.18.2
environment:
CACHE_VERSION: v1
working_directory: ~/react-spectrum

rsp-large:
docker:
- image: cimg/node:18.20.3
- image: cimg/node:20.18.2
resource_class: large
environment:
CACHE_VERSION: v1
working_directory: ~/react-spectrum

rsp-xlarge:
docker:
- image: cimg/node:18.20.3
- image: cimg/node:20.18.2
resource_class: xlarge
environment:
CACHE_VERSION: v1
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/branch/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Branch from fork'
description: 'creates a branch based off PR from fork'
runs:
using: 'node18'
using: 'node20'
main: 'index.js'
2 changes: 1 addition & 1 deletion .github/actions/comment/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'PR Comment'
description: 'Comment on the PR attached to a commit'
runs:
using: 'node12'
using: 'node20'
main: 'index.js'
2 changes: 1 addition & 1 deletion .github/actions/permissions/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Check permissions'
description: 'Checks if commentor has write access or above'
runs:
using: 'node18'
using: 'node20'
main: 'index.js'
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.*
20.*
4 changes: 2 additions & 2 deletions .storybook-s2/docs/Colors.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function Colors() {
<Disclosure isQuiet>
<DisclosureTitle>Background colors</DisclosureTitle>
<DisclosurePanel>
<P>The <Code>backgroundColor</Code> property supports the following values, in addition to the semantic and global colors shown below. These colors are specifically chosen to be used as backgrounds, so prefer them over global colors where possible. Some background colors also automatically update according to states such as <Code>isHovered</Code> (see <Link href="#runtime-conditions" target="_self">runtime conditions</Link> below).</P>
<P>The <Code>backgroundColor</Code> property supports the following values, in addition to the semantic and global colors shown below. These colors are specifically chosen to be used as backgrounds, so prefer them over global colors where possible.</P>
<div className="sb-unstyled" style={{columnWidth: 120}}>
<Color name="base" className={colorSwatch('base')} />
<Color name="layer-1" className={colorSwatch('layer-1')} />
Expand Down Expand Up @@ -74,7 +74,7 @@ export function Colors() {
<Disclosure isQuiet>
<DisclosureTitle>Text colors</DisclosureTitle>
<DisclosurePanel>
<P>The <Code>color</Code> property supports the following values, in addition to the semantic and global colors shown below. These colors are specifically chosen to be used as text colors, so prefer them over global colors where possible. Some text colors also automatically update according to states such as <Code>isHovered</Code> (see <Link href="#runtime-conditions" target="_self">runtime conditions</Link> below).</P>
<P>The <Code>color</Code> property supports the following values, in addition to the semantic and global colors shown below. These colors are specifically chosen to be used as text colors, so prefer them over global colors where possible.</P>
<div className="sb-unstyled" style={{columnWidth: 120}}>
<Color name="accent" className={colorSwatch('accent', 'color')} />
<Color name="neutral" className={colorSwatch('neutral', 'color')} />
Expand Down
13 changes: 13 additions & 0 deletions .yarn/patches/@types-node-npm-20.14.13-41f92d384c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/buffer.d.ts b/buffer.d.ts
index 5d6c97d6b5d47fd189f795498aefd6b8d7713b7d..b9a22c4634fa6308006ae17d3527ff3c518a789d 100644
--- a/buffer.d.ts
+++ b/buffer.d.ts
@@ -629,7 +629,7 @@ declare module "buffer" {
*/
poolSize: number;
}
- interface Buffer extends Uint8Array {
+ interface Buffer extends Uint8Array<ArrayBuffer> {
/**
* Writes `string` to `buf` at `offset` according to the character encoding in`encoding`. The `length` parameter is the number of bytes to write. If `buf` did
* not contain enough space to fit the entire string, only part of `string` will be
2 changes: 1 addition & 1 deletion examples/remix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"vite-tsconfig-paths": "^4.2.1"
},
"engines": {
"node": ">=18.0.0"
"node": ">=20.0.0"
},
"workspaces": [
"../../packages/react-aria-components",
Expand Down
5 changes: 0 additions & 5 deletions lib/viewTransitions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,3 @@
interface Document {
startViewTransition(update: (() => void) | {update: () => void, types: string[]}): ViewTransition;
}

interface ViewTransition {
ready: Promise<void>;
finished: Promise<void>;
}
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"test-storybook": "test-storybook --url http://localhost:9003 --browsers chromium --no-cache",
"test:docs": "yarn playwright install && node scripts/testDocs.js",
"build": "make build",
"test:ssr": "cross-env STRICT_MODE=1 yarn jest --config jest.ssr.config.js",
"test:ssr": "cross-env STRICT_MODE=1 yarn jest --runInBand --config jest.ssr.config.js",
"ci-test": "cross-env STRICT_MODE=1 yarn jest --maxWorkers=2 && cross-env STRICT_MODE=1 yarn test:ssr --runInBand",
"lint": "concurrently \"yarn check-types\" \"eslint packages\" \"node scripts/lint-packages.js\" \"yarn constraints\"",
"jest": "jest",
Expand Down Expand Up @@ -101,7 +101,7 @@
"@parcel/transformer-svg-react": "^2.14.0",
"@parcel/transformer-typescript-types": "^2.14.0",
"@react-spectrum/s2-icon-builder": "^0.2.0",
"@spectrum-css/component-builder": "1.0.1",
"@spectrum-css/component-builder": "workspace:^",
"@spectrum-css/vars": "^2.3.0",
"@storybook/addon-a11y": "patch:@storybook/addon-a11y@npm%3A^7.6.19#~/.yarn/patches/@storybook-addon-a11y-npm-7.6.19-04b470eae0.patch",
"@storybook/addon-actions": "^7.6.19",
Expand Down Expand Up @@ -206,7 +206,7 @@
"tailwindcss": "^4.0.0",
"tailwindcss-animate": "^1.0.7",
"tempy": "^0.5.0",
"typescript": "^5.5.0",
"typescript": "^5.8.2",
"typescript-eslint": "^8.9.0",
"verdaccio": "^6.0.0",
"walk-object": "^4.0.0",
Expand Down Expand Up @@ -234,7 +234,10 @@
"recast": "0.23.6",
"ast-types": "0.16.1",
"svgo": "^3",
"@testing-library/user-event": "patch:@testing-library/user-event@npm%3A14.6.1#~/.yarn/patches/@testing-library-user-event-npm-14.6.1-5da7e1d4e2.patch"
"@testing-library/user-event": "patch:@testing-library/user-event@npm%3A14.6.1#~/.yarn/patches/@testing-library-user-event-npm-14.6.1-5da7e1d4e2.patch",
"@types/node@npm:*": "patch:@types/node@npm%3A20.14.13#~/.yarn/patches/@types-node-npm-20.14.13-41f92d384c.patch",
"@types/node@npm:^18.0.0": "patch:@types/node@npm%3A20.14.13#~/.yarn/patches/@types-node-npm-20.14.13-41f92d384c.patch",
"@types/node@npm:>= 8": "patch:@types/node@npm%3A20.14.13#~/.yarn/patches/@types-node-npm-20.14.13-41f92d384c.patch"
},
"@parcel/transformer-css": {
"cssModules": {
Expand Down
149 changes: 149 additions & 0 deletions packages/@adobe/spectrum-css-builder-temp/css/lib/varUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
/*
Copyright 2019 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

const gulp = require('gulp');
const postcss = require('postcss');
const concat = require('gulp-concat');
const through = require('through2');
const fsp = require('fs').promises;
const logger = require('gulplog');
const path = require('path');

function getVarsFromCSS(css) {
let variableList = [];
let root = postcss.parse(css);

root.walkRules((rule, ruleIndex) => {
rule.walkDecls((decl) => {
let matches = decl.value.match(/var\(.*?\)/g);
if (matches) {
matches.forEach(function (match) {
let varName = match.replace(/var\((--[\w-]+),?.*?\)/, '$1').trim();
if (variableList.indexOf(varName) === -1) {
variableList.push(varName);
}
});
}
});
});
return variableList;
}

function getVarValues(css) {
let root = postcss.parse(css);
let variables = {};

root.walkRules((rule, ruleIndex) => {
rule.walkDecls((decl) => {
variables[decl.prop] = decl.value;
});
});

return variables;
}

function getClassNames(contents, pkgName) {
let classNames = [];

if (classNames.length === 0) {
logger.error(`Could not find classNames for ${pkgName}, assuming no classNames`);
classNames.push('');
}

logger.debug(`Found classNames ${classNames.join(', ')} for ${pkgName}`);

return classNames;
}

function resolveValue(value, vars) {
if (value) {
let match = value.match(/var\((.+),?.*?\)/);
if (match) {
return match[1];
}
return value;
}
}

const varDir = path.join(path.dirname(require.resolve('@spectrum-css/vars')), '..');

async function readDNAVariables(file) {
let css = await fsp.readFile(path.join(varDir, 'css', file));
let vars = getVarValues(css);
return vars;
}

function getVariableDeclarations(classNames, vars) {
let varNames = Object.keys(vars);
if (varNames.length) {
return `
${classNames.map((className) => `${className}`).join(',\n')} {
${varNames.map((varName) => ` ${varName}: ${vars[varName]};`).join('\n')}
}
`;
}

return '';
}

function getAllVars() {
return new Promise((resolve, reject) => {
let variableList;

gulp.src([
`${varDir}/css/themes/*.css`,
`${varDir}/css/scales/*.css`,
`${varDir}/css/components/*.css`,
`${varDir}/css/globals/*.css`
])
.pipe(concat('everything.css'))
.pipe(through.obj(function getAllVars(file, enc, cb) {
variableList = getVarValues(file.contents.toString());

cb(null, file);
}))
.on('finish', () => {
resolve(variableList);
})
.on('error', reject);
});
}

function getAllComponentVars() {
return new Promise((resolve, reject) => {
let variableList;

gulp.src([
`${varDir}/css/components/*.css`,
`${varDir}/css/globals/*.css`
])
.pipe(concat('everything.css'))
.pipe(through.obj(function getAllVars(file, enc, cb) {
variableList = getVarValues(file.contents.toString());

cb(null, file);
}))
.on('finish', () => {
resolve(variableList);
})
.on('error', reject);
});
}

exports.getAllComponentVars = getAllComponentVars;
exports.getAllVars = getAllVars;
exports.getVarsFromCSS = getVarsFromCSS;
exports.getVarValues = getVarValues;
exports.getClassNames = getClassNames;
exports.resolveValue = resolveValue;
exports.readDNAVariables = readDNAVariables;
exports.getVariableDeclarations = getVariableDeclarations;
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
Copyright 2019 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
var valueParser = require('postcss-value-parser');
let varUtils = require('../lib/varUtils.js');

// match custom property inclusions
const customPropertiesRegExp = /(^|[^\w-])var\([\W\w]+\)/;

let staticVars;
let allVars;
async function fetchVars() {
if (staticVars && allVars) {
return true;
}

// Read in all static vars
staticVars = Object.assign(
{},
await varUtils.readDNAVariables('globals/spectrum-staticAliases.css'),
await varUtils.readDNAVariables('globals/spectrum-fontGlobals.css'),
await varUtils.readDNAVariables('globals/spectrum-fontGlobals.css'),
await varUtils.readDNAVariables('globals/spectrum-dimensionGlobals.css'),
await varUtils.readDNAVariables('globals/spectrum-colorGlobals.css'),
await varUtils.readDNAVariables('globals/spectrum-animationGlobals.css')
);

// Read in all variables so we have the value they resolve to
allVars = await varUtils.getAllComponentVars();

return true;
}

let fetchVarsPromise;
module.exports = function () {
return {
postcssPlugin: 'postcss-custom-properties-mapping',
OnceExit: async function (root, result) {
fetchVarsPromise ??= fetchVars();
await fetchVarsPromise;

root.walkRules((rule, ruleIndex) => {
rule.walkDecls((decl) => {
if (customPropertiesRegExp.test(decl.value)) {
let value = valueParser(decl.value);

value.walk((node, index, nodes) => {
if (node.type === 'function' && node.value === 'var') {
let v = node.nodes[0].value;

// If the value is static, replace the variable with the value.
// Otherwise, change the variable name to the mapped name.
if (staticVars[v]) {
nodes.splice(index, 1, ...valueParser(`var(${v}, ${staticVars[v]})`).nodes);
} else if (allVars[v]) {
nodes.splice(index, 1, ...valueParser(`var(${v}, ${allVars[v]})`).nodes);
}
}
});

decl.value = value.toString();
}
});
});
}
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
Copyright 2019 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

module.exports = function (opts) {
opts = opts || {};

return function (root, result) {
root.walkRules((rule, ruleIndex) => {
rule.walkDecls((decl) => {
if (decl.value.match('xvar(.*?)')) {
decl.value = decl.value.substr(1);
}
if (decl.prop.substr(0, 3) === 'x--') {
decl.prop = decl.prop.substr(1);
}
});
});
};
};
Loading