@gravity-ui/aikit 2.38.1-beta.df52c45a6db1e66eee61ce9dcc820bb1cecade7e.0 → 2.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/components/internal/CompactRow/CompactRow.css +6 -0
- package/build/cjs/components/internal/CompactRow/CompactRow.d.ts +3 -1
- package/build/cjs/components/internal/CompactRow/CompactRow.js +8 -2
- package/build/cjs/components/internal/CompactRow/CompactRow.js.map +1 -1
- package/build/cjs/components/internal/ThinkingMessage/ThinkingMessageView.js +1 -1
- package/build/cjs/components/internal/ThinkingMessage/ThinkingMessageView.js.map +1 -1
- package/build/cjs/components/molecules/ChangedFilesSummary/ChangedFilesSummary.css +18 -17
- package/build/cjs/components/molecules/ChangedFilesSummary/index.js +1 -1
- package/build/cjs/components/molecules/ChangedFilesSummary/index.js.map +1 -1
- package/build/cjs/components/molecules/PlanProgress/PlanProgress.css +134 -0
- package/build/cjs/components/molecules/PlanProgress/PlanProgress.d.ts +36 -0
- package/build/cjs/components/molecules/PlanProgress/PlanProgress.js +51 -0
- package/build/cjs/components/molecules/PlanProgress/PlanProgress.js.map +1 -0
- package/build/cjs/components/molecules/PlanProgress/i18n/en.json +16 -0
- package/build/cjs/components/molecules/PlanProgress/i18n/index.d.ts +13 -0
- package/build/cjs/components/molecules/PlanProgress/i18n/index.js +9 -0
- package/build/cjs/components/molecules/PlanProgress/i18n/index.js.map +1 -0
- package/build/cjs/components/molecules/PlanProgress/i18n/ru.json +16 -0
- package/build/cjs/components/molecules/PlanProgress/index.d.ts +2 -0
- package/build/cjs/components/molecules/PlanProgress/index.js +7 -0
- package/build/cjs/components/molecules/PlanProgress/index.js.map +1 -0
- package/build/cjs/components/organisms/AskUserQuestion/AskUserQuestion.css +28 -10
- package/build/cjs/components/organisms/AskUserQuestion/AskUserQuestion.d.ts +1 -1
- package/build/cjs/components/organisms/AskUserQuestion/AskUserQuestion.js +66 -23
- package/build/cjs/components/organisms/AskUserQuestion/AskUserQuestion.js.map +1 -1
- package/build/cjs/components/organisms/AskUserQuestion/i18n/en.json +1 -0
- package/build/cjs/components/organisms/AskUserQuestion/i18n/index.d.ts +4 -4
- package/build/cjs/components/organisms/AskUserQuestion/i18n/ru.json +1 -0
- package/build/cjs/components/organisms/AskUserQuestion/types.d.ts +1 -1
- package/build/cjs/components/organisms/AskUserQuestion/types.js.map +1 -1
- package/build/cjs/components/organisms/RunActivity/RunActivity.css +5 -0
- package/build/cjs/components/organisms/RunActivity/index.d.ts +1 -0
- package/build/cjs/components/organisms/RunActivity/index.js +4 -1
- package/build/cjs/components/organisms/RunActivity/index.js.map +1 -1
- package/build/cjs/components/organisms/ToolMessage/ToolMessage.css +11 -0
- package/build/cjs/components/organisms/ToolMessage/index.js +1 -1
- package/build/cjs/components/organisms/ToolMessage/index.js.map +1 -1
- package/build/cjs/components/pages/AgentChat/AgentChat.css +6 -7
- package/build/cjs/components/pages/AgentChat/AgentComposer.d.ts +3 -1
- package/build/cjs/components/pages/AgentChat/AgentComposer.js +2 -2
- package/build/cjs/components/pages/AgentChat/AgentComposer.js.map +1 -1
- package/build/cjs/components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.d.ts +3 -1
- package/build/cjs/components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.js +4 -2
- package/build/cjs/components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.js.map +1 -1
- package/build/cjs/components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.ported.css +20 -0
- package/build/cjs/experimental/index.d.ts +1 -0
- package/build/cjs/experimental/index.js +1 -0
- package/build/cjs/experimental/index.js.map +1 -1
- package/build/cjs/package.json +1 -1
- package/build/docs/INDEX.md +1 -0
- package/build/docs/components/molecules/PlanProgress.md +44 -0
- package/build/docs/components/organisms/AskUserQuestion.md +19 -4
- package/build/docs/components/pages/AgentChat.md +142 -14
- package/build/docs/guides/COMPONENTS.md +1 -0
- package/build/docs/guides/PROJECT_STRUCTURE.md +1 -0
- package/build/docs/guides/experimental.md +1 -0
- package/build/esm/components/internal/CompactRow/CompactRow.css +6 -0
- package/build/esm/components/internal/CompactRow/CompactRow.d.ts +3 -1
- package/build/esm/components/internal/CompactRow/CompactRow.js +8 -2
- package/build/esm/components/internal/CompactRow/CompactRow.js.map +1 -1
- package/build/esm/components/internal/ThinkingMessage/ThinkingMessageView.js +1 -1
- package/build/esm/components/internal/ThinkingMessage/ThinkingMessageView.js.map +1 -1
- package/build/esm/components/molecules/ChangedFilesSummary/ChangedFilesSummary.css +18 -17
- package/build/esm/components/molecules/ChangedFilesSummary/index.js +1 -1
- package/build/esm/components/molecules/ChangedFilesSummary/index.js.map +1 -1
- package/build/esm/components/molecules/PlanProgress/PlanProgress.css +134 -0
- package/build/esm/components/molecules/PlanProgress/PlanProgress.d.ts +36 -0
- package/build/esm/components/molecules/PlanProgress/PlanProgress.js +47 -0
- package/build/esm/components/molecules/PlanProgress/PlanProgress.js.map +1 -0
- package/build/esm/components/molecules/PlanProgress/i18n/en.json +16 -0
- package/build/esm/components/molecules/PlanProgress/i18n/index.d.ts +13 -0
- package/build/esm/components/molecules/PlanProgress/i18n/index.js +5 -0
- package/build/esm/components/molecules/PlanProgress/i18n/index.js.map +1 -0
- package/build/esm/components/molecules/PlanProgress/i18n/ru.json +16 -0
- package/build/esm/components/molecules/PlanProgress/index.d.ts +2 -0
- package/build/esm/components/molecules/PlanProgress/index.js +2 -0
- package/build/esm/components/molecules/PlanProgress/index.js.map +1 -0
- package/build/esm/components/organisms/AskUserQuestion/AskUserQuestion.css +28 -10
- package/build/esm/components/organisms/AskUserQuestion/AskUserQuestion.d.ts +1 -1
- package/build/esm/components/organisms/AskUserQuestion/AskUserQuestion.js +66 -23
- package/build/esm/components/organisms/AskUserQuestion/AskUserQuestion.js.map +1 -1
- package/build/esm/components/organisms/AskUserQuestion/i18n/en.json +1 -0
- package/build/esm/components/organisms/AskUserQuestion/i18n/index.d.ts +4 -4
- package/build/esm/components/organisms/AskUserQuestion/i18n/ru.json +1 -0
- package/build/esm/components/organisms/AskUserQuestion/types.d.ts +1 -1
- package/build/esm/components/organisms/AskUserQuestion/types.js.map +1 -1
- package/build/esm/components/organisms/RunActivity/RunActivity.css +5 -0
- package/build/esm/components/organisms/RunActivity/index.d.ts +1 -0
- package/build/esm/components/organisms/RunActivity/index.js +4 -1
- package/build/esm/components/organisms/RunActivity/index.js.map +1 -1
- package/build/esm/components/organisms/ToolMessage/ToolMessage.css +11 -0
- package/build/esm/components/organisms/ToolMessage/index.js +2 -2
- package/build/esm/components/organisms/ToolMessage/index.js.map +1 -1
- package/build/esm/components/pages/AgentChat/AgentChat.css +6 -7
- package/build/esm/components/pages/AgentChat/AgentComposer.d.ts +3 -1
- package/build/esm/components/pages/AgentChat/AgentComposer.js +2 -2
- package/build/esm/components/pages/AgentChat/AgentComposer.js.map +1 -1
- package/build/esm/components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.d.ts +3 -1
- package/build/esm/components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.js +4 -2
- package/build/esm/components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.js.map +1 -1
- package/build/esm/components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.ported.css +20 -0
- package/build/esm/experimental/index.d.ts +1 -0
- package/build/esm/experimental/index.js +1 -0
- package/build/esm/experimental/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/docs/COMPONENTS.md +1 -0
- package/docs/PROJECT_STRUCTURE.md +1 -0
- package/docs/experimental.md +1 -0
- package/llms-full.txt +2 -0
- package/llms.txt +1 -0
- package/package.json +1 -1
|
@@ -23,6 +23,12 @@
|
|
|
23
23
|
max-width: 100%;
|
|
24
24
|
box-sizing: border-box;
|
|
25
25
|
}
|
|
26
|
+
.g-aikit-compact-row__toggle_secondary:not(:hover, :focus-visible) {
|
|
27
|
+
color: var(--g-color-text-secondary);
|
|
28
|
+
}
|
|
29
|
+
.g-aikit-compact-row__toggle_secondary-icons:not(:hover, :focus-visible) > :is(.g-aikit-compact-row__icon, .g-icon) {
|
|
30
|
+
color: var(--g-color-text-secondary);
|
|
31
|
+
}
|
|
26
32
|
.g-aikit-compact-row__toggle:focus-visible {
|
|
27
33
|
outline: 2px solid var(--g-color-line-focus);
|
|
28
34
|
outline-offset: 2px;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import "./CompactRow.css";
|
|
3
|
-
export declare function CompactRow({ label, icon, showIcon, context, active, expanded, onToggle, children, tooltip, persistentChevron, }: {
|
|
3
|
+
export declare function CompactRow({ label, icon, showIcon, context, active, expanded, onToggle, children, tooltip, persistentChevron, secondary, secondaryIcons, }: {
|
|
4
4
|
tooltip?: ReactNode;
|
|
5
5
|
persistentChevron?: boolean;
|
|
6
|
+
secondary?: boolean;
|
|
7
|
+
secondaryIcons?: boolean;
|
|
6
8
|
label: ReactNode;
|
|
7
9
|
icon?: ReactNode;
|
|
8
10
|
showIcon?: boolean;
|
|
@@ -6,11 +6,17 @@ const react_1 = require("react");
|
|
|
6
6
|
const icons_1 = require("@gravity-ui/icons");
|
|
7
7
|
const uikit_1 = require("@gravity-ui/uikit");
|
|
8
8
|
const chatLayoutChange_1 = require("../../../utils/chatLayoutChange.js");
|
|
9
|
+
const cn_1 = require("../../../utils/cn.js");
|
|
9
10
|
const Shimmer_1 = require("../../atoms/Shimmer/index.js");
|
|
10
11
|
require("./CompactRow.css");
|
|
11
|
-
|
|
12
|
+
const b = (0, cn_1.block)('compact-row');
|
|
13
|
+
function CompactRow({ label, icon, showIcon = true, context, active, expanded, onToggle, children, tooltip, persistentChevron = false, secondary = false, secondaryIcons = false, }) {
|
|
12
14
|
const preserve = (0, react_1.useContext)(chatLayoutChange_1.LayoutChangeContext);
|
|
13
15
|
const Heading = onToggle ? 'button' : 'div';
|
|
14
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className:
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: b({ 'without-icon': !showIcon }), children: [(0, jsx_runtime_1.jsx)(uikit_1.Tooltip, { placement: "top", content: tooltip, disabled: !tooltip, children: (0, jsx_runtime_1.jsxs)(Heading, { type: onToggle ? 'button' : undefined, className: b('toggle', {
|
|
17
|
+
persistent: persistentChevron,
|
|
18
|
+
secondary,
|
|
19
|
+
'secondary-icons': secondaryIcons,
|
|
20
|
+
}), "aria-label": typeof label === 'string' ? label : undefined, "aria-expanded": onToggle ? expanded : undefined, onClick: onToggle ? () => preserve(onToggle) : undefined, children: [showIcon && ((0, jsx_runtime_1.jsx)("span", { className: b('icon'), "aria-hidden": "true", children: icon })), active ? (0, jsx_runtime_1.jsx)(Shimmer_1.Shimmer, { children: label }) : (0, jsx_runtime_1.jsx)("span", { children: label }), context && (0, jsx_runtime_1.jsx)("span", { className: b('context'), children: context }), onToggle && ((0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.ChevronRight, size: 12, className: expanded ? 'expanded' : '' }))] }) }), (0, jsx_runtime_1.jsx)("div", { hidden: !expanded, className: b('detail'), children: children })] }));
|
|
15
21
|
}
|
|
16
22
|
//# sourceMappingURL=CompactRow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompactRow.js","sourceRoot":"../../../../../src","sources":["components/internal/CompactRow/CompactRow.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"CompactRow.js","sourceRoot":"../../../../../src","sources":["components/internal/CompactRow/CompactRow.tsx"],"names":[],"mappings":";;AAaA,gCAgEC;;AA7ED,iCAAiD;AAEjD,6CAA+C;AAC/C,6CAAgD;AAEhD,yEAAoE;AACpE,6CAAwC;AACxC,0DAA4C;AAE5C,4BAA2B;AAE3B,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,aAAa,CAAC,CAAC;AAE/B,SAAgB,UAAU,CAAC,EACvB,KAA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AM,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,YAAG,OAAO,GAAQ,EAC1D,QAAQ,IAAI,CACT,uBAAC,YAAI,IACD,IAAI,EAAE,oBAAY,EAClB,IAAI,EAAE,EAAE,EACR,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,GACvC,CACL,IACK,GACJ,EACV,gCAAK,MAAM,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,YACzC,QAAQ,GACP,IACJ,CACT,CAAC;AACN,CAAC","sourcesContent":["import {type ReactNode, useContext} from 'react';\n\nimport {ChevronRight} from '@gravity-ui/icons';\nimport {Icon, Tooltip} from '@gravity-ui/uikit';\n\nimport {LayoutChangeContext} from '../../../utils/chatLayoutChange';\nimport {block} from '../../../utils/cn';\nimport {Shimmer} from '../../atoms/Shimmer';\n\nimport './CompactRow.scss';\n\nconst b = block('compact-row');\n\nexport function CompactRow({\n label,\n icon,\n showIcon = true,\n context,\n active,\n expanded,\n onToggle,\n children,\n tooltip,\n persistentChevron = false,\n secondary = false,\n secondaryIcons = false,\n}: {\n tooltip?: ReactNode;\n persistentChevron?: boolean;\n secondary?: boolean;\n secondaryIcons?: boolean;\n label: ReactNode;\n icon?: ReactNode;\n showIcon?: boolean;\n context?: ReactNode;\n active?: boolean;\n expanded: boolean;\n onToggle?: () => void;\n children?: ReactNode;\n}) {\n const preserve = useContext(LayoutChangeContext);\n const Heading = onToggle ? 'button' : 'div';\n return (\n <div className={b({'without-icon': !showIcon})}>\n <Tooltip placement=\"top\" content={tooltip} disabled={!tooltip}>\n <Heading\n type={onToggle ? 'button' : undefined}\n className={b('toggle', {\n persistent: persistentChevron,\n secondary,\n 'secondary-icons': secondaryIcons,\n })}\n aria-label={typeof label === 'string' ? label : undefined}\n aria-expanded={onToggle ? expanded : undefined}\n onClick={onToggle ? () => preserve(onToggle) : undefined}\n >\n {showIcon && (\n <span className={b('icon')} aria-hidden=\"true\">\n {icon}\n </span>\n )}\n {active ? <Shimmer>{label}</Shimmer> : <span>{label}</span>}\n {context && <span className={b('context')}>{context}</span>}\n {onToggle && (\n <Icon\n data={ChevronRight}\n size={12}\n className={expanded ? 'expanded' : ''}\n />\n )}\n </Heading>\n </Tooltip>\n <div hidden={!expanded} className={b('detail')}>\n {children}\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -30,7 +30,7 @@ const ThinkingMessageView = (props) => {
|
|
|
30
30
|
const markdownTransformOptions = Object.assign(Object.assign({}, defaultTransformOptions), transformOptions);
|
|
31
31
|
const { isExpanded, toggleExpanded, buttonTitle, content, showLoader, handleCopy, showCopyButton, } = (0, useThinkingMessage_1.useThinkingMessage)(data);
|
|
32
32
|
if (view === 'compact') {
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: className, "data-qa": qa, style: style, children: (0, jsx_runtime_1.jsxs)(CompactRow_1.CompactRow, { label: data.title || buttonTitle, icon: icon, showIcon: showIcon, context: secondaryText, active: showLoader, expanded: isExpanded, onToggle: toggleExpanded, children: [content.map((item, index) => format === 'markdown' ? ((0, jsx_runtime_1.jsx)(MarkdownProvider_1.MarkdownContent, { content: item, transformOptions: markdownTransformOptions, mermaidOptions: mermaidOptions, openLinksInNewTab: openMarkdownLinksInNewTab, mdxOptions: mdxOptions, mdxContext: mdxContext, extraProps: markdownExtraProps }, index)) : ((0, jsx_runtime_1.jsx)("p", { children: item }, index))), showCopyButton && ((0, jsx_runtime_1.jsx)(ActionButton_1.ActionButton, { onClick: handleCopy, children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Copy, size: 16 }) }))] }) }));
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: className, "data-qa": qa, style: style, children: (0, jsx_runtime_1.jsxs)(CompactRow_1.CompactRow, { secondary: true, label: data.title || buttonTitle, icon: icon, showIcon: showIcon, context: secondaryText, active: showLoader, expanded: isExpanded, onToggle: toggleExpanded, children: [content.map((item, index) => format === 'markdown' ? ((0, jsx_runtime_1.jsx)(MarkdownProvider_1.MarkdownContent, { content: item, transformOptions: markdownTransformOptions, mermaidOptions: mermaidOptions, openLinksInNewTab: openMarkdownLinksInNewTab, mdxOptions: mdxOptions, mdxContext: mdxContext, extraProps: markdownExtraProps }, index)) : ((0, jsx_runtime_1.jsx)("p", { children: item }, index))), showCopyButton && ((0, jsx_runtime_1.jsx)(ActionButton_1.ActionButton, { onClick: handleCopy, children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Copy, size: 16 }) }))] }) }));
|
|
34
34
|
}
|
|
35
35
|
return ((0, jsx_runtime_1.jsxs)("div", { className: b(null, className), "data-qa": qa, style: style, children: [(0, jsx_runtime_1.jsxs)("div", { className: b('buttons'), children: [(0, jsx_runtime_1.jsxs)(uikit_1.Button, { size: "s", onClick: toggleExpanded, children: [buttonTitle, (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: isExpanded ? icons_1.ChevronUp : icons_1.ChevronDown })] }), showLoader ? ((0, jsx_runtime_1.jsx)(Loader_1.Loader, { view: "loading", size: "xs" })) : (showCopyButton && ((0, jsx_runtime_1.jsx)(ActionButton_1.ActionButton, { size: "s", onClick: handleCopy, children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Copy, size: 16 }) })))] }), isExpanded && ((0, jsx_runtime_1.jsx)("div", { className: b('container'), children: content.map((item, index) => format === 'markdown' ? ((0, jsx_runtime_1.jsx)(MarkdownProvider_1.MarkdownContent, { className: b('content'), content: item, transformOptions: markdownTransformOptions, mermaidOptions: mermaidOptions, openLinksInNewTab: openMarkdownLinksInNewTab, mdxOptions: mdxOptions, mdxContext: mdxContext, extraProps: markdownExtraProps }, index)) : ((0, jsx_runtime_1.jsx)(uikit_1.Text, { className: b('content'), children: item }, index))) }))] }));
|
|
36
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThinkingMessageView.js","sourceRoot":"../../../../../src","sources":["components/internal/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AAU,IAAI,CACX,gCAAK,SAAS,EAAE,CAAC,CAAC,WAAW,CAAC,YACzB,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACzB,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,CACpB,uBAAC,kCAAe,IACZ,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,EAEvB,OAAO,EAAE,IAAI,EACb,gBAAgB,EAAE,wBAAwB,EAC1C,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,yBAAyB,EAC5C,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,kBAAkB,IAPzB,KAAK,CAQZ,CACL,CAAC,CAAC,CAAC,CACA,uBAAC,YAAI,IAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,YACxB,IAAI,IAD2B,KAAK,CAElC,CACV,CACJ,GACC,CACT,IACC,CACT,CAAC;AACN,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ThinkingMessageView.js","sourceRoot":"../../../../../src","sources":["components/internal/ThinkingMessage/ThinkingMessageView.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AAKb,6CAA+D;AAC/D,6CAAwE;AAExE,4EAAmE;AAGnE,6CAAwC;AACxC,oEAAsD;AACtD,wDAA0C;AAC1C,8FAAsF;AACtF,4DAAoD;AAEpD,+DAA8D;AAE9D,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,kBAAkB,CAAC,CAAC;AAmCpC,MAAM,uBAAuB,GAAgB;IACzC,oBAAoB,EAAE,IAAI;CAC7B,CAAC;AAEF;;;;;;;GAOG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAA2B,EAAE,EAAE;IAC/D,MAAM,EACF,SAAS,EACT,EAAE,EACF,KAAK,EACL,MAAM,GAAG,OAAO,EAChB,IAAI,GAAG,SAAS,EAChB,QAAQ,GAAG,IAAI,EACf,IAAI,EACJ,aAAa,EACb,gBAAgB,EACh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V,CACJ,GACC,CACT,IACC,CACT,CAAC;AACN,CAAC,CAAC;AAnHW,QAAA,mBAAmB,uBAmH9B","sourcesContent":["'use client';\n\nimport type {HTMLAttributes, ReactNode} from 'react';\n\nimport {OptionsType} from '@diplodoc/transform/lib/typings';\nimport {ChevronDown, ChevronUp, Copy} from '@gravity-ui/icons';\nimport {Button, DOMProps, Icon, QAProps, Text} from '@gravity-ui/uikit';\n\nimport {MarkdownContent} from '../../../markdown/MarkdownProvider';\nimport {type MarkdownRendererMdxOptions, type MermaidOptions} from '../../../markdown/types';\nimport type {ThinkingMessageContentData} from '../../../types/messages';\nimport {block} from '../../../utils/cn';\nimport {ActionButton} from '../../atoms/ActionButton';\nimport {Loader} from '../../atoms/Loader';\nimport {useThinkingMessage} from '../../organisms/ThinkingMessage/useThinkingMessage';\nimport {CompactRow} from '../CompactRow/CompactRow';\n\nimport '../../organisms/ThinkingMessage/ThinkingMessage.scss';\n\nconst b = block('thinking-message');\n\n/**\n * Props for the ThinkingMessage component.\n * Combines DOM props, QA props, and thinking message data.\n */\nexport type ThinkingMessageProps = DOMProps &\n QAProps &\n ThinkingMessageContentData & {\n /**\n * How thinking content strings are rendered.\n * @default 'plain'\n */\n format?: 'plain' | 'markdown';\n /** @experimental Compact presentation may change in minor releases. */\n view?: 'default' | 'compact';\n /** @experimental Show the compact row icon. Defaults to true. */\n showIcon?: boolean;\n /** @experimental Compact presentation API may change in minor releases. */\n icon?: ReactNode;\n /** @experimental Compact presentation API may change in minor releases. */\n secondaryText?: ReactNode;\n /**\n * Options for @diplodoc/transform when `format` is `'markdown'`.\n * Shallow-merged with the component defaults (`disableCommonAnchors: true`).\n */\n transformOptions?: OptionsType;\n mermaidOptions?: MermaidOptions;\n openMarkdownLinksInNewTab?: boolean;\n mdxOptions?: MarkdownRendererMdxOptions;\n mdxContext?: Record<string, unknown>;\n /** Extra props forwarded to the root container `div` of each rendered markdown block. */\n markdownExtraProps?: HTMLAttributes<HTMLDivElement>;\n };\n\nconst defaultTransformOptions: OptionsType = {\n disableCommonAnchors: true,\n};\n\n/**\n * ThinkingMessage component displays AI model's internal reasoning process.\n * Shows a collapsible block with thinking content and a copy button.\n * Displays a loader when the thinking process is still in progress.\n *\n * @param props - Component props\n * @returns Rendered thinking message component\n */\nexport const ThinkingMessageView = (props: ThinkingMessageProps) => {\n const {\n className,\n qa,\n style,\n format = 'plain',\n view = 'default',\n showIcon = true,\n icon,\n secondaryText,\n transformOptions,\n mermaidOptions,\n openMarkdownLinksInNewTab,\n mdxOptions,\n mdxContext,\n markdownExtraProps,\n ...data\n } = props;\n\n const markdownTransformOptions: OptionsType = {\n ...defaultTransformOptions,\n ...transformOptions,\n };\n\n const {\n isExpanded,\n toggleExpanded,\n buttonTitle,\n content,\n showLoader,\n handleCopy,\n showCopyButton,\n } = useThinkingMessage(data);\n\n if (view === 'compact') {\n return (\n <div className={className} data-qa={qa} style={style}>\n <CompactRow\n secondary\n label={data.title || buttonTitle}\n icon={icon}\n showIcon={showIcon}\n context={secondaryText}\n active={showLoader}\n expanded={isExpanded}\n onToggle={toggleExpanded}\n >\n {content.map((item, index) =>\n format === 'markdown' ? (\n <MarkdownContent\n key={index}\n content={item}\n transformOptions={markdownTransformOptions}\n mermaidOptions={mermaidOptions}\n openLinksInNewTab={openMarkdownLinksInNewTab}\n mdxOptions={mdxOptions}\n mdxContext={mdxContext}\n extraProps={markdownExtraProps}\n />\n ) : (\n <p key={index}>{item}</p>\n ),\n )}\n {showCopyButton && (\n <ActionButton onClick={handleCopy}>\n <Icon data={Copy} size={16} />\n </ActionButton>\n )}\n </CompactRow>\n </div>\n );\n }\n\n return (\n <div className={b(null, className)} data-qa={qa} style={style}>\n <div className={b('buttons')}>\n <Button size=\"s\" onClick={toggleExpanded}>\n {buttonTitle}\n <Icon data={isExpanded ? ChevronUp : ChevronDown} />\n </Button>\n {showLoader ? (\n <Loader view=\"loading\" size=\"xs\" />\n ) : (\n showCopyButton && (\n <ActionButton size=\"s\" onClick={handleCopy}>\n <Icon data={Copy} size={16} />\n </ActionButton>\n )\n )}\n </div>\n {isExpanded && (\n <div className={b('container')}>\n {content.map((item, index) =>\n format === 'markdown' ? (\n <MarkdownContent\n className={b('content')}\n key={index}\n content={item}\n transformOptions={markdownTransformOptions}\n mermaidOptions={mermaidOptions}\n openLinksInNewTab={openMarkdownLinksInNewTab}\n mdxOptions={mdxOptions}\n mdxContext={mdxContext}\n extraProps={markdownExtraProps}\n />\n ) : (\n <Text className={b('content')} key={index}>\n {item}\n </Text>\n ),\n )}\n </div>\n )}\n </div>\n );\n};\n"]}
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
color: var(--g-color-text-primary);
|
|
23
23
|
}
|
|
24
24
|
.g-aikit-changed-files-summary__content {
|
|
25
|
-
--g-button-font-size: 12px;
|
|
26
25
|
box-sizing: border-box;
|
|
27
26
|
width: var(--g-aikit-changed-files-summary-width, 360px);
|
|
28
27
|
max-width: calc(100vw - 32px);
|
|
@@ -62,24 +61,26 @@
|
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
.g-aikit-changed-files-summary__file-action {
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
gap: var(--g-spacing-2);
|
|
67
67
|
width: 100%;
|
|
68
|
-
flex: 1;
|
|
69
|
-
min-width: 0;
|
|
70
|
-
height: auto;
|
|
71
68
|
min-height: 28px;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
align
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
69
|
+
padding: 6px var(--g-spacing-3);
|
|
70
|
+
border: 0;
|
|
71
|
+
border-radius: var(--g-border-radius-m);
|
|
72
|
+
background: transparent;
|
|
73
|
+
color: inherit;
|
|
74
|
+
font: inherit;
|
|
75
|
+
text-align: start;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
}
|
|
78
|
+
.g-aikit-changed-files-summary__file-action:hover {
|
|
79
|
+
background-color: var(--g-color-base-simple-hover);
|
|
80
|
+
}
|
|
81
|
+
.g-aikit-changed-files-summary__file-action:focus-visible {
|
|
82
|
+
outline: 2px solid var(--g-color-line-focus);
|
|
83
|
+
outline-offset: -2px;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
.g-aikit-changed-files-summary_view_card {
|
|
@@ -24,7 +24,7 @@ function ChangedFilesSummary({ files, view = 'pill', onViewChanges, onUndo, view
|
|
|
24
24
|
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(value);
|
|
25
25
|
};
|
|
26
26
|
const totals = files.reduce((sum, file) => ({ added: sum.added + file.added, deleted: sum.deleted + file.deleted }), { added: 0, deleted: 0 });
|
|
27
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: b({ view }, className), "data-qa": qa, children: [(0, jsx_runtime_1.jsxs)(uikit_1.Button, { ref: setAnchor, className: b(view === 'pill' ? 'pill' : 'summary'), view: view === 'pill' ? 'outlined' : 'flat-secondary', size: "m", disabled: isDisabled, "aria-haspopup": "dialog", "aria-expanded": open, "aria-controls": open ? popupId : undefined, onClick: () => changeOpen(!open), children: [(0, jsx_runtime_1.jsx)("span", { className: b('label'), children: label !== null && label !== void 0 ? label : t(files.length === 1 ? 'one-file' : 'files', { count: files.length }) }), (0, jsx_runtime_1.jsx)(DiffStat_1.DiffStat, Object.assign({}, totals))] }), view === 'card' && (onUndo || onViewChanges) && ((0, jsx_runtime_1.jsxs)("div", { className: b('actions'), children: [onUndo && ((0, jsx_runtime_1.jsxs)(uikit_1.Button, { className: b('action'), size: "m", disabled: isDisabled, onClick: onUndo, children: [(0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.ArrowRotateLeft, size: 16, "aria-hidden": true }), undoLabel !== null && undoLabel !== void 0 ? undoLabel : t('undo')] })), onViewChanges && ((0, jsx_runtime_1.jsxs)(uikit_1.Button, { className: b('action'), size: "m", disabled: isDisabled, onClick: onViewChanges, children: [(0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Eye, size: 16, "aria-hidden": true }), viewChangesLabel !== null && viewChangesLabel !== void 0 ? viewChangesLabel : t('view')] }))] })), (0, jsx_runtime_1.jsx)(uikit_1.Popup, { id: popupId, open: open && Boolean(anchor), onOpenChange: changeOpen, anchorElement: anchor, placement: "top", offset: 8, modal: true, floatingRef: (node) => node === null || node === void 0 ? void 0 : node.setAttribute('aria-label', title !== null && title !== void 0 ? title : t('title')), role: "dialog", className: b('popup'), children: (0, jsx_runtime_1.jsx)("div", { className: b('content'), tabIndex: 0, "aria-label": title !== null && title !== void 0 ? title : t('title'), children: (0, jsx_runtime_1.jsx)("ul", { children: files.map((file) => ((0, jsx_runtime_1.jsxs)("li", { className: b('file', { interactive: Boolean(onFileClick) }), children: [onFileClick ? ((0, jsx_runtime_1.jsxs)(
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: b({ view }, className), "data-qa": qa, children: [(0, jsx_runtime_1.jsxs)(uikit_1.Button, { ref: setAnchor, className: b(view === 'pill' ? 'pill' : 'summary'), view: view === 'pill' ? 'outlined' : 'flat-secondary', size: "m", disabled: isDisabled, "aria-haspopup": "dialog", "aria-expanded": open, "aria-controls": open ? popupId : undefined, onClick: () => changeOpen(!open), children: [(0, jsx_runtime_1.jsx)("span", { className: b('label'), children: label !== null && label !== void 0 ? label : t(files.length === 1 ? 'one-file' : 'files', { count: files.length }) }), (0, jsx_runtime_1.jsx)(DiffStat_1.DiffStat, Object.assign({}, totals))] }), view === 'card' && (onUndo || onViewChanges) && ((0, jsx_runtime_1.jsxs)("div", { className: b('actions'), children: [onUndo && ((0, jsx_runtime_1.jsxs)(uikit_1.Button, { className: b('action'), size: "m", disabled: isDisabled, onClick: onUndo, children: [(0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.ArrowRotateLeft, size: 16, "aria-hidden": true }), undoLabel !== null && undoLabel !== void 0 ? undoLabel : t('undo')] })), onViewChanges && ((0, jsx_runtime_1.jsxs)(uikit_1.Button, { className: b('action'), size: "m", disabled: isDisabled, onClick: onViewChanges, children: [(0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Eye, size: 16, "aria-hidden": true }), viewChangesLabel !== null && viewChangesLabel !== void 0 ? viewChangesLabel : t('view')] }))] })), (0, jsx_runtime_1.jsx)(uikit_1.Popup, { id: popupId, open: open && Boolean(anchor), onOpenChange: changeOpen, anchorElement: anchor, placement: "top", offset: 8, modal: true, floatingRef: (node) => node === null || node === void 0 ? void 0 : node.setAttribute('aria-label', title !== null && title !== void 0 ? title : t('title')), role: "dialog", className: b('popup'), children: (0, jsx_runtime_1.jsx)("div", { className: b('content'), tabIndex: 0, "aria-label": title !== null && title !== void 0 ? title : t('title'), children: (0, jsx_runtime_1.jsx)("ul", { children: files.map((file) => ((0, jsx_runtime_1.jsxs)("li", { className: b('file', { interactive: Boolean(onFileClick) }), children: [onFileClick ? ((0, jsx_runtime_1.jsxs)("button", { type: "button", className: b('file-action'), onClick: () => {
|
|
28
28
|
onFileClick(file);
|
|
29
29
|
changeOpen(false);
|
|
30
30
|
}, children: [(0, jsx_runtime_1.jsx)("span", { className: b('path'), title: file.path, children: file.path }), (0, jsx_runtime_1.jsx)(DiffStat_1.DiffStat, { added: file.added, deleted: file.deleted })] })) : ((0, jsx_runtime_1.jsx)("span", { className: b('path'), title: file.path, children: file.path })), !onFileClick && ((0, jsx_runtime_1.jsx)(DiffStat_1.DiffStat, { added: file.added, deleted: file.deleted }))] }, file.id))) }) }) })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../../../../../src","sources":["components/molecules/ChangedFilesSummary/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AA8Cb,kDA4HC;;AAxKD,iCAA+C;AAE/C,6CAAuD;AACvD,6CAAiE;AAEjE,6CAAwC;AACxC,4DAA8C;AAE9C,0CAA4B;AAE5B,qCAAoC;AAE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AM,EACX,IAAI,EAAC,GAAG,EACR,OAAO,EAAE,GAAG,EAAE;wCACV,WAAW,CAAC,IAAI,CAAC,CAAC;wCAClB,UAAU,CAAC,KAAK,CAAC,CAAC;oCACtB,CAAC,aAED,iCAAM,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,YACvC,IAAI,CAAC,IAAI,GACP,EACP,uBAAC,mBAAQ,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI,IACjD,CACZ,CAAC,CAAC,CAAC,CACA,iCAAM,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,YACvC,IAAI,CAAC,IAAI,GACP,CACV,EACA,CAAC,WAAW,IAAI,CACb,uBAAC,mBAAQ,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI,CACzD,KAzBI,IAAI,CAAC,EAAE,CA0BX,CACR,CAAC,GACD,GACH,GACF,IACN,CACT,CAAC;AACN,CAAC","sourcesContent":["'use client';\n\nimport {type ReactNode, useState} from 'react';\n\nimport {ArrowRotateLeft, Eye} from '@gravity-ui/icons';\nimport {Button, Icon, Popup, useUniqId} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\nimport {DiffStat} from '../../atoms/DiffStat';\n\nimport {i18n} from './i18n';\n\nimport './ChangedFilesSummary.scss';\n\nconst b = block('changed-files-summary');\n\n/** @experimental May change or be removed in minor releases. */\nexport interface ChangedFile {\n id: string;\n path: string;\n added: number;\n deleted: number;\n}\n\n/** @experimental May change or be removed in minor releases. */\nexport interface ChangedFilesSummaryProps {\n /** Final per-file differences against the host's baseline, not tool-call deltas. */\n files: readonly ChangedFile[];\n view?: 'pill' | 'card';\n onViewChanges?: () => void;\n onUndo?: () => void;\n viewChangesLabel?: string;\n undoLabel?: string;\n label?: ReactNode;\n title?: string;\n disabled?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Only render file actions when the host supplies a real action. */\n onFileClick?: (file: ChangedFile) => void;\n className?: string;\n qa?: string;\n}\n\n/** @experimental May change or be removed in minor releases. */\nexport function ChangedFilesSummary({\n files,\n view = 'pill',\n onViewChanges,\n onUndo,\n viewChangesLabel,\n undoLabel,\n label,\n title,\n disabled = false,\n defaultOpen = false,\n open: controlledOpen,\n onOpenChange,\n onFileClick,\n className,\n qa,\n}: ChangedFilesSummaryProps) {\n const {t} = i18n.useTranslation();\n const [localOpen, setLocalOpen] = useState(defaultOpen);\n const [anchor, setAnchor] = useState<HTMLButtonElement | null>(null);\n const popupId = useUniqId();\n const isDisabled = disabled || files.length === 0;\n const open = (controlledOpen ?? localOpen) && !isDisabled;\n const changeOpen = (value: boolean) => {\n setLocalOpen(value);\n onOpenChange?.(value);\n };\n const totals = files.reduce(\n (sum, file) => ({added: sum.added + file.added, deleted: sum.deleted + file.deleted}),\n {added: 0, deleted: 0},\n );\n return (\n <div className={b({view}, className)} data-qa={qa}>\n <Button\n ref={setAnchor}\n className={b(view === 'pill' ? 'pill' : 'summary')}\n view={view === 'pill' ? 'outlined' : 'flat-secondary'}\n size=\"m\"\n disabled={isDisabled}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={open ? popupId : undefined}\n onClick={() => changeOpen(!open)}\n >\n <span className={b('label')}>\n {label ?? t(files.length === 1 ? 'one-file' : 'files', {count: files.length})}\n </span>\n <DiffStat {...totals} />\n </Button>\n {view === 'card' && (onUndo || onViewChanges) && (\n <div className={b('actions')}>\n {onUndo && (\n <Button\n className={b('action')}\n size=\"m\"\n disabled={isDisabled}\n onClick={onUndo}\n >\n <Icon data={ArrowRotateLeft} size={16} aria-hidden />\n {undoLabel ?? t('undo')}\n </Button>\n )}\n {onViewChanges && (\n <Button\n className={b('action')}\n size=\"m\"\n disabled={isDisabled}\n onClick={onViewChanges}\n >\n <Icon data={Eye} size={16} aria-hidden />\n {viewChangesLabel ?? t('view')}\n </Button>\n )}\n </div>\n )}\n <Popup\n id={popupId}\n open={open && Boolean(anchor)}\n onOpenChange={changeOpen}\n anchorElement={anchor}\n placement=\"top\"\n offset={8}\n modal\n floatingRef={(node) => node?.setAttribute('aria-label', title ?? t('title'))}\n role=\"dialog\"\n className={b('popup')}\n >\n <div className={b('content')} tabIndex={0} aria-label={title ?? t('title')}>\n <ul>\n {files.map((file) => (\n <li\n key={file.id}\n className={b('file', {interactive: Boolean(onFileClick)})}\n >\n {onFileClick ? (\n <Button\n className={b('file-action')}\n view=\"flat\"\n size=\"m\"\n onClick={() => {\n onFileClick(file);\n changeOpen(false);\n }}\n >\n <span className={b('path')} title={file.path}>\n {file.path}\n </span>\n <DiffStat added={file.added} deleted={file.deleted} />\n </Button>\n ) : (\n <span className={b('path')} title={file.path}>\n {file.path}\n </span>\n )}\n {!onFileClick && (\n <DiffStat added={file.added} deleted={file.deleted} />\n )}\n </li>\n ))}\n </ul>\n </div>\n </Popup>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../../src","sources":["components/molecules/ChangedFilesSummary/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AA8Cb,kDA2HC;;AAvKD,iCAA+C;AAE/C,6CAAuD;AACvD,6CAAiE;AAEjE,6CAAwC;AACxC,4DAA8C;AAE9C,0CAA4B;AAE5B,qCAAoC;AAEpC,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,uBAAuB,CAAC,CAAC;AA+BzC,gEAAgE;AAChE,SAAgB,mBAAmB,CAAC,EAChC,KAAK,EACL,IAAI,GAAG,MAAM,EACb,aAAa,EACb,MAAM,EACN,gBAAgB,EAChB,SAAS,EACT,KAAK,EACL,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,WAAW,GAAG,KAAK,EACnB,IAAI,EAAE,cAAc,EACpB,YAAY,EACZ,WAAW,EACX,S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AO,GAAI,IACjD,CACZ,CAAC,CAAC,CAAC,CACA,iCAAM,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,YACvC,IAAI,CAAC,IAAI,GACP,CACV,EACA,CAAC,WAAW,IAAI,CACb,uBAAC,mBAAQ,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,GAAI,CACzD,KAxBI,IAAI,CAAC,EAAE,CAyBX,CACR,CAAC,GACD,GACH,GACF,IACN,CACT,CAAC;AACN,CAAC","sourcesContent":["'use client';\n\nimport {type ReactNode, useState} from 'react';\n\nimport {ArrowRotateLeft, Eye} from '@gravity-ui/icons';\nimport {Button, Icon, Popup, useUniqId} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\nimport {DiffStat} from '../../atoms/DiffStat';\n\nimport {i18n} from './i18n';\n\nimport './ChangedFilesSummary.scss';\n\nconst b = block('changed-files-summary');\n\n/** @experimental May change or be removed in minor releases. */\nexport interface ChangedFile {\n id: string;\n path: string;\n added: number;\n deleted: number;\n}\n\n/** @experimental May change or be removed in minor releases. */\nexport interface ChangedFilesSummaryProps {\n /** Final per-file differences against the host's baseline, not tool-call deltas. */\n files: readonly ChangedFile[];\n view?: 'pill' | 'card';\n onViewChanges?: () => void;\n onUndo?: () => void;\n viewChangesLabel?: string;\n undoLabel?: string;\n label?: ReactNode;\n title?: string;\n disabled?: boolean;\n defaultOpen?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** Only render file actions when the host supplies a real action. */\n onFileClick?: (file: ChangedFile) => void;\n className?: string;\n qa?: string;\n}\n\n/** @experimental May change or be removed in minor releases. */\nexport function ChangedFilesSummary({\n files,\n view = 'pill',\n onViewChanges,\n onUndo,\n viewChangesLabel,\n undoLabel,\n label,\n title,\n disabled = false,\n defaultOpen = false,\n open: controlledOpen,\n onOpenChange,\n onFileClick,\n className,\n qa,\n}: ChangedFilesSummaryProps) {\n const {t} = i18n.useTranslation();\n const [localOpen, setLocalOpen] = useState(defaultOpen);\n const [anchor, setAnchor] = useState<HTMLButtonElement | null>(null);\n const popupId = useUniqId();\n const isDisabled = disabled || files.length === 0;\n const open = (controlledOpen ?? localOpen) && !isDisabled;\n const changeOpen = (value: boolean) => {\n setLocalOpen(value);\n onOpenChange?.(value);\n };\n const totals = files.reduce(\n (sum, file) => ({added: sum.added + file.added, deleted: sum.deleted + file.deleted}),\n {added: 0, deleted: 0},\n );\n return (\n <div className={b({view}, className)} data-qa={qa}>\n <Button\n ref={setAnchor}\n className={b(view === 'pill' ? 'pill' : 'summary')}\n view={view === 'pill' ? 'outlined' : 'flat-secondary'}\n size=\"m\"\n disabled={isDisabled}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={open ? popupId : undefined}\n onClick={() => changeOpen(!open)}\n >\n <span className={b('label')}>\n {label ?? t(files.length === 1 ? 'one-file' : 'files', {count: files.length})}\n </span>\n <DiffStat {...totals} />\n </Button>\n {view === 'card' && (onUndo || onViewChanges) && (\n <div className={b('actions')}>\n {onUndo && (\n <Button\n className={b('action')}\n size=\"m\"\n disabled={isDisabled}\n onClick={onUndo}\n >\n <Icon data={ArrowRotateLeft} size={16} aria-hidden />\n {undoLabel ?? t('undo')}\n </Button>\n )}\n {onViewChanges && (\n <Button\n className={b('action')}\n size=\"m\"\n disabled={isDisabled}\n onClick={onViewChanges}\n >\n <Icon data={Eye} size={16} aria-hidden />\n {viewChangesLabel ?? t('view')}\n </Button>\n )}\n </div>\n )}\n <Popup\n id={popupId}\n open={open && Boolean(anchor)}\n onOpenChange={changeOpen}\n anchorElement={anchor}\n placement=\"top\"\n offset={8}\n modal\n floatingRef={(node) => node?.setAttribute('aria-label', title ?? t('title'))}\n role=\"dialog\"\n className={b('popup')}\n >\n <div className={b('content')} tabIndex={0} aria-label={title ?? t('title')}>\n <ul>\n {files.map((file) => (\n <li\n key={file.id}\n className={b('file', {interactive: Boolean(onFileClick)})}\n >\n {onFileClick ? (\n <button\n type=\"button\"\n className={b('file-action')}\n onClick={() => {\n onFileClick(file);\n changeOpen(false);\n }}\n >\n <span className={b('path')} title={file.path}>\n {file.path}\n </span>\n <DiffStat added={file.added} deleted={file.deleted} />\n </button>\n ) : (\n <span className={b('path')} title={file.path}>\n {file.path}\n </span>\n )}\n {!onFileClick && (\n <DiffStat added={file.added} deleted={file.deleted} />\n )}\n </li>\n ))}\n </ul>\n </div>\n </Popup>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
.g-aikit-plan-progress {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: var(--g-spacing-1);
|
|
5
|
+
}
|
|
6
|
+
.g-aikit-plan-progress_view_card {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-wrap: wrap;
|
|
9
|
+
justify-content: space-between;
|
|
10
|
+
gap: var(--g-spacing-2);
|
|
11
|
+
padding: var(--g-spacing-3);
|
|
12
|
+
border-radius: var(--g-border-radius-xl);
|
|
13
|
+
background: var(--g-color-base-generic);
|
|
14
|
+
}
|
|
15
|
+
.g-aikit-plan-progress__summary_view_pill, .g-aikit-plan-progress_split {
|
|
16
|
+
border-radius: var(--g-border-radius-s);
|
|
17
|
+
box-shadow: var(--g-aikit-plan-progress-shadow, 0 2px 8px var(--g-color-sfx-shadow));
|
|
18
|
+
background: var(--g-color-base-background);
|
|
19
|
+
}
|
|
20
|
+
.g-aikit-plan-progress_split {
|
|
21
|
+
gap: 0;
|
|
22
|
+
}
|
|
23
|
+
.g-aikit-plan-progress_split > .g-button {
|
|
24
|
+
--g-button-border-radius: var(--g-border-radius-s);
|
|
25
|
+
--g-button-focus-outline-offset: -2px;
|
|
26
|
+
}
|
|
27
|
+
.g-aikit-plan-progress_split > .g-button:active {
|
|
28
|
+
transform: scale(1);
|
|
29
|
+
}
|
|
30
|
+
.g-aikit-plan-progress_split > .g-aikit-plan-progress__summary {
|
|
31
|
+
box-shadow: none;
|
|
32
|
+
background: transparent;
|
|
33
|
+
}
|
|
34
|
+
.g-aikit-plan-progress__summary {
|
|
35
|
+
--g-button-font-size: 12px;
|
|
36
|
+
}
|
|
37
|
+
.g-aikit-plan-progress__summary .g-button__text {
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: var(--g-spacing-2);
|
|
41
|
+
}
|
|
42
|
+
.g-aikit-plan-progress__count, .g-aikit-plan-progress__status {
|
|
43
|
+
color: var(--g-color-text-secondary);
|
|
44
|
+
}
|
|
45
|
+
.g-aikit-plan-progress__status {
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
width: 14px;
|
|
48
|
+
height: 16px;
|
|
49
|
+
flex: none;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
}
|
|
53
|
+
.g-aikit-plan-progress__status .g-aikit-plan-progress__spinner {
|
|
54
|
+
width: 12px;
|
|
55
|
+
height: 12px;
|
|
56
|
+
}
|
|
57
|
+
.g-aikit-plan-progress__status_status_completed {
|
|
58
|
+
color: var(--g-color-text-positive);
|
|
59
|
+
}
|
|
60
|
+
.g-aikit-plan-progress__status_status_failed {
|
|
61
|
+
color: var(--g-color-text-danger);
|
|
62
|
+
}
|
|
63
|
+
.g-aikit-plan-progress__popup {
|
|
64
|
+
--g-popup-border-radius: var(--g-border-radius-xl);
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
}
|
|
67
|
+
.g-aikit-plan-progress__content {
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
width: min(360px, 100vw - 32px);
|
|
70
|
+
max-height: min(10 * var(--_step-height) + 2 * var(--g-spacing-1), 60vh);
|
|
71
|
+
overflow: auto;
|
|
72
|
+
scrollbar-width: thin;
|
|
73
|
+
padding: var(--g-spacing-1);
|
|
74
|
+
}
|
|
75
|
+
.g-aikit-plan-progress__content, .g-aikit-plan-progress__steps {
|
|
76
|
+
--_step-height: 28px;
|
|
77
|
+
}
|
|
78
|
+
.g-aikit-plan-progress__steps {
|
|
79
|
+
margin: 0;
|
|
80
|
+
padding: 0;
|
|
81
|
+
list-style: none;
|
|
82
|
+
}
|
|
83
|
+
.g-aikit-plan-progress__step {
|
|
84
|
+
display: flex;
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
min-height: var(--_step-height);
|
|
87
|
+
align-items: flex-start;
|
|
88
|
+
gap: var(--g-spacing-2);
|
|
89
|
+
padding: 6px var(--g-spacing-2);
|
|
90
|
+
color: var(--g-color-text-primary);
|
|
91
|
+
font: inherit;
|
|
92
|
+
font-size: 12px;
|
|
93
|
+
line-height: 16px;
|
|
94
|
+
overflow-wrap: anywhere;
|
|
95
|
+
text-align: start;
|
|
96
|
+
}
|
|
97
|
+
.g-aikit-plan-progress__step_interactive {
|
|
98
|
+
width: 100%;
|
|
99
|
+
border: 0;
|
|
100
|
+
border-radius: var(--g-border-radius-m);
|
|
101
|
+
background: transparent;
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
}
|
|
104
|
+
.g-aikit-plan-progress__step_interactive:hover {
|
|
105
|
+
background-color: var(--g-color-base-simple-hover);
|
|
106
|
+
}
|
|
107
|
+
.g-aikit-plan-progress__step_interactive:hover .g-aikit-plan-progress__step-chevron, .g-aikit-plan-progress__step_interactive:focus-visible .g-aikit-plan-progress__step-chevron {
|
|
108
|
+
visibility: visible;
|
|
109
|
+
}
|
|
110
|
+
.g-aikit-plan-progress__step_interactive:hover .g-aikit-plan-progress__step-elapsed, .g-aikit-plan-progress__step_interactive:focus-visible .g-aikit-plan-progress__step-elapsed {
|
|
111
|
+
opacity: 0;
|
|
112
|
+
}
|
|
113
|
+
.g-aikit-plan-progress__step_interactive:focus-visible {
|
|
114
|
+
outline: 2px solid var(--g-color-line-focus);
|
|
115
|
+
outline-offset: -2px;
|
|
116
|
+
}
|
|
117
|
+
.g-aikit-plan-progress__step-trailing {
|
|
118
|
+
display: grid;
|
|
119
|
+
flex: none;
|
|
120
|
+
place-items: center end;
|
|
121
|
+
min-height: 16px;
|
|
122
|
+
margin-inline-start: auto;
|
|
123
|
+
color: var(--g-color-text-secondary);
|
|
124
|
+
}
|
|
125
|
+
.g-aikit-plan-progress__step-chevron, .g-aikit-plan-progress__step-elapsed {
|
|
126
|
+
grid-area: 1/1;
|
|
127
|
+
}
|
|
128
|
+
.g-aikit-plan-progress__step-chevron {
|
|
129
|
+
visibility: hidden;
|
|
130
|
+
}
|
|
131
|
+
.g-aikit-plan-progress__step-elapsed {
|
|
132
|
+
font-variant-numeric: tabular-nums;
|
|
133
|
+
white-space: nowrap;
|
|
134
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import "./PlanProgress.css";
|
|
2
|
+
declare const statusIcons: {
|
|
3
|
+
pending: (props: import("react").SVGProps<SVGSVGElement>) => React.JSX.Element;
|
|
4
|
+
completed: (props: import("react").SVGProps<SVGSVGElement>) => React.JSX.Element;
|
|
5
|
+
failed: (props: import("react").SVGProps<SVGSVGElement>) => React.JSX.Element;
|
|
6
|
+
cancelled: (props: import("react").SVGProps<SVGSVGElement>) => React.JSX.Element;
|
|
7
|
+
};
|
|
8
|
+
/** @experimental May change or be removed in minor releases. */
|
|
9
|
+
export interface PlanStep {
|
|
10
|
+
id: string;
|
|
11
|
+
title: string;
|
|
12
|
+
/** Formatted elapsed time supplied by the host. */
|
|
13
|
+
elapsedLabel?: string;
|
|
14
|
+
status: keyof typeof statusIcons | 'running';
|
|
15
|
+
}
|
|
16
|
+
/** @experimental May change or be removed in minor releases. */
|
|
17
|
+
export interface PlanStepListProps {
|
|
18
|
+
steps: readonly PlanStep[];
|
|
19
|
+
onStepClick?: (id: string) => void;
|
|
20
|
+
}
|
|
21
|
+
/** @experimental May change or be removed in minor releases. */
|
|
22
|
+
export declare function PlanStepList({ steps, onStepClick }: PlanStepListProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
/** @experimental May change or be removed in minor releases. */
|
|
24
|
+
export type PlanStatus = PlanStep['status'];
|
|
25
|
+
/** @experimental May change or be removed in minor releases. */
|
|
26
|
+
export interface PlanProgressProps extends PlanStepListProps {
|
|
27
|
+
status: PlanStatus;
|
|
28
|
+
view?: 'pill' | 'card';
|
|
29
|
+
onCancel?: () => void;
|
|
30
|
+
onOpenPreview?: () => void;
|
|
31
|
+
className?: string;
|
|
32
|
+
qa?: string;
|
|
33
|
+
}
|
|
34
|
+
/** @experimental May change or be removed in minor releases. */
|
|
35
|
+
export declare function PlanProgress({ steps, status, view, onStepClick, onCancel, onOpenPreview, className, qa, }: PlanProgressProps): import("react/jsx-runtime").JSX.Element | null;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PlanStepList = PlanStepList;
|
|
5
|
+
exports.PlanProgress = PlanProgress;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const icons_1 = require("@gravity-ui/icons");
|
|
9
|
+
const uikit_1 = require("@gravity-ui/uikit");
|
|
10
|
+
const cn_1 = require("../../../utils/cn.js");
|
|
11
|
+
const i18n_1 = require("./i18n/index.js");
|
|
12
|
+
require("./PlanProgress.css");
|
|
13
|
+
const b = (0, cn_1.block)('plan-progress');
|
|
14
|
+
const statusIcons = {
|
|
15
|
+
pending: icons_1.CircleDashed,
|
|
16
|
+
completed: icons_1.CircleCheck,
|
|
17
|
+
failed: icons_1.CircleExclamation,
|
|
18
|
+
cancelled: icons_1.CircleXmark,
|
|
19
|
+
};
|
|
20
|
+
/** @experimental May change or be removed in minor releases. */
|
|
21
|
+
function PlanStepList({ steps, onStepClick }) {
|
|
22
|
+
const { t } = i18n_1.i18n.useTranslation();
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)("ol", { className: b('steps'), children: steps.map(({ id, title, status, elapsedLabel }) => {
|
|
24
|
+
const content = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: b('status', { status }), role: "img", "aria-label": t(status), children: status === 'running' ? ((0, jsx_runtime_1.jsx)(uikit_1.Spin, { size: "xs", className: b('spinner') })) : ((0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: statusIcons[status], size: 14 })) }), (0, jsx_runtime_1.jsx)("span", { children: title })] }));
|
|
25
|
+
const elapsed = elapsedLabel && ((0, jsx_runtime_1.jsx)("span", { className: b('step-elapsed'), children: elapsedLabel }));
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)("li", { "aria-current": status === 'running' ? 'step' : undefined, children: onStepClick ? ((0, jsx_runtime_1.jsxs)("button", { type: "button", className: b('step', { interactive: true }), onClick: () => onStepClick(id), children: [content, (0, jsx_runtime_1.jsxs)("span", { className: b('step-trailing'), children: [elapsed, (0, jsx_runtime_1.jsx)(uikit_1.Icon, { className: b('step-chevron'), data: icons_1.ChevronRight, size: 12, "aria-hidden": true })] })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: b('step'), children: [content, elapsed && (0, jsx_runtime_1.jsx)("span", { className: b('step-trailing'), children: elapsed })] })) }, id));
|
|
27
|
+
}) }));
|
|
28
|
+
}
|
|
29
|
+
/** @experimental May change or be removed in minor releases. */
|
|
30
|
+
function PlanProgress({ steps, status, view = 'pill', onStepClick, onCancel, onOpenPreview, className, qa, }) {
|
|
31
|
+
const { t } = i18n_1.i18n.useTranslation();
|
|
32
|
+
const [expanded, setExpanded] = (0, react_1.useState)(false);
|
|
33
|
+
const [anchor, setAnchor] = (0, react_1.useState)(null);
|
|
34
|
+
const id = (0, uikit_1.useUniqId)();
|
|
35
|
+
if (!steps.length) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const total = steps.length;
|
|
39
|
+
const completed = steps.filter((step) => step.status === 'completed').length;
|
|
40
|
+
const statusLabel = t(`plan-${status}`);
|
|
41
|
+
const cancel = view === 'pill' && status === 'running' ? onCancel : undefined;
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: b({ view, split: Boolean(cancel) }, className), "data-qa": qa, children: [(0, jsx_runtime_1.jsxs)(uikit_1.Button, { ref: setAnchor, className: b('summary', { view }), view: "outlined", pin: cancel ? 'round-clear' : undefined, "aria-label": `${statusLabel}. ${t('progress', { completed, total })}`, "aria-haspopup": "dialog", "aria-expanded": expanded, "aria-controls": expanded ? id : undefined, onClick: () => setExpanded(!expanded), children: [(0, jsx_runtime_1.jsx)("span", { className: b('status', { status }), "aria-hidden": true, children: status === 'running' ? ((0, jsx_runtime_1.jsx)(uikit_1.Spin, { size: "xs", className: b('spinner') })) : ((0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: statusIcons[status], size: 14 })) }), statusLabel, (0, jsx_runtime_1.jsxs)("span", { className: b('count'), "aria-hidden": true, children: [completed, "/", total] })] }), cancel && ((0, jsx_runtime_1.jsx)(uikit_1.ActionTooltip, { title: t('cancel'), placement: "top", children: (0, jsx_runtime_1.jsx)(uikit_1.Button, { className: b('cancel'), view: "outlined", pin: "brick-round", "aria-label": t('cancel'), onClick: () => {
|
|
43
|
+
setExpanded(false);
|
|
44
|
+
cancel();
|
|
45
|
+
}, children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Xmark, size: 16, "aria-hidden": true }) }) })), view === 'card' && completed > 0 && onOpenPreview && ((0, jsx_runtime_1.jsxs)(uikit_1.Button, { view: "action", onClick: onOpenPreview, children: [(0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Eye, size: 16 }), t('view-preview')] })), (0, jsx_runtime_1.jsx)(uikit_1.Popup, { id: id, role: "dialog", floatingRef: (node) => node === null || node === void 0 ? void 0 : node.setAttribute('aria-label', t('title')), modal: true, placement: "top", offset: 8, anchorElement: anchor, open: expanded && Boolean(anchor), onOpenChange: setExpanded, className: b('popup'), children: (0, jsx_runtime_1.jsx)("div", { className: b('content'), tabIndex: 0, children: (0, jsx_runtime_1.jsx)(PlanStepList, { steps: steps, onStepClick: onStepClick &&
|
|
46
|
+
((stepId) => {
|
|
47
|
+
setExpanded(false);
|
|
48
|
+
onStepClick(stepId);
|
|
49
|
+
}) }) }) })] }));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=PlanProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlanProgress.js","sourceRoot":"../../../../../src","sources":["components/molecules/PlanProgress/PlanProgress.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;AA8Cb,oCAmDC;AAgBD,oCAiGC;;AAhND,iCAA+B;AAE/B,6CAQ2B;AAC3B,6CAAsF;AAEtF,6CAAwC;AAExC,0CAA4B;AAE5B,8BAA6B;AAE7B,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,eAAe,CAAC,CAAC;AAEjC,MAAM,WAAW,GAAG;IAChB,OAAO,EAAE,oBAAY;IACrB,SAAS,EAAE,mBAAW;IACtB,MAAM,EAAE,yBAAiB;IACzB,SAAS,EAAE,mBAAW;CACzB,CAAC;AAiBF,gEAAgE;AAChE,SAAgB,YAAY,CAAC,EAAC,KAAK,EAAE,WAAW,EAAoB;IAChE,MAAM,EAAC,CAAC,EAAC,GAAG,WAAI,CAAC,cAAc,EAAE,CAAC;IAElC,OAAO,CACH,+BAAI,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,YACpB,KAAK,CAAC,GAAG,CAAC,CAAC,EAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAC,EAAE,EAAE;YAC7C,MAAM,OAAO,GAAG,CACZ,6DACI,iCAAM,SAAS,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAC,MAAM,EAAC,CAAC,EAAE,IAAI,EAAC,KAAK,gBAAa,CAAC,CAAC,MAAM,CAAC,YACnE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,CACpB,uBAAC,YAAI,IAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAE,C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E,EACN,IAAI,EAAC,QAAQ,EACb,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,CAAC,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EACnE,KAAK,QACL,SAAS,EAAC,KAAK,EACf,MAAM,EAAE,CAAC,EACT,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,EACjC,YAAY,EAAE,WAAW,EACzB,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,YAErB,gCAAK,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC,YACrC,uBAAC,YAAY,IACT,KAAK,EAAE,KAAK,EACZ,WAAW,EACP,WAAW;4BACX,CAAC,CAAC,MAAM,EAAE,EAAE;gCACR,WAAW,CAAC,KAAK,CAAC,CAAC;gCACnB,WAAW,CAAC,MAAM,CAAC,CAAC;4BACxB,CAAC,CAAC,GAER,GACA,GACF,IACN,CACT,CAAC;AACN,CAAC","sourcesContent":["'use client';\n\nimport {useState} from 'react';\n\nimport {\n ChevronRight,\n CircleCheck,\n CircleDashed,\n CircleExclamation,\n CircleXmark,\n Eye,\n Xmark,\n} from '@gravity-ui/icons';\nimport {ActionTooltip, Button, Icon, Popup, Spin, useUniqId} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\n\nimport {i18n} from './i18n';\n\nimport './PlanProgress.scss';\n\nconst b = block('plan-progress');\n\nconst statusIcons = {\n pending: CircleDashed,\n completed: CircleCheck,\n failed: CircleExclamation,\n cancelled: CircleXmark,\n};\n\n/** @experimental May change or be removed in minor releases. */\nexport interface PlanStep {\n id: string;\n title: string;\n /** Formatted elapsed time supplied by the host. */\n elapsedLabel?: string;\n status: keyof typeof statusIcons | 'running';\n}\n\n/** @experimental May change or be removed in minor releases. */\nexport interface PlanStepListProps {\n steps: readonly PlanStep[];\n onStepClick?: (id: string) => void;\n}\n\n/** @experimental May change or be removed in minor releases. */\nexport function PlanStepList({steps, onStepClick}: PlanStepListProps) {\n const {t} = i18n.useTranslation();\n\n return (\n <ol className={b('steps')}>\n {steps.map(({id, title, status, elapsedLabel}) => {\n const content = (\n <>\n <span className={b('status', {status})} role=\"img\" aria-label={t(status)}>\n {status === 'running' ? (\n <Spin size=\"xs\" className={b('spinner')} />\n ) : (\n <Icon data={statusIcons[status]} size={14} />\n )}\n </span>\n <span>{title}</span>\n </>\n );\n const elapsed = elapsedLabel && (\n <span className={b('step-elapsed')}>{elapsedLabel}</span>\n );\n return (\n <li key={id} aria-current={status === 'running' ? 'step' : undefined}>\n {onStepClick ? (\n <button\n type=\"button\"\n className={b('step', {interactive: true})}\n onClick={() => onStepClick(id)}\n >\n {content}\n <span className={b('step-trailing')}>\n {elapsed}\n <Icon\n className={b('step-chevron')}\n data={ChevronRight}\n size={12}\n aria-hidden\n />\n </span>\n </button>\n ) : (\n <div className={b('step')}>\n {content}\n {elapsed && <span className={b('step-trailing')}>{elapsed}</span>}\n </div>\n )}\n </li>\n );\n })}\n </ol>\n );\n}\n\n/** @experimental May change or be removed in minor releases. */\nexport type PlanStatus = PlanStep['status'];\n\n/** @experimental May change or be removed in minor releases. */\nexport interface PlanProgressProps extends PlanStepListProps {\n status: PlanStatus;\n view?: 'pill' | 'card';\n onCancel?: () => void;\n onOpenPreview?: () => void;\n className?: string;\n qa?: string;\n}\n\n/** @experimental May change or be removed in minor releases. */\nexport function PlanProgress({\n steps,\n status,\n view = 'pill',\n onStepClick,\n onCancel,\n onOpenPreview,\n className,\n qa,\n}: PlanProgressProps) {\n const {t} = i18n.useTranslation();\n const [expanded, setExpanded] = useState(false);\n const [anchor, setAnchor] = useState<HTMLButtonElement | null>(null);\n const id = useUniqId();\n if (!steps.length) {\n return null;\n }\n\n const total = steps.length;\n const completed = steps.filter((step) => step.status === 'completed').length;\n const statusLabel = t(`plan-${status}`);\n const cancel = view === 'pill' && status === 'running' ? onCancel : undefined;\n\n return (\n <div className={b({view, split: Boolean(cancel)}, className)} data-qa={qa}>\n <Button\n ref={setAnchor}\n className={b('summary', {view})}\n view=\"outlined\"\n pin={cancel ? 'round-clear' : undefined}\n aria-label={`${statusLabel}. ${t('progress', {completed, total})}`}\n aria-haspopup=\"dialog\"\n aria-expanded={expanded}\n aria-controls={expanded ? id : undefined}\n onClick={() => setExpanded(!expanded)}\n >\n <span className={b('status', {status})} aria-hidden>\n {status === 'running' ? (\n <Spin size=\"xs\" className={b('spinner')} />\n ) : (\n <Icon data={statusIcons[status]} size={14} />\n )}\n </span>\n {statusLabel}\n <span className={b('count')} aria-hidden>\n {completed}/{total}\n </span>\n </Button>\n {cancel && (\n <ActionTooltip title={t('cancel')} placement=\"top\">\n <Button\n className={b('cancel')}\n view=\"outlined\"\n pin=\"brick-round\"\n aria-label={t('cancel')}\n onClick={() => {\n setExpanded(false);\n cancel();\n }}\n >\n <Icon data={Xmark} size={16} aria-hidden />\n </Button>\n </ActionTooltip>\n )}\n {view === 'card' && completed > 0 && onOpenPreview && (\n <Button view=\"action\" onClick={onOpenPreview}>\n <Icon data={Eye} size={16} />\n {t('view-preview')}\n </Button>\n )}\n <Popup\n id={id}\n role=\"dialog\"\n floatingRef={(node) => node?.setAttribute('aria-label', t('title'))}\n modal\n placement=\"top\"\n offset={8}\n anchorElement={anchor}\n open={expanded && Boolean(anchor)}\n onOpenChange={setExpanded}\n className={b('popup')}\n >\n <div className={b('content')} tabIndex={0}>\n <PlanStepList\n steps={steps}\n onStepClick={\n onStepClick &&\n ((stepId) => {\n setExpanded(false);\n onStepClick(stepId);\n })\n }\n />\n </div>\n </Popup>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Task plan",
|
|
3
|
+
"pending": "Pending",
|
|
4
|
+
"running": "In progress",
|
|
5
|
+
"completed": "Completed",
|
|
6
|
+
"failed": "Failed",
|
|
7
|
+
"cancelled": "Cancelled",
|
|
8
|
+
"plan-pending": "Awaiting start",
|
|
9
|
+
"plan-running": "In progress",
|
|
10
|
+
"plan-completed": "Plan completed",
|
|
11
|
+
"plan-failed": "Something went wrong",
|
|
12
|
+
"plan-cancelled": "Plan cancelled",
|
|
13
|
+
"progress": "{{completed}} of {{total}} steps completed",
|
|
14
|
+
"cancel": "Cancel",
|
|
15
|
+
"view-preview": "View preview"
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const i18n: ((key: "title" | "cancelled" | "progress" | "cancel" | "pending" | "running" | "completed" | "failed" | "plan-pending" | "plan-running" | "plan-completed" | "plan-failed" | "plan-cancelled" | "view-preview", params?: import("@gravity-ui/i18n").Params) => string) & {
|
|
2
|
+
Translation: import("react").ComponentType<{
|
|
3
|
+
children: (props: {
|
|
4
|
+
t: (key: "title" | "cancelled" | "progress" | "cancel" | "pending" | "running" | "completed" | "failed" | "plan-pending" | "plan-running" | "plan-completed" | "plan-failed" | "plan-cancelled" | "view-preview", params?: import("@gravity-ui/i18n").Params) => string;
|
|
5
|
+
}) => React.ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
useTranslation: () => {
|
|
8
|
+
t: (key: "title" | "cancelled" | "progress" | "cancel" | "pending" | "running" | "completed" | "failed" | "plan-pending" | "plan-running" | "plan-completed" | "plan-failed" | "plan-cancelled" | "view-preview", params?: import("@gravity-ui/i18n").Params) => string;
|
|
9
|
+
};
|
|
10
|
+
keysetData: {
|
|
11
|
+
"g-aikit.PlanProgress": Record<"title" | "cancelled" | "progress" | "cancel" | "pending" | "running" | "completed" | "failed" | "plan-pending" | "plan-running" | "plan-completed" | "plan-failed" | "plan-cancelled" | "view-preview", import("@gravity-ui/i18n").KeyData>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.i18n = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const i18n_1 = require("@gravity-ui/uikit/i18n");
|
|
6
|
+
const en_json_1 = tslib_1.__importDefault(require("./en.json"));
|
|
7
|
+
const ru_json_1 = tslib_1.__importDefault(require("./ru.json"));
|
|
8
|
+
exports.i18n = (0, i18n_1.addComponentKeysets)({ en: en_json_1.default, ru: ru_json_1.default }, 'g-aikit.PlanProgress');
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../../../src","sources":["components/molecules/PlanProgress/i18n/index.ts"],"names":[],"mappings":";;;;AAAA,iDAA2D;AAE3D,gEAA2B;AAC3B,gEAA2B;AAEd,QAAA,IAAI,GAAG,IAAA,0BAAmB,EAAC,EAAC,EAAE,EAAF,iBAAE,EAAE,EAAE,EAAF,iBAAE,EAAC,EAAE,sBAAsB,CAAC,CAAC","sourcesContent":["import {addComponentKeysets} from '@gravity-ui/uikit/i18n';\n\nimport en from './en.json';\nimport ru from './ru.json';\n\nexport const i18n = addComponentKeysets({en, ru}, 'g-aikit.PlanProgress');\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "План задач",
|
|
3
|
+
"pending": "Ожидает запуска",
|
|
4
|
+
"running": "Выполняется",
|
|
5
|
+
"completed": "Выполнен",
|
|
6
|
+
"failed": "Ошибка",
|
|
7
|
+
"cancelled": "Отменён",
|
|
8
|
+
"plan-pending": "Ожидает запуска",
|
|
9
|
+
"plan-running": "В процессе",
|
|
10
|
+
"plan-completed": "План выполнен",
|
|
11
|
+
"plan-failed": "Что-то пошло не так",
|
|
12
|
+
"plan-cancelled": "План отменён",
|
|
13
|
+
"progress": "Выполнено {{completed}} из {{total}} шагов",
|
|
14
|
+
"cancel": "Отменить",
|
|
15
|
+
"view-preview": "Посмотреть"
|
|
16
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlanStepList = exports.PlanProgress = void 0;
|
|
4
|
+
var PlanProgress_1 = require("./PlanProgress.js");
|
|
5
|
+
Object.defineProperty(exports, "PlanProgress", { enumerable: true, get: function () { return PlanProgress_1.PlanProgress; } });
|
|
6
|
+
Object.defineProperty(exports, "PlanStepList", { enumerable: true, get: function () { return PlanProgress_1.PlanStepList; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../../src","sources":["components/molecules/PlanProgress/index.ts"],"names":[],"mappings":";;;AAAA,kDAA0D;AAAlD,4GAAA,YAAY,OAAA;AAAE,4GAAA,YAAY,OAAA","sourcesContent":["export {PlanProgress, PlanStepList} from './PlanProgress';\nexport type {PlanProgressProps, PlanStatus, PlanStep, PlanStepListProps} from './PlanProgress';\n"]}
|