Skip to content
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

feat: suggestion 建议组件 #87

Merged
merged 16 commits into from
Sep 14, 2024
1 change: 1 addition & 0 deletions .dumi/preset/components-changelog-cn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ThoughtChain":[{"version":"1.0.0-alpha.0","changelog":"🔥 新组件 ThoughtChain.","refs":["https://github.com/ant-design/x/pull/86"]}],"Suggestion":[],"Sender":[{"version":"1.0.0-alpha.0","changelog":"🔥 新组件 Sender.","refs":["https://github.com/ant-design/x/pull/46"]}],"Prompts":[{"version":"1.0.0-alpha.0","changelog":"🔥 新组件 Prompts.","refs":["https://github.com/ant-design/x/pull/55"]}],"Conversations":[{"version":"1.0.0-alpha.0","changelog":"🔥 新组件 Conversations.","refs":["https://github.com/ant-design/x/pull/48"]}],"Bubble":[{"version":"1.0.0-alpha.0","changelog":"🔥 Bubble 支持方向","refs":["https://github.com/ant-design/x/pull/52"]},{"version":"1.0.0-alpha.0","changelog":"🔥 新组件 Bubble.List.","refs":["https://github.com/ant-design/x/pull/57"]}]}
1 change: 1 addition & 0 deletions .dumi/preset/components-changelog-en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"ThoughtChain":[{"version":"1.0.0-alpha.0","changelog":"🔥 New Component ThoughtChain.","refs":["https://github.com/ant-design/x/pull/86"]}],"Suggestion":[],"Sender":[{"version":"1.0.0-alpha.0","changelog":"🔥 New Component Sender.","refs":["https://github.com/ant-design/x/pull/46"]}],"Prompts":[{"version":"1.0.0-alpha.0","changelog":"🔥 New Component Prompts.","refs":["https://github.com/ant-design/x/pull/55"]}],"Conversations":[{"version":"1.0.0-alpha.0","changelog":"🔥 New Component Conversations.","refs":["https://github.com/ant-design/x/pull/48"]}],"Bubble":[{"version":"1.0.0-alpha.0","changelog":"🔥 Bubble support direction","refs":["https://github.com/ant-design/x/pull/52"]},{"version":"1.0.0-alpha.0","changelog":"🔥 New Component Bubble.List.","refs":["https://github.com/ant-design/x/pull/57"]}]}
2 changes: 2 additions & 0 deletions components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ export { default as Prompts } from './prompts';
export type { PromptsProps, PromptProps } from './prompts';
export { default as ThoughtChain } from './thought-chain';
export type { ThoughtChainProps, ThoughtChainItem } from './thought-chain';
export { default as Suggestion } from './suggestion';
export type { SuggestionProps } from './suggestion';
export { default as version } from './version';
4 changes: 2 additions & 2 deletions components/prompts/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
category: Components
group: Data Display
title: Prompts
description: Display a predefined set of questions or suggestions.
description: Display a predefined set of questions or suggestion.
cover: https://mdn.alipayobjects.com/huamei_iwk9zp/afts/img/A*1ysXSqEnAckAAAAAAAAAAAAADgCCAQ/original
coverDark: https://mdn.alipayobjects.com/huamei_iwk9zp/afts/img/A*EkYUTotf-eYAAAAAAAAAAAAADgCCAQ/original
demo:
Expand All @@ -11,7 +11,7 @@ demo:

## When To Use

The Prompts component is used to display a predefined set of questions or suggestions that are relevant to the current context.
The Prompts component is used to display a predefined set of questions or suggestion that are relevant to the current context.

## Examples

Expand Down
3 changes: 3 additions & 0 deletions components/sender/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface SenderProps extends Pick<TextareaProps, 'placeholder' | 'onKeyP
onSubmit?: (message: string) => void;
onChange?: (value: string) => void;
onCancel?: VoidFunction;
onKeyDown?: React.KeyboardEventHandler<any>;
components?: SenderComponents;
styles?: {
input?: React.CSSProperties;
Expand Down Expand Up @@ -81,6 +82,7 @@ const Sender: React.FC<SenderProps> = (props) => {
onChange,
actions,
onKeyPress,
onKeyDown,
...rest
} = props;

Expand Down Expand Up @@ -189,6 +191,7 @@ const Sender: React.FC<SenderProps> = (props) => {
triggerValueChange((e.target as HTMLTextAreaElement).value);
}}
onPressEnter={onInternalKeyPress}
onKeyDown={onKeyDown}
readOnly={loading}
/>

Expand Down
Loading
Loading