Skip to content

Commit b84bea7

Browse files
committed
docs: refine bilingual README branding
1 parent cdd4413 commit b84bea7

2 files changed

Lines changed: 51 additions & 53 deletions

File tree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<div align="center">
22
<h1>@rc-component/mentions</h1>
3-
<p><sub>Part of the Ant Design ecosystem.</sub></p>
4-
<img alt="Ant Design" height="32" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" />
3+
<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>
54
<p>💬 React mentions textarea with searchable suggestions and keyboard navigation.</p>
65
</div>
76

README.zh-CN.md

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<div align="center">
22
<h1>@rc-component/mentions</h1>
3-
<p><sub>Ant Design 生态的一部分。</sub></p>
4-
<img alt="Ant Design" height="32" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" />
3+
<p><sub><img alt="Ant Design" height="14" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" style="vertical-align: -0.125em;" /> Ant Design 生态的一部分。</sub></p>
54
<p>💬 React 提及输入组件,支持建议列表、自定义过滤和多前缀触发。</p>
65
</div>
76

@@ -22,10 +21,10 @@
2221

2322
## 特性
2423

25-
- Textarea mentions with prefix based search and selection.
26-
- Keyboard navigation for suggestion menus.
27-
- Data-driven `options` API and `Option` children API.
28-
- Multiple prefixes, custom filtering, custom validation, and split token support.
24+
- 文本区域提及基于前缀的搜索和选择。
25+
- 支持建议菜单的键盘导航。
26+
- 支持数据驱动的 `options` API `Option` 子节点 API
27+
- 多个前缀、自定义过滤、自定义验证和拆分令牌支持。
2928
- Built on `@rc-component/input`, `@rc-component/menu`, and `@rc-component/trigger`.
3029

3130
## 安装
@@ -34,7 +33,7 @@
3433
npm install @rc-component/mentions
3534
```
3635

37-
> The package is published as `@rc-component/mentions`. Legacy `rc-mentions` references should migrate to the scoped package name.
36+
> 该包发布为 `@rc-component/mentions`。旧的 `rc-mentions` 引用应迁移到带 scope 的包名。
3837
3938
## 使用
4039

@@ -65,7 +64,7 @@ export default () => (
6564
);
6665
```
6766

68-
Import the styles from `assets/index.less` or the compiled CSS generated by `npm run compile`.
67+
`assets/index.less` 引入样式,或使用 `npm run compile` 生成的编译后 CSS。
6968

7069
## 示例
7170

@@ -76,60 +75,60 @@ npm install
7675
npm start
7776
```
7877

79-
The demo site includes basic usage, dynamic suggestions, custom filtering, multiple prefixes, textarea behavior, and scroll callbacks.
78+
示例站点包含基础用法、动态建议、自定义过滤、多前缀、文本域行为和滚动回调。
8079

8180
## API
8281

8382
### Mentions
8483

8584
| 参数 | 类型 | 默认值 | 说明 |
8685
| ----------------- | ---------------------------------------------------------- | ------------- | ----------------------------------------------- |
87-
| allowClear | `boolean \| { clearIcon?: ReactNode }` | `false` | Show a clear button for the textarea value. |
88-
| autoFocus | `boolean` | `false` | Focus the textarea when mounted. |
89-
| autoSize | `boolean \| { minRows?: number; maxRows?: number }` | - | Auto resize textarea height. |
90-
| children | `ReactNode` | - | `Mentions.Option` children. |
91-
| className | `string` | - | Class name for the root element. |
92-
| classNames | `MentionsProps['classNames']` | - | Semantic class names for slots. |
93-
| defaultValue | `string` | - | Initial value. |
94-
| direction | `'ltr' \| 'rtl'` | `ltr` | Popup direction. |
95-
| filterOption | `false \| (input: string, option: OptionProps) => boolean` | - | Customize option filtering. |
96-
| getPopupContainer | `() => HTMLElement` | - | Container for the suggestion popup. |
86+
| allowClear | `boolean \| { clearIcon?: ReactNode }` | `false` | 显示文本区域值的清除按钮。 |
87+
| autoFocus | `boolean` | `false` | 安装后聚焦文本区域。 |
88+
| autoSize | `boolean \| { minRows?: number; maxRows?: number }` | - | 自动调整文本区域高度。 |
89+
| children们 | `ReactNode` | - | `Mentions.Option` 小朋友。 |
90+
| className | `string` | - | 根元素的className。 |
91+
| classNames | `MentionsProps['classNames']` | - | 插槽的语义className称。 |
92+
| defaultValue | `string` | - | 初始值。 |
93+
| direction | `'ltr' \| 'rtl'` | `ltr` | 弹层方向。 |
94+
| filterOption | `false \| (input: string, option: OptionProps) => boolean` | - | 自定义选项过滤。 |
95+
| getPopupContainer | `() => HTMLElement` | - | 建议弹层窗口的容器。 |
9796
| id | `string` | - | Textarea id. |
98-
| notFoundContent | `ReactNode` | `Not Found` | Content shown when no option matches. |
99-
| options | `DataDrivenOptionProps[]` | - | Data-driven options. |
100-
| placement | `'top' \| 'bottom'` | `bottom` | Suggestion popup placement. |
101-
| popupClassName | `string` | - | Class name for the popup. |
102-
| prefix | `string \| string[]` | `@` | Trigger prefix or prefixes. |
103-
| prefixCls | `string` | `rc-mentions` | Class name prefix. |
97+
| notFoundContent | `ReactNode` | `Not Found` | 没有选项匹配时显示的内容。 |
98+
| 选项 | `DataDrivenOptionProps[]` | - | 数据驱动的选项。 |
99+
| placement | `'top' \| 'bottom'` | `bottom` | 建议弹层窗口放置。 |
100+
| popupClassName | `string` | - | 弹层窗口的className称。 |
101+
| 前缀 | `string \| string[]` | `@` | 触发前缀或前缀。 |
102+
| prefixCls | `string` | `rc-mentions` | className前缀。 |
104103
| rows | `number` | `1` | Textarea row count. |
105-
| silent | `boolean` | `false` | Ignore Enter behavior during transition phases. |
106-
| split | `string` | `' '` | String inserted after a selected mention. |
107-
| style | `React.CSSProperties` | - | Inline styles for the root element. |
104+
| silent | `boolean` | `false` | 忽略过渡阶段的 Enter 行为。 |
105+
| split | `string` | `' '` | 在选定的提及之后插入的字符串。 |
106+
| 风格 | `React.CSSProperties` | - | 根元素的内联样式。 |
108107
| styles | `MentionsProps['styles']` | - | Semantic styles for slots. |
109-
| transitionName | `string` | - | Popup transition name. |
110-
| validateSearch | `(text: string, split: MentionsProps['split']) => boolean` | - | Customize trigger search logic. |
111-
| value | `string` | - | Controlled value. |
112-
| onBlur | `React.FocusEventHandler<HTMLTextAreaElement>` | - | Triggered when textarea loses focus. |
113-
| onChange | `(text: string) => void` | - | Triggered when value changes. |
114-
| onFocus | `React.FocusEventHandler<HTMLTextAreaElement>` | - | Triggered when textarea receives focus. |
108+
| transitionName | `string` | - | 弹层过渡名称。 |
109+
| validateSearch | `(text: string, split: MentionsProps['split']) => boolean` | - | 自定义触发搜索逻辑。 |
110+
| 价值 | `string` | - | 受控值。 |
111+
| onBlur | `React.FocusEventHandler<HTMLTextAreaElement>` | - | 当文本区域失去焦点时触发。 |
112+
| onChange | `(text: string) => void` | - | 当值改变时触发。 |
113+
| onFocus | `React.FocusEventHandler<HTMLTextAreaElement>` | - | 当文本区域获得焦点时触发。 |
115114
| onKeyDown | `React.KeyboardEventHandler<HTMLTextAreaElement>` | - | Triggered on key down. |
116115
| onKeyUp | `React.KeyboardEventHandler<HTMLTextAreaElement>` | - | Triggered on key up. |
117-
| onPopupScroll | `(event: React.UIEvent<HTMLDivElement>) => void` | - | Triggered when the popup scrolls. |
118-
| onPressEnter | `React.KeyboardEventHandler<HTMLTextAreaElement>` | - | Triggered when Enter is pressed. |
119-
| onResize | `(size: { width: number; height: number }) => void` | - | Triggered when textarea size changes. |
120-
| onSearch | `(text: string, prefix: string) => void` | - | Triggered when a prefix starts a search. |
121-
| onSelect | `(option: OptionProps, prefix: string) => void` | - | Triggered when an option is selected. |
116+
| onPopupScroll | `(event: React.UIEvent<HTMLDivElement>) => void` | - | 当弹层窗口滚动时触发。 |
117+
| onPressEnter | `React.KeyboardEventHandler<HTMLTextAreaElement>` | - | 当按下 Enter 时触发。 |
118+
| onResize | `(size: { width: number; height: number }) => void` | - | 当文本区域大小改变时触发。 |
119+
| onSearch | `(text: string, prefix: string) => void` | - | 当前缀开始搜索时触发。 |
120+
| onSelect | `(option: OptionProps, prefix: string) => void` | - | 选择选项时触发。 |
122121

123122
### Option
124123

125124
| 参数 | 类型 | 默认值 | 说明 |
126125
| --------- | --------------------- | ------- | ----------------------------------------- |
127-
| children | `ReactNode` | - | Option label. |
128-
| className | `string` | - | Class name for the option. |
129-
| disabled | `boolean` | `false` | Disable the option. |
130-
| key | `string` | - | React key and option key. |
131-
| style | `React.CSSProperties` | - | Inline option style. |
132-
| value | `string` | - | Mention value inserted into the textarea. |
126+
| children们 | `ReactNode` | - | 选项标签。 |
127+
| className | `string` | - | 选项的className称。 |
128+
| disabled | `boolean` | `false` | 禁用该选项。 |
129+
| key | `string` | - | React键和选项键。 |
130+
| 风格 | `React.CSSProperties` | - | 内联选项样式。 |
131+
| 价值 | `string` | - | 提及插入文本区域的值。 |
133132

134133
### Ref
135134

@@ -144,10 +143,10 @@ ref.current?.blur();
144143

145144
| 参数 | 类型 | 说明 |
146145
| ------------- | ----------------------------- | ------------------------------ |
147-
| focus | `() => void` | Focus the textarea. |
148-
| blur | `() => void` | Blur the textarea. |
149-
| textarea | `HTMLTextAreaElement \| null` | Deprecated textarea reference. |
150-
| nativeElement | `HTMLElement` | Root native element. |
146+
| 重点 | `() => void` | 聚焦文本区域。 |
147+
| 模糊 | `() => void` | 模糊文本区域。 |
148+
| textarea | `HTMLTextAreaElement \| null` | 已弃用的文本区域参考。 |
149+
| nativeElement | `HTMLElement` | 根原生元素。 |
151150

152151
## 本地开发
153152

@@ -166,11 +165,11 @@ npm run build
166165
npm run prepublishOnly
167166
```
168167

169-
The release flow is handled by `@rc-component/np` through the `rc-np` command after the package build.
168+
包构建完成后,发布流程由 `@rc-component/np` 通过 `rc-np` 命令处理。
170169

171170
## 许可证
172171

173-
@rc-component/mentions is released under the [MIT](./LICENSE.md) license.
172+
@rc-component/mentions 基于 [MIT](./LICENSE.md) 许可证发布。
174173

175174
[npm-image]: https://img.shields.io/npm/v/@rc-component/mentions.svg?style=flat-square
176175
[npm-url]: https://npmjs.org/package/@rc-component/mentions

0 commit comments

Comments
 (0)