@gravity-ui/aikit 3.0.1-beta.f7461335625c068858baeb9c24f602de088b4093.0 → 3.0.1

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.
Files changed (29) hide show
  1. package/build/cjs/components/organisms/ThinkingMessageGroup/CompactHeading.d.ts +2 -2
  2. package/build/cjs/components/organisms/ThinkingMessageGroup/CompactHeading.js +7 -10
  3. package/build/cjs/components/organisms/ThinkingMessageGroup/CompactHeading.js.map +1 -1
  4. package/build/cjs/components/organisms/ThinkingMessageGroup/StepIcon.d.ts +3 -4
  5. package/build/cjs/components/organisms/ThinkingMessageGroup/StepIcon.js +2 -6
  6. package/build/cjs/components/organisms/ThinkingMessageGroup/StepIcon.js.map +1 -1
  7. package/build/cjs/components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.css +16 -47
  8. package/build/cjs/components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.js +11 -18
  9. package/build/cjs/components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.js.map +1 -1
  10. package/build/cjs/components/organisms/ThinkingMessageGroup/types.d.ts +1 -5
  11. package/build/cjs/components/organisms/ThinkingMessageGroup/types.js.map +1 -1
  12. package/build/cjs/package.json +1 -1
  13. package/build/docs/INDEX.md +1 -0
  14. package/build/docs/components/organisms/ThinkingMessageGroup.md +17 -55
  15. package/build/docs/guides/releasing.md +45 -0
  16. package/build/esm/components/organisms/ThinkingMessageGroup/CompactHeading.d.ts +2 -2
  17. package/build/esm/components/organisms/ThinkingMessageGroup/CompactHeading.js +7 -10
  18. package/build/esm/components/organisms/ThinkingMessageGroup/CompactHeading.js.map +1 -1
  19. package/build/esm/components/organisms/ThinkingMessageGroup/StepIcon.d.ts +3 -4
  20. package/build/esm/components/organisms/ThinkingMessageGroup/StepIcon.js +3 -7
  21. package/build/esm/components/organisms/ThinkingMessageGroup/StepIcon.js.map +1 -1
  22. package/build/esm/components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.css +16 -47
  23. package/build/esm/components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.js +11 -18
  24. package/build/esm/components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.js.map +1 -1
  25. package/build/esm/components/organisms/ThinkingMessageGroup/types.d.ts +1 -5
  26. package/build/esm/components/organisms/ThinkingMessageGroup/types.js.map +1 -1
  27. package/build/esm/package.json +1 -1
  28. package/docs/releasing.md +45 -0
  29. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ThinkingMessageGroupProps, ThinkingStep } from "./types.js";
3
- interface CompactHeadingProps extends Pick<ThinkingMessageGroupProps, 'stepTypes' | 'iconMode' | 'activeStepLabel'> {
3
+ interface CompactHeadingProps extends Pick<ThinkingMessageGroupProps, 'stepTypes'> {
4
4
  status: NonNullable<ThinkingMessageGroupProps['status']>;
5
5
  activeStep?: ThinkingStep;
6
6
  summary: ReactNode;
7
7
  hasDetails: boolean;
8
8
  isExpanded: boolean;
9
9
  }
10
- export declare function CompactHeading({ activeStep, stepTypes, iconMode, activeStepLabel, status, summary, hasDetails, isExpanded, }: CompactHeadingProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function CompactHeading({ activeStep, stepTypes, status, summary, hasDetails, isExpanded, }: CompactHeadingProps): import("react/jsx-runtime").JSX.Element;
11
11
  export {};
@@ -8,22 +8,19 @@ const cn_1 = require("../../../utils/cn.js");
8
8
  const StepIcon_1 = require("./StepIcon.js");
9
9
  const i18n_1 = require("./i18n/index.js");
10
10
  const b = (0, cn_1.block)('thinking-message-group');
11
- function CompactHeading({ activeStep, stepTypes, iconMode, activeStepLabel, status, summary, hasDetails, isExpanded, }) {
11
+ function CompactHeading({ activeStep, stepTypes, status, summary, hasDetails, isExpanded, }) {
12
12
  var _a;
13
13
  const { t } = i18n_1.i18n.useTranslation();
14
14
  const isThinking = status === 'thinking';
15
+ const showActiveStep = Boolean(activeStep && isThinking);
15
16
  const hasSummary = summary !== null && summary !== undefined && summary !== false && summary !== '';
16
17
  const showCompletedSummary = status === 'thought' && hasSummary;
17
- const label = (isThinking && activeStepLabel) ||
18
- (isThinking && (activeStep === null || activeStep === void 0 ? void 0 : activeStep.title)) ||
19
- t(`status-${status}`);
20
- const showIcon = status !== 'thought' && iconMode !== 'none';
21
- const operationIcon = isThinking && activeStep ? (_a = stepTypes === null || stepTypes === void 0 ? void 0 : stepTypes[activeStep.type]) === null || _a === void 0 ? void 0 : _a.icon : null;
18
+ const label = (showActiveStep && (activeStep === null || activeStep === void 0 ? void 0 : activeStep.title)) || t(`status-${status}`);
19
+ const operationIcon = showActiveStep && activeStep ? (_a = stepTypes === null || stepTypes === void 0 ? void 0 : stepTypes[activeStep.type]) === null || _a === void 0 ? void 0 : _a.icon : null;
22
20
  const showSecondarySummary = !showCompletedSummary && hasSummary;
23
- return ((0, jsx_runtime_1.jsxs)("span", { className: b('compact-heading'), children: [(0, jsx_runtime_1.jsxs)("span", { className: b('compact-current'), children: [showIcon && ((0, jsx_runtime_1.jsx)("span", { className: b('step-icon', { error: status === 'error' }), "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)(StepIcon_1.StepIcon, { status: status, operationIcon: operationIcon, iconMode: iconMode }) })), (0, jsx_runtime_1.jsx)("span", { className: b('compact-label', {
24
- active: isThinking &&
25
- ((activeStep === null || activeStep === void 0 ? void 0 : activeStep.status) === 'thinking' || Boolean(activeStepLabel)),
21
+ return ((0, jsx_runtime_1.jsxs)("span", { className: b('compact-heading'), children: [(0, jsx_runtime_1.jsxs)("span", { className: b('compact-current'), children: [status !== 'thought' && ((0, jsx_runtime_1.jsx)("span", { className: b('step-icon', { error: status === 'error' }), "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)(StepIcon_1.StepIcon, { status: status, operationIcon: operationIcon }) })), (0, jsx_runtime_1.jsx)("span", { className: b('compact-label', {
22
+ active: isThinking && (activeStep === null || activeStep === void 0 ? void 0 : activeStep.status) === 'thinking',
26
23
  error: status === 'error',
27
- }), title: showCompletedSummary ? undefined : label, children: showCompletedSummary ? summary : label }), hasDetails && ((0, jsx_runtime_1.jsx)("span", { className: b('disclosure', { expanded: isExpanded }), "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.ChevronRight, size: 12 }) }))] }), showSecondarySummary && ((0, jsx_runtime_1.jsx)("span", { className: b('compact-summary', { indented: showIcon }), children: summary }))] }));
24
+ }), title: showCompletedSummary ? undefined : label, children: showCompletedSummary ? summary : label }), hasDetails && ((0, jsx_runtime_1.jsx)("span", { className: b('disclosure', { expanded: isExpanded }), "aria-hidden": "true", children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.ChevronRight, size: 12 }) }))] }), showSecondarySummary && ((0, jsx_runtime_1.jsx)("span", { className: b('compact-summary', { indented: true }), children: summary }))] }));
28
25
  }
29
26
  //# sourceMappingURL=CompactHeading.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CompactHeading.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/CompactHeading.tsx"],"names":[],"mappings":";;AAsBA,wCA2DC;;AA/ED,6CAA+C;AAC/C,6CAAuC;AAEvC,6CAAwC;AAExC,4CAAoC;AACpC,0CAA4B;AAG5B,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,wBAAwB,CAAC,CAAC;AAW1C,SAAgB,cAAc,CAAC,EAC3B,UAAU,EACV,SAAS,EACT,QAAQ,EACR,eAAe,EACf,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,GACQ;;IAClB,MAAM,EAAC,CAAC,EAAC,GAAG,WAAI,CAAC,cAAc,EAAE,CAAC;IAClC,MAAM,UAAU,GAAG,MAAM,KAAK,UAAU,CAAC;IACzC,MAAM,UAAU,GACZ,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,EAAE,CAAC;IACrF,MAAM,oBAAoB,GAAG,MAAM,KAAK,SAA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K,GACpC,EACN,UAAU,IAAI,CACX,iCAAM,SAAS,EAAE,CAAC,CAAC,YAAY,EAAE,EAAC,QAAQ,EAAE,UAAU,EAAC,CAAC,iBAAc,MAAM,YACxE,uBAAC,YAAI,IAAC,IAAI,EAAE,oBAAY,EAAE,IAAI,EAAE,EAAE,GAAI,GACnC,CACV,IACE,EACN,oBAAoB,IAAI,CACrB,iCAAM,SAAS,EAAE,CAAC,CAAC,iBAAiB,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAC,CAAC,YAAG,OAAO,GAAQ,CAChF,IACE,CACV,CAAC;AACN,CAAC","sourcesContent":["import type {ReactNode} from 'react';\n\nimport {ChevronRight} from '@gravity-ui/icons';\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\n\nimport {StepIcon} from './StepIcon';\nimport {i18n} from './i18n';\nimport type {ThinkingMessageGroupProps, ThinkingStep} from './types';\n\nconst b = block('thinking-message-group');\n\ninterface CompactHeadingProps\n extends Pick<ThinkingMessageGroupProps, 'stepTypes' | 'iconMode' | 'activeStepLabel'> {\n status: NonNullable<ThinkingMessageGroupProps['status']>;\n activeStep?: ThinkingStep;\n summary: ReactNode;\n hasDetails: boolean;\n isExpanded: boolean;\n}\n\nexport function CompactHeading({\n activeStep,\n stepTypes,\n iconMode,\n activeStepLabel,\n status,\n summary,\n hasDetails,\n isExpanded,\n}: CompactHeadingProps) {\n const {t} = i18n.useTranslation();\n const isThinking = status === 'thinking';\n const hasSummary =\n summary !== null && summary !== undefined && summary !== false && summary !== '';\n const showCompletedSummary = status === 'thought' && hasSummary;\n const label =\n (isThinking && activeStepLabel) ||\n (isThinking && activeStep?.title) ||\n t(`status-${status}`);\n const showIcon = status !== 'thought' && iconMode !== 'none';\n const operationIcon = isThinking && activeStep ? stepTypes?.[activeStep.type]?.icon : null;\n const showSecondarySummary = !showCompletedSummary && hasSummary;\n return (\n <span className={b('compact-heading')}>\n <span className={b('compact-current')}>\n {showIcon && (\n <span\n className={b('step-icon', {error: status === 'error'})}\n aria-hidden=\"true\"\n >\n <StepIcon\n status={status}\n operationIcon={operationIcon}\n iconMode={iconMode}\n />\n </span>\n )}\n <span\n className={b('compact-label', {\n active:\n isThinking &&\n (activeStep?.status === 'thinking' || Boolean(activeStepLabel)),\n error: status === 'error',\n })}\n title={showCompletedSummary ? undefined : label}\n >\n {showCompletedSummary ? summary : label}\n </span>\n {hasDetails && (\n <span className={b('disclosure', {expanded: isExpanded})} aria-hidden=\"true\">\n <Icon data={ChevronRight} size={12} />\n </span>\n )}\n </span>\n {showSecondarySummary && (\n <span className={b('compact-summary', {indented: showIcon})}>{summary}</span>\n )}\n </span>\n );\n}\n"]}
1
+ {"version":3,"file":"CompactHeading.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/CompactHeading.tsx"],"names":[],"mappings":";;AAqBA,wCAgDC;;AAnED,6CAA+C;AAC/C,6CAAuC;AAEvC,6CAAwC;AAExC,4CAAoC;AACpC,0CAA4B;AAG5B,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,wBAAwB,CAAC,CAAC;AAU1C,SAAgB,cAAc,CAAC,EAC3B,UAAU,EACV,SAAS,EACT,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,GACQ;;IAClB,MAAM,EAAC,CAAC,EAAC,GAAG,WAAI,CAAC,cAAc,EAAE,CAAC;IAClC,MAAM,UAAU,GAAG,MAAM,KAAK,UAAU,CAAC;IACzC,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,IAAI,UAAU,CAAC,CAAC;IACzD,MAAM,UAAU,GACZ,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,EAAE,CAAC;IACrF,MAAM,oBAAoB,GAAG,MAAM,KAAK,SAAS,IAAI,UAAU,CAAC;IAChE,MAAM,KAAK,GAAG,CAAC,cAAc,KAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,C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BAAiB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,YAAG,OAAO,GAAQ,CAC5E,IACE,CACV,CAAC;AACN,CAAC","sourcesContent":["import type {ReactNode} from 'react';\n\nimport {ChevronRight} from '@gravity-ui/icons';\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\n\nimport {StepIcon} from './StepIcon';\nimport {i18n} from './i18n';\nimport type {ThinkingMessageGroupProps, ThinkingStep} from './types';\n\nconst b = block('thinking-message-group');\n\ninterface CompactHeadingProps extends Pick<ThinkingMessageGroupProps, 'stepTypes'> {\n status: NonNullable<ThinkingMessageGroupProps['status']>;\n activeStep?: ThinkingStep;\n summary: ReactNode;\n hasDetails: boolean;\n isExpanded: boolean;\n}\n\nexport function CompactHeading({\n activeStep,\n stepTypes,\n status,\n summary,\n hasDetails,\n isExpanded,\n}: CompactHeadingProps) {\n const {t} = i18n.useTranslation();\n const isThinking = status === 'thinking';\n const showActiveStep = Boolean(activeStep && isThinking);\n const hasSummary =\n summary !== null && summary !== undefined && summary !== false && summary !== '';\n const showCompletedSummary = status === 'thought' && hasSummary;\n const label = (showActiveStep && activeStep?.title) || t(`status-${status}`);\n const operationIcon = showActiveStep && activeStep ? stepTypes?.[activeStep.type]?.icon : null;\n const showSecondarySummary = !showCompletedSummary && hasSummary;\n return (\n <span className={b('compact-heading')}>\n <span className={b('compact-current')}>\n {status !== 'thought' && (\n <span\n className={b('step-icon', {error: status === 'error'})}\n aria-hidden=\"true\"\n >\n <StepIcon status={status} operationIcon={operationIcon} />\n </span>\n )}\n <span\n className={b('compact-label', {\n active: isThinking && activeStep?.status === 'thinking',\n error: status === 'error',\n })}\n title={showCompletedSummary ? undefined : label}\n >\n {showCompletedSummary ? summary : label}\n </span>\n {hasDetails && (\n <span className={b('disclosure', {expanded: isExpanded})} aria-hidden=\"true\">\n <Icon data={ChevronRight} size={12} />\n </span>\n )}\n </span>\n {showSecondarySummary && (\n <span className={b('compact-summary', {indented: true})}>{summary}</span>\n )}\n </span>\n );\n}\n"]}
@@ -1,7 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { ThinkingMessageGroupProps, ThinkingStepStatus } from "./types.js";
3
- export declare function StepIcon({ status, operationIcon, iconMode, }: {
2
+ import type { ThinkingStepStatus } from "./types.js";
3
+ export declare function StepIcon({ status, operationIcon, }: {
4
4
  status: ThinkingStepStatus;
5
5
  operationIcon?: ReactNode;
6
- iconMode?: ThinkingMessageGroupProps['iconMode'];
7
- }): string | number | true | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element | null;
6
+ }): string | number | true | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element;
@@ -7,16 +7,12 @@ const uikit_1 = require("@gravity-ui/uikit");
7
7
  const cn_1 = require("../../../utils/cn.js");
8
8
  const b = (0, cn_1.block)('thinking-message-group');
9
9
  const statusIcons = {
10
- thinking: icons_1.Clock,
11
- thought: icons_1.Check,
12
10
  error: icons_1.CircleXmark,
13
11
  cancelled: icons_1.Ban,
14
12
  paused: icons_1.Pause,
15
13
  };
16
- function StepIcon({ status, operationIcon, iconMode = 'status', }) {
17
- if (iconMode === 'none')
18
- return null;
19
- if (iconMode === 'type' && (status === 'thinking' || status === 'thought')) {
14
+ function StepIcon({ status, operationIcon, }) {
15
+ if (status === 'thinking' || status === 'thought') {
20
16
  return operationIcon || (0, jsx_runtime_1.jsx)("span", { className: b('step-dot') });
21
17
  }
22
18
  return (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: statusIcons[status], size: 16 });
@@ -1 +1 @@
1
- {"version":3,"file":"StepIcon.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/StepIcon.tsx"],"names":[],"mappings":";;AAmBA,4BAgBC;;AAjCD,6CAAwE;AACxE,6CAAuC;AAEvC,6CAAwC;AAIxC,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,wBAAwB,CAAC,CAAC;AAE1C,MAAM,WAAW,GAAG;IAChB,QAAQ,EAAE,aAAK;IACf,OAAO,EAAE,aAAK;IACd,KAAK,EAAE,mBAAW;IAClB,SAAS,EAAE,WAAG;IACd,MAAM,EAAE,aAAK;CAChB,CAAC;AAEF,SAAgB,QAAQ,CAAC,EACrB,MAAM,EACN,aAAa,EACb,QAAQ,GAAG,QAAQ,GAKtB;IACG,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAErC,IAAI,QAAQ,KAAK,MAAM,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,MAAM,KAAK,SAAS,CAAC,EAAE,CAAC;QACzE,OAAO,aAAa,IAAI,iCAAM,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,GAAI,CAAC;IAC/D,CAAC;IAED,OAAO,uBAAC,YAAI,IAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,GAAI,CAAC;AACzD,CAAC","sourcesContent":["import type {ReactNode} from 'react';\n\nimport {Ban, Check, CircleXmark, Clock, Pause} from '@gravity-ui/icons';\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\n\nimport type {ThinkingMessageGroupProps, ThinkingStepStatus} from './types';\n\nconst b = block('thinking-message-group');\n\nconst statusIcons = {\n thinking: Clock,\n thought: Check,\n error: CircleXmark,\n cancelled: Ban,\n paused: Pause,\n};\n\nexport function StepIcon({\n status,\n operationIcon,\n iconMode = 'status',\n}: {\n status: ThinkingStepStatus;\n operationIcon?: ReactNode;\n iconMode?: ThinkingMessageGroupProps['iconMode'];\n}) {\n if (iconMode === 'none') return null;\n\n if (iconMode === 'type' && (status === 'thinking' || status === 'thought')) {\n return operationIcon || <span className={b('step-dot')} />;\n }\n\n return <Icon data={statusIcons[status]} size={16} />;\n}\n"]}
1
+ {"version":3,"file":"StepIcon.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/StepIcon.tsx"],"names":[],"mappings":";;AAiBA,4BAYC;;AA3BD,6CAA0D;AAC1D,6CAAuC;AAEvC,6CAAwC;AAIxC,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,wBAAwB,CAAC,CAAC;AAE1C,MAAM,WAAW,GAAG;IAChB,KAAK,EAAE,mBAAW;IAClB,SAAS,EAAE,WAAG;IACd,MAAM,EAAE,aAAK;CAChB,CAAC;AAEF,SAAgB,QAAQ,CAAC,EACrB,MAAM,EACN,aAAa,GAIhB;IACG,IAAI,MAAM,KAAK,UAAU,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAChD,OAAO,aAAa,IAAI,iCAAM,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,GAAI,CAAC;IAC/D,CAAC;IAED,OAAO,uBAAC,YAAI,IAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,GAAI,CAAC;AACzD,CAAC","sourcesContent":["import type {ReactNode} from 'react';\n\nimport {Ban, CircleXmark, Pause} from '@gravity-ui/icons';\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\n\nimport type {ThinkingStepStatus} from './types';\n\nconst b = block('thinking-message-group');\n\nconst statusIcons = {\n error: CircleXmark,\n cancelled: Ban,\n paused: Pause,\n};\n\nexport function StepIcon({\n status,\n operationIcon,\n}: {\n status: ThinkingStepStatus;\n operationIcon?: ReactNode;\n}) {\n if (status === 'thinking' || status === 'thought') {\n return operationIcon || <span className={b('step-dot')} />;\n }\n\n return <Icon data={statusIcons[status]} size={16} />;\n}\n"]}
@@ -6,9 +6,8 @@
6
6
  gap: var(--g-spacing-3);
7
7
  padding: 0;
8
8
  border: 0;
9
- color: var(--g-color-text-secondary);
10
- font-size: var(--g-text-body-1-font-size);
11
- line-height: var(--g-text-body-1-line-height);
9
+ font-size: var(--g-text-body-2-font-size);
10
+ line-height: var(--g-text-body-2-line-height);
12
11
  }
13
12
  .g-aikit-thinking-message-group__compact-toggle {
14
13
  align-self: flex-start;
@@ -19,8 +18,8 @@
19
18
  text-align: start;
20
19
  line-height: inherit;
21
20
  --g-button-padding: 0;
22
- --g-button-font-size: var(--g-text-body-1-font-size);
23
- --g-button-text-color: var(--g-color-text-primary);
21
+ --g-button-font-size: var(--g-text-body-2-font-size);
22
+ --g-button-text-color: var(--g-color-text-complementary);
24
23
  --g-button-text-color-hover: var(--g-color-text-primary);
25
24
  --g-button-background-color-hover: transparent;
26
25
  }
@@ -31,8 +30,8 @@
31
30
  gap: calc(var(--g-spacing-1) / 2);
32
31
  min-width: 0;
33
32
  max-width: 100%;
34
- color: var(--g-color-text-primary);
35
- line-height: var(--g-text-body-1-line-height);
33
+ color: var(--g-color-text-complementary);
34
+ line-height: var(--g-text-body-2-line-height);
36
35
  }
37
36
  .g-aikit-thinking-message-group__compact-header, .g-aikit-thinking-message-group__compact-current {
38
37
  display: flex;
@@ -110,7 +109,7 @@
110
109
  justify-content: center;
111
110
  align-items: center;
112
111
  width: 16px;
113
- height: var(--g-text-body-1-line-height);
112
+ height: var(--g-text-body-2-line-height);
114
113
  color: var(--g-color-text-secondary);
115
114
  }
116
115
  .g-aikit-thinking-message-group__step-marker_status_error {
@@ -132,9 +131,12 @@
132
131
  gap: var(--g-spacing-1);
133
132
  }
134
133
  .g-aikit-thinking-message-group__step-title {
135
- color: var(--g-color-text-secondary);
136
- font-size: var(--g-text-body-1-font-size);
137
- line-height: var(--g-text-body-1-line-height);
134
+ color: var(--g-color-text-complementary);
135
+ font-size: var(--g-text-body-2-font-size);
136
+ line-height: var(--g-text-body-2-line-height);
137
+ }
138
+ .g-aikit-thinking-message-group__step-title_active {
139
+ color: var(--g-color-text-primary);
138
140
  }
139
141
  .g-aikit-thinking-message-group__step-meta {
140
142
  display: flex;
@@ -147,7 +149,7 @@
147
149
  .g-aikit-thinking-message-group__step-icon {
148
150
  width: 16px;
149
151
  }
150
- .g-aikit-thinking-message-group__compact-label_error, .g-aikit-thinking-message-group__step-icon_error, .g-aikit-thinking-message-group__step-status_error, .g-aikit-thinking-message-group__step-title_error {
152
+ .g-aikit-thinking-message-group__compact-label_error, .g-aikit-thinking-message-group__step-icon_error, .g-aikit-thinking-message-group__step-status_error {
151
153
  color: var(--g-color-text-danger);
152
154
  }
153
155
  .g-aikit-thinking-message-group__step-details {
@@ -165,47 +167,14 @@
165
167
  overflow-x: auto;
166
168
  color: var(--g-color-text-secondary);
167
169
  font-size: var(--g-text-body-1-font-size);
168
- line-height: var(--g-text-body-1-line-height);
170
+ line-height: var(--g-text-body-2-line-height);
169
171
  --yfm-font-size: var(--g-text-body-1-font-size);
170
- --yfm-font-line-height: var(--g-text-body-1-line-height);
172
+ --yfm-font-line-height: var(--g-text-body-2-line-height);
171
173
  }
172
174
  .g-aikit-thinking-message-group__step-content_plain {
173
175
  white-space: pre-wrap;
174
176
  }
175
177
 
176
- .g-aikit-thinking-message-group_without-icons .g-aikit-thinking-message-group__step {
177
- grid-template-columns: minmax(0, 1fr);
178
- }
179
- .g-aikit-thinking-message-group_without-icons .g-aikit-thinking-message-group__step::before {
180
- display: none;
181
- }
182
- .g-aikit-thinking-message-group_without-icons .g-aikit-thinking-message-group__step-marker_hidden {
183
- position: absolute;
184
- width: 1px;
185
- height: 1px;
186
- padding: 0;
187
- margin: -1px;
188
- overflow: hidden;
189
- clip-path: inset(50%);
190
- white-space: nowrap;
191
- border: 0;
192
- }
193
-
194
- .g-aikit-thinking-message-group .g-aikit-thinking-message-group__step-details .g-aikit-thinking-message-group__step-content {
195
- --yfm-font-size: var(--g-text-body-1-font-size);
196
- --yfm-font-line-height: var(--g-text-body-1-line-height);
197
- --yfm-color-text: var(--g-color-text-secondary);
198
- --yfm-font-size-h4: var(--g-text-body-1-font-size);
199
- --yfm-font-line-height-h4: var(--g-text-body-1-line-height);
200
- --yfm-font-size-h5: var(--g-text-body-1-font-size);
201
- --yfm-font-line-height-h5: var(--g-text-body-1-line-height);
202
- --yfm-font-size-h6: var(--g-text-body-1-font-size);
203
- --yfm-font-line-height-h6: var(--g-text-body-1-line-height);
204
- color: var(--g-color-text-secondary);
205
- font-size: var(--g-text-body-1-font-size);
206
- line-height: var(--g-text-body-1-line-height);
207
- }
208
-
209
178
  @keyframes thinking-message-group-pulse {
210
179
  0%, 100% {
211
180
  opacity: 1;
@@ -15,15 +15,10 @@ const StepIcon_1 = require("./StepIcon.js");
15
15
  const i18n_1 = require("./i18n/index.js");
16
16
  require("./ThinkingMessageGroup.css");
17
17
  const b = (0, cn_1.block)('thinking-message-group');
18
- function shouldShowStatus(step, iconMode, hasContent) {
19
- if (step.status === 'thinking' || step.status === 'thought')
20
- return false;
21
- return iconMode === 'none' && Boolean(step.title || hasContent);
22
- }
23
18
  function ThinkingMessageGroup(props) {
24
19
  var _a, _b;
25
20
  const { t } = i18n_1.i18n.useTranslation();
26
- const { steps, iconMode = 'status', activeStepLabel, stepTypes, status = (_b = (_a = steps[steps.length - 1]) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'thought', activeStepId, expanded, defaultExpanded = false, maxHistoryHeight = 480, onExpandedChange, renderSummary, renderStepContent, className, qa, style, format = 'plain', transformOptions, mermaidOptions, openMarkdownLinksInNewTab, mdxOptions, mdxContext, markdownExtraProps, } = props;
21
+ const { steps, stepTypes, status = (_b = (_a = steps[steps.length - 1]) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'thought', activeStepId, expanded, defaultExpanded = false, maxHistoryHeight = 480, onExpandedChange, renderSummary, renderStepContent, className, qa, style, format = 'plain', transformOptions, mermaidOptions, openMarkdownLinksInNewTab, mdxOptions, mdxContext, markdownExtraProps, } = props;
27
22
  const [internalExpanded, setInternalExpanded] = (0, react_1.useState)(defaultExpanded);
28
23
  const detailsId = (0, react_1.useId)();
29
24
  const headingId = `${detailsId}-heading`;
@@ -54,20 +49,18 @@ function ThinkingMessageGroup(props) {
54
49
  };
55
50
  const defaultSummary = completedSteps.length > 0 ? t('completed-steps', { count: completedSteps.length }) : null;
56
51
  const summary = renderSummary ? renderSummary(completedSteps) : defaultSummary;
57
- const heading = ((0, jsx_runtime_1.jsx)(CompactHeading_1.CompactHeading, { activeStep: activeStep, stepTypes: stepTypes, iconMode: iconMode, activeStepLabel: activeStepLabel, status: status, summary: summary, hasDetails: hasDetails, isExpanded: isExpanded }));
58
- return ((0, jsx_runtime_1.jsxs)("div", { className: b({ 'without-icons': iconMode === 'none' }, className), "data-qa": qa, style: style, children: [hasDetails ? ((0, jsx_runtime_1.jsx)(uikit_1.Button, { id: headingId, className: b('compact-toggle'), view: "flat-secondary", width: "auto", onClick: toggleExpanded, "aria-expanded": isExpanded, "aria-controls": isExpanded ? detailsId : undefined, children: heading })) : ((0, jsx_runtime_1.jsx)("div", { className: b('compact-header'), children: heading })), hasDetails && isExpanded && ((0, jsx_runtime_1.jsx)("ol", { className: b('steps'), id: detailsId, "aria-labelledby": headingId, tabIndex: 0, style: { maxHeight: maxHistoryHeight }, children: steps.map((step) => {
52
+ const heading = ((0, jsx_runtime_1.jsx)(CompactHeading_1.CompactHeading, { activeStep: activeStep, stepTypes: stepTypes, status: status, summary: summary, hasDetails: hasDetails, isExpanded: isExpanded }));
53
+ return ((0, jsx_runtime_1.jsxs)("div", { className: b(null, className), "data-qa": qa, style: style, children: [hasDetails ? ((0, jsx_runtime_1.jsx)(uikit_1.Button, { id: headingId, className: b('compact-toggle'), view: "flat-secondary", width: "auto", onClick: toggleExpanded, "aria-expanded": isExpanded, "aria-controls": isExpanded ? detailsId : undefined, children: heading })) : ((0, jsx_runtime_1.jsx)("div", { className: b('compact-header'), children: heading })), hasDetails && isExpanded && ((0, jsx_runtime_1.jsx)("ol", { className: b('steps'), id: detailsId, "aria-labelledby": headingId, tabIndex: 0, style: { maxHeight: maxHistoryHeight }, children: steps.map((step) => {
59
54
  const type = stepTypes === null || stepTypes === void 0 ? void 0 : stepTypes[step.type];
60
- const typeLabel = type === null || type === void 0 ? void 0 : type.label;
61
55
  const content = Array.isArray(step.content) ? step.content : [step.content];
62
- const hasContent = Boolean(renderStepContent) || content.some(Boolean);
63
- const showTitle = Boolean(step.title) || !hasContent;
64
- const showStatus = shouldShowStatus(step, iconMode, hasContent);
65
- return ((0, jsx_runtime_1.jsxs)("li", { className: b('step'), children: [(0, jsx_runtime_1.jsx)("span", { className: b('step-marker', {
66
- status: step.status,
67
- hidden: iconMode === 'none',
68
- }), role: "img", "aria-label": t(`status-${step.status}`), children: (0, jsx_runtime_1.jsx)(StepIcon_1.StepIcon, { status: step.status, operationIcon: type === null || type === void 0 ? void 0 : type.icon, iconMode: iconMode }) }), (0, jsx_runtime_1.jsxs)("div", { className: b('step-body'), children: [showTitle && ((0, jsx_runtime_1.jsx)(uikit_1.Text, { className: b('step-title', {
69
- error: step.status === 'error' && !step.title,
70
- }), children: step.title || t(`status-${step.status}`) })), (typeLabel || showStatus) && ((0, jsx_runtime_1.jsxs)("span", { className: b('step-meta'), children: [typeLabel && (0, jsx_runtime_1.jsx)("span", { children: typeLabel }), showStatus && ((0, jsx_runtime_1.jsx)("span", { className: b('step-status', {
56
+ return ((0, jsx_runtime_1.jsxs)("li", { className: b('step'), children: [(0, jsx_runtime_1.jsx)("span", { className: b('step-marker', { status: step.status }), role: "img", "aria-label": t(`status-${step.status}`), children: (0, jsx_runtime_1.jsx)(StepIcon_1.StepIcon, { status: step.status, operationIcon: type === null || type === void 0 ? void 0 : type.icon }) }), (0, jsx_runtime_1.jsxs)("div", { className: b('step-body'), children: [(0, jsx_runtime_1.jsx)(uikit_1.Text, { className: b('step-title', {
57
+ active: step.id === (activeStep === null || activeStep === void 0 ? void 0 : activeStep.id) &&
58
+ step.status === 'thinking' &&
59
+ isThinking,
60
+ }), children: step.title || t(`status-${step.status}`) }), ((type === null || type === void 0 ? void 0 : type.label) ||
61
+ (step.status !== 'thinking' &&
62
+ step.status !== 'thought')) && ((0, jsx_runtime_1.jsxs)("span", { className: b('step-meta'), children: [(type === null || type === void 0 ? void 0 : type.label) && (0, jsx_runtime_1.jsx)("span", { children: type.label }), step.status !== 'thinking' &&
63
+ step.status !== 'thought' && ((0, jsx_runtime_1.jsx)("span", { className: b('step-status', {
71
64
  error: step.status === 'error',
72
65
  }), children: t(`status-${step.status}`) }))] })), (0, jsx_runtime_1.jsx)("div", { className: b('step-details'), children: renderStepContent
73
66
  ? renderStepContent(step)
@@ -1 +1 @@
1
- {"version":3,"file":"ThinkingMessageGroup.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AA8Bb,oDAsNC;;AAlPD,iCAAsC;AAEtC,6CAAuC;AACvC,6CAAqD;AAErD,qEAA8D;AAC9D,6CAAwC;AACxC,oEAAsD;AACtD,4EAA8D;AAE9D,wDAAgD;AAChD,4CAAoC;AACpC,0CAA4B;AAG5B,sCAAqC;AAErC,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,wBAAwB,CAAC,CAAC;AAE1C,SAAS,gBAAgB,CACrB,IAAkB,EAClB,QAA+C,EAC/C,UAAmB;IAEnB,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC1E,OAAO,QAAQ,KAAK,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC,CAAC;AACpE,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAgC;;IACjE,MAAM,EAAC,CAAC,EAAC,GAAG,WAAI,CAAC,cAAc,EAAE,CAAC;IAClC,MAAM,EACF,KAAK,EACL,QAAQ,GAAG,QAAQ,EACnB,eAAe,EACf,SAAS,EACT,MAAM,GAAG,MAAA,MAAA,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,MAAM,mCAAI,SAAS,EACrD,YAAY,EACZ,QAAQ,EACR,eAAe,GAAG,KAAK,EACvB,gBAAgB,GAAG,GAAG,EACtB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,EAAE,EACF,KAAK,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,CAAC,GACD,CACR,IACC,CACT,CAAC;AACN,CAAC","sourcesContent":["'use client';\n\nimport {useId, useState} from 'react';\n\nimport {Copy} from '@gravity-ui/icons';\nimport {Button, Icon, Text} from '@gravity-ui/uikit';\n\nimport {copyToClipboard} from '../../../utils/clipboardUtils';\nimport {block} from '../../../utils/cn';\nimport {ActionButton} from '../../atoms/ActionButton';\nimport {MarkdownRenderer} from '../../atoms/MarkdownRenderer';\n\nimport {CompactHeading} from './CompactHeading';\nimport {StepIcon} from './StepIcon';\nimport {i18n} from './i18n';\nimport type {ThinkingMessageGroupProps, ThinkingStep} from './types';\n\nimport './ThinkingMessageGroup.scss';\n\nconst b = block('thinking-message-group');\n\nfunction shouldShowStatus(\n step: ThinkingStep,\n iconMode: ThinkingMessageGroupProps['iconMode'],\n hasContent: boolean,\n) {\n if (step.status === 'thinking' || step.status === 'thought') return false;\n return iconMode === 'none' && Boolean(step.title || hasContent);\n}\n\nexport function ThinkingMessageGroup(props: ThinkingMessageGroupProps) {\n const {t} = i18n.useTranslation();\n const {\n steps,\n iconMode = 'status',\n activeStepLabel,\n stepTypes,\n status = steps[steps.length - 1]?.status ?? 'thought',\n activeStepId,\n expanded,\n defaultExpanded = false,\n maxHistoryHeight = 480,\n onExpandedChange,\n renderSummary,\n renderStepContent,\n className,\n qa,\n style,\n format = 'plain',\n transformOptions,\n mermaidOptions,\n openMarkdownLinksInNewTab,\n mdxOptions,\n mdxContext,\n markdownExtraProps,\n } = props;\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const detailsId = useId();\n const headingId = `${detailsId}-heading`;\n const isExpanded = expanded ?? internalExpanded;\n const activeStep =\n activeStepId === undefined\n ? [...steps].reverse().find((step) => step.status === 'thinking')\n : steps.find((step) => step.id === activeStepId);\n const completedSteps = steps.filter((step) => step.status === 'thought');\n const isThinking = status === 'thinking';\n const hasDetails =\n !isThinking ||\n steps.length > 1 ||\n Boolean(renderStepContent) ||\n steps.some((step) => {\n const content = Array.isArray(step.content) ? step.content : [step.content];\n return (\n Boolean(stepTypes?.[step.type]?.label || step.enabledCopy || step.onCopyClick) ||\n content.some(Boolean)\n );\n });\n\n if (steps.length === 0) {\n return null;\n }\n\n const toggleExpanded = () => {\n const nextExpanded = !isExpanded;\n if (expanded === undefined) {\n setInternalExpanded(nextExpanded);\n }\n onExpandedChange?.(nextExpanded);\n };\n\n const defaultSummary =\n completedSteps.length > 0 ? t('completed-steps', {count: completedSteps.length}) : null;\n const summary = renderSummary ? renderSummary(completedSteps) : defaultSummary;\n const heading = (\n <CompactHeading\n activeStep={activeStep}\n stepTypes={stepTypes}\n iconMode={iconMode}\n activeStepLabel={activeStepLabel}\n status={status}\n summary={summary}\n hasDetails={hasDetails}\n isExpanded={isExpanded}\n />\n );\n\n return (\n <div\n className={b({'without-icons': iconMode === 'none'}, className)}\n data-qa={qa}\n style={style}\n >\n {hasDetails ? (\n <Button\n id={headingId}\n className={b('compact-toggle')}\n view=\"flat-secondary\"\n width=\"auto\"\n onClick={toggleExpanded}\n aria-expanded={isExpanded}\n aria-controls={isExpanded ? detailsId : undefined}\n >\n {heading}\n </Button>\n ) : (\n <div className={b('compact-header')}>{heading}</div>\n )}\n {hasDetails && isExpanded && (\n <ol\n className={b('steps')}\n id={detailsId}\n aria-labelledby={headingId}\n tabIndex={0}\n style={{maxHeight: maxHistoryHeight}}\n >\n {steps.map((step) => {\n const type = stepTypes?.[step.type];\n const typeLabel = type?.label;\n const content = Array.isArray(step.content) ? step.content : [step.content];\n const hasContent = Boolean(renderStepContent) || content.some(Boolean);\n const showTitle = Boolean(step.title) || !hasContent;\n const showStatus = shouldShowStatus(step, iconMode, hasContent);\n return (\n <li className={b('step')} key={step.id}>\n <span\n className={b('step-marker', {\n status: step.status,\n hidden: iconMode === 'none',\n })}\n role=\"img\"\n aria-label={t(`status-${step.status}`)}\n >\n <StepIcon\n status={step.status}\n operationIcon={type?.icon}\n iconMode={iconMode}\n />\n </span>\n <div className={b('step-body')}>\n {showTitle && (\n <Text\n className={b('step-title', {\n error: step.status === 'error' && !step.title,\n })}\n >\n {step.title || t(`status-${step.status}`)}\n </Text>\n )}\n {(typeLabel || showStatus) && (\n <span className={b('step-meta')}>\n {typeLabel && <span>{typeLabel}</span>}\n {showStatus && (\n <span\n className={b('step-status', {\n error: step.status === 'error',\n })}\n >\n {t(`status-${step.status}`)}\n </span>\n )}\n </span>\n )}\n <div className={b('step-details')}>\n {renderStepContent\n ? renderStepContent(step)\n : content.map((item, index) => {\n if (!item) {\n return null;\n }\n if (format === 'markdown') {\n return (\n <MarkdownRenderer\n className={b('step-content')}\n key={index}\n content={item}\n transformOptions={{\n disableCommonAnchors: true,\n ...transformOptions,\n }}\n mermaidOptions={mermaidOptions}\n openLinksInNewTab={\n openMarkdownLinksInNewTab\n }\n mdxOptions={mdxOptions}\n mdxContext={mdxContext}\n extraProps={markdownExtraProps}\n />\n );\n }\n return (\n <Text\n className={b('step-content', {\n plain: true,\n })}\n key={index}\n >\n {item}\n </Text>\n );\n })}\n </div>\n {step.status !== 'thinking' &&\n (step.enabledCopy || step.onCopyClick) && (\n <ActionButton\n size=\"xs\"\n aria-label={t('copy')}\n tooltipTitle={t('copy')}\n className={b('copy')}\n onClick={() => {\n if (step.onCopyClick) step.onCopyClick();\n else copyToClipboard(step.content ?? '');\n }}\n >\n <Icon data={Copy} size={14} />\n </ActionButton>\n )}\n </div>\n </li>\n );\n })}\n </ol>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"ThinkingMessageGroup.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AAqBb,oDAuMC;;AA1ND,iCAAsC;AAEtC,6CAAuC;AACvC,6CAAqD;AAErD,qEAA8D;AAC9D,6CAAwC;AACxC,oEAAsD;AACtD,4EAA8D;AAE9D,wDAAgD;AAChD,4CAAoC;AACpC,0CAA4B;AAG5B,sCAAqC;AAErC,MAAM,CAAC,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Ae,EAAC,MAAA,IAAI,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC;wCAC7C,CAAC,YAED,uBAAC,YAAI,IAAC,IAAI,EAAE,YAAI,EAAE,IAAI,EAAE,EAAE,GAAI,GACnB,CAClB,IACH,KA1FqB,IAAI,CAAC,EAAE,CA2FjC,CACR,CAAC;gBACN,CAAC,CAAC,GACD,CACR,IACC,CACT,CAAC;AACN,CAAC","sourcesContent":["'use client';\n\nimport {useId, useState} from 'react';\n\nimport {Copy} from '@gravity-ui/icons';\nimport {Button, Icon, Text} from '@gravity-ui/uikit';\n\nimport {copyToClipboard} from '../../../utils/clipboardUtils';\nimport {block} from '../../../utils/cn';\nimport {ActionButton} from '../../atoms/ActionButton';\nimport {MarkdownRenderer} from '../../atoms/MarkdownRenderer';\n\nimport {CompactHeading} from './CompactHeading';\nimport {StepIcon} from './StepIcon';\nimport {i18n} from './i18n';\nimport type {ThinkingMessageGroupProps} from './types';\n\nimport './ThinkingMessageGroup.scss';\n\nconst b = block('thinking-message-group');\n\nexport function ThinkingMessageGroup(props: ThinkingMessageGroupProps) {\n const {t} = i18n.useTranslation();\n const {\n steps,\n stepTypes,\n status = steps[steps.length - 1]?.status ?? 'thought',\n activeStepId,\n expanded,\n defaultExpanded = false,\n maxHistoryHeight = 480,\n onExpandedChange,\n renderSummary,\n renderStepContent,\n className,\n qa,\n style,\n format = 'plain',\n transformOptions,\n mermaidOptions,\n openMarkdownLinksInNewTab,\n mdxOptions,\n mdxContext,\n markdownExtraProps,\n } = props;\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const detailsId = useId();\n const headingId = `${detailsId}-heading`;\n const isExpanded = expanded ?? internalExpanded;\n const activeStep =\n activeStepId === undefined\n ? [...steps].reverse().find((step) => step.status === 'thinking')\n : steps.find((step) => step.id === activeStepId);\n const completedSteps = steps.filter((step) => step.status === 'thought');\n const isThinking = status === 'thinking';\n const hasDetails =\n !isThinking ||\n steps.length > 1 ||\n Boolean(renderStepContent) ||\n steps.some((step) => {\n const content = Array.isArray(step.content) ? step.content : [step.content];\n return (\n Boolean(stepTypes?.[step.type]?.label || step.enabledCopy || step.onCopyClick) ||\n content.some(Boolean)\n );\n });\n\n if (steps.length === 0) {\n return null;\n }\n\n const toggleExpanded = () => {\n const nextExpanded = !isExpanded;\n if (expanded === undefined) {\n setInternalExpanded(nextExpanded);\n }\n onExpandedChange?.(nextExpanded);\n };\n\n const defaultSummary =\n completedSteps.length > 0 ? t('completed-steps', {count: completedSteps.length}) : null;\n const summary = renderSummary ? renderSummary(completedSteps) : defaultSummary;\n const heading = (\n <CompactHeading\n activeStep={activeStep}\n stepTypes={stepTypes}\n status={status}\n summary={summary}\n hasDetails={hasDetails}\n isExpanded={isExpanded}\n />\n );\n\n return (\n <div className={b(null, className)} data-qa={qa} style={style}>\n {hasDetails ? (\n <Button\n id={headingId}\n className={b('compact-toggle')}\n view=\"flat-secondary\"\n width=\"auto\"\n onClick={toggleExpanded}\n aria-expanded={isExpanded}\n aria-controls={isExpanded ? detailsId : undefined}\n >\n {heading}\n </Button>\n ) : (\n <div className={b('compact-header')}>{heading}</div>\n )}\n {hasDetails && isExpanded && (\n <ol\n className={b('steps')}\n id={detailsId}\n aria-labelledby={headingId}\n tabIndex={0}\n style={{maxHeight: maxHistoryHeight}}\n >\n {steps.map((step) => {\n const type = stepTypes?.[step.type];\n const content = Array.isArray(step.content) ? step.content : [step.content];\n return (\n <li className={b('step')} key={step.id}>\n <span\n className={b('step-marker', {status: step.status})}\n role=\"img\"\n aria-label={t(`status-${step.status}`)}\n >\n <StepIcon status={step.status} operationIcon={type?.icon} />\n </span>\n <div className={b('step-body')}>\n <Text\n className={b('step-title', {\n active:\n step.id === activeStep?.id &&\n step.status === 'thinking' &&\n isThinking,\n })}\n >\n {step.title || t(`status-${step.status}`)}\n </Text>\n {(type?.label ||\n (step.status !== 'thinking' &&\n step.status !== 'thought')) && (\n <span className={b('step-meta')}>\n {type?.label && <span>{type.label}</span>}\n {step.status !== 'thinking' &&\n step.status !== 'thought' && (\n <span\n className={b('step-status', {\n error: step.status === 'error',\n })}\n >\n {t(`status-${step.status}`)}\n </span>\n )}\n </span>\n )}\n <div className={b('step-details')}>\n {renderStepContent\n ? renderStepContent(step)\n : content.map((item, index) => {\n if (!item) {\n return null;\n }\n if (format === 'markdown') {\n return (\n <MarkdownRenderer\n className={b('step-content')}\n key={index}\n content={item}\n transformOptions={{\n disableCommonAnchors: true,\n ...transformOptions,\n }}\n mermaidOptions={mermaidOptions}\n openLinksInNewTab={\n openMarkdownLinksInNewTab\n }\n mdxOptions={mdxOptions}\n mdxContext={mdxContext}\n extraProps={markdownExtraProps}\n />\n );\n }\n return (\n <Text\n className={b('step-content', {\n plain: true,\n })}\n key={index}\n >\n {item}\n </Text>\n );\n })}\n </div>\n {step.status !== 'thinking' &&\n (step.enabledCopy || step.onCopyClick) && (\n <ActionButton\n size=\"xs\"\n aria-label={t('copy')}\n tooltipTitle={t('copy')}\n className={b('copy')}\n onClick={() => {\n if (step.onCopyClick) step.onCopyClick();\n else copyToClipboard(step.content ?? '');\n }}\n >\n <Icon data={Copy} size={14} />\n </ActionButton>\n )}\n </div>\n </li>\n );\n })}\n </ol>\n )}\n </div>\n );\n}\n"]}
@@ -14,7 +14,7 @@ export interface ThinkingStep {
14
14
  onCopyClick?: () => void;
15
15
  }
16
16
  export interface ThinkingStepType {
17
- /** Operation icon used with iconMode="type" while thinking and after completion; other states use their status icon. */
17
+ /** Operation icon shown while thinking and after completion; error, paused, and cancelled states use their status icon. */
18
18
  icon?: ReactNode;
19
19
  /** Shown only in the expanded history. */
20
20
  label?: string;
@@ -22,10 +22,6 @@ export interface ThinkingStepType {
22
22
  export interface ThinkingMessageGroupProps extends Pick<ThinkingMessageProps, 'format' | 'transformOptions' | 'mermaidOptions' | 'openMarkdownLinksInNewTab' | 'mdxOptions' | 'mdxContext' | 'markdownExtraProps' | 'className' | 'qa' | 'style'> {
23
23
  /** Ordered, accumulated steps supplied by the application. */
24
24
  steps: readonly ThinkingStep[];
25
- /** Defaults to status icons. Use type for application-supplied category icons. */
26
- iconMode?: 'type' | 'status' | 'none';
27
- /** Plain-text running heading supplied by the application; overrides the active step title. */
28
- activeStepLabel?: string;
29
25
  stepTypes?: Readonly<Record<string, ThinkingStepType>>;
30
26
  /** Defaults to the last step's status. Explicit run status takes precedence. */
31
27
  status?: ThinkingStepStatus;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {CSSProperties, ReactNode} from 'react';\n\nimport type {ThinkingMessageProps} from '../ThinkingMessage';\n\n/** Execution state is independent of the application-defined category. */\nexport type ThinkingStepStatus = 'thinking' | 'thought' | 'error' | 'cancelled' | 'paused';\n\nexport interface ThinkingStep {\n /** Stable identity across streaming updates. */\n id: string;\n type: string;\n title?: string;\n status: ThinkingStepStatus;\n /** Paragraphs belonging to this step, not separate actions. */\n content?: string | string[];\n enabledCopy?: boolean;\n onCopyClick?: () => void;\n}\n\nexport interface ThinkingStepType {\n /** Operation icon used with iconMode=\"type\" while thinking and after completion; other states use their status icon. */\n icon?: ReactNode;\n /** Shown only in the expanded history. */\n label?: string;\n}\n\nexport interface ThinkingMessageGroupProps\n extends Pick<\n ThinkingMessageProps,\n | 'format'\n | 'transformOptions'\n | 'mermaidOptions'\n | 'openMarkdownLinksInNewTab'\n | 'mdxOptions'\n | 'mdxContext'\n | 'markdownExtraProps'\n | 'className'\n | 'qa'\n | 'style'\n > {\n /** Ordered, accumulated steps supplied by the application. */\n steps: readonly ThinkingStep[];\n /** Defaults to status icons. Use type for application-supplied category icons. */\n iconMode?: 'type' | 'status' | 'none';\n /** Plain-text running heading supplied by the application; overrides the active step title. */\n activeStepLabel?: string;\n stepTypes?: Readonly<Record<string, ThinkingStepType>>;\n /** Defaults to the last step's status. Explicit run status takes precedence. */\n status?: ThinkingStepStatus;\n /** Defaults to the last thinking step while the group is running. */\n activeStepId?: string;\n expanded?: boolean;\n defaultExpanded?: boolean;\n /** Maximum expanded history height. Defaults to 480px; use \"none\" to disable the limit. */\n maxHistoryHeight?: CSSProperties['maxHeight'];\n onExpandedChange?: (expanded: boolean) => void;\n renderSummary?: (completedSteps: ThinkingStep[]) => ReactNode;\n renderStepContent?: (step: ThinkingStep) => ReactNode;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {CSSProperties, ReactNode} from 'react';\n\nimport type {ThinkingMessageProps} from '../ThinkingMessage';\n\n/** Execution state is independent of the application-defined category. */\nexport type ThinkingStepStatus = 'thinking' | 'thought' | 'error' | 'cancelled' | 'paused';\n\nexport interface ThinkingStep {\n /** Stable identity across streaming updates. */\n id: string;\n type: string;\n title?: string;\n status: ThinkingStepStatus;\n /** Paragraphs belonging to this step, not separate actions. */\n content?: string | string[];\n enabledCopy?: boolean;\n onCopyClick?: () => void;\n}\n\nexport interface ThinkingStepType {\n /** Operation icon shown while thinking and after completion; error, paused, and cancelled states use their status icon. */\n icon?: ReactNode;\n /** Shown only in the expanded history. */\n label?: string;\n}\n\nexport interface ThinkingMessageGroupProps\n extends Pick<\n ThinkingMessageProps,\n | 'format'\n | 'transformOptions'\n | 'mermaidOptions'\n | 'openMarkdownLinksInNewTab'\n | 'mdxOptions'\n | 'mdxContext'\n | 'markdownExtraProps'\n | 'className'\n | 'qa'\n | 'style'\n > {\n /** Ordered, accumulated steps supplied by the application. */\n steps: readonly ThinkingStep[];\n stepTypes?: Readonly<Record<string, ThinkingStepType>>;\n /** Defaults to the last step's status. Explicit run status takes precedence. */\n status?: ThinkingStepStatus;\n /** Defaults to the last thinking step while the group is running. */\n activeStepId?: string;\n expanded?: boolean;\n defaultExpanded?: boolean;\n /** Maximum expanded history height. Defaults to 480px; use \"none\" to disable the limit. */\n maxHistoryHeight?: CSSProperties['maxHeight'];\n onExpandedChange?: (expanded: boolean) => void;\n renderSummary?: (completedSteps: ThinkingStep[]) => ReactNode;\n renderStepContent?: (step: ThinkingStep) => ReactNode;\n}\n"]}
@@ -1 +1 @@
1
- {"version":"3.0.1-beta.f7461335625c068858baeb9c24f602de088b4093.0","type":"commonjs","sideEffects":["*.css","*.scss"]}
1
+ {"version":"3.0.1","type":"commonjs","sideEffects":["*.css","*.scss"]}
@@ -88,6 +88,7 @@ function App() {
88
88
  - [Playwright Commands Quick Reference](./guides/PLAYWRIGHT.md)
89
89
  - [Quick Start](./guides/GETTING_STARTED.md) — This guide walks you through installing @gravity-ui/aikit and rendering your first chat.
90
90
  - [README Documentation](./guides/guidelines/readme.md) — Every component must have a comprehensive README.md file documenting its purpose, usage, and API.
91
+ - [Releasing AIKit 2 and 3](./guides/releasing.md)
91
92
  - [Storybook Files Creation](./guides/guidelines/storybook.md) — All components should have Storybook stories for documentation and testing purposes. Stories are located in the __stories__ directory within each component folder.
92
93
  - [Testing Guide](./guides/TESTING.md) — This project uses Playwright Component Testing for visual regression testing and component validation.
93
94
  - [Testing Guidelines](./guides/guidelines/testing.md) — Tests should be created based on Storybook stories to ensure consistency between documentation and functionality. We use Playwright Component Testing for visual regression testing and interaction testing.
@@ -44,7 +44,7 @@ import {ThinkingMessageGroup, thinkingMessageToStep} from '@gravity-ui/aikit/Thi
44
44
 
45
45
  Use a stable ID scoped to the response. One legacy message becomes one step, even when its
46
46
  `content` is an array of paragraphs. Titles, contents, statuses and copy callbacks are preserved.
47
- No category or action name is inferred from reasoning text. Without a title, details are shown directly; an empty step uses localized status text.
47
+ No category or action name is inferred from reasoning text. Missing titles use localized status text.
48
48
 
49
49
  ### Supply structured steps
50
50
 
@@ -58,71 +58,33 @@ import {ThinkingMessageGroup} from '@gravity-ui/aikit/ThinkingMessageGroup';
58
58
  {id: 'analyze', type: 'reasoning', title: 'Analyzed the request', status: 'thought'},
59
59
  {id: 'search', type: 'search', title: 'Searching documentation', status: 'thinking'},
60
60
  ]}
61
- iconMode="type"
62
61
  stepTypes={{search: {icon: <Icon data={Magnifier} size={16} />, label: 'Documentation search'}}}
63
62
  status="thinking"
64
63
  activeStepId="search"
65
64
  />;
66
65
  ```
67
66
 
68
- Types have no fixed enum. With `iconMode="type"`, running and completed steps keep their category icon, or a static dot when none is supplied. Error, paused and cancelled steps use their status icon instead. Category labels appear
67
+ Types have no fixed enum. Running and completed steps keep their category icon, or a static dot
68
+ when none is supplied. Error, paused and cancelled steps use their status icon instead. Category labels appear
69
69
  only in the expanded history. Applications choose icons; the component does not map backend event
70
70
  names to icons. Details can be omitted when the backend does not supply them.
71
71
 
72
- ### Configure progress presentation
73
-
74
- ```tsx
75
- <ThinkingMessageGroup
76
- steps={steps}
77
- iconMode="status"
78
- activeStepLabel="Checking database clusters"
79
- format="markdown"
80
- />
81
- ```
82
-
83
- The component uses `body-1` typography by default. The top-level heading uses primary text.
84
- All expanded history text, including the running step and Markdown inside a mobile chat, uses
85
- secondary text. Only the running heading pulses.
86
- Error indicators use the danger color. Completed steps stay neutral, not green.
87
-
88
- In expanded history, a supplied `title` is displayed above the details. Without a title, details
89
- are displayed directly, without a repeated "In progress" or "Completed" heading. A step with
90
- neither a title nor details still displays its localized status. No title is generated from content.
91
-
92
- `iconMode="status"` uses a static clock while running and a check after completion.
93
- `iconMode="type"` uses application-provided category icons for running/completed steps,
94
- falling back to a dot. Error, paused and cancelled states keep their dedicated status icons.
95
- `iconMode="none"` removes icons and the timeline gutter; accessible statuses remain, and
96
- exceptional states retain a visible status label. Custom icons can supply their own colors.
97
- The completed group heading does not add another checkmark above the step icons.
98
-
99
- Use `activeStepLabel` for an application-supplied plain-text heading while running. It takes
100
- precedence over the active step title, is truncated visually and is available in full on hover.
101
- When omitted, the active title or localized run status is used. It does not replace stored content
102
- or affect the completed summary (`renderSummary`).
103
-
104
- This presentation also applies automatically with `thinkingMessageView="grouped"`.
105
- To customize icons or the running heading inside a chat, render `ThinkingMessageGroup` through
106
- the existing custom thinking renderer, as in the example above.
107
-
108
72
  ## Props
109
73
 
110
- | Prop | Type | Required | Default | Description |
111
- | -------------------------- | ----------------------------------------------- | -------- | -------------------------------- | ------------------------------------------------------------------ |
112
- | `steps` | `readonly ThinkingStep[]` | Yes | — | Accumulated, ordered steps with stable unique IDs |
113
- | `iconMode` | `'type' \| 'status' \| 'none'` | No | `'status'` | Category icons, execution-state icons, or no icons/timeline |
114
- | `activeStepLabel` | `string` | No | Active title or localized status | Plain-text override of the running heading |
115
- | `stepTypes` | `Record<string, ThinkingStepType>` | No | — | Category icons and labels |
116
- | `status` | `ThinkingStepStatus` | No | Last step status | Overall run status, independent of stored step statuses |
117
- | `activeStepId` | `string` | No | Last thinking step | Select the active step explicitly |
118
- | `expanded` | `boolean` | No | — | Controlled expansion |
119
- | `defaultExpanded` | `boolean` | No | `false` | Initial uncontrolled expansion |
120
- | `maxHistoryHeight` | `CSSProperties['maxHeight']` | No | `480` | Maximum expanded history height; use `"none"` to disable the limit |
121
- | `onExpandedChange` | `(expanded: boolean) => void` | No | — | Disclosure change callback |
122
- | `renderSummary` | `(completedSteps: ThinkingStep[]) => ReactNode` | No | Completed count | Optional summary; null, false and empty string hide it |
123
- | `renderStepContent` | `(step: ThinkingStep) => ReactNode` | No | Content renderer | Custom details |
124
- | `format` | `'plain' \| 'markdown'` | No | `'plain'` | Content format |
125
- | `className`, `style`, `qa` | Standard DOM/QA props | No | — | Root customization |
74
+ | Prop | Type | Required | Default | Description |
75
+ | -------------------------- | ----------------------------------------------- | -------- | ------------------ | ------------------------------------------------------------------ |
76
+ | `steps` | `readonly ThinkingStep[]` | Yes | — | Accumulated, ordered steps with stable unique IDs |
77
+ | `stepTypes` | `Record<string, ThinkingStepType>` | No | — | Category icons and labels |
78
+ | `status` | `ThinkingStepStatus` | No | Last step status | Overall run status, independent of stored step statuses |
79
+ | `activeStepId` | `string` | No | Last thinking step | Select the active step explicitly |
80
+ | `expanded` | `boolean` | No | — | Controlled expansion |
81
+ | `defaultExpanded` | `boolean` | No | `false` | Initial uncontrolled expansion |
82
+ | `maxHistoryHeight` | `CSSProperties['maxHeight']` | No | `480` | Maximum expanded history height; use `"none"` to disable the limit |
83
+ | `onExpandedChange` | `(expanded: boolean) => void` | No | — | Disclosure change callback |
84
+ | `renderSummary` | `(completedSteps: ThinkingStep[]) => ReactNode` | No | Completed count | Optional summary; null, false and empty string hide it |
85
+ | `renderStepContent` | `(step: ThinkingStep) => ReactNode` | No | Content renderer | Custom details |
86
+ | `format` | `'plain' \| 'markdown'` | No | `'plain'` | Content format |
87
+ | `className`, `style`, `qa` | Standard DOM/QA props | No | — | Root customization |
126
88
 
127
89
  Markdown options match `ThinkingMessage`: `transformOptions`, `mermaidOptions`,
128
90
  `openMarkdownLinksInNewTab`, `mdxOptions`, `mdxContext`, `markdownExtraProps`.
@@ -0,0 +1,45 @@
1
+ # Releasing AIKit 2 and 3
2
+
3
+ | Branch | Stable npm tag | PR preview tag | Dependencies |
4
+ | ------------ | -------------- | -------------- | ------------ |
5
+ | `main` | `latest` | `beta-v3` | UIKit 8 |
6
+ | `release/v2` | `v2` | `beta-v2` | UIKit 7 |
7
+
8
+ Versions and changelogs advance independently. A shared feature can ship as 3.1.0 and 2.29.0. Releases are not an atomic operation across branches.
9
+
10
+ ## One-time setup
11
+
12
+ 1. Apply the workflow changes to the current `main` (AIKit 3), not the old 2.28.0 checkout.
13
+ 2. Create `release/v2` from `v2.28.0`. Copy the release infrastructure changes to it, including `scripts/release/check-major.cjs`. Keep its package manifests, changelog, source code and UIKit 7 dependencies. Do not merge `main` into this branch. On `main`, keep the UIKit matrix `[locked, '8.0.0']`; on `release/v2`, use `[locked]` to test its UIKit 7 lockfile. Keep the aggregate `Tests` job on both branches so branch protection uses the same check name.
14
+ 3. Create the `backport-v2` label. Enable squash merging and GitHub's **Allow auto-merge** repository setting.
15
+ 4. Protect both branches. Inspect active repository rulesets as well as classic branch protection; preserve existing review and merge-queue requirements. Require `Release Major`, `Verify Files`, `Tests`, `Visual Tests` and `Lint PR Title`, with checks against the latest base branch. Do not allow the automation app to bypass checks. Additional required human reviews will still require human approval; auto-merge does not bypass them.
16
+ 5. Ensure the existing Gravity UI app has contents and pull request write permissions on this repository. Its installation token creates PRs so their CI workflows run.
17
+ 6. Set repository variable `RELEASE_BOT_LOGIN` to the exact login of the app account that creates release-please PRs (including `[bot]` when present). The verified author of release PR #288 is `gravity-ui[bot]`; recheck the author if the app installation changes.
18
+ 7. Verify that all five required check names have reported on a PR into each branch, including the aggregate `Tests` job. Only after branch protection is configured, set repository variable `RELEASE_AUTOMERGE` to `true`. Until then backport and release PRs require manual merging.
19
+ 8. Test one compatible fix end to end. Verify that the backport checks run against UIKit 7 and that publishing 2.x leaves npm `latest` pointing to 3.x.
20
+
21
+ ## Daily workflow
22
+
23
+ - Develop changes in a PR targeting `main`, using a conventional `feat:` or `fix:` title and squash merge.
24
+ - Add `backport-v2` when the change should also ship in AIKit 2. The label can be added before or after merging.
25
+ - After merging, release-please prepares the 3.x release PR. Backport automation separately creates a PR into `release/v2`, preserving the original title for version calculation.
26
+ - With auto-merge enabled, compatible backports and release PRs merge once required checks and reviews pass. Each branch then publishes its own release.
27
+ - Do not label release PRs for backport. Version bumps, changelogs, breaking changes and UIKit 8 migrations must not be copied to 2.x.
28
+
29
+ The privileged backport workflow checks out the trusted base branch and never installs dependencies or runs PR scripts. PR validation runs in normal pull request workflows.
30
+
31
+ ## Conflicts and compatibility
32
+
33
+ A clean cherry-pick is not proof of UIKit 7 compatibility. Both branches must run build, type, unit and visual checks. Visual tests use the existing Playwright container workflow.
34
+
35
+ If cherry-picking fails, the backport workflow fails and the action reports the conflict on the original PR. Manually cherry-pick/adapt the change into a branch based on `release/v2` and open a normal PR with a conventional title. The 3.x release continues independently. Never resolve conflicts by copying the 3.x package manifest or lockfile over 2.x.
36
+
37
+ `Release Major` rejects prereleases, mismatched lockfile versions and unexpected majors. A breaking change intended for a new major needs an explicit update of the branch policy; it cannot silently turn `release/v2` into 3.x or `main` into 4.x.
38
+
39
+ ## Operational notes
40
+
41
+ - The existing release action remains responsible for version calculation, changelog generation and publication. Only release PRs from the configured bot, with the expected branch prefix and release label, changing only manifests and changelog are eligible for automatic merging.
42
+ - Publishing runs are serialized per branch. A failure in one release line does not block the other.
43
+ - PR prereleases validate the base branch and stable package/lockfile versions before changing the version or publishing. Only PRs into `main` and `release/v2` publish previews. PR prereleases use separate `beta-v2` and `beta-v3` tags. Install the exact version from the PR for reproducible testing; each tag points to the most recently published preview in that release line.
44
+ - If npm publication fails after a GitHub release was created, inspect npm before retrying. The existing release action does not guarantee a retry will republish an already-created release. Publish the missing version from its exact release tag through the project's authorized recovery process; never bump merely to retry or republish an existing version.
45
+ - To pause automatic merging, set `RELEASE_AUTOMERGE` to `false`. This does not cancel already-enabled GitHub auto-merge requests; disable those on the affected PRs as well.
@@ -1,11 +1,11 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ThinkingMessageGroupProps, ThinkingStep } from "./types.js";
3
- interface CompactHeadingProps extends Pick<ThinkingMessageGroupProps, 'stepTypes' | 'iconMode' | 'activeStepLabel'> {
3
+ interface CompactHeadingProps extends Pick<ThinkingMessageGroupProps, 'stepTypes'> {
4
4
  status: NonNullable<ThinkingMessageGroupProps['status']>;
5
5
  activeStep?: ThinkingStep;
6
6
  summary: ReactNode;
7
7
  hasDetails: boolean;
8
8
  isExpanded: boolean;
9
9
  }
10
- export declare function CompactHeading({ activeStep, stepTypes, iconMode, activeStepLabel, status, summary, hasDetails, isExpanded, }: CompactHeadingProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function CompactHeading({ activeStep, stepTypes, status, summary, hasDetails, isExpanded, }: CompactHeadingProps): import("react/jsx-runtime").JSX.Element;
11
11
  export {};
@@ -5,22 +5,19 @@ import { block } from "../../../utils/cn.js";
5
5
  import { StepIcon } from "./StepIcon.js";
6
6
  import { i18n } from "./i18n/index.js";
7
7
  const b = block('thinking-message-group');
8
- export function CompactHeading({ activeStep, stepTypes, iconMode, activeStepLabel, status, summary, hasDetails, isExpanded, }) {
8
+ export function CompactHeading({ activeStep, stepTypes, status, summary, hasDetails, isExpanded, }) {
9
9
  var _a;
10
10
  const { t } = i18n.useTranslation();
11
11
  const isThinking = status === 'thinking';
12
+ const showActiveStep = Boolean(activeStep && isThinking);
12
13
  const hasSummary = summary !== null && summary !== undefined && summary !== false && summary !== '';
13
14
  const showCompletedSummary = status === 'thought' && hasSummary;
14
- const label = (isThinking && activeStepLabel) ||
15
- (isThinking && (activeStep === null || activeStep === void 0 ? void 0 : activeStep.title)) ||
16
- t(`status-${status}`);
17
- const showIcon = status !== 'thought' && iconMode !== 'none';
18
- const operationIcon = isThinking && activeStep ? (_a = stepTypes === null || stepTypes === void 0 ? void 0 : stepTypes[activeStep.type]) === null || _a === void 0 ? void 0 : _a.icon : null;
15
+ const label = (showActiveStep && (activeStep === null || activeStep === void 0 ? void 0 : activeStep.title)) || t(`status-${status}`);
16
+ const operationIcon = showActiveStep && activeStep ? (_a = stepTypes === null || stepTypes === void 0 ? void 0 : stepTypes[activeStep.type]) === null || _a === void 0 ? void 0 : _a.icon : null;
19
17
  const showSecondarySummary = !showCompletedSummary && hasSummary;
20
- return (_jsxs("span", { className: b('compact-heading'), children: [_jsxs("span", { className: b('compact-current'), children: [showIcon && (_jsx("span", { className: b('step-icon', { error: status === 'error' }), "aria-hidden": "true", children: _jsx(StepIcon, { status: status, operationIcon: operationIcon, iconMode: iconMode }) })), _jsx("span", { className: b('compact-label', {
21
- active: isThinking &&
22
- ((activeStep === null || activeStep === void 0 ? void 0 : activeStep.status) === 'thinking' || Boolean(activeStepLabel)),
18
+ return (_jsxs("span", { className: b('compact-heading'), children: [_jsxs("span", { className: b('compact-current'), children: [status !== 'thought' && (_jsx("span", { className: b('step-icon', { error: status === 'error' }), "aria-hidden": "true", children: _jsx(StepIcon, { status: status, operationIcon: operationIcon }) })), _jsx("span", { className: b('compact-label', {
19
+ active: isThinking && (activeStep === null || activeStep === void 0 ? void 0 : activeStep.status) === 'thinking',
23
20
  error: status === 'error',
24
- }), title: showCompletedSummary ? undefined : label, children: showCompletedSummary ? summary : label }), hasDetails && (_jsx("span", { className: b('disclosure', { expanded: isExpanded }), "aria-hidden": "true", children: _jsx(Icon, { data: ChevronRight, size: 12 }) }))] }), showSecondarySummary && (_jsx("span", { className: b('compact-summary', { indented: showIcon }), children: summary }))] }));
21
+ }), title: showCompletedSummary ? undefined : label, children: showCompletedSummary ? summary : label }), hasDetails && (_jsx("span", { className: b('disclosure', { expanded: isExpanded }), "aria-hidden": "true", children: _jsx(Icon, { data: ChevronRight, size: 12 }) }))] }), showSecondarySummary && (_jsx("span", { className: b('compact-summary', { indented: true }), children: summary }))] }));
25
22
  }
26
23
  //# sourceMappingURL=CompactHeading.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CompactHeading.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/CompactHeading.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,KAAK,EAAC,6BAA0B;AAExC,OAAO,EAAC,QAAQ,EAAC,sBAAmB;AACpC,OAAO,EAAC,IAAI,EAAC,wBAAe;AAG5B,MAAM,CAAC,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAW1C,MAAM,UAAU,cAAc,CAAC,EAC3B,UAAU,EACV,SAAS,EACT,QAAQ,EACR,eAAe,EACf,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,GACQ;;IAClB,MAAM,EAAC,CAAC,EAAC,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IAClC,MAAM,UAAU,GAAG,MAAM,KAAK,UAAU,CAAC;IACzC,MAAM,UAAU,GACZ,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,EAAE,CAAC;IACrF,MAAM,oBAAoB,G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CAAC,CAAC,KAAK,GACpC,EACN,UAAU,IAAI,CACX,eAAM,SAAS,EAAE,CAAC,CAAC,YAAY,EAAE,EAAC,QAAQ,EAAE,UAAU,EAAC,CAAC,iBAAc,MAAM,YACxE,KAAC,IAAI,IAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAI,GACnC,CACV,IACE,EACN,oBAAoB,IAAI,CACrB,eAAM,SAAS,EAAE,CAAC,CAAC,iBAAiB,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAC,CAAC,YAAG,OAAO,GAAQ,CAChF,IACE,CACV,CAAC;AACN,CAAC","sourcesContent":["import type {ReactNode} from 'react';\n\nimport {ChevronRight} from '@gravity-ui/icons';\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\n\nimport {StepIcon} from './StepIcon';\nimport {i18n} from './i18n';\nimport type {ThinkingMessageGroupProps, ThinkingStep} from './types';\n\nconst b = block('thinking-message-group');\n\ninterface CompactHeadingProps\n extends Pick<ThinkingMessageGroupProps, 'stepTypes' | 'iconMode' | 'activeStepLabel'> {\n status: NonNullable<ThinkingMessageGroupProps['status']>;\n activeStep?: ThinkingStep;\n summary: ReactNode;\n hasDetails: boolean;\n isExpanded: boolean;\n}\n\nexport function CompactHeading({\n activeStep,\n stepTypes,\n iconMode,\n activeStepLabel,\n status,\n summary,\n hasDetails,\n isExpanded,\n}: CompactHeadingProps) {\n const {t} = i18n.useTranslation();\n const isThinking = status === 'thinking';\n const hasSummary =\n summary !== null && summary !== undefined && summary !== false && summary !== '';\n const showCompletedSummary = status === 'thought' && hasSummary;\n const label =\n (isThinking && activeStepLabel) ||\n (isThinking && activeStep?.title) ||\n t(`status-${status}`);\n const showIcon = status !== 'thought' && iconMode !== 'none';\n const operationIcon = isThinking && activeStep ? stepTypes?.[activeStep.type]?.icon : null;\n const showSecondarySummary = !showCompletedSummary && hasSummary;\n return (\n <span className={b('compact-heading')}>\n <span className={b('compact-current')}>\n {showIcon && (\n <span\n className={b('step-icon', {error: status === 'error'})}\n aria-hidden=\"true\"\n >\n <StepIcon\n status={status}\n operationIcon={operationIcon}\n iconMode={iconMode}\n />\n </span>\n )}\n <span\n className={b('compact-label', {\n active:\n isThinking &&\n (activeStep?.status === 'thinking' || Boolean(activeStepLabel)),\n error: status === 'error',\n })}\n title={showCompletedSummary ? undefined : label}\n >\n {showCompletedSummary ? summary : label}\n </span>\n {hasDetails && (\n <span className={b('disclosure', {expanded: isExpanded})} aria-hidden=\"true\">\n <Icon data={ChevronRight} size={12} />\n </span>\n )}\n </span>\n {showSecondarySummary && (\n <span className={b('compact-summary', {indented: showIcon})}>{summary}</span>\n )}\n </span>\n );\n}\n"]}
1
+ {"version":3,"file":"CompactHeading.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/CompactHeading.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,KAAK,EAAC,6BAA0B;AAExC,OAAO,EAAC,QAAQ,EAAC,sBAAmB;AACpC,OAAO,EAAC,IAAI,EAAC,wBAAe;AAG5B,MAAM,CAAC,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAU1C,MAAM,UAAU,cAAc,CAAC,EAC3B,UAAU,EACV,SAAS,EACT,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,GACQ;;IAClB,MAAM,EAAC,CAAC,EAAC,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IAClC,MAAM,UAAU,GAAG,MAAM,KAAK,UAAU,CAAC;IACzC,MAAM,cAAc,GAAG,OAAO,CAAC,UAAU,IAAI,UAAU,CAAC,CAAC;IACzD,MAAM,UAAU,GACZ,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,EAAE,CAAC;IACrF,MAAM,o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IAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAI,GACnC,CACV,IACE,EACN,oBAAoB,IAAI,CACrB,eAAM,SAAS,EAAE,CAAC,CAAC,iBAAiB,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,YAAG,OAAO,GAAQ,CAC5E,IACE,CACV,CAAC;AACN,CAAC","sourcesContent":["import type {ReactNode} from 'react';\n\nimport {ChevronRight} from '@gravity-ui/icons';\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\n\nimport {StepIcon} from './StepIcon';\nimport {i18n} from './i18n';\nimport type {ThinkingMessageGroupProps, ThinkingStep} from './types';\n\nconst b = block('thinking-message-group');\n\ninterface CompactHeadingProps extends Pick<ThinkingMessageGroupProps, 'stepTypes'> {\n status: NonNullable<ThinkingMessageGroupProps['status']>;\n activeStep?: ThinkingStep;\n summary: ReactNode;\n hasDetails: boolean;\n isExpanded: boolean;\n}\n\nexport function CompactHeading({\n activeStep,\n stepTypes,\n status,\n summary,\n hasDetails,\n isExpanded,\n}: CompactHeadingProps) {\n const {t} = i18n.useTranslation();\n const isThinking = status === 'thinking';\n const showActiveStep = Boolean(activeStep && isThinking);\n const hasSummary =\n summary !== null && summary !== undefined && summary !== false && summary !== '';\n const showCompletedSummary = status === 'thought' && hasSummary;\n const label = (showActiveStep && activeStep?.title) || t(`status-${status}`);\n const operationIcon = showActiveStep && activeStep ? stepTypes?.[activeStep.type]?.icon : null;\n const showSecondarySummary = !showCompletedSummary && hasSummary;\n return (\n <span className={b('compact-heading')}>\n <span className={b('compact-current')}>\n {status !== 'thought' && (\n <span\n className={b('step-icon', {error: status === 'error'})}\n aria-hidden=\"true\"\n >\n <StepIcon status={status} operationIcon={operationIcon} />\n </span>\n )}\n <span\n className={b('compact-label', {\n active: isThinking && activeStep?.status === 'thinking',\n error: status === 'error',\n })}\n title={showCompletedSummary ? undefined : label}\n >\n {showCompletedSummary ? summary : label}\n </span>\n {hasDetails && (\n <span className={b('disclosure', {expanded: isExpanded})} aria-hidden=\"true\">\n <Icon data={ChevronRight} size={12} />\n </span>\n )}\n </span>\n {showSecondarySummary && (\n <span className={b('compact-summary', {indented: true})}>{summary}</span>\n )}\n </span>\n );\n}\n"]}
@@ -1,7 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { ThinkingMessageGroupProps, ThinkingStepStatus } from "./types.js";
3
- export declare function StepIcon({ status, operationIcon, iconMode, }: {
2
+ import type { ThinkingStepStatus } from "./types.js";
3
+ export declare function StepIcon({ status, operationIcon, }: {
4
4
  status: ThinkingStepStatus;
5
5
  operationIcon?: ReactNode;
6
- iconMode?: ThinkingMessageGroupProps['iconMode'];
7
- }): string | number | true | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element | null;
6
+ }): string | number | true | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element;
@@ -1,19 +1,15 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Ban, Check, CircleXmark, Clock, Pause } from '@gravity-ui/icons';
2
+ import { Ban, CircleXmark, Pause } from '@gravity-ui/icons';
3
3
  import { Icon } from '@gravity-ui/uikit';
4
4
  import { block } from "../../../utils/cn.js";
5
5
  const b = block('thinking-message-group');
6
6
  const statusIcons = {
7
- thinking: Clock,
8
- thought: Check,
9
7
  error: CircleXmark,
10
8
  cancelled: Ban,
11
9
  paused: Pause,
12
10
  };
13
- export function StepIcon({ status, operationIcon, iconMode = 'status', }) {
14
- if (iconMode === 'none')
15
- return null;
16
- if (iconMode === 'type' && (status === 'thinking' || status === 'thought')) {
11
+ export function StepIcon({ status, operationIcon, }) {
12
+ if (status === 'thinking' || status === 'thought') {
17
13
  return operationIcon || _jsx("span", { className: b('step-dot') });
18
14
  }
19
15
  return _jsx(Icon, { data: statusIcons[status], size: 16 });
@@ -1 +1 @@
1
- {"version":3,"file":"StepIcon.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/StepIcon.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,KAAK,EAAC,6BAA0B;AAIxC,MAAM,CAAC,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAE1C,MAAM,WAAW,GAAG;IAChB,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,GAAG;IACd,MAAM,EAAE,KAAK;CAChB,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,EACrB,MAAM,EACN,aAAa,EACb,QAAQ,GAAG,QAAQ,GAKtB;IACG,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAErC,IAAI,QAAQ,KAAK,MAAM,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,MAAM,KAAK,SAAS,CAAC,EAAE,CAAC;QACzE,OAAO,aAAa,IAAI,eAAM,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,GAAI,CAAC;IAC/D,CAAC;IAED,OAAO,KAAC,IAAI,IAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,GAAI,CAAC;AACzD,CAAC","sourcesContent":["import type {ReactNode} from 'react';\n\nimport {Ban, Check, CircleXmark, Clock, Pause} from '@gravity-ui/icons';\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\n\nimport type {ThinkingMessageGroupProps, ThinkingStepStatus} from './types';\n\nconst b = block('thinking-message-group');\n\nconst statusIcons = {\n thinking: Clock,\n thought: Check,\n error: CircleXmark,\n cancelled: Ban,\n paused: Pause,\n};\n\nexport function StepIcon({\n status,\n operationIcon,\n iconMode = 'status',\n}: {\n status: ThinkingStepStatus;\n operationIcon?: ReactNode;\n iconMode?: ThinkingMessageGroupProps['iconMode'];\n}) {\n if (iconMode === 'none') return null;\n\n if (iconMode === 'type' && (status === 'thinking' || status === 'thought')) {\n return operationIcon || <span className={b('step-dot')} />;\n }\n\n return <Icon data={statusIcons[status]} size={16} />;\n}\n"]}
1
+ {"version":3,"file":"StepIcon.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/StepIcon.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,KAAK,EAAC,6BAA0B;AAIxC,MAAM,CAAC,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAE1C,MAAM,WAAW,GAAG;IAChB,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,GAAG;IACd,MAAM,EAAE,KAAK;CAChB,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,EACrB,MAAM,EACN,aAAa,GAIhB;IACG,IAAI,MAAM,KAAK,UAAU,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAChD,OAAO,aAAa,IAAI,eAAM,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,GAAI,CAAC;IAC/D,CAAC;IAED,OAAO,KAAC,IAAI,IAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,GAAI,CAAC;AACzD,CAAC","sourcesContent":["import type {ReactNode} from 'react';\n\nimport {Ban, CircleXmark, Pause} from '@gravity-ui/icons';\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\n\nimport type {ThinkingStepStatus} from './types';\n\nconst b = block('thinking-message-group');\n\nconst statusIcons = {\n error: CircleXmark,\n cancelled: Ban,\n paused: Pause,\n};\n\nexport function StepIcon({\n status,\n operationIcon,\n}: {\n status: ThinkingStepStatus;\n operationIcon?: ReactNode;\n}) {\n if (status === 'thinking' || status === 'thought') {\n return operationIcon || <span className={b('step-dot')} />;\n }\n\n return <Icon data={statusIcons[status]} size={16} />;\n}\n"]}
@@ -6,9 +6,8 @@
6
6
  gap: var(--g-spacing-3);
7
7
  padding: 0;
8
8
  border: 0;
9
- color: var(--g-color-text-secondary);
10
- font-size: var(--g-text-body-1-font-size);
11
- line-height: var(--g-text-body-1-line-height);
9
+ font-size: var(--g-text-body-2-font-size);
10
+ line-height: var(--g-text-body-2-line-height);
12
11
  }
13
12
  .g-aikit-thinking-message-group__compact-toggle {
14
13
  align-self: flex-start;
@@ -19,8 +18,8 @@
19
18
  text-align: start;
20
19
  line-height: inherit;
21
20
  --g-button-padding: 0;
22
- --g-button-font-size: var(--g-text-body-1-font-size);
23
- --g-button-text-color: var(--g-color-text-primary);
21
+ --g-button-font-size: var(--g-text-body-2-font-size);
22
+ --g-button-text-color: var(--g-color-text-complementary);
24
23
  --g-button-text-color-hover: var(--g-color-text-primary);
25
24
  --g-button-background-color-hover: transparent;
26
25
  }
@@ -31,8 +30,8 @@
31
30
  gap: calc(var(--g-spacing-1) / 2);
32
31
  min-width: 0;
33
32
  max-width: 100%;
34
- color: var(--g-color-text-primary);
35
- line-height: var(--g-text-body-1-line-height);
33
+ color: var(--g-color-text-complementary);
34
+ line-height: var(--g-text-body-2-line-height);
36
35
  }
37
36
  .g-aikit-thinking-message-group__compact-header, .g-aikit-thinking-message-group__compact-current {
38
37
  display: flex;
@@ -110,7 +109,7 @@
110
109
  justify-content: center;
111
110
  align-items: center;
112
111
  width: 16px;
113
- height: var(--g-text-body-1-line-height);
112
+ height: var(--g-text-body-2-line-height);
114
113
  color: var(--g-color-text-secondary);
115
114
  }
116
115
  .g-aikit-thinking-message-group__step-marker_status_error {
@@ -132,9 +131,12 @@
132
131
  gap: var(--g-spacing-1);
133
132
  }
134
133
  .g-aikit-thinking-message-group__step-title {
135
- color: var(--g-color-text-secondary);
136
- font-size: var(--g-text-body-1-font-size);
137
- line-height: var(--g-text-body-1-line-height);
134
+ color: var(--g-color-text-complementary);
135
+ font-size: var(--g-text-body-2-font-size);
136
+ line-height: var(--g-text-body-2-line-height);
137
+ }
138
+ .g-aikit-thinking-message-group__step-title_active {
139
+ color: var(--g-color-text-primary);
138
140
  }
139
141
  .g-aikit-thinking-message-group__step-meta {
140
142
  display: flex;
@@ -147,7 +149,7 @@
147
149
  .g-aikit-thinking-message-group__step-icon {
148
150
  width: 16px;
149
151
  }
150
- .g-aikit-thinking-message-group__compact-label_error, .g-aikit-thinking-message-group__step-icon_error, .g-aikit-thinking-message-group__step-status_error, .g-aikit-thinking-message-group__step-title_error {
152
+ .g-aikit-thinking-message-group__compact-label_error, .g-aikit-thinking-message-group__step-icon_error, .g-aikit-thinking-message-group__step-status_error {
151
153
  color: var(--g-color-text-danger);
152
154
  }
153
155
  .g-aikit-thinking-message-group__step-details {
@@ -165,47 +167,14 @@
165
167
  overflow-x: auto;
166
168
  color: var(--g-color-text-secondary);
167
169
  font-size: var(--g-text-body-1-font-size);
168
- line-height: var(--g-text-body-1-line-height);
170
+ line-height: var(--g-text-body-2-line-height);
169
171
  --yfm-font-size: var(--g-text-body-1-font-size);
170
- --yfm-font-line-height: var(--g-text-body-1-line-height);
172
+ --yfm-font-line-height: var(--g-text-body-2-line-height);
171
173
  }
172
174
  .g-aikit-thinking-message-group__step-content_plain {
173
175
  white-space: pre-wrap;
174
176
  }
175
177
 
176
- .g-aikit-thinking-message-group_without-icons .g-aikit-thinking-message-group__step {
177
- grid-template-columns: minmax(0, 1fr);
178
- }
179
- .g-aikit-thinking-message-group_without-icons .g-aikit-thinking-message-group__step::before {
180
- display: none;
181
- }
182
- .g-aikit-thinking-message-group_without-icons .g-aikit-thinking-message-group__step-marker_hidden {
183
- position: absolute;
184
- width: 1px;
185
- height: 1px;
186
- padding: 0;
187
- margin: -1px;
188
- overflow: hidden;
189
- clip-path: inset(50%);
190
- white-space: nowrap;
191
- border: 0;
192
- }
193
-
194
- .g-aikit-thinking-message-group .g-aikit-thinking-message-group__step-details .g-aikit-thinking-message-group__step-content {
195
- --yfm-font-size: var(--g-text-body-1-font-size);
196
- --yfm-font-line-height: var(--g-text-body-1-line-height);
197
- --yfm-color-text: var(--g-color-text-secondary);
198
- --yfm-font-size-h4: var(--g-text-body-1-font-size);
199
- --yfm-font-line-height-h4: var(--g-text-body-1-line-height);
200
- --yfm-font-size-h5: var(--g-text-body-1-font-size);
201
- --yfm-font-line-height-h5: var(--g-text-body-1-line-height);
202
- --yfm-font-size-h6: var(--g-text-body-1-font-size);
203
- --yfm-font-line-height-h6: var(--g-text-body-1-line-height);
204
- color: var(--g-color-text-secondary);
205
- font-size: var(--g-text-body-1-font-size);
206
- line-height: var(--g-text-body-1-line-height);
207
- }
208
-
209
178
  @keyframes thinking-message-group-pulse {
210
179
  0%, 100% {
211
180
  opacity: 1;
@@ -12,15 +12,10 @@ import { StepIcon } from "./StepIcon.js";
12
12
  import { i18n } from "./i18n/index.js";
13
13
  import "./ThinkingMessageGroup.css";
14
14
  const b = block('thinking-message-group');
15
- function shouldShowStatus(step, iconMode, hasContent) {
16
- if (step.status === 'thinking' || step.status === 'thought')
17
- return false;
18
- return iconMode === 'none' && Boolean(step.title || hasContent);
19
- }
20
15
  export function ThinkingMessageGroup(props) {
21
16
  var _a, _b;
22
17
  const { t } = i18n.useTranslation();
23
- const { steps, iconMode = 'status', activeStepLabel, stepTypes, status = (_b = (_a = steps[steps.length - 1]) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'thought', activeStepId, expanded, defaultExpanded = false, maxHistoryHeight = 480, onExpandedChange, renderSummary, renderStepContent, className, qa, style, format = 'plain', transformOptions, mermaidOptions, openMarkdownLinksInNewTab, mdxOptions, mdxContext, markdownExtraProps, } = props;
18
+ const { steps, stepTypes, status = (_b = (_a = steps[steps.length - 1]) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'thought', activeStepId, expanded, defaultExpanded = false, maxHistoryHeight = 480, onExpandedChange, renderSummary, renderStepContent, className, qa, style, format = 'plain', transformOptions, mermaidOptions, openMarkdownLinksInNewTab, mdxOptions, mdxContext, markdownExtraProps, } = props;
24
19
  const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
25
20
  const detailsId = useId();
26
21
  const headingId = `${detailsId}-heading`;
@@ -51,20 +46,18 @@ export function ThinkingMessageGroup(props) {
51
46
  };
52
47
  const defaultSummary = completedSteps.length > 0 ? t('completed-steps', { count: completedSteps.length }) : null;
53
48
  const summary = renderSummary ? renderSummary(completedSteps) : defaultSummary;
54
- const heading = (_jsx(CompactHeading, { activeStep: activeStep, stepTypes: stepTypes, iconMode: iconMode, activeStepLabel: activeStepLabel, status: status, summary: summary, hasDetails: hasDetails, isExpanded: isExpanded }));
55
- return (_jsxs("div", { className: b({ 'without-icons': iconMode === 'none' }, className), "data-qa": qa, style: style, children: [hasDetails ? (_jsx(Button, { id: headingId, className: b('compact-toggle'), view: "flat-secondary", width: "auto", onClick: toggleExpanded, "aria-expanded": isExpanded, "aria-controls": isExpanded ? detailsId : undefined, children: heading })) : (_jsx("div", { className: b('compact-header'), children: heading })), hasDetails && isExpanded && (_jsx("ol", { className: b('steps'), id: detailsId, "aria-labelledby": headingId, tabIndex: 0, style: { maxHeight: maxHistoryHeight }, children: steps.map((step) => {
49
+ const heading = (_jsx(CompactHeading, { activeStep: activeStep, stepTypes: stepTypes, status: status, summary: summary, hasDetails: hasDetails, isExpanded: isExpanded }));
50
+ return (_jsxs("div", { className: b(null, className), "data-qa": qa, style: style, children: [hasDetails ? (_jsx(Button, { id: headingId, className: b('compact-toggle'), view: "flat-secondary", width: "auto", onClick: toggleExpanded, "aria-expanded": isExpanded, "aria-controls": isExpanded ? detailsId : undefined, children: heading })) : (_jsx("div", { className: b('compact-header'), children: heading })), hasDetails && isExpanded && (_jsx("ol", { className: b('steps'), id: detailsId, "aria-labelledby": headingId, tabIndex: 0, style: { maxHeight: maxHistoryHeight }, children: steps.map((step) => {
56
51
  const type = stepTypes === null || stepTypes === void 0 ? void 0 : stepTypes[step.type];
57
- const typeLabel = type === null || type === void 0 ? void 0 : type.label;
58
52
  const content = Array.isArray(step.content) ? step.content : [step.content];
59
- const hasContent = Boolean(renderStepContent) || content.some(Boolean);
60
- const showTitle = Boolean(step.title) || !hasContent;
61
- const showStatus = shouldShowStatus(step, iconMode, hasContent);
62
- return (_jsxs("li", { className: b('step'), children: [_jsx("span", { className: b('step-marker', {
63
- status: step.status,
64
- hidden: iconMode === 'none',
65
- }), role: "img", "aria-label": t(`status-${step.status}`), children: _jsx(StepIcon, { status: step.status, operationIcon: type === null || type === void 0 ? void 0 : type.icon, iconMode: iconMode }) }), _jsxs("div", { className: b('step-body'), children: [showTitle && (_jsx(Text, { className: b('step-title', {
66
- error: step.status === 'error' && !step.title,
67
- }), children: step.title || t(`status-${step.status}`) })), (typeLabel || showStatus) && (_jsxs("span", { className: b('step-meta'), children: [typeLabel && _jsx("span", { children: typeLabel }), showStatus && (_jsx("span", { className: b('step-status', {
53
+ return (_jsxs("li", { className: b('step'), children: [_jsx("span", { className: b('step-marker', { status: step.status }), role: "img", "aria-label": t(`status-${step.status}`), children: _jsx(StepIcon, { status: step.status, operationIcon: type === null || type === void 0 ? void 0 : type.icon }) }), _jsxs("div", { className: b('step-body'), children: [_jsx(Text, { className: b('step-title', {
54
+ active: step.id === (activeStep === null || activeStep === void 0 ? void 0 : activeStep.id) &&
55
+ step.status === 'thinking' &&
56
+ isThinking,
57
+ }), children: step.title || t(`status-${step.status}`) }), ((type === null || type === void 0 ? void 0 : type.label) ||
58
+ (step.status !== 'thinking' &&
59
+ step.status !== 'thought')) && (_jsxs("span", { className: b('step-meta'), children: [(type === null || type === void 0 ? void 0 : type.label) && _jsx("span", { children: type.label }), step.status !== 'thinking' &&
60
+ step.status !== 'thought' && (_jsx("span", { className: b('step-status', {
68
61
  error: step.status === 'error',
69
62
  }), children: t(`status-${step.status}`) }))] })), _jsx("div", { className: b('step-details'), children: renderStepContent
70
63
  ? renderStepContent(step)
@@ -1 +1 @@
1
- {"version":3,"file":"ThinkingMessageGroup.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAC,eAAe,EAAC,yCAAsC;AAC9D,OAAO,EAAC,KAAK,EAAC,6BAA0B;AACxC,OAAO,EAAC,YAAY,EAAC,0CAAiC;AACtD,OAAO,EAAC,gBAAgB,EAAC,8CAAqC;AAE9D,OAAO,EAAC,cAAc,EAAC,4BAAyB;AAChD,OAAO,EAAC,QAAQ,EAAC,sBAAmB;AACpC,OAAO,EAAC,IAAI,EAAC,wBAAe;AAG5B,oCAAqC;AAErC,MAAM,CAAC,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAE1C,SAAS,gBAAgB,CACrB,IAAkB,EAClB,QAA+C,EAC/C,UAAmB;IAEnB,IAAI,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAC1E,OAAO,QAAQ,KAAK,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,UAAU,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAgC;;IACjE,MAAM,EAAC,CAAC,EAAC,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IAClC,MAAM,EACF,KAAK,EACL,QAAQ,GAAG,QAAQ,EACnB,eAAe,EACf,SAAS,EACT,MAAM,GAAG,MAAA,MAAA,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,MAAM,mCAAI,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,IAAI,EAAE,IAAI,EAAE,EAAE,GAAI,GACnB,CAClB,IACH,KA7FqB,IAAI,CAAC,EAAE,CA8FjC,CACR,CAAC;gBACN,CAAC,CAAC,GACD,CACR,IACC,CACT,CAAC;AACN,CAAC","sourcesContent":["'use client';\n\nimport {useId, useState} from 'react';\n\nimport {Copy} from '@gravity-ui/icons';\nimport {Button, Icon, Text} from '@gravity-ui/uikit';\n\nimport {copyToClipboard} from '../../../utils/clipboardUtils';\nimport {block} from '../../../utils/cn';\nimport {ActionButton} from '../../atoms/ActionButton';\nimport {MarkdownRenderer} from '../../atoms/MarkdownRenderer';\n\nimport {CompactHeading} from './CompactHeading';\nimport {StepIcon} from './StepIcon';\nimport {i18n} from './i18n';\nimport type {ThinkingMessageGroupProps, ThinkingStep} from './types';\n\nimport './ThinkingMessageGroup.scss';\n\nconst b = block('thinking-message-group');\n\nfunction shouldShowStatus(\n step: ThinkingStep,\n iconMode: ThinkingMessageGroupProps['iconMode'],\n hasContent: boolean,\n) {\n if (step.status === 'thinking' || step.status === 'thought') return false;\n return iconMode === 'none' && Boolean(step.title || hasContent);\n}\n\nexport function ThinkingMessageGroup(props: ThinkingMessageGroupProps) {\n const {t} = i18n.useTranslation();\n const {\n steps,\n iconMode = 'status',\n activeStepLabel,\n stepTypes,\n status = steps[steps.length - 1]?.status ?? 'thought',\n activeStepId,\n expanded,\n defaultExpanded = false,\n maxHistoryHeight = 480,\n onExpandedChange,\n renderSummary,\n renderStepContent,\n className,\n qa,\n style,\n format = 'plain',\n transformOptions,\n mermaidOptions,\n openMarkdownLinksInNewTab,\n mdxOptions,\n mdxContext,\n markdownExtraProps,\n } = props;\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const detailsId = useId();\n const headingId = `${detailsId}-heading`;\n const isExpanded = expanded ?? internalExpanded;\n const activeStep =\n activeStepId === undefined\n ? [...steps].reverse().find((step) => step.status === 'thinking')\n : steps.find((step) => step.id === activeStepId);\n const completedSteps = steps.filter((step) => step.status === 'thought');\n const isThinking = status === 'thinking';\n const hasDetails =\n !isThinking ||\n steps.length > 1 ||\n Boolean(renderStepContent) ||\n steps.some((step) => {\n const content = Array.isArray(step.content) ? step.content : [step.content];\n return (\n Boolean(stepTypes?.[step.type]?.label || step.enabledCopy || step.onCopyClick) ||\n content.some(Boolean)\n );\n });\n\n if (steps.length === 0) {\n return null;\n }\n\n const toggleExpanded = () => {\n const nextExpanded = !isExpanded;\n if (expanded === undefined) {\n setInternalExpanded(nextExpanded);\n }\n onExpandedChange?.(nextExpanded);\n };\n\n const defaultSummary =\n completedSteps.length > 0 ? t('completed-steps', {count: completedSteps.length}) : null;\n const summary = renderSummary ? renderSummary(completedSteps) : defaultSummary;\n const heading = (\n <CompactHeading\n activeStep={activeStep}\n stepTypes={stepTypes}\n iconMode={iconMode}\n activeStepLabel={activeStepLabel}\n status={status}\n summary={summary}\n hasDetails={hasDetails}\n isExpanded={isExpanded}\n />\n );\n\n return (\n <div\n className={b({'without-icons': iconMode === 'none'}, className)}\n data-qa={qa}\n style={style}\n >\n {hasDetails ? (\n <Button\n id={headingId}\n className={b('compact-toggle')}\n view=\"flat-secondary\"\n width=\"auto\"\n onClick={toggleExpanded}\n aria-expanded={isExpanded}\n aria-controls={isExpanded ? detailsId : undefined}\n >\n {heading}\n </Button>\n ) : (\n <div className={b('compact-header')}>{heading}</div>\n )}\n {hasDetails && isExpanded && (\n <ol\n className={b('steps')}\n id={detailsId}\n aria-labelledby={headingId}\n tabIndex={0}\n style={{maxHeight: maxHistoryHeight}}\n >\n {steps.map((step) => {\n const type = stepTypes?.[step.type];\n const typeLabel = type?.label;\n const content = Array.isArray(step.content) ? step.content : [step.content];\n const hasContent = Boolean(renderStepContent) || content.some(Boolean);\n const showTitle = Boolean(step.title) || !hasContent;\n const showStatus = shouldShowStatus(step, iconMode, hasContent);\n return (\n <li className={b('step')} key={step.id}>\n <span\n className={b('step-marker', {\n status: step.status,\n hidden: iconMode === 'none',\n })}\n role=\"img\"\n aria-label={t(`status-${step.status}`)}\n >\n <StepIcon\n status={step.status}\n operationIcon={type?.icon}\n iconMode={iconMode}\n />\n </span>\n <div className={b('step-body')}>\n {showTitle && (\n <Text\n className={b('step-title', {\n error: step.status === 'error' && !step.title,\n })}\n >\n {step.title || t(`status-${step.status}`)}\n </Text>\n )}\n {(typeLabel || showStatus) && (\n <span className={b('step-meta')}>\n {typeLabel && <span>{typeLabel}</span>}\n {showStatus && (\n <span\n className={b('step-status', {\n error: step.status === 'error',\n })}\n >\n {t(`status-${step.status}`)}\n </span>\n )}\n </span>\n )}\n <div className={b('step-details')}>\n {renderStepContent\n ? renderStepContent(step)\n : content.map((item, index) => {\n if (!item) {\n return null;\n }\n if (format === 'markdown') {\n return (\n <MarkdownRenderer\n className={b('step-content')}\n key={index}\n content={item}\n transformOptions={{\n disableCommonAnchors: true,\n ...transformOptions,\n }}\n mermaidOptions={mermaidOptions}\n openLinksInNewTab={\n openMarkdownLinksInNewTab\n }\n mdxOptions={mdxOptions}\n mdxContext={mdxContext}\n extraProps={markdownExtraProps}\n />\n );\n }\n return (\n <Text\n className={b('step-content', {\n plain: true,\n })}\n key={index}\n >\n {item}\n </Text>\n );\n })}\n </div>\n {step.status !== 'thinking' &&\n (step.enabledCopy || step.onCopyClick) && (\n <ActionButton\n size=\"xs\"\n aria-label={t('copy')}\n tooltipTitle={t('copy')}\n className={b('copy')}\n onClick={() => {\n if (step.onCopyClick) step.onCopyClick();\n else copyToClipboard(step.content ?? '');\n }}\n >\n <Icon data={Copy} size={14} />\n </ActionButton>\n )}\n </div>\n </li>\n );\n })}\n </ol>\n )}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"ThinkingMessageGroup.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAC,IAAI,EAA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IAAI,CAAC,MAAM,KAAK,UAAU;wCACvB,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CACtC,KAAC,YAAY,IACT,IAAI,EAAC,IAAI,gBACG,CAAC,CAAC,MAAM,CAAC,EACrB,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,EACvB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EACpB,OAAO,EAAE,GAAG,EAAE;;4CACV,IAAI,IAAI,CAAC,WAAW;gDAAE,IAAI,CAAC,WAAW,EAAE,CAAC;;gDACpC,eAAe,CAAC,MAAA,IAAI,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC;wCAC7C,CAAC,YAED,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,GAAI,GACnB,CAClB,IACH,KA1FqB,IAAI,CAAC,EAAE,CA2FjC,CACR,CAAC;gBACN,CAAC,CAAC,GACD,CACR,IACC,CACT,CAAC;AACN,CAAC","sourcesContent":["'use client';\n\nimport {useId, useState} from 'react';\n\nimport {Copy} from '@gravity-ui/icons';\nimport {Button, Icon, Text} from '@gravity-ui/uikit';\n\nimport {copyToClipboard} from '../../../utils/clipboardUtils';\nimport {block} from '../../../utils/cn';\nimport {ActionButton} from '../../atoms/ActionButton';\nimport {MarkdownRenderer} from '../../atoms/MarkdownRenderer';\n\nimport {CompactHeading} from './CompactHeading';\nimport {StepIcon} from './StepIcon';\nimport {i18n} from './i18n';\nimport type {ThinkingMessageGroupProps} from './types';\n\nimport './ThinkingMessageGroup.scss';\n\nconst b = block('thinking-message-group');\n\nexport function ThinkingMessageGroup(props: ThinkingMessageGroupProps) {\n const {t} = i18n.useTranslation();\n const {\n steps,\n stepTypes,\n status = steps[steps.length - 1]?.status ?? 'thought',\n activeStepId,\n expanded,\n defaultExpanded = false,\n maxHistoryHeight = 480,\n onExpandedChange,\n renderSummary,\n renderStepContent,\n className,\n qa,\n style,\n format = 'plain',\n transformOptions,\n mermaidOptions,\n openMarkdownLinksInNewTab,\n mdxOptions,\n mdxContext,\n markdownExtraProps,\n } = props;\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const detailsId = useId();\n const headingId = `${detailsId}-heading`;\n const isExpanded = expanded ?? internalExpanded;\n const activeStep =\n activeStepId === undefined\n ? [...steps].reverse().find((step) => step.status === 'thinking')\n : steps.find((step) => step.id === activeStepId);\n const completedSteps = steps.filter((step) => step.status === 'thought');\n const isThinking = status === 'thinking';\n const hasDetails =\n !isThinking ||\n steps.length > 1 ||\n Boolean(renderStepContent) ||\n steps.some((step) => {\n const content = Array.isArray(step.content) ? step.content : [step.content];\n return (\n Boolean(stepTypes?.[step.type]?.label || step.enabledCopy || step.onCopyClick) ||\n content.some(Boolean)\n );\n });\n\n if (steps.length === 0) {\n return null;\n }\n\n const toggleExpanded = () => {\n const nextExpanded = !isExpanded;\n if (expanded === undefined) {\n setInternalExpanded(nextExpanded);\n }\n onExpandedChange?.(nextExpanded);\n };\n\n const defaultSummary =\n completedSteps.length > 0 ? t('completed-steps', {count: completedSteps.length}) : null;\n const summary = renderSummary ? renderSummary(completedSteps) : defaultSummary;\n const heading = (\n <CompactHeading\n activeStep={activeStep}\n stepTypes={stepTypes}\n status={status}\n summary={summary}\n hasDetails={hasDetails}\n isExpanded={isExpanded}\n />\n );\n\n return (\n <div className={b(null, className)} data-qa={qa} style={style}>\n {hasDetails ? (\n <Button\n id={headingId}\n className={b('compact-toggle')}\n view=\"flat-secondary\"\n width=\"auto\"\n onClick={toggleExpanded}\n aria-expanded={isExpanded}\n aria-controls={isExpanded ? detailsId : undefined}\n >\n {heading}\n </Button>\n ) : (\n <div className={b('compact-header')}>{heading}</div>\n )}\n {hasDetails && isExpanded && (\n <ol\n className={b('steps')}\n id={detailsId}\n aria-labelledby={headingId}\n tabIndex={0}\n style={{maxHeight: maxHistoryHeight}}\n >\n {steps.map((step) => {\n const type = stepTypes?.[step.type];\n const content = Array.isArray(step.content) ? step.content : [step.content];\n return (\n <li className={b('step')} key={step.id}>\n <span\n className={b('step-marker', {status: step.status})}\n role=\"img\"\n aria-label={t(`status-${step.status}`)}\n >\n <StepIcon status={step.status} operationIcon={type?.icon} />\n </span>\n <div className={b('step-body')}>\n <Text\n className={b('step-title', {\n active:\n step.id === activeStep?.id &&\n step.status === 'thinking' &&\n isThinking,\n })}\n >\n {step.title || t(`status-${step.status}`)}\n </Text>\n {(type?.label ||\n (step.status !== 'thinking' &&\n step.status !== 'thought')) && (\n <span className={b('step-meta')}>\n {type?.label && <span>{type.label}</span>}\n {step.status !== 'thinking' &&\n step.status !== 'thought' && (\n <span\n className={b('step-status', {\n error: step.status === 'error',\n })}\n >\n {t(`status-${step.status}`)}\n </span>\n )}\n </span>\n )}\n <div className={b('step-details')}>\n {renderStepContent\n ? renderStepContent(step)\n : content.map((item, index) => {\n if (!item) {\n return null;\n }\n if (format === 'markdown') {\n return (\n <MarkdownRenderer\n className={b('step-content')}\n key={index}\n content={item}\n transformOptions={{\n disableCommonAnchors: true,\n ...transformOptions,\n }}\n mermaidOptions={mermaidOptions}\n openLinksInNewTab={\n openMarkdownLinksInNewTab\n }\n mdxOptions={mdxOptions}\n mdxContext={mdxContext}\n extraProps={markdownExtraProps}\n />\n );\n }\n return (\n <Text\n className={b('step-content', {\n plain: true,\n })}\n key={index}\n >\n {item}\n </Text>\n );\n })}\n </div>\n {step.status !== 'thinking' &&\n (step.enabledCopy || step.onCopyClick) && (\n <ActionButton\n size=\"xs\"\n aria-label={t('copy')}\n tooltipTitle={t('copy')}\n className={b('copy')}\n onClick={() => {\n if (step.onCopyClick) step.onCopyClick();\n else copyToClipboard(step.content ?? '');\n }}\n >\n <Icon data={Copy} size={14} />\n </ActionButton>\n )}\n </div>\n </li>\n );\n })}\n </ol>\n )}\n </div>\n );\n}\n"]}
@@ -14,7 +14,7 @@ export interface ThinkingStep {
14
14
  onCopyClick?: () => void;
15
15
  }
16
16
  export interface ThinkingStepType {
17
- /** Operation icon used with iconMode="type" while thinking and after completion; other states use their status icon. */
17
+ /** Operation icon shown while thinking and after completion; error, paused, and cancelled states use their status icon. */
18
18
  icon?: ReactNode;
19
19
  /** Shown only in the expanded history. */
20
20
  label?: string;
@@ -22,10 +22,6 @@ export interface ThinkingStepType {
22
22
  export interface ThinkingMessageGroupProps extends Pick<ThinkingMessageProps, 'format' | 'transformOptions' | 'mermaidOptions' | 'openMarkdownLinksInNewTab' | 'mdxOptions' | 'mdxContext' | 'markdownExtraProps' | 'className' | 'qa' | 'style'> {
23
23
  /** Ordered, accumulated steps supplied by the application. */
24
24
  steps: readonly ThinkingStep[];
25
- /** Defaults to status icons. Use type for application-supplied category icons. */
26
- iconMode?: 'type' | 'status' | 'none';
27
- /** Plain-text running heading supplied by the application; overrides the active step title. */
28
- activeStepLabel?: string;
29
25
  stepTypes?: Readonly<Record<string, ThinkingStepType>>;
30
26
  /** Defaults to the last step's status. Explicit run status takes precedence. */
31
27
  status?: ThinkingStepStatus;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {CSSProperties, ReactNode} from 'react';\n\nimport type {ThinkingMessageProps} from '../ThinkingMessage';\n\n/** Execution state is independent of the application-defined category. */\nexport type ThinkingStepStatus = 'thinking' | 'thought' | 'error' | 'cancelled' | 'paused';\n\nexport interface ThinkingStep {\n /** Stable identity across streaming updates. */\n id: string;\n type: string;\n title?: string;\n status: ThinkingStepStatus;\n /** Paragraphs belonging to this step, not separate actions. */\n content?: string | string[];\n enabledCopy?: boolean;\n onCopyClick?: () => void;\n}\n\nexport interface ThinkingStepType {\n /** Operation icon used with iconMode=\"type\" while thinking and after completion; other states use their status icon. */\n icon?: ReactNode;\n /** Shown only in the expanded history. */\n label?: string;\n}\n\nexport interface ThinkingMessageGroupProps\n extends Pick<\n ThinkingMessageProps,\n | 'format'\n | 'transformOptions'\n | 'mermaidOptions'\n | 'openMarkdownLinksInNewTab'\n | 'mdxOptions'\n | 'mdxContext'\n | 'markdownExtraProps'\n | 'className'\n | 'qa'\n | 'style'\n > {\n /** Ordered, accumulated steps supplied by the application. */\n steps: readonly ThinkingStep[];\n /** Defaults to status icons. Use type for application-supplied category icons. */\n iconMode?: 'type' | 'status' | 'none';\n /** Plain-text running heading supplied by the application; overrides the active step title. */\n activeStepLabel?: string;\n stepTypes?: Readonly<Record<string, ThinkingStepType>>;\n /** Defaults to the last step's status. Explicit run status takes precedence. */\n status?: ThinkingStepStatus;\n /** Defaults to the last thinking step while the group is running. */\n activeStepId?: string;\n expanded?: boolean;\n defaultExpanded?: boolean;\n /** Maximum expanded history height. Defaults to 480px; use \"none\" to disable the limit. */\n maxHistoryHeight?: CSSProperties['maxHeight'];\n onExpandedChange?: (expanded: boolean) => void;\n renderSummary?: (completedSteps: ThinkingStep[]) => ReactNode;\n renderStepContent?: (step: ThinkingStep) => ReactNode;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"../../../../../src","sources":["components/organisms/ThinkingMessageGroup/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {CSSProperties, ReactNode} from 'react';\n\nimport type {ThinkingMessageProps} from '../ThinkingMessage';\n\n/** Execution state is independent of the application-defined category. */\nexport type ThinkingStepStatus = 'thinking' | 'thought' | 'error' | 'cancelled' | 'paused';\n\nexport interface ThinkingStep {\n /** Stable identity across streaming updates. */\n id: string;\n type: string;\n title?: string;\n status: ThinkingStepStatus;\n /** Paragraphs belonging to this step, not separate actions. */\n content?: string | string[];\n enabledCopy?: boolean;\n onCopyClick?: () => void;\n}\n\nexport interface ThinkingStepType {\n /** Operation icon shown while thinking and after completion; error, paused, and cancelled states use their status icon. */\n icon?: ReactNode;\n /** Shown only in the expanded history. */\n label?: string;\n}\n\nexport interface ThinkingMessageGroupProps\n extends Pick<\n ThinkingMessageProps,\n | 'format'\n | 'transformOptions'\n | 'mermaidOptions'\n | 'openMarkdownLinksInNewTab'\n | 'mdxOptions'\n | 'mdxContext'\n | 'markdownExtraProps'\n | 'className'\n | 'qa'\n | 'style'\n > {\n /** Ordered, accumulated steps supplied by the application. */\n steps: readonly ThinkingStep[];\n stepTypes?: Readonly<Record<string, ThinkingStepType>>;\n /** Defaults to the last step's status. Explicit run status takes precedence. */\n status?: ThinkingStepStatus;\n /** Defaults to the last thinking step while the group is running. */\n activeStepId?: string;\n expanded?: boolean;\n defaultExpanded?: boolean;\n /** Maximum expanded history height. Defaults to 480px; use \"none\" to disable the limit. */\n maxHistoryHeight?: CSSProperties['maxHeight'];\n onExpandedChange?: (expanded: boolean) => void;\n renderSummary?: (completedSteps: ThinkingStep[]) => ReactNode;\n renderStepContent?: (step: ThinkingStep) => ReactNode;\n}\n"]}
@@ -1 +1 @@
1
- {"version":"3.0.1-beta.f7461335625c068858baeb9c24f602de088b4093.0","type":"module","sideEffects":["*.css","*.scss"]}
1
+ {"version":"3.0.1","type":"module","sideEffects":["*.css","*.scss"]}
@@ -0,0 +1,45 @@
1
+ # Releasing AIKit 2 and 3
2
+
3
+ | Branch | Stable npm tag | PR preview tag | Dependencies |
4
+ | ------------ | -------------- | -------------- | ------------ |
5
+ | `main` | `latest` | `beta-v3` | UIKit 8 |
6
+ | `release/v2` | `v2` | `beta-v2` | UIKit 7 |
7
+
8
+ Versions and changelogs advance independently. A shared feature can ship as 3.1.0 and 2.29.0. Releases are not an atomic operation across branches.
9
+
10
+ ## One-time setup
11
+
12
+ 1. Apply the workflow changes to the current `main` (AIKit 3), not the old 2.28.0 checkout.
13
+ 2. Create `release/v2` from `v2.28.0`. Copy the release infrastructure changes to it, including `scripts/release/check-major.cjs`. Keep its package manifests, changelog, source code and UIKit 7 dependencies. Do not merge `main` into this branch. On `main`, keep the UIKit matrix `[locked, '8.0.0']`; on `release/v2`, use `[locked]` to test its UIKit 7 lockfile. Keep the aggregate `Tests` job on both branches so branch protection uses the same check name.
14
+ 3. Create the `backport-v2` label. Enable squash merging and GitHub's **Allow auto-merge** repository setting.
15
+ 4. Protect both branches. Inspect active repository rulesets as well as classic branch protection; preserve existing review and merge-queue requirements. Require `Release Major`, `Verify Files`, `Tests`, `Visual Tests` and `Lint PR Title`, with checks against the latest base branch. Do not allow the automation app to bypass checks. Additional required human reviews will still require human approval; auto-merge does not bypass them.
16
+ 5. Ensure the existing Gravity UI app has contents and pull request write permissions on this repository. Its installation token creates PRs so their CI workflows run.
17
+ 6. Set repository variable `RELEASE_BOT_LOGIN` to the exact login of the app account that creates release-please PRs (including `[bot]` when present). The verified author of release PR #288 is `gravity-ui[bot]`; recheck the author if the app installation changes.
18
+ 7. Verify that all five required check names have reported on a PR into each branch, including the aggregate `Tests` job. Only after branch protection is configured, set repository variable `RELEASE_AUTOMERGE` to `true`. Until then backport and release PRs require manual merging.
19
+ 8. Test one compatible fix end to end. Verify that the backport checks run against UIKit 7 and that publishing 2.x leaves npm `latest` pointing to 3.x.
20
+
21
+ ## Daily workflow
22
+
23
+ - Develop changes in a PR targeting `main`, using a conventional `feat:` or `fix:` title and squash merge.
24
+ - Add `backport-v2` when the change should also ship in AIKit 2. The label can be added before or after merging.
25
+ - After merging, release-please prepares the 3.x release PR. Backport automation separately creates a PR into `release/v2`, preserving the original title for version calculation.
26
+ - With auto-merge enabled, compatible backports and release PRs merge once required checks and reviews pass. Each branch then publishes its own release.
27
+ - Do not label release PRs for backport. Version bumps, changelogs, breaking changes and UIKit 8 migrations must not be copied to 2.x.
28
+
29
+ The privileged backport workflow checks out the trusted base branch and never installs dependencies or runs PR scripts. PR validation runs in normal pull request workflows.
30
+
31
+ ## Conflicts and compatibility
32
+
33
+ A clean cherry-pick is not proof of UIKit 7 compatibility. Both branches must run build, type, unit and visual checks. Visual tests use the existing Playwright container workflow.
34
+
35
+ If cherry-picking fails, the backport workflow fails and the action reports the conflict on the original PR. Manually cherry-pick/adapt the change into a branch based on `release/v2` and open a normal PR with a conventional title. The 3.x release continues independently. Never resolve conflicts by copying the 3.x package manifest or lockfile over 2.x.
36
+
37
+ `Release Major` rejects prereleases, mismatched lockfile versions and unexpected majors. A breaking change intended for a new major needs an explicit update of the branch policy; it cannot silently turn `release/v2` into 3.x or `main` into 4.x.
38
+
39
+ ## Operational notes
40
+
41
+ - The existing release action remains responsible for version calculation, changelog generation and publication. Only release PRs from the configured bot, with the expected branch prefix and release label, changing only manifests and changelog are eligible for automatic merging.
42
+ - Publishing runs are serialized per branch. A failure in one release line does not block the other.
43
+ - PR prereleases validate the base branch and stable package/lockfile versions before changing the version or publishing. Only PRs into `main` and `release/v2` publish previews. PR prereleases use separate `beta-v2` and `beta-v3` tags. Install the exact version from the PR for reproducible testing; each tag points to the most recently published preview in that release line.
44
+ - If npm publication fails after a GitHub release was created, inspect npm before retrying. The existing release action does not guarantee a retry will republish an already-created release. Publish the missing version from its exact release tag through the project's authorized recovery process; never bump merely to retry or republish an existing version.
45
+ - To pause automatic merging, set `RELEASE_AUTOMERGE` to `false`. This does not cancel already-enabled GitHub auto-merge requests; disable those on the affected PRs as well.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/aikit",
3
- "version": "3.0.1-beta.f7461335625c068858baeb9c24f602de088b4093.0",
3
+ "version": "3.0.1",
4
4
  "description": "Gravity UI base kit for building ai assistant chats",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",