+
+
+
+
+
+
+
+
+ {/* number | { top } — absolute pixel scroll */}
+
+
+
+
+
+
+ {/* { key, align, offset } — scroll to an item */}
+
+
+
+
+ {/* { groupKey, align, offset } — scroll to a group header */}
+
+
+
+
+
+ last config:{' '}
+
+ {lastConfig === undefined ? '—' : JSON.stringify(lastConfig)}
+
+
+
+
{
+ const height = 40 + (index % 3) * 16;
+ return (
+
+ {item.name}
+
+ );
+ }}
+ group={{
+ key: (item) => item.group,
+ title: (key, groupItems) => (
+
+ {key} · {groupItems.length} items
+
+ ),
+ }}
+ />
+
+ );
+};
diff --git a/eslint.config.mjs b/eslint.config.mjs
index a298e8e..d9e494a 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -101,6 +101,7 @@ export default defineConfig([
files: ['tests/**/*.{js,jsx,ts,tsx}', '**/*.{test,spec}.{js,jsx,ts,tsx}'],
extends: [jest.configs['flat/recommended']],
rules: {
+ '@typescript-eslint/no-require-imports': 'off',
'jest/no-disabled-tests': 'off',
'jest/no-done-callback': 'off',
'jest/no-identical-title': 'off',
diff --git a/package.json b/package.json
index 2a6da82..08b79d5 100644
--- a/package.json
+++ b/package.json
@@ -32,22 +32,26 @@
"build": "dumi build",
"compile": "father build && lessc assets/index.less assets/index.css",
"prepublishOnly": "npm run compile && rc-np",
- "lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js",
+ "lint": "eslint src/ tests/ docs/examples/ --ext .tsx,.ts,.jsx,.js",
"test": "rc-test",
+ "prepare": "husky",
"prettier": "prettier --write .",
"coverage": "rc-test --coverage"
},
+ "lint-staged": {
+ "*.{ts,tsx,js,jsx,json,less,md}": "prettier --write"
+ },
"dependencies": {
"@rc-component/motion": "^1.1.4",
"@rc-component/portal": "^2.0.0",
"@rc-component/resize-observer": "^1.0.0",
"@rc-component/util": "^1.3.1",
- "clsx": "^2.1.1",
- "@rc-component/virtual-list": "^1.2.0"
+ "@rc-component/virtual-list": "^1.4.0",
+ "clsx": "^2.1.1"
},
"devDependencies": {
- "@eslint/js": "^10.0.1",
"@eslint/compat": "^2.1.0",
+ "@eslint/js": "^10.0.1",
"@rc-component/father-plugin": "^2.2.0",
"@rc-component/np": "^1.0.4",
"@testing-library/jest-dom": "^6.9.1",
@@ -66,7 +70,9 @@
"eslint-plugin-react-hooks": "^7.1.1",
"father": "^4.6.24",
"globals": "^17.7.0",
+ "husky": "^9.1.7",
"less": "^4.6.7",
+ "lint-staged": "^17.0.8",
"prettier": "^3.9.4",
"rc-test": "^7.1.3",
"react": "^19.2.7",
diff --git a/src/List.tsx b/src/List.tsx
index 0728fd8..d9ba9da 100644
--- a/src/List.tsx
+++ b/src/List.tsx
@@ -13,7 +13,9 @@ export type ListySemanticName = 'root' | 'item' | 'groupHeader';
export type ListyClassNames = Partial