Skip to content

Commit

Permalink
AI Extension: Add keyboard shortcut for stop action on forms and upda…
Browse files Browse the repository at this point in the history
…te text (#33271)

* add stop shortcut to AIControl component

* add tooltip to Stop action

* update component story

* remove tooltip in favor of permanent text

* focus on prompt after stop for forms

* changelog

* remove esc shortcut from AIControl component

* move shortcuts to KeyboardShortcuts wrapper component

* move focus logic on Form extension to AIAssistantBar component

* bump version
  • Loading branch information
dhasilva authored Sep 26, 2023
1 parent fbba36d commit 05aa446
Show file tree
Hide file tree
Showing 7 changed files with 251 additions and 217 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: added

AI Client: Add keyboard shortcut text next to Stop action
2 changes: 1 addition & 1 deletion projects/js-packages/ai-client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": false,
"name": "@automattic/jetpack-ai-client",
"version": "0.1.9",
"version": "0.1.10-alpha",
"description": "A JS client for consuming Jetpack AI services",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/ai-client/#readme",
"bugs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export function AIControl(
{ ! loading ? (
<Button
className={ actionButtonClasses }
onClick={ () => onSend( value ) }
onClick={ () => onSend?.( value ) }
isSmall={ true }
disabled={ ! value?.length || disabled }
label={ __( 'Send request', 'jetpack-ai-client' ) }
Expand All @@ -159,7 +159,7 @@ export function AIControl(
label={ __( 'Stop request', 'jetpack-ai-client' ) }
>
<Icon icon={ closeSmall } />
{ showButtonLabels && __( 'Stop', 'jetpack-ai-client' ) }
{ showButtonLabels && __( 'Stop (ESC)', 'jetpack-ai-client' ) }
</Button>
) }
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
),
],
argTypes: {
requestingState: {
state: {
control: {
type: 'select',
},
Expand All @@ -51,10 +51,9 @@ const Template = args => {
};

const DefaultArgs = {
loading: false,
isTransparent: false,
placeholder: '',
requestingState: 'init',
state: 'init',
showButtonLabels: true,
showAccept: false,
acceptLabel: 'Accept',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: enhancement

AI Extension: Add keyboard shortcut for stop action on forms
Loading

0 comments on commit 05aa446

Please sign in to comment.