-
Notifications
You must be signed in to change notification settings - Fork 29
chore: standardize repository config #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
4331968
chore: standardize repository config
afc163 771799e
fix: make preview build generate styles
afc163 bed5b58
fix: address review feedback
afc163 4f5736b
fix: keep rc-test secrets inheritance
afc163 fbeb616
fix: align test workflow triggers
afc163 7336b16
chore: address AI review feedback
afc163 9038793
docs: standardize README release details
afc163 fb6afc2
ci: make surge preview non-blocking
afc163 a491ac0
ci: keep surge preview as fallback
afc163 941413f
docs: refine README usage and ecosystem note
afc163 75577f2
ci: isolate surge preview token
afc163 8252c5b
docs: add Chinese README
afc163 ba9acc9
docs: add Ant Design logo to README
afc163 11a0aea
docs: refine bilingual README branding
afc163 0b2914f
chore: standardize rc tooling and docs
afc163 7533087
chore: address standardization review comments
afc163 54638a9
chore: include father config in type checks
afc163 8f132fe
docs: add license file
afc163 fe3bf79
ci: use actions checkout v7
afc163 a0320ec
chore: standardize package metadata
afc163 25efc32
ci: standardize dependabot updates
afc163 d31e137
docs: fix Chinese README API names
afc163 28dcc11
chore: refine preview workflow ignores
afc163 d6eb2c5
docs: polish Chinese README wording
afc163 42523cb
chore: align tooling ignores and typescript
afc163 bb3401c
docs: polish Chinese README wording
afc163 6207ea4
docs: document dumi dev server port
afc163 07de675
chore: standardize husky configuration
afc163 433c7f8
docs: normalize readme badges
afc163 8822e57
ci: limit reusable workflow secrets
afc163 35cd254
ci: restore reusable workflow compatibility
afc163 c217523
docs: polish zh-CN readme wording
afc163 35e1c11
ci: narrow surge preview permissions
afc163 b9b0bb4
chore: limit reusable workflow secrets
afc163 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| github: ant-design | ||
| open_collective: ant-design |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| name: ✅ test | ||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| branches: [master] | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| test: | ||
| uses: react-component/rc-test/.github/workflows/test-utoo.yml@main | ||
| secrets: | ||
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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@v7 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| - uses: millionco/react-doctor@0b4f4f4bd248a154e64eb508a48347f71154b3f3 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| 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 | ||
|
|
||
| jobs: | ||
| preview: | ||
| runs-on: ubuntu-latest | ||
| concurrency: | ||
| group: surge-preview-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
| env: | ||
| PREVIEW: true | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| 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: ${{ steps.surge-token.outputs.enabled == 'true' }} | ||
| run: | | ||
| npm install | ||
| npm run build | ||
| - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec | ||
| if: ${{ steps.surge-token.outputs.enabled == 'true' }} | ||
| env: | ||
| SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | ||
| with: | ||
| surge_token: ${{ env.SURGE_TOKEN }} | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| dist: docs-dist | ||
| failOnError: false | ||
| setCommitStatus: false | ||
| - name: Skip Surge preview | ||
| if: ${{ steps.surge-token.outputs.enabled != 'true' }} | ||
| run: echo "SURGE_TOKEN is not configured; skip Surge preview." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,8 @@ package-lock.json | |
| pnpm-lock.yaml | ||
| coverage/ | ||
| .doc | ||
| docs-dist | ||
| .vercel | ||
|
|
||
| # umi | ||
| .umi | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1 @@ | ||
| #!/usr/bin/env sh | ||
| . "$(dirname -- "$0")/_/husky.sh" | ||
|
|
||
| npx pretty-quick --staged | ||
| npx lint-staged |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,79 +1,119 @@ | ||
| # @rc-component/segmented | ||
| <div align="center"> | ||
| <h1>@rc-component/segmented</h1> | ||
| <p><sub><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /> Part of the Ant Design ecosystem.</sub></p> | ||
| <p>🧩 React segmented control for switching between compact options.</p> | ||
|
|
||
| [![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] | ||
| <p> | ||
| <a href="https://npmjs.org/package/@rc-component/segmented"><img alt="NPM version" src="https://img.shields.io/npm/v/@rc-component/segmented.svg?style=flat-square"></a> | ||
| <a href="https://npmjs.org/package/@rc-component/segmented"><img alt="npm downloads" src="https://img.shields.io/npm/dm/@rc-component/segmented.svg?style=flat-square"></a> | ||
| <a href="https://github.com/react-component/segmented/actions/workflows/react-component-ci.yml"><img alt="build status" src="https://github.com/react-component/segmented/actions/workflows/react-component-ci.yml/badge.svg"></a> | ||
| <a href="https://app.codecov.io/gh/react-component/segmented"><img alt="Codecov" src="https://img.shields.io/codecov/c/github/react-component/segmented/master.svg?style=flat-square"></a> | ||
| <a href="https://bundlephobia.com/package/@rc-component/segmented"><img alt="bundle size" src="https://img.shields.io/bundlephobia/minzip/@rc-component/segmented?style=flat-square"></a> | ||
| <a href="https://github.com/umijs/dumi"><img alt="dumi" src="https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square"></a> | ||
| </p> | ||
| </div> | ||
|
|
||
| [npm-image]: http://img.shields.io/npm/v/@rc-component/segmented.svg?style=flat-square | ||
| [npm-url]: http://npmjs.org/package/@rc-component/segmented | ||
| [github-actions-image]: https://github.com/react-component/segmented/actions/workflows/main.yml/badge.svg | ||
| [github-actions-url]: https://github.com/react-component/segmented/actions/workflows/main.yml | ||
| [codecov-image]: https://codecov.io/gh/react-component/segmented/branch/master/graph/badge.svg | ||
| [codecov-url]: https://codecov.io/gh/react-component/segmented/branch/master | ||
| [download-image]: https://img.shields.io/npm/dm/@rc-component/segmented.svg?style=flat-square | ||
| [download-url]: https://npmjs.org/package/@rc-component/segmented | ||
| [bundlephobia-url]: https://bundlephobia.com/package/@rc-component/segmented | ||
| [bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/segmented | ||
| <p align="center">English | <a href="./README.zh-CN.md">简体中文</a></p> | ||
|
|
||
| React Segmented Control. | ||
|
|
||
|  | ||
| ## Highlights | ||
|
|
||
| ## Live Demo | ||
|
|
||
| https://react-component.github.io/segmented/ | ||
| - Supports string, number, and labeled option records. | ||
| - Provides controlled and uncontrolled value flows. | ||
| - Includes keyboard navigation, RTL, vertical layout, and disabled options. | ||
| - Exposes semantic `classNames` and `styles` slots for item and label customization. | ||
|
|
||
| ## Install | ||
|
|
||
| [](https://npmjs.org/package/@rc-component/segmented) | ||
| ```bash | ||
| npm install @rc-component/segmented | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ```js | ||
| ```tsx pure | ||
| import Segmented from '@rc-component/segmented'; | ||
| import '@rc-component/segmented/assets/index.css'; // import '@rc-component/segmented/assets/index.less'; | ||
| import { render } from 'react-dom'; | ||
| import '@rc-component/segmented/assets/index.css'; | ||
|
|
||
| render( | ||
| export default () => ( | ||
| <Segmented | ||
| options={['Antd', 'Antv', 'Egg.js']} | ||
| onChange={(value) => handleValueChange(value)} | ||
| />, | ||
| mountNode, | ||
| options={['Daily', 'Weekly', 'Monthly']} | ||
| defaultValue="Weekly" | ||
| onChange={(value) => { | ||
| console.log(value); | ||
| }} | ||
| /> | ||
| ); | ||
| ``` | ||
|
|
||
| Online preview: https://segmented.react-component.vercel.app/ | ||
|
|
||
| ## Examples | ||
|
|
||
| Run the local dumi site: | ||
|
|
||
| ```bash | ||
| npm install | ||
| npm start | ||
| ``` | ||
|
|
||
| Then open `http://localhost:8000`. | ||
|
|
||
| ## API | ||
|
|
||
| Please note that **onChange** API | ||
| changed on v2.0.0+ | ||
|
|
||
| | Property | Type | Default | Description | | ||
| | --------- | --------- | --------- | --------- | | ||
| | prefixCls | string | `rc-segmented` | prefixCls of this component | | ||
| | className | string | '' | additional class name of segmented | | ||
| | style | React.CSSProperties | | style properties of segmented | | ||
| | options | Array<string \| number \| [SegmentedOption](#SegmentedOption)> | [] | options for choices | | ||
| | value | string \| number | | value of segmented | | ||
| | defaultValue | string \| number | | defaultValue of segmented | | ||
| | value | string \| number | | currently selected value of segmented | | ||
| | onChange | (value: string \| number) => void | | defaultValue of segmented | | ||
| | disabled | boolean | false | disabled status of segmented | | ||
|
|
||
| ### SegmentedOption | ||
|
|
||
| | Property | Type | Default | Description | | ||
| | --------- | --------- | --------- | --------- | | ||
| | label | ReactNode | | label of segmented option | | ||
| | value | string \| number | | value of segmented option | | ||
| | className | string | '' | additional class name of segmented option | | ||
| | disabled | boolean | false | disabled status of segmented option | | ||
| ### Segmented | ||
|
|
||
| | Name | Type | Default | Description | | ||
| | --- | --- | --- | --- | | ||
| | `className` | string | `''` | Additional class name. | | ||
| | `classNames` | Partial<Record<'item' \| 'label', string>> | - | Semantic class names for internal slots. | | ||
| | `defaultValue` | string \| number | first option value | Initial selected value. | | ||
| | `direction` | `'ltr'` \| `'rtl'` | - | Layout direction. | | ||
| | `disabled` | boolean | false | Disable all options. | | ||
| | `itemRender` | `(node: ReactNode, info: { item: SegmentedLabeledOption }) => ReactNode` | identity | Custom option item renderer. | | ||
| | `motionName` | string | `'thumb-motion'` | Motion class name for the active thumb. | | ||
| | `name` | string | - | Radio group name. | | ||
| | `onChange` | `(value: string \| number) => void` | - | Triggered when the selected value changes. | | ||
| | `options` | Array<string \| number \| SegmentedLabeledOption> | - | Available options. Required. | | ||
| | `prefixCls` | string | `'rc-segmented'` | Prefix class name. | | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| | `style` | React.CSSProperties | - | Root style. | | ||
| | `styles` | Partial<Record<'item' \| 'label', React.CSSProperties>> | - | Semantic styles for internal slots. | | ||
| | `value` | string \| number | - | Controlled selected value. | | ||
| | `vertical` | boolean | false | Render options vertically. | | ||
|
|
||
| Additional valid `div` props are passed to the root element. | ||
|
|
||
| ### SegmentedLabeledOption | ||
|
|
||
| | Name | Type | Default | Description | | ||
| | --- | --- | --- | --- | | ||
| | `className` | string | - | Option class name. | | ||
| | `disabled` | boolean | false | Disable this option. | | ||
| | `label` | ReactNode | - | Displayed option content. | | ||
| | `title` | string | derived from label | Native title for the label. | | ||
| | `value` | string \| number | - | Option value. | | ||
|
|
||
| ## Development | ||
|
|
||
| ``` | ||
| ```bash | ||
| npm install | ||
| npm start | ||
| npm test | ||
| npm run tsc | ||
| npm run compile | ||
| npm run build | ||
| ``` | ||
|
|
||
| The dumi site runs at `http://localhost:8000` by default. | ||
|
|
||
| ## Release | ||
|
|
||
| ```bash | ||
| npm run prepublishOnly | ||
| ``` | ||
|
|
||
| The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build. | ||
|
|
||
| ## License | ||
|
|
||
| @rc-component/segmented is released under the MIT license. | ||
| @rc-component/segmented is released under the [MIT](./LICENSE) license. | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.