🔘 Accessible React switch for boolean state with controlled and uncontrolled modes.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 71f3c16..ec89fdd 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -1,6 +1,7 @@
@rc-component/switch
Ant Design 生态的一部分。
+
🔀 React 开关组件。
From 93b721608e0ca8c344eb576aa63e37bb00a4cead Mon Sep 17 00:00:00 2001
From: afc163
Date: Sat, 27 Jun 2026 23:03:56 +0800
Subject: [PATCH 12/32] docs: refine bilingual README branding
---
README.md | 3 +--
README.zh-CN.md | 49 ++++++++++++++++++++++++-------------------------
2 files changed, 25 insertions(+), 27 deletions(-)
diff --git a/README.md b/README.md
index 2b702ff..e095711 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,6 @@
@rc-component/switch
-
Part of the Ant Design ecosystem.
-

+
Part of the Ant Design ecosystem.
🔘 Accessible React switch for boolean state with controlled and uncontrolled modes.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index ec89fdd..9d6a011 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -1,8 +1,7 @@
@rc-component/switch
-
Ant Design 生态的一部分。
-

-
🔀 React 开关组件。
+
Ant Design 生态的一部分。
+
🔘 React 开关组件。
@@ -19,10 +18,10 @@
## 特性
-- Renders a native button with `role="switch"` and `aria-checked` state.
-- 支持 controlled and uncontrolled checked state.
-- Handles click and keyboard toggles with left and right arrow keys.
-- 提供 content class/style slots for checked and unchecked labels.
+- 渲染具有 `role="switch"` 和 `aria-checked` 状态的本机按钮。
+- 支持受控和非受控检查状态。
+- 使用左右箭头键处理点击和键盘切换。
+- 为选中和未选中的标签提供内容类/样式槽。
## 安装
@@ -39,29 +38,29 @@ import '@rc-component/switch/assets/index.css';
export default () => ;
```
-Online preview: https://switch.react-component.vercel.app/
+在线预览:https://switch.react-component.vercel.app/
## API
| 名称 | 类型 | 默认值 | 说明 |
| ------------------- | ----------------------------------- | ------------- | ------------------------------------------ |
-| `autoFocus` | boolean | - | Focus the switch on mount. |
-| `checked` | boolean | - | Controlled checked state. |
-| `checkedChildren` | React.ReactNode | - | Content shown when checked. |
-| `className` | string | - | Additional class name. |
-| `classNames` | `{ content?: string }` | - | Semantic class names for internal content. |
-| `defaultChecked` | boolean | false | Initial checked state. |
-| `disabled` | boolean | false | Disable interaction. |
-| `loadingIcon` | React.ReactNode | - | Extra loading icon node. |
-| `onChange` | `(checked, event) => void` | - | Triggered after checked state changes. |
-| `onClick` | `(checked, event) => void` | - | Triggered after click. |
+| `autoFocus` | boolean | - | 将开关聚焦在安装座上。 |
+| `checked` | boolean | - | 受控的检查状态。 |
+| `checkedChildren` | React.ReactNode | - | 勾选时显示的内容。 |
+| `className` | string | - | 附加className。 |
+| `classNames` | `{ content?: string }` | - | 内部内容的语义className称。 |
+| `defaultChecked` | boolean | false | 初始检查状态。 |
+| `disabled` | boolean | false | 禁用交互。 |
+| `loadingIcon` | React.ReactNode | - | 额外加载图标节点。 |
+| `onChange` | `(checked, event) => void` | - | 检查状态更改后触发。 |
+| `onClick` | `(checked, event) => void` | - | 点击后触发。 |
| `onKeyDown` | React.KeyboardEventHandler | - | Key down handler. |
-| `prefixCls` | string | `'rc-switch'` | Prefix class name. |
-| `style` | React.CSSProperties | - | Root style. |
-| `styles` | `{ content?: React.CSSProperties }` | - | Semantic styles for internal content. |
+| `prefixCls` | string | `'rc-switch'` | 前缀className。 |
+| `style` | React.CSSProperties | - | 根样式。 |
+| `styles` | `{ content?: React.CSSProperties }` | - | 内部内容的语义样式。 |
| `tabIndex` | number | - | Tab index. |
-| `title` | string | - | Native title attribute. |
-| `unCheckedChildren` | React.ReactNode | - | Content shown when unchecked. |
+| `title` | string | - | 本土产权属性。 |
+| `unCheckedChildren` | React.ReactNode | - | 未选中时显示的内容。 |
## 本地开发
@@ -80,8 +79,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/switch is released under the [MIT](./LICENSE.md) license.
+@rc-component/switch 基于 [MIT](./LICENSE.md) 许可证发布。
From 622b1c973cdc85110c4f4eb55593b84acea1fd5b Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 01:28:44 +0800
Subject: [PATCH 13/32] chore: standardize rc tooling and docs
---
.dumirc.ts | 2 +-
README.md | 11 +++++++++++
README.zh-CN.md | 11 +++++++++++
package.json | 42 +++++++++++++++++++++---------------------
tsconfig.json | 45 +++++++++++++++++++++++++++++++++++----------
5 files changed, 79 insertions(+), 32 deletions(-)
diff --git a/.dumirc.ts b/.dumirc.ts
index cb62963..762ed97 100644
--- a/.dumirc.ts
+++ b/.dumirc.ts
@@ -2,7 +2,7 @@ import { defineConfig } from 'dumi';
import path from 'path';
const basePath = process.env.GH_PAGES ? '/switch/' : '/';
-const publicPath = process.env.GH_PAGES ? '/switch/' : '/';
+const publicPath = basePath;
export default defineConfig({
alias: {
diff --git a/README.md b/README.md
index e095711..31052ad 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,17 @@ export default () => ;
Online preview: https://switch.react-component.vercel.app/
+## Examples
+
+Run the local dumi site:
+
+```bash
+npm install
+npm start
+```
+
+Then open `http://localhost:8000`.
+
## API
| Name | Type | Default | Description |
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 9d6a011..1f4d687 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -40,6 +40,17 @@ export default () => ;
在线预览:https://switch.react-component.vercel.app/
+## 示例
+
+运行本地 dumi 站点:
+
+```bash
+npm install
+npm start
+```
+
+然后打开 `http://localhost:8000`。
+
## API
| 名称 | 类型 | 默认值 | 说明 |
diff --git a/package.json b/package.json
index 6c4c80b..5e042ab 100644
--- a/package.json
+++ b/package.json
@@ -44,27 +44,27 @@
},
"devDependencies": {
"@rc-component/father-plugin": "^2.2.0",
- "@rc-component/np": "^1.0.3",
- "@testing-library/react": "^16.0.1",
- "@types/jest": "^29.4.0",
- "@types/node": "^24.5.2",
- "@types/react": "^19.1.14",
- "@types/react-dom": "^19.1.9",
- "@umijs/fabric": "^3.0.0",
- "dumi": "^2.0.0",
- "eslint": "^8.55.0",
- "eslint-plugin-jest": "^27.6.0",
- "eslint-plugin-unicorn": "^49.0.0",
- "father": "^4.0.0",
- "gh-pages": "^6.1.0",
- "husky": "^8.0.1",
- "less": "^4.1.3",
- "lint-staged": "^15.1.0",
- "prettier": "^3.1.0",
- "react": "^18.0.0",
- "react-dom": "^18.0.0",
- "cross-env": "^7.0.0",
- "rc-test": "^7.0.15"
+ "@rc-component/np": "^1.0.4",
+ "@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",
+ "less": "^4.6.7",
+ "lint-staged": "^16.4.0",
+ "prettier": "^3.9.0",
+ "react": "^18.3.1",
+ "react-dom": "^18.3.1",
+ "cross-env": "^10.1.0",
+ "rc-test": "^7.1.3"
},
"peerDependencies": {
"react": ">=16.9.0",
diff --git a/tsconfig.json b/tsconfig.json
index 16ec7b3..ef3af79 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -3,21 +3,46 @@
"target": "esnext",
"moduleResolution": "node",
"baseUrl": "./",
- "lib": ["dom", "es2017"],
+ "lib": [
+ "dom",
+ "es2017"
+ ],
"jsx": "react",
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
"paths": {
- "@/*": ["src/*"],
- "@@/*": [".dumi/tmp/*"],
- "@rc-component/switch": ["src/index.tsx"],
- "@rc-component/switch/es": ["src"],
- "@rc-component/switch/es/*": ["src/*"],
- "@rc-component/switch/assets/*": ["assets/*"]
+ "@/*": [
+ "src/*"
+ ],
+ "@@/*": [
+ ".dumi/tmp/*"
+ ],
+ "@rc-component/switch": [
+ "src/index.tsx"
+ ],
+ "@rc-component/switch/es": [
+ "src"
+ ],
+ "@rc-component/switch/es/*": [
+ "src/*"
+ ],
+ "@rc-component/switch/assets/*": [
+ "assets/*"
+ ]
},
- "strict": true
+ "strict": true,
+ "ignoreDeprecations": "5.0"
},
- "include": [".dumirc.ts", "src", "tests", "docs/examples"],
- "exclude": ["docs-dist", "lib", "es"]
+ "include": [
+ ".dumirc.ts",
+ "src",
+ "tests",
+ "docs/examples"
+ ],
+ "exclude": [
+ "docs-dist",
+ "lib",
+ "es"
+ ]
}
From a7f32920cefee26e46be25a8609db5cd43d09786 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 02:01:08 +0800
Subject: [PATCH 14/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 5e6923d51735eaf400b595263fe40972e3c70f64 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 02:10:34 +0800
Subject: [PATCH 15/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 ef3af79..9388b08 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -35,6 +35,7 @@
"ignoreDeprecations": "5.0"
},
"include": [
+ ".fatherrc.ts",
".dumirc.ts",
"src",
"tests",
From 44e511ebe681e6a254e885c3c1ad7f56859e6772 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 13:28:10 +0800
Subject: [PATCH 16/32] 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 31052ad..6e25861 100644
--- a/README.md
+++ b/README.md
@@ -94,4 +94,4 @@ The release flow is handled by `@rc-component/np` through the `rc-np` command af
## License
-@rc-component/switch is released under the [MIT](./LICENSE.md) license.
+@rc-component/switch is released under the [MIT](./LICENSE) license.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 1f4d687..f0bcc47 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -94,4 +94,4 @@ npm run prepublishOnly
## 许可证
-@rc-component/switch 基于 [MIT](./LICENSE.md) 许可证发布。
+@rc-component/switch 基于 [MIT](./LICENSE) 许可证发布。
From b6457651c20ef26a1aa2b10b22e26bf99fbb6fdd Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 14:01:28 +0800
Subject: [PATCH 17/32] ci: use actions checkout v7
---
.github/workflows/react-doctor.yml | 2 +-
.github/workflows/surge-preview.yml | 2 +-
2 files changed, 2 insertions(+), 2 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/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 74baec6f371c65bf4eadd37627c738062b7fdc6f Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 14:32:16 +0800
Subject: [PATCH 18/32] chore: standardize package metadata
---
package.json | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/package.json b/package.json
index 5e042ab..3f3ed0b 100644
--- a/package.json
+++ b/package.json
@@ -10,11 +10,11 @@
],
"homepage": "https://react-component.github.io/switch",
"bugs": {
- "url": "https://github.com/react-component/switch/issues"
+ "url": "https://github.com/react-component/switch/issues"
},
"repository": {
"type": "git",
- "url": "git@github.com:react-component/switch.git"
+ "url": "https://github.com/react-component/switch.git"
},
"license": "MIT",
"main": "./lib/index",
@@ -71,5 +71,8 @@
"react-dom": ">=16.9.0"
},
"types": "./lib/index.d.ts",
- "style": "./assets/index.css"
+ "style": "./assets/index.css",
+ "publishConfig": {
+ "access": "public"
+ }
}
From bbec15fbc5380a0343d07e81d37d0100095ecd18 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 14:38:28 +0800
Subject: [PATCH 19/32] ci: standardize dependabot updates
---
.github/dependabot.yml | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 07575c0..3b730ef 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -3,6 +3,17 @@ updates:
- package-ecosystem: npm
directory: '/'
schedule:
- interval: daily
+ 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 e6c8f2d2ac86b3d9f44a59e294d4382b05166eb7 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 15:07:22 +0800
Subject: [PATCH 20/32] chore: ignore generated docs artifacts
---
.gitignore | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.gitignore b/.gitignore
index bcd4e0c..dc304ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -44,3 +44,6 @@ docs-dist
bun.lockb
bun.lock
+coverage
+.dumi/tmp
+.dumi/tmp-production
From ead3aa256640c22e533d6b5b81bdda8ce9566e27 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 17:16:19 +0800
Subject: [PATCH 21/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 5def596054703939c9a559d9095dfb53b5aee2f2 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 17:36:51 +0800
Subject: [PATCH 22/32] docs: polish Chinese README wording
---
README.zh-CN.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.zh-CN.md b/README.zh-CN.md
index f0bcc47..0c9583f 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -58,15 +58,15 @@ npm start
| `autoFocus` | boolean | - | 将开关聚焦在安装座上。 |
| `checked` | boolean | - | 受控的检查状态。 |
| `checkedChildren` | React.ReactNode | - | 勾选时显示的内容。 |
-| `className` | string | - | 附加className。 |
-| `classNames` | `{ content?: string }` | - | 内部内容的语义className称。 |
+| `className` | string | - | 附加 className。 |
+| `classNames` | `{ content?: string }` | - | 内部内容的语义 className。 |
| `defaultChecked` | boolean | false | 初始检查状态。 |
| `disabled` | boolean | false | 禁用交互。 |
| `loadingIcon` | React.ReactNode | - | 额外加载图标节点。 |
| `onChange` | `(checked, event) => void` | - | 检查状态更改后触发。 |
| `onClick` | `(checked, event) => void` | - | 点击后触发。 |
| `onKeyDown` | React.KeyboardEventHandler | - | Key down handler. |
-| `prefixCls` | string | `'rc-switch'` | 前缀className。 |
+| `prefixCls` | string | `'rc-switch'` | className 前缀。 |
| `style` | React.CSSProperties | - | 根样式。 |
| `styles` | `{ content?: React.CSSProperties }` | - | 内部内容的语义样式。 |
| `tabIndex` | number | - | Tab index. |
From 53210b6ca8cade312bc179ab1c89d26763f722c6 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 17:48:29 +0800
Subject: [PATCH 23/32] chore: align tooling ignores and typescript
---
package.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 3f3ed0b..3bf1ad7 100644
--- a/package.json
+++ b/package.json
@@ -64,7 +64,8 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"cross-env": "^10.1.0",
- "rc-test": "^7.1.3"
+ "rc-test": "^7.1.3",
+ "typescript": "^5.9.3"
},
"peerDependencies": {
"react": ">=16.9.0",
From 8fe76a05e00fa85cf255e2d35859a465ba11deb8 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 19:14:15 +0800
Subject: [PATCH 24/32] docs: polish Chinese README wording
---
README.zh-CN.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 0c9583f..118adb2 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -65,7 +65,7 @@ npm start
| `loadingIcon` | React.ReactNode | - | 额外加载图标节点。 |
| `onChange` | `(checked, event) => void` | - | 检查状态更改后触发。 |
| `onClick` | `(checked, event) => void` | - | 点击后触发。 |
-| `onKeyDown` | React.KeyboardEventHandler | - | Key down handler. |
+| `onKeyDown` | React.KeyboardEventHandler | - | 按键按下处理函数。 |
| `prefixCls` | string | `'rc-switch'` | className 前缀。 |
| `style` | React.CSSProperties | - | 根样式。 |
| `styles` | `{ content?: React.CSSProperties }` | - | 内部内容的语义样式。 |
From b26ebbacbf23416d67ea71c2c082abf4a890bddf Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 19:39:31 +0800
Subject: [PATCH 25/32] docs: document dumi dev server port
---
README.md | 2 ++
README.zh-CN.md | 2 ++
2 files changed, 4 insertions(+)
diff --git a/README.md b/README.md
index 6e25861..bb240fc 100644
--- a/README.md
+++ b/README.md
@@ -84,6 +84,8 @@ npm run compile
npm run build
```
+The dumi site runs at `http://localhost:8000` by default.
+
## Release
```bash
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 118adb2..13a7cf7 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -84,6 +84,8 @@ npm run compile
npm run build
```
+dumi 站点默认运行在 `http://localhost:8000`。
+
## 发布
```bash
From 6b5435cb1275242554b2e36e33cbfc81132019b6 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 19:58:52 +0800
Subject: [PATCH 26/32] chore: standardize husky configuration
---
.husky/pre-commit | 3 ---
package.json | 6 +++++-
2 files changed, 5 insertions(+), 4 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 3bf1ad7..931d4ba 100644
--- a/package.json
+++ b/package.json
@@ -36,7 +36,8 @@
"prettier": "prettier --write --ignore-unknown .",
"start": "dumi dev",
"test": "rc-test",
- "tsc": "tsc --noEmit"
+ "tsc": "tsc --noEmit",
+ "prepare": "husky"
},
"dependencies": {
"@rc-component/util": "^1.11.1",
@@ -75,5 +76,8 @@
"style": "./assets/index.css",
"publishConfig": {
"access": "public"
+ },
+ "lint-staged": {
+ "*": "prettier --write --ignore-unknown"
}
}
From 3e1004a2da43721c4ca0c027f3230c7a3b9452c6 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 20:33:11 +0800
Subject: [PATCH 27/32] chore: standardize package type entry
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 931d4ba..b980484 100644
--- a/package.json
+++ b/package.json
@@ -72,7 +72,7 @@
"react": ">=16.9.0",
"react-dom": ">=16.9.0"
},
- "types": "./lib/index.d.ts",
+ "types": "./es/index.d.ts",
"style": "./assets/index.css",
"publishConfig": {
"access": "public"
From 6e2d36f0491edcd0dede593e0ec732fc4abea661 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 21:01:27 +0800
Subject: [PATCH 28/32] docs: normalize readme badges
---
README.md | 12 ++++++------
README.zh-CN.md | 12 ++++++------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/README.md b/README.md
index bb240fc..9337205 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,12 @@
🔘 Accessible React switch for boolean state with controlled and uncontrolled modes.
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 13a7cf7..6626132 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -4,12 +4,12 @@
🔘 React 开关组件。
-
-
-
-
-
-
+
+
+
+
+
+
From 3b1b5c3fb23d14dcb6febc98238065dbe114f178 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 21:21:19 +0800
Subject: [PATCH 29/32] ci: limit reusable workflow secrets
---
.github/workflows/react-component-ci.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml
index 1ed6420..cf754af 100644
--- a/.github/workflows/react-component-ci.yml
+++ b/.github/workflows/react-component-ci.yml
@@ -9,4 +9,6 @@ permissions:
jobs:
test:
uses: react-component/rc-test/.github/workflows/test-utoo.yml@main
- secrets: inherit
+ secrets:
+
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
From 0ee74ca4ba7d6b0a783cabfcb3697785b186649a Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 21:30:09 +0800
Subject: [PATCH 30/32] ci: restore reusable workflow compatibility
---
.github/workflows/react-component-ci.yml | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml
index cf754af..1ed6420 100644
--- a/.github/workflows/react-component-ci.yml
+++ b/.github/workflows/react-component-ci.yml
@@ -9,6 +9,4 @@ permissions:
jobs:
test:
uses: react-component/rc-test/.github/workflows/test-utoo.yml@main
- secrets:
-
- CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+ secrets: inherit
From b9ae748c2a2ff339edcd55c229bfb39020c0b6ab Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 21:52:59 +0800
Subject: [PATCH 31/32] docs: polish zh-CN readme wording
---
README.zh-CN.md | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 6626132..1a0bf93 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -15,7 +15,6 @@
English | 简体中文
-
## 特性
- 渲染具有 `role="switch"` 和 `aria-checked` 状态的本机按钮。
@@ -53,25 +52,25 @@ npm start
## API
-| 名称 | 类型 | 默认值 | 说明 |
-| ------------------- | ----------------------------------- | ------------- | ------------------------------------------ |
-| `autoFocus` | boolean | - | 将开关聚焦在安装座上。 |
-| `checked` | boolean | - | 受控的检查状态。 |
-| `checkedChildren` | React.ReactNode | - | 勾选时显示的内容。 |
-| `className` | string | - | 附加 className。 |
+| 名称 | 类型 | 默认值 | 说明 |
+| ------------------- | ----------------------------------- | ------------- | -------------------------- |
+| `autoFocus` | boolean | - | 挂载后自动聚焦开关。 |
+| `checked` | boolean | - | 受控的检查状态。 |
+| `checkedChildren` | React.ReactNode | - | 勾选时显示的内容。 |
+| `className` | string | - | 附加 className。 |
| `classNames` | `{ content?: string }` | - | 内部内容的语义 className。 |
-| `defaultChecked` | boolean | false | 初始检查状态。 |
-| `disabled` | boolean | false | 禁用交互。 |
-| `loadingIcon` | React.ReactNode | - | 额外加载图标节点。 |
-| `onChange` | `(checked, event) => void` | - | 检查状态更改后触发。 |
-| `onClick` | `(checked, event) => void` | - | 点击后触发。 |
-| `onKeyDown` | React.KeyboardEventHandler | - | 按键按下处理函数。 |
-| `prefixCls` | string | `'rc-switch'` | className 前缀。 |
-| `style` | React.CSSProperties | - | 根样式。 |
-| `styles` | `{ content?: React.CSSProperties }` | - | 内部内容的语义样式。 |
-| `tabIndex` | number | - | Tab index. |
-| `title` | string | - | 本土产权属性。 |
-| `unCheckedChildren` | React.ReactNode | - | 未选中时显示的内容。 |
+| `defaultChecked` | boolean | false | 初始检查状态。 |
+| `disabled` | boolean | false | 禁用交互。 |
+| `loadingIcon` | React.ReactNode | - | 额外加载图标节点。 |
+| `onChange` | `(checked, event) => void` | - | 检查状态更改后触发。 |
+| `onClick` | `(checked, event) => void` | - | 点击后触发。 |
+| `onKeyDown` | React.KeyboardEventHandler | - | 按键按下处理函数。 |
+| `prefixCls` | string | `'rc-switch'` | className 前缀。 |
+| `style` | React.CSSProperties | - | 根样式。 |
+| `styles` | `{ content?: React.CSSProperties }` | - | 内部内容的语义样式。 |
+| `tabIndex` | number | - | Tab index. |
+| `title` | string | - | 本土产权属性。 |
+| `unCheckedChildren` | React.ReactNode | - | 未选中时显示的内容。 |
## 本地开发
From c068cb7697da0aff40a06bebdb7d976caaf53a58 Mon Sep 17 00:00:00 2001
From: afc163
Date: Mon, 29 Jun 2026 01:20:58 +0800
Subject: [PATCH 32/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: