From d8e2fcb9f5dec172db718921f413a9a076e77190 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 26 Jun 2026 12:38:05 +0800 Subject: [PATCH 01/33] chore: standardize repository setup --- .dumirc.ts | 9 +- .github/FUNDING.yml | 2 + .../workflows/cloudflare-pages-preview.yml | 38 ++ .github/workflows/react-component-ci.yml | 4 +- .github/workflows/react-doctor.yml | 27 ++ .github/workflows/site-deploy.yml | 10 +- .github/workflows/surge-preview.yml | 34 ++ README.md | 341 ++++++------------ package.json | 6 +- vercel.json | 5 +- 10 files changed, 233 insertions(+), 243 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/cloudflare-pages-preview.yml create mode 100644 .github/workflows/react-doctor.yml create mode 100644 .github/workflows/surge-preview.yml diff --git a/.dumirc.ts b/.dumirc.ts index 95ecbc3..4d5d601 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -2,8 +2,13 @@ import { defineConfig } from 'dumi'; import path from 'path'; -const basePath = process.env.GITHUB_ACTIONS ? '/collapse/' : '/'; -const publicPath = process.env.GITHUB_ACTIONS ? '/collapse/' : '/'; +const isProdSite = + process.env.PREVIEW !== 'true' && + process.env.VERCEL !== '1' && + process.env.NODE_ENV === 'production'; + +const basePath = isProdSite ? '/collapse/' : '/'; +const publicPath = isProdSite ? '/collapse/' : '/'; export default defineConfig({ alias: { diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..758659a --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: ant-design +open_collective: ant-design diff --git a/.github/workflows/cloudflare-pages-preview.yml b/.github/workflows/cloudflare-pages-preview.yml new file mode 100644 index 0000000..c1738df --- /dev/null +++ b/.github/workflows/cloudflare-pages-preview.yml @@ -0,0 +1,38 @@ +name: Cloudflare Pages Preview + +on: + pull_request: + +permissions: + contents: read + deployments: write + +jobs: + preview: + runs-on: ubuntu-latest + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + CLOUDFLARE_PAGES_PROJECT: ${{ vars.CLOUDFLARE_PAGES_PROJECT }} + PREVIEW: true + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + with: + persist-credentials: false + - name: Skip Cloudflare Pages preview + if: ${{ env.CLOUDFLARE_API_TOKEN == '' || env.CLOUDFLARE_ACCOUNT_ID == '' || env.CLOUDFLARE_PAGES_PROJECT == '' }} + run: echo "Cloudflare Pages preview is not configured; skip deployment." + - name: Install dependencies + if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PAGES_PROJECT != '' }} + run: npm install + - name: Build site + if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PAGES_PROJECT != '' }} + run: npm run build + - name: Deploy preview + if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PAGES_PROJECT != '' }} + uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 + with: + apiToken: ${{ env.CLOUDFLARE_API_TOKEN }} + accountId: ${{ env.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy dist --project-name=${{ env.CLOUDFLARE_PAGES_PROJECT }} --branch=${{ github.head_ref }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml index 5735e2d..f8482b6 100644 --- a/.github/workflows/react-component-ci.yml +++ b/.github/workflows/react-component-ci.yml @@ -2,5 +2,5 @@ name: ✅ test on: [push, pull_request] jobs: test: - uses: react-component/rc-test/.github/workflows/test.yml@main - secrets: inherit \ No newline at end of file + uses: react-component/rc-test/.github/workflows/test-utoo.yml@main + secrets: inherit diff --git a/.github/workflows/react-doctor.yml b/.github/workflows/react-doctor.yml new file mode 100644 index 0000000..f68281c --- /dev/null +++ b/.github/workflows/react-doctor.yml @@ -0,0 +1,27 @@ +name: React Doctor + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + push: + branches: [master] + +permissions: + contents: read + pull-requests: write + issues: write + statuses: write + +concurrency: + group: react-doctor-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + react-doctor: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + with: + fetch-depth: 0 + persist-credentials: false + - uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3 diff --git a/.github/workflows/site-deploy.yml b/.github/workflows/site-deploy.yml index 8f12507..fcd35a2 100644 --- a/.github/workflows/site-deploy.yml +++ b/.github/workflows/site-deploy.yml @@ -13,12 +13,14 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@v3 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + with: + persist-credentials: false - name: setup node - uses: actions/setup-node@v1 + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e with: - node-version: 14 + node-version: 20 - name: create package-lock.json run: npm i --package-lock-only --ignore-scripts @@ -30,7 +32,7 @@ jobs: run: npm run build - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@329bcc8f12caed2cefe5a5b80781499a6f3b361b with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./dist diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml new file mode 100644 index 0000000..b7986b6 --- /dev/null +++ b/.github/workflows/surge-preview.yml @@ -0,0 +1,34 @@ +name: Surge Preview + +on: + pull_request: + +permissions: + contents: read + pull-requests: write + checks: write + +jobs: + preview: + runs-on: ubuntu-latest + env: + SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} + PREVIEW: true + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + with: + persist-credentials: false + - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec + if: ${{ env.SURGE_TOKEN != '' }} + with: + surge_token: ${{ env.SURGE_TOKEN }} + github_token: ${{ secrets.GITHUB_TOKEN }} + dist: dist + failOnError: true + setCommitStatus: true + build: | + npm install + npm run build + - name: Skip Surge preview + if: ${{ env.SURGE_TOKEN == '' }} + run: echo "SURGE_TOKEN is not configured; skip Surge preview." diff --git a/README.md b/README.md index 96ceda1..358fa49 100644 --- a/README.md +++ b/README.md @@ -1,250 +1,123 @@ -# rc-collapse +
+

@rc-component/collapse

+

🪗 A flexible collapse and accordion component for React.

-rc-collapse ui component for react + + Ant Design + -[![NPM version][npm-image]][npm-url] [![build status][github-actions-image]][github-actions-url] [![Test coverage][codecov-image]][codecov-url] [![npm download][download-image]][download-url] +

Part of the Ant Design ecosystem.

-[npm-image]: http://img.shields.io/npm/v/rc-collapse.svg?style=flat-square -[npm-url]: http://npmjs.org/package/rc-collapse -[github-actions-image]: https://github.com/react-component/collapse/workflows/CI/badge.svg -[github-actions-url]: https://github.com/react-component/collapse/actions +[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url] + +
+ +[npm-image]: https://img.shields.io/npm/v/@rc-component/collapse.svg?style=flat-square +[npm-url]: https://npmjs.org/package/@rc-component/collapse +[github-actions-image]: https://github.com/react-component/collapse/actions/workflows/react-component-ci.yml/badge.svg +[github-actions-url]: https://github.com/react-component/collapse/actions/workflows/react-component-ci.yml [codecov-image]: https://img.shields.io/codecov/c/github/react-component/collapse/master.svg?style=flat-square [codecov-url]: https://app.codecov.io/gh/react-component/collapse -[download-image]: https://img.shields.io/npm/dm/rc-collapse.svg?style=flat-square -[download-url]: https://npmjs.org/package/rc-collapse +[download-image]: https://img.shields.io/npm/dm/@rc-component/collapse.svg?style=flat-square +[download-url]: https://npmjs.org/package/@rc-component/collapse +[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/%40rc-component%2Fcollapse?style=flat-square +[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/collapse +[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square +[dumi-url]: https://github.com/umijs/dumi -## Live Demo +## Highlights -https://collapse-react-component.vercel.app +- Supports accordion and multi-panel collapse modes. +- Prefer the `items` API for declarative panel configuration. +- Keeps `Collapse.Panel` for compatibility. It is deprecated and will be removed in v4. +- Supports custom expand icons, semantic class names, semantic styles, and motion. ## Install -[![rc-collapse](https://nodei.co/npm/rc-collapse.png)](https://npmjs.org/package/rc-collapse) +```bash +npm install @rc-component/collapse +``` ## Usage -```js -var Collapse = require('rc-collapse'); -var Panel = Collapse.Panel; -var React = require('react'); -var ReactDOM = require('react-dom'); -require('rc-collapse/assets/index.css'); - -var App = ( - - - this is panel content - - this is panel content2 or other - -); -ReactDOM.render(App, container); +```tsx | pure +import Collapse from '@rc-component/collapse'; +import '@rc-component/collapse/assets/index.css'; + +export default function App() { + return ( + + ); +} ``` -## Features - -- support ie8,ie8+,chrome,firefox,safari - -## API - -### Collapse props - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
nametypedefaultdescription
activeKeyString|ArrayThe first panel keycurrent active Panel key
classNameString or objectcustom className to apply
defaultActiveKeyString|Arraynulldefault active key
destroyOnHiddenBooleanfalseIf destroy the panel which not active, default false.
accordionBooleanfalseaccordion mode, default is null, is collapse mode
onChangeFunction(key)noopcalled when collapse Panel is changed
expandIcon(props: PanelProps) => ReactNodespecific the custom expand icon.
collapsible'header' | 'icon' | 'disabled'-specify whether the panel of children is collapsible or the area of collapsible.
items - interface.ts#ItemType - -collapse items content
- -If `accordion` is null or false, every panel can open. Opening another panel will not close any of the other panels. `activeKey` should be an string, if passing an array (the first item in the array will be used). - -If `accordion` is true, only one panel can be open. Opening another panel will cause the previously opened panel to close. `activeKey` should be an string, if passing an array (the first item in the array will be used). - -### Collapse.Panel props +## Examples -> **deprecated** use `items` instead, will be removed in `v4.0.0` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
nametypedefaultdescription
headerString or nodeheader content of Panel
headerClassString' 'custom className to apply to header
showArrowbooleantrueshow arrow beside header
classNameString or objectcustom className to apply
classNames{ header?: string, body?: string }Semantic structure className
styleobjectcustom style
styles{ header?: React.CSSProperties, body?: React.CSSProperties }Semantic structure styles
openMotionobjectset the animation of open behavior, [more](https://github.com/react-component/motion). Different with v2, closed pane use a `rc-collapse-content-hidden` class to set `display: none` for hidden.
forceRenderbooleanfalseforced render of content in panel, not lazy render after clicking on header
extraString | ReactNodeContent to render in the right of the panel header
collapsible'header' | 'icon' | 'disabled'-specify whether the panel be collapsible or the area of collapsible.
- -> `disabled` is removed since 3.0.0, please use `collapsible=disabled` replace it. - -#### key - -If `key` is not provided, the panel's index will be used instead. +```bash +npm install +npm start +``` -#### KeyBoard Event +Then open `http://localhost:8000`. -By default, Collapse will listen `onKeyDown`(<3.7.0 `onKeyPress`) event with `enter` key to toggle panel's active state when `collapsible` is not `disabled`. If you want to disable this behavior, you can prevent the event from bubbling like this: +Online demo: https://collapse-react-component.vercel.app -```tsx | pure -const App = () => { - const items: CollapseProps['items'] = [ - { - label: e.stopPropagation()} />, - children: 'content', - }, - { - label: ( -
e.stopPropagation()}> - -
- ), - children: 'content', - }, - { - label: 'title 2', - children: 'content 2', - collapsible: 'disabled', - }, - { - label: 'title 3', - children: 'content 3', - onItemClick: console.log, - }, - ]; +## API - return ; -}; -``` +### Collapse + +| Property | Description | Type | Default | +| --- | --- | --- | --- | +| accordion | Only one panel can be opened at a time | boolean | false | +| activeKey | Current active panel key | `React.Key \| React.Key[]` | - | +| className | Additional class name | string | - | +| classNames | Semantic class names | `Partial>` | - | +| collapsible | Specify whether panel trigger area is collapsible | `header` \| `icon` \| `disabled` | - | +| defaultActiveKey | Initial active panel key | `React.Key \| React.Key[]` | - | +| destroyOnHidden | Destroy inactive panel content | boolean | false | +| expandIcon | Custom expand icon | `(props: object) => React.ReactNode` | - | +| items | Collapse items content | `ItemType[]` | - | +| openMotion | Custom open motion | `CSSMotionProps` | - | +| prefixCls | Component class name prefix | string | `rc-collapse` | +| style | Inline style | object | - | +| styles | Semantic styles | `Partial>` | - | +| onChange | Callback when active panels change | `(key: React.Key[]) => void` | - | + +### ItemType + +| Property | Description | Type | Default | +| --- | --- | --- | --- | +| key | Panel key | `React.Key` | - | +| label | Panel header content | `React.ReactNode` | - | +| children | Panel body content | `React.ReactNode` | - | +| className | Additional panel class name | string | - | +| classNames | Semantic class names | `Partial>` | - | +| collapsible | Specify whether the panel is collapsible | `header` \| `icon` \| `disabled` | - | +| destroyOnHidden | Destroy inactive panel content | boolean | false | +| extra | Extra content in the panel header | `React.ReactNode` | - | +| forceRender | Render panel content before it is opened | boolean | false | +| showArrow | Show arrow beside header | boolean | true | +| style | Inline panel style | object | - | +| styles | Semantic styles | `Partial>` | - | +| onItemClick | Callback when this panel is clicked | `(panelKey: React.Key) => void` | - | + +### Collapse.Panel + +`Collapse.Panel` is deprecated. Use `items` instead. ## Development @@ -253,18 +126,22 @@ npm install npm start ``` -## Test Case - ```bash npm test +npm run tsc +npm run lint +npm run compile +npm run build ``` -## Coverage +## Release ```bash -npm test -- --coverage +npm run prepublishOnly ``` +The release script compiles the package and runs `rc-np`. + ## License -rc-collapse is released under the MIT license. +`@rc-component/collapse` is released under the MIT license. diff --git a/package.json b/package.json index e936676..4065abb 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "assets/*.css" ], "scripts": { + "build": "npm run docs:build", "compile": "father build && lessc assets/index.less assets/index.css", "coverage": "rc-test --coverage", "docs:build": "dumi build", @@ -36,10 +37,11 @@ "prepare": "husky", "now-build": "npm run docs:build", "prepublishOnly": "npm run compile && rc-np", - "prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"", + "prettier": "prettier --write --ignore-unknown .", "postpublish": "npm run docs:deploy", "start": "dumi dev", - "test": "rc-test" + "test": "rc-test", + "tsc": "tsc --noEmit" }, "lint-staged": { "**/*.{ts,tsx,js,jsx,json,md}": "npm run prettier" diff --git a/vercel.json b/vercel.json index cc12e40..e884e1b 100644 --- a/vercel.json +++ b/vercel.json @@ -1,3 +1,6 @@ { - "framework": "umijs" + "framework": "umijs", + "installCommand": "npm install", + "buildCommand": "npm run build", + "outputDirectory": "dist" } From 094d60ebab96c90b51b75308223e73dd7e44e594 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 26 Jun 2026 12:41:29 +0800 Subject: [PATCH 02/33] ci: allow surge preview status updates --- .github/workflows/surge-preview.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index b7986b6..1b7fc7e 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -7,6 +7,7 @@ permissions: contents: read pull-requests: write checks: write + statuses: write jobs: preview: From c5a06f6a235965994734b3024837dbaa67d1d550 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 26 Jun 2026 12:46:34 +0800 Subject: [PATCH 03/33] chore: address review feedback --- .dumirc.ts | 4 +--- package.json | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.dumirc.ts b/.dumirc.ts index 4d5d601..f70377a 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -3,9 +3,7 @@ import { defineConfig } from 'dumi'; import path from 'path'; const isProdSite = - process.env.PREVIEW !== 'true' && - process.env.VERCEL !== '1' && - process.env.NODE_ENV === 'production'; + process.env.GITHUB_ACTIONS === 'true' && process.env.PREVIEW !== 'true'; const basePath = isProdSite ? '/collapse/' : '/'; const publicPath = isProdSite ? '/collapse/' : '/'; diff --git a/package.json b/package.json index 4065abb..d451a37 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "tsc": "tsc --noEmit" }, "lint-staged": { - "**/*.{ts,tsx,js,jsx,json,md}": "npm run prettier" + "**/*.{ts,tsx,js,jsx,json,md}": "prettier --write --ignore-unknown" }, "dependencies": { "@babel/runtime": "^7.10.1", From e7a2cf438b122147e937c9ebdb5780311069828f Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 26 Jun 2026 15:03:39 +0800 Subject: [PATCH 04/33] chore: remove cloudflare preview and now-build --- .../workflows/cloudflare-pages-preview.yml | 38 ------------------- package.json | 1 - 2 files changed, 39 deletions(-) delete mode 100644 .github/workflows/cloudflare-pages-preview.yml diff --git a/.github/workflows/cloudflare-pages-preview.yml b/.github/workflows/cloudflare-pages-preview.yml deleted file mode 100644 index c1738df..0000000 --- a/.github/workflows/cloudflare-pages-preview.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Cloudflare Pages Preview - -on: - pull_request: - -permissions: - contents: read - deployments: write - -jobs: - preview: - runs-on: ubuntu-latest - env: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - CLOUDFLARE_PAGES_PROJECT: ${{ vars.CLOUDFLARE_PAGES_PROJECT }} - PREVIEW: true - steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 - with: - persist-credentials: false - - name: Skip Cloudflare Pages preview - if: ${{ env.CLOUDFLARE_API_TOKEN == '' || env.CLOUDFLARE_ACCOUNT_ID == '' || env.CLOUDFLARE_PAGES_PROJECT == '' }} - run: echo "Cloudflare Pages preview is not configured; skip deployment." - - name: Install dependencies - if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PAGES_PROJECT != '' }} - run: npm install - - name: Build site - if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PAGES_PROJECT != '' }} - run: npm run build - - name: Deploy preview - if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PAGES_PROJECT != '' }} - uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 - with: - apiToken: ${{ env.CLOUDFLARE_API_TOKEN }} - accountId: ${{ env.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy dist --project-name=${{ env.CLOUDFLARE_PAGES_PROJECT }} --branch=${{ github.head_ref }} - gitHubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index d451a37..48e97b4 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,6 @@ "docs:deploy": "npm run docs:build && gh-pages -d dist", "lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md", "prepare": "husky", - "now-build": "npm run docs:build", "prepublishOnly": "npm run compile && rc-np", "prettier": "prettier --write --ignore-unknown .", "postpublish": "npm run docs:deploy", From b7b56fea6cb98322ebbfcc40457089de96d484a1 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 01:56:46 +0800 Subject: [PATCH 05/33] docs: standardize README release details --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 358fa49..288a3a2 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,9 @@

Part of the Ant Design ecosystem.

+ + +
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url] @@ -140,8 +143,8 @@ npm run build npm run prepublishOnly ``` -The release script compiles the package and runs `rc-np`. +The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build. ## License -`@rc-component/collapse` is released under the MIT license. +@rc-component/collapse is released under the [MIT](./LICENSE.md) license. From e1a3a3d981d0e01dcad76f305226dbdefd47f535 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 02:13:55 +0800 Subject: [PATCH 06/33] ci: make surge preview non-blocking --- .github/workflows/surge-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 1b7fc7e..c1e7176 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -25,7 +25,7 @@ jobs: surge_token: ${{ env.SURGE_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }} dist: dist - failOnError: true + failOnError: false setCommitStatus: true build: | npm install From fcc08d84b4062bc472690d9e9a8e9cab4c0d66fe Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 02:25:40 +0800 Subject: [PATCH 07/33] ci: keep surge preview as fallback --- .github/workflows/surge-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index c1e7176..d4a0c7a 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -26,7 +26,7 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} dist: dist failOnError: false - setCommitStatus: true + setCommitStatus: false build: | npm install npm run build From f724f1f03b3a0b919867a001fae4a3e062ae69d2 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 13:03:57 +0800 Subject: [PATCH 08/33] docs: refine README usage and ecosystem note --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 288a3a2..61cc9a2 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,10 @@

@rc-component/collapse

+

Part of the Ant Design ecosystem.

🪗 A flexible collapse and accordion component for React.

- - - Ant Design - - -

Part of the Ant Design ecosystem.

+
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url] From 06c8fb79e11d6033124d17ed9f41327b748c22a4 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 13:22:13 +0800 Subject: [PATCH 09/33] ci: isolate surge preview token --- .github/workflows/surge-preview.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index d4a0c7a..230f8c6 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -13,23 +13,26 @@ jobs: preview: runs-on: ubuntu-latest env: - SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} PREVIEW: true steps: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 with: persist-credentials: false + - name: Build preview + if: ${{ secrets.SURGE_TOKEN != '' }} + run: | + npm install + npm run build - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec - if: ${{ env.SURGE_TOKEN != '' }} + if: ${{ secrets.SURGE_TOKEN != '' }} + env: + SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} with: surge_token: ${{ env.SURGE_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }} dist: dist failOnError: false setCommitStatus: false - build: | - npm install - npm run build - name: Skip Surge preview - if: ${{ env.SURGE_TOKEN == '' }} + if: ${{ secrets.SURGE_TOKEN == '' }} run: echo "SURGE_TOKEN is not configured; skip Surge preview." From d53b058b2f7be44a630b5f66e944e0866a8235c6 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 13:50:32 +0800 Subject: [PATCH 10/33] chore: address review comments --- .dumirc.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.dumirc.ts b/.dumirc.ts index f70377a..ecbe287 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -2,8 +2,7 @@ import { defineConfig } from 'dumi'; import path from 'path'; -const isProdSite = - process.env.GITHUB_ACTIONS === 'true' && process.env.PREVIEW !== 'true'; +const isProdSite = process.env.GH_PAGES === '1'; const basePath = isProdSite ? '/collapse/' : '/'; const publicPath = isProdSite ? '/collapse/' : '/'; From 834b016b095ddabcc05943971b833e2feb713909 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 22:19:09 +0800 Subject: [PATCH 11/33] docs: add Chinese README --- README.md | 2 + README.zh-CN.md | 148 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 README.zh-CN.md diff --git a/README.md b/README.md index 61cc9a2..ca5f59a 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@

🪗 A flexible collapse and accordion component for React.

+

English | 简体中文

+
diff --git a/README.zh-CN.md b/README.zh-CN.md new file mode 100644 index 0000000..4ec47b6 --- /dev/null +++ b/README.zh-CN.md @@ -0,0 +1,148 @@ +
+

@rc-component/collapse

+

Ant Design 生态的一部分。

+

🪗 灵活的 React 折叠面板和手风琴组件。

+
+ +

English | 简体中文

+ + +
+ +[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url] + +
+ +[npm-image]: https://img.shields.io/npm/v/@rc-component/collapse.svg?style=flat-square +[npm-url]: https://npmjs.org/package/@rc-component/collapse +[github-actions-image]: https://github.com/react-component/collapse/actions/workflows/react-component-ci.yml/badge.svg +[github-actions-url]: https://github.com/react-component/collapse/actions/workflows/react-component-ci.yml +[codecov-image]: https://img.shields.io/codecov/c/github/react-component/collapse/master.svg?style=flat-square +[codecov-url]: https://app.codecov.io/gh/react-component/collapse +[download-image]: https://img.shields.io/npm/dm/@rc-component/collapse.svg?style=flat-square +[download-url]: https://npmjs.org/package/@rc-component/collapse +[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/%40rc-component%2Fcollapse?style=flat-square +[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/collapse +[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square +[dumi-url]: https://github.com/umijs/dumi + +## 特性 + +- 支持 accordion and multi-panel collapse modes. +- 推荐使用 `items` API 声明式配置面板。 +- 保留 `Collapse.Panel` for compatibility. It is deprecated and will be removed in v4. +- 支持 custom expand icons, semantic class names, semantic styles, and motion. + +## 安装 + +```bash +npm install @rc-component/collapse +``` + +## 使用 + +```tsx | pure +import Collapse from '@rc-component/collapse'; +import '@rc-component/collapse/assets/index.css'; + +export default function App() { + return ( + + ); +} +``` + +## 示例 + +```bash +npm install +npm start +``` + +然后打开 `http://localhost:8000`。 + +在线演示: https://collapse-react-component.vercel.app + +## API + +### Collapse + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| accordion | Only one panel can be opened at a time | boolean | false | +| activeKey | Current active panel key | `React.Key \| React.Key[]` | - | +| className | Additional class name | string | - | +| classNames | Semantic class names | `Partial>` | - | +| collapsible | Specify whether panel trigger area is collapsible | `header` \| `icon` \| `disabled` | - | +| defaultActiveKey | Initial active panel key | `React.Key \| React.Key[]` | - | +| destroyOnHidden | Destroy inactive panel content | boolean | false | +| expandIcon | Custom expand icon | `(props: object) => React.ReactNode` | - | +| items | Collapse items content | `ItemType[]` | - | +| openMotion | Custom open motion | `CSSMotionProps` | - | +| prefixCls | Component class name prefix | string | `rc-collapse` | +| style | Inline style | object | - | +| styles | Semantic styles | `Partial>` | - | +| onChange | Callback when active panels change | `(key: React.Key[]) => void` | - | + +### ItemType + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| key | Panel key | `React.Key` | - | +| label | Panel header content | `React.ReactNode` | - | +| children | Panel body content | `React.ReactNode` | - | +| className | Additional panel class name | string | - | +| classNames | Semantic class names | `Partial>` | - | +| collapsible | Specify whether the panel is collapsible | `header` \| `icon` \| `disabled` | - | +| destroyOnHidden | Destroy inactive panel content | boolean | false | +| extra | Extra content in the panel header | `React.ReactNode` | - | +| forceRender | Render panel content before it is opened | boolean | false | +| showArrow | Show arrow beside header | boolean | true | +| style | Inline panel style | object | - | +| styles | Semantic styles | `Partial>` | - | +| onItemClick | Callback when this panel is clicked | `(panelKey: React.Key) => void` | - | + +### Collapse.Panel + +`Collapse.Panel` is deprecated. Use `items` instead. + +## 本地开发 + +```bash +npm install +npm start +``` + +```bash +npm test +npm run tsc +npm run lint +npm run compile +npm run build +``` + +## 发布 + +```bash +npm run prepublishOnly +``` + +The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build. + +## 许可证 + +@rc-component/collapse is released under the [MIT](./LICENSE.md) license. From 0838abca50bf1a7a621f5804d915ccb566f54b89 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 22:34:27 +0800 Subject: [PATCH 12/33] docs: add Ant Design logo to README --- README.md | 1 + README.zh-CN.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index ca5f59a..2203f1a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@

@rc-component/collapse

Part of the Ant Design ecosystem.

+ Ant Design

🪗 A flexible collapse and accordion component for React.

diff --git a/README.zh-CN.md b/README.zh-CN.md index 4ec47b6..c9de0ff 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,6 +1,7 @@

@rc-component/collapse

Ant Design 生态的一部分。

+ Ant Design

🪗 灵活的 React 折叠面板和手风琴组件。

From 8e2215d679caf7438e020861cb772ccf0116f3a0 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 23:02:42 +0800 Subject: [PATCH 13/33] docs: refine bilingual README branding --- README.md | 3 +-- README.zh-CN.md | 67 ++++++++++++++++++++++++------------------------- 2 files changed, 34 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 2203f1a..a8faf6e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@

@rc-component/collapse

-

Part of the Ant Design ecosystem.

- Ant Design +

Ant Design Part of the Ant Design ecosystem.

🪗 A flexible collapse and accordion component for React.

diff --git a/README.zh-CN.md b/README.zh-CN.md index c9de0ff..e9a3fcf 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,7 +1,6 @@

@rc-component/collapse

-

Ant Design 生态的一部分。

- Ant Design +

Ant Design Ant Design 生态的一部分。

🪗 灵活的 React 折叠面板和手风琴组件。

@@ -29,10 +28,10 @@ ## 特性 -- 支持 accordion and multi-panel collapse modes. +- 支持手风琴和多面板折叠模式。 - 推荐使用 `items` API 声明式配置面板。 -- 保留 `Collapse.Panel` for compatibility. It is deprecated and will be removed in v4. -- 支持 custom expand icons, semantic class names, semantic styles, and motion. +- 保留 `Collapse.Panel` 以实现兼容性。它已被弃用,并将在 v4 中删除。 +- 支持自定义展开图标、语义className称、语义样式和动作。 ## 安装 @@ -84,42 +83,42 @@ npm start | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | -| accordion | Only one panel can be opened at a time | boolean | false | -| activeKey | Current active panel key | `React.Key \| React.Key[]` | - | -| className | Additional class name | string | - | -| classNames | Semantic class names | `Partial>` | - | -| collapsible | Specify whether panel trigger area is collapsible | `header` \| `icon` \| `disabled` | - | -| defaultActiveKey | Initial active panel key | `React.Key \| React.Key[]` | - | -| destroyOnHidden | Destroy inactive panel content | boolean | false | -| expandIcon | Custom expand icon | `(props: object) => React.ReactNode` | - | -| items | Collapse items content | `ItemType[]` | - | -| openMotion | Custom open motion | `CSSMotionProps` | - | -| prefixCls | Component class name prefix | string | `rc-collapse` | -| style | Inline style | object | - | +| accordion | 一次只能打开一个面板 | boolean | false | +| activeKey | 当前活动面板键 | `React.Key \| React.Key[]` | - | +| className | 附加className | string | - | +| classNames | 语义className | `Partial>` | - | +| collapsible | 指定面板触发区域是否可折叠 | `header` \| `icon` \| `disabled` | - | +| defaultActiveKey | 初始活动面板键 | `React.Key \| React.Key[]` | - | +| destroyOnHidden | 销毁非活动面板内容 | boolean | false | +| expandIcon | 自定义展开图标 | `(props: object) => React.ReactNode` | - | +| 项目 | 折叠项目内容 | `ItemType[]` | - | +| openMotion | 自定义打开动作 | `CSSMotionProps` | - | +| prefixCls | 组件className前缀 | string | `rc-collapse` | +| 风格 | 内联样式 | object | - | | styles | Semantic styles | `Partial>` | - | -| onChange | Callback when active panels change | `(key: React.Key[]) => void` | - | +| onChange | 活动面板更改时的回调 | `(key: React.Key[]) => void` | - | ### ItemType | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | -| key | Panel key | `React.Key` | - | -| label | Panel header content | `React.ReactNode` | - | -| children | Panel body content | `React.ReactNode` | - | -| className | Additional panel class name | string | - | -| classNames | Semantic class names | `Partial>` | - | -| collapsible | Specify whether the panel is collapsible | `header` \| `icon` \| `disabled` | - | -| destroyOnHidden | Destroy inactive panel content | boolean | false | -| extra | Extra content in the panel header | `React.ReactNode` | - | -| forceRender | Render panel content before it is opened | boolean | false | -| showArrow | Show arrow beside header | boolean | true | -| style | Inline panel style | object | - | +| key | 面板按键 | `React.Key` | - | +| label | 面板标题内容 | `React.ReactNode` | - | +| 孩子们 | 面板主体内容 | `React.ReactNode` | - | +| className | 附加面板className | string | - | +| classNames | 语义className | `Partial>` | - | +| collapsible | 指定面板是否可折叠 | `header` \| `icon` \| `disabled` | - | +| destroyOnHidden | 销毁非活动面板内容 | boolean | false | +| 额外的 | 面板标题中的额外内容 | `React.ReactNode` | - | +| forceRender | 在打开面板之前渲染面板内容 | boolean | false | +| showArrow | 在标题旁边显示箭头 | boolean | true | +| 风格 | 内联面板样式 | object | - | | styles | Semantic styles | `Partial>` | - | -| onItemClick | Callback when this panel is clicked | `(panelKey: React.Key) => void` | - | +| onItemClick | 点击该面板时的回调 | `(panelKey: React.Key) => void` | - | -### Collapse.Panel +### 折叠面板 -`Collapse.Panel` is deprecated. Use `items` instead. +`Collapse.Panel` 已弃用。请改用 `items`。 ## 本地开发 @@ -142,8 +141,8 @@ npm run build npm run prepublishOnly ``` -The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build. +包构建完成后,发布流程由 `@rc-component/np` 通过 `rc-np` 命令处理。 ## 许可证 -@rc-component/collapse is released under the [MIT](./LICENSE.md) license. +@rc-component/collapse 基于 [MIT](./LICENSE.md) 许可证发布。 From 394d4ebb0b7dc23c39ed6e9d0a411750f78a4170 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 01:28:37 +0800 Subject: [PATCH 14/33] chore: standardize rc tooling and docs --- .dumirc.ts | 7 ++--- .github/workflows/site-deploy.yml | 2 +- .github/workflows/surge-preview.yml | 2 +- README.md | 4 +-- README.zh-CN.md | 4 +-- package.json | 46 ++++++++++++++--------------- tsconfig.json | 15 +++++++--- vercel.json | 2 +- 8 files changed, 44 insertions(+), 38 deletions(-) diff --git a/.dumirc.ts b/.dumirc.ts index ecbe287..f31cdc8 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -2,12 +2,11 @@ import { defineConfig } from 'dumi'; import path from 'path'; -const isProdSite = process.env.GH_PAGES === '1'; - -const basePath = isProdSite ? '/collapse/' : '/'; -const publicPath = isProdSite ? '/collapse/' : '/'; +const basePath = process.env.GH_PAGES ? '/collapse/' : '/'; +const publicPath = basePath; export default defineConfig({ + outputPath: 'docs-dist', alias: { 'rc-collapse$': path.resolve('src'), 'rc-collapse/es': path.resolve('src'), diff --git a/.github/workflows/site-deploy.yml b/.github/workflows/site-deploy.yml index fcd35a2..527f033 100644 --- a/.github/workflows/site-deploy.yml +++ b/.github/workflows/site-deploy.yml @@ -35,7 +35,7 @@ jobs: uses: peaceiris/actions-gh-pages@329bcc8f12caed2cefe5a5b80781499a6f3b361b with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./dist + publish_dir: ./docs-dist force_orphan: true user_name: 'github-actions[bot]' user_email: 'github-actions[bot]@users.noreply.github.com' diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 230f8c6..5e2be72 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -30,7 +30,7 @@ jobs: with: surge_token: ${{ env.SURGE_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }} - dist: dist + dist: docs-dist failOnError: false setCommitStatus: false - name: Skip Surge preview diff --git a/README.md b/README.md index a8faf6e..ec2ebf3 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,8 @@ export default function App() { ## Examples +Run the local dumi site: + ```bash npm install npm start @@ -75,8 +77,6 @@ npm start Then open `http://localhost:8000`. -Online demo: https://collapse-react-component.vercel.app - ## API ### Collapse diff --git a/README.zh-CN.md b/README.zh-CN.md index e9a3fcf..93badb2 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -68,6 +68,8 @@ export default function App() { ## 示例 +运行本地 dumi 站点: + ```bash npm install npm start @@ -75,8 +77,6 @@ npm start 然后打开 `http://localhost:8000`。 -在线演示: https://collapse-react-component.vercel.app - ## API ### Collapse diff --git a/package.json b/package.json index 48e97b4..2de0344 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "compile": "father build && lessc assets/index.less assets/index.css", "coverage": "rc-test --coverage", "docs:build": "dumi build", - "docs:deploy": "npm run docs:build && gh-pages -d dist", + "docs:deploy": "npm run docs:build && gh-pages -d docs-dist", "lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md", "prepare": "husky", "prepublishOnly": "npm run compile && rc-np", @@ -54,28 +54,28 @@ "devDependencies": { "@rc-component/father-plugin": "^2.2.0", "@rc-component/np": "^1.0.4", - "@testing-library/jest-dom": "^6.1.4", - "@testing-library/react": "^16.3.0", - "@types/jest": "^29.4.0", - "@types/node": "^24.2.0", - "@types/react": "^19.1.4", - "@types/react-dom": "^19.1.5", - "@umijs/fabric": "^4.0.0", - "dumi": "^2.1.1", - "eslint": "^8.55.0", - "eslint-plugin-jest": "^29.0.1", - "eslint-plugin-unicorn": "^49.0.0", - "father": "^4.1.3", - "gh-pages": "^6.2.0", - "husky": "^9.0.0", - "jest": "^30.0.3", - "less": "^4.2.0", - "lint-staged": "^16.0.0", - "prettier": "^3.0.3", - "rc-test": "^7.0.14", - "react": "^19.1.0", - "react-dom": "^19.1.0", - "typescript": "^5.0.0" + "@testing-library/jest-dom": "^6.9.1", + "@testing-library/react": "^15.0.7", + "@types/jest": "^29.5.14", + "@types/node": "^26.0.1", + "@types/react": "^18.3.31", + "@types/react-dom": "^18.3.7", + "@umijs/fabric": "^4.0.1", + "dumi": "^2.4.35", + "eslint": "^8.57.1", + "eslint-plugin-jest": "^27.9.0", + "eslint-plugin-unicorn": "^56.0.1", + "father": "^4.6.23", + "gh-pages": "^6.3.0", + "husky": "^9.1.7", + "jest": "^29.7.0", + "less": "^4.6.7", + "lint-staged": "^16.4.0", + "prettier": "^3.9.0", + "rc-test": "^7.1.3", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "typescript": "^5.9.3" }, "peerDependencies": { "react": ">=18.0.0", diff --git a/tsconfig.json b/tsconfig.json index bc68db4..44c8fc6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,10 +8,17 @@ "skipLibCheck": true, "esModuleInterop": true, "paths": { - "@/*": ["src/*"], - "@@/*": ["src/.dumi/*"], - "rc-collapse": ["src/index.tsx"] - } + "@/*": [ + "src/*" + ], + "@@/*": [ + "src/.dumi/*" + ], + "rc-collapse": [ + "src/index.tsx" + ] + }, + "ignoreDeprecations": "5.0" }, "include": [ ".dumirc.ts", diff --git a/vercel.json b/vercel.json index e884e1b..5f9139e 100644 --- a/vercel.json +++ b/vercel.json @@ -2,5 +2,5 @@ "framework": "umijs", "installCommand": "npm install", "buildCommand": "npm run build", - "outputDirectory": "dist" + "outputDirectory": "docs-dist" } From 2f4db3466d81ac4ee2a531ea338da3c80d1600a7 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 02:01:03 +0800 Subject: [PATCH 15/33] chore: address standardization review comments --- .github/workflows/surge-preview.yml | 16 ++++++++++++--- README.md | 1 + README.zh-CN.md | 31 +++++++++++++++-------------- package.json | 7 ++++--- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 5e2be72..0f193f1 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -18,13 +18,23 @@ jobs: - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 with: persist-credentials: false + - name: Check Surge token + id: surge-token + env: + SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} + run: | + if [ -n "$SURGE_TOKEN" ]; then + echo "enabled=true" >> "$GITHUB_OUTPUT" + else + echo "enabled=false" >> "$GITHUB_OUTPUT" + fi - name: Build preview - if: ${{ secrets.SURGE_TOKEN != '' }} + if: ${{ steps.surge-token.outputs.enabled == 'true' }} run: | npm install npm run build - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec - if: ${{ secrets.SURGE_TOKEN != '' }} + if: ${{ steps.surge-token.outputs.enabled == 'true' }} env: SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} with: @@ -34,5 +44,5 @@ jobs: failOnError: false setCommitStatus: false - name: Skip Surge preview - if: ${{ secrets.SURGE_TOKEN == '' }} + if: ${{ steps.surge-token.outputs.enabled != 'true' }} run: echo "SURGE_TOKEN is not configured; skip Surge preview." diff --git a/README.md b/README.md index ec2ebf3..678d06f 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ Then open `http://localhost:8000`. | --- | --- | --- | --- | | key | Panel key | `React.Key` | - | | label | Panel header content | `React.ReactNode` | - | +| ref | Panel DOM ref | `React.RefObject` | - | | children | Panel body content | `React.ReactNode` | - | | className | Additional panel class name | string | - | | classNames | Semantic class names | `Partial>` | - | diff --git a/README.zh-CN.md b/README.zh-CN.md index 93badb2..c6388c9 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -31,7 +31,7 @@ - 支持手风琴和多面板折叠模式。 - 推荐使用 `items` API 声明式配置面板。 - 保留 `Collapse.Panel` 以实现兼容性。它已被弃用,并将在 v4 中删除。 -- 支持自定义展开图标、语义className称、语义样式和动作。 +- 支持自定义展开图标、语义化类名、语义样式和动画。 ## 安装 @@ -85,35 +85,36 @@ npm start | --- | --- | --- | --- | | accordion | 一次只能打开一个面板 | boolean | false | | activeKey | 当前活动面板键 | `React.Key \| React.Key[]` | - | -| className | 附加className | string | - | -| classNames | 语义className | `Partial>` | - | +| className | 附加 className | string | - | +| classNames | 语义化类名 | `Partial>` | - | | collapsible | 指定面板触发区域是否可折叠 | `header` \| `icon` \| `disabled` | - | | defaultActiveKey | 初始活动面板键 | `React.Key \| React.Key[]` | - | | destroyOnHidden | 销毁非活动面板内容 | boolean | false | | expandIcon | 自定义展开图标 | `(props: object) => React.ReactNode` | - | -| 项目 | 折叠项目内容 | `ItemType[]` | - | -| openMotion | 自定义打开动作 | `CSSMotionProps` | - | -| prefixCls | 组件className前缀 | string | `rc-collapse` | -| 风格 | 内联样式 | object | - | -| styles | Semantic styles | `Partial>` | - | +| items | 折叠条目内容 | `ItemType[]` | - | +| openMotion | 自定义展开动画 | `CSSMotionProps` | - | +| prefixCls | 组件 className 前缀 | string | `rc-collapse` | +| style | 内联样式 | object | - | +| styles | 语义化样式 | `Partial>` | - | | onChange | 活动面板更改时的回调 | `(key: React.Key[]) => void` | - | ### ItemType | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | -| key | 面板按键 | `React.Key` | - | +| key | 面板键值 | `React.Key` | - | | label | 面板标题内容 | `React.ReactNode` | - | -| 孩子们 | 面板主体内容 | `React.ReactNode` | - | -| className | 附加面板className | string | - | -| classNames | 语义className | `Partial>` | - | +| ref | 面板 DOM 引用 | `React.RefObject` | - | +| children | 面板主体内容 | `React.ReactNode` | - | +| className | 附加面板 className | string | - | +| classNames | 语义化类名 | `Partial>` | - | | collapsible | 指定面板是否可折叠 | `header` \| `icon` \| `disabled` | - | | destroyOnHidden | 销毁非活动面板内容 | boolean | false | -| 额外的 | 面板标题中的额外内容 | `React.ReactNode` | - | +| extra | 面板标题中的额外内容 | `React.ReactNode` | - | | forceRender | 在打开面板之前渲染面板内容 | boolean | false | | showArrow | 在标题旁边显示箭头 | boolean | true | -| 风格 | 内联面板样式 | object | - | -| styles | Semantic styles | `Partial>` | - | +| style | 内联面板样式 | object | - | +| styles | 语义化样式 | `Partial>` | - | | onItemClick | 点击该面板时的回调 | `(panelKey: React.Key) => void` | - | ### 折叠面板 diff --git a/package.json b/package.json index 2de0344..626ab2d 100644 --- a/package.json +++ b/package.json @@ -32,15 +32,16 @@ "compile": "father build && lessc assets/index.less assets/index.css", "coverage": "rc-test --coverage", "docs:build": "dumi build", - "docs:deploy": "npm run docs:build && gh-pages -d docs-dist", + "docs:deploy": "gh-pages -d docs-dist", "lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md", "prepare": "husky", "prepublishOnly": "npm run compile && rc-np", "prettier": "prettier --write --ignore-unknown .", - "postpublish": "npm run docs:deploy", + "postpublish": "npm run docs:build:gh-pages && npm run docs:deploy", "start": "dumi dev", "test": "rc-test", - "tsc": "tsc --noEmit" + "tsc": "tsc --noEmit", + "docs:build:gh-pages": "GH_PAGES=1 npm run docs:build" }, "lint-staged": { "**/*.{ts,tsx,js,jsx,json,md}": "prettier --write --ignore-unknown" From 4e6952fd43e11704879b3c4935c151e67481cea1 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 02:10:32 +0800 Subject: [PATCH 16/33] chore: include father config in type checks --- tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tsconfig.json b/tsconfig.json index 44c8fc6..7886929 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -21,6 +21,7 @@ "ignoreDeprecations": "5.0" }, "include": [ + ".fatherrc.ts", ".dumirc.ts", "./src/**/*.ts", "./src/**/*.tsx", From ad6b51c20b04e3874c68520d32f5a07acf394352 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 13:06:30 +0800 Subject: [PATCH 17/33] chore: ignore dumi build output --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e1c3a36..f01a997 100644 --- a/.gitignore +++ b/.gitignore @@ -36,7 +36,8 @@ pnpm-lock.yaml .dumi/tmp .dumi/tmp-production .dumi/tmp-test +docs-dist .env.local src/.umi -bun.lockb \ No newline at end of file +bun.lockb From 5526bbc3c5e2d681ac33633e8fbc5adb92f82842 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 13:26:54 +0800 Subject: [PATCH 18/33] docs: add license file --- LICENSE | 21 +++++++++++++++++++++ README.md | 2 +- README.zh-CN.md | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bd0a1f7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019-present react-component + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 678d06f..40ec23f 100644 --- a/README.md +++ b/README.md @@ -146,4 +146,4 @@ The release flow is handled by `@rc-component/np` through the `rc-np` command af ## License -@rc-component/collapse is released under the [MIT](./LICENSE.md) license. +@rc-component/collapse is released under the [MIT](./LICENSE) license. diff --git a/README.zh-CN.md b/README.zh-CN.md index c6388c9..184e578 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -146,4 +146,4 @@ npm run prepublishOnly ## 许可证 -@rc-component/collapse 基于 [MIT](./LICENSE.md) 许可证发布。 +@rc-component/collapse 基于 [MIT](./LICENSE) 许可证发布。 From 72b3ccbad96b0ced28a2b8d2760db12a41042c39 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 13:59:34 +0800 Subject: [PATCH 19/33] ci: use actions checkout v7 --- .github/workflows/react-doctor.yml | 2 +- .github/workflows/site-deploy.yml | 2 +- .github/workflows/surge-preview.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/react-doctor.yml b/.github/workflows/react-doctor.yml index f68281c..097eb88 100644 --- a/.github/workflows/react-doctor.yml +++ b/.github/workflows/react-doctor.yml @@ -20,7 +20,7 @@ jobs: react-doctor: runs-on: ubuntu-latest steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + - uses: actions/checkout@v7 with: fetch-depth: 0 persist-credentials: false diff --git a/.github/workflows/site-deploy.yml b/.github/workflows/site-deploy.yml index 527f033..a28395d 100644 --- a/.github/workflows/site-deploy.yml +++ b/.github/workflows/site-deploy.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: checkout - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + uses: actions/checkout@v7 with: persist-credentials: false diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 0f193f1..16eaf48 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -15,7 +15,7 @@ jobs: env: PREVIEW: true steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + - uses: actions/checkout@v7 with: persist-credentials: false - name: Check Surge token From 8db61d7da6170eba7e631ae5cb42b6f461624b6f Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 14:20:34 +0800 Subject: [PATCH 20/33] ci: update deploy action versions --- .github/workflows/site-deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/site-deploy.yml b/.github/workflows/site-deploy.yml index a28395d..3439206 100644 --- a/.github/workflows/site-deploy.yml +++ b/.github/workflows/site-deploy.yml @@ -18,7 +18,7 @@ jobs: persist-credentials: false - name: setup node - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e + uses: actions/setup-node@v6 with: node-version: 20 @@ -32,7 +32,7 @@ jobs: run: npm run build - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@329bcc8f12caed2cefe5a5b80781499a6f3b361b + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs-dist From 907fd7bc96fda1d263c74242dffc0de044c1f717 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 14:29:57 +0800 Subject: [PATCH 21/33] chore: standardize package metadata --- package.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 626ab2d..9cb5ef6 100644 --- a/package.json +++ b/package.json @@ -10,13 +10,13 @@ "collapse", "accordion" ], - "homepage": "http://github.com/react-component/collapse", + "homepage": "https://react-component.github.io/collapse", "bugs": { - "url": "http://github.com/react-component/collapse/issues" + "url": "https://github.com/react-component/collapse/issues" }, "repository": { "type": "git", - "url": "git@github.com:react-component/collapse.git" + "url": "https://github.com/react-component/collapse.git" }, "license": "MIT", "main": "./lib/index", @@ -81,5 +81,8 @@ "peerDependencies": { "react": ">=18.0.0", "react-dom": ">=18.0.0" + }, + "publishConfig": { + "access": "public" } } From 7e1c099de55815bb0074b94c8b62ecc755ba8104 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 14:36:17 +0800 Subject: [PATCH 22/33] ci: standardize dependabot updates --- .github/dependabot.yml | 43 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6745ced..3b730ef 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,28 +1,19 @@ version: 2 updates: -- package-ecosystem: npm - directory: "/" - schedule: - interval: daily - time: "21:00" - open-pull-requests-limit: 10 - ignore: - - dependency-name: "@types/react-dom" - versions: - - 17.0.0 - - 17.0.1 - - 17.0.2 - - dependency-name: "@types/react" - versions: - - 17.0.0 - - 17.0.1 - - 17.0.2 - - 17.0.3 - - dependency-name: np - versions: - - 7.2.0 - - 7.3.0 - - 7.4.0 - - dependency-name: less - versions: - - 4.1.0 + - package-ecosystem: npm + directory: '/' + schedule: + interval: weekly + day: monday + time: '21:00' + timezone: Asia/Shanghai + open-pull-requests-limit: 10 + + - package-ecosystem: github-actions + directory: '/' + schedule: + interval: weekly + day: monday + time: '21:00' + timezone: Asia/Shanghai + open-pull-requests-limit: 10 From bbc315ef9a16f2fb3d5a74085314219ddc575c4e Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 17:14:24 +0800 Subject: [PATCH 23/33] chore: refine preview workflow ignores --- .github/workflows/surge-preview.yml | 3 +++ .prettierignore | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 .prettierignore diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 16eaf48..456b911 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -12,6 +12,9 @@ permissions: jobs: preview: runs-on: ubuntu-latest + concurrency: + group: surge-preview-${{ github.event.pull_request.number }} + cancel-in-progress: true env: PREVIEW: true steps: diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..c466d87 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,14 @@ +node_modules +coverage +docs-dist +dist +es +lib +.dumi/tmp +.dumi/tmp-production +.vercel +package-lock.json +pnpm-lock.yaml +yarn.lock +bun.lockb +*.log From 912fac8d911a297fdce3902cb5ba1f010d5eb837 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 18:05:34 +0800 Subject: [PATCH 24/33] ci: pin gh-pages deployment action --- .github/workflows/site-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/site-deploy.yml b/.github/workflows/site-deploy.yml index 3439206..c5de830 100644 --- a/.github/workflows/site-deploy.yml +++ b/.github/workflows/site-deploy.yml @@ -32,7 +32,7 @@ jobs: run: npm run build - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v4 + uses: peaceiris/actions-gh-pages@329bcc8f12caed2cefe5a5b80781499a6f3b361b with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs-dist From 4c638223d9d2bf13927739784e4881f278294246 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 19:37:44 +0800 Subject: [PATCH 25/33] docs: document dumi dev server port --- README.md | 3 ++- README.zh-CN.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 40ec23f..1598c63 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@

English | 简体中文

-
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url] @@ -128,6 +127,8 @@ npm install npm start ``` +The dumi site runs at `http://localhost:8000` by default. + ```bash npm test npm run tsc diff --git a/README.zh-CN.md b/README.zh-CN.md index 184e578..a70eae7 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -6,7 +6,6 @@

English | 简体中文

-
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url] @@ -128,6 +127,8 @@ npm install npm start ``` +dumi 站点默认运行在 `http://localhost:8000`。 + ```bash npm test npm run tsc From 39252bc9347ffc143413b6016e55acb373be8e2b Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 19:56:46 +0800 Subject: [PATCH 26/33] chore: standardize husky configuration --- .husky/pre-commit | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index c27d889..2312dc5 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1 @@ -lint-staged +npx lint-staged diff --git a/package.json b/package.json index 9cb5ef6..36edc53 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "docs:build:gh-pages": "GH_PAGES=1 npm run docs:build" }, "lint-staged": { - "**/*.{ts,tsx,js,jsx,json,md}": "prettier --write --ignore-unknown" + "*": "prettier --write --ignore-unknown" }, "dependencies": { "@babel/runtime": "^7.10.1", From 5a82ee00cdbce3f246ee882a3a0b42754a12e186 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 20:05:32 +0800 Subject: [PATCH 27/33] docs: align readme badge layout --- README.md | 29 +++++++++-------------------- README.zh-CN.md | 29 +++++++++-------------------- 2 files changed, 18 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 1598c63..3a2ecc0 100644 --- a/README.md +++ b/README.md @@ -2,29 +2,18 @@

@rc-component/collapse

Ant Design Part of the Ant Design ecosystem.

🪗 A flexible collapse and accordion component for React.

-
- -

English | 简体中文

- -
- -[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url] +

+ NPM version + npm downloads + build status + Codecov + bundle size + dumi +

-[npm-image]: https://img.shields.io/npm/v/@rc-component/collapse.svg?style=flat-square -[npm-url]: https://npmjs.org/package/@rc-component/collapse -[github-actions-image]: https://github.com/react-component/collapse/actions/workflows/react-component-ci.yml/badge.svg -[github-actions-url]: https://github.com/react-component/collapse/actions/workflows/react-component-ci.yml -[codecov-image]: https://img.shields.io/codecov/c/github/react-component/collapse/master.svg?style=flat-square -[codecov-url]: https://app.codecov.io/gh/react-component/collapse -[download-image]: https://img.shields.io/npm/dm/@rc-component/collapse.svg?style=flat-square -[download-url]: https://npmjs.org/package/@rc-component/collapse -[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/%40rc-component%2Fcollapse?style=flat-square -[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/collapse -[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square -[dumi-url]: https://github.com/umijs/dumi - +

English | 简体中文

## Highlights - Supports accordion and multi-panel collapse modes. diff --git a/README.zh-CN.md b/README.zh-CN.md index a70eae7..4848ea4 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -2,29 +2,18 @@

@rc-component/collapse

Ant Design Ant Design 生态的一部分。

🪗 灵活的 React 折叠面板和手风琴组件。

-
- -

English | 简体中文

- -
- -[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url] +

+ NPM version + npm downloads + build status + Codecov + bundle size + dumi +

-[npm-image]: https://img.shields.io/npm/v/@rc-component/collapse.svg?style=flat-square -[npm-url]: https://npmjs.org/package/@rc-component/collapse -[github-actions-image]: https://github.com/react-component/collapse/actions/workflows/react-component-ci.yml/badge.svg -[github-actions-url]: https://github.com/react-component/collapse/actions/workflows/react-component-ci.yml -[codecov-image]: https://img.shields.io/codecov/c/github/react-component/collapse/master.svg?style=flat-square -[codecov-url]: https://app.codecov.io/gh/react-component/collapse -[download-image]: https://img.shields.io/npm/dm/@rc-component/collapse.svg?style=flat-square -[download-url]: https://npmjs.org/package/@rc-component/collapse -[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/%40rc-component%2Fcollapse?style=flat-square -[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/collapse -[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square -[dumi-url]: https://github.com/umijs/dumi - +

English | 简体中文

## 特性 - 支持手风琴和多面板折叠模式。 From 4f9939aa8341c841492daac7951361760583e12c Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 20:31:25 +0800 Subject: [PATCH 28/33] chore: standardize package type entry --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 36edc53..662fb76 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "license": "MIT", "main": "./lib/index", "module": "./es/index", - "typings": "es/index.d.ts", "files": [ "lib", "es", @@ -84,5 +83,6 @@ }, "publishConfig": { "access": "public" - } + }, + "types": "./es/index.d.ts" } From 4837cad8d0f364ecfc6a909f4edd9d88dee772e3 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 20:59:37 +0800 Subject: [PATCH 29/33] docs: normalize readme badges --- README.md | 1 + README.zh-CN.md | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 3a2ecc0..57f91a1 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@

English | 简体中文

+ ## Highlights - Supports accordion and multi-panel collapse modes. diff --git a/README.zh-CN.md b/README.zh-CN.md index 4848ea4..9751c16 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -14,6 +14,7 @@

English | 简体中文

+ ## 特性 - 支持手风琴和多面板折叠模式。 From 1c61c5283abc279a0b333dbee2f7bcd6d7f3391f Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 21:19:04 +0800 Subject: [PATCH 30/33] ci: limit reusable workflow secrets --- .github/workflows/react-component-ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml index f8482b6..36dacae 100644 --- a/.github/workflows/react-component-ci.yml +++ b/.github/workflows/react-component-ci.yml @@ -1,6 +1,9 @@ name: ✅ test on: [push, pull_request] +permissions: + contents: read jobs: test: uses: react-component/rc-test/.github/workflows/test-utoo.yml@main - secrets: inherit + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 3c73257e007d3eeb6f016e033b50c373a04b424a Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 21:31:51 +0800 Subject: [PATCH 31/33] ci: restore reusable workflow compatibility --- .github/workflows/react-component-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml index 36dacae..9503b96 100644 --- a/.github/workflows/react-component-ci.yml +++ b/.github/workflows/react-component-ci.yml @@ -5,5 +5,4 @@ permissions: jobs: test: uses: react-component/rc-test/.github/workflows/test-utoo.yml@main - secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + secrets: inherit From bb29af0209d1ec6549351553641f028818e3556f Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 29 Jun 2026 00:33:59 +0800 Subject: [PATCH 32/33] ci: narrow surge preview permissions --- .github/workflows/surge-preview.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 456b911..cffac6c 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -7,7 +7,6 @@ permissions: contents: read pull-requests: write checks: write - statuses: write jobs: preview: From 2cff651e980d6beb50dbcba7e44073d65e7614da Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 29 Jun 2026 14:24:24 +0800 Subject: [PATCH 33/33] chore: limit reusable workflow secrets --- .github/workflows/react-component-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml index 9503b96..36dacae 100644 --- a/.github/workflows/react-component-ci.yml +++ b/.github/workflows/react-component-ci.yml @@ -5,4 +5,5 @@ permissions: jobs: test: uses: react-component/rc-test/.github/workflows/test-utoo.yml@main - secrets: inherit + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}