From 92f80645c8f8ca1ae210cf3acaaf54901b8245d8 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 26 Jun 2026 13:56:16 +0800 Subject: [PATCH 01/38] chore: standardize repository config --- .dumirc.ts | 2 +- .github/FUNDING.yml | 2 + .../workflows/cloudflare-pages-preview.yml | 42 ++++ .github/workflows/codeql.yml | 22 +- .github/workflows/main.yml | 6 - .github/workflows/react-component-ci.yml | 6 + .github/workflows/react-doctor.yml | 27 ++ .github/workflows/surge-preview.yml | 39 +++ .gitignore | 3 + README.md | 235 ++++++++++-------- package.json | 12 +- vercel.json | 6 + 12 files changed, 274 insertions(+), 128 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/cloudflare-pages-preview.yml delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/react-component-ci.yml create mode 100644 .github/workflows/react-doctor.yml create mode 100644 .github/workflows/surge-preview.yml create mode 100644 vercel.json diff --git a/.dumirc.ts b/.dumirc.ts index 498e3b6..0b40825 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -10,7 +10,7 @@ export default defineConfig({ name: 'Input', logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4', }, - outputPath: '.doc', + outputPath: 'docs-dist', base: basePath, publicPath, }); diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..758659a --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: ant-design +open_collective: ant-design diff --git a/.github/workflows/cloudflare-pages-preview.yml b/.github/workflows/cloudflare-pages-preview.yml new file mode 100644 index 0000000..d925f51 --- /dev/null +++ b/.github/workflows/cloudflare-pages-preview.yml @@ -0,0 +1,42 @@ +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-dist --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 bc73d6d..1d87fcb 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: "13 6 * * 2" + - cron: '13 6 * * 2' 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/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 5735e2d..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,6 +0,0 @@ -name: ✅ test -on: [push, pull_request] -jobs: - test: - uses: react-component/rc-test/.github/workflows/test.yml@main - secrets: inherit \ No newline at end of file diff --git a/.github/workflows/react-component-ci.yml b/.github/workflows/react-component-ci.yml new file mode 100644 index 0000000..f8482b6 --- /dev/null +++ b/.github/workflows/react-component-ci.yml @@ -0,0 +1,6 @@ +name: ✅ test +on: [push, pull_request] +jobs: + test: + uses: react-component/rc-test/.github/workflows/test-utoo.yml@main + secrets: inherit diff --git a/.github/workflows/react-doctor.yml b/.github/workflows/react-doctor.yml new file mode 100644 index 0000000..f68281c --- /dev/null +++ b/.github/workflows/react-doctor.yml @@ -0,0 +1,27 @@ +name: React Doctor + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + push: + branches: [master] + +permissions: + contents: read + pull-requests: write + issues: write + statuses: write + +concurrency: + group: react-doctor-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + react-doctor: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 + with: + fetch-depth: 0 + persist-credentials: false + - uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3 diff --git a/.github/workflows/surge-preview.yml b/.github/workflows/surge-preview.yml new file mode 100644 index 0000000..1b29a17 --- /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 cda3eae..174db1f 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ pnpm-lock.yaml coverage/ .doc dist/ +docs-dist/ # umi .umi @@ -43,3 +44,5 @@ dist/ .dumi/tmp-production .node bun.lockb +.vercel +.vercel diff --git a/README.md b/README.md index 036b692..a3cf38c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ -# @rc-component/input ⌨️ +
+

@rc-component/input

+

⌨️ Low-level React input primitives for building polished text fields and textareas.

+
+ +
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] @@ -7,142 +12,162 @@ [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url] -[npm-image]: http://img.shields.io/npm/v/@rc-component/input.svg?style=flat-square -[npm-url]: http://npmjs.org/package/@rc-component/input -[travis-image]: https://img.shields.io/travis/react-component/input/master?style=flat-square -[travis-url]: https://travis-ci.com/react-component/input -[github-actions-image]: https://github.com/react-component/input/actions/workflows/main.yml/badge.svg -[github-actions-url]: https://github.com/react-component/input/actions/workflows/main.yml -[codecov-image]: https://img.shields.io/codecov/c/github/react-component/input/master.svg?style=flat-square -[codecov-url]: https://app.codecov.io/gh/react-component/input -[david-url]: https://david-dm.org/react-component/input -[david-image]: https://david-dm.org/react-component/input/status.svg?style=flat-square -[david-dev-url]: https://david-dm.org/react-component/input?type=dev -[david-dev-image]: https://david-dm.org/react-component/input/dev-status.svg?style=flat-square -[download-image]: https://img.shields.io/npm/dm/@rc-component/input.svg?style=flat-square -[download-url]: https://npmjs.org/package/@rc-component/input -[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/input -[bundlephobia-image]: https://img.shields.io/bundlephobia/minzip/@rc-component/input?style=flat-square -[dumi-url]: https://github.com/umijs/dumi -[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square +
+ +
+ + Part of the Ant Design ecosystem + Ant Design + +
+ +## Highlights + +- Composable `Input`, `TextArea`, and `BaseInput` primitives. +- Affix, addon, clear icon, prefix, suffix, and character count support. +- Autosizing textarea with resize callbacks and imperative refs. +- TypeScript definitions and semantic `classNames` / `styles` slots. +- Used by Ant Design as the shared input foundation. ## Install -[![@rc-component/input](https://nodei.co/npm/@rc-component/input.png)](https://npmjs.org/package/@rc-component/input) +```bash +npm install @rc-component/input +``` ## Usage -```js +```tsx | pure import Input from '@rc-component/input'; -import { render } from 'react-dom'; -render(, mountNode); +export default () => ; ``` -```js +```tsx | pure import { TextArea } from '@rc-component/input'; -import { render } from 'react-dom'; -render(