From eb7cb3a115240d4cae891a187683a9cdb3ed3f8c Mon Sep 17 00:00:00 2001
From: afc163
Date: Fri, 26 Jun 2026 17:31:02 +0800
Subject: [PATCH 01/28] chore: standardize repository config
---
.dumirc.ts | 19 ++-
.github/FUNDING.yml | 17 +-
.github/dependabot.yml | 27 +--
.github/workflows/codeql.yml | 43 +++++
.github/workflows/react-component-ci.yml | 12 +-
.github/workflows/react-doctor.yml | 27 +++
.github/workflows/site-deploy.yml | 39 -----
.github/workflows/surge-preview.yml | 39 +++++
.gitignore | 15 +-
README.md | 204 ++++++++---------------
docs/examples/arrowContent.tsx | 2 +-
docs/examples/formError.tsx | 2 +-
docs/examples/onVisibleChange.tsx | 2 +-
docs/examples/placement.tsx | 4 +-
docs/examples/point.tsx | 2 +-
docs/examples/showArrow.tsx | 2 +-
docs/examples/simple.tsx | 4 +-
docs/examples/twoButtons.tsx | 2 +-
docs/index.md | 5 +-
package.json | 27 +--
tsconfig.json | 25 +--
vercel.json | 18 +-
22 files changed, 257 insertions(+), 280 deletions(-)
create mode 100644 .github/workflows/codeql.yml
create mode 100644 .github/workflows/react-doctor.yml
delete mode 100644 .github/workflows/site-deploy.yml
create mode 100644 .github/workflows/surge-preview.yml
diff --git a/.dumirc.ts b/.dumirc.ts
index 1e597f02..29dcf6b3 100644
--- a/.dumirc.ts
+++ b/.dumirc.ts
@@ -1,16 +1,16 @@
import { defineConfig } from 'dumi';
import path from 'path';
-// const isProdSite =
-// // 不是预览模式 同时是生产环境
-// process.env.PREVIEW !== 'true' && process.env.NODE_ENV === 'production';
-
-// const name = 'tooltip';
+const basePath = process.env.GH_PAGES ? '/tooltip/' : '/';
+const publicPath = process.env.GH_PAGES ? '/tooltip/' : '/';
export default defineConfig({
alias: {
- 'rc-tooltip$': path.resolve('src'),
- 'rc-tooltip/es': path.resolve('src'),
+ '@rc-component/tooltip$': path.resolve('src'),
+ '@rc-component/tooltip/assets': path.resolve('assets'),
+ '@rc-component/tooltip/assets/*': path.resolve('assets'),
+ '@rc-component/tooltip/es': path.resolve('src'),
+ '@rc-component/tooltip/es/*': path.resolve('src'),
},
mfsu: false,
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
@@ -18,6 +18,7 @@ export default defineConfig({
name: 'Tooltip',
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
},
- // base: isProdSite ? `/${name}/` : '/',
- // publicPath: isProdSite ? `/${name}/` : '/',
+ outputPath: 'docs-dist',
+ base: basePath,
+ publicPath,
});
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 33b1999c..758659af 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1,15 +1,2 @@
-# These are supported funding model platforms
-
-github: ant-design # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
-patreon: # Replace with a single Patreon username
-open_collective: ant-design # Replace with a single Open Collective username
-ko_fi: # Replace with a single Ko-fi username
-tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
-community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
-liberapay: # Replace with a single Liberapay username
-issuehunt: # Replace with a single IssueHunt username
-lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
-polar: # Replace with a single Polar username
-buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
-thanks_dev: # Replace with a single thanks.dev username
-custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+github: ant-design
+open_collective: ant-design
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index cb16808a..07575c02 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,23 +1,8 @@
version: 2
updates:
-- package-ecosystem: npm
- directory: "/"
- schedule:
- interval: daily
- time: "21:00"
- open-pull-requests-limit: 10
- ignore:
- - dependency-name: "@types/react"
- versions:
- - 17.0.0
- - 17.0.1
- - 17.0.2
- - 17.0.3
- - dependency-name: "@types/react-dom"
- versions:
- - 17.0.0
- - 17.0.1
- - 17.0.2
- - dependency-name: less
- versions:
- - 4.1.0
+ - package-ecosystem: npm
+ directory: '/'
+ schedule:
+ interval: daily
+ time: '21:00'
+ open-pull-requests-limit: 10
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 00000000..23f424a8
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,43 @@
+name: 'CodeQL'
+
+on:
+ push:
+ branches: ['master']
+ pull_request:
+ branches: ['master']
+ schedule:
+ - cron: '17 10 * * 1'
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [javascript]
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
+ with:
+ persist-credentials: false
+
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
+ with:
+ languages: ${{ matrix.language }}
+ queries: +security-and-quality
+
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e
+ with:
+ category: '/language:${{ matrix.language }}'
diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml
index 5735e2d2..1ed64209 100644
--- a/.github/workflows/react-component-ci.yml
+++ b/.github/workflows/react-component-ci.yml
@@ -1,6 +1,12 @@
name: ✅ test
-on: [push, pull_request]
+on:
+ push:
+ branches: [master]
+ pull_request:
+ branches: [master]
+permissions:
+ contents: read
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 00000000..f68281c8
--- /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
deleted file mode 100644
index 8f125072..00000000
--- a/.github/workflows/site-deploy.yml
+++ /dev/null
@@ -1,39 +0,0 @@
-name: Deploy website
-on:
- push:
- tags:
- - '*'
- workflow_dispatch:
-
-permissions:
- contents: write
-
-jobs:
- build-and-deploy:
- runs-on: ubuntu-latest
- steps:
- - name: checkout
- uses: actions/checkout@v3
-
- - name: setup node
- uses: actions/setup-node@v1
- with:
- node-version: 14
-
- - name: create package-lock.json
- run: npm i --package-lock-only --ignore-scripts
-
- - name: Install dependencies
- run: npm ci
-
- - name: build Docs
- run: npm run build
-
- - name: Deploy to GitHub Pages
- uses: peaceiris/actions-gh-pages@v3
- with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- publish_dir: ./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
new file mode 100644
index 00000000..1b29a17b
--- /dev/null
+++ b/.github/workflows/surge-preview.yml
@@ -0,0 +1,39 @@
+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
+ 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-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/.gitignore b/.gitignore
index d34b9854..4597fc50 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-.storybook
*.iml
*.log
*.log.*
@@ -27,19 +26,23 @@ assets/**/*.css
build
lib
es
-coverage
+/coverage
yarn.lock
package-lock.json
pnpm-lock.yaml
+.doc
+docs-dist
+.vercel
+.storybook
+tmp/
+.history
# umi
.umi
.umi-production
.umi-test
.env.local
-
-# dumi
-.dumi/tmp
-.dumi/tmp-production
+.dumi/
bun.lockb
+bun.lock
diff --git a/README.md b/README.md
index 362bc0d8..51b77299 100644
--- a/README.md
+++ b/README.md
@@ -1,160 +1,100 @@
-# @rc-component/tooltip
-
-React Tooltip
-
-[![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]: http://img.shields.io/npm/v/@rc-component/tooltip.svg?style=flat-square
-[npm-url]: http://npmjs.org/package/@rc-component/tooltip
-[github-actions-image]: https://github.com/react-component/tooltip/actions/workflows/react-component-ci.yml/badge.svg
-[github-actions-url]: https://github.com/react-component/tooltip/actions/workflows/react-component-ci.yml
-[codecov-image]: https://img.shields.io/codecov/c/github/react-component/tooltip/master.svg?style=flat-square
-[codecov-url]: https://app.codecov.io/gh/react-component/tooltip
-[download-image]: https://img.shields.io/npm/dm/@rc-component/tooltip.svg?style=flat-square
-[download-url]: https://npmjs.org/package/@rc-component/tooltip
-[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/tooltip
-[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/tooltip
-[dumi-url]: https://github.com/umijs/dumi
-[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
-
-## Screenshot
-
-
-
-## Browsers support
-
-| [
](http://godban.github.io/browsers-support-badges/)IE / Edge | [
](http://godban.github.io/browsers-support-badges/)Firefox | [
](http://godban.github.io/browsers-support-badges/)Chrome | [
](http://godban.github.io/browsers-support-badges/)Safari | [
](http://godban.github.io/browsers-support-badges/)Opera |
-| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| IE 8 + ✔ | Firefox 31.0+ ✔ | Chrome 31.0+ ✔ | Safari 7.0+ ✔ | Opera 30.0+ ✔ |
+
+
@rc-component/tooltip
+
💡 Positioned React tooltip for hover, focus, click, and controlled popup flows.
+
+
+
+
Part of the Ant Design ecosystem.
+
+
+
+
+
+
+
+
+
+
+
+## Highlights
+
+- Supports hover, focus, click, and controlled visibility through one trigger layer.
+- Provides built-in placements, custom alignment, delays, arrows, and popup motion.
+- Exposes semantic `classNames` and `styles` slots for root, arrow, and container nodes.
+- Keeps accessibility wiring through generated tooltip ids and `aria-describedby`.
## Install
-[](https://npmjs.org/package/@rc-component/tooltip)
+```bash
+npm install @rc-component/tooltip
+```
## Usage
-```js
-var Tooltip = require('@rc-component/tooltip');
-var React = require('react');
-var ReactDOM = require('react-dom');
+```tsx pure
+import Tooltip from '@rc-component/tooltip';
+import '@rc-component/tooltip/assets/bootstrap_white.css';
-// By default, the tooltip has no style.
-// Consider importing the stylesheet it comes with:
-// '@rc-component/tooltip/assets/bootstrap_white.css'
-
-ReactDOM.render(
- tooltip}>
- hover
- ,
- container,
+export default () => (
+ Tooltip content}>
+
+
);
```
-## Examples
-
-`npm start` and then go to
-
-
-Online demo: https://tooltip-react-component.vercel.app/
+Online preview: https://tooltip.react-component.vercel.app/
## API
-### Props
-
-| name | type | default | description |
-| ------------------- | ------------------------------------------------------------------ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| trigger | string \| string\[] | 'hover' | which actions cause tooltip shown. enum of 'hover','click','focus' |
-| visible | boolean | false | whether tooltip is visible |
-| defaultVisible | boolean | false | whether tooltip is visible by default |
-| placement | string | 'right' | tooltip placement. enum of 'top','left','right','bottom', 'topLeft', 'topRight', 'bottomLeft', 'bottomRight', 'leftTop', 'leftBottom', 'rightTop', 'rightBottom' |
-| motion | object | | Config popup motion. Please ref demo for example |
-| onVisibleChange | (visible: boolean) => void; | | Callback when visible change |
-| afterVisibleChange | (visible: boolean) => void; | | Callback after visible change |
-| overlay | ReactNode \| () => ReactNode | | tooltip overlay content |
-| overlayStyle | object | | deprecated, Please use `styles={{ root: {} }}` |
-| overlayClassName | string | | deprecated, Please use `classNames={{ root: {} }}` |
-| prefixCls | string | 'rc-tooltip' | prefix class name of tooltip |
-| mouseEnterDelay | number | 0 | delay time (in second) before tooltip shows when mouse enter |
-| mouseLeaveDelay | number | 0.1 | delay time (in second) before tooltip hides when mouse leave |
-| getTooltipContainer | (triggerNode: HTMLElement) => HTMLElement | () => document.body | get container of tooltip, default to body |
-| destroyOnHidden | boolean | false | destroy tooltip when it is hidden |
-| align | object | | align config of tooltip, ref [dom-align](https://github.com/yiminghe/dom-align). See [Align Overflow](#align-overflow) below |
-| showArrow | boolean \| object | false | whether to show arrow of tooltip |
-| zIndex | number | | config popup tooltip zIndex |
-| classNames | classNames?: { root?: string; container?: string;}; | | Semantic DOM class |
-| styles | styles?: {root?: React.CSSProperties;container?: React.CSSProperties;}; | | Semantic DOM styles |
-
-### Align Overflow
-
-The `align` prop accepts an object that may include an `overflow` field to control how the tooltip adjusts when it overflows the visible area. This is powered by [dom-align](https://github.com/yiminghe/dom-align).
-
-| name | type | default | description |
-| ---------------- | ---------------- | ------- | -------------------------------------------------------------------------------------------------------- |
-| adjustX | boolean \| number | false | adjust tooltip position in the X direction when it overflows |
-| adjustY | boolean \| number | false | adjust tooltip position in the Y direction when it overflows |
-| alwaysByViewport | boolean | false | when `true`, always adjusts position based on the viewport rather than the scrollable parent container |
-
-```jsx
-tooltip content}
->
-
-
-```
-
-When `alwaysByViewport` is `true`, the tooltip will reposition itself to stay within the browser viewport. This is particularly useful when the trigger element is inside a scrollable container and you want the tooltip to always be visible on screen.
-
-## Important Note
-
-`Tooltip` requires a child node that accepts an `onMouseEnter`, `onMouseLeave`, `onFocus`, `onClick` event. This means the child node must be a built-in component like `div` or `span`, or a custom component that passes its props to its built-in component child.
-
-## Accessibility
-
-For accessibility purpose you can use the `id` prop to link your tooltip with another element. For example attaching it to an input element:
-
-```js
-
-
-
-```
-
-If you do it like this, a screenreader would read the content of your tooltip if you focus the input element.
-
-**NOTE:** `role="tooltip"` is also added to expose the purpose of the tooltip element to a screenreader.
+### Tooltip
+
+| Name | Type | Default | Description |
+| --------------------- | ---------------------------------------------------- | ------------------- | ---------------------------------------------------------- |
+| `afterVisibleChange` | `(visible: boolean) => void` | - | Called after popup visibility changes. |
+| `align` | AlignType | `{}` | Extra popup alignment config. |
+| `arrowContent` | React.ReactNode | - | Custom arrow content. |
+| `builtinPlacements` | TriggerProps['builtinPlacements'] | built in placements | Placement map passed to trigger. |
+| `children` | React.ReactElement | - | Required trigger element. |
+| `classNames` | `Partial>` | - | Semantic class names for root, arrow, and container nodes. |
+| `defaultVisible` | boolean | - | Initial uncontrolled visible state. |
+| `destroyOnHidden` | boolean | false | Destroy popup DOM when hidden. |
+| `fresh` | boolean | - | Keep popup content fresh when closed. |
+| `getTooltipContainer` | `(node: HTMLElement) => HTMLElement` | - | Resolve popup container. |
+| `id` | string | generated id | Tooltip id used for accessibility. |
+| `motion` | TriggerProps['popupMotion'] | - | Popup motion config. |
+| `mouseEnterDelay` | number | 0 | Delay in seconds before showing on mouse enter. |
+| `mouseLeaveDelay` | number | 0.1 | Delay in seconds before hiding on mouse leave. |
+| `onPopupAlign` | TriggerProps['onPopupAlign'] | - | Called after popup alignment. |
+| `onVisibleChange` | `(visible: boolean) => void` | - | Called when visibility changes. |
+| `overlay` | React.ReactNode \| `() => React.ReactNode` | - | Tooltip content. |
+| `placement` | string | `'right'` | Popup placement. |
+| `prefixCls` | string | `'rc-tooltip'` | Prefix class name. |
+| `showArrow` | boolean \| ArrowType | true | Whether to show arrow or provide arrow config. |
+| `styles` | `Partial>` | - | Semantic styles for root, arrow, and container nodes. |
+| `trigger` | ActionType \| ActionType[] | `['hover']` | Actions that show the tooltip. |
+| `unique` | TriggerProps['unique'] | - | Experimental unique container reuse config. |
+| `visible` | boolean | - | Controlled visible state. |
+| `zIndex` | number | - | Popup z-index. |
## Development
```bash
npm install
npm start
-```
-
-## Test Case
-
-```bash
npm test
-npm run chrome-test
+npm run tsc
+npm run compile
+npm run build
```
-## Coverage
+## Release
```bash
-npm run coverage
+npm run prepublishOnly
```
+`prepublishOnly` builds the package with Father and publishes through `rc-np`. Run `npm run gh-pages` to deploy the dumi site.
+
## License
-`@rc-component/tooltip` is released under the MIT license.
+@rc-component/tooltip is released under the MIT license.
diff --git a/docs/examples/arrowContent.tsx b/docs/examples/arrowContent.tsx
index 61d68d9a..34581416 100644
--- a/docs/examples/arrowContent.tsx
+++ b/docs/examples/arrowContent.tsx
@@ -1,5 +1,5 @@
import React, { CSSProperties } from 'react';
-import Tooltip from 'rc-tooltip';
+import Tooltip from '@rc-component/tooltip';
import '../../assets/bootstrap_white.less';
const text = Tooltip Text;
diff --git a/docs/examples/formError.tsx b/docs/examples/formError.tsx
index 4c31f968..25c0b154 100644
--- a/docs/examples/formError.tsx
+++ b/docs/examples/formError.tsx
@@ -1,4 +1,4 @@
-import Tooltip from 'rc-tooltip';
+import Tooltip from '@rc-component/tooltip';
import React, { Component } from 'react';
import '../../assets/bootstrap.less';
diff --git a/docs/examples/onVisibleChange.tsx b/docs/examples/onVisibleChange.tsx
index fb8049b9..dbb73331 100644
--- a/docs/examples/onVisibleChange.tsx
+++ b/docs/examples/onVisibleChange.tsx
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
-import Tooltip from 'rc-tooltip';
+import Tooltip from '@rc-component/tooltip';
import '../../assets/bootstrap.less';
function preventDefault(e: React.MouseEvent) {
diff --git a/docs/examples/placement.tsx b/docs/examples/placement.tsx
index e62ab59d..1409f130 100644
--- a/docs/examples/placement.tsx
+++ b/docs/examples/placement.tsx
@@ -1,7 +1,7 @@
import React from 'react';
-import Tooltip from 'rc-tooltip';
+import Tooltip from '@rc-component/tooltip';
import '../../assets/bootstrap.less';
-import Popup from '../../src/Popup';
+import Popup from '@rc-component/tooltip/es/Popup';
const text = Tooltip Text;
diff --git a/docs/examples/point.tsx b/docs/examples/point.tsx
index f7faf1dc..cda1c172 100644
--- a/docs/examples/point.tsx
+++ b/docs/examples/point.tsx
@@ -1,4 +1,4 @@
-import Tooltip from 'rc-tooltip';
+import Tooltip from '@rc-component/tooltip';
import React from 'react';
import '../../assets/bootstrap_white.less';
diff --git a/docs/examples/showArrow.tsx b/docs/examples/showArrow.tsx
index bf2a97dc..c1f9d1b4 100644
--- a/docs/examples/showArrow.tsx
+++ b/docs/examples/showArrow.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import Tooltip from 'rc-tooltip';
+import Tooltip from '@rc-component/tooltip';
import '../../assets/bootstrap_white.less';
const text = Tooltip Text;
diff --git a/docs/examples/simple.tsx b/docs/examples/simple.tsx
index cef651c8..6367adf1 100644
--- a/docs/examples/simple.tsx
+++ b/docs/examples/simple.tsx
@@ -1,9 +1,9 @@
import type { ActionType } from '@rc-component/trigger';
-import Tooltip from 'rc-tooltip';
+import Tooltip from '@rc-component/tooltip';
import type { CSSProperties } from 'react';
import React, { Component } from 'react';
import '../../assets/bootstrap.less';
-import { placements } from '../../src/placements';
+import { placements } from '@rc-component/tooltip/es/placements';
type OffsetType = string | number;
diff --git a/docs/examples/twoButtons.tsx b/docs/examples/twoButtons.tsx
index 25b39bc3..25ecb2a9 100644
--- a/docs/examples/twoButtons.tsx
+++ b/docs/examples/twoButtons.tsx
@@ -1,7 +1,7 @@
import { UniqueProvider } from '@rc-component/trigger';
import React from 'react';
import '../../assets/bootstrap.less';
-import Tooltip from '../../src';
+import Tooltip from '@rc-component/tooltip';
const TwoButtonsDemo = () => (
diff --git a/docs/index.md b/docs/index.md
index 4c79a7b9..43776f02 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,8 +1,5 @@
---
-hero:
- title: rc-tooltip
- description: React Tooltip
+title: '@rc-component/tooltip'
---
-
diff --git a/package.json b/package.json
index 7789adfc..1c052116 100644
--- a/package.json
+++ b/package.json
@@ -1,14 +1,14 @@
{
"name": "@rc-component/tooltip",
"version": "1.4.0",
- "description": "React Tooltip",
+ "description": "Tooltip UI component for React",
"keywords": [
"react",
"react-component",
"react-tooltip",
"tooltip"
],
- "homepage": "http://github.com/react-component/tooltip",
+ "homepage": "https://react-component.github.io/tooltip",
"bugs": {
"url": "http://github.com/react-component/tooltip/issues"
},
@@ -20,8 +20,8 @@
"maintainers": [
"yiminghe@gmail.com"
],
- "main": "lib/index",
- "module": "es/index",
+ "main": "./lib/index",
+ "module": "./es/index",
"files": [
"lib",
"es",
@@ -29,16 +29,19 @@
"assets/*.less"
],
"scripts": {
+ "build": "npm run compile && npm run docs:build",
"compile": "father build && lessc assets/bootstrap.less assets/bootstrap.css && lessc assets/bootstrap_white.less assets/bootstrap_white.css",
+ "coverage": "rc-test --coverage",
"docs:build": "dumi build",
- "docs:deploy": "npm run docs:build && gh-pages -d dist",
+ "docs:deploy": "gh-pages -d docs-dist",
+ "deploy": "npm run gh-pages",
+ "gh-pages": "cross-env GH_PAGES=1 npm run compile && npm run docs:build && npm run docs:deploy",
"lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
- "now-build": "npm run docs:build",
- "prepare": "dumi setup",
"prepublishOnly": "npm run compile && rc-np",
- "postpublish": "npm run docs:build && npm run docs:deploy",
+ "prettier": "prettier --write --ignore-unknown .",
"start": "dumi dev",
- "test": "rc-test"
+ "test": "rc-test",
+ "tsc": "tsc --noEmit"
},
"dependencies": {
"@rc-component/trigger": "^3.7.1",
@@ -64,10 +67,12 @@
"rc-test": "^7.0.9",
"react": "^19.1.0",
"react-dom": "^19.1.0",
- "typescript": "^4.0.5"
+ "typescript": "^4.0.5",
+ "cross-env": "^7.0.0"
},
"peerDependencies": {
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
- }
+ },
+ "types": "./lib/index.d.ts"
}
diff --git a/tsconfig.json b/tsconfig.json
index f9501603..9d6e202a 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -9,22 +9,13 @@
"esModuleInterop": true,
"types": ["@testing-library/jest-dom"],
"paths": {
- "@/*": [
- "src/*"
- ],
- "@@/*": [
- ".dumi/tmp/*"
- ],
- "rc-tooltip": [
- "src/index.tsx"
- ]
+ "@/*": ["src/*"],
+ "@@/*": [".dumi/tmp/*"],
+ "@rc-component/tooltip": ["src/index.tsx"],
+ "@rc-component/tooltip/es": ["src"],
+ "@rc-component/tooltip/es/*": ["src/*"]
}
},
- "include": [
- ".dumirc.ts",
- "./src/**/*.ts",
- "./src/**/*.tsx",
- "./docs/**/*.tsx",
- "./tests/**/*.tsx"
- ]
-}
\ No newline at end of file
+ "include": [".dumirc.ts", "src", "tests", "docs/examples"],
+ "exclude": ["docs-dist", "lib", "es"]
+}
diff --git a/vercel.json b/vercel.json
index 120c2be6..5f9139ef 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1,14 +1,6 @@
{
- "$schema": "https://openapi.vercel.sh/vercel.json",
- "version": 2,
- "name": "@rc-component/tooltip",
- "builds": [
- {
- "src": "package.json",
- "use": "@vercel/static-build",
- "config": {
- "distDir": "dist"
- }
- }
- ]
-}
\ No newline at end of file
+ "framework": "umijs",
+ "installCommand": "npm install",
+ "buildCommand": "npm run build",
+ "outputDirectory": "docs-dist"
+}
From 547d2abf80023744dc3a9ac1ceeb03b583e60df6 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sat, 27 Jun 2026 01:27:33 +0800
Subject: [PATCH 02/28] chore: address AI review feedback
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 1c052116..8b811936 100644
--- a/package.json
+++ b/package.json
@@ -35,7 +35,7 @@
"docs:build": "dumi build",
"docs:deploy": "gh-pages -d docs-dist",
"deploy": "npm run gh-pages",
- "gh-pages": "cross-env GH_PAGES=1 npm run compile && npm run docs:build && npm run docs:deploy",
+ "gh-pages": "npm run compile && cross-env GH_PAGES=1 npm run docs:build && npm run docs:deploy",
"lint": "eslint src/ --ext .tsx,.ts,.jsx,.js",
"prepublishOnly": "npm run compile && rc-np",
"prettier": "prettier --write --ignore-unknown .",
From 113b08db7ffa077bf5627cdf70880359556e8a79 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sat, 27 Jun 2026 01:56:50 +0800
Subject: [PATCH 03/28] docs: standardize README release details
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 51b77299..e686e8d6 100644
--- a/README.md
+++ b/README.md
@@ -93,8 +93,8 @@ npm run build
npm run prepublishOnly
```
-`prepublishOnly` builds the package with Father and publishes through `rc-np`. Run `npm run gh-pages` to deploy the dumi site.
+The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build.
## License
-@rc-component/tooltip is released under the MIT license.
+@rc-component/tooltip is released under the [MIT](./LICENSE) license.
From 1578373acea3e46fb071ace7171c4ebf7b4476b4 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sat, 27 Jun 2026 02:13:59 +0800
Subject: [PATCH 04/28] 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 1b29a17b..ad8683da 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-dist
- failOnError: true
+ failOnError: false
setCommitStatus: true
build: |
npm install
From fd090328e835b35778f31d103e50d42c2943dc85 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sat, 27 Jun 2026 02:25:43 +0800
Subject: [PATCH 05/28] 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 ad8683da..70768bf2 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-dist
failOnError: false
- setCommitStatus: true
+ setCommitStatus: false
build: |
npm install
npm run build
From 9f0cf7c74f3e6ebf7bcca0aa22297c52241e0f82 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sat, 27 Jun 2026 13:04:04 +0800
Subject: [PATCH 06/28] docs: refine README usage and ecosystem note
---
README.md | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index e686e8d6..77e61cd9 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,7 @@
@rc-component/tooltip
+
Part of the Ant Design ecosystem.
💡 Positioned React tooltip for hover, focus, click, and controlled popup flows.
-
-
-
-
Part of the Ant Design ecosystem.
@@ -16,6 +13,7 @@
+
## Highlights
- Supports hover, focus, click, and controlled visibility through one trigger layer.
From 22675eb6b1bfcc03816c9e60ccbdf48b2796afc3 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sat, 27 Jun 2026 13:22:20 +0800
Subject: [PATCH 07/28] 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 70768bf2..faf6b8bd 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-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 8b5db461b69d9948801a974fb429af7114319000 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sat, 27 Jun 2026 13:51:22 +0800
Subject: [PATCH 08/28] chore: address review comments
---
.dumirc.ts | 2 --
1 file changed, 2 deletions(-)
diff --git a/.dumirc.ts b/.dumirc.ts
index 29dcf6b3..97a5ddf8 100644
--- a/.dumirc.ts
+++ b/.dumirc.ts
@@ -8,9 +8,7 @@ export default defineConfig({
alias: {
'@rc-component/tooltip$': path.resolve('src'),
'@rc-component/tooltip/assets': path.resolve('assets'),
- '@rc-component/tooltip/assets/*': path.resolve('assets'),
'@rc-component/tooltip/es': path.resolve('src'),
- '@rc-component/tooltip/es/*': path.resolve('src'),
},
mfsu: false,
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
From 6f9d074e14e052bfaf5fc76e90fa3851f91086cd Mon Sep 17 00:00:00 2001
From: afc163
Date: Sat, 27 Jun 2026 22:20:24 +0800
Subject: [PATCH 09/28] docs: add Chinese README
---
README.md | 2 +
README.zh-CN.md | 100 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 102 insertions(+)
create mode 100644 README.zh-CN.md
diff --git a/README.md b/README.md
index 77e61cd9..039e7e72 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,8 @@
+English | 简体中文
+
## Highlights
diff --git a/README.zh-CN.md b/README.zh-CN.md
new file mode 100644
index 00000000..09e6a111
--- /dev/null
+++ b/README.zh-CN.md
@@ -0,0 +1,100 @@
+
+
@rc-component/tooltip
+
Ant Design 生态的一部分。
+
💡 React 文字提示组件,基于 trigger 定位和弹层能力构建。
+
+
+
+
+
+
+
+
+
+
+
+English | 简体中文
+
+
+## 特性
+
+- 支持 hover, focus, click, and controlled visibility through one trigger layer.
+- 提供 built-in placements, custom alignment, delays, arrows, and popup motion.
+- 暴露 semantic `classNames` and `styles` slots for root, arrow, and container nodes.
+- 保留 accessibility wiring through generated tooltip ids and `aria-describedby`.
+
+## 安装
+
+```bash
+npm install @rc-component/tooltip
+```
+
+## 使用
+
+```tsx pure
+import Tooltip from '@rc-component/tooltip';
+import '@rc-component/tooltip/assets/bootstrap_white.css';
+
+export default () => (
+ Tooltip content}>
+
+
+);
+```
+
+Online preview: https://tooltip.react-component.vercel.app/
+
+## API
+
+### Tooltip
+
+| 名称 | 类型 | 默认值 | 说明 |
+| --------------------- | ---------------------------------------------------- | ------------------- | ---------------------------------------------------------- |
+| `afterVisibleChange` | `(visible: boolean) => void` | - | Called after popup visibility changes. |
+| `align` | AlignType | `{}` | Extra popup alignment config. |
+| `arrowContent` | React.ReactNode | - | Custom arrow content. |
+| `builtinPlacements` | TriggerProps['builtinPlacements'] | built in placements | Placement map passed to trigger. |
+| `children` | React.ReactElement | - | Required trigger element. |
+| `classNames` | `Partial>` | - | Semantic class names for root, arrow, and container nodes. |
+| `defaultVisible` | boolean | - | Initial uncontrolled visible state. |
+| `destroyOnHidden` | boolean | false | Destroy popup DOM when hidden. |
+| `fresh` | boolean | - | Keep popup content fresh when closed. |
+| `getTooltipContainer` | `(node: HTMLElement) => HTMLElement` | - | Resolve popup container. |
+| `id` | string | generated id | Tooltip id used for accessibility. |
+| `motion` | TriggerProps['popupMotion'] | - | Popup motion config. |
+| `mouseEnterDelay` | number | 0 | Delay in seconds before showing on mouse enter. |
+| `mouseLeaveDelay` | number | 0.1 | Delay in seconds before hiding on mouse leave. |
+| `onPopupAlign` | TriggerProps['onPopupAlign'] | - | Called after popup alignment. |
+| `onVisibleChange` | `(visible: boolean) => void` | - | Called when visibility changes. |
+| `overlay` | React.ReactNode \| `() => React.ReactNode` | - | Tooltip content. |
+| `placement` | string | `'right'` | Popup placement. |
+| `prefixCls` | string | `'rc-tooltip'` | Prefix class name. |
+| `showArrow` | boolean \| ArrowType | true | Whether to show arrow or provide arrow config. |
+| `styles` | `Partial>` | - | Semantic styles for root, arrow, and container nodes. |
+| `trigger` | ActionType \| ActionType[] | `['hover']` | Actions that show the tooltip. |
+| `unique` | TriggerProps['unique'] | - | Experimental unique container reuse config. |
+| `visible` | boolean | - | Controlled visible state. |
+| `zIndex` | number | - | Popup z-index. |
+
+## 本地开发
+
+```bash
+npm install
+npm start
+npm test
+npm run tsc
+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/tooltip is released under the [MIT](./LICENSE) license.
From 3616952822197fe9ee59d8aa4748ac479d59064d Mon Sep 17 00:00:00 2001
From: afc163
Date: Sat, 27 Jun 2026 22:35:05 +0800
Subject: [PATCH 10/28] 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 039e7e72..c48e6f05 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
@rc-component/tooltip
Part of the Ant Design ecosystem.
+
💡 Positioned React tooltip for hover, focus, click, and controlled popup flows.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 09e6a111..8a93a0d6 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -1,6 +1,7 @@
@rc-component/tooltip
Ant Design 生态的一部分。
+
💡 React 文字提示组件,基于 trigger 定位和弹层能力构建。
From de136d57f4e981fe8c73d706934e95f7d6c2c948 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sat, 27 Jun 2026 23:04:06 +0800
Subject: [PATCH 11/28] 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 c48e6f05..85a91ce0 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,6 @@
@rc-component/tooltip
-
Part of the Ant Design ecosystem.
-

+
Part of the Ant Design ecosystem.
💡 Positioned React tooltip for hover, focus, click, and controlled popup flows.
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 8a93a0d6..4cdcae7a 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -1,7 +1,6 @@
@rc-component/tooltip
-
Ant Design 生态的一部分。
-

+
Ant Design 生态的一部分。
💡 React 文字提示组件,基于 trigger 定位和弹层能力构建。
@@ -19,10 +18,10 @@
## 特性
-- 支持 hover, focus, click, and controlled visibility through one trigger layer.
-- 提供 built-in placements, custom alignment, delays, arrows, and popup motion.
-- 暴露 semantic `classNames` and `styles` slots for root, arrow, and container nodes.
-- 保留 accessibility wiring through generated tooltip ids and `aria-describedby`.
+- 支持悬停、聚焦、单击以及通过一个触发层控制可见性。
+- 提供内置放置、自定义对齐、延迟、箭头和弹层动作。
+- 为根节点、箭头节点和容器节点引入语义 `classNames` 和 `styles` 槽。
+- 通过生成的工具提示 id 和 `aria-describedby` 保留可访问性连接。
## 安装
@@ -43,7 +42,7 @@ export default () => (
);
```
-Online preview: https://tooltip.react-component.vercel.app/
+在线预览:https://tooltip.react-component.vercel.app/
## API
@@ -51,31 +50,31 @@ Online preview: https://tooltip.react-component.vercel.app/
| 名称 | 类型 | 默认值 | 说明 |
| --------------------- | ---------------------------------------------------- | ------------------- | ---------------------------------------------------------- |
-| `afterVisibleChange` | `(visible: boolean) => void` | - | Called after popup visibility changes. |
-| `align` | AlignType | `{}` | Extra popup alignment config. |
-| `arrowContent` | React.ReactNode | - | Custom arrow content. |
-| `builtinPlacements` | TriggerProps['builtinPlacements'] | built in placements | Placement map passed to trigger. |
-| `children` | React.ReactElement | - | Required trigger element. |
-| `classNames` | `Partial>` | - | Semantic class names for root, arrow, and container nodes. |
-| `defaultVisible` | boolean | - | Initial uncontrolled visible state. |
-| `destroyOnHidden` | boolean | false | Destroy popup DOM when hidden. |
-| `fresh` | boolean | - | Keep popup content fresh when closed. |
-| `getTooltipContainer` | `(node: HTMLElement) => HTMLElement` | - | Resolve popup container. |
-| `id` | string | generated id | Tooltip id used for accessibility. |
-| `motion` | TriggerProps['popupMotion'] | - | Popup motion config. |
-| `mouseEnterDelay` | number | 0 | Delay in seconds before showing on mouse enter. |
-| `mouseLeaveDelay` | number | 0.1 | Delay in seconds before hiding on mouse leave. |
-| `onPopupAlign` | TriggerProps['onPopupAlign'] | - | Called after popup alignment. |
-| `onVisibleChange` | `(visible: boolean) => void` | - | Called when visibility changes. |
-| `overlay` | React.ReactNode \| `() => React.ReactNode` | - | Tooltip content. |
-| `placement` | string | `'right'` | Popup placement. |
-| `prefixCls` | string | `'rc-tooltip'` | Prefix class name. |
-| `showArrow` | boolean \| ArrowType | true | Whether to show arrow or provide arrow config. |
-| `styles` | `Partial>` | - | Semantic styles for root, arrow, and container nodes. |
-| `trigger` | ActionType \| ActionType[] | `['hover']` | Actions that show the tooltip. |
-| `unique` | TriggerProps['unique'] | - | Experimental unique container reuse config. |
-| `visible` | boolean | - | Controlled visible state. |
-| `zIndex` | number | - | Popup z-index. |
+| `afterVisibleChange` | `(visible: boolean) => void` | - | 弹层窗口可见性更改后调用。 |
+| `align` | AlignType | `{}` | 额外弹层对齐配置。 |
+| `arrowContent` | React.ReactNode | - | 自定义箭头内容。 |
+| `builtinPlacements` | TriggerProps['builtinPlacements'] | built in placements | 放置图传递给触发器。 |
+| `children` | React.ReactElement | - | 所需的触发元素。 |
+| `classNames` | `Partial>` | - | 根节点、箭头节点和容器节点的语义className称。 |
+| `defaultVisible` | boolean | - | 初始不受控制的可见状态。 |
+| `destroyOnHidden` | boolean | false | 隐藏时销毁弹层 DOM。 |
+| `fresh` | boolean | - | 关闭时保持弹层内容新鲜。 |
+| `getTooltipContainer` | `(node: HTMLElement) => HTMLElement` | - | 解决弹层容器。 |
+| `id` | string | generated id | 用于辅助功能的工具提示 ID。 |
+| `motion` | TriggerProps['popupMotion'] | - | 弹层运动配置。 |
+| `mouseEnterDelay` | number | 0 | 在鼠标输入时显示之前的延迟(以秒为单位)。 |
+| `mouseLeaveDelay` | number | 0.1 | 在鼠标离开隐藏之前延迟几秒钟。 |
+| `onPopupAlign` | TriggerProps['onPopupAlign'] | - | 弹层对齐后调用。 |
+| `onVisibleChange` | `(visible: boolean) => void` | - | 当可见性发生变化时调用。 |
+| `overlay` | React.ReactNode \| `() => React.ReactNode` | - | 提示内容。 |
+| `placement` | string | `'right'` | 弹层窗口放置。 |
+| `prefixCls` | string | `'rc-tooltip'` | 前缀className。 |
+| `showArrow` | boolean \| ArrowType | true | 是否显示箭头,或提供箭头配置。 |
+| `styles` | `Partial>` | - | 根节点、箭头节点和容器节点的语义样式。 |
+| `trigger` | ActionType \| ActionType[] | `['hover']` | 显示提示的触发行为。 |
+| `unique` | TriggerProps['unique'] | - | 实验性独特的容器重用配置。 |
+| `visible` | boolean | - | 受控可见状态。 |
+| `zIndex` | number | - | 弹层 z 索引。 |
## 本地开发
@@ -94,8 +93,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/tooltip is released under the [MIT](./LICENSE) license.
+@rc-component/tooltip 基于 [MIT](./LICENSE) 许可证发布。
From 36996c6d08c70c37cd9c8d4011003f769d93fba6 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 01:28:44 +0800
Subject: [PATCH 12/28] chore: standardize rc tooling and docs
---
.dumirc.ts | 2 +-
README.md | 11 +++++++++++
README.zh-CN.md | 11 +++++++++++
package.json | 36 ++++++++++++++++++------------------
tsconfig.json | 40 +++++++++++++++++++++++++++++++---------
5 files changed, 72 insertions(+), 28 deletions(-)
diff --git a/.dumirc.ts b/.dumirc.ts
index 97a5ddf8..4f40c1df 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 ? '/tooltip/' : '/';
-const publicPath = process.env.GH_PAGES ? '/tooltip/' : '/';
+const publicPath = basePath;
export default defineConfig({
alias: {
diff --git a/README.md b/README.md
index 85a91ce0..9a327fac 100644
--- a/README.md
+++ b/README.md
@@ -44,6 +44,17 @@ export default () => (
Online preview: https://tooltip.react-component.vercel.app/
+## Examples
+
+Run the local dumi site:
+
+```bash
+npm install
+npm start
+```
+
+Then open `http://localhost:8000`.
+
## API
### Tooltip
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 4cdcae7a..563bb57d 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -44,6 +44,17 @@ export default () => (
在线预览:https://tooltip.react-component.vercel.app/
+## 示例
+
+运行本地 dumi 站点:
+
+```bash
+npm install
+npm start
+```
+
+然后打开 `http://localhost:8000`。
+
## API
### Tooltip
diff --git a/package.json b/package.json
index 8b811936..0fbf0ea6 100644
--- a/package.json
+++ b/package.json
@@ -50,25 +50,25 @@
},
"devDependencies": {
"@rc-component/father-plugin": "^2.2.0",
- "@rc-component/np": "^1.0.3",
+ "@rc-component/np": "^1.0.4",
"@testing-library/jest-dom": "^6.9.1",
- "@testing-library/react": "^16.3.0",
- "@types/jest": "^29.4.0",
- "@types/node": "^22.15.18",
- "@types/react": "^19.1.4",
- "@types/react-dom": "^19.1.5",
- "@types/warning": "^3.0.0",
- "dumi": "^2.2.13",
- "eslint": "^8.56.0",
- "father": "^4.0.0",
- "gh-pages": "^6.1.1",
- "less": "^4.1.1",
- "prettier": "^3.6.2",
- "rc-test": "^7.0.9",
- "react": "^19.1.0",
- "react-dom": "^19.1.0",
- "typescript": "^4.0.5",
- "cross-env": "^7.0.0"
+ "@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",
+ "dumi": "^2.4.35",
+ "eslint": "^8.57.1",
+ "father": "^4.6.23",
+ "gh-pages": "^6.3.0",
+ "less": "^4.6.7",
+ "prettier": "^3.9.0",
+ "rc-test": "^7.1.3",
+ "react": "^18.3.1",
+ "react-dom": "^18.3.1",
+ "typescript": "^5.9.3",
+ "cross-env": "^10.1.0"
},
"peerDependencies": {
"react": ">=18.0.0",
diff --git a/tsconfig.json b/tsconfig.json
index 9d6e202a..daa07014 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -7,15 +7,37 @@
"declaration": true,
"skipLibCheck": true,
"esModuleInterop": true,
- "types": ["@testing-library/jest-dom"],
+ "types": [
+ "@testing-library/jest-dom"
+ ],
"paths": {
- "@/*": ["src/*"],
- "@@/*": [".dumi/tmp/*"],
- "@rc-component/tooltip": ["src/index.tsx"],
- "@rc-component/tooltip/es": ["src"],
- "@rc-component/tooltip/es/*": ["src/*"]
- }
+ "@/*": [
+ "src/*"
+ ],
+ "@@/*": [
+ ".dumi/tmp/*"
+ ],
+ "@rc-component/tooltip": [
+ "src/index.tsx"
+ ],
+ "@rc-component/tooltip/es": [
+ "src"
+ ],
+ "@rc-component/tooltip/es/*": [
+ "src/*"
+ ]
+ },
+ "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 1846df631c498f8998bd62a189fbd3fd84870168 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 02:01:08 +0800
Subject: [PATCH 13/28] chore: address standardization review comments
---
.github/workflows/surge-preview.yml | 16 +++++++++++++---
README.md | 2 +-
README.zh-CN.md | 14 +++++++-------
3 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml
index faf6b8bd..cb6c8c4a 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."
diff --git a/README.md b/README.md
index 9a327fac..a0202700 100644
--- a/README.md
+++ b/README.md
@@ -64,7 +64,7 @@ Then open `http://localhost:8000`.
| `afterVisibleChange` | `(visible: boolean) => void` | - | Called after popup visibility changes. |
| `align` | AlignType | `{}` | Extra popup alignment config. |
| `arrowContent` | React.ReactNode | - | Custom arrow content. |
-| `builtinPlacements` | TriggerProps['builtinPlacements'] | built in placements | Placement map passed to trigger. |
+| `builtinPlacements` | TriggerProps['builtinPlacements'] | built-in placements | Placement map passed to trigger. |
| `children` | React.ReactElement | - | Required trigger element. |
| `classNames` | `Partial>` | - | Semantic class names for root, arrow, and container nodes. |
| `defaultVisible` | boolean | - | Initial uncontrolled visible state. |
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 563bb57d..068b1f94 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -64,22 +64,22 @@ npm start
| `afterVisibleChange` | `(visible: boolean) => void` | - | 弹层窗口可见性更改后调用。 |
| `align` | AlignType | `{}` | 额外弹层对齐配置。 |
| `arrowContent` | React.ReactNode | - | 自定义箭头内容。 |
-| `builtinPlacements` | TriggerProps['builtinPlacements'] | built in placements | 放置图传递给触发器。 |
+| `builtinPlacements` | TriggerProps['builtinPlacements'] | built-in placements | 传递给触发器的放置映射。 |
| `children` | React.ReactElement | - | 所需的触发元素。 |
-| `classNames` | `Partial>` | - | 根节点、箭头节点和容器节点的语义className称。 |
+| `classNames` | `Partial>` | - | 根节点、箭头节点和容器节点的语义化类名。 |
| `defaultVisible` | boolean | - | 初始不受控制的可见状态。 |
| `destroyOnHidden` | boolean | false | 隐藏时销毁弹层 DOM。 |
| `fresh` | boolean | - | 关闭时保持弹层内容新鲜。 |
-| `getTooltipContainer` | `(node: HTMLElement) => HTMLElement` | - | 解决弹层容器。 |
+| `getTooltipContainer` | `(node: HTMLElement) => HTMLElement` | - | 指定弹层容器。 |
| `id` | string | generated id | 用于辅助功能的工具提示 ID。 |
| `motion` | TriggerProps['popupMotion'] | - | 弹层运动配置。 |
-| `mouseEnterDelay` | number | 0 | 在鼠标输入时显示之前的延迟(以秒为单位)。 |
-| `mouseLeaveDelay` | number | 0.1 | 在鼠标离开隐藏之前延迟几秒钟。 |
+| `mouseEnterDelay` | number | 0 | 鼠标移入后显示的延迟(秒)。 |
+| `mouseLeaveDelay` | number | 0.1 | 鼠标移出后隐藏的延迟(秒)。 |
| `onPopupAlign` | TriggerProps['onPopupAlign'] | - | 弹层对齐后调用。 |
| `onVisibleChange` | `(visible: boolean) => void` | - | 当可见性发生变化时调用。 |
| `overlay` | React.ReactNode \| `() => React.ReactNode` | - | 提示内容。 |
-| `placement` | string | `'right'` | 弹层窗口放置。 |
-| `prefixCls` | string | `'rc-tooltip'` | 前缀className。 |
+| `placement` | string | `'right'` | 弹层放置。 |
+| `prefixCls` | string | `'rc-tooltip'` | 前缀 className。 |
| `showArrow` | boolean \| ArrowType | true | 是否显示箭头,或提供箭头配置。 |
| `styles` | `Partial>` | - | 根节点、箭头节点和容器节点的语义样式。 |
| `trigger` | ActionType \| ActionType[] | `['hover']` | 显示提示的触发行为。 |
From 98d897e6a22447bd75759d24958a02b3c27a3953 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 12:24:46 +0800
Subject: [PATCH 14/28] 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 23f424a8..6999184b 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 1641065bb1fd3ddc049d9fe4c97920b5486025c9 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 12:30:22 +0800
Subject: [PATCH 15/28] 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 6999184b..23f424a8 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 a5df5352296af3f70c9a798dd9956cff91463bd0 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 14:01:55 +0800
Subject: [PATCH 16/28] 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 23f424a8..82242dfd 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 f68281c8..097eb883 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 cb6c8c4a..ebfecd53 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 b8c75e4d89b76698f3c022223d18e65047b468d9 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 14:32:25 +0800
Subject: [PATCH 17/28] chore: standardize package metadata
---
package.json | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/package.json b/package.json
index 0fbf0ea6..94d231c9 100644
--- a/package.json
+++ b/package.json
@@ -10,11 +10,11 @@
],
"homepage": "https://react-component.github.io/tooltip",
"bugs": {
- "url": "http://github.com/react-component/tooltip/issues"
+ "url": "https://github.com/react-component/tooltip/issues"
},
"repository": {
"type": "git",
- "url": "git@github.com:react-component/tooltip.git"
+ "url": "https://github.com/react-component/tooltip.git"
},
"license": "MIT",
"maintainers": [
@@ -74,5 +74,8 @@
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
},
- "types": "./lib/index.d.ts"
+ "types": "./lib/index.d.ts",
+ "publishConfig": {
+ "access": "public"
+ }
}
From f8a49da2d57fbfb0f871feda5a198c3c95c24e40 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 14:38:37 +0800
Subject: [PATCH 18/28] 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 07575c02..3b730ef9 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 7851d841410dc8759460d88a20d2fc296ac6458e Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 15:07:34 +0800
Subject: [PATCH 19/28] chore: ignore generated docs artifacts
---
.gitignore | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.gitignore b/.gitignore
index 4597fc50..f0882bba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,3 +46,6 @@ tmp/
bun.lockb
bun.lock
+coverage
+.dumi/tmp
+.dumi/tmp-production
From 82eee44e10da1f15c1d7c5c8c04251c37fe8ae4d Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 17:16:40 +0800
Subject: [PATCH 20/28] 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 ebfecd53..eaff160a 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 00000000..c466d872
--- /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 1e249dd579d2276f9f6207c4030e7c625fb7a8c2 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 19:14:22 +0800
Subject: [PATCH 21/28] chore: add father config
---
.fatherrc.ts | 5 +++++
tsconfig.json | 1 +
2 files changed, 6 insertions(+)
create mode 100644 .fatherrc.ts
diff --git a/.fatherrc.ts b/.fatherrc.ts
new file mode 100644
index 00000000..96268ae1
--- /dev/null
+++ b/.fatherrc.ts
@@ -0,0 +1,5 @@
+import { defineConfig } from 'father';
+
+export default defineConfig({
+ plugins: ['@rc-component/father-plugin'],
+});
diff --git a/tsconfig.json b/tsconfig.json
index daa07014..b22bfce4 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -31,6 +31,7 @@
},
"include": [
".dumirc.ts",
+ ".fatherrc.ts",
"src",
"tests",
"docs/examples"
From a26a2800e099f3810bdd48c9c6263aef79bdc0f2 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 19:39:41 +0800
Subject: [PATCH 22/28] 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 a0202700..86f709d9 100644
--- a/README.md
+++ b/README.md
@@ -98,6 +98,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 068b1f94..eacb56ca 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -98,6 +98,8 @@ npm run compile
npm run build
```
+dumi 站点默认运行在 `http://localhost:8000`。
+
## 发布
```bash
From 83b1c4b8a0891313ae84c1a355a640529a0227c2 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 19:59:10 +0800
Subject: [PATCH 23/28] chore: standardize husky configuration
---
.husky/pre-commit | 1 +
package.json | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
create mode 100755 .husky/pre-commit
diff --git a/.husky/pre-commit b/.husky/pre-commit
new file mode 100755
index 00000000..2312dc58
--- /dev/null
+++ b/.husky/pre-commit
@@ -0,0 +1 @@
+npx lint-staged
diff --git a/package.json b/package.json
index 94d231c9..c9c58448 100644
--- a/package.json
+++ b/package.json
@@ -41,7 +41,8 @@
"prettier": "prettier --write --ignore-unknown .",
"start": "dumi dev",
"test": "rc-test",
- "tsc": "tsc --noEmit"
+ "tsc": "tsc --noEmit",
+ "prepare": "husky"
},
"dependencies": {
"@rc-component/trigger": "^3.7.1",
@@ -68,7 +69,9 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.9.3",
- "cross-env": "^10.1.0"
+ "cross-env": "^10.1.0",
+ "husky": "^9.1.7",
+ "lint-staged": "^16.4.0"
},
"peerDependencies": {
"react": ">=18.0.0",
@@ -77,5 +80,8 @@
"types": "./lib/index.d.ts",
"publishConfig": {
"access": "public"
+ },
+ "lint-staged": {
+ "*": "prettier --write --ignore-unknown"
}
}
From c68a60d36e323e9b212eb52db61d01a88cc92fc3 Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 20:33:25 +0800
Subject: [PATCH 24/28] chore: standardize package type entry
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index c9c58448..89633334 100644
--- a/package.json
+++ b/package.json
@@ -77,7 +77,7 @@
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
},
- "types": "./lib/index.d.ts",
+ "types": "./es/index.d.ts",
"publishConfig": {
"access": "public"
},
From 770bc7ee1d18f05da4b71543626576d25330eeee Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 21:01:44 +0800
Subject: [PATCH 25/28] 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 86f709d9..727846c6 100644
--- a/README.md
+++ b/README.md
@@ -4,12 +4,12 @@
💡 Positioned React tooltip for hover, focus, click, and controlled popup flows.
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/README.zh-CN.md b/README.zh-CN.md
index eacb56ca..da084ae0 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -4,12 +4,12 @@
💡 React 文字提示组件,基于 trigger 定位和弹层能力构建。
-
-
-
-
-
-
+
+
+
+
+
+
From 72f6d60320efc32c2f13595a81496d49676dd33d Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 21:21:29 +0800
Subject: [PATCH 26/28] 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 1ed64209..cf754afa 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 ff13c9049ca5d66b86c4948f88d4b84d140c5d3e Mon Sep 17 00:00:00 2001
From: afc163
Date: Sun, 28 Jun 2026 21:30:21 +0800
Subject: [PATCH 27/28] 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 cf754afa..1ed64209 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 fd8a71bf8d6e7b0cff5221cfe39360000b3cda9f Mon Sep 17 00:00:00 2001
From: afc163
Date: Mon, 29 Jun 2026 01:21:04 +0800
Subject: [PATCH 28/28] 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 eaff160a..4c2f17ed 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: