From 1c90c46c779595214378b4a6a9a8f2554d203e33 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 26 Jun 2026 13:05:42 +0800 Subject: [PATCH 01/32] chore: standardize repository setup --- .github/FUNDING.yml | 2 + .github/workflows/ci.yml | 2 +- .../workflows/cloudflare-pages-preview.yml | 38 ++++ .github/workflows/codeql.yml | 22 +- .github/workflows/react-doctor.yml | 27 +++ .github/workflows/surge-preview.yml | 35 ++++ README.md | 189 +++++++----------- now.json | 11 - package.json | 7 +- src/Dropdown.tsx | 28 ++- vercel.json | 6 + 11 files changed, 210 insertions(+), 157 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 delete mode 100644 now.json create mode 100644 vercel.json 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/ci.yml b/.github/workflows/ci.yml index b50874b..318c6a9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,5 +4,5 @@ on: ['push', 'pull_request'] jobs: CI: - uses: react-component/rc-test/.github/workflows/test.yml@main + uses: react-component/rc-test/.github/workflows/test-utoo.yml@main secrets: inherit diff --git a/.github/workflows/cloudflare-pages-preview.yml b/.github/workflows/cloudflare-pages-preview.yml new file mode 100644 index 0000000..2de7ff8 --- /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 .docs --project-name=${{ env.CLOUDFLARE_PAGES_PROJECT }} --branch=${{ github.head_ref }} + gitHubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index ca134dd..6feca7a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,12 +1,12 @@ -name: "CodeQL" +name: 'CodeQL' on: push: - branches: [ "master" ] + branches: ['master'] pull_request: - branches: [ "master" ] + branches: ['master'] schedule: - - cron: "38 3 * * 6" + - cron: '38 3 * * 6' jobs: analyze: @@ -20,22 +20,24 @@ jobs: strategy: fail-fast: false matrix: - language: [ javascript ] + language: [javascript] steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + with: + persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with: languages: ${{ matrix.language }} queries: +security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with: - category: "/language:${{ matrix.language }}" + category: '/language:${{ matrix.language }}' 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/surge-preview.yml b/.github/workflows/surge-preview.yml new file mode 100644 index 0000000..2d5c51d --- /dev/null +++ b/.github/workflows/surge-preview.yml @@ -0,0 +1,35 @@ +name: Surge Preview + +on: + pull_request: + +permissions: + contents: read + pull-requests: write + checks: write + statuses: 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: .docs + 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 2239225..fce7c7c 100644 --- a/README.md +++ b/README.md @@ -1,143 +1,89 @@ -# @rc-component/dropdown +
+

@rc-component/dropdown

+

🔽 A trigger-driven dropdown component for React.

-react dropdown component. + + 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] +
+ [npm-image]: https://img.shields.io/npm/v/@rc-component/dropdown.svg?style=flat-square [npm-url]: https://npmjs.org/package/@rc-component/dropdown -[travis-image]: https://img.shields.io/travis/react-component/dropdown/master?style=flat-square -[travis-url]: https://travis-ci.com/react-component/dropdown [github-actions-image]: https://github.com/react-component/dropdown/actions/workflows/ci.yml/badge.svg [github-actions-url]: https://github.com/react-component/dropdown/actions/workflows/ci.yml [codecov-image]: https://img.shields.io/codecov/c/github/react-component/dropdown/master.svg?style=flat-square [codecov-url]: https://app.codecov.io/gh/react-component/dropdown -[david-url]: https://david-dm.org/react-component/dropdown -[david-image]: https://david-dm.org/react-component/dropdown/status.svg?style=flat-square -[david-dev-url]: https://david-dm.org/react-component/dropdown?type=dev -[david-dev-image]: https://david-dm.org/react-component/dropdown/dev-status.svg?style=flat-square [download-image]: https://img.shields.io/npm/dm/@rc-component/dropdown.svg?style=flat-square [download-url]: https://npmjs.org/package/@rc-component/dropdown +[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/%40rc-component%2Fdropdown?style=flat-square [bundlephobia-url]: https://bundlephobia.com/package/@rc-component/dropdown -[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/dropdown -[dumi-url]: https://github.com/umijs/dumi [dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square +[dumi-url]: https://github.com/umijs/dumi -## Screenshot +## Highlights -![](https://t.alipayobjects.com/images/rmsweb/T1bWpgXgBaXXXXXXXX.png) +- Built on `@rc-component/trigger`. +- Supports hover, click, context menu, and custom trigger actions. +- Accepts a React element or render function as dropdown overlay. +- Supports align point behavior and trigger-width matching. -## Example +## Install -online example: http://react-component.github.io/dropdown/examples/ +```bash +npm install @rc-component/dropdown +``` -## install +## Usage -[![@rc-component/dropdown](https://nodei.co/npm/@rc-component/dropdown.png)](https://npmjs.org/package/@rc-component/dropdown) +```tsx | pure +import Dropdown from '@rc-component/dropdown'; +import '@rc-component/dropdown/assets/index.css'; + +export default function App() { + return ( + Dropdown content} trigger={['click']}> + + + ); +} +``` -## Usage +## Examples -```js -var Dropdown = require('@rc-component/dropdown'); -// use dropdown +```bash +npm install +npm start ``` +Then open `http://localhost:8000`. + ## API -### props - - - - - - - - - - - - - - - - - - - - -           -           - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -           -           - - - - - - - - -
nametypedefaultdescription
overlayClassNameStringadditional css class of root dom node
openClassNameString`${prefixCls}-open`className of trigger when dropdown is opened
prefixClsStringrc-dropdownprefix class name
transitionNameStringdropdown menu's animation css class name
animationStringpart of dropdown menu's animation css class name
placementStringbottomLeftPosition of menu item. There are: top, topCenter, topRight, bottomLeft, bottom, bottomRight
onVisibleChangeFunctioncall when visible is changed
visiblebooleanwhether tooltip is visible
defaultVisiblebooleanwhether tooltip is visible initially
overlayrc-menurc-menu element
onOverlayClickfunction(e)call when overlay is clicked
minOverlayWidthMatchTriggerbooleantrue (false when set alignPoint)whether overlay's width must not be less than trigger's
getPopupContainerFunction(menuDOMNode): HTMLElement() => document.bodyWhere to render the DOM node of dropdown
- -Note: Additional props are passed into the underlying [rc-trigger](https://github.com/react-component/trigger) component. This can be useful for example, to display the dropdown in a separate [portal](https://reactjs.org/docs/portals.html)-driven window via the `getDocument()` rc-trigger prop. +Additional props are passed to the underlying [`@rc-component/trigger`](https://github.com/react-component/trigger) component. + +| Property | Description | Type | Default | +| --- | --- | --- | --- | +| alignPoint | Align popup to the click point | boolean | false | +| animation | Popup animation name | string | - | +| defaultVisible | Initial visible state | boolean | - | +| getPopupContainer | Container where dropdown is rendered | `(node: HTMLElement) => HTMLElement` | `() => document.body` | +| minOverlayWidthMatchTrigger | Whether overlay width should be at least trigger width | boolean | `true` unless `alignPoint` is set | +| openClassName | Class name added to trigger when dropdown is open | string | `${prefixCls}-open` | +| overlay | Dropdown overlay | `React.ReactElement \| (() => React.ReactElement)` | - | +| overlayClassName | Additional overlay class name | string | - | +| overlayStyle | Overlay style | `React.CSSProperties` | - | +| placement | Dropdown placement | string | `bottomLeft` | +| prefixCls | Component class name prefix | string | `rc-dropdown` | +| transitionName | Popup transition class name | string | - | +| trigger | Trigger action | `ActionType \| ActionType[]` | `['hover']` | +| visible | Controlled visible state | boolean | - | +| onOverlayClick | Callback when overlay is clicked | `(event: React.MouseEvent) => void` | - | +| onVisibleChange | Callback when visibility changes | `(visible: boolean) => void` | - | ## Development @@ -146,21 +92,22 @@ npm install npm start ``` -## Test Case - ```bash npm test -npm run chrome-test +npm run tsc +npm run lint +npm run compile +npm run build ``` -## Coverage +## Release ```bash -npm run coverage +npm run prepublishOnly ``` -open coverage/ dir +The release script compiles the package and runs `rc-np`. ## License -@rc-component/dropdown is released under the MIT license. +`@rc-component/dropdown` is released under the MIT license. diff --git a/now.json b/now.json deleted file mode 100644 index 745d0e5..0000000 --- a/now.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": 2, - "name": "rc-dropdown", - "builds": [ - { - "src": "package.json", - "use": "@now/static-build", - "config": { "distDir": ".docs" } - } - ] -} diff --git a/package.json b/package.json index e2b3164..fe61e35 100644 --- a/package.json +++ b/package.json @@ -34,13 +34,14 @@ "now-build": "npm run build", "prepare": "husky install && dumi setup", "prepublishOnly": "npm run compile && rc-np", + "prettier": "prettier --write --ignore-unknown .", "start": "dumi dev", - "test": "rc-test" + "test": "rc-test", + "tsc": "tsc --noEmit" }, "lint-staged": { "**/*.{js,jsx,tsx,ts,md,json}": [ - "prettier --write", - "git add" + "prettier --write --ignore-unknown" ] }, "dependencies": { diff --git a/src/Dropdown.tsx b/src/Dropdown.tsx index 7707f26..8f598a1 100644 --- a/src/Dropdown.tsx +++ b/src/Dropdown.tsx @@ -1,7 +1,6 @@ import Trigger, { type ActionType, type AlignType, - type AnimationType, type BuildInPlacements, type TriggerProps, type TriggerRef, @@ -32,7 +31,7 @@ export interface DropdownProps transitionName?: string; overlayClassName?: string; openClassName?: string; - animation?: AnimationType; + animation?: string; align?: AlignType; overlayStyle?: React.CSSProperties; placement?: keyof typeof Placements; @@ -135,15 +134,22 @@ const Dropdown = React.forwardRef((props, ref) => { return `${prefixCls}-open`; }; - const childrenNode = React.cloneElement(children as React.ReactElement, { - className: clsx( - (children as React.ReactElement).props?.className, - mergedVisible && getOpenClassName(), - ), - ref: supportRef(children) - ? composeRef(childRef, getNodeRef(children as React.ReactElement)) - : undefined, - }); + const child = children as React.ReactElement; + const childClassName = clsx( + child.props?.className, + mergedVisible && getOpenClassName(), + ); + + const childrenNode = supportRef(child) ? ( + React.cloneElement(child, { + className: childClassName, + ref: composeRef(childRef, getNodeRef(child)), + }) + ) : ( + + {child} + + ); let triggerHideAction = hideAction; if (!triggerHideAction && trigger.indexOf('contextMenu') !== -1) { diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..3587862 --- /dev/null +++ b/vercel.json @@ -0,0 +1,6 @@ +{ + "framework": "umijs", + "installCommand": "npm install", + "buildCommand": "npm run build", + "outputDirectory": ".docs" +} From 452068ece5c53244e630ba9d883beb5e0ed73c91 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 26 Jun 2026 13:29:56 +0800 Subject: [PATCH 02/32] chore: address review feedback --- .../workflows/cloudflare-pages-preview.yml | 4 +++ .github/workflows/surge-preview.yml | 4 +++ src/Dropdown.tsx | 34 ++++++++++++------- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cloudflare-pages-preview.yml b/.github/workflows/cloudflare-pages-preview.yml index 2de7ff8..d4b31ec 100644 --- a/.github/workflows/cloudflare-pages-preview.yml +++ b/.github/workflows/cloudflare-pages-preview.yml @@ -3,6 +3,10 @@ name: Cloudflare Pages Preview on: pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + permissions: contents: read deployments: write diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 2d5c51d..729a842 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -3,6 +3,10 @@ name: Surge Preview on: pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + permissions: contents: read pull-requests: write diff --git a/src/Dropdown.tsx b/src/Dropdown.tsx index 8f598a1..9896eec 100644 --- a/src/Dropdown.tsx +++ b/src/Dropdown.tsx @@ -134,22 +134,32 @@ const Dropdown = React.forwardRef((props, ref) => { return `${prefixCls}-open`; }; - const child = children as React.ReactElement; + const child = children as React.ReactNode; + const validChild = React.isValidElement<{ className?: string }>(child); + const elementChild = validChild ? child : null; const childClassName = clsx( - child.props?.className, + elementChild?.props.className, mergedVisible && getOpenClassName(), ); + const triggerChildProps: React.HTMLAttributes & + React.RefAttributes = { + className: childClassName, + ref: composeRef(childRef, elementChild && getNodeRef(elementChild)), + }; - const childrenNode = supportRef(child) ? ( - React.cloneElement(child, { - className: childClassName, - ref: composeRef(childRef, getNodeRef(child)), - }) - ) : ( - - {child} - - ); + const childrenNode = + elementChild && supportRef(elementChild) ? ( + React.cloneElement( + elementChild as React.ReactElement< + React.HTMLAttributes & React.RefAttributes + >, + triggerChildProps, + ) + ) : ( + + {child} + + ); let triggerHideAction = hideAction; if (!triggerHideAction && trigger.indexOf('contextMenu') !== -1) { From bbb3e00a1ff2568b497c2407cdd68e80afeaa7a5 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 26 Jun 2026 15:03:52 +0800 Subject: [PATCH 03/32] chore: remove cloudflare preview and now-build --- .../workflows/cloudflare-pages-preview.yml | 42 ------------------- package.json | 1 - 2 files changed, 43 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 d4b31ec..0000000 --- a/.github/workflows/cloudflare-pages-preview.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Cloudflare Pages Preview - -on: - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} - cancel-in-progress: true - -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 .docs --project-name=${{ env.CLOUDFLARE_PAGES_PROJECT }} --branch=${{ github.head_ref }} - gitHubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index fe61e35..0c2b5d8 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "compile": "father build && lessc assets/index.less assets/index.css", "coverage": "rc-test --coverage", "lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js", - "now-build": "npm run build", "prepare": "husky install && dumi setup", "prepublishOnly": "npm run compile && rc-np", "prettier": "prettier --write --ignore-unknown .", From d16b8ebdc3c19cf64f8151448d7227138408b880 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 01:56:46 +0800 Subject: [PATCH 04/32] docs: standardize README release details --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fce7c7c..2e0c0cd 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] @@ -106,8 +109,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/dropdown` is released under the MIT license. +@rc-component/dropdown is released under the [MIT](./LICENSE) license. From 54fe98bf93adc0779be6c4aa072b78d50bdc5a78 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 02:13:56 +0800 Subject: [PATCH 05/32] 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 729a842..c411178 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -29,7 +29,7 @@ jobs: surge_token: ${{ env.SURGE_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }} dist: .docs - failOnError: true + failOnError: false setCommitStatus: true build: | npm install From 21186bb736e017d40b62f6140a6c62c0f9fde052 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 02:25:41 +0800 Subject: [PATCH 06/32] 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 c411178..1634a79 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -30,7 +30,7 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} dist: .docs failOnError: false - setCommitStatus: true + setCommitStatus: false build: | npm install npm run build From 53adbf137f6f6de1b21a37a0f316cedbd6589679 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 13:03:59 +0800 Subject: [PATCH 07/32] 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 2e0c0cd..ee24265 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,10 @@

@rc-component/dropdown

+

Part of the Ant Design ecosystem.

🔽 A trigger-driven dropdown 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 fc0d148c739ffad3cbeb0fbc87cba030c390eb32 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 13:22:14 +0800 Subject: [PATCH 08/32] 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 1634a79..38c821b 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -17,23 +17,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: .docs 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 0065a00fb19dd527d1ee907779e2695204694917 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 22:19:20 +0800 Subject: [PATCH 09/32] docs: add Chinese README --- README.md | 2 + README.zh-CN.md | 114 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 README.zh-CN.md diff --git a/README.md b/README.md index ee24265..bb39a64 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@

🔽 A trigger-driven dropdown component for React.

+

English | 简体中文

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

@rc-component/dropdown

+

Ant Design 生态的一部分。

+

⬇️ React 下拉菜单基础组件,基于 trigger 和 menu 能力构建。

+
+ +

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/dropdown.svg?style=flat-square +[npm-url]: https://npmjs.org/package/@rc-component/dropdown +[github-actions-image]: https://github.com/react-component/dropdown/actions/workflows/ci.yml/badge.svg +[github-actions-url]: https://github.com/react-component/dropdown/actions/workflows/ci.yml +[codecov-image]: https://img.shields.io/codecov/c/github/react-component/dropdown/master.svg?style=flat-square +[codecov-url]: https://app.codecov.io/gh/react-component/dropdown +[download-image]: https://img.shields.io/npm/dm/@rc-component/dropdown.svg?style=flat-square +[download-url]: https://npmjs.org/package/@rc-component/dropdown +[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/%40rc-component%2Fdropdown?style=flat-square +[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/dropdown +[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square +[dumi-url]: https://github.com/umijs/dumi + +## 特性 + +- Built on `@rc-component/trigger`. +- 支持 hover, click, context menu, and custom trigger actions. +- Accepts a React element or render function as dropdown overlay. +- 支持 align point behavior and trigger-width matching. + +## 安装 + +```bash +npm install @rc-component/dropdown +``` + +## 使用 + +```tsx | pure +import Dropdown from '@rc-component/dropdown'; +import '@rc-component/dropdown/assets/index.css'; + +export default function App() { + return ( + Dropdown content
} trigger={['click']}> + + + ); +} +``` + +## 示例 + +```bash +npm install +npm start +``` + +然后打开 `http://localhost:8000`。 + +## API + +Additional props are passed to the underlying [`@rc-component/trigger`](https://github.com/react-component/trigger) component. + +| 参数 | 说明 | 类型 | 默认值 | +| --- | --- | --- | --- | +| alignPoint | Align popup to the click point | boolean | false | +| animation | Popup animation name | string | - | +| defaultVisible | Initial visible state | boolean | - | +| getPopupContainer | Container where dropdown is rendered | `(node: HTMLElement) => HTMLElement` | `() => document.body` | +| minOverlayWidthMatchTrigger | Whether overlay width should be at least trigger width | boolean | `true` unless `alignPoint` is set | +| openClassName | Class name added to trigger when dropdown is open | string | `${prefixCls}-open` | +| overlay | Dropdown overlay | `React.ReactElement \| (() => React.ReactElement)` | - | +| overlayClassName | Additional overlay class name | string | - | +| overlayStyle | Overlay style | `React.CSSProperties` | - | +| placement | Dropdown placement | string | `bottomLeft` | +| prefixCls | Component class name prefix | string | `rc-dropdown` | +| transitionName | Popup transition class name | string | - | +| trigger | Trigger action | `ActionType \| ActionType[]` | `['hover']` | +| visible | Controlled visible state | boolean | - | +| onOverlayClick | Callback when overlay is clicked | `(event: React.MouseEvent) => void` | - | +| onVisibleChange | Callback when visibility changes | `(visible: boolean) => void` | - | + +## 本地开发 + +```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/dropdown is released under the [MIT](./LICENSE) license. From cac19fac4a13ac9377b6d649716a456bb5853085 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 22:34:35 +0800 Subject: [PATCH 10/32] 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 bb39a64..5beb36e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@

@rc-component/dropdown

Part of the Ant Design ecosystem.

+ Ant Design

🔽 A trigger-driven dropdown component for React.

diff --git a/README.zh-CN.md b/README.zh-CN.md index e4a2f2f..746096d 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,6 +1,7 @@

@rc-component/dropdown

Ant Design 生态的一部分。

+ Ant Design

⬇️ React 下拉菜单基础组件,基于 trigger 和 menu 能力构建。

From 75efcead04ed9a8953924a2eb5635c5ecabce90c Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 27 Jun 2026 23:02:54 +0800 Subject: [PATCH 11/32] docs: refine bilingual README branding --- README.md | 3 +-- README.zh-CN.md | 45 ++++++++++++++++++++++----------------------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 5beb36e..e2f6e3d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@

@rc-component/dropdown

-

Part of the Ant Design ecosystem.

- Ant Design +

Ant Design Part of the Ant Design ecosystem.

🔽 A trigger-driven dropdown component for React.

diff --git a/README.zh-CN.md b/README.zh-CN.md index 746096d..54e3860 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -1,8 +1,7 @@

@rc-component/dropdown

-

Ant Design 生态的一部分。

- Ant Design -

⬇️ React 下拉菜单基础组件,基于 trigger 和 menu 能力构建。

+

Ant Design Ant Design 生态的一部分。

+

🔽 ⬇️ React 下拉菜单基础组件,基于 trigger 和 menu 能力构建。

English | 简体中文

@@ -30,9 +29,9 @@ ## 特性 - Built on `@rc-component/trigger`. -- 支持 hover, click, context menu, and custom trigger actions. -- Accepts a React element or render function as dropdown overlay. -- 支持 align point behavior and trigger-width matching. +- 支持悬停、单击、上下文菜单和自定义触发操作。 +- 接受 React 元素或渲染函数作为下拉覆盖。 +- 支持对齐点行为和触发宽度匹配。 ## 安装 @@ -66,26 +65,26 @@ npm start ## API -Additional props are passed to the underlying [`@rc-component/trigger`](https://github.com/react-component/trigger) component. +额外属性会透传给底层 [`@rc-component/trigger`](https://github.com/react-component/trigger) 组件。 | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | -| alignPoint | Align popup to the click point | boolean | false | -| animation | Popup animation name | string | - | -| defaultVisible | Initial visible state | boolean | - | -| getPopupContainer | Container where dropdown is rendered | `(node: HTMLElement) => HTMLElement` | `() => document.body` | -| minOverlayWidthMatchTrigger | Whether overlay width should be at least trigger width | boolean | `true` unless `alignPoint` is set | -| openClassName | Class name added to trigger when dropdown is open | string | `${prefixCls}-open` | +| alignPoint | 将弹层窗口与点击点对齐 | boolean | false | +| 动画片 | 弹层动画名称 | string | - | +| defaultVisible | 初始可见状态 | boolean | - | +| getPopupContainer | 呈现下拉列表的容器 | `(node: HTMLElement) => HTMLElement` | `() => document.body` | +| minOverlayWidthMatchTrigger | 覆盖宽度是否至少应为触发宽度 | boolean | `true` 除非设置了 `alignPoint` | +| openClassName | 打开下拉菜单时添加到触发器的className称 | string | `${prefixCls}-open` | | overlay | Dropdown overlay | `React.ReactElement \| (() => React.ReactElement)` | - | -| overlayClassName | Additional overlay class name | string | - | -| overlayStyle | Overlay style | `React.CSSProperties` | - | +| overlayClassName | 附加覆盖className称 | string | - | +| overlayStyle | 叠加样式 | `React.CSSProperties` | - | | placement | Dropdown placement | string | `bottomLeft` | -| prefixCls | Component class name prefix | string | `rc-dropdown` | -| transitionName | Popup transition class name | string | - | -| trigger | Trigger action | `ActionType \| ActionType[]` | `['hover']` | -| visible | Controlled visible state | boolean | - | -| onOverlayClick | Callback when overlay is clicked | `(event: React.MouseEvent) => void` | - | -| onVisibleChange | Callback when visibility changes | `(visible: boolean) => void` | - | +| prefixCls | 组件className前缀 | string | `rc-dropdown` | +| transitionName | 弹层过渡className称 | string | - | +| 扳机 | 触发动作 | `ActionType \| ActionType[]` | `['hover']` | +| 可见的 | 受控可见状态 | boolean | - | +| onOverlayClick | 点击覆盖时的回调 | `(event: React.MouseEvent) => void` | - | +| onVisibleChange | 可见性变化时的回调 | `(visible: boolean) => void` | - | ## 本地开发 @@ -108,8 +107,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/dropdown is released under the [MIT](./LICENSE) license. +@rc-component/dropdown 基于 [MIT](./LICENSE) 许可证发布。 From 918507b5fe4be8766898a436d709025ac2f6cf3e Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 01:28:38 +0800 Subject: [PATCH 12/32] chore: standardize rc tooling and docs --- .dumirc.ts | 7 ++++- .github/workflows/surge-preview.yml | 2 +- README.md | 2 ++ README.zh-CN.md | 2 ++ package.json | 44 ++++++++++++++--------------- tsconfig.json | 13 +++++++-- vercel.json | 2 +- 7 files changed, 44 insertions(+), 28 deletions(-) diff --git a/.dumirc.ts b/.dumirc.ts index ad57b55..ff146e8 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -1,13 +1,18 @@ // more config: https://d.umijs.org/config import { defineConfig } from 'dumi'; +const basePath = process.env.GH_PAGES ? '/dropdown/' : '/'; +const publicPath = basePath; + export default defineConfig({ favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'], themeConfig: { name: 'rc-dropdown', logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', }, - outputPath: '.docs', + outputPath: 'docs-dist', + base: basePath, + publicPath, exportStatic: {}, styles: [ ` diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index 38c821b..faf6b8b 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -34,7 +34,7 @@ jobs: with: surge_token: ${{ env.SURGE_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }} - dist: .docs + dist: docs-dist failOnError: false setCommitStatus: false - name: Skip Surge preview diff --git a/README.md b/README.md index e2f6e3d..8e9a8da 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ export default function App() { ## Examples +Run the local dumi site: + ```bash npm install npm start diff --git a/README.zh-CN.md b/README.zh-CN.md index 54e3860..3761f79 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -56,6 +56,8 @@ export default function App() { ## 示例 +运行本地 dumi 站点: + ```bash npm install npm start diff --git a/package.json b/package.json index 0c2b5d8..64ceeda 100644 --- a/package.json +++ b/package.json @@ -51,29 +51,29 @@ "devDependencies": { "@rc-component/father-plugin": "^2.2.0", "@rc-component/menu": "^1.0.0", - "@rc-component/np": "^1.0.3", + "@rc-component/np": "^1.0.4", "@rc-component/resize-observer": "^1.0.0", - "@testing-library/jest-dom": "^5.16.5", - "@testing-library/react": "^14.0.0", - "@types/jest": "^29.0.0", - "@types/node": "^24.5.2", - "@types/react": "^18.0.0", - "@types/react-dom": "^18.0.0", - "@types/warning": "^3.0.0", - "@umijs/fabric": "^3.0.0", - "dumi": "^2.0.0", - "eslint": "^7.18.0", - "father": "^4.0.0", - "glob": "^10.0.0", - "husky": "^8.0.3", - "jest-environment-jsdom": "^29.5.0", - "less": "^4.1.1", - "lint-staged": "^13.2.1", - "prettier": "^2.8.7", - "rc-test": "^7.0.14", - "react": "^18.0.0", - "react-dom": "^18.0.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", + "@types/warning": "^3.0.4", + "@umijs/fabric": "^4.0.1", + "dumi": "^2.4.35", + "eslint": "^8.57.1", + "father": "^4.6.23", + "glob": "^13.0.6", + "husky": "^9.1.7", + "jest-environment-jsdom": "^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": ">=16.11.0", diff --git a/tsconfig.json b/tsconfig.json index 468fa20..a96eadc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,10 +9,17 @@ "jsx": "react", "skipLibCheck": true, "paths": { - "@@/*": [".dumi/tmp/*"] - } + "@@/*": [ + ".dumi/tmp/*" + ] + }, + "ignoreDeprecations": "5.0" }, - "include": ["./src", "./tests", "./typings/"], + "include": [ + "./src", + "./tests", + "./typings/" + ], "typings": "./typings/index.d.ts", "exclude": [ "node_modules", diff --git a/vercel.json b/vercel.json index 3587862..5f9139e 100644 --- a/vercel.json +++ b/vercel.json @@ -2,5 +2,5 @@ "framework": "umijs", "installCommand": "npm install", "buildCommand": "npm run build", - "outputDirectory": ".docs" + "outputDirectory": "docs-dist" } From ca1d70c87012589501e736f1427a816753f7f08f Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 02:01:04 +0800 Subject: [PATCH 13/32] chore: address standardization review comments --- .github/workflows/surge-preview.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml index faf6b8b..cb6c8c4 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -22,13 +22,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: @@ -38,5 +48,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." From def709cf9fbe50d8e683477675233cc909587aa0 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 02:10:33 +0800 Subject: [PATCH 14/32] chore: include father config in type checks --- tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/tsconfig.json b/tsconfig.json index a96eadc..00303f7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,6 +16,7 @@ "ignoreDeprecations": "5.0" }, "include": [ + ".fatherrc.ts", "./src", "./tests", "./typings/" From 2027ffaa704e27b4fba5bd82736c5dc78abc57da Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 12:23:42 +0800 Subject: [PATCH 15/32] ci: update GitHub Actions versions --- .github/workflows/codeql.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 6feca7a..be23e15 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -29,15 +29,15 @@ jobs: persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e + uses: github/codeql-action/init@a0853c24544627f65ddf259abe73b1d18a591444 with: languages: ${{ matrix.language }} queries: +security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e + uses: github/codeql-action/autobuild@a0853c24544627f65ddf259abe73b1d18a591444 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e + uses: github/codeql-action/analyze@a0853c24544627f65ddf259abe73b1d18a591444 with: category: '/language:${{ matrix.language }}' From 73add1c256dbae7edf7e772511cd34fb3e5dce95 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 12:27:51 +0800 Subject: [PATCH 16/32] ci: use resolvable CodeQL action ref --- .github/workflows/codeql.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index be23e15..6feca7a 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -29,15 +29,15 @@ jobs: persist-credentials: false - name: Initialize CodeQL - uses: github/codeql-action/init@a0853c24544627f65ddf259abe73b1d18a591444 + uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with: languages: ${{ matrix.language }} queries: +security-and-quality - name: Autobuild - uses: github/codeql-action/autobuild@a0853c24544627f65ddf259abe73b1d18a591444 + uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@a0853c24544627f65ddf259abe73b1d18a591444 + uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e with: category: '/language:${{ matrix.language }}' From 703ca12374f46a8a63ca43d04190ab6859f53b76 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 12:40:52 +0800 Subject: [PATCH 17/32] fix: align dropdown docs and open class handling --- .gitignore | 1 + README.md | 4 ++-- README.zh-CN.md | 24 ++++++++++++------------ src/Dropdown.tsx | 12 ++++++++++-- tests/basic.test.tsx | 13 +++++++++++++ 5 files changed, 38 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index b0774d5..26de349 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ pnpm-lock.yaml .dumi/tmp-test .dumi/tmp-production .docs +docs-dist diff --git a/README.md b/README.md index 8e9a8da..42c220b 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Additional props are passed to the underlying [`@rc-component/trigger`](https:// | --- | --- | --- | --- | | alignPoint | Align popup to the click point | boolean | false | | animation | Popup animation name | string | - | -| defaultVisible | Initial visible state | boolean | - | +| arrow | Whether to show dropdown arrow | boolean | false | | getPopupContainer | Container where dropdown is rendered | `(node: HTMLElement) => HTMLElement` | `() => document.body` | | minOverlayWidthMatchTrigger | Whether overlay width should be at least trigger width | boolean | `true` unless `alignPoint` is set | | openClassName | Class name added to trigger when dropdown is open | string | `${prefixCls}-open` | @@ -85,7 +85,7 @@ Additional props are passed to the underlying [`@rc-component/trigger`](https:// | transitionName | Popup transition class name | string | - | | trigger | Trigger action | `ActionType \| ActionType[]` | `['hover']` | | visible | Controlled visible state | boolean | - | -| onOverlayClick | Callback when overlay is clicked | `(event: React.MouseEvent) => void` | - | +| onOverlayClick | Callback when overlay is clicked | `(event: Event) => void` | - | | onVisibleChange | Callback when visibility changes | `(visible: boolean) => void` | - | ## Development diff --git a/README.zh-CN.md b/README.zh-CN.md index 3761f79..bee78ae 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -28,7 +28,7 @@ ## 特性 -- Built on `@rc-component/trigger`. +- 基于 `@rc-component/trigger` 构建。 - 支持悬停、单击、上下文菜单和自定义触发操作。 - 接受 React 元素或渲染函数作为下拉覆盖。 - 支持对齐点行为和触发宽度匹配。 @@ -72,20 +72,20 @@ npm start | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | alignPoint | 将弹层窗口与点击点对齐 | boolean | false | -| 动画片 | 弹层动画名称 | string | - | -| defaultVisible | 初始可见状态 | boolean | - | +| animation | 弹层动画名称 | string | - | +| arrow | 是否显示下拉箭头 | boolean | false | | getPopupContainer | 呈现下拉列表的容器 | `(node: HTMLElement) => HTMLElement` | `() => document.body` | | minOverlayWidthMatchTrigger | 覆盖宽度是否至少应为触发宽度 | boolean | `true` 除非设置了 `alignPoint` | -| openClassName | 打开下拉菜单时添加到触发器的className称 | string | `${prefixCls}-open` | -| overlay | Dropdown overlay | `React.ReactElement \| (() => React.ReactElement)` | - | -| overlayClassName | 附加覆盖className称 | string | - | +| openClassName | 打开下拉菜单时添加到触发器的类名 | string | `${prefixCls}-open` | +| overlay | 下拉菜单内容 | `React.ReactElement \| (() => React.ReactElement)` | - | +| overlayClassName | 附加弹层类名 | string | - | | overlayStyle | 叠加样式 | `React.CSSProperties` | - | -| placement | Dropdown placement | string | `bottomLeft` | -| prefixCls | 组件className前缀 | string | `rc-dropdown` | -| transitionName | 弹层过渡className称 | string | - | -| 扳机 | 触发动作 | `ActionType \| ActionType[]` | `['hover']` | -| 可见的 | 受控可见状态 | boolean | - | -| onOverlayClick | 点击覆盖时的回调 | `(event: React.MouseEvent) => void` | - | +| placement | 下拉菜单位置 | string | `bottomLeft` | +| prefixCls | 组件类名前缀 | string | `rc-dropdown` | +| transitionName | 弹层过渡类名 | string | - | +| trigger | 触发动作 | `ActionType \| ActionType[]` | `['hover']` | +| visible | 受控可见状态 | boolean | - | +| onOverlayClick | 点击下拉菜单内容时的回调 | `(event: Event) => void` | - | | onVisibleChange | 可见性变化时的回调 | `(visible: boolean) => void` | - | ## 本地开发 diff --git a/src/Dropdown.tsx b/src/Dropdown.tsx index 9896eec..aa8b17a 100644 --- a/src/Dropdown.tsx +++ b/src/Dropdown.tsx @@ -146,6 +146,14 @@ const Dropdown = React.forwardRef((props, ref) => { className: childClassName, ref: composeRef(childRef, elementChild && getNodeRef(elementChild)), }; + const fallbackChild = elementChild + ? React.cloneElement( + elementChild as React.ReactElement>, + { + className: childClassName, + }, + ) + : child; const childrenNode = elementChild && supportRef(elementChild) ? ( @@ -156,8 +164,8 @@ const Dropdown = React.forwardRef((props, ref) => { triggerChildProps, ) ) : ( - - {child} + + {fallbackChild} ); diff --git a/tests/basic.test.tsx b/tests/basic.test.tsx index 3956370..bc62fb8 100644 --- a/tests/basic.test.tsx +++ b/tests/basic.test.tsx @@ -286,6 +286,19 @@ describe('dropdown', () => { ).toBeFalsy(); }); + it('should pass openClassName to child without ref support', () => { + const LegacyButton = (props: HTMLAttributes) => ( + + ); + const { container } = render( + Test
} visible> + + , + ); + + expect(container.querySelector('.my-button')).toHaveClass('rc-dropdown-open'); + }); + it('overlay callback', async () => { const overlay =
Test
; const { container, baseElement } = render( From 2baf8c949e36d5cbc81bc9c18916561d0bc2a221 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 12:47:57 +0800 Subject: [PATCH 18/32] fix: preserve dropdown fallback wrapper class --- src/Dropdown.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dropdown.tsx b/src/Dropdown.tsx index aa8b17a..3a80efd 100644 --- a/src/Dropdown.tsx +++ b/src/Dropdown.tsx @@ -164,7 +164,7 @@ const Dropdown = React.forwardRef((props, ref) => { triggerChildProps, ) ) : ( - + {fallbackChild} ); From efdbd3c67542ad76065ce05a6a68064dd9b37663 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 12:53:41 +0800 Subject: [PATCH 19/32] fix: simplify dropdown fallback child handling --- src/Dropdown.tsx | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/Dropdown.tsx b/src/Dropdown.tsx index 3a80efd..ecbba77 100644 --- a/src/Dropdown.tsx +++ b/src/Dropdown.tsx @@ -134,29 +134,21 @@ const Dropdown = React.forwardRef((props, ref) => { return `${prefixCls}-open`; }; - const child = children as React.ReactNode; - const validChild = React.isValidElement<{ className?: string }>(child); - const elementChild = validChild ? child : null; + const elementChild = children as React.ReactElement< + React.HTMLAttributes + >; const childClassName = clsx( - elementChild?.props.className, + elementChild.props?.className, mergedVisible && getOpenClassName(), ); const triggerChildProps: React.HTMLAttributes & React.RefAttributes = { className: childClassName, - ref: composeRef(childRef, elementChild && getNodeRef(elementChild)), + ref: composeRef(childRef, getNodeRef(elementChild)), }; - const fallbackChild = elementChild - ? React.cloneElement( - elementChild as React.ReactElement>, - { - className: childClassName, - }, - ) - : child; const childrenNode = - elementChild && supportRef(elementChild) ? ( + supportRef(elementChild) ? ( React.cloneElement( elementChild as React.ReactElement< React.HTMLAttributes & React.RefAttributes @@ -165,7 +157,9 @@ const Dropdown = React.forwardRef((props, ref) => { ) ) : ( - {fallbackChild} + {React.cloneElement(elementChild, { + className: childClassName, + })} ); From 73ec93372fe3b7c5e1aefe0666deab7dcb1a7ee9 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 13:59:51 +0800 Subject: [PATCH 20/32] ci: use actions checkout v7 --- .github/workflows/codeql.yml | 2 +- .github/workflows/react-doctor.yml | 2 +- .github/workflows/surge-preview.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 6feca7a..0446c60 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + uses: actions/checkout@v7 with: persist-credentials: false 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/surge-preview.yml b/.github/workflows/surge-preview.yml index cb6c8c4..ebfecd5 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -19,7 +19,7 @@ jobs: env: PREVIEW: true steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + - uses: actions/checkout@v7 with: persist-credentials: false - name: Check Surge token From b384a3c4e02b7bbf62c7418c1358a18cec703442 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 14:30:16 +0800 Subject: [PATCH 21/32] chore: standardize package metadata --- package.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 64ceeda..6a7036d 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,13 @@ "react", "react-dropdown" ], - "homepage": "http://github.com/react-component/dropdown", + "homepage": "https://react-component.github.io/dropdown", "bugs": { - "url": "http://github.com/react-component/dropdown/issues" + "url": "https://github.com/react-component/dropdown/issues" }, "repository": { "type": "git", - "url": "git@github.com:react-component/dropdown.git" + "url": "https://github.com/react-component/dropdown.git" }, "license": "MIT", "maintainers": [ @@ -78,5 +78,8 @@ "peerDependencies": { "react": ">=16.11.0", "react-dom": ">=16.11.0" + }, + "publishConfig": { + "access": "public" } } From e1f71d25ce38dbb3363dfa53f2cb83fc8c8a7ca9 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 14:36:43 +0800 Subject: [PATCH 22/32] ci: standardize dependabot updates --- .github/dependabot.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5990d9c..3b730ef 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,11 +1,19 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file - version: 2 updates: - - package-ecosystem: "" # See documentation for possible values - directory: "/" # Location of package manifests + - 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" + interval: weekly + day: monday + time: '21:00' + timezone: Asia/Shanghai + open-pull-requests-limit: 10 From 060ebe8894862fb4fbc0f7c774f4762cc75b3c95 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 17:14:42 +0800 Subject: [PATCH 23/32] 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 ebfecd5..eaff160 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -16,6 +16,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 c1d6f2f1cea3c14d913e7e8cadad77a6fe394c01 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 19:38:04 +0800 Subject: [PATCH 24/32] 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 42c220b..4e90ee1 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] @@ -95,6 +94,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 bee78ae..0dc3a6b 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] @@ -95,6 +94,8 @@ npm install npm start ``` +dumi 站点默认运行在 `http://localhost:8000`。 + ```bash npm test npm run tsc From 4b90abe92238d28429bd520be7d2bd961a1b662b Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 19:57:04 +0800 Subject: [PATCH 25/32] chore: standardize husky configuration --- .husky/pre-commit | 3 --- package.json | 6 ++---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index d24fdfc..2312dc5 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - npx lint-staged diff --git a/package.json b/package.json index 6a7036d..9a7aa7a 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "compile": "father build && lessc assets/index.less assets/index.css", "coverage": "rc-test --coverage", "lint": "eslint src/ docs/examples/ --ext .tsx,.ts,.jsx,.js", - "prepare": "husky install && dumi setup", + "prepare": "husky && dumi setup", "prepublishOnly": "npm run compile && rc-np", "prettier": "prettier --write --ignore-unknown .", "start": "dumi dev", @@ -39,9 +39,7 @@ "tsc": "tsc --noEmit" }, "lint-staged": { - "**/*.{js,jsx,tsx,ts,md,json}": [ - "prettier --write --ignore-unknown" - ] + "*": "prettier --write --ignore-unknown" }, "dependencies": { "@rc-component/trigger": "^3.0.0", From 903d8eb9cfb11f7b4af11f04e326d32935e24fc7 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 20:05:48 +0800 Subject: [PATCH 26/32] 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 4e90ee1..534c40c 100644 --- a/README.md +++ b/README.md @@ -2,29 +2,18 @@

@rc-component/dropdown

Ant Design Part of the Ant Design ecosystem.

🔽 A trigger-driven dropdown 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/dropdown.svg?style=flat-square -[npm-url]: https://npmjs.org/package/@rc-component/dropdown -[github-actions-image]: https://github.com/react-component/dropdown/actions/workflows/ci.yml/badge.svg -[github-actions-url]: https://github.com/react-component/dropdown/actions/workflows/ci.yml -[codecov-image]: https://img.shields.io/codecov/c/github/react-component/dropdown/master.svg?style=flat-square -[codecov-url]: https://app.codecov.io/gh/react-component/dropdown -[download-image]: https://img.shields.io/npm/dm/@rc-component/dropdown.svg?style=flat-square -[download-url]: https://npmjs.org/package/@rc-component/dropdown -[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/%40rc-component%2Fdropdown?style=flat-square -[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/dropdown -[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square -[dumi-url]: https://github.com/umijs/dumi - +

English | 简体中文

## Highlights - Built on `@rc-component/trigger`. diff --git a/README.zh-CN.md b/README.zh-CN.md index 0dc3a6b..0f41736 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -2,29 +2,18 @@

@rc-component/dropdown

Ant Design Ant Design 生态的一部分。

🔽 ⬇️ React 下拉菜单基础组件,基于 trigger 和 menu 能力构建。

-
- -

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

English | 简体中文

## 特性 - 基于 `@rc-component/trigger` 构建。 From 5146bcfaeb9b33a860d83fdfc254c075a3c307df Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 20:31:50 +0800 Subject: [PATCH 27/32] chore: standardize package type entry --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 9a7aa7a..3dc9d06 100644 --- a/package.json +++ b/package.json @@ -79,5 +79,6 @@ }, "publishConfig": { "access": "public" - } + }, + "types": "./es/index.d.ts" } From af3de5a9fd6b020672c2cb8c3eaf113fec6b0f1c Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 21:00:01 +0800 Subject: [PATCH 28/32] 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 534c40c..75ac90b 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@

English | 简体中文

+ ## Highlights - Built on `@rc-component/trigger`. diff --git a/README.zh-CN.md b/README.zh-CN.md index 0f41736..d81c375 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -14,6 +14,7 @@

English | 简体中文

+ ## 特性 - 基于 `@rc-component/trigger` 构建。 From 5b3778d80d725c7cf228ecd311994fa0ee37f6b5 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 21:19:27 +0800 Subject: [PATCH 29/32] ci: limit reusable workflow secrets --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 318c6a9..a685269 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,10 @@ name: CI on: ['push', 'pull_request'] +permissions: + contents: read jobs: CI: uses: react-component/rc-test/.github/workflows/test-utoo.yml@main - secrets: inherit + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} From 1ee8ad8fbe329b1cf76d129279f0599b2678f5c9 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sun, 28 Jun 2026 21:32:13 +0800 Subject: [PATCH 30/32] ci: restore reusable workflow compatibility --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a685269..97c217d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,5 +7,4 @@ permissions: jobs: CI: uses: react-component/rc-test/.github/workflows/test-utoo.yml@main - secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + secrets: inherit From 38493da7cba0a65c4e35a97f5ae2d3e90a6555cd Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 29 Jun 2026 00:34:23 +0800 Subject: [PATCH 31/32] 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 eaff160..4c2f17e 100644 --- a/.github/workflows/surge-preview.yml +++ b/.github/workflows/surge-preview.yml @@ -11,7 +11,6 @@ permissions: contents: read pull-requests: write checks: write - statuses: write jobs: preview: From 8ee3feceecd3fb905dfa5d8f1e9d1f4e4e4903a9 Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 29 Jun 2026 14:24:54 +0800 Subject: [PATCH 32/32] chore: limit reusable workflow secrets --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97c217d..a685269 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,4 +7,5 @@ permissions: jobs: CI: uses: react-component/rc-test/.github/workflows/test-utoo.yml@main - secrets: inherit + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}