@cloud-ru/uikit-product-claudia 1.6.5 → 1.7.0
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/CHANGELOG.md +11 -0
- package/README.md +3 -2
- package/dist/cjs/components/RecommendPannel/RecommendPanel.d.ts +4 -3
- package/dist/cjs/components/RecommendPannel/RecommendPanel.js +4 -3
- package/dist/cjs/components/RecommendPannel/helperComponents/AiAssistantChip/AiAssistantChip.d.ts +12 -0
- package/dist/cjs/components/RecommendPannel/helperComponents/AiAssistantChip/AiAssistantChip.js +20 -0
- package/dist/cjs/components/RecommendPannel/helperComponents/AiAssistantChip/index.d.ts +1 -0
- package/dist/cjs/components/RecommendPannel/helperComponents/{ClaudiaChip → AiAssistantChip}/index.js +1 -1
- package/dist/cjs/components/SshField/SshField.d.ts +1 -1
- package/dist/cjs/components/SshField/components/MobileFieldAi/MobileFieldAi.d.ts +1 -1
- package/dist/esm/components/RecommendPannel/RecommendPanel.d.ts +4 -3
- package/dist/esm/components/RecommendPannel/RecommendPanel.js +4 -3
- package/dist/esm/components/RecommendPannel/helperComponents/AiAssistantChip/AiAssistantChip.d.ts +12 -0
- package/dist/esm/components/RecommendPannel/helperComponents/AiAssistantChip/AiAssistantChip.js +17 -0
- package/dist/esm/components/RecommendPannel/helperComponents/AiAssistantChip/index.d.ts +1 -0
- package/dist/esm/components/RecommendPannel/helperComponents/AiAssistantChip/index.js +1 -0
- package/dist/esm/components/SshField/SshField.d.ts +1 -1
- package/dist/esm/components/SshField/components/MobileFieldAi/MobileFieldAi.d.ts +1 -1
- package/package.json +3 -2
- package/src/components/RecommendPannel/RecommendPanel.tsx +26 -7
- package/src/components/RecommendPannel/helperComponents/AiAssistantChip/AiAssistantChip.tsx +58 -0
- package/src/components/RecommendPannel/helperComponents/AiAssistantChip/index.ts +1 -0
- package/dist/cjs/components/RecommendPannel/helperComponents/ClaudiaChip/ClaudiaChip.d.ts +0 -11
- package/dist/cjs/components/RecommendPannel/helperComponents/ClaudiaChip/ClaudiaChip.js +0 -18
- package/dist/cjs/components/RecommendPannel/helperComponents/ClaudiaChip/index.d.ts +0 -1
- package/dist/esm/components/RecommendPannel/helperComponents/ClaudiaChip/ClaudiaChip.d.ts +0 -11
- package/dist/esm/components/RecommendPannel/helperComponents/ClaudiaChip/ClaudiaChip.js +0 -15
- package/dist/esm/components/RecommendPannel/helperComponents/ClaudiaChip/index.d.ts +0 -1
- package/dist/esm/components/RecommendPannel/helperComponents/ClaudiaChip/index.js +0 -1
- package/src/components/RecommendPannel/helperComponents/ClaudiaChip/ClaudiaChip.tsx +0 -40
- package/src/components/RecommendPannel/helperComponents/ClaudiaChip/index.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 1.7.0 (2025-11-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **RM-3714:** replace claudia button by giga for recommend panel ([9114db7](https://gitverse.ru/cloud-ru-tech/uikit-product/commits/9114db7e67cc17a4e134b3d3b7a12055b6d5edae))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 1.6.5 (2025-11-13)
|
|
7
18
|
|
|
8
19
|
|
package/README.md
CHANGED
|
@@ -545,8 +545,9 @@
|
|
|
545
545
|
| layoutType | enum LayoutType: `"mobile"`, `"tablet"`, `"desktop"`, `"desktopSmall"` | - | |
|
|
546
546
|
| onCloseClick | `() => void` | - | |
|
|
547
547
|
| onCloseChipLabel | `ReactNode` | - | |
|
|
548
|
-
|
|
|
549
|
-
|
|
|
548
|
+
| onAiAssistantClick | `() => void` | - | |
|
|
549
|
+
| docsUrl | `string` | https://cloud.ru/docs/ai_assistant_cloudia/ug/index | |
|
|
550
|
+
| dataTestId | `string` | recommend-panel | |
|
|
550
551
|
## SshField
|
|
551
552
|
### Props
|
|
552
553
|
| name | type | default value | description |
|
|
@@ -8,7 +8,8 @@ export type RecommendPanelProps = {
|
|
|
8
8
|
layoutType?: LayoutType;
|
|
9
9
|
onCloseClick?: () => void;
|
|
10
10
|
onCloseChipLabel?: ReactNode;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
onAiAssistantClick?: () => void;
|
|
12
|
+
docsUrl?: string;
|
|
13
|
+
dataTestId?: string;
|
|
13
14
|
};
|
|
14
|
-
export declare function RecommendPanel({ chips, type, size, layoutType, onCloseClick, onCloseChipLabel,
|
|
15
|
+
export declare function RecommendPanel({ chips, type, size, layoutType, onCloseClick, onCloseChipLabel, onAiAssistantClick, docsUrl, dataTestId, }: RecommendPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,14 +7,15 @@ exports.RecommendPanel = RecommendPanel;
|
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = require("react");
|
|
9
9
|
const uikit_product_utils_1 = require("@cloud-ru/uikit-product-utils");
|
|
10
|
+
const AiAssistantChip_1 = require("./helperComponents/AiAssistantChip");
|
|
10
11
|
const Chip_1 = require("./helperComponents/Chip");
|
|
11
|
-
const ClaudiaChip_1 = require("./helperComponents/ClaudiaChip");
|
|
12
12
|
const CloseChip_1 = require("./helperComponents/CloseChip");
|
|
13
13
|
const DropdownChip_1 = require("./helperComponents/DropdownChip");
|
|
14
14
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
15
15
|
const types_1 = require("./types");
|
|
16
16
|
const gitVisibleChipsCount_1 = require("./utils/gitVisibleChipsCount");
|
|
17
|
-
|
|
17
|
+
const AI_ASSISTANT_DOCUMENTATION_URL = 'https://cloud.ru/docs/ai_assistant_cloudia/ug/index';
|
|
18
|
+
function RecommendPanel({ chips, type = types_1.CHIP_TYPE.Default, size = types_1.SIZE.S, layoutType, onCloseClick, onCloseChipLabel, onAiAssistantClick, docsUrl = AI_ASSISTANT_DOCUMENTATION_URL, dataTestId = 'recommend-panel', }) {
|
|
18
19
|
const [containerWidth, setContainerWidth] = (0, react_1.useState)(0);
|
|
19
20
|
const [isCloseIconVisible, setCloseIconVisible] = (0, react_1.useState)(false);
|
|
20
21
|
const [chipWidths, setChipWidths] = (0, react_1.useState)([]);
|
|
@@ -70,5 +71,5 @@ function RecommendPanel({ chips, type = types_1.CHIP_TYPE.Default, size = types_
|
|
|
70
71
|
return;
|
|
71
72
|
setCloseIconVisible(false);
|
|
72
73
|
};
|
|
73
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.container, ref: containerRef, onMouseEnter: showCloseIcon, onMouseLeave: hideCloseIcon, children: [(0, jsx_runtime_1.jsx)(
|
|
74
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.container, ref: containerRef, onMouseEnter: showCloseIcon, onMouseLeave: hideCloseIcon, "data-test-id": dataTestId, children: [(0, jsx_runtime_1.jsx)(AiAssistantChip_1.AiAssistantChip, { layoutType: layoutType, onClick: onAiAssistantClick, size: size, "data-test-id": `${dataTestId}__ai-assistant-chip`, docsUrl: docsUrl }), visibleChips.map((chip, index) => ((0, jsx_runtime_1.jsx)(Chip_1.Chip, { ref: chipElement => (allChipsRefs.current[index] = chipElement), label: chip.label, size: size, type: type, layoutType: layoutType, onClick: chip.onClick, "data-test-id": `${dataTestId}__chip-${chip.id}` }, chip.id))), hasHiddenChips && ((0, jsx_runtime_1.jsx)(DropdownChip_1.DropdownChip, { layoutType: layoutType, type: type, size: size, label: `+${hiddenChips.length}`, dropdownItems: hiddenChips, "data-test-id": `${dataTestId}__dropdown-chip` })), onCloseClick && onCloseChipLabel && ((0, jsx_runtime_1.jsx)(CloseChip_1.CloseChip, { size: size, layoutType: layoutType, content: onCloseChipLabel, onClick: onCloseClick, isVisible: isCloseIconVisible, "data-test-id": `${dataTestId}__close-chip` }))] }));
|
|
74
75
|
}
|
package/dist/cjs/components/RecommendPannel/helperComponents/AiAssistantChip/AiAssistantChip.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MouseEventHandler } from 'react';
|
|
2
|
+
import { LayoutType } from '@cloud-ru/uikit-product-utils';
|
|
3
|
+
import { Size } from '../../types';
|
|
4
|
+
type AiAssistantChipProps = {
|
|
5
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
6
|
+
size: Size;
|
|
7
|
+
layoutType?: LayoutType;
|
|
8
|
+
docsUrl?: string;
|
|
9
|
+
dataTestId?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const AiAssistantChip: import("react").ForwardRefExoticComponent<AiAssistantChipProps & import("react").RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
12
|
+
export {};
|
package/dist/cjs/components/RecommendPannel/helperComponents/AiAssistantChip/AiAssistantChip.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AiAssistantChip = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const uikit_product_locale_1 = require("@cloud-ru/uikit-product-locale");
|
|
7
|
+
const uikit_product_utils_1 = require("@cloud-ru/uikit-product-utils");
|
|
8
|
+
const link_1 = require("@snack-uikit/link");
|
|
9
|
+
const tooltip_1 = require("@snack-uikit/tooltip");
|
|
10
|
+
const typography_1 = require("@snack-uikit/typography");
|
|
11
|
+
const ButtonGiga_1 = require("../../../ButtonGiga");
|
|
12
|
+
const IconGiga_1 = require("../../../IconGiga");
|
|
13
|
+
const types_1 = require("../../types");
|
|
14
|
+
exports.AiAssistantChip = (0, react_1.forwardRef)(({ onClick, size, layoutType, docsUrl, dataTestId }, ref) => {
|
|
15
|
+
const isMobile = layoutType === uikit_product_utils_1.LAYOUT_TYPE.Mobile || size === types_1.SIZE.M;
|
|
16
|
+
const totalSize = isMobile ? types_1.SIZE.M : size;
|
|
17
|
+
const { t } = (0, uikit_product_locale_1.useLocale)('Claudia');
|
|
18
|
+
const tooltipContent = ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(typography_1.Typography.SansLabelM, { tag: 'p', "data-test-id": `${dataTestId}__tooltip-title`, children: t('AiAssistantChip.tooltipTitle') }), (0, jsx_runtime_1.jsx)(typography_1.Typography.SansBodyS, { tag: 'p', "data-test-id": `${dataTestId}__tooltip-description`, children: t('AiAssistantChip.tooltipDescription') }), (0, jsx_runtime_1.jsx)(link_1.Link, { text: t('AiAssistantChip.documentationLink'), appearance: 'invert-neutral', textMode: 'accent', target: '_blank', href: docsUrl, "data-test-id": `${dataTestId}__documentation-link` })] }));
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { triggerRef: ref, tip: tooltipContent, placement: 'top', "data-test-id": dataTestId, children: (0, jsx_runtime_1.jsx)(ButtonGiga_1.ButtonGigaOutline, { size: totalSize, "data-mobile": isMobile, onClick: onClick, icon: (0, jsx_runtime_1.jsx)(IconGiga_1.IconGiga, { size: 24 }) }) }));
|
|
20
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AiAssistantChip';
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./AiAssistantChip"), exports);
|
|
@@ -4,7 +4,7 @@ export type SshFieldProps = WithLayoutType<Omit<FieldTextAreaProps, 'placeholder
|
|
|
4
4
|
/** Колбек действия при отправке */
|
|
5
5
|
onSubmit(value: string): void;
|
|
6
6
|
}>;
|
|
7
|
-
export declare const SshField: import("react").ForwardRefExoticComponent<Omit<FieldTextAreaProps, "label" | "size" | "placeholder" | "
|
|
7
|
+
export declare const SshField: import("react").ForwardRefExoticComponent<Omit<FieldTextAreaProps, "label" | "size" | "placeholder" | "footer" | "spellCheck" | "required" | "labelTooltip"> & {
|
|
8
8
|
/** Колбек действия при отправке */
|
|
9
9
|
onSubmit(value: string): void;
|
|
10
10
|
} & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldTextAreaProps } from '@cloud-ru/uikit-product-mobile-fields';
|
|
2
|
-
export declare const MobileFieldAi: import("react").ForwardRefExoticComponent<Omit<FieldTextAreaProps, "label" | "size" | "placeholder" | "
|
|
2
|
+
export declare const MobileFieldAi: import("react").ForwardRefExoticComponent<Omit<FieldTextAreaProps, "label" | "size" | "placeholder" | "footer" | "spellCheck" | "required" | "labelTooltip"> & {
|
|
3
3
|
onSubmit(): void;
|
|
4
4
|
submitEnabled: boolean;
|
|
5
5
|
} & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -8,7 +8,8 @@ export type RecommendPanelProps = {
|
|
|
8
8
|
layoutType?: LayoutType;
|
|
9
9
|
onCloseClick?: () => void;
|
|
10
10
|
onCloseChipLabel?: ReactNode;
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
onAiAssistantClick?: () => void;
|
|
12
|
+
docsUrl?: string;
|
|
13
|
+
dataTestId?: string;
|
|
13
14
|
};
|
|
14
|
-
export declare function RecommendPanel({ chips, type, size, layoutType, onCloseClick, onCloseChipLabel,
|
|
15
|
+
export declare function RecommendPanel({ chips, type, size, layoutType, onCloseClick, onCloseChipLabel, onAiAssistantClick, docsUrl, dataTestId, }: RecommendPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { LAYOUT_TYPE } from '@cloud-ru/uikit-product-utils';
|
|
4
|
+
import { AiAssistantChip } from './helperComponents/AiAssistantChip';
|
|
4
5
|
import { Chip } from './helperComponents/Chip';
|
|
5
|
-
import { ClaudiaChip } from './helperComponents/ClaudiaChip';
|
|
6
6
|
import { CloseChip } from './helperComponents/CloseChip';
|
|
7
7
|
import { DropdownChip } from './helperComponents/DropdownChip';
|
|
8
8
|
import styles from './styles.module.css';
|
|
9
9
|
import { CHIP_TYPE, SIZE } from './types';
|
|
10
10
|
import { getVisibleChipsCount } from './utils/gitVisibleChipsCount';
|
|
11
|
-
|
|
11
|
+
const AI_ASSISTANT_DOCUMENTATION_URL = 'https://cloud.ru/docs/ai_assistant_cloudia/ug/index';
|
|
12
|
+
export function RecommendPanel({ chips, type = CHIP_TYPE.Default, size = SIZE.S, layoutType, onCloseClick, onCloseChipLabel, onAiAssistantClick, docsUrl = AI_ASSISTANT_DOCUMENTATION_URL, dataTestId = 'recommend-panel', }) {
|
|
12
13
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
13
14
|
const [isCloseIconVisible, setCloseIconVisible] = useState(false);
|
|
14
15
|
const [chipWidths, setChipWidths] = useState([]);
|
|
@@ -64,5 +65,5 @@ export function RecommendPanel({ chips, type = CHIP_TYPE.Default, size = SIZE.S,
|
|
|
64
65
|
return;
|
|
65
66
|
setCloseIconVisible(false);
|
|
66
67
|
};
|
|
67
|
-
return (_jsxs("div", { className: styles.container, ref: containerRef, onMouseEnter: showCloseIcon, onMouseLeave: hideCloseIcon, children: [_jsx(
|
|
68
|
+
return (_jsxs("div", { className: styles.container, ref: containerRef, onMouseEnter: showCloseIcon, onMouseLeave: hideCloseIcon, "data-test-id": dataTestId, children: [_jsx(AiAssistantChip, { layoutType: layoutType, onClick: onAiAssistantClick, size: size, "data-test-id": `${dataTestId}__ai-assistant-chip`, docsUrl: docsUrl }), visibleChips.map((chip, index) => (_jsx(Chip, { ref: chipElement => (allChipsRefs.current[index] = chipElement), label: chip.label, size: size, type: type, layoutType: layoutType, onClick: chip.onClick, "data-test-id": `${dataTestId}__chip-${chip.id}` }, chip.id))), hasHiddenChips && (_jsx(DropdownChip, { layoutType: layoutType, type: type, size: size, label: `+${hiddenChips.length}`, dropdownItems: hiddenChips, "data-test-id": `${dataTestId}__dropdown-chip` })), onCloseClick && onCloseChipLabel && (_jsx(CloseChip, { size: size, layoutType: layoutType, content: onCloseChipLabel, onClick: onCloseClick, isVisible: isCloseIconVisible, "data-test-id": `${dataTestId}__close-chip` }))] }));
|
|
68
69
|
}
|
package/dist/esm/components/RecommendPannel/helperComponents/AiAssistantChip/AiAssistantChip.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MouseEventHandler } from 'react';
|
|
2
|
+
import { LayoutType } from '@cloud-ru/uikit-product-utils';
|
|
3
|
+
import { Size } from '../../types';
|
|
4
|
+
type AiAssistantChipProps = {
|
|
5
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
6
|
+
size: Size;
|
|
7
|
+
layoutType?: LayoutType;
|
|
8
|
+
docsUrl?: string;
|
|
9
|
+
dataTestId?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const AiAssistantChip: import("react").ForwardRefExoticComponent<AiAssistantChipProps & import("react").RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
12
|
+
export {};
|
package/dist/esm/components/RecommendPannel/helperComponents/AiAssistantChip/AiAssistantChip.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { useLocale } from '@cloud-ru/uikit-product-locale';
|
|
4
|
+
import { LAYOUT_TYPE } from '@cloud-ru/uikit-product-utils';
|
|
5
|
+
import { Link } from '@snack-uikit/link';
|
|
6
|
+
import { Tooltip } from '@snack-uikit/tooltip';
|
|
7
|
+
import { Typography } from '@snack-uikit/typography';
|
|
8
|
+
import { ButtonGigaOutline } from '../../../ButtonGiga';
|
|
9
|
+
import { IconGiga } from '../../../IconGiga';
|
|
10
|
+
import { SIZE } from '../../types';
|
|
11
|
+
export const AiAssistantChip = forwardRef(({ onClick, size, layoutType, docsUrl, dataTestId }, ref) => {
|
|
12
|
+
const isMobile = layoutType === LAYOUT_TYPE.Mobile || size === SIZE.M;
|
|
13
|
+
const totalSize = isMobile ? SIZE.M : size;
|
|
14
|
+
const { t } = useLocale('Claudia');
|
|
15
|
+
const tooltipContent = (_jsxs("div", { children: [_jsx(Typography.SansLabelM, { tag: 'p', "data-test-id": `${dataTestId}__tooltip-title`, children: t('AiAssistantChip.tooltipTitle') }), _jsx(Typography.SansBodyS, { tag: 'p', "data-test-id": `${dataTestId}__tooltip-description`, children: t('AiAssistantChip.tooltipDescription') }), _jsx(Link, { text: t('AiAssistantChip.documentationLink'), appearance: 'invert-neutral', textMode: 'accent', target: '_blank', href: docsUrl, "data-test-id": `${dataTestId}__documentation-link` })] }));
|
|
16
|
+
return (_jsx(Tooltip, { triggerRef: ref, tip: tooltipContent, placement: 'top', "data-test-id": dataTestId, children: _jsx(ButtonGigaOutline, { size: totalSize, "data-mobile": isMobile, onClick: onClick, icon: _jsx(IconGiga, { size: 24 }) }) }));
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AiAssistantChip';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AiAssistantChip';
|
|
@@ -4,7 +4,7 @@ export type SshFieldProps = WithLayoutType<Omit<FieldTextAreaProps, 'placeholder
|
|
|
4
4
|
/** Колбек действия при отправке */
|
|
5
5
|
onSubmit(value: string): void;
|
|
6
6
|
}>;
|
|
7
|
-
export declare const SshField: import("react").ForwardRefExoticComponent<Omit<FieldTextAreaProps, "label" | "size" | "placeholder" | "
|
|
7
|
+
export declare const SshField: import("react").ForwardRefExoticComponent<Omit<FieldTextAreaProps, "label" | "size" | "placeholder" | "footer" | "spellCheck" | "required" | "labelTooltip"> & {
|
|
8
8
|
/** Колбек действия при отправке */
|
|
9
9
|
onSubmit(value: string): void;
|
|
10
10
|
} & {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FieldTextAreaProps } from '@cloud-ru/uikit-product-mobile-fields';
|
|
2
|
-
export declare const MobileFieldAi: import("react").ForwardRefExoticComponent<Omit<FieldTextAreaProps, "label" | "size" | "placeholder" | "
|
|
2
|
+
export declare const MobileFieldAi: import("react").ForwardRefExoticComponent<Omit<FieldTextAreaProps, "label" | "size" | "placeholder" | "footer" | "spellCheck" | "required" | "labelTooltip"> & {
|
|
3
3
|
onSubmit(): void;
|
|
4
4
|
submitEnabled: boolean;
|
|
5
5
|
} & import("react").RefAttributes<HTMLTextAreaElement>>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/uikit-product-claudia",
|
|
3
3
|
"title": "Claudia",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.7.0",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"*.css",
|
|
7
7
|
"*.woff",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@snack-uikit/drop-zone": "0.9.6",
|
|
45
45
|
"@snack-uikit/dropdown": "0.5.3",
|
|
46
46
|
"@snack-uikit/input-private": "4.8.3",
|
|
47
|
+
"@snack-uikit/link": "0.17.12",
|
|
47
48
|
"@snack-uikit/loaders": "0.9.9",
|
|
48
49
|
"@snack-uikit/scroll": "0.10.5",
|
|
49
50
|
"@snack-uikit/tooltip": "0.18.5",
|
|
@@ -57,5 +58,5 @@
|
|
|
57
58
|
"@cloud-ru/uikit-product-locale": "*",
|
|
58
59
|
"@snack-uikit/figma-tokens": "*"
|
|
59
60
|
},
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "871be56e967b2421b96a5a0135b509d6ff29b7b7"
|
|
61
62
|
}
|
|
@@ -2,8 +2,8 @@ import { ReactNode, useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { LAYOUT_TYPE, LayoutType } from '@cloud-ru/uikit-product-utils';
|
|
4
4
|
|
|
5
|
+
import { AiAssistantChip } from './helperComponents/AiAssistantChip';
|
|
5
6
|
import { Chip } from './helperComponents/Chip';
|
|
6
|
-
import { ClaudiaChip } from './helperComponents/ClaudiaChip';
|
|
7
7
|
import { CloseChip } from './helperComponents/CloseChip';
|
|
8
8
|
import { DropdownChip } from './helperComponents/DropdownChip';
|
|
9
9
|
import styles from './styles.module.scss';
|
|
@@ -17,10 +17,13 @@ export type RecommendPanelProps = {
|
|
|
17
17
|
layoutType?: LayoutType;
|
|
18
18
|
onCloseClick?: () => void;
|
|
19
19
|
onCloseChipLabel?: ReactNode;
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
onAiAssistantClick?: () => void;
|
|
21
|
+
docsUrl?: string;
|
|
22
|
+
dataTestId?: string;
|
|
22
23
|
};
|
|
23
24
|
|
|
25
|
+
const AI_ASSISTANT_DOCUMENTATION_URL = 'https://cloud.ru/docs/ai_assistant_cloudia/ug/index';
|
|
26
|
+
|
|
24
27
|
export function RecommendPanel({
|
|
25
28
|
chips,
|
|
26
29
|
type = CHIP_TYPE.Default,
|
|
@@ -28,8 +31,9 @@ export function RecommendPanel({
|
|
|
28
31
|
layoutType,
|
|
29
32
|
onCloseClick,
|
|
30
33
|
onCloseChipLabel,
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
onAiAssistantClick,
|
|
35
|
+
docsUrl = AI_ASSISTANT_DOCUMENTATION_URL,
|
|
36
|
+
dataTestId = 'recommend-panel',
|
|
33
37
|
}: RecommendPanelProps) {
|
|
34
38
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
35
39
|
const [isCloseIconVisible, setCloseIconVisible] = useState(false);
|
|
@@ -95,8 +99,20 @@ export function RecommendPanel({
|
|
|
95
99
|
};
|
|
96
100
|
|
|
97
101
|
return (
|
|
98
|
-
<div
|
|
99
|
-
|
|
102
|
+
<div
|
|
103
|
+
className={styles.container}
|
|
104
|
+
ref={containerRef}
|
|
105
|
+
onMouseEnter={showCloseIcon}
|
|
106
|
+
onMouseLeave={hideCloseIcon}
|
|
107
|
+
data-test-id={dataTestId}
|
|
108
|
+
>
|
|
109
|
+
<AiAssistantChip
|
|
110
|
+
layoutType={layoutType}
|
|
111
|
+
onClick={onAiAssistantClick}
|
|
112
|
+
size={size}
|
|
113
|
+
data-test-id={`${dataTestId}__ai-assistant-chip`}
|
|
114
|
+
docsUrl={docsUrl}
|
|
115
|
+
/>
|
|
100
116
|
{visibleChips.map((chip, index) => (
|
|
101
117
|
<Chip
|
|
102
118
|
ref={chipElement => (allChipsRefs.current[index] = chipElement)}
|
|
@@ -106,6 +122,7 @@ export function RecommendPanel({
|
|
|
106
122
|
type={type}
|
|
107
123
|
layoutType={layoutType}
|
|
108
124
|
onClick={chip.onClick}
|
|
125
|
+
data-test-id={`${dataTestId}__chip-${chip.id}`}
|
|
109
126
|
/>
|
|
110
127
|
))}
|
|
111
128
|
{hasHiddenChips && (
|
|
@@ -115,6 +132,7 @@ export function RecommendPanel({
|
|
|
115
132
|
size={size}
|
|
116
133
|
label={`+${hiddenChips.length}`}
|
|
117
134
|
dropdownItems={hiddenChips}
|
|
135
|
+
data-test-id={`${dataTestId}__dropdown-chip`}
|
|
118
136
|
/>
|
|
119
137
|
)}
|
|
120
138
|
{onCloseClick && onCloseChipLabel && (
|
|
@@ -124,6 +142,7 @@ export function RecommendPanel({
|
|
|
124
142
|
content={onCloseChipLabel}
|
|
125
143
|
onClick={onCloseClick}
|
|
126
144
|
isVisible={isCloseIconVisible}
|
|
145
|
+
data-test-id={`${dataTestId}__close-chip`}
|
|
127
146
|
/>
|
|
128
147
|
)}
|
|
129
148
|
</div>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { forwardRef, MouseEventHandler, RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useLocale } from '@cloud-ru/uikit-product-locale';
|
|
4
|
+
import { LAYOUT_TYPE, LayoutType } from '@cloud-ru/uikit-product-utils';
|
|
5
|
+
import { Link } from '@snack-uikit/link';
|
|
6
|
+
import { Tooltip } from '@snack-uikit/tooltip';
|
|
7
|
+
import { Typography } from '@snack-uikit/typography';
|
|
8
|
+
|
|
9
|
+
import { ButtonGigaOutline } from '../../../ButtonGiga';
|
|
10
|
+
import { IconGiga } from '../../../IconGiga';
|
|
11
|
+
import { SIZE, Size } from '../../types';
|
|
12
|
+
|
|
13
|
+
type AiAssistantChipProps = {
|
|
14
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
15
|
+
size: Size;
|
|
16
|
+
layoutType?: LayoutType;
|
|
17
|
+
docsUrl?: string;
|
|
18
|
+
dataTestId?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const AiAssistantChip = forwardRef<HTMLElement | HTMLButtonElement, AiAssistantChipProps>(
|
|
22
|
+
({ onClick, size, layoutType, docsUrl, dataTestId }, ref) => {
|
|
23
|
+
const isMobile = layoutType === LAYOUT_TYPE.Mobile || size === SIZE.M;
|
|
24
|
+
const totalSize = isMobile ? SIZE.M : size;
|
|
25
|
+
|
|
26
|
+
const { t } = useLocale('Claudia');
|
|
27
|
+
|
|
28
|
+
const tooltipContent = (
|
|
29
|
+
<div>
|
|
30
|
+
<Typography.SansLabelM tag='p' data-test-id={`${dataTestId}__tooltip-title`}>
|
|
31
|
+
{t('AiAssistantChip.tooltipTitle')}
|
|
32
|
+
</Typography.SansLabelM>
|
|
33
|
+
<Typography.SansBodyS tag='p' data-test-id={`${dataTestId}__tooltip-description`}>
|
|
34
|
+
{t('AiAssistantChip.tooltipDescription')}
|
|
35
|
+
</Typography.SansBodyS>
|
|
36
|
+
<Link
|
|
37
|
+
text={t('AiAssistantChip.documentationLink')}
|
|
38
|
+
appearance='invert-neutral'
|
|
39
|
+
textMode='accent'
|
|
40
|
+
target='_blank'
|
|
41
|
+
href={docsUrl}
|
|
42
|
+
data-test-id={`${dataTestId}__documentation-link`}
|
|
43
|
+
></Link>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Tooltip
|
|
49
|
+
triggerRef={ref as RefObject<HTMLElement>}
|
|
50
|
+
tip={tooltipContent}
|
|
51
|
+
placement='top'
|
|
52
|
+
data-test-id={dataTestId}
|
|
53
|
+
>
|
|
54
|
+
<ButtonGigaOutline size={totalSize} data-mobile={isMobile} onClick={onClick} icon={<IconGiga size={24} />} />
|
|
55
|
+
</Tooltip>
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AiAssistantChip';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { MouseEventHandler, ReactNode } from 'react';
|
|
2
|
-
import { LayoutType } from '@cloud-ru/uikit-product-utils';
|
|
3
|
-
import { Size } from '../../types';
|
|
4
|
-
type ClaudiaChipProps = {
|
|
5
|
-
onClick?: MouseEventHandler<HTMLElement>;
|
|
6
|
-
size: Size;
|
|
7
|
-
tooltip?: ReactNode;
|
|
8
|
-
layoutType?: LayoutType;
|
|
9
|
-
};
|
|
10
|
-
export declare const ClaudiaChip: import("react").ForwardRefExoticComponent<ClaudiaChipProps & import("react").RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
11
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClaudiaChip = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const uikit_product_icons_1 = require("@cloud-ru/uikit-product-icons");
|
|
7
|
-
const uikit_product_utils_1 = require("@cloud-ru/uikit-product-utils");
|
|
8
|
-
const tooltip_1 = require("@snack-uikit/tooltip");
|
|
9
|
-
const ButtonClaudia_1 = require("../../../ButtonClaudia");
|
|
10
|
-
const types_1 = require("../../types");
|
|
11
|
-
exports.ClaudiaChip = (0, react_1.forwardRef)(({ onClick, size, tooltip, layoutType }, ref) => {
|
|
12
|
-
const isMobile = layoutType === uikit_product_utils_1.LAYOUT_TYPE.Mobile || size === types_1.SIZE.M;
|
|
13
|
-
const totalSize = isMobile ? types_1.SIZE.M : size;
|
|
14
|
-
if (!tooltip) {
|
|
15
|
-
return ((0, jsx_runtime_1.jsx)(ButtonClaudia_1.ButtonClaudia, { size: totalSize, "data-mobile": isMobile, ref: ref, onClick: onClick, icon: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.AgentClaudiaSVG, { size: 24 }) }));
|
|
16
|
-
}
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { triggerRef: ref, tip: tooltip, children: (0, jsx_runtime_1.jsx)(ButtonClaudia_1.ButtonClaudia, { size: totalSize, "data-mobile": isMobile, onClick: onClick, icon: (0, jsx_runtime_1.jsx)(uikit_product_icons_1.AgentClaudiaSVG, { size: 24 }) }) }));
|
|
18
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ClaudiaChip';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { MouseEventHandler, ReactNode } from 'react';
|
|
2
|
-
import { LayoutType } from '@cloud-ru/uikit-product-utils';
|
|
3
|
-
import { Size } from '../../types';
|
|
4
|
-
type ClaudiaChipProps = {
|
|
5
|
-
onClick?: MouseEventHandler<HTMLElement>;
|
|
6
|
-
size: Size;
|
|
7
|
-
tooltip?: ReactNode;
|
|
8
|
-
layoutType?: LayoutType;
|
|
9
|
-
};
|
|
10
|
-
export declare const ClaudiaChip: import("react").ForwardRefExoticComponent<ClaudiaChipProps & import("react").RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
11
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import { AgentClaudiaSVG } from '@cloud-ru/uikit-product-icons';
|
|
4
|
-
import { LAYOUT_TYPE } from '@cloud-ru/uikit-product-utils';
|
|
5
|
-
import { Tooltip } from '@snack-uikit/tooltip';
|
|
6
|
-
import { ButtonClaudia } from '../../../ButtonClaudia';
|
|
7
|
-
import { SIZE } from '../../types';
|
|
8
|
-
export const ClaudiaChip = forwardRef(({ onClick, size, tooltip, layoutType }, ref) => {
|
|
9
|
-
const isMobile = layoutType === LAYOUT_TYPE.Mobile || size === SIZE.M;
|
|
10
|
-
const totalSize = isMobile ? SIZE.M : size;
|
|
11
|
-
if (!tooltip) {
|
|
12
|
-
return (_jsx(ButtonClaudia, { size: totalSize, "data-mobile": isMobile, ref: ref, onClick: onClick, icon: _jsx(AgentClaudiaSVG, { size: 24 }) }));
|
|
13
|
-
}
|
|
14
|
-
return (_jsx(Tooltip, { triggerRef: ref, tip: tooltip, children: _jsx(ButtonClaudia, { size: totalSize, "data-mobile": isMobile, onClick: onClick, icon: _jsx(AgentClaudiaSVG, { size: 24 }) }) }));
|
|
15
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ClaudiaChip';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ClaudiaChip';
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { forwardRef, MouseEventHandler, ReactNode, RefObject } from 'react';
|
|
2
|
-
|
|
3
|
-
import { AgentClaudiaSVG } from '@cloud-ru/uikit-product-icons';
|
|
4
|
-
import { LAYOUT_TYPE, LayoutType } from '@cloud-ru/uikit-product-utils';
|
|
5
|
-
import { Tooltip } from '@snack-uikit/tooltip';
|
|
6
|
-
|
|
7
|
-
import { ButtonClaudia } from '../../../ButtonClaudia';
|
|
8
|
-
import { SIZE, Size } from '../../types';
|
|
9
|
-
|
|
10
|
-
type ClaudiaChipProps = {
|
|
11
|
-
onClick?: MouseEventHandler<HTMLElement>;
|
|
12
|
-
size: Size;
|
|
13
|
-
tooltip?: ReactNode;
|
|
14
|
-
layoutType?: LayoutType;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const ClaudiaChip = forwardRef<HTMLElement | HTMLButtonElement, ClaudiaChipProps>(
|
|
18
|
-
({ onClick, size, tooltip, layoutType }, ref) => {
|
|
19
|
-
const isMobile = layoutType === LAYOUT_TYPE.Mobile || size === SIZE.M;
|
|
20
|
-
const totalSize = isMobile ? SIZE.M : size;
|
|
21
|
-
|
|
22
|
-
if (!tooltip) {
|
|
23
|
-
return (
|
|
24
|
-
<ButtonClaudia
|
|
25
|
-
size={totalSize}
|
|
26
|
-
data-mobile={isMobile}
|
|
27
|
-
ref={ref as RefObject<HTMLButtonElement>}
|
|
28
|
-
onClick={onClick}
|
|
29
|
-
icon={<AgentClaudiaSVG size={24} />}
|
|
30
|
-
/>
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<Tooltip triggerRef={ref as RefObject<HTMLElement>} tip={tooltip}>
|
|
36
|
-
<ButtonClaudia size={totalSize} data-mobile={isMobile} onClick={onClick} icon={<AgentClaudiaSVG size={24} />} />
|
|
37
|
-
</Tooltip>
|
|
38
|
-
);
|
|
39
|
-
},
|
|
40
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ClaudiaChip';
|