diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/settings_context_menu/try_ai_agent_context_menu_item.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/settings_context_menu/try_ai_agent_context_menu_item.tsx
index bab72c9e39967..6f85f648df928 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/settings_context_menu/try_ai_agent_context_menu_item.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/assistant/settings/settings_context_menu/try_ai_agent_context_menu_item.tsx
@@ -6,9 +6,10 @@
*/
import React, { useEffect, useRef } from 'react';
-import { EuiButton, EuiContextMenuItem, EuiToolTip } from '@elastic/eui';
+import { EuiContextMenuItem, EuiToolTip } from '@elastic/eui';
import { css } from '@emotion/react';
import { AGENT_BUILDER_EVENT_TYPES } from '@kbn/agent-builder-common';
+import { AiButton } from '@kbn/shared-ux-ai-components';
import type { AnalyticsServiceStart } from '@kbn/core-analytics-browser';
import * as i18n from './translations';
@@ -42,11 +43,11 @@ export const TryAIAgentContextMenuItem: React.FC<{
width: 100%;
`}
>
- handleOpenAIAgentModal('security_settings_menu')}
iconType="productAgent"
- color="accent"
+ variant="base"
size="s"
fullWidth
isDisabled={!hasAgentBuilderManagePrivilege}
@@ -56,15 +57,15 @@ export const TryAIAgentContextMenuItem: React.FC<{
`}
>
{i18n.TRY_AI_AGENT}
-
+
) : (
- handleOpenAIAgentModal('security_settings_menu')}
iconType="productAgent"
- color="accent"
+ variant="base"
size="s"
fullWidth
isDisabled={!hasAgentBuilderManagePrivilege}
@@ -74,7 +75,7 @@ export const TryAIAgentContextMenuItem: React.FC<{
`}
>
{i18n.TRY_AI_AGENT}
-
+
)}
);
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/new_chat/index.test.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/new_chat/index.test.tsx
index 986c596b89202..5a15470735934 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/new_chat/index.test.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/new_chat/index.test.tsx
@@ -48,7 +48,7 @@ describe('NewChat', () => {
jest.clearAllMocks();
});
- it('renders the default New Chat button with a discuss icon', () => {
+ it('renders the default New Chat button with an assistant (AiButton) icon', () => {
render();
const newChatButton = screen.getByTestId('plusCircle');
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/new_chat_by_title/index.test.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/new_chat_by_title/index.test.tsx
index 68371599fa78f..015e2b47f2d94 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/new_chat_by_title/index.test.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/new_chat_by_title/index.test.tsx
@@ -9,7 +9,7 @@ import React from 'react';
import { render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
-import { BUTTON_ICON_TEST_ID, BUTTON_TEST_ID, BUTTON_TEXT_TEST_ID, NewChatByTitle } from '.';
+import { BUTTON_TEST_ID, BUTTON_TEXT_TEST_ID, NewChatByTitle } from '.';
const testProps = {
showAssistantOverlay: jest.fn(),
@@ -21,18 +21,20 @@ describe('NewChatByTitle', () => {
});
it('should render icon only by default', () => {
- const { getByTestId, queryByTestId } = render();
+ const { getByTestId, queryByTestId, getByRole } = render();
expect(getByTestId(BUTTON_TEST_ID)).toBeInTheDocument();
- expect(getByTestId(BUTTON_ICON_TEST_ID)).toBeInTheDocument();
+ expect(getByRole('button', { name: 'Ask AI Assistant' })).toBeInTheDocument();
expect(queryByTestId(BUTTON_TEXT_TEST_ID)).not.toBeInTheDocument();
});
it('should render the button with icon and text', () => {
- const { getByTestId } = render();
+ const { getByTestId, getByRole } = render(
+
+ );
expect(getByTestId(BUTTON_TEST_ID)).toBeInTheDocument();
- expect(getByTestId(BUTTON_ICON_TEST_ID)).toBeInTheDocument();
+ expect(getByRole('button', { name: 'Ask AI Assistant' })).toBeInTheDocument();
expect(getByTestId(BUTTON_TEXT_TEST_ID)).toHaveTextContent('Ask AI Assistant');
});
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/new_chat_by_title/index.tsx b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/new_chat_by_title/index.tsx
index 1f7b1218c55e0..446e20b2e5b68 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/new_chat_by_title/index.tsx
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/impl/new_chat_by_title/index.tsx
@@ -6,14 +6,12 @@
*/
import type { EuiButtonColor } from '@elastic/eui';
-import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import React, { useCallback } from 'react';
-import { AssistantIcon } from '@kbn/ai-assistant-icon';
+import { AiButton } from '@kbn/shared-ux-ai-components';
import type { EuiButtonEmptySizes } from '@elastic/eui/src/components/button/button_empty/button_empty';
import * as i18n from './translations';
export const BUTTON_TEST_ID = 'newChatByTitle';
-export const BUTTON_ICON_TEST_ID = 'newChatByTitleIcon';
export const BUTTON_TEXT_TEST_ID = 'newChatByTitleText';
export interface NewChatByTitleComponentProps {
@@ -45,24 +43,17 @@ const NewChatByTitleComponent: React.FC = ({
const showOverlay = useCallback(() => showAssistantOverlay(true), [showAssistantOverlay]);
return (
-
-
-
-
-
- {text && (
-
- {text}
-
- )}
-
-
+ {text ? {text} : null}
+
);
};
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/moon.yml b/x-pack/platform/packages/shared/kbn-elastic-assistant/moon.yml
index b7c74f7224078..0ac537a573fd8 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/moon.yml
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/moon.yml
@@ -56,8 +56,8 @@ dependsOn:
- '@kbn/kibana-react-plugin'
- '@kbn/core-analytics-browser'
- '@kbn/shared-ux-utility'
- - '@kbn/shared-ux-ai-components'
- '@kbn/inference-connectors'
+ - '@kbn/shared-ux-ai-components'
tags:
- shared-browser
- package
diff --git a/x-pack/platform/packages/shared/kbn-elastic-assistant/tsconfig.json b/x-pack/platform/packages/shared/kbn-elastic-assistant/tsconfig.json
index 5bf11266da9fb..225db6106e668 100644
--- a/x-pack/platform/packages/shared/kbn-elastic-assistant/tsconfig.json
+++ b/x-pack/platform/packages/shared/kbn-elastic-assistant/tsconfig.json
@@ -56,7 +56,7 @@
"@kbn/kibana-react-plugin",
"@kbn/core-analytics-browser",
"@kbn/shared-ux-utility",
- "@kbn/shared-ux-ai-components",
- "@kbn/inference-connectors"
+ "@kbn/inference-connectors",
+ "@kbn/shared-ux-ai-components"
]
}
diff --git a/x-pack/solutions/security/plugins/elastic_assistant/moon.yml b/x-pack/solutions/security/plugins/elastic_assistant/moon.yml
index 7e0ddb2ca5247..5d0c15ba551d1 100644
--- a/x-pack/solutions/security/plugins/elastic_assistant/moon.yml
+++ b/x-pack/solutions/security/plugins/elastic_assistant/moon.yml
@@ -76,6 +76,7 @@ dependsOn:
- '@kbn/security-solution-navigation'
- '@kbn/rison'
- '@kbn/search-errors'
+ - '@kbn/shared-ux-ai-components'
- '@kbn/securitysolution-t-grid'
- '@kbn/triggers-actions-ui-plugin'
- '@kbn/discover-plugin'
diff --git a/x-pack/solutions/security/plugins/elastic_assistant/public/src/components/get_comments/stream/buttons/regenerate_response_button.tsx b/x-pack/solutions/security/plugins/elastic_assistant/public/src/components/get_comments/stream/buttons/regenerate_response_button.tsx
index 3b5fdc935a411..f134757fcf85e 100644
--- a/x-pack/solutions/security/plugins/elastic_assistant/public/src/components/get_comments/stream/buttons/regenerate_response_button.tsx
+++ b/x-pack/solutions/security/plugins/elastic_assistant/public/src/components/get_comments/stream/buttons/regenerate_response_button.tsx
@@ -5,22 +5,22 @@
* 2.0.
*/
-import type { EuiButtonEmptyProps } from '@elastic/eui';
-import { EuiButtonEmpty } from '@elastic/eui';
import React from 'react';
import { i18n } from '@kbn/i18n';
+import { AiButton, type AiButtonProps } from '@kbn/shared-ux-ai-components';
-export function RegenerateResponseButton(props: Partial) {
+export function RegenerateResponseButton(props: AiButtonProps) {
return (
-
{i18n.translate('xpack.elasticAssistantPlugin.aiAssistant.regenerateResponseButtonLabel', {
defaultMessage: 'Regenerate',
})}
-
+
);
}
diff --git a/x-pack/solutions/security/plugins/elastic_assistant/tsconfig.json b/x-pack/solutions/security/plugins/elastic_assistant/tsconfig.json
index f371dacfe8925..3dce6dba2fc71 100644
--- a/x-pack/solutions/security/plugins/elastic_assistant/tsconfig.json
+++ b/x-pack/solutions/security/plugins/elastic_assistant/tsconfig.json
@@ -74,6 +74,7 @@
"@kbn/security-solution-navigation",
"@kbn/rison",
"@kbn/search-errors",
+ "@kbn/shared-ux-ai-components",
"@kbn/securitysolution-t-grid",
"@kbn/triggers-actions-ui-plugin",
"@kbn/discover-plugin",
diff --git a/x-pack/solutions/security/plugins/security_solution/moon.yml b/x-pack/solutions/security/plugins/security_solution/moon.yml
index c1ae366ccbf6b..fe7df2eee88d1 100644
--- a/x-pack/solutions/security/plugins/security_solution/moon.yml
+++ b/x-pack/solutions/security/plugins/security_solution/moon.yml
@@ -287,6 +287,7 @@ dependsOn:
- '@kbn/controls-constants'
- '@kbn/anonymization-plugin'
- '@kbn/anonymization-common'
+ - '@kbn/shared-ux-ai-components'
- '@kbn/controls-schemas'
- '@kbn/search-inference-endpoints'
- '@kbn/shared-ux-column-presets'
diff --git a/x-pack/solutions/security/plugins/security_solution/public/agent_builder/components/new_agent_builder_attachment.tsx b/x-pack/solutions/security/plugins/security_solution/public/agent_builder/components/new_agent_builder_attachment.tsx
index 758d12c869a84..8e2895085fe01 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/agent_builder/components/new_agent_builder_attachment.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/agent_builder/components/new_agent_builder_attachment.tsx
@@ -6,7 +6,8 @@
*/
import type { EuiButtonColor } from '@elastic/eui';
-import { EuiButtonEmpty, EuiFlexGroup, EuiFlexItem, EuiIcon, EuiToolTip } from '@elastic/eui';
+import { EuiToolTip } from '@elastic/eui';
+import { AiButton } from '@kbn/shared-ux-ai-components';
import React, { memo, useCallback } from 'react';
import type { EuiButtonEmptySizes } from '@elastic/eui/src/components/button/button_empty/button_empty';
import type { AgentBuilderAddToChatTelemetry } from '../hooks/use_report_add_to_chat';
@@ -71,25 +72,17 @@ export const NewAgentBuilderAttachment = memo(function NewAgentBuilderAttachment
}
const button = (
-
-
-
-
-
- {i18n.ADD_TO_CHAT}
-
-
+ {i18n.ADD_TO_CHAT}
+
);
if (!shouldShowLicenseTooltip) {
@@ -97,8 +90,6 @@ export const NewAgentBuilderAttachment = memo(function NewAgentBuilderAttachment
}
return (
-
- {button}
-
+ {button}
);
});
diff --git a/x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_creation_ui/components/ai_assistant/index.tsx b/x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_creation_ui/components/ai_assistant/index.tsx
index 25d966d402c4e..f25c65228bc63 100644
--- a/x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_creation_ui/components/ai_assistant/index.tsx
+++ b/x-pack/solutions/security/plugins/security_solution/public/detection_engine/rule_creation_ui/components/ai_assistant/index.tsx
@@ -10,9 +10,7 @@ import { EuiSpacer } from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';
import { NewChat } from '@kbn/elastic-assistant';
-
-import { AssistantIcon } from '@kbn/ai-assistant-icon';
-import { css } from '@emotion/react';
+import { AiButton } from '@kbn/shared-ux-ai-components';
import { SecurityAgentBuilderAttachments } from '../../../../../common/constants';
import { METRIC_TYPE, TELEMETRY_EVENT, track } from '../../../../common/lib/telemetry';
import { useAssistantAvailability } from '../../../../assistant/use_assistant_availability';
@@ -154,13 +152,14 @@ Proposed solution should be valid and must not contain new line symbols (\\n)`;
isAssistantEnabled={isAssistantEnabled}
onExportCodeBlock={handleOnExportCodeBlock}
>
-
- {i18n.ASK_ASSISTANT_ERROR_BUTTON}
+
+ {i18n.ASK_ASSISTANT_ERROR_BUTTON}
+
),
}}
diff --git a/x-pack/solutions/security/plugins/security_solution/tsconfig.json b/x-pack/solutions/security/plugins/security_solution/tsconfig.json
index 0b0637ce0565d..700fb7189beb4 100644
--- a/x-pack/solutions/security/plugins/security_solution/tsconfig.json
+++ b/x-pack/solutions/security/plugins/security_solution/tsconfig.json
@@ -289,6 +289,7 @@
"@kbn/controls-constants",
"@kbn/anonymization-plugin",
"@kbn/anonymization-common",
+ "@kbn/shared-ux-ai-components",
"@kbn/controls-schemas",
"@kbn/search-inference-endpoints",
"@kbn/shared-ux-column-presets",