@gravity-ui/aikit 3.2.2-beta.ce1b72616966ae6173eb0bc3bbcec0fbdee91d24.0 → 3.3.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.
Files changed (93) hide show
  1. package/build/cjs/components/atoms/ScrollToBottomButton/ScrollToBottomButton.js +3 -2
  2. package/build/cjs/components/atoms/ScrollToBottomButton/ScrollToBottomButton.js.map +1 -1
  3. package/build/cjs/components/atoms/ScrollToBottomButton/i18n/index.js.map +1 -1
  4. package/build/cjs/components/internal/CompactRow/CompactRow.css +5 -0
  5. package/build/cjs/components/internal/CompactRow/CompactRow.d.ts +1 -1
  6. package/build/cjs/components/internal/CompactRow/CompactRow.js +2 -1
  7. package/build/cjs/components/internal/CompactRow/CompactRow.js.map +1 -1
  8. package/build/cjs/components/internal/MessageMarkdownContext.d.ts +3 -0
  9. package/build/cjs/components/internal/MessageMarkdownContext.js +6 -0
  10. package/build/cjs/components/internal/MessageMarkdownContext.js.map +1 -0
  11. package/build/cjs/components/internal/ThinkingMessage/ThinkingMessageView.js +1 -1
  12. package/build/cjs/components/internal/ThinkingMessage/ThinkingMessageView.js.map +1 -1
  13. package/build/cjs/components/molecules/ChangedFilesSummary/ChangedFilesSummary.css +1 -1
  14. package/build/cjs/components/molecules/ChangedFilesSummary/i18n/index.js.map +1 -1
  15. package/build/cjs/components/molecules/ChangedFilesSummary/index.js +3 -2
  16. package/build/cjs/components/molecules/ChangedFilesSummary/index.js.map +1 -1
  17. package/build/cjs/components/organisms/AssistantMessage/AssistantMessage.js +19 -3
  18. package/build/cjs/components/organisms/AssistantMessage/AssistantMessage.js.map +1 -1
  19. package/build/cjs/components/organisms/RunActivity/i18n/index.js.map +1 -1
  20. package/build/cjs/components/organisms/RunActivity/index.js +9 -6
  21. package/build/cjs/components/organisms/RunActivity/index.js.map +1 -1
  22. package/build/cjs/components/organisms/ToolMessage/index.js +4 -2
  23. package/build/cjs/components/organisms/ToolMessage/index.js.map +1 -1
  24. package/build/cjs/components/pages/AgentChat/AgentChat.css +0 -10
  25. package/build/cjs/components/pages/AgentChat/AgentComposer.js +68 -18
  26. package/build/cjs/components/pages/AgentChat/AgentComposer.js.map +1 -1
  27. package/build/cjs/components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.js.map +1 -1
  28. package/build/cjs/components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.ported.css +3 -6
  29. package/build/cjs/components/pages/AgentChat/controls/ui/components/InputIcon/InputIcon.ported.css +2 -2
  30. package/build/cjs/components/pages/AgentChat/controls/ui/components/List/List.js +3 -2
  31. package/build/cjs/components/pages/AgentChat/controls/ui/components/List/List.js.map +1 -1
  32. package/build/cjs/components/pages/AgentChat/controls/ui/components/SelectPopup/SelectPopup.js +7 -4
  33. package/build/cjs/components/pages/AgentChat/controls/ui/components/SelectPopup/SelectPopup.js.map +1 -1
  34. package/build/cjs/components/pages/AgentChat/controls/ui/components/SelectPopup/SelectPopup.ported.css +13 -13
  35. package/build/cjs/components/pages/AgentChat/controls/ui/modules/agent/components/AgentRepoSelect/AgentRepoSelect.js +2 -1
  36. package/build/cjs/components/pages/AgentChat/controls/ui/modules/agent/components/AgentRepoSelect/AgentRepoSelect.js.map +1 -1
  37. package/build/cjs/components/pages/AgentChat/controls/ui/modules/agent/components/SkillsAutocompletePopup/SkillsAutocompletePopup.d.ts +2 -1
  38. package/build/cjs/components/pages/AgentChat/controls/ui/modules/agent/components/SkillsAutocompletePopup/SkillsAutocompletePopup.js +10 -2
  39. package/build/cjs/components/pages/AgentChat/controls/ui/modules/agent/components/SkillsAutocompletePopup/SkillsAutocompletePopup.js.map +1 -1
  40. package/build/cjs/components/pages/AgentChat/types.js.map +1 -1
  41. package/build/cjs/components/templates/ChatContentV2/index.js +65 -13
  42. package/build/cjs/components/templates/ChatContentV2/index.js.map +1 -1
  43. package/build/cjs/package.json +1 -1
  44. package/build/docs/INDEX.md +5 -5
  45. package/build/docs/components/atoms/ScrollToBottomButton.md +2 -2
  46. package/build/docs/components/molecules/ChangedFilesSummary.md +2 -2
  47. package/build/docs/components/organisms/RunActivity.md +2 -2
  48. package/build/docs/components/pages/AgentChat.md +2 -2
  49. package/build/docs/components/templates/ChatContentV2.md +2 -2
  50. package/build/esm/components/atoms/ScrollToBottomButton/ScrollToBottomButton.js +3 -2
  51. package/build/esm/components/atoms/ScrollToBottomButton/ScrollToBottomButton.js.map +1 -1
  52. package/build/esm/components/atoms/ScrollToBottomButton/i18n/index.js.map +1 -1
  53. package/build/esm/components/internal/CompactRow/CompactRow.css +5 -0
  54. package/build/esm/components/internal/CompactRow/CompactRow.d.ts +1 -1
  55. package/build/esm/components/internal/CompactRow/CompactRow.js +2 -1
  56. package/build/esm/components/internal/CompactRow/CompactRow.js.map +1 -1
  57. package/build/esm/components/internal/MessageMarkdownContext.d.ts +3 -0
  58. package/build/esm/components/internal/MessageMarkdownContext.js +3 -0
  59. package/build/esm/components/internal/MessageMarkdownContext.js.map +1 -0
  60. package/build/esm/components/internal/ThinkingMessage/ThinkingMessageView.js +1 -1
  61. package/build/esm/components/internal/ThinkingMessage/ThinkingMessageView.js.map +1 -1
  62. package/build/esm/components/molecules/ChangedFilesSummary/ChangedFilesSummary.css +1 -1
  63. package/build/esm/components/molecules/ChangedFilesSummary/i18n/index.js.map +1 -1
  64. package/build/esm/components/molecules/ChangedFilesSummary/index.js +3 -2
  65. package/build/esm/components/molecules/ChangedFilesSummary/index.js.map +1 -1
  66. package/build/esm/components/organisms/AssistantMessage/AssistantMessage.js +19 -3
  67. package/build/esm/components/organisms/AssistantMessage/AssistantMessage.js.map +1 -1
  68. package/build/esm/components/organisms/RunActivity/i18n/index.js.map +1 -1
  69. package/build/esm/components/organisms/RunActivity/index.js +10 -7
  70. package/build/esm/components/organisms/RunActivity/index.js.map +1 -1
  71. package/build/esm/components/organisms/ToolMessage/index.js +4 -2
  72. package/build/esm/components/organisms/ToolMessage/index.js.map +1 -1
  73. package/build/esm/components/pages/AgentChat/AgentChat.css +0 -10
  74. package/build/esm/components/pages/AgentChat/AgentComposer.js +69 -19
  75. package/build/esm/components/pages/AgentChat/AgentComposer.js.map +1 -1
  76. package/build/esm/components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.js.map +1 -1
  77. package/build/esm/components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.ported.css +3 -6
  78. package/build/esm/components/pages/AgentChat/controls/ui/components/InputIcon/InputIcon.ported.css +2 -2
  79. package/build/esm/components/pages/AgentChat/controls/ui/components/List/List.js +3 -2
  80. package/build/esm/components/pages/AgentChat/controls/ui/components/List/List.js.map +1 -1
  81. package/build/esm/components/pages/AgentChat/controls/ui/components/SelectPopup/SelectPopup.js +7 -4
  82. package/build/esm/components/pages/AgentChat/controls/ui/components/SelectPopup/SelectPopup.js.map +1 -1
  83. package/build/esm/components/pages/AgentChat/controls/ui/components/SelectPopup/SelectPopup.ported.css +13 -13
  84. package/build/esm/components/pages/AgentChat/controls/ui/modules/agent/components/AgentRepoSelect/AgentRepoSelect.js +2 -1
  85. package/build/esm/components/pages/AgentChat/controls/ui/modules/agent/components/AgentRepoSelect/AgentRepoSelect.js.map +1 -1
  86. package/build/esm/components/pages/AgentChat/controls/ui/modules/agent/components/SkillsAutocompletePopup/SkillsAutocompletePopup.d.ts +2 -1
  87. package/build/esm/components/pages/AgentChat/controls/ui/modules/agent/components/SkillsAutocompletePopup/SkillsAutocompletePopup.js +10 -2
  88. package/build/esm/components/pages/AgentChat/controls/ui/modules/agent/components/SkillsAutocompletePopup/SkillsAutocompletePopup.js.map +1 -1
  89. package/build/esm/components/pages/AgentChat/types.js.map +1 -1
  90. package/build/esm/components/templates/ChatContentV2/index.js +65 -13
  91. package/build/esm/components/templates/ChatContentV2/index.js.map +1 -1
  92. package/build/esm/package.json +1 -1
  93. package/package.json +1 -1
@@ -6,18 +6,32 @@ const react_1 = require("react");
6
6
  const uikit_1 = require("@gravity-ui/uikit");
7
7
  const PromptInputFull_1 = require("../../organisms/PromptInput/PromptInputFull.js");
8
8
  const usePromptInput_1 = require("../../organisms/PromptInput/usePromptInput.js");
9
- const i18n_1 = require("./i18n.js");
10
9
  const AssistantModelSelect_1 = require("./controls/ui/components/AssistantModelSelect/AssistantModelSelect.js");
11
10
  const SelectPopup_1 = require("./controls/ui/components/SelectPopup/SelectPopup.js");
12
11
  const AgentRepoSelect_1 = require("./controls/ui/modules/agent/components/AgentRepoSelect/AgentRepoSelect.js");
13
12
  const SkillsAutocompletePopup_1 = require("./controls/ui/modules/agent/components/SkillsAutocompletePopup/SkillsAutocompletePopup.js");
13
+ const i18n_1 = require("./i18n.js");
14
14
  const slashIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M10.5 1.25C12.8472 1.25 14.75 3.15279 14.75 5.5V10.5C14.75 12.8472 12.8472 14.75 10.5 14.75H5.5C3.15279 14.75 1.25 12.8472 1.25 10.5V5.5C1.25 3.15279 3.15279 1.25 5.5 1.25H10.5ZM5.5 2.75C3.98122 2.75 2.75 3.98122 2.75 5.5V10.5C2.75 12.0188 3.98122 13.25 5.5 13.25H10.5C12.0188 13.25 13.25 12.0188 13.25 10.5V5.5C13.25 3.98122 12.0188 2.75 10.5 2.75H5.5ZM8.07129 5.12891C8.27636 4.61624 8.85839 4.36642 9.37109 4.57129C9.88377 4.77636 10.1336 5.35839 9.92871 5.87109L7.92871 10.8711C7.72364 11.3838 7.14161 11.6336 6.62891 11.4287C6.11623 11.2236 5.86642 10.6416 6.07129 10.1289L8.07129 5.12891Z" fill="currentColor"/>\n</svg>\n\n';
15
+ function getSlashCommand(value, start, end) {
16
+ if (start !== end || (start < value.length && !/\s/.test(value[start]))) {
17
+ return undefined;
18
+ }
19
+ const match = value.slice(0, start).match(/(?:^|\s)\/([^\s/]*)$/);
20
+ if (!match) {
21
+ return undefined;
22
+ }
23
+ return { start: start - match[1].length - 1, end: start, query: match[1] };
24
+ }
15
25
  /** @experimental May change or be removed in minor releases. */
16
26
  function AgentComposer({ status, onSend, onStop, models, skills, repositories, repository, onRepositoryChange, model, onModelChange, modelLabel, resetKey, }) {
17
- var _a, _b, _c;
27
+ var _a, _b;
28
+ const { t } = i18n_1.i18n.useTranslation();
18
29
  const [skillsOpen, setSkillsOpen] = (0, react_1.useState)(false);
19
30
  const [typedSkills, setTypedSkills] = (0, react_1.useState)(false);
20
31
  const [selectedIndex, setSelectedIndex] = (0, react_1.useState)(0);
32
+ const [selection, setSelection] = (0, react_1.useState)({ start: 0, end: 0 });
33
+ const pendingCaret = (0, react_1.useRef)();
34
+ const lastSelection = (0, react_1.useRef)({ value: '', start: 0, end: 0 });
21
35
  const buttonRef = (0, react_1.useRef)(null);
22
36
  const wrapperRef = (0, react_1.useRef)(null);
23
37
  const inputRef = (0, react_1.useRef)(null);
@@ -35,26 +49,56 @@ function AgentComposer({ status, onSend, onStop, models, skills, repositories, r
35
49
  });
36
50
  const { value: input, handleChange: setInput } = prompt;
37
51
  const busy = ['submitted', 'streaming', 'streaming_loading'].includes(status);
38
- const query = typedSkills ? ((_a = input.match(/(?:^|\s)\/([^\s]*)$/)) === null || _a === void 0 ? void 0 : _a[1]) || '' : '';
39
- const visibleSkills = skills.filter((skill) => skill.slug.includes(query));
52
+ const command = typedSkills
53
+ ? getSlashCommand(input, selection.start, selection.end)
54
+ : undefined;
55
+ const visibleSkills = skills.filter((skill) => { var _a; return skill.slug.includes((_a = command === null || command === void 0 ? void 0 : command.query) !== null && _a !== void 0 ? _a : ''); });
56
+ (0, uikit_1.useLayoutEffect)(() => {
57
+ var _a, _b;
58
+ if (pendingCaret.current !== undefined) {
59
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
60
+ (_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.setSelectionRange(pendingCaret.current, pendingCaret.current);
61
+ pendingCaret.current = undefined;
62
+ }
63
+ });
64
+ const updateSelection = (value) => {
65
+ var _a, _b, _c, _d;
66
+ const start = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.selectionStart) !== null && _b !== void 0 ? _b : value.length;
67
+ const end = (_d = (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.selectionEnd) !== null && _d !== void 0 ? _d : start;
68
+ const previous = lastSelection.current;
69
+ if (previous.value === value && previous.start === start && previous.end === end) {
70
+ return;
71
+ }
72
+ lastSelection.current = { value, start, end };
73
+ setSelection({ start, end });
74
+ setTypedSkills(Boolean(getSlashCommand(value, start, end)));
75
+ setSelectedIndex(0);
76
+ };
40
77
  const selectSkill = (skill) => {
41
- var _a, _b, _c;
78
+ var _a, _b, _c, _d;
42
79
  const caret = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.selectionStart) !== null && _b !== void 0 ? _b : input.length;
43
- const start = typedSkills ? input.lastIndexOf('/', caret) : caret;
44
- setInput(input.slice(0, start) + `/${skill.slug} ` + input.slice(caret));
80
+ const end = (_d = (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.selectionEnd) !== null && _d !== void 0 ? _d : caret;
81
+ const currentCommand = getSlashCommand(input, caret, end);
82
+ if (typedSkills && !skillsOpen && !currentCommand) {
83
+ setTypedSkills(false);
84
+ return;
85
+ }
86
+ const start = typedSkills && !skillsOpen && currentCommand ? currentCommand.start : caret;
87
+ const replacement = `/${skill.slug} `;
88
+ pendingCaret.current = start + replacement.length;
89
+ setInput(input.slice(0, start) + replacement + input.slice(end));
45
90
  setSkillsOpen(false);
46
91
  setTypedSkills(false);
47
- (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.focus();
48
92
  };
49
93
  const hookState = Object.assign(Object.assign({}, prompt), { handleChange: (value) => {
50
94
  setInput(value);
51
- setTypedSkills(/(?:^|\s)\/[^\s]*$/.test(value));
52
- setSelectedIndex(0);
95
+ updateSelection(value);
53
96
  }, handleKeyDown: (event) => {
54
97
  if (event.nativeEvent.isComposing || event.defaultPrevented) {
55
98
  return;
56
99
  }
57
- if (typedSkills && visibleSkills.length) {
100
+ const currentCommand = getSlashCommand(input, event.currentTarget.selectionStart, event.currentTarget.selectionEnd);
101
+ if (typedSkills && currentCommand && visibleSkills.length) {
58
102
  if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
59
103
  event.preventDefault();
60
104
  setSelectedIndex((index) => (index + (event.key === 'ArrowDown' ? 1 : visibleSkills.length - 1)) %
@@ -82,7 +126,7 @@ function AgentComposer({ status, onSend, onStop, models, skills, repositories, r
82
126
  }
83
127
  prompt.handleKeyDown(event);
84
128
  } });
85
- return ((0, jsx_runtime_1.jsx)("div", { className: "agent-chat__agent-footer", children: (0, jsx_runtime_1.jsxs)("div", { ref: wrapperRef, className: "agent-chat__agent-autocomplete", children: [prompt.sendError && ((0, jsx_runtime_1.jsx)(uikit_1.Text, { color: "danger", role: "alert", children: (0, i18n_1.i18n)('send-error') })), (0, jsx_runtime_1.jsx)(PromptInputFull_1.PromptInputFull, { className: "agent-chat__agent-input", hookState: hookState, headerProps: {
129
+ return ((0, jsx_runtime_1.jsx)("div", { className: "agent-chat__agent-footer", children: (0, jsx_runtime_1.jsxs)("div", { ref: wrapperRef, className: "agent-chat__agent-autocomplete", children: [prompt.sendError && ((0, jsx_runtime_1.jsx)(uikit_1.Text, { color: "danger", role: "alert", children: t('send-error') })), (0, jsx_runtime_1.jsx)(PromptInputFull_1.PromptInputFull, { className: "agent-chat__agent-input", hookState: hookState, headerProps: {
86
130
  contextItems: [
87
131
  {
88
132
  id: 'repository',
@@ -90,20 +134,26 @@ function AgentComposer({ status, onSend, onStop, models, skills, repositories, r
90
134
  },
91
135
  ],
92
136
  }, bodyProps: {
93
- placeholder: (0, i18n_1.i18n)('placeholder'),
137
+ placeholder: t('placeholder'),
94
138
  minRows: 1,
95
139
  maxRows: 10,
96
140
  autoFocus: true,
97
141
  inputRef,
142
+ controlProps: {
143
+ onSelect: () => updateSelection(input),
144
+ },
98
145
  }, footerProps: {
99
- submitButtonCancelableText: (0, i18n_1.i18n)('stop'),
100
- submitButtonTooltipSend: (0, i18n_1.i18n)('send'),
101
- submitButtonTooltipCancel: (0, i18n_1.i18n)('stop'),
146
+ submitButtonCancelableText: t('stop'),
147
+ submitButtonTooltipSend: t('send'),
148
+ submitButtonTooltipCancel: t('stop'),
102
149
  submitButtonQa: busy
103
150
  ? 'agent-chat-input-stop-button'
104
151
  : 'agent-chat-input-send-button',
105
- bottomContent: ((0, jsx_runtime_1.jsxs)(uikit_1.Flex, { width: "100%", alignItems: "center", gap: "2", children: [(0, jsx_runtime_1.jsx)(AssistantModelSelect_1.AssistantModelSelect, { size: "m", models: models, selectedModelId: model, selectedModelLabel: (_c = modelLabel !== null && modelLabel !== void 0 ? modelLabel : (_b = models.find((item) => item.id === model)) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : model, onSelect: onModelChange, header: (0, jsx_runtime_1.jsx)(SelectPopup_1.SelectPopup.Header, { children: (0, jsx_runtime_1.jsx)(uikit_1.Text, { variant: "subheader-2", children: (0, i18n_1.i18n)('select-model') }) }) }), (0, jsx_runtime_1.jsx)(uikit_1.Flex, { style: { flexGrow: 1 }, justifyContent: "flex-end", children: (0, jsx_runtime_1.jsx)(uikit_1.Button, { ref: buttonRef, "aria-label": (0, i18n_1.i18n)('select-skill'), view: "flat-secondary", size: "m", onClick: () => setSkillsOpen((open) => !open), selected: skillsOpen, qa: "skill-autocomplete-button", children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: slashIcon, size: 16 }) }) })] })),
106
- }, qa: "agent-chat-input" }), (skillsOpen || typedSkills) && ((0, jsx_runtime_1.jsx)(SkillsAutocompletePopup_1.SkillsAutocompletePopup, { skills: typedSkills ? visibleSkills : skills, selectedIndex: selectedIndex, anchorElement: skillsOpen ? buttonRef.current : wrapperRef.current, onSelect: selectSkill, onClose: () => {
152
+ bottomContent: ((0, jsx_runtime_1.jsxs)(uikit_1.Flex, { width: "100%", alignItems: "center", gap: "2", children: [(0, jsx_runtime_1.jsx)(AssistantModelSelect_1.AssistantModelSelect, { size: "m", models: models, selectedModelId: model, selectedModelLabel: (_b = modelLabel !== null && modelLabel !== void 0 ? modelLabel : (_a = models.find((item) => item.id === model)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : model, onSelect: onModelChange, header: (0, jsx_runtime_1.jsx)(SelectPopup_1.SelectPopup.Header, { children: (0, jsx_runtime_1.jsx)(uikit_1.Text, { variant: "subheader-2", children: t('select-model') }) }) }), (0, jsx_runtime_1.jsx)(uikit_1.Flex, { style: { flexGrow: 1 }, justifyContent: "flex-end", children: (0, jsx_runtime_1.jsx)(uikit_1.Button, { ref: buttonRef, "aria-label": t('select-skill'), view: "flat-secondary", size: "m", onClick: () => {
153
+ setTypedSkills(false);
154
+ setSkillsOpen((open) => !open);
155
+ }, selected: skillsOpen, qa: "skill-autocomplete-button", children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: slashIcon, size: 16 }) }) })] })),
156
+ }, qa: "agent-chat-input" }), (skillsOpen || command) && ((0, jsx_runtime_1.jsx)(SkillsAutocompletePopup_1.SkillsAutocompletePopup, { skills: skillsOpen ? skills : visibleSkills, selectedIndex: skillsOpen ? undefined : selectedIndex, onSelectedIndexChange: setSelectedIndex, anchorElement: skillsOpen ? buttonRef.current : wrapperRef.current, onSelect: selectSkill, onClose: () => {
107
157
  setSkillsOpen(false);
108
158
  setTypedSkills(false);
109
159
  }, placement: skillsOpen ? 'bottom-end' : 'top-start', withSearch: skillsOpen }))] }) }));
@@ -1 +1 @@
1
- {"version":3,"file":"AgentComposer.js","sourceRoot":"../../../../../src","sources":["components/pages/AgentChat/AgentComposer.tsx"],"names":[],"mappings":";;AAoCA,sCAuLC;;AA3ND,iCAAuC;AAEvC,6CAA2D;AAG3D,oFAA4E;AAC5E,kFAA0E;AAG1E,oCAA4B;AAC5B,gHAAwG;AACxG,qFAA6E;AAC7E,+GAAuG;AACvG,uIAA+H;AAE/H,MAAM,SAAS,GACX,iuBAAiuB,CAA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,cACf,uBAAC,YAAI,IAAC,OAAO,EAAC,aAAa,YACtB,IAAA,WAAI,EAAC,cAAc,CAAC,GAClB,GACU,GAE3B,EACF,uBAAC,YAAI,IAAC,KAAK,EAAE,EAAC,QAAQ,EAAE,CAAC,EAAC,EAAE,cAAc,EAAC,UAAU,YACjD,uBAAC,cAAM,IACH,GAAG,EAAE,SAAS,gBACF,IAAA,WAAI,EAAC,cAAc,CAAC,EAChC,IAAI,EAAC,gBAAgB,EACrB,IAAI,EAAC,GAAG,EACR,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAC7C,QAAQ,EAAE,UAAU,EACpB,EAAE,EAAC,2BAA2B,YAE9B,uBAAC,YAAI,IAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,GAAI,GAC9B,GACN,IACJ,CACV;qBACJ,EACD,EAAE,EAAC,kBAAkB,GACvB,EACD,CAAC,UAAU,IAAI,WAAW,CAAC,IAAI,CAC5B,uBAAC,iDAAuB,IACpB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,EAC5C,aAAa,EAAE,aAAa,EAC5B,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAClE,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,GAAG,EAAE;wBACV,aAAa,CAAC,KAAK,CAAC,CAAC;wBACrB,cAAc,CAAC,KAAK,CAAC,CAAC;oBAC1B,CAAC,EACD,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,EAClD,UAAU,EAAE,UAAU,GACxB,CACL,IACC,GACJ,CACT,CAAC;AACN,CAAC","sourcesContent":["import {useRef, useState} from 'react';\n\nimport {Button, Flex, Icon, Text} from '@gravity-ui/uikit';\n\nimport type {ChatStatus, TSubmitData} from '../../../types';\nimport {PromptInputFull} from '../../organisms/PromptInput/PromptInputFull';\nimport {usePromptInput} from '../../organisms/PromptInput/usePromptInput';\n\nimport type {AgentModelOption} from './types';\nimport {i18n} from './i18n';\nimport {AssistantModelSelect} from './controls/ui/components/AssistantModelSelect/AssistantModelSelect';\nimport {SelectPopup} from './controls/ui/components/SelectPopup/SelectPopup';\nimport {AgentRepoSelect} from './controls/ui/modules/agent/components/AgentRepoSelect/AgentRepoSelect';\nimport {SkillsAutocompletePopup} from './controls/ui/modules/agent/components/SkillsAutocompletePopup/SkillsAutocompletePopup';\n\nconst slashIcon =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\\n<path d=\"M10.5 1.25C12.8472 1.25 14.75 3.15279 14.75 5.5V10.5C14.75 12.8472 12.8472 14.75 10.5 14.75H5.5C3.15279 14.75 1.25 12.8472 1.25 10.5V5.5C1.25 3.15279 3.15279 1.25 5.5 1.25H10.5ZM5.5 2.75C3.98122 2.75 2.75 3.98122 2.75 5.5V10.5C2.75 12.0188 3.98122 13.25 5.5 13.25H10.5C12.0188 13.25 13.25 12.0188 13.25 10.5V5.5C13.25 3.98122 12.0188 2.75 10.5 2.75H5.5ZM8.07129 5.12891C8.27636 4.61624 8.85839 4.36642 9.37109 4.57129C9.88377 4.77636 10.1336 5.35839 9.92871 5.87109L7.92871 10.8711C7.72364 11.3838 7.14161 11.6336 6.62891 11.4287C6.11623 11.2236 5.86642 10.6416 6.07129 10.1289L8.07129 5.12891Z\" fill=\"currentColor\"/>\\n</svg>\\n\\n';\n\n/** @experimental May change or be removed in minor releases. */\nexport interface AgentComposerProps {\n models: AgentModelOption[];\n skills: Array<{slug: string; title?: string}>;\n repositories: Array<{orgSlug: string; slug: string}>;\n repository: {orgSlug: string; repoSlug: string};\n onRepositoryChange: (repository: {orgSlug: string; repoSlug: string}) => void;\n model: string;\n modelLabel?: string;\n onModelChange: (model: string) => void;\n status: ChatStatus;\n onSend: (data: TSubmitData) => Promise<void | false>;\n onStop: () => void;\n /** Scope draft recovery to the active conversation. */\n resetKey?: string | number;\n}\n\n/** @experimental May change or be removed in minor releases. */\nexport function AgentComposer({\n status,\n onSend,\n onStop,\n models,\n skills,\n repositories,\n repository,\n onRepositoryChange,\n model,\n onModelChange,\n modelLabel,\n resetKey,\n}: AgentComposerProps) {\n const [skillsOpen, setSkillsOpen] = useState(false);\n const [typedSkills, setTypedSkills] = useState(false);\n const [selectedIndex, setSelectedIndex] = useState(0);\n const buttonRef = useRef<HTMLButtonElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLTextAreaElement>(null);\n const prompt = usePromptInput({\n status,\n resetKey,\n onCancel: async () => {\n onStop();\n },\n onSend: async (data) => {\n setSkillsOpen(false);\n setTypedSkills(false);\n return onSend(data);\n },\n });\n const {value: input, handleChange: setInput} = prompt;\n const busy = ['submitted', 'streaming', 'streaming_loading'].includes(status);\n const query = typedSkills ? input.match(/(?:^|\\s)\\/([^\\s]*)$/)?.[1] || '' : '';\n const visibleSkills = skills.filter((skill) => skill.slug.includes(query));\n const selectSkill = (skill: (typeof skills)[number]) => {\n const caret = inputRef.current?.selectionStart ?? input.length;\n const start = typedSkills ? input.lastIndexOf('/', caret) : caret;\n setInput(input.slice(0, start) + `/${skill.slug} ` + input.slice(caret));\n setSkillsOpen(false);\n setTypedSkills(false);\n inputRef.current?.focus();\n };\n const hookState = {\n ...prompt,\n handleChange: (value: string) => {\n setInput(value);\n setTypedSkills(/(?:^|\\s)\\/[^\\s]*$/.test(value));\n setSelectedIndex(0);\n },\n handleKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.nativeEvent.isComposing || event.defaultPrevented) {\n return;\n }\n if (typedSkills && visibleSkills.length) {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n setSelectedIndex(\n (index) =>\n (index + (event.key === 'ArrowDown' ? 1 : visibleSkills.length - 1)) %\n visibleSkills.length,\n );\n return;\n }\n if (event.key === 'Escape') {\n event.preventDefault();\n setTypedSkills(false);\n return;\n }\n if (event.key === 'Enter' || event.key === 'Tab') {\n event.preventDefault();\n selectSkill(visibleSkills[selectedIndex % visibleSkills.length]);\n return;\n }\n }\n if (\n busy &&\n event.key === 'Enter' &&\n !event.shiftKey &&\n !event.ctrlKey &&\n !event.metaKey\n ) {\n event.preventDefault();\n return;\n }\n prompt.handleKeyDown(event);\n },\n };\n return (\n <div className=\"agent-chat__agent-footer\">\n <div ref={wrapperRef} className=\"agent-chat__agent-autocomplete\">\n {prompt.sendError && (\n <Text color=\"danger\" role=\"alert\">\n {i18n('send-error')}\n </Text>\n )}\n <PromptInputFull\n className=\"agent-chat__agent-input\"\n hookState={hookState}\n headerProps={{\n contextItems: [\n {\n id: 'repository',\n content: (\n <AgentRepoSelect\n {...repository}\n repositories={repositories}\n onRepoSelectionChange={onRepositoryChange}\n />\n ),\n },\n ],\n }}\n bodyProps={{\n placeholder: i18n('placeholder'),\n minRows: 1,\n maxRows: 10,\n autoFocus: true,\n inputRef,\n }}\n footerProps={{\n submitButtonCancelableText: i18n('stop'),\n submitButtonTooltipSend: i18n('send'),\n submitButtonTooltipCancel: i18n('stop'),\n submitButtonQa: busy\n ? 'agent-chat-input-stop-button'\n : 'agent-chat-input-send-button',\n bottomContent: (\n <Flex width=\"100%\" alignItems=\"center\" gap=\"2\">\n <AssistantModelSelect\n size=\"m\"\n models={models}\n selectedModelId={model}\n selectedModelLabel={\n modelLabel ??\n models.find((item) => item.id === model)?.name ??\n model\n }\n onSelect={onModelChange}\n header={\n <SelectPopup.Header>\n <Text variant=\"subheader-2\">\n {i18n('select-model')}\n </Text>\n </SelectPopup.Header>\n }\n />\n <Flex style={{flexGrow: 1}} justifyContent=\"flex-end\">\n <Button\n ref={buttonRef}\n aria-label={i18n('select-skill')}\n view=\"flat-secondary\"\n size=\"m\"\n onClick={() => setSkillsOpen((open) => !open)}\n selected={skillsOpen}\n qa=\"skill-autocomplete-button\"\n >\n <Icon data={slashIcon} size={16} />\n </Button>\n </Flex>\n </Flex>\n ),\n }}\n qa=\"agent-chat-input\"\n />\n {(skillsOpen || typedSkills) && (\n <SkillsAutocompletePopup\n skills={typedSkills ? visibleSkills : skills}\n selectedIndex={selectedIndex}\n anchorElement={skillsOpen ? buttonRef.current : wrapperRef.current}\n onSelect={selectSkill}\n onClose={() => {\n setSkillsOpen(false);\n setTypedSkills(false);\n }}\n placement={skillsOpen ? 'bottom-end' : 'top-start'}\n withSearch={skillsOpen}\n />\n )}\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"AgentComposer.js","sourceRoot":"../../../../../src","sources":["components/pages/AgentChat/AgentComposer.tsx"],"names":[],"mappings":";;AA+CA,sCAgOC;;AA/QD,iCAAuC;AAEvC,6CAA4E;AAG5E,oFAA4E;AAC5E,kFAA0E;AAE1E,gHAAwG;AACxG,qFAA6E;AAC7E,+GAAuG;AACvG,uIAA+H;AAC/H,oCAA4B;AAG5B,MAAM,SAAS,GACX,iuBAAiuB,CAAC;AAEtuB,SAAS,eAAe,CAAC,KAAa,EAAE,KAAa,EAAE,GAAW;IAC9D,IAAI,KAAK,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAClE,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,EAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,K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AI,CAAC,CAAC;wCACnC,CAAC,EACD,QAAQ,EAAE,UAAU,EACpB,EAAE,EAAC,2BAA2B,YAE9B,uBAAC,YAAI,IAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,GAAI,GAC9B,GACN,IACJ,CACV;qBACJ,EACD,EAAE,EAAC,kBAAkB,GACvB,EACD,CAAC,UAAU,IAAI,OAAO,CAAC,IAAI,CACxB,uBAAC,iDAAuB,IACpB,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,EAC3C,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EACrD,qBAAqB,EAAE,gBAAgB,EACvC,aAAa,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAClE,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,GAAG,EAAE;wBACV,aAAa,CAAC,KAAK,CAAC,CAAC;wBACrB,cAAc,CAAC,KAAK,CAAC,CAAC;oBAC1B,CAAC,EACD,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,EAClD,UAAU,EAAE,UAAU,GACxB,CACL,IACC,GACJ,CACT,CAAC;AACN,CAAC","sourcesContent":["import {useRef, useState} from 'react';\n\nimport {Button, Flex, Icon, Text, useLayoutEffect} from '@gravity-ui/uikit';\n\nimport type {ChatStatus, TSubmitData} from '../../../types';\nimport {PromptInputFull} from '../../organisms/PromptInput/PromptInputFull';\nimport {usePromptInput} from '../../organisms/PromptInput/usePromptInput';\n\nimport {AssistantModelSelect} from './controls/ui/components/AssistantModelSelect/AssistantModelSelect';\nimport {SelectPopup} from './controls/ui/components/SelectPopup/SelectPopup';\nimport {AgentRepoSelect} from './controls/ui/modules/agent/components/AgentRepoSelect/AgentRepoSelect';\nimport {SkillsAutocompletePopup} from './controls/ui/modules/agent/components/SkillsAutocompletePopup/SkillsAutocompletePopup';\nimport {i18n} from './i18n';\nimport type {AgentModelOption} from './types';\n\nconst slashIcon =\n '<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\\n<path d=\"M10.5 1.25C12.8472 1.25 14.75 3.15279 14.75 5.5V10.5C14.75 12.8472 12.8472 14.75 10.5 14.75H5.5C3.15279 14.75 1.25 12.8472 1.25 10.5V5.5C1.25 3.15279 3.15279 1.25 5.5 1.25H10.5ZM5.5 2.75C3.98122 2.75 2.75 3.98122 2.75 5.5V10.5C2.75 12.0188 3.98122 13.25 5.5 13.25H10.5C12.0188 13.25 13.25 12.0188 13.25 10.5V5.5C13.25 3.98122 12.0188 2.75 10.5 2.75H5.5ZM8.07129 5.12891C8.27636 4.61624 8.85839 4.36642 9.37109 4.57129C9.88377 4.77636 10.1336 5.35839 9.92871 5.87109L7.92871 10.8711C7.72364 11.3838 7.14161 11.6336 6.62891 11.4287C6.11623 11.2236 5.86642 10.6416 6.07129 10.1289L8.07129 5.12891Z\" fill=\"currentColor\"/>\\n</svg>\\n\\n';\n\nfunction getSlashCommand(value: string, start: number, end: number) {\n if (start !== end || (start < value.length && !/\\s/.test(value[start]))) {\n return undefined;\n }\n const match = value.slice(0, start).match(/(?:^|\\s)\\/([^\\s/]*)$/);\n if (!match) {\n return undefined;\n }\n return {start: start - match[1].length - 1, end: start, query: match[1]};\n}\n\n/** @experimental May change or be removed in minor releases. */\nexport interface AgentComposerProps {\n models: AgentModelOption[];\n skills: Array<{slug: string; title?: string}>;\n repositories: Array<{orgSlug: string; slug: string}>;\n repository: {orgSlug: string; repoSlug: string};\n onRepositoryChange: (repository: {orgSlug: string; repoSlug: string}) => void;\n model: string;\n modelLabel?: string;\n onModelChange: (model: string) => void;\n status: ChatStatus;\n onSend: (data: TSubmitData) => Promise<void | false>;\n onStop: () => void;\n /** Scope draft recovery to the active conversation. */\n resetKey?: string | number;\n}\n\n/** @experimental May change or be removed in minor releases. */\nexport function AgentComposer({\n status,\n onSend,\n onStop,\n models,\n skills,\n repositories,\n repository,\n onRepositoryChange,\n model,\n onModelChange,\n modelLabel,\n resetKey,\n}: AgentComposerProps) {\n const {t} = i18n.useTranslation();\n const [skillsOpen, setSkillsOpen] = useState(false);\n const [typedSkills, setTypedSkills] = useState(false);\n const [selectedIndex, setSelectedIndex] = useState(0);\n const [selection, setSelection] = useState({start: 0, end: 0});\n const pendingCaret = useRef<number>();\n const lastSelection = useRef({value: '', start: 0, end: 0});\n const buttonRef = useRef<HTMLButtonElement>(null);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLTextAreaElement>(null);\n const prompt = usePromptInput({\n status,\n resetKey,\n onCancel: async () => {\n onStop();\n },\n onSend: async (data) => {\n setSkillsOpen(false);\n setTypedSkills(false);\n return onSend(data);\n },\n });\n const {value: input, handleChange: setInput} = prompt;\n const busy = ['submitted', 'streaming', 'streaming_loading'].includes(status);\n const command = typedSkills\n ? getSlashCommand(input, selection.start, selection.end)\n : undefined;\n const visibleSkills = skills.filter((skill) => skill.slug.includes(command?.query ?? ''));\n useLayoutEffect(() => {\n if (pendingCaret.current !== undefined) {\n inputRef.current?.focus();\n inputRef.current?.setSelectionRange(pendingCaret.current, pendingCaret.current);\n pendingCaret.current = undefined;\n }\n });\n const updateSelection = (value: string) => {\n const start = inputRef.current?.selectionStart ?? value.length;\n const end = inputRef.current?.selectionEnd ?? start;\n const previous = lastSelection.current;\n if (previous.value === value && previous.start === start && previous.end === end) {\n return;\n }\n lastSelection.current = {value, start, end};\n setSelection({start, end});\n setTypedSkills(Boolean(getSlashCommand(value, start, end)));\n setSelectedIndex(0);\n };\n const selectSkill = (skill: (typeof skills)[number]) => {\n const caret = inputRef.current?.selectionStart ?? input.length;\n const end = inputRef.current?.selectionEnd ?? caret;\n const currentCommand = getSlashCommand(input, caret, end);\n if (typedSkills && !skillsOpen && !currentCommand) {\n setTypedSkills(false);\n return;\n }\n const start = typedSkills && !skillsOpen && currentCommand ? currentCommand.start : caret;\n const replacement = `/${skill.slug} `;\n pendingCaret.current = start + replacement.length;\n setInput(input.slice(0, start) + replacement + input.slice(end));\n setSkillsOpen(false);\n setTypedSkills(false);\n };\n const hookState = {\n ...prompt,\n handleChange: (value: string) => {\n setInput(value);\n updateSelection(value);\n },\n handleKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (event.nativeEvent.isComposing || event.defaultPrevented) {\n return;\n }\n const currentCommand = getSlashCommand(\n input,\n event.currentTarget.selectionStart,\n event.currentTarget.selectionEnd,\n );\n if (typedSkills && currentCommand && visibleSkills.length) {\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n setSelectedIndex(\n (index) =>\n (index + (event.key === 'ArrowDown' ? 1 : visibleSkills.length - 1)) %\n visibleSkills.length,\n );\n return;\n }\n if (event.key === 'Escape') {\n event.preventDefault();\n setTypedSkills(false);\n return;\n }\n if (event.key === 'Enter' || event.key === 'Tab') {\n event.preventDefault();\n selectSkill(visibleSkills[selectedIndex % visibleSkills.length]);\n return;\n }\n }\n if (\n busy &&\n event.key === 'Enter' &&\n !event.shiftKey &&\n !event.ctrlKey &&\n !event.metaKey\n ) {\n event.preventDefault();\n return;\n }\n prompt.handleKeyDown(event);\n },\n };\n return (\n <div className=\"agent-chat__agent-footer\">\n <div ref={wrapperRef} className=\"agent-chat__agent-autocomplete\">\n {prompt.sendError && (\n <Text color=\"danger\" role=\"alert\">\n {t('send-error')}\n </Text>\n )}\n <PromptInputFull\n className=\"agent-chat__agent-input\"\n hookState={hookState}\n headerProps={{\n contextItems: [\n {\n id: 'repository',\n content: (\n <AgentRepoSelect\n {...repository}\n repositories={repositories}\n onRepoSelectionChange={onRepositoryChange}\n />\n ),\n },\n ],\n }}\n bodyProps={{\n placeholder: t('placeholder'),\n minRows: 1,\n maxRows: 10,\n autoFocus: true,\n inputRef,\n controlProps: {\n onSelect: () => updateSelection(input),\n },\n }}\n footerProps={{\n submitButtonCancelableText: t('stop'),\n submitButtonTooltipSend: t('send'),\n submitButtonTooltipCancel: t('stop'),\n submitButtonQa: busy\n ? 'agent-chat-input-stop-button'\n : 'agent-chat-input-send-button',\n bottomContent: (\n <Flex width=\"100%\" alignItems=\"center\" gap=\"2\">\n <AssistantModelSelect\n size=\"m\"\n models={models}\n selectedModelId={model}\n selectedModelLabel={\n modelLabel ??\n models.find((item) => item.id === model)?.name ??\n model\n }\n onSelect={onModelChange}\n header={\n <SelectPopup.Header>\n <Text variant=\"subheader-2\">{t('select-model')}</Text>\n </SelectPopup.Header>\n }\n />\n <Flex style={{flexGrow: 1}} justifyContent=\"flex-end\">\n <Button\n ref={buttonRef}\n aria-label={t('select-skill')}\n view=\"flat-secondary\"\n size=\"m\"\n onClick={() => {\n setTypedSkills(false);\n setSkillsOpen((open) => !open);\n }}\n selected={skillsOpen}\n qa=\"skill-autocomplete-button\"\n >\n <Icon data={slashIcon} size={16} />\n </Button>\n </Flex>\n </Flex>\n ),\n }}\n qa=\"agent-chat-input\"\n />\n {(skillsOpen || command) && (\n <SkillsAutocompletePopup\n skills={skillsOpen ? skills : visibleSkills}\n selectedIndex={skillsOpen ? undefined : selectedIndex}\n onSelectedIndexChange={setSelectedIndex}\n anchorElement={skillsOpen ? buttonRef.current : wrapperRef.current}\n onSelect={selectSkill}\n onClose={() => {\n setSkillsOpen(false);\n setTypedSkills(false);\n }}\n placement={skillsOpen ? 'bottom-end' : 'top-start'}\n withSearch={skillsOpen}\n />\n )}\n </div>\n </div>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AssistantModelSelect.js","sourceRoot":"../../../../../../../../../src","sources":["components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.tsx"],"names":[],"mappings":";;AA+CA,oDAgGC;;;AA/ID,uDAAmD;AAEnD,6CAA8C;AAC9C,6CAA+C;AAE/C,uDAAuC;AAEvC,oFAA4E;AAE5E,4EAAoE;AAEpE,6C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AK,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAI,IACxE,CACZ,CAAC;IAEF,IAAI,QAAQ,IAAI,OAAO,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7C,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,OAAO,CACH,uBAAC,mDAAwB,IACrB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,eAAe,EAChC,QAAQ,EAAE,iBAAiB,EAC3B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,gBAAgB,EAC9B,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,CAAC,EAAC,GAAG,EAAE,YAAY,EAAC,EAAE,EAAE,CACnC,eAAK,CAAC,YAAY,CAAC,QAAQ,kCACpB,YAAY,KACf,GAAG,EAAE,GAAmC,IAC1C,GAER,CACL,CAAC;AACN,CAAC","sourcesContent":["import React, {useCallback, useState} from 'react';\n\nimport {ChevronDown} from '@gravity-ui/icons';\nimport {Button, Icon} from '@gravity-ui/uikit';\n\nimport {cn} from '../../../classNames';\nimport type {AgentModelOption} from '../../../../types';\nimport {getAssistantModelIcon} from '../../lib/utils/getAssistantModelIcon';\n\nimport {AssistantModelSelectMenu} from './AssistantModelSelectMenu';\n\nimport './AssistantModelSelect.ported.scss';\n\nconst css = {\n switcher: 'g-aikit-agent-model-select__switcher',\n switcherWidthMax: 'g-aikit-agent-model-select__switcherWidthMax',\n switcherLoading: 'g-aikit-agent-model-select__switcherLoading',\n switcherOutlined: 'g-aikit-agent-model-select__switcherOutlined',\n label: 'g-aikit-agent-model-select__label',\n switcherLabel: 'g-aikit-agent-model-select__switcherLabel',\n switcherBrandIcon: 'g-aikit-agent-model-select__switcherBrandIcon',\n popup: 'g-aikit-agent-model-select__popup',\n popupContent: 'g-aikit-agent-model-select__popupContent',\n itemRow: 'g-aikit-agent-model-select__itemRow',\n itemTitleUnavailable: 'g-aikit-agent-model-select__itemTitleUnavailable',\n brandIcon: 'g-aikit-agent-model-select__brandIcon',\n brandIconUnavailable: 'g-aikit-agent-model-select__brandIconUnavailable',\n itemEndContent: 'g-aikit-agent-model-select__itemEndContent',\n modelInfo: 'g-aikit-agent-model-select__modelInfo',\n};\n\nexport interface AssistantModelSelectProps {\n models: AgentModelOption[];\n selectedModelId?: string;\n selectedModelLabel: string;\n onSelect: (modelId: string) => void;\n disabled?: boolean;\n loading?: boolean;\n size?: 's' | 'm' | 'l' | 'xl';\n width?: 'auto' | 'max';\n view?: 'normal' | 'outlined';\n qa?: string;\n header?: React.ReactNode;\n footer?: React.ReactNode;\n onOpen?: () => void;\n}\n\nexport function AssistantModelSelect({\n models,\n selectedModelId,\n selectedModelLabel,\n onSelect,\n disabled = false,\n loading = false,\n size = 's',\n width = 'auto',\n view = 'normal',\n qa = 'assistant-model-selector',\n header,\n footer,\n onOpen,\n}: AssistantModelSelectProps) {\n const [internalOpen, setInternalOpen] = useState(false);\n const open = internalOpen;\n\n const handleOpenToggle = useCallback(\n (nextOpen: boolean) => {\n if (disabled || loading || models.length === 0) {\n return;\n }\n\n setInternalOpen(nextOpen);\n if (nextOpen) {\n onOpen?.();\n }\n },\n [disabled, loading, models.length, onOpen],\n );\n\n const handleSelectModel = useCallback(\n (modelId: string) => {\n onSelect(modelId);\n handleOpenToggle(false);\n },\n [handleOpenToggle, onSelect],\n );\n\n const selectedModel = models.find((model) => model.id === selectedModelId);\n\n const switcher = (\n <Button\n view={view}\n size={size}\n width={width}\n className={cn(\n css.switcher,\n loading && css.switcherLoading,\n width === 'max' && css.switcherWidthMax,\n view === 'outlined' && css.switcherOutlined,\n )}\n qa={qa}\n disabled={disabled || models.length === 0}\n loading={loading}\n selected={open}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n >\n {!loading && (\n <span className={css.switcherLabel}>\n {selectedModel ? (\n <span className={css.switcherBrandIcon} aria-hidden=\"true\">\n <Icon {...getAssistantModelIcon(selectedModel)} />\n </span>\n ) : null}\n <span className={css.label}>{selectedModelLabel}</span>\n </span>\n )}\n {!loading && <Icon data={ChevronDown} size={view === 'outlined' ? 16 : 14} />}\n </Button>\n );\n\n if (disabled || loading || models.length === 0) {\n return switcher;\n }\n\n return (\n <AssistantModelSelectMenu\n models={models}\n selectedModelId={selectedModelId}\n onSelect={handleSelectModel}\n header={header}\n footer={footer}\n open={open}\n onOpenChange={handleOpenToggle}\n width={width}\n renderControl={({ref, triggerProps}) =>\n React.cloneElement(switcher, {\n ...triggerProps,\n ref: ref as React.Ref<HTMLButtonElement>,\n })\n }\n />\n );\n}\n"]}
1
+ {"version":3,"file":"AssistantModelSelect.js","sourceRoot":"../../../../../../../../../src","sources":["components/pages/AgentChat/controls/ui/components/AssistantModelSelect/AssistantModelSelect.tsx"],"names":[],"mappings":";;AA+CA,oDAgGC;;;AA/ID,uDAAmD;AAEnD,6CAA8C;AAC9C,6CAA+C;AAG/C,uDAAuC;AACvC,oFAA4E;AAE5E,4EAAoE;AAEpE,6CAA4C;AAE5C,MAAM,GAAG,GAAG;IACR,QAAQ,EAAE,sCAAsC;IAChD,gBAAgB,EAAE,8CAA8C;IAChE,eAAe,EAAE,6CAA6C;IAC9D,gBAAgB,EAAE,8CAA8C;IAChE,KAAK,EAAE,mCAAmC;IAC1C,aAAa,EAAE,2CAA2C;IAC1D,iBAAiB,EAAE,+CAA+C;IAClE,KAAK,EAAE,mCAAmC;IAC1C,YAAY,EAAE,0CAA0C;IACxD,OAAO,EAAE,qCAAqC;IAC9C,oBAAoB,EAAE,kDAAkD;IACxE,SAAS,EAAE,uCAAuC;IAClD,oBAAoB,EAAE,kDAAkD;IACxE,cAAc,EAAE,4CAA4C;IAC5D,SAAS,EAAE,uCAAuC;CACrD,CAAC;AAkBF,SAAgB,oBAAoB,CAAC,EACjC,MAAM,EACN,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,I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ACN,CAAC","sourcesContent":["import React, {useCallback, useState} from 'react';\n\nimport {ChevronDown} from '@gravity-ui/icons';\nimport {Button, Icon} from '@gravity-ui/uikit';\n\nimport type {AgentModelOption} from '../../../../types';\nimport {cn} from '../../../classNames';\nimport {getAssistantModelIcon} from '../../lib/utils/getAssistantModelIcon';\n\nimport {AssistantModelSelectMenu} from './AssistantModelSelectMenu';\n\nimport './AssistantModelSelect.ported.scss';\n\nconst css = {\n switcher: 'g-aikit-agent-model-select__switcher',\n switcherWidthMax: 'g-aikit-agent-model-select__switcherWidthMax',\n switcherLoading: 'g-aikit-agent-model-select__switcherLoading',\n switcherOutlined: 'g-aikit-agent-model-select__switcherOutlined',\n label: 'g-aikit-agent-model-select__label',\n switcherLabel: 'g-aikit-agent-model-select__switcherLabel',\n switcherBrandIcon: 'g-aikit-agent-model-select__switcherBrandIcon',\n popup: 'g-aikit-agent-model-select__popup',\n popupContent: 'g-aikit-agent-model-select__popupContent',\n itemRow: 'g-aikit-agent-model-select__itemRow',\n itemTitleUnavailable: 'g-aikit-agent-model-select__itemTitleUnavailable',\n brandIcon: 'g-aikit-agent-model-select__brandIcon',\n brandIconUnavailable: 'g-aikit-agent-model-select__brandIconUnavailable',\n itemEndContent: 'g-aikit-agent-model-select__itemEndContent',\n modelInfo: 'g-aikit-agent-model-select__modelInfo',\n};\n\nexport interface AssistantModelSelectProps {\n models: AgentModelOption[];\n selectedModelId?: string;\n selectedModelLabel: string;\n onSelect: (modelId: string) => void;\n disabled?: boolean;\n loading?: boolean;\n size?: 's' | 'm' | 'l' | 'xl';\n width?: 'auto' | 'max';\n view?: 'normal' | 'outlined';\n qa?: string;\n header?: React.ReactNode;\n footer?: React.ReactNode;\n onOpen?: () => void;\n}\n\nexport function AssistantModelSelect({\n models,\n selectedModelId,\n selectedModelLabel,\n onSelect,\n disabled = false,\n loading = false,\n size = 's',\n width = 'auto',\n view = 'normal',\n qa = 'assistant-model-selector',\n header,\n footer,\n onOpen,\n}: AssistantModelSelectProps) {\n const [internalOpen, setInternalOpen] = useState(false);\n const open = internalOpen;\n\n const handleOpenToggle = useCallback(\n (nextOpen: boolean) => {\n if (disabled || loading || models.length === 0) {\n return;\n }\n\n setInternalOpen(nextOpen);\n if (nextOpen) {\n onOpen?.();\n }\n },\n [disabled, loading, models.length, onOpen],\n );\n\n const handleSelectModel = useCallback(\n (modelId: string) => {\n onSelect(modelId);\n handleOpenToggle(false);\n },\n [handleOpenToggle, onSelect],\n );\n\n const selectedModel = models.find((model) => model.id === selectedModelId);\n\n const switcher = (\n <Button\n view={view}\n size={size}\n width={width}\n className={cn(\n css.switcher,\n loading && css.switcherLoading,\n width === 'max' && css.switcherWidthMax,\n view === 'outlined' && css.switcherOutlined,\n )}\n qa={qa}\n disabled={disabled || models.length === 0}\n loading={loading}\n selected={open}\n aria-haspopup=\"listbox\"\n aria-expanded={open}\n >\n {!loading && (\n <span className={css.switcherLabel}>\n {selectedModel ? (\n <span className={css.switcherBrandIcon} aria-hidden=\"true\">\n <Icon {...getAssistantModelIcon(selectedModel)} />\n </span>\n ) : null}\n <span className={css.label}>{selectedModelLabel}</span>\n </span>\n )}\n {!loading && <Icon data={ChevronDown} size={view === 'outlined' ? 16 : 14} />}\n </Button>\n );\n\n if (disabled || loading || models.length === 0) {\n return switcher;\n }\n\n return (\n <AssistantModelSelectMenu\n models={models}\n selectedModelId={selectedModelId}\n onSelect={handleSelectModel}\n header={header}\n footer={footer}\n open={open}\n onOpenChange={handleOpenToggle}\n width={width}\n renderControl={({ref, triggerProps}) =>\n React.cloneElement(switcher, {\n ...triggerProps,\n ref: ref as React.Ref<HTMLButtonElement>,\n })\n }\n />\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  .g-aikit-agent-model-select__switcher {
2
- max-width: var(--base-width-160);
2
+ max-width: var(--base-width-160, 160px);
3
3
  }
4
4
 
5
5
  .g-aikit-agent-model-select__switcherWidthMax {
@@ -48,10 +48,7 @@
48
48
  }
49
49
 
50
50
  .g-aikit-agent-model-select__popup {
51
- --g-popup-border-radius: var(--dropdown-popup-border-radius);
52
- }
53
-
54
- .popup.g-select-popup {
51
+ --g-popup-border-radius: var(--dropdown-popup-border-radius, var(--g-border-radius-xl));
55
52
  max-width: calc(100vw - 24px);
56
53
  }
57
54
 
@@ -61,7 +58,7 @@
61
58
  overflow: hidden;
62
59
  /* Reduce the list by one 32px model row and its spacing. */
63
60
  --select-popup-list-max-height: calc(
64
- min(448px, calc(100dvh - 128px)) - 32px - var(--dropdown-item-gap-m)
61
+ min(448px, calc(100dvh - 128px)) - 32px - var(--dropdown-item-gap-m, var(--g-spacing-half))
65
62
  );
66
63
  }
67
64
 
@@ -3,11 +3,11 @@
3
3
  }
4
4
 
5
5
  .g-aikit-agent-input-icon__start {
6
- padding-left: var(--spacing-1-and-half);
6
+ padding-left: var(--spacing-1-and-half, 6px);
7
7
  padding-right: var(--g-spacing-1);
8
8
  }
9
9
 
10
10
  .g-aikit-agent-input-icon__end {
11
- padding-right: var(--spacing-1-and-half);
11
+ padding-right: var(--spacing-1-and-half, 6px);
12
12
  padding-left: var(--g-spacing-1);
13
13
  }
@@ -4,16 +4,17 @@ exports.List = List;
4
4
  const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const uikit_1 = require("@gravity-ui/uikit");
7
- const classNames_1 = require("../../../classNames.js");
8
7
  const i18n_1 = require("../../../../i18n.js");
8
+ const classNames_1 = require("../../../classNames.js");
9
9
  require("./List.ported.css");
10
10
  const css = {
11
11
  wrapper: 'g-aikit-agent-list__wrapper',
12
12
  count: 'g-aikit-agent-list__count',
13
13
  };
14
14
  function List(props) {
15
+ const { t } = i18n_1.i18n.useTranslation();
15
16
  const { containerRef, containerStyle, className } = props, listProps = tslib_1.__rest(props, ["containerRef", "containerStyle", "className"]);
16
- const list = props.items.length ? ((0, jsx_runtime_1.jsx)(uikit_1.List, Object.assign({}, listProps, { className: (0, classNames_1.cn)(css.wrapper, className) }))) : ((0, jsx_runtime_1.jsx)(uikit_1.Text, { color: "secondary", children: (0, i18n_1.i18n)('nothing-found') }));
17
+ const list = props.items.length ? ((0, jsx_runtime_1.jsx)(uikit_1.List, Object.assign({}, listProps, { className: (0, classNames_1.cn)(css.wrapper, className) }))) : ((0, jsx_runtime_1.jsx)(uikit_1.Text, { color: "secondary", children: t('nothing-found') }));
17
18
  if (!containerRef && !containerStyle) {
18
19
  return list;
19
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sourceRoot":"../../../../../../../../../src","sources":["components/pages/AgentChat/controls/ui/components/List/List.tsx"],"names":[],"mappings":";;AAkBA,oBAkBC;;;AAlCD,6CAAsE;AAEtE,uDAAuC;AACvC,8CAAoD;AAEpD,6BAA4B;AAC5B,MAAM,GAAG,GAAG;IACR,OAAO,EAAE,6BAA6B;IACtC,KAAK,EAAE,2BAA2B;CACrC,CAAC;AAOF,SAAgB,IAAI,CAAO,KAAuB;IAC9C,MAAM,EAAC,YAAY,EAAE,cAAc,EAAE,SAAS,KAAkB,KAAK,EAAlB,SAAS,kBAAI,KAAK,EAA/D,+CAAuD,CAAQ,CAAC;IAEtE,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAC9B,uBAAC,YAAK,oBAAK,SAAS,IAAE,SAAS,EAAE,IAAA,eAAE,EAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAClE,CAAC,CAAC,CAAC,CACA,uBAAC,YAAI,IAAC,KAAK,EAAC,WAAW,YAAE,IAAA,WAAU,EAAC,eAAe,CAAC,GAAQ,CAC/D,CAAC;IAEF,IAAI,CAAC,YAAY,IAAI,CAAC,cAAc,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CACH,gCAAK,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,YACxC,IAAI,GACH,CACT,CAAC;AACN,CAAC;AAMD,IAAI,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAA0C;IAC5E,OAAO,CACH,gCAAK,SAAS,EAAE,IAAA,eAAE,EAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,YAC1C,uBAAC,YAAI,IAAC,KAAK,EAAC,WAAW,YAAE,KAAK,CAAC,QAAQ,GAAQ,GAC7C,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import {type CSSProperties, type PropsWithChildren, type Ref} from 'react';\n\nimport {List as GList, type ListProps, Text} from '@gravity-ui/uikit';\n\nimport {cn} from '../../../classNames';\nimport {i18n as i18nGlobal} from '../../../../i18n';\n\nimport './List.ported.scss';\nconst css = {\n wrapper: 'g-aikit-agent-list__wrapper',\n count: 'g-aikit-agent-list__count',\n};\n\nexport interface IListProps<Item> extends ListProps<Item> {\n containerRef?: Ref<HTMLDivElement>;\n containerStyle?: CSSProperties;\n}\n\nexport function List<Item>(props: IListProps<Item>) {\n const {containerRef, containerStyle, className, ...listProps} = props;\n\n const list = props.items.length ? (\n <GList {...listProps} className={cn(css.wrapper, className)} />\n ) : (\n <Text color=\"secondary\">{i18nGlobal('nothing-found')}</Text>\n );\n\n if (!containerRef && !containerStyle) {\n return list;\n }\n\n return (\n <div ref={containerRef} style={containerStyle}>\n {list}\n </div>\n );\n}\n\ninterface IItemsCountProps {\n className?: string;\n}\n\nList.ItemsCount = function ItemsCount(props: PropsWithChildren<IItemsCountProps>) {\n return (\n <div className={cn(css.count, props.className)}>\n <Text color=\"secondary\">{props.children}</Text>\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"List.js","sourceRoot":"../../../../../../../../../src","sources":["components/pages/AgentChat/controls/ui/components/List/List.tsx"],"names":[],"mappings":";;AAkBA,oBAmBC;;;AAnCD,6CAAsE;AAEtE,8CAAoD;AACpD,uDAAuC;AAEvC,6BAA4B;AAC5B,MAAM,GAAG,GAAG;IACR,OAAO,EAAE,6BAA6B;IACtC,KAAK,EAAE,2BAA2B;CACrC,CAAC;AAOF,SAAgB,IAAI,CAAO,KAAuB;IAC9C,MAAM,EAAC,CAAC,EAAC,GAAG,WAAU,CAAC,cAAc,EAAE,CAAC;IACxC,MAAM,EAAC,YAAY,EAAE,cAAc,EAAE,SAAS,KAAkB,KAAK,EAAlB,SAAS,kBAAI,KAAK,EAA/D,+CAAuD,CAAQ,CAAC;IAEtE,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAC9B,uBAAC,YAAK,oBAAK,SAAS,IAAE,SAAS,EAAE,IAAA,eAAE,EAAC,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAClE,CAAC,CAAC,CAAC,CACA,uBAAC,YAAI,IAAC,KAAK,EAAC,WAAW,YAAE,CAAC,CAAC,eAAe,CAAC,GAAQ,CACtD,CAAC;IAEF,IAAI,CAAC,YAAY,IAAI,CAAC,cAAc,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CACH,gCAAK,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc,YACxC,IAAI,GACH,CACT,CAAC;AACN,CAAC;AAMD,IAAI,CAAC,UAAU,GAAG,SAAS,UAAU,CAAC,KAA0C;IAC5E,OAAO,CACH,gCAAK,SAAS,EAAE,IAAA,eAAE,EAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,YAC1C,uBAAC,YAAI,IAAC,KAAK,EAAC,WAAW,YAAE,KAAK,CAAC,QAAQ,GAAQ,GAC7C,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import {type CSSProperties, type PropsWithChildren, type Ref} from 'react';\n\nimport {List as GList, type ListProps, Text} from '@gravity-ui/uikit';\n\nimport {i18n as i18nGlobal} from '../../../../i18n';\nimport {cn} from '../../../classNames';\n\nimport './List.ported.scss';\nconst css = {\n wrapper: 'g-aikit-agent-list__wrapper',\n count: 'g-aikit-agent-list__count',\n};\n\nexport interface IListProps<Item> extends ListProps<Item> {\n containerRef?: Ref<HTMLDivElement>;\n containerStyle?: CSSProperties;\n}\n\nexport function List<Item>(props: IListProps<Item>) {\n const {t} = i18nGlobal.useTranslation();\n const {containerRef, containerStyle, className, ...listProps} = props;\n\n const list = props.items.length ? (\n <GList {...listProps} className={cn(css.wrapper, className)} />\n ) : (\n <Text color=\"secondary\">{t('nothing-found')}</Text>\n );\n\n if (!containerRef && !containerStyle) {\n return list;\n }\n\n return (\n <div ref={containerRef} style={containerStyle}>\n {list}\n </div>\n );\n}\n\ninterface IItemsCountProps {\n className?: string;\n}\n\nList.ItemsCount = function ItemsCount(props: PropsWithChildren<IItemsCountProps>) {\n return (\n <div className={cn(css.count, props.className)}>\n <Text color=\"secondary\">{props.children}</Text>\n </div>\n );\n};\n"]}
@@ -7,8 +7,8 @@ const react_1 = require("react");
7
7
  const icons_1 = require("@gravity-ui/icons");
8
8
  const uikit_1 = require("@gravity-ui/uikit");
9
9
  const uikit_2 = require("@gravity-ui/uikit");
10
- const classNames_1 = require("../../../classNames.js");
11
10
  const i18n_1 = require("../../../../i18n.js");
11
+ const classNames_1 = require("../../../classNames.js");
12
12
  const index_1 = require("../ListItem/index.js");
13
13
  require("./SelectPopup.ported.css");
14
14
  const DebounceTextInput = uikit_1.TextInput;
@@ -41,7 +41,8 @@ SelectPopup.List = function SelectPopupList(props) {
41
41
  };
42
42
  SelectPopup.ListCount = function SelectPopupListCount(_a) {
43
43
  var { count, color = 'secondary' } = _a, props = tslib_1.__rest(_a, ["count", "color"]);
44
- return ((0, jsx_runtime_1.jsx)(uikit_1.Text, Object.assign({}, props, { color: color, className: (0, classNames_1.cn)(css.listCount, props.className), children: (0, i18n_1.i18n)('items-found', { items: count }) })));
44
+ const { t } = i18n_1.i18n.useTranslation();
45
+ return ((0, jsx_runtime_1.jsx)(uikit_1.Text, Object.assign({}, props, { color: color, className: (0, classNames_1.cn)(css.listCount, props.className), children: t('items-found', { items: count }) })));
45
46
  };
46
47
  SelectPopup.Footer = function SelectPopupFooter(props) {
47
48
  return (0, jsx_runtime_1.jsx)("div", Object.assign({}, props, { className: (0, classNames_1.cn)(css.footer, props.className) }));
@@ -51,13 +52,15 @@ SelectPopup.FooterButton = function SelectPopupFooterButton(props) {
51
52
  };
52
53
  SelectPopup.Search = (0, react_1.forwardRef)(function SelectPopupSearch(_a, ref) {
53
54
  var { debounced } = _a, props = tslib_1.__rest(_a, ["debounced"]);
55
+ const { t } = i18n_1.i18n.useTranslation();
54
56
  const Component = debounced ? DebounceTextInput : uikit_1.TextInput;
55
- return ((0, jsx_runtime_1.jsx)(Component, Object.assign({ startContent: (0, jsx_runtime_1.jsx)("div", { className: css.searchIcon, children: (0, jsx_runtime_1.jsx)(uikit_2.Icon, { data: icons_1.Magnifier, size: 16 }) }) }, props, { placeholder: (0, i18n_1.i18n)('search'), className: (0, classNames_1.cn)(css.search, props.className), ref: ref })));
57
+ return ((0, jsx_runtime_1.jsx)(Component, Object.assign({ startContent: (0, jsx_runtime_1.jsx)("div", { className: css.searchIcon, children: (0, jsx_runtime_1.jsx)(uikit_2.Icon, { data: icons_1.Magnifier, size: 16 }) }) }, props, { placeholder: t('search'), className: (0, classNames_1.cn)(css.search, props.className), ref: ref })));
56
58
  });
57
59
  SelectPopup.ListItem = index_1.ListItem;
58
60
  SelectPopup.EmptyOptions = function SelectPopupEmptyOptions(_a) {
59
61
  var { children } = _a, props = tslib_1.__rest(_a, ["children"]);
60
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, props, { className: (0, classNames_1.cn)(css.emptyOptions, props.className), children: children !== null && children !== void 0 ? children : ((0, jsx_runtime_1.jsx)(SelectPopup.EmptyPlaceholder, { children: (0, i18n_1.i18n)('nothing-found') })) })));
62
+ const { t } = i18n_1.i18n.useTranslation();
63
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, props, { className: (0, classNames_1.cn)(css.emptyOptions, props.className), children: children !== null && children !== void 0 ? children : ((0, jsx_runtime_1.jsx)(SelectPopup.EmptyPlaceholder, { children: t('nothing-found') })) })));
61
64
  };
62
65
  SelectPopup.EmptyPlaceholder = function SelectPopupEmptyOptions(_a) {
63
66
  var { color = 'secondary' } = _a, props = tslib_1.__rest(_a, ["color"]);
@@ -1 +1 @@
1
- {"version":3,"file":"SelectPopup.js","sourceRoot":"../../../../../../../../../src","sources":["components/pages/AgentChat/controls/ui/components/SelectPopup/SelectPopup.tsx"],"names":[],"mappings":";;AAkCA,kCAEC;;;AApCD,iCAAwC;AAExC,6CAA4C;AAC5C,6CAS2B;AAC3B,6CAAuC;AAEvC,uDAAuC;AACvC,8CAAsC;AACtC,gDAA2C;AAE3C,oCAAmC;AACnC,MAAM,iBAAiB,GAAG,iBAAS,CAAC;AAEpC,MAAM,GAAG,GAAG;IACR,OAAO,EAAE,qCAAqC;IAC9C,MAAM,EAAE,oCAAoC;IAC5C,MAAM,EAAE,oCAAoC;IAC5C,IAAI,EAAE,kCAAkC;IACxC,MAAM,EAAE,oCAAoC;IAC5C,MAAM,EAAE,oCAAoC;IAC5C,UAAU,EAAE,wCAAwC;IACpD,YAAY,EAAE,0CAA0C;IACxD,SAAS,EAAE,uCAAuC;CACrD,CAAC;AAEF,SAAgB,WAAW,CAAC,KAA2C;IACnE,OAAO,gDAAS,KAAK,IAAE,SAAS,EAAE,IAAA,eAAE,EAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;AAC3E,CAAC;AAED,WAAW,CAAC,MAAM,GAAG,SAAS,iBAAiB,CAAC,KAA2C;IACvF,OAAO,gDAAS,KAAK,IAAE,SAAS,EAAE,IAAA,eAAE,EAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;AAC1E,CAAC,CAAC;AAEF,WAAW,CAAC,MAAM,GAAG,SAAS,iBAAiB,CAAC,KAA2C;IACvF,OAAO,gDAAS,KAAK,IAAE,SAAS,EAAE,IAAA,eAAE,EAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,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BAAK,KAAK,IAAE,KAAK,EAAE,KAAK,IAAI,CAAC;AAC7C,CAAC,CAAC","sourcesContent":["import React, {forwardRef} from 'react';\n\nimport {Magnifier} from '@gravity-ui/icons';\nimport {\n Button,\n type ButtonProps,\n SegmentedRadioGroup,\n type SegmentedRadioGroupProps,\n Text,\n TextInput,\n type TextInputProps,\n type TextProps,\n} from '@gravity-ui/uikit';\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {cn} from '../../../classNames';\nimport {i18n} from '../../../../i18n';\nimport {ListItem} from '../ListItem/index';\n\nimport './SelectPopup.ported.scss';\nconst DebounceTextInput = TextInput;\n\nconst css = {\n wrapper: 'g-aikit-agent-select-popup__wrapper',\n header: 'g-aikit-agent-select-popup__header',\n filter: 'g-aikit-agent-select-popup__filter',\n list: 'g-aikit-agent-select-popup__list',\n footer: 'g-aikit-agent-select-popup__footer',\n search: 'g-aikit-agent-select-popup__search',\n searchIcon: 'g-aikit-agent-select-popup__searchIcon',\n emptyOptions: 'g-aikit-agent-select-popup__emptyOptions',\n listCount: 'g-aikit-agent-select-popup__listCount',\n};\n\nexport function SelectPopup(props: React.HTMLAttributes<HTMLDivElement>) {\n return <div {...props} className={cn(css.wrapper, props.className)} />;\n}\n\nSelectPopup.Header = function SelectPopupHeader(props: React.HTMLAttributes<HTMLDivElement>) {\n return <div {...props} className={cn(css.header, props.className)} />;\n};\n\nSelectPopup.Filter = function SelectPopupFilter(props: React.HTMLAttributes<HTMLDivElement>) {\n return <div {...props} className={cn(css.filter, props.className)} />;\n};\n\nSelectPopup.Tabs = function SelectPopupTabs(props: SegmentedRadioGroupProps) {\n return <SegmentedRadioGroup size=\"m\" width=\"max\" {...props} />;\n};\n\nSelectPopup.Tab = SegmentedRadioGroup.Option;\n\nSelectPopup.List = function SelectPopupList(props: React.HTMLAttributes<HTMLDivElement>) {\n return <div {...props} className={cn(css.list, props.className)} />;\n};\n\nSelectPopup.ListCount = function SelectPopupListCount({\n count,\n color = 'secondary',\n ...props\n}: TextProps & {count: number}) {\n return (\n <Text {...props} color={color} className={cn(css.listCount, props.className)}>\n {i18n('items-found', {items: count})}\n </Text>\n );\n};\n\nSelectPopup.Footer = function SelectPopupFooter(props: React.HTMLAttributes<HTMLDivElement>) {\n return <div {...props} className={cn(css.footer, props.className)} />;\n};\n\nSelectPopup.FooterButton = function SelectPopupFooterButton(props: ButtonProps) {\n return <Button view=\"normal\" size=\"m\" width=\"max\" {...props} />;\n};\n\nSelectPopup.Search = forwardRef<\n HTMLInputElement,\n TextInputProps & {\n debounced?: boolean;\n }\n>(function SelectPopupSearch({debounced, ...props}, ref) {\n const Component = debounced ? DebounceTextInput : TextInput;\n\n return (\n <Component\n startContent={\n <div className={css.searchIcon}>\n <Icon data={Magnifier} size={16} />\n </div>\n }\n {...props}\n placeholder={i18n('search')}\n className={cn(css.search, props.className)}\n ref={ref}\n />\n );\n});\n\nSelectPopup.ListItem = ListItem;\n\nSelectPopup.EmptyOptions = function SelectPopupEmptyOptions({\n children,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n return (\n <div {...props} className={cn(css.emptyOptions, props.className)}>\n {children ?? (\n <SelectPopup.EmptyPlaceholder>{i18n('nothing-found')}</SelectPopup.EmptyPlaceholder>\n )}\n </div>\n );\n};\n\nSelectPopup.EmptyPlaceholder = function SelectPopupEmptyOptions({\n color = 'secondary',\n ...props\n}: React.PropsWithChildren<TextProps>) {\n return <Text {...props} color={color} />;\n};\n"]}
1
+ {"version":3,"file":"SelectPopup.js","sourceRoot":"../../../../../../../../../src","sources":["components/pages/AgentChat/controls/ui/components/SelectPopup/SelectPopup.tsx"],"names":[],"mappings":";;AAkCA,kCAEC;;;AApCD,iCAAwC;AAExC,6CAA4C;AAC5C,6CAS2B;AAC3B,6CAAuC;AAEvC,8CAAsC;AACtC,uDAAuC;AACvC,gDAA2C;AAE3C,oCAAmC;AACnC,MAAM,iBAAiB,GAAG,iBAAS,CAAC;AAEpC,MAAM,GAAG,GAAG;IACR,OAAO,EAA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CAAC,UAAU,YAC1B,uBAAC,YAAI,IAAC,IAAI,EAAE,iBAAS,EAAE,IAAI,EAAE,EAAE,GAAI,GACjC,IAEN,KAAK,IACT,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,EACxB,SAAS,EAAE,IAAA,eAAE,EAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,EAC1C,GAAG,EAAE,GAAG,IACV,CACL,CAAC;AACN,CAAC,CAAC,CAAC;AAEH,WAAW,CAAC,QAAQ,GAAG,gBAAQ,CAAC;AAEhC,WAAW,CAAC,YAAY,GAAG,SAAS,uBAAuB,CAAC,EAGrB;QAHqB,EACxD,QAAQ,OAE2B,EADhC,KAAK,sBAFgD,YAG3D,CADW;IAER,MAAM,EAAC,CAAC,EAAC,GAAG,WAAI,CAAC,cAAc,EAAE,CAAC;IAClC,OAAO,CACH,gDAAS,KAAK,IAAE,SAAS,EAAE,IAAA,eAAE,EAAC,GAAG,CAAC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,YAC3D,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,CACT,uBAAC,WAAW,CAAC,gBAAgB,cAAE,CAAC,CAAC,eAAe,CAAC,GAAgC,CACpF,IACC,CACT,CAAC;AACN,CAAC,CAAC;AAEF,WAAW,CAAC,gBAAgB,GAAG,SAAS,uBAAuB,CAAC,EAG3B;QAH2B,EAC5D,KAAK,GAAG,WAAW,OAEc,EAD9B,KAAK,sBAFoD,SAG/D,CADW;IAER,OAAO,uBAAC,YAAI,oBAAK,KAAK,IAAE,KAAK,EAAE,KAAK,IAAI,CAAC;AAC7C,CAAC,CAAC","sourcesContent":["import React, {forwardRef} from 'react';\n\nimport {Magnifier} from '@gravity-ui/icons';\nimport {\n Button,\n type ButtonProps,\n SegmentedRadioGroup,\n type SegmentedRadioGroupProps,\n Text,\n TextInput,\n type TextInputProps,\n type TextProps,\n} from '@gravity-ui/uikit';\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {i18n} from '../../../../i18n';\nimport {cn} from '../../../classNames';\nimport {ListItem} from '../ListItem/index';\n\nimport './SelectPopup.ported.scss';\nconst DebounceTextInput = TextInput;\n\nconst css = {\n wrapper: 'g-aikit-agent-select-popup__wrapper',\n header: 'g-aikit-agent-select-popup__header',\n filter: 'g-aikit-agent-select-popup__filter',\n list: 'g-aikit-agent-select-popup__list',\n footer: 'g-aikit-agent-select-popup__footer',\n search: 'g-aikit-agent-select-popup__search',\n searchIcon: 'g-aikit-agent-select-popup__searchIcon',\n emptyOptions: 'g-aikit-agent-select-popup__emptyOptions',\n listCount: 'g-aikit-agent-select-popup__listCount',\n};\n\nexport function SelectPopup(props: React.HTMLAttributes<HTMLDivElement>) {\n return <div {...props} className={cn(css.wrapper, props.className)} />;\n}\n\nSelectPopup.Header = function SelectPopupHeader(props: React.HTMLAttributes<HTMLDivElement>) {\n return <div {...props} className={cn(css.header, props.className)} />;\n};\n\nSelectPopup.Filter = function SelectPopupFilter(props: React.HTMLAttributes<HTMLDivElement>) {\n return <div {...props} className={cn(css.filter, props.className)} />;\n};\n\nSelectPopup.Tabs = function SelectPopupTabs(props: SegmentedRadioGroupProps) {\n return <SegmentedRadioGroup size=\"m\" width=\"max\" {...props} />;\n};\n\nSelectPopup.Tab = SegmentedRadioGroup.Option;\n\nSelectPopup.List = function SelectPopupList(props: React.HTMLAttributes<HTMLDivElement>) {\n return <div {...props} className={cn(css.list, props.className)} />;\n};\n\nSelectPopup.ListCount = function SelectPopupListCount({\n count,\n color = 'secondary',\n ...props\n}: TextProps & {count: number}) {\n const {t} = i18n.useTranslation();\n return (\n <Text {...props} color={color} className={cn(css.listCount, props.className)}>\n {t('items-found', {items: count})}\n </Text>\n );\n};\n\nSelectPopup.Footer = function SelectPopupFooter(props: React.HTMLAttributes<HTMLDivElement>) {\n return <div {...props} className={cn(css.footer, props.className)} />;\n};\n\nSelectPopup.FooterButton = function SelectPopupFooterButton(props: ButtonProps) {\n return <Button view=\"normal\" size=\"m\" width=\"max\" {...props} />;\n};\n\nSelectPopup.Search = forwardRef<\n HTMLInputElement,\n TextInputProps & {\n debounced?: boolean;\n }\n>(function SelectPopupSearch({debounced, ...props}, ref) {\n const {t} = i18n.useTranslation();\n const Component = debounced ? DebounceTextInput : TextInput;\n\n return (\n <Component\n startContent={\n <div className={css.searchIcon}>\n <Icon data={Magnifier} size={16} />\n </div>\n }\n {...props}\n placeholder={t('search')}\n className={cn(css.search, props.className)}\n ref={ref}\n />\n );\n});\n\nSelectPopup.ListItem = ListItem;\n\nSelectPopup.EmptyOptions = function SelectPopupEmptyOptions({\n children,\n ...props\n}: React.HTMLAttributes<HTMLDivElement>) {\n const {t} = i18n.useTranslation();\n return (\n <div {...props} className={cn(css.emptyOptions, props.className)}>\n {children ?? (\n <SelectPopup.EmptyPlaceholder>{t('nothing-found')}</SelectPopup.EmptyPlaceholder>\n )}\n </div>\n );\n};\n\nSelectPopup.EmptyPlaceholder = function SelectPopupEmptyOptions({\n color = 'secondary',\n ...props\n}: React.PropsWithChildren<TextProps>) {\n return <Text {...props} color={color} />;\n};\n"]}
@@ -1,14 +1,14 @@
1
1
  .g-aikit-agent-select-popup__wrapper {
2
- width: var(--base-width-320);
2
+ width: var(--base-width-320, 320px);
3
3
  }
4
4
 
5
5
  .g-aikit-agent-select-popup__header {
6
- padding-block: var(--dropdown-padding-m);
7
- padding-inline: var(--dropdown-padding-m);
6
+ padding-block: var(--dropdown-padding-m, var(--g-spacing-2));
7
+ padding-inline: var(--dropdown-padding-m, var(--g-spacing-2));
8
8
  border-bottom: 1px solid var(--g-color-line-generic);
9
9
  display: flex;
10
10
  flex-direction: column;
11
- gap: var(--dropdown-padding-m);
11
+ gap: var(--dropdown-padding-m, var(--g-spacing-2));
12
12
  }
13
13
 
14
14
  .g-aikit-agent-select-popup__header .g-segmented-radio-group__option {
@@ -23,7 +23,7 @@
23
23
  .g-aikit-agent-select-popup__filter {
24
24
  display: flex;
25
25
  align-items: center;
26
- gap: var(--spacing-1-and-half);
26
+ gap: var(--spacing-1-and-half, 6px);
27
27
  }
28
28
 
29
29
  .g-aikit-agent-select-popup__filter .g-select-filter {
@@ -35,19 +35,19 @@
35
35
  }
36
36
 
37
37
  .g-aikit-agent-select-popup__list .g-list {
38
- padding-inline: var(--dropdown-padding-m);
39
- padding-block: var(--dropdown-padding-m);
38
+ padding-inline: var(--dropdown-padding-m, var(--g-spacing-2));
39
+ padding-block: var(--dropdown-padding-m, var(--g-spacing-2));
40
40
  max-height: var(--select-popup-list-max-height, 280px);
41
41
  box-sizing: border-box;
42
42
  margin: 0;
43
43
  }
44
44
 
45
45
  .g-aikit-agent-select-popup__list .g-list__item:not(:last-child) {
46
- margin-bottom: var(--dropdown-item-gap-m);
46
+ margin-bottom: var(--dropdown-item-gap-m, var(--g-spacing-half));
47
47
  }
48
48
 
49
49
  .g-aikit-agent-select-popup__list .g-list__item {
50
- border-radius: var(--dropdown-item-border-radius-m);
50
+ border-radius: var(--dropdown-item-border-radius-m, var(--g-border-radius-l));
51
51
  }
52
52
 
53
53
  .g-aikit-agent-select-popup__list .g-select-list__option {
@@ -60,12 +60,12 @@
60
60
  }
61
61
 
62
62
  .g-aikit-agent-select-popup__footer {
63
- padding-block: var(--dropdown-padding-m);
64
- padding-inline: var(--dropdown-padding-m);
63
+ padding-block: var(--dropdown-padding-m, var(--g-spacing-2));
64
+ padding-inline: var(--dropdown-padding-m, var(--g-spacing-2));
65
65
  border-top: 1px solid var(--g-color-line-generic);
66
66
  display: flex;
67
67
  flex-direction: column;
68
- gap: var(--dropdown-padding-m);
68
+ gap: var(--dropdown-padding-m, var(--g-spacing-2));
69
69
  }
70
70
 
71
71
  .g-aikit-agent-select-popup__search {
@@ -92,6 +92,6 @@
92
92
 
93
93
  .g-aikit-agent-select-popup__listCount {
94
94
  display: block;
95
- padding-inline: calc(var(--dropdown-padding-m) + var(--g-spacing-2));
95
+ padding-inline: calc(var(--dropdown-padding-m, var(--g-spacing-2)) + var(--g-spacing-2));
96
96
  padding-block: var(--g-spacing-3) 0;
97
97
  }
@@ -33,6 +33,7 @@ function AgentRepoSelect(_a) {
33
33
  return (0, jsx_runtime_1.jsx)(AgentRepoSelectControl, Object.assign({}, props, { disabled: status === RepoSelectStatus.Disabled }));
34
34
  }
35
35
  function AgentRepoSelectControl({ orgSlug, repositories, repoSlug, onRepoSelectionChange, disabled, }) {
36
+ const { t } = i18n_1.i18n.useTranslation();
36
37
  const [filter, setFilter] = (0, react_1.useState)('');
37
38
  const [open, setOpen] = (0, react_1.useState)(false);
38
39
  const options = (0, react_1.useMemo)(() => repositories
@@ -69,6 +70,6 @@ function AgentRepoSelectControl({ orgSlug, repositories, repoSlug, onRepoSelecti
69
70
  const handleFilterChange = (0, react_1.useCallback)((nextFilter) => {
70
71
  setFilter(nextFilter);
71
72
  }, []);
72
- return ((0, jsx_runtime_1.jsx)(uikit_1.Select, { qa: "agent-repo-select", className: css.select, size: "s", width: "auto", popupWidth: 300, value: value, disabled: disabled, options: options, open: open && !disabled, filterable: true, filter: filter, filterOption: () => true, filterPlaceholder: (0, i18n_1.i18n)('placeholder_search'), placeholder: (0, i18n_1.i18n)('placeholder_repository'), "aria-label": (0, i18n_1.i18n)('label_repository'), title: repoSlug || (0, i18n_1.i18n)('placeholder_repository'), renderSelectedOptions: () => ((0, jsx_runtime_1.jsxs)("span", { className: css.selectedOption, children: [(0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Archive, size: 16, className: css.repoIcon, "aria-hidden": true }), (0, jsx_runtime_1.jsx)("span", { className: css.selectedLabel, children: repoSlug })] })), renderEmptyOptions: () => ((0, jsx_runtime_1.jsx)(index_1.SelectPopup.EmptyOptions, { children: (0, i18n_1.i18n)('empty_repositories') })), renderPopup: ({ renderFilter, renderList }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: css.filter, children: renderFilter() }), (0, jsx_runtime_1.jsx)("div", { className: css.list, children: renderList() }), (0, jsx_runtime_1.jsx)(index_1.SelectPopup.Footer, { children: (0, jsx_runtime_1.jsxs)(index_1.SelectPopup.FooterButton, { disabled: disabled || value.length === 0, onClick: handleClear, children: [(0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Xmark, size: 16, "aria-hidden": true }), (0, i18n_1.i18n)('action_no_repository')] }) })] })), onFilterChange: handleFilterChange, onUpdate: handleSelect, onOpenChange: handleOpenChange }));
73
+ return ((0, jsx_runtime_1.jsx)(uikit_1.Select, { qa: "agent-repo-select", className: css.select, size: "s", width: "auto", popupWidth: 300, value: value, disabled: disabled, options: options, open: open && !disabled, filterable: true, filter: filter, filterOption: () => true, filterPlaceholder: t('placeholder_search'), placeholder: t('placeholder_repository'), "aria-label": t('label_repository'), title: repoSlug || t('placeholder_repository'), renderSelectedOptions: () => ((0, jsx_runtime_1.jsxs)("span", { className: css.selectedOption, children: [(0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Archive, size: 16, className: css.repoIcon, "aria-hidden": true }), (0, jsx_runtime_1.jsx)("span", { className: css.selectedLabel, children: repoSlug })] })), renderEmptyOptions: () => ((0, jsx_runtime_1.jsx)(index_1.SelectPopup.EmptyOptions, { children: t('empty_repositories') })), renderPopup: ({ renderFilter, renderList }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: css.filter, children: renderFilter() }), (0, jsx_runtime_1.jsx)("div", { className: css.list, children: renderList() }), (0, jsx_runtime_1.jsx)(index_1.SelectPopup.Footer, { children: (0, jsx_runtime_1.jsxs)(index_1.SelectPopup.FooterButton, { disabled: disabled || value.length === 0, onClick: handleClear, children: [(0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Xmark, size: 16, "aria-hidden": true }), t('action_no_repository')] }) })] })), onFilterChange: handleFilterChange, onUpdate: handleSelect, onOpenChange: handleOpenChange }));
73
74
  }
74
75
  //# sourceMappingURL=AgentRepoSelect.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentRepoSelect.js","sourceRoot":"../../../../../../../../../../../src","sources":["components/pages/AgentChat/controls/ui/modules/agent/components/AgentRepoSelect/AgentRepoSelect.tsx"],"names":[],"mappings":";;;AAmCA,0CASC;;;AA5CD,iCAAqD;AAErD,6CAAiD;AACjD,6CAAyD;AAGzD,uEAAqE;AAErE,oCAA4B;AAE5B,wCAAuC;AACvC,MAAM,GAAG,GAAG;IACR,MAAM,EAAE,yCAAyC;IACjD,cAAc,EAAE,iDAAiD;IACjE,MAAM,EAAE,yCAAyC;IACjD,IAAI,EAAE,uCAAuC;IAC7C,QAAQ,EAAE,2CAA2C;IACrD,aAAa,EAAE,gDAAgD;IAC/D,QAAQ,EAAE,2CAA2C;CACxD,CAAC;AAEF,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IACxB,yCAAqB,CAAA;IACrB,qCAAiB,CAAA;IACjB,uCAAmB,CAAA;AACvB,CAAC,EAJW,gBAAgB,gCAAhB,gBAAgB,QAI3B;AAUD,SAAgB,eAAe,CAAC,EAGR;QAHQ,EAC5B,MAAM,GAAG,gBAAgB,CAAC,MAAM,OAEZ,EADjB,KAAK,sBAFoB,UAG/B,CADW;IAER,IAAI,MAAM,KAAK,gBAAgB,CAAC,OAAO,EAAE,CAAC;QACtC,OAAO,uBAAC,gBAAQ,IAAC,SAAS,EAAE,GAAG,CAAC,QAAQ,EAAE,EAAE,EAAC,4BAA4B,GAAG,CAAC;IACjF,CAAC;IAED,OAAO,uBAAC,sBAAsB,oBAAK,KAAK,IAAE,QAAQ,EAAE,MAAM,KAAK,gBAAgB,CAAC,QAAQ,IAAI,CAAC;AACjG,CAAC;AAED,SAAS,sBAAsB,CAAC,EAC5B,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,qBAAqB,EACrB,QAAQ,GACkD;IAC1D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,IAAI,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C,EACjD,qBAAqB,EAAE,GAAG,EAAE,CAAC,CACzB,kCAAM,SAAS,EAAE,GAAG,CAAC,cAAc,aAC/B,uBAAC,YAAI,IAAC,IAAI,EAAE,eAAO,EAAE,IAAI,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,QAAQ,wBAAgB,EACtE,iCAAM,SAAS,EAAE,GAAG,CAAC,aAAa,YAAG,QAAQ,GAAQ,IAClD,CACV,EACD,kBAAkB,EAAE,GAAG,EAAE,CAAC,CACtB,uBAAC,mBAAW,CAAC,YAAY,cAAE,IAAA,WAAI,EAAC,oBAAoB,CAAC,GAA4B,CACpF,EACD,WAAW,EAAE,CAAC,EAAC,YAAY,EAAE,UAAU,EAAC,EAAE,EAAE,CAAC,CACzC,6DACI,gCAAK,SAAS,EAAE,GAAG,CAAC,MAAM,YAAG,YAAY,EAAE,GAAO,EAClD,gCAAK,SAAS,EAAE,GAAG,CAAC,IAAI,YAAG,UAAU,EAAE,GAAO,EAC9C,uBAAC,mBAAW,CAAC,MAAM,cACf,wBAAC,mBAAW,CAAC,YAAY,IACrB,QAAQ,EAAE,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EACxC,OAAO,EAAE,WAAW,aAEpB,uBAAC,YAAI,IAAC,IAAI,EAAE,aAAK,EAAE,IAAI,EAAE,EAAE,wBAAgB,EAC1C,IAAA,WAAI,EAAC,sBAAsB,CAAC,IACN,GACV,IACtB,CACN,EACD,cAAc,EAAE,kBAAkB,EAClC,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,gBAAgB,GAChC,CACL,CAAC;AACN,CAAC","sourcesContent":["import {useCallback, useMemo, useState} from 'react';\n\nimport {Archive, Xmark} from '@gravity-ui/icons';\nimport {Icon, Select, Skeleton} from '@gravity-ui/uikit';\n\nimport {type Repository} from '../../../../../types';\nimport {SelectPopup} from '../../../../components/SelectPopup/index';\n\nimport {i18n} from './i18n';\n\nimport './AgentRepoSelect.ported.scss';\nconst css = {\n select: 'g-aikit-agent-agent-repo-select__select',\n selectedOption: 'g-aikit-agent-agent-repo-select__selectedOption',\n filter: 'g-aikit-agent-agent-repo-select__filter',\n list: 'g-aikit-agent-agent-repo-select__list',\n repoIcon: 'g-aikit-agent-agent-repo-select__repoIcon',\n selectedLabel: 'g-aikit-agent-agent-repo-select__selectedLabel',\n skeleton: 'g-aikit-agent-agent-repo-select__skeleton',\n};\n\nexport enum RepoSelectStatus {\n Disabled = 'disabled',\n Active = 'active',\n Loading = 'loading',\n}\n\nexport interface IAgentRepoSelectProps {\n repositories: Repository[];\n orgSlug?: string;\n repoSlug?: string;\n onRepoSelectionChange: (repository: {orgSlug: string; repoSlug: string}) => void;\n status?: RepoSelectStatus;\n}\n\nexport function AgentRepoSelect({\n status = RepoSelectStatus.Active,\n ...props\n}: IAgentRepoSelectProps) {\n if (status === RepoSelectStatus.Loading) {\n return <Skeleton className={css.skeleton} qa=\"agent-repo-select-skeleton\" />;\n }\n\n return <AgentRepoSelectControl {...props} disabled={status === RepoSelectStatus.Disabled} />;\n}\n\nfunction AgentRepoSelectControl({\n orgSlug,\n repositories,\n repoSlug,\n onRepoSelectionChange,\n disabled,\n}: Omit<IAgentRepoSelectProps, 'status'> & {disabled: boolean}) {\n const [filter, setFilter] = useState('');\n const [open, setOpen] = useState(false);\n const options = useMemo(\n () =>\n repositories\n .filter((repo) => repo.slug.includes(filter))\n .map((repo) => ({\n value: `${repo.orgSlug}/${repo.slug}`,\n content: repo.slug,\n data: repo,\n })),\n [repositories, filter],\n );\n const value = useMemo(\n () => (orgSlug && repoSlug ? [`${orgSlug}/${repoSlug}`] : []),\n [orgSlug, repoSlug],\n );\n\n const handleOpenChange = useCallback((nextOpen: boolean) => {\n setOpen(nextOpen);\n if (!nextOpen) {\n setFilter('');\n }\n }, []);\n\n const handleClear = useCallback(() => {\n if (disabled) {\n return;\n }\n onRepoSelectionChange({orgSlug: '', repoSlug: ''});\n handleOpenChange(false);\n }, [disabled, handleOpenChange, onRepoSelectionChange]);\n\n const handleSelect = useCallback(\n (nextValue: string[]) => {\n if (disabled) {\n return;\n }\n const repository = options.find((option) => option.value === nextValue[0])?.data;\n if (repository) {\n onRepoSelectionChange({orgSlug: repository.orgSlug, repoSlug: repository.slug});\n }\n },\n [disabled, onRepoSelectionChange, options],\n );\n\n const handleFilterChange = useCallback((nextFilter: string) => {\n setFilter(nextFilter);\n }, []);\n\n return (\n <Select<Repository>\n qa=\"agent-repo-select\"\n className={css.select}\n size=\"s\"\n width=\"auto\"\n popupWidth={300}\n value={value}\n disabled={disabled}\n options={options}\n open={open && !disabled}\n filterable\n filter={filter}\n filterOption={() => true}\n filterPlaceholder={i18n('placeholder_search')}\n placeholder={i18n('placeholder_repository')}\n aria-label={i18n('label_repository')}\n title={repoSlug || i18n('placeholder_repository')}\n renderSelectedOptions={() => (\n <span className={css.selectedOption}>\n <Icon data={Archive} size={16} className={css.repoIcon} aria-hidden />\n <span className={css.selectedLabel}>{repoSlug}</span>\n </span>\n )}\n renderEmptyOptions={() => (\n <SelectPopup.EmptyOptions>{i18n('empty_repositories')}</SelectPopup.EmptyOptions>\n )}\n renderPopup={({renderFilter, renderList}) => (\n <>\n <div className={css.filter}>{renderFilter()}</div>\n <div className={css.list}>{renderList()}</div>\n <SelectPopup.Footer>\n <SelectPopup.FooterButton\n disabled={disabled || value.length === 0}\n onClick={handleClear}\n >\n <Icon data={Xmark} size={16} aria-hidden />\n {i18n('action_no_repository')}\n </SelectPopup.FooterButton>\n </SelectPopup.Footer>\n </>\n )}\n onFilterChange={handleFilterChange}\n onUpdate={handleSelect}\n onOpenChange={handleOpenChange}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"AgentRepoSelect.js","sourceRoot":"../../../../../../../../../../../src","sources":["components/pages/AgentChat/controls/ui/modules/agent/components/AgentRepoSelect/AgentRepoSelect.tsx"],"names":[],"mappings":";;;AAmCA,0CASC;;;AA5CD,iCAAqD;AAErD,6CAAiD;AACjD,6CAAyD;AAGzD,uEAAqE;AAErE,o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CAAC,QAAQ,wBAAgB,EACtE,iCAAM,SAAS,EAAE,GAAG,CAAC,aAAa,YAAG,QAAQ,GAAQ,IAClD,CACV,EACD,kBAAkB,EAAE,GAAG,EAAE,CAAC,CACtB,uBAAC,mBAAW,CAAC,YAAY,cAAE,CAAC,CAAC,oBAAoB,CAAC,GAA4B,CACjF,EACD,WAAW,EAAE,CAAC,EAAC,YAAY,EAAE,UAAU,EAAC,EAAE,EAAE,CAAC,CACzC,6DACI,gCAAK,SAAS,EAAE,GAAG,CAAC,MAAM,YAAG,YAAY,EAAE,GAAO,EAClD,gCAAK,SAAS,EAAE,GAAG,CAAC,IAAI,YAAG,UAAU,EAAE,GAAO,EAC9C,uBAAC,mBAAW,CAAC,MAAM,cACf,wBAAC,mBAAW,CAAC,YAAY,IACrB,QAAQ,EAAE,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EACxC,OAAO,EAAE,WAAW,aAEpB,uBAAC,YAAI,IAAC,IAAI,EAAE,aAAK,EAAE,IAAI,EAAE,EAAE,wBAAgB,EAC1C,CAAC,CAAC,sBAAsB,CAAC,IACH,GACV,IACtB,CACN,EACD,cAAc,EAAE,kBAAkB,EAClC,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,gBAAgB,GAChC,CACL,CAAC;AACN,CAAC","sourcesContent":["import {useCallback, useMemo, useState} from 'react';\n\nimport {Archive, Xmark} from '@gravity-ui/icons';\nimport {Icon, Select, Skeleton} from '@gravity-ui/uikit';\n\nimport {type Repository} from '../../../../../types';\nimport {SelectPopup} from '../../../../components/SelectPopup/index';\n\nimport {i18n} from './i18n';\n\nimport './AgentRepoSelect.ported.scss';\nconst css = {\n select: 'g-aikit-agent-agent-repo-select__select',\n selectedOption: 'g-aikit-agent-agent-repo-select__selectedOption',\n filter: 'g-aikit-agent-agent-repo-select__filter',\n list: 'g-aikit-agent-agent-repo-select__list',\n repoIcon: 'g-aikit-agent-agent-repo-select__repoIcon',\n selectedLabel: 'g-aikit-agent-agent-repo-select__selectedLabel',\n skeleton: 'g-aikit-agent-agent-repo-select__skeleton',\n};\n\nexport enum RepoSelectStatus {\n Disabled = 'disabled',\n Active = 'active',\n Loading = 'loading',\n}\n\nexport interface IAgentRepoSelectProps {\n repositories: Repository[];\n orgSlug?: string;\n repoSlug?: string;\n onRepoSelectionChange: (repository: {orgSlug: string; repoSlug: string}) => void;\n status?: RepoSelectStatus;\n}\n\nexport function AgentRepoSelect({\n status = RepoSelectStatus.Active,\n ...props\n}: IAgentRepoSelectProps) {\n if (status === RepoSelectStatus.Loading) {\n return <Skeleton className={css.skeleton} qa=\"agent-repo-select-skeleton\" />;\n }\n\n return <AgentRepoSelectControl {...props} disabled={status === RepoSelectStatus.Disabled} />;\n}\n\nfunction AgentRepoSelectControl({\n orgSlug,\n repositories,\n repoSlug,\n onRepoSelectionChange,\n disabled,\n}: Omit<IAgentRepoSelectProps, 'status'> & {disabled: boolean}) {\n const {t} = i18n.useTranslation();\n const [filter, setFilter] = useState('');\n const [open, setOpen] = useState(false);\n const options = useMemo(\n () =>\n repositories\n .filter((repo) => repo.slug.includes(filter))\n .map((repo) => ({\n value: `${repo.orgSlug}/${repo.slug}`,\n content: repo.slug,\n data: repo,\n })),\n [repositories, filter],\n );\n const value = useMemo(\n () => (orgSlug && repoSlug ? [`${orgSlug}/${repoSlug}`] : []),\n [orgSlug, repoSlug],\n );\n\n const handleOpenChange = useCallback((nextOpen: boolean) => {\n setOpen(nextOpen);\n if (!nextOpen) {\n setFilter('');\n }\n }, []);\n\n const handleClear = useCallback(() => {\n if (disabled) {\n return;\n }\n onRepoSelectionChange({orgSlug: '', repoSlug: ''});\n handleOpenChange(false);\n }, [disabled, handleOpenChange, onRepoSelectionChange]);\n\n const handleSelect = useCallback(\n (nextValue: string[]) => {\n if (disabled) {\n return;\n }\n const repository = options.find((option) => option.value === nextValue[0])?.data;\n if (repository) {\n onRepoSelectionChange({orgSlug: repository.orgSlug, repoSlug: repository.slug});\n }\n },\n [disabled, onRepoSelectionChange, options],\n );\n\n const handleFilterChange = useCallback((nextFilter: string) => {\n setFilter(nextFilter);\n }, []);\n\n return (\n <Select<Repository>\n qa=\"agent-repo-select\"\n className={css.select}\n size=\"s\"\n width=\"auto\"\n popupWidth={300}\n value={value}\n disabled={disabled}\n options={options}\n open={open && !disabled}\n filterable\n filter={filter}\n filterOption={() => true}\n filterPlaceholder={t('placeholder_search')}\n placeholder={t('placeholder_repository')}\n aria-label={t('label_repository')}\n title={repoSlug || t('placeholder_repository')}\n renderSelectedOptions={() => (\n <span className={css.selectedOption}>\n <Icon data={Archive} size={16} className={css.repoIcon} aria-hidden />\n <span className={css.selectedLabel}>{repoSlug}</span>\n </span>\n )}\n renderEmptyOptions={() => (\n <SelectPopup.EmptyOptions>{t('empty_repositories')}</SelectPopup.EmptyOptions>\n )}\n renderPopup={({renderFilter, renderList}) => (\n <>\n <div className={css.filter}>{renderFilter()}</div>\n <div className={css.list}>{renderList()}</div>\n <SelectPopup.Footer>\n <SelectPopup.FooterButton\n disabled={disabled || value.length === 0}\n onClick={handleClear}\n >\n <Icon data={Xmark} size={16} aria-hidden />\n {t('action_no_repository')}\n </SelectPopup.FooterButton>\n </SelectPopup.Footer>\n </>\n )}\n onFilterChange={handleFilterChange}\n onUpdate={handleSelect}\n onOpenChange={handleOpenChange}\n />\n );\n}\n"]}