@gravity-ui/aikit 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/organisms/PromptInput/PromptInputWithSuggestions.js +2 -3
- package/dist/components/pages/ChatContainer/ChatContainer.js +5 -2
- package/dist/components/pages/ChatContainer/__stories__/ChatContainer.stories.js +2 -0
- package/dist/components/pages/ChatContainer/types.d.ts +4 -0
- package/package.json +1 -1
|
@@ -10,7 +10,6 @@ const b = block('prompt-input');
|
|
|
10
10
|
*/
|
|
11
11
|
export function PromptInputWithSuggestions(props) {
|
|
12
12
|
const { children, suggestionsProps = {}, className, qa } = props;
|
|
13
|
-
const { showSuggestions = false, suggestions, suggestTitle, onSuggestionClick, suggestionsLayout, suggestionsTextAlign = 'center', } = suggestionsProps;
|
|
14
|
-
|
|
15
|
-
return (_jsxs("div", { className: b('suggestions-wrapper', className), "data-qa": qa, children: [hasSuggestions && (_jsx("div", { className: b('suggestions'), children: _jsx(Suggestions, { items: suggestions, onClick: onSuggestionClick || (() => { }), title: suggestTitle, layout: suggestionsLayout, textAlign: suggestionsTextAlign }) })), children] }));
|
|
13
|
+
const { showSuggestions = false, suggestions = [], suggestTitle, onSuggestionClick, suggestionsLayout, suggestionsTextAlign = 'center', } = suggestionsProps;
|
|
14
|
+
return (_jsxs("div", { className: b('suggestions-wrapper', className), "data-qa": qa, children: [showSuggestions && (_jsx("div", { className: b('suggestions'), children: _jsx(Suggestions, { items: suggestions, onClick: onSuggestionClick || (() => { }), title: suggestTitle, layout: suggestionsLayout, textAlign: suggestionsTextAlign }) })), children] }));
|
|
16
15
|
}
|
|
@@ -58,9 +58,12 @@ export function ChatContainer(props) {
|
|
|
58
58
|
// Build props for EmptyContainer
|
|
59
59
|
const finalEmptyContainerProps = useMemo(() => {
|
|
60
60
|
var _a, _b, _c, _d;
|
|
61
|
-
|
|
61
|
+
const { showDefaultTitle = true, showDefaultDescription = true } = welcomeConfig || {};
|
|
62
|
+
return Object.assign(Object.assign({}, emptyContainerProps), { image: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.image, title: (welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.title) ||
|
|
63
|
+
((_a = i18nConfig.emptyState) === null || _a === void 0 ? void 0 : _a.title) ||
|
|
64
|
+
(showDefaultTitle ? i18n('empty-state-title') : undefined), description: (welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.description) ||
|
|
62
65
|
((_b = i18nConfig.emptyState) === null || _b === void 0 ? void 0 : _b.description) ||
|
|
63
|
-
i18n('empty-state-description'), suggestionTitle: (welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.suggestionTitle) || ((_c = i18nConfig.emptyState) === null || _c === void 0 ? void 0 : _c.suggestionsTitle), suggestions: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.suggestions, alignment: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.alignment, layout: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.layout, wrapText: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.wrapText, showMore: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.showMore, showMoreText: (welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.showMoreText) ||
|
|
66
|
+
(showDefaultDescription ? i18n('empty-state-description') : undefined), suggestionTitle: (welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.suggestionTitle) || ((_c = i18nConfig.emptyState) === null || _c === void 0 ? void 0 : _c.suggestionsTitle), suggestions: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.suggestions, alignment: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.alignment, layout: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.layout, wrapText: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.wrapText, showMore: welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.showMore, showMoreText: (welcomeConfig === null || welcomeConfig === void 0 ? void 0 : welcomeConfig.showMoreText) ||
|
|
64
67
|
((_d = i18nConfig.emptyState) === null || _d === void 0 ? void 0 : _d.showMoreText) ||
|
|
65
68
|
i18n('empty-state-show-more'), onSuggestionClick: async (clickedTitle) => {
|
|
66
69
|
await onSendMessage({ content: clickedTitle });
|
|
@@ -281,6 +281,8 @@ export const EmptyState = {
|
|
|
281
281
|
description: 'Start a conversation by typing a message or selecting a suggestion.',
|
|
282
282
|
suggestionTitle: 'Try asking:',
|
|
283
283
|
suggestions: mockSuggestions,
|
|
284
|
+
showDefaultTitle: false,
|
|
285
|
+
showDefaultDescription: false,
|
|
284
286
|
},
|
|
285
287
|
},
|
|
286
288
|
render: (args) => {
|
|
@@ -82,6 +82,10 @@ export interface WelcomeConfig {
|
|
|
82
82
|
layout?: 'grid' | 'list';
|
|
83
83
|
/** Enable text wrapping inside suggestion buttons instead of ellipsis */
|
|
84
84
|
wrapText?: boolean;
|
|
85
|
+
/** Show default title when neither title nor i18nConfig.emptyState.title are provided */
|
|
86
|
+
showDefaultTitle?: boolean;
|
|
87
|
+
/** Show default description when neither description nor i18nConfig.emptyState.description are provided */
|
|
88
|
+
showDefaultDescription?: boolean;
|
|
85
89
|
/** Show more suggestions callback */
|
|
86
90
|
showMore?: () => void;
|
|
87
91
|
/** Show more button text */
|