@gravity-ui/aikit 2.7.1-beta.a94bc5e8a406bcdf76d167a4c8f33d22a7ca697b.0 → 2.8.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/atoms/MarkdownRenderer/MarkdownRenderer.css +4 -30
- package/build/cjs/components/molecules/BaseMessage/BaseMessage.css +0 -2
- package/build/cjs/components/organisms/AssistantMessage/AssistantMessage.css +0 -1
- package/build/cjs/components/organisms/MessageList/MessageList.css +0 -2
- package/build/cjs/components/organisms/PromptInput/PromptInputFull.js +2 -2
- package/build/cjs/components/organisms/PromptInput/PromptInputFull.js.map +1 -1
- package/build/cjs/components/organisms/PromptInput/PromptInputSimple.js +2 -2
- package/build/cjs/components/organisms/PromptInput/PromptInputSimple.js.map +1 -1
- package/build/cjs/components/organisms/PromptInput/types.d.ts +3 -1
- package/build/cjs/components/organisms/PromptInput/types.js.map +1 -1
- package/build/cjs/components/templates/ChatContent/ChatContent.css +0 -1
- package/build/cjs/hooks/useMarkdownTransform.js +1 -2
- package/build/cjs/hooks/useMarkdownTransform.js.map +1 -1
- package/build/cjs/package.json +1 -1
- package/build/cjs/themes/common.css +0 -3
- package/build/cjs/themes/variables.css +0 -3
- package/build/cjs/utils/markdownUtils.d.ts +0 -2
- package/build/cjs/utils/markdownUtils.js +0 -8
- package/build/cjs/utils/markdownUtils.js.map +1 -1
- package/build/esm/components/atoms/MarkdownRenderer/MarkdownRenderer.css +4 -30
- package/build/esm/components/molecules/BaseMessage/BaseMessage.css +0 -2
- package/build/esm/components/organisms/AssistantMessage/AssistantMessage.css +0 -1
- package/build/esm/components/organisms/MessageList/MessageList.css +0 -2
- package/build/esm/components/organisms/PromptInput/PromptInputFull.js +2 -2
- package/build/esm/components/organisms/PromptInput/PromptInputFull.js.map +1 -1
- package/build/esm/components/organisms/PromptInput/PromptInputSimple.js +2 -2
- package/build/esm/components/organisms/PromptInput/PromptInputSimple.js.map +1 -1
- package/build/esm/components/organisms/PromptInput/types.d.ts +3 -1
- package/build/esm/components/organisms/PromptInput/types.js.map +1 -1
- package/build/esm/components/templates/ChatContent/ChatContent.css +0 -1
- package/build/esm/hooks/useMarkdownTransform.js +2 -3
- package/build/esm/hooks/useMarkdownTransform.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/themes/common.css +0 -3
- package/build/esm/themes/variables.css +0 -3
- package/build/esm/utils/markdownUtils.d.ts +0 -2
- package/build/esm/utils/markdownUtils.js +0 -7
- package/build/esm/utils/markdownUtils.js.map +1 -1
- package/package.json +1 -1
- package/build/cjs/utils/markdownTableWrapPlugin.d.ts +0 -4
- package/build/cjs/utils/markdownTableWrapPlugin.js +0 -25
- package/build/cjs/utils/markdownTableWrapPlugin.js.map +0 -1
- package/build/esm/utils/markdownTableWrapPlugin.d.ts +0 -4
- package/build/esm/utils/markdownTableWrapPlugin.js +0 -22
- package/build/esm/utils/markdownTableWrapPlugin.js.map +0 -1
|
@@ -87,44 +87,18 @@
|
|
|
87
87
|
display: none;
|
|
88
88
|
}
|
|
89
89
|
.g-aikit-markdown-renderer {
|
|
90
|
-
width: 100%;
|
|
91
90
|
max-width: 100%;
|
|
92
|
-
min-width: 0;
|
|
93
|
-
/* Scroll container injected by markdownTableWrapPlugin; text outside stays fixed */
|
|
94
|
-
}
|
|
95
|
-
.g-aikit-markdown-renderer__table-wrap {
|
|
96
|
-
width: 100%;
|
|
97
|
-
max-width: 100%;
|
|
98
|
-
min-width: 0;
|
|
99
91
|
overflow-x: auto;
|
|
100
|
-
|
|
101
|
-
.g-aikit-markdown-renderer {
|
|
102
|
-
/*
|
|
103
|
-
* Override @diplodoc/transform `.yfm table` (inline-block + max-width: 100%).
|
|
104
|
-
* min-width: 100% — narrow tables fill the message; width: max-content — columns size to content.
|
|
105
|
-
*/
|
|
92
|
+
/* Tables inside message wrappers: reset inherited word-break; scroll on this root when wide */
|
|
106
93
|
}
|
|
107
94
|
.g-aikit-markdown-renderer table {
|
|
108
|
-
display: table;
|
|
109
95
|
table-layout: auto;
|
|
110
96
|
word-break: normal;
|
|
111
|
-
width: max-content;
|
|
112
97
|
min-width: 100%;
|
|
113
|
-
|
|
114
|
-
overflow: visible;
|
|
98
|
+
width: max-content;
|
|
115
99
|
}
|
|
116
|
-
.g-aikit-markdown-renderer
|
|
100
|
+
.g-aikit-markdown-renderer th,
|
|
101
|
+
.g-aikit-markdown-renderer td {
|
|
117
102
|
word-break: normal;
|
|
118
103
|
white-space: nowrap;
|
|
119
|
-
overflow: visible;
|
|
120
|
-
text-overflow: clip;
|
|
121
|
-
}
|
|
122
|
-
.g-aikit-markdown-renderer table td {
|
|
123
|
-
max-width: var(--g-aikit-markdown-renderer-table-cell-max-width);
|
|
124
|
-
word-break: normal;
|
|
125
|
-
white-space: normal;
|
|
126
|
-
/* Wrap multi-word text at spaces within max-width */
|
|
127
|
-
overflow-wrap: normal;
|
|
128
|
-
overflow: visible;
|
|
129
|
-
text-overflow: clip;
|
|
130
104
|
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
display: flex;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
min-height: 0;
|
|
7
|
-
min-width: 0;
|
|
8
7
|
flex: 1;
|
|
9
8
|
align-self: stretch;
|
|
10
9
|
}
|
|
@@ -12,7 +11,6 @@
|
|
|
12
11
|
display: flex;
|
|
13
12
|
flex-direction: column;
|
|
14
13
|
gap: var(--g-spacing-4);
|
|
15
|
-
min-width: 0;
|
|
16
14
|
}
|
|
17
15
|
.g-aikit-message-list_virtualized {
|
|
18
16
|
overflow: hidden;
|
|
@@ -16,11 +16,11 @@ const b = (0, cn_1.block)('prompt-input');
|
|
|
16
16
|
function PromptInputFull(props) {
|
|
17
17
|
const { hookState, headerProps = {}, bodyProps = {}, footerProps = {}, className, qa } = props;
|
|
18
18
|
const { topContent, contextItems = [], showContextIndicator = false, contextIndicatorProps, qa: headerQa, } = headerProps;
|
|
19
|
-
const { placeholder = 'Plan, code, build and test anything', minRows = 1, maxRows = 15, autoFocus = false, qa: bodyQa, } = bodyProps;
|
|
19
|
+
const { placeholder = 'Plan, code, build and test anything', minRows = 1, maxRows = 15, autoFocus = false, inputRef, qa: bodyQa, } = bodyProps;
|
|
20
20
|
const { bottomContent, showSettings = false, onSettingsClick, attachmentContent, showAttachment, onAttachmentClick, showMicrophone = false, onMicrophoneClick, submitButtonTooltipSend, submitButtonTooltipCancel, submitButtonCancelableText, submitButtonQa, qa: footerQa, } = footerProps;
|
|
21
21
|
const { value, submitButtonState, handleChange, handleKeyDown, handleSubmit } = hookState;
|
|
22
22
|
const shouldShowHeader = topContent || contextItems.length > 0 || showContextIndicator;
|
|
23
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: b({ view: 'full' }, className), "data-qa": qa, children: [shouldShowHeader && ((0, jsx_runtime_1.jsx)(PromptInputHeader_1.PromptInputHeader, { contextItems: contextItems, showContextIndicator: showContextIndicator, contextIndicatorProps: contextIndicatorProps, qa: headerQa, children: topContent })), (0, jsx_runtime_1.jsx)(PromptInputBody_1.PromptInputBody, { value: value, placeholder: placeholder, minRows: minRows, maxRows: maxRows, autoFocus: autoFocus, onChange: handleChange, onKeyDown: handleKeyDown, inputClassName: b('textarea'), qa: bodyQa }), (0, jsx_runtime_1.jsx)(PromptInputFooter_1.PromptInputFooter, { qa: footerQa, submitButton: {
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: b({ view: 'full' }, className), "data-qa": qa, children: [shouldShowHeader && ((0, jsx_runtime_1.jsx)(PromptInputHeader_1.PromptInputHeader, { contextItems: contextItems, showContextIndicator: showContextIndicator, contextIndicatorProps: contextIndicatorProps, qa: headerQa, children: topContent })), (0, jsx_runtime_1.jsx)(PromptInputBody_1.PromptInputBody, { value: value, placeholder: placeholder, minRows: minRows, maxRows: maxRows, autoFocus: autoFocus, ref: inputRef, onChange: handleChange, onKeyDown: handleKeyDown, inputClassName: b('textarea'), qa: bodyQa }), (0, jsx_runtime_1.jsx)(PromptInputFooter_1.PromptInputFooter, { qa: footerQa, submitButton: {
|
|
24
24
|
onClick: handleSubmit,
|
|
25
25
|
state: submitButtonState,
|
|
26
26
|
tooltipSend: submitButtonTooltipSend,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromptInputFull.js","sourceRoot":"../../../../../src","sources":["components/organisms/PromptInput/PromptInputFull.tsx"],"names":[],"mappings":";;AAkCA,
|
|
1
|
+
{"version":3,"file":"PromptInputFull.js","sourceRoot":"../../../../../src","sources":["components/organisms/PromptInput/PromptInputFull.tsx"],"names":[],"mappings":";;AAkCA,0CAwFC;;AA1HD,6CAAwC;AACxC,8EAAgE;AAChE,kFAAoE;AACpE,kFAAoE;AAKpE,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,cAAc,CAAC,CAAC;AAoBhC;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,KAA2B;IACvD,MAAM,EAAC,SAAS,EAAE,WAAW,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,SAAS,EAAE,EAAE,EAAC,GAAG,KAAK,CAAC;IAE7F,MAAM,EACF,UAAU,EACV,YAAY,GAAG,EAAE,EACjB,oBAAoB,GAAG,KAAK,EAC5B,qBAAqB,EACrB,EAAE,EAAE,QAAQ,GACf,GAAG,WAAW,CAAC;IAEhB,MAAM,EACF,WAAW,GAAG,qCAAqC,EACnD,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,EAAE,EACZ,SAAS,GAAG,KAAK,EACjB,QAAQ,EACR,EAAE,EAAE,MAAM,GACb,GAAG,SAAS,CAAC;IAEd,MAAM,EACF,aAAa,EACb,YAAY,GAAG,KAAK,EACpB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,cAAc,GAAG,KAAK,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,cAAc,EACd,EAAE,EAAE,QAAQ,GACf,GAAG,WAAW,C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AACN,CAAC","sourcesContent":["import {block} from '../../../utils/cn';\nimport {PromptInputBody} from '../../molecules/PromptInputBody';\nimport {PromptInputFooter} from '../../molecules/PromptInputFooter';\nimport {PromptInputHeader} from '../../molecules/PromptInputHeader';\n\nimport {PromptInputBodyConfig, PromptInputFooterConfig, PromptInputHeaderConfig} from './types';\nimport {UsePromptInputReturn} from './usePromptInput';\n\nconst b = block('prompt-input');\n\n/**\n * Props for the PromptInputFull component\n */\nexport type PromptInputFullProps = {\n /** Hook return value with state and handlers */\n hookState: UsePromptInputReturn;\n /** Header-related props */\n headerProps?: PromptInputHeaderConfig;\n /** Body/textarea-related props */\n bodyProps?: PromptInputBodyConfig;\n /** Footer-related props */\n footerProps?: PromptInputFooterConfig;\n /** Additional CSS class */\n className?: string;\n /** QA/test identifier */\n qa?: string;\n};\n\n/**\n * PromptInputFull component - full view with header, body, and footer\n *\n * @param props - Component props\n * @returns React component\n */\nexport function PromptInputFull(props: PromptInputFullProps) {\n const {hookState, headerProps = {}, bodyProps = {}, footerProps = {}, className, qa} = props;\n\n const {\n topContent,\n contextItems = [],\n showContextIndicator = false,\n contextIndicatorProps,\n qa: headerQa,\n } = headerProps;\n\n const {\n placeholder = 'Plan, code, build and test anything',\n minRows = 1,\n maxRows = 15,\n autoFocus = false,\n inputRef,\n qa: bodyQa,\n } = bodyProps;\n\n const {\n bottomContent,\n showSettings = false,\n onSettingsClick,\n attachmentContent,\n showAttachment,\n onAttachmentClick,\n showMicrophone = false,\n onMicrophoneClick,\n submitButtonTooltipSend,\n submitButtonTooltipCancel,\n submitButtonCancelableText,\n submitButtonQa,\n qa: footerQa,\n } = footerProps;\n\n const {value, submitButtonState, handleChange, handleKeyDown, handleSubmit} = hookState;\n\n const shouldShowHeader = topContent || contextItems.length > 0 || showContextIndicator;\n\n return (\n <div className={b({view: 'full'}, className)} data-qa={qa}>\n {shouldShowHeader && (\n <PromptInputHeader\n contextItems={contextItems}\n showContextIndicator={showContextIndicator}\n contextIndicatorProps={contextIndicatorProps}\n qa={headerQa}\n >\n {topContent}\n </PromptInputHeader>\n )}\n\n <PromptInputBody\n value={value}\n placeholder={placeholder}\n minRows={minRows}\n maxRows={maxRows}\n autoFocus={autoFocus}\n ref={inputRef}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n inputClassName={b('textarea')}\n qa={bodyQa}\n />\n\n <PromptInputFooter\n qa={footerQa}\n submitButton={{\n onClick: handleSubmit,\n state: submitButtonState,\n tooltipSend: submitButtonTooltipSend,\n tooltipCancel: submitButtonTooltipCancel,\n cancelableText: submitButtonCancelableText,\n qa: submitButtonQa || 'submit-button-full',\n }}\n showSettings={showSettings}\n onSettingsClick={onSettingsClick}\n showAttachment={showAttachment}\n onAttachmentClick={onAttachmentClick}\n attachmentContent={attachmentContent}\n showMicrophone={showMicrophone}\n onMicrophoneClick={onMicrophoneClick}\n >\n {bottomContent}\n </PromptInputFooter>\n </div>\n );\n}\n"]}
|
|
@@ -14,10 +14,10 @@ const b = (0, cn_1.block)('prompt-input');
|
|
|
14
14
|
*/
|
|
15
15
|
function PromptInputSimple(props) {
|
|
16
16
|
const { hookState, bodyProps = {}, footerProps = {}, className, qa } = props;
|
|
17
|
-
const { placeholder = 'Plan, code, build and test anything', minRows = 1, maxRows = 15, autoFocus = false, qa: bodyQa, } = bodyProps;
|
|
17
|
+
const { placeholder = 'Plan, code, build and test anything', minRows = 1, maxRows = 15, autoFocus = false, inputRef, qa: bodyQa, } = bodyProps;
|
|
18
18
|
const { bottomContent, showAttachment = false, onAttachmentClick, attachmentContent, showMicrophone = false, onMicrophoneClick, submitButtonTooltipSend, submitButtonTooltipCancel, submitButtonCancelableText, submitButtonQa, qa: footerQa, } = footerProps;
|
|
19
19
|
const { value, submitButtonState, handleChange, handleKeyDown, handleSubmit } = hookState;
|
|
20
|
-
return ((0, jsx_runtime_1.jsx)("div", { className: b({ view: 'simple' }, className), "data-qa": qa, children: (0, jsx_runtime_1.jsxs)("div", { className: b('content'), children: [(0, jsx_runtime_1.jsx)(PromptInputBody_1.PromptInputBody, { value: value, placeholder: placeholder, minRows: minRows, maxRows: maxRows, autoFocus: autoFocus, onChange: handleChange, onKeyDown: handleKeyDown, qa: bodyQa }), (0, jsx_runtime_1.jsx)(PromptInputFooter_1.PromptInputFooter, { qa: footerQa, submitButton: {
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: b({ view: 'simple' }, className), "data-qa": qa, children: (0, jsx_runtime_1.jsxs)("div", { className: b('content'), children: [(0, jsx_runtime_1.jsx)(PromptInputBody_1.PromptInputBody, { value: value, placeholder: placeholder, minRows: minRows, maxRows: maxRows, autoFocus: autoFocus, ref: inputRef, onChange: handleChange, onKeyDown: handleKeyDown, qa: bodyQa }), (0, jsx_runtime_1.jsx)(PromptInputFooter_1.PromptInputFooter, { qa: footerQa, submitButton: {
|
|
21
21
|
onClick: handleSubmit,
|
|
22
22
|
state: submitButtonState,
|
|
23
23
|
tooltipSend: submitButtonTooltipSend,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromptInputSimple.js","sourceRoot":"../../../../../src","sources":["components/organisms/PromptInput/PromptInputSimple.tsx"],"names":[],"mappings":";;AA+BA,
|
|
1
|
+
{"version":3,"file":"PromptInputSimple.js","sourceRoot":"../../../../../src","sources":["components/organisms/PromptInput/PromptInputSimple.tsx"],"names":[],"mappings":";;AA+BA,8CAgEC;;AA/FD,6CAAwC;AACxC,8EAAgE;AAChE,kFAAoE;AAKpE,MAAM,CAAC,GAAG,IAAA,UAAK,EAAC,cAAc,CAAC,CAAC;AAkBhC;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,KAA6B;IAC3D,MAAM,EAAC,SAAS,EAAE,SAAS,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,SAAS,EAAE,EAAE,EAAC,GAAG,KAAK,CAAC;IAE3E,MAAM,EACF,WAAW,GAAG,qCAAqC,EACnD,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,EAAE,EACZ,SA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T,CAAC;AACN,CAAC","sourcesContent":["import {block} from '../../../utils/cn';\nimport {PromptInputBody} from '../../molecules/PromptInputBody';\nimport {PromptInputFooter} from '../../molecules/PromptInputFooter';\n\nimport {PromptInputBodyConfig, PromptInputFooterConfig} from './types';\nimport {UsePromptInputReturn} from './usePromptInput';\n\nconst b = block('prompt-input');\n\n/**\n * Props for the PromptInputSimple component\n */\nexport type PromptInputSimpleProps = {\n /** Hook return value with state and handlers */\n hookState: UsePromptInputReturn;\n /** Body/textarea-related props */\n bodyProps?: PromptInputBodyConfig;\n /** Footer-related props */\n footerProps?: PromptInputFooterConfig;\n /** Additional CSS class */\n className?: string;\n /** QA/test identifier */\n qa?: string;\n};\n\n/**\n * PromptInputSimple component - simple view with just body and footer\n *\n * @param props - Component props\n * @returns React component\n */\nexport function PromptInputSimple(props: PromptInputSimpleProps) {\n const {hookState, bodyProps = {}, footerProps = {}, className, qa} = props;\n\n const {\n placeholder = 'Plan, code, build and test anything',\n minRows = 1,\n maxRows = 15,\n autoFocus = false,\n inputRef,\n qa: bodyQa,\n } = bodyProps;\n\n const {\n bottomContent,\n showAttachment = false,\n onAttachmentClick,\n attachmentContent,\n showMicrophone = false,\n onMicrophoneClick,\n submitButtonTooltipSend,\n submitButtonTooltipCancel,\n submitButtonCancelableText,\n submitButtonQa,\n qa: footerQa,\n } = footerProps;\n\n const {value, submitButtonState, handleChange, handleKeyDown, handleSubmit} = hookState;\n\n return (\n <div className={b({view: 'simple'}, className)} data-qa={qa}>\n <div className={b('content')}>\n <PromptInputBody\n value={value}\n placeholder={placeholder}\n minRows={minRows}\n maxRows={maxRows}\n autoFocus={autoFocus}\n ref={inputRef}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n qa={bodyQa}\n />\n <PromptInputFooter\n qa={footerQa}\n submitButton={{\n onClick: handleSubmit,\n state: submitButtonState,\n tooltipSend: submitButtonTooltipSend,\n tooltipCancel: submitButtonTooltipCancel,\n cancelableText: submitButtonCancelableText,\n qa: submitButtonQa || 'submit-button-simple',\n }}\n showAttachment={showAttachment}\n onAttachmentClick={onAttachmentClick}\n attachmentContent={attachmentContent}\n showMicrophone={showMicrophone}\n onMicrophoneClick={onMicrophoneClick}\n buttonSize=\"l\"\n >\n {bottomContent}\n </PromptInputFooter>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, type Ref } from 'react';
|
|
2
2
|
import type { SuggestionsItem } from "../../../types/common.js";
|
|
3
3
|
import { PromptInputHeaderProps } from "../../molecules/PromptInputHeader/index.js";
|
|
4
4
|
import type { SuggestionsProps } from "../../molecules/Suggestions/index.js";
|
|
@@ -32,6 +32,8 @@ export type PromptInputHeaderConfig = {
|
|
|
32
32
|
export type PromptInputBodyConfig = {
|
|
33
33
|
/** QA/test identifier for body wrapper */
|
|
34
34
|
qa?: string;
|
|
35
|
+
/** Ref to the textarea input */
|
|
36
|
+
inputRef?: Ref<HTMLTextAreaElement>;
|
|
35
37
|
/** Placeholder text for textarea */
|
|
36
38
|
placeholder?: string;
|
|
37
39
|
/** Minimum number of textarea rows */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"../../../../../src","sources":["components/organisms/PromptInput/types.ts"],"names":[],"mappings":"","sourcesContent":["import {ReactNode} from 'react';\n\nimport type {SuggestionsItem} from '../../../types/common';\nimport {PromptInputHeaderProps} from '../../molecules/PromptInputHeader';\nimport type {SuggestionsProps} from '../../molecules/Suggestions';\n\n/**\n * Props for a panel (top or bottom)\n */\nexport type PromptInputPanelConfig = {\n /** Is panel open */\n isOpen: boolean;\n /** Panel content */\n children?: ReactNode;\n};\n\n/**\n * Props for the header section of PromptInput\n */\nexport type PromptInputHeaderConfig = {\n /** QA/test identifier for header wrapper */\n qa?: string;\n /** Custom content for header area */\n topContent?: ReactNode;\n /** Array of context items to display on the left */\n contextItems?: PromptInputHeaderProps['contextItems'];\n /** Show context indicator in header */\n showContextIndicator?: boolean;\n /** Props for context indicator */\n contextIndicatorProps?: PromptInputHeaderProps['contextIndicatorProps'];\n};\n\n/**\n * Props for the body/textarea section of PromptInput\n */\nexport type PromptInputBodyConfig = {\n /** QA/test identifier for body wrapper */\n qa?: string;\n /** Placeholder text for textarea */\n placeholder?: string;\n /** Minimum number of textarea rows */\n minRows?: number;\n /** Maximum number of textarea rows */\n maxRows?: number;\n /** Auto focus textarea on mount */\n autoFocus?: boolean;\n /**\n * Auto focus textarea when a new chat is opened via the plus icon.\n * Only applies inside ChatContainer. Defaults to false.\n */\n autoFocusOnNewChat?: boolean;\n /**\n * Auto focus textarea when a chat is selected from history.\n * Only applies inside ChatContainer. Defaults to false.\n */\n autoFocusOnChatSelect?: boolean;\n};\n\n/**\n * Props for the footer section of PromptInput\n */\nexport type PromptInputFooterConfig = {\n /** QA/test identifier for footer wrapper */\n qa?: string;\n /** Custom content for footer area (SubmitButton will still be shown) */\n bottomContent?: ReactNode;\n /** Show settings icon in footer */\n showSettings?: boolean;\n /** Settings icon click handler */\n onSettingsClick?: () => void;\n /** Show attachment icon in footer */\n showAttachment?: boolean;\n /** Attachment icon click handler */\n onAttachmentClick?: () => void;\n /**\n * Replaces the built-in attachment icon button with a custom node (e.g. AttachmentPicker).\n * When set, `showAttachment` and `onAttachmentClick` are ignored.\n */\n attachmentContent?: ReactNode;\n /** Show microphone icon in footer */\n showMicrophone?: boolean;\n /** Microphone icon click handler */\n onMicrophoneClick?: () => void;\n /** Custom tooltip for submit button in enabled state */\n submitButtonTooltipSend?: string;\n /** Custom tooltip for submit button in cancelable state */\n submitButtonTooltipCancel?: string;\n /** Custom cancelable text (if provided, will be shown in cancelable state) */\n submitButtonCancelableText?: string;\n /** QA/test identifier for submit button */\n submitButtonQa?: string;\n};\n\n/**\n * Props for the suggestions section of PromptInput\n */\nexport type PromptInputSuggestionsConfig = {\n /** Submit suggestions array */\n suggestions?: SuggestionsItem[];\n /** Show submit suggestions */\n showSuggestions?: boolean;\n /** Title for the suggestions section - can be string or custom React element */\n suggestTitle?: string | ReactNode;\n /** Layout orientation for suggestions: 'grid' for horizontal, 'list' for vertical */\n suggestionsLayout?: SuggestionsProps['layout'];\n /** Text alignment inside suggestion buttons */\n suggestionsTextAlign?: SuggestionsProps['textAlign'];\n /** Callback when suggestion is clicked */\n onSuggestionClick?: (content: string, id?: string) => void;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"../../../../../src","sources":["components/organisms/PromptInput/types.ts"],"names":[],"mappings":"","sourcesContent":["import {ReactNode, type Ref} from 'react';\n\nimport type {SuggestionsItem} from '../../../types/common';\nimport {PromptInputHeaderProps} from '../../molecules/PromptInputHeader';\nimport type {SuggestionsProps} from '../../molecules/Suggestions';\n\n/**\n * Props for a panel (top or bottom)\n */\nexport type PromptInputPanelConfig = {\n /** Is panel open */\n isOpen: boolean;\n /** Panel content */\n children?: ReactNode;\n};\n\n/**\n * Props for the header section of PromptInput\n */\nexport type PromptInputHeaderConfig = {\n /** QA/test identifier for header wrapper */\n qa?: string;\n /** Custom content for header area */\n topContent?: ReactNode;\n /** Array of context items to display on the left */\n contextItems?: PromptInputHeaderProps['contextItems'];\n /** Show context indicator in header */\n showContextIndicator?: boolean;\n /** Props for context indicator */\n contextIndicatorProps?: PromptInputHeaderProps['contextIndicatorProps'];\n};\n\n/**\n * Props for the body/textarea section of PromptInput\n */\nexport type PromptInputBodyConfig = {\n /** QA/test identifier for body wrapper */\n qa?: string;\n /** Ref to the textarea input */\n inputRef?: Ref<HTMLTextAreaElement>;\n /** Placeholder text for textarea */\n placeholder?: string;\n /** Minimum number of textarea rows */\n minRows?: number;\n /** Maximum number of textarea rows */\n maxRows?: number;\n /** Auto focus textarea on mount */\n autoFocus?: boolean;\n /**\n * Auto focus textarea when a new chat is opened via the plus icon.\n * Only applies inside ChatContainer. Defaults to false.\n */\n autoFocusOnNewChat?: boolean;\n /**\n * Auto focus textarea when a chat is selected from history.\n * Only applies inside ChatContainer. Defaults to false.\n */\n autoFocusOnChatSelect?: boolean;\n};\n\n/**\n * Props for the footer section of PromptInput\n */\nexport type PromptInputFooterConfig = {\n /** QA/test identifier for footer wrapper */\n qa?: string;\n /** Custom content for footer area (SubmitButton will still be shown) */\n bottomContent?: ReactNode;\n /** Show settings icon in footer */\n showSettings?: boolean;\n /** Settings icon click handler */\n onSettingsClick?: () => void;\n /** Show attachment icon in footer */\n showAttachment?: boolean;\n /** Attachment icon click handler */\n onAttachmentClick?: () => void;\n /**\n * Replaces the built-in attachment icon button with a custom node (e.g. AttachmentPicker).\n * When set, `showAttachment` and `onAttachmentClick` are ignored.\n */\n attachmentContent?: ReactNode;\n /** Show microphone icon in footer */\n showMicrophone?: boolean;\n /** Microphone icon click handler */\n onMicrophoneClick?: () => void;\n /** Custom tooltip for submit button in enabled state */\n submitButtonTooltipSend?: string;\n /** Custom tooltip for submit button in cancelable state */\n submitButtonTooltipCancel?: string;\n /** Custom cancelable text (if provided, will be shown in cancelable state) */\n submitButtonCancelableText?: string;\n /** QA/test identifier for submit button */\n submitButtonQa?: string;\n};\n\n/**\n * Props for the suggestions section of PromptInput\n */\nexport type PromptInputSuggestionsConfig = {\n /** Submit suggestions array */\n suggestions?: SuggestionsItem[];\n /** Show submit suggestions */\n showSuggestions?: boolean;\n /** Title for the suggestions section - can be string or custom React element */\n suggestTitle?: string | ReactNode;\n /** Layout orientation for suggestions: 'grid' for horizontal, 'list' for vertical */\n suggestionsLayout?: SuggestionsProps['layout'];\n /** Text alignment inside suggestion buttons */\n suggestionsTextAlign?: SuggestionsProps['textAlign'];\n /** Callback when suggestion is clicked */\n onSuggestionClick?: (content: string, id?: string) => void;\n};\n"]}
|
|
@@ -19,7 +19,6 @@ function useMarkdownTransform(content, options) {
|
|
|
19
19
|
cacheRef.current.clear();
|
|
20
20
|
prevOptionsRef.current = options;
|
|
21
21
|
}
|
|
22
|
-
const transformOptions = (0, markdownUtils_1.mergeMarkdownTransformOptions)(options);
|
|
23
22
|
try {
|
|
24
23
|
const blocks = (0, parse_blocks_1.parseMarkdownIntoBlocks)(content);
|
|
25
24
|
const cache = cacheRef.current;
|
|
@@ -28,7 +27,7 @@ function useMarkdownTransform(content, options) {
|
|
|
28
27
|
let html = cache.get(block);
|
|
29
28
|
if (!html) {
|
|
30
29
|
try {
|
|
31
|
-
const result = (0, transform_1.default)(block,
|
|
30
|
+
const result = (0, transform_1.default)(block, options);
|
|
32
31
|
html = result.result.html;
|
|
33
32
|
cache.set(block, html);
|
|
34
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMarkdownTransform.js","sourceRoot":"../../../src","sources":["hooks/useMarkdownTransform.ts"],"names":[],"mappings":";;AASA,
|
|
1
|
+
{"version":3,"file":"useMarkdownTransform.js","sourceRoot":"../../../src","sources":["hooks/useMarkdownTransform.ts"],"names":[],"mappings":";;AASA,oDA8CC;;AAvDD,iCAAsC;AAEtC,4EAA4C;AAC5C,8CAA4C;AAG5C,6DAAuD;AACvD,2DAA8D;AAE9D,SAAgB,oBAAoB,CAAC,OAAe,EAAE,OAAqB;IACvE,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAsB,IAAI,GAAG,EAAE,CAAC,CAAC;IACxD,MAAM,cAAc,GAAG,IAAA,cAAM,EAA0B,OAAO,CAAC,CAAC;IAEhE,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QAChB,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO,EAAE,CAAC;QACd,CAAC;QAED,MAAM,cAAc,GAAG,CAAC,IAAA,+BAAe,EAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACzE,IAAI,cAAc,EAAE,CAAC;YACjB,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACzB,cAAc,CAAC,OAAO,GAAG,OAAO,CAAC;QACrC,CAAC;QAED,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,IAAA,sCAAuB,EAAC,OAAO,CAAC,CAAC;YAChD,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC;YAC/B,MAAM,SAAS,GAAa,EAAE,CAAC;YAE/B,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBACzB,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;gBAC5B,IAAI,CAAC,IAAI,EAAE,CAAC;oBACR,IAAI,CAAC;wBACD,MAAM,MAAM,GAAG,IAAA,mBAAS,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;wBACzC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;wBAC1B,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBAC3B,CAAC;oBAAC,WAAM,CAAC;wBACL,IAAI,GAAG,EAAE,CAAC;oBACd,CAAC;gBACL,CAAC;gBACD,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzB,CAAC;YAED,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;YACzC,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;gBAC7B,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC7B,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACtB,CAAC;YACL,CAAC;YAED,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9B,CAAC;QAAC,WAAM,CAAC;YACL,OAAO,EAAE,CAAC;QACd,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import {useMemo, useRef} from 'react';\n\nimport transform from '@diplodoc/transform';\nimport '@diplodoc/transform/dist/js/yfm.js';\nimport {OptionsType} from '@diplodoc/transform/lib/typings';\n\nimport {areOptionsEqual} from '../utils/markdownUtils';\nimport {parseMarkdownIntoBlocks} from '../utils/parse-blocks';\n\nexport function useMarkdownTransform(content: string, options?: OptionsType): string {\n const cacheRef = useRef<Map<string, string>>(new Map());\n const prevOptionsRef = useRef<OptionsType | undefined>(options);\n\n return useMemo(() => {\n if (!content) {\n return '';\n }\n\n const optionsChanged = !areOptionsEqual(prevOptionsRef.current, options);\n if (optionsChanged) {\n cacheRef.current.clear();\n prevOptionsRef.current = options;\n }\n\n try {\n const blocks = parseMarkdownIntoBlocks(content);\n const cache = cacheRef.current;\n const htmlParts: string[] = [];\n\n for (const block of blocks) {\n let html = cache.get(block);\n if (!html) {\n try {\n const result = transform(block, options);\n html = result.result.html;\n cache.set(block, html);\n } catch {\n html = '';\n }\n }\n htmlParts.push(html);\n }\n\n const currentBlocksSet = new Set(blocks);\n for (const key of cache.keys()) {\n if (!currentBlocksSet.has(key)) {\n cache.delete(key);\n }\n }\n\n return htmlParts.join('');\n } catch {\n return '';\n }\n }, [content, options]);\n}\n"]}
|
package/build/cjs/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.
|
|
1
|
+
{"version":"2.8.0","type":"commonjs","sideEffects":["*.css","*.scss"]}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import { OptionsType } from '@diplodoc/transform/lib/typings';
|
|
2
2
|
export declare function areOptionsEqual(prev?: OptionsType, next?: OptionsType): boolean;
|
|
3
|
-
/** AIKit default transform plugins; user plugins from `transformOptions` are appended after. */
|
|
4
|
-
export declare function mergeMarkdownTransformOptions(options?: OptionsType): OptionsType;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.areOptionsEqual = areOptionsEqual;
|
|
4
|
-
exports.mergeMarkdownTransformOptions = mergeMarkdownTransformOptions;
|
|
5
|
-
const markdownTableWrapPlugin_1 = require("./markdownTableWrapPlugin.js");
|
|
6
4
|
function areOptionsEqual(prev, next) {
|
|
7
5
|
if (prev === next) {
|
|
8
6
|
return true;
|
|
@@ -22,10 +20,4 @@ function areOptionsEqual(prev, next) {
|
|
|
22
20
|
}
|
|
23
21
|
return true;
|
|
24
22
|
}
|
|
25
|
-
/** AIKit default transform plugins; user plugins from `transformOptions` are appended after. */
|
|
26
|
-
function mergeMarkdownTransformOptions(options) {
|
|
27
|
-
var _a;
|
|
28
|
-
const userPlugins = (_a = options === null || options === void 0 ? void 0 : options.plugins) !== null && _a !== void 0 ? _a : [];
|
|
29
|
-
return Object.assign(Object.assign({}, options), { plugins: [markdownTableWrapPlugin_1.markdownTableWrapPlugin, ...userPlugins] });
|
|
30
|
-
}
|
|
31
23
|
//# sourceMappingURL=markdownUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdownUtils.js","sourceRoot":"../../../src","sources":["utils/markdownUtils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"markdownUtils.js","sourceRoot":"../../../src","sources":["utils/markdownUtils.ts"],"names":[],"mappings":";;AAEA,0CAkBC;AAlBD,SAAgB,eAAe,CAAC,IAAkB,EAAE,IAAkB;IAClE,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import {OptionsType} from '@diplodoc/transform/lib/typings';\n\nexport function areOptionsEqual(prev?: OptionsType, next?: OptionsType): boolean {\n if (prev === next) {\n return true;\n }\n if (!prev || !next) {\n return false;\n }\n const prevKeys = Object.keys(prev);\n const nextKeys = Object.keys(next);\n if (prevKeys.length !== nextKeys.length) {\n return false;\n }\n for (const key of prevKeys) {\n if (prev[key] !== next[key]) {\n return false;\n }\n }\n return true;\n}\n"]}
|
|
@@ -87,44 +87,18 @@
|
|
|
87
87
|
display: none;
|
|
88
88
|
}
|
|
89
89
|
.g-aikit-markdown-renderer {
|
|
90
|
-
width: 100%;
|
|
91
90
|
max-width: 100%;
|
|
92
|
-
min-width: 0;
|
|
93
|
-
/* Scroll container injected by markdownTableWrapPlugin; text outside stays fixed */
|
|
94
|
-
}
|
|
95
|
-
.g-aikit-markdown-renderer__table-wrap {
|
|
96
|
-
width: 100%;
|
|
97
|
-
max-width: 100%;
|
|
98
|
-
min-width: 0;
|
|
99
91
|
overflow-x: auto;
|
|
100
|
-
|
|
101
|
-
.g-aikit-markdown-renderer {
|
|
102
|
-
/*
|
|
103
|
-
* Override @diplodoc/transform `.yfm table` (inline-block + max-width: 100%).
|
|
104
|
-
* min-width: 100% — narrow tables fill the message; width: max-content — columns size to content.
|
|
105
|
-
*/
|
|
92
|
+
/* Tables inside message wrappers: reset inherited word-break; scroll on this root when wide */
|
|
106
93
|
}
|
|
107
94
|
.g-aikit-markdown-renderer table {
|
|
108
|
-
display: table;
|
|
109
95
|
table-layout: auto;
|
|
110
96
|
word-break: normal;
|
|
111
|
-
width: max-content;
|
|
112
97
|
min-width: 100%;
|
|
113
|
-
|
|
114
|
-
overflow: visible;
|
|
98
|
+
width: max-content;
|
|
115
99
|
}
|
|
116
|
-
.g-aikit-markdown-renderer
|
|
100
|
+
.g-aikit-markdown-renderer th,
|
|
101
|
+
.g-aikit-markdown-renderer td {
|
|
117
102
|
word-break: normal;
|
|
118
103
|
white-space: nowrap;
|
|
119
|
-
overflow: visible;
|
|
120
|
-
text-overflow: clip;
|
|
121
|
-
}
|
|
122
|
-
.g-aikit-markdown-renderer table td {
|
|
123
|
-
max-width: var(--g-aikit-markdown-renderer-table-cell-max-width);
|
|
124
|
-
word-break: normal;
|
|
125
|
-
white-space: normal;
|
|
126
|
-
/* Wrap multi-word text at spaces within max-width */
|
|
127
|
-
overflow-wrap: normal;
|
|
128
|
-
overflow: visible;
|
|
129
|
-
text-overflow: clip;
|
|
130
104
|
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
display: flex;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
min-height: 0;
|
|
7
|
-
min-width: 0;
|
|
8
7
|
flex: 1;
|
|
9
8
|
align-self: stretch;
|
|
10
9
|
}
|
|
@@ -12,7 +11,6 @@
|
|
|
12
11
|
display: flex;
|
|
13
12
|
flex-direction: column;
|
|
14
13
|
gap: var(--g-spacing-4);
|
|
15
|
-
min-width: 0;
|
|
16
14
|
}
|
|
17
15
|
.g-aikit-message-list_virtualized {
|
|
18
16
|
overflow: hidden;
|
|
@@ -13,11 +13,11 @@ const b = block('prompt-input');
|
|
|
13
13
|
export function PromptInputFull(props) {
|
|
14
14
|
const { hookState, headerProps = {}, bodyProps = {}, footerProps = {}, className, qa } = props;
|
|
15
15
|
const { topContent, contextItems = [], showContextIndicator = false, contextIndicatorProps, qa: headerQa, } = headerProps;
|
|
16
|
-
const { placeholder = 'Plan, code, build and test anything', minRows = 1, maxRows = 15, autoFocus = false, qa: bodyQa, } = bodyProps;
|
|
16
|
+
const { placeholder = 'Plan, code, build and test anything', minRows = 1, maxRows = 15, autoFocus = false, inputRef, qa: bodyQa, } = bodyProps;
|
|
17
17
|
const { bottomContent, showSettings = false, onSettingsClick, attachmentContent, showAttachment, onAttachmentClick, showMicrophone = false, onMicrophoneClick, submitButtonTooltipSend, submitButtonTooltipCancel, submitButtonCancelableText, submitButtonQa, qa: footerQa, } = footerProps;
|
|
18
18
|
const { value, submitButtonState, handleChange, handleKeyDown, handleSubmit } = hookState;
|
|
19
19
|
const shouldShowHeader = topContent || contextItems.length > 0 || showContextIndicator;
|
|
20
|
-
return (_jsxs("div", { className: b({ view: 'full' }, className), "data-qa": qa, children: [shouldShowHeader && (_jsx(PromptInputHeader, { contextItems: contextItems, showContextIndicator: showContextIndicator, contextIndicatorProps: contextIndicatorProps, qa: headerQa, children: topContent })), _jsx(PromptInputBody, { value: value, placeholder: placeholder, minRows: minRows, maxRows: maxRows, autoFocus: autoFocus, onChange: handleChange, onKeyDown: handleKeyDown, inputClassName: b('textarea'), qa: bodyQa }), _jsx(PromptInputFooter, { qa: footerQa, submitButton: {
|
|
20
|
+
return (_jsxs("div", { className: b({ view: 'full' }, className), "data-qa": qa, children: [shouldShowHeader && (_jsx(PromptInputHeader, { contextItems: contextItems, showContextIndicator: showContextIndicator, contextIndicatorProps: contextIndicatorProps, qa: headerQa, children: topContent })), _jsx(PromptInputBody, { value: value, placeholder: placeholder, minRows: minRows, maxRows: maxRows, autoFocus: autoFocus, ref: inputRef, onChange: handleChange, onKeyDown: handleKeyDown, inputClassName: b('textarea'), qa: bodyQa }), _jsx(PromptInputFooter, { qa: footerQa, submitButton: {
|
|
21
21
|
onClick: handleSubmit,
|
|
22
22
|
state: submitButtonState,
|
|
23
23
|
tooltipSend: submitButtonTooltipSend,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromptInputFull.js","sourceRoot":"../../../../../src","sources":["components/organisms/PromptInput/PromptInputFull.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,KAAK,EAAC,6BAA0B;AACxC,OAAO,EAAC,eAAe,EAAC,iDAAwC;AAChE,OAAO,EAAC,iBAAiB,EAAC,mDAA0C;AACpE,OAAO,EAAC,iBAAiB,EAAC,mDAA0C;AAKpE,MAAM,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC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KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,aAAa,EACxB,cAAc,EAAE,CAAC,CAAC,UAAU,CAAC,EAC7B,EAAE,EAAE,MAAM,GACZ,EAEF,KAAC,iBAAiB,IACd,EAAE,EAAE,QAAQ,EACZ,YAAY,EAAE;oBACV,OAAO,EAAE,YAAY;oBACrB,KAAK,EAAE,iBAAiB;oBACxB,WAAW,EAAE,uBAAuB;oBACpC,aAAa,EAAE,yBAAyB;oBACxC,cAAc,EAAE,0BAA0B;oBAC1C,EAAE,EAAE,cAAc,IAAI,oBAAoB;iBAC7C,EACD,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,YAEnC,aAAa,GACE,IAClB,CACT,CAAC;AACN,CAAC","sourcesContent":["import {block} from '../../../utils/cn';\nimport {PromptInputBody} from '../../molecules/PromptInputBody';\nimport {PromptInputFooter} from '../../molecules/PromptInputFooter';\nimport {PromptInputHeader} from '../../molecules/PromptInputHeader';\n\nimport {PromptInputBodyConfig, PromptInputFooterConfig, PromptInputHeaderConfig} from './types';\nimport {UsePromptInputReturn} from './usePromptInput';\n\nconst b = block('prompt-input');\n\n/**\n * Props for the PromptInputFull component\n */\nexport type PromptInputFullProps = {\n /** Hook return value with state and handlers */\n hookState: UsePromptInputReturn;\n /** Header-related props */\n headerProps?: PromptInputHeaderConfig;\n /** Body/textarea-related props */\n bodyProps?: PromptInputBodyConfig;\n /** Footer-related props */\n footerProps?: PromptInputFooterConfig;\n /** Additional CSS class */\n className?: string;\n /** QA/test identifier */\n qa?: string;\n};\n\n/**\n * PromptInputFull component - full view with header, body, and footer\n *\n * @param props - Component props\n * @returns React component\n */\nexport function PromptInputFull(props: PromptInputFullProps) {\n const {hookState, headerProps = {}, bodyProps = {}, footerProps = {}, className, qa} = props;\n\n const {\n topContent,\n contextItems = [],\n showContextIndicator = false,\n contextIndicatorProps,\n qa: headerQa,\n } = headerProps;\n\n const {\n placeholder = 'Plan, code, build and test anything',\n minRows = 1,\n maxRows = 15,\n autoFocus = false,\n qa: bodyQa,\n } = bodyProps;\n\n const {\n bottomContent,\n showSettings = false,\n onSettingsClick,\n attachmentContent,\n showAttachment,\n onAttachmentClick,\n showMicrophone = false,\n onMicrophoneClick,\n submitButtonTooltipSend,\n submitButtonTooltipCancel,\n submitButtonCancelableText,\n submitButtonQa,\n qa: footerQa,\n } = footerProps;\n\n const {value, submitButtonState, handleChange, handleKeyDown, handleSubmit} = hookState;\n\n const shouldShowHeader = topContent || contextItems.length > 0 || showContextIndicator;\n\n return (\n <div className={b({view: 'full'}, className)} data-qa={qa}>\n {shouldShowHeader && (\n <PromptInputHeader\n contextItems={contextItems}\n showContextIndicator={showContextIndicator}\n contextIndicatorProps={contextIndicatorProps}\n qa={headerQa}\n >\n {topContent}\n </PromptInputHeader>\n )}\n\n <PromptInputBody\n value={value}\n placeholder={placeholder}\n minRows={minRows}\n maxRows={maxRows}\n autoFocus={autoFocus}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n inputClassName={b('textarea')}\n qa={bodyQa}\n />\n\n <PromptInputFooter\n qa={footerQa}\n submitButton={{\n onClick: handleSubmit,\n state: submitButtonState,\n tooltipSend: submitButtonTooltipSend,\n tooltipCancel: submitButtonTooltipCancel,\n cancelableText: submitButtonCancelableText,\n qa: submitButtonQa || 'submit-button-full',\n }}\n showSettings={showSettings}\n onSettingsClick={onSettingsClick}\n showAttachment={showAttachment}\n onAttachmentClick={onAttachmentClick}\n attachmentContent={attachmentContent}\n showMicrophone={showMicrophone}\n onMicrophoneClick={onMicrophoneClick}\n >\n {bottomContent}\n </PromptInputFooter>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PromptInputFull.js","sourceRoot":"../../../../../src","sources":["components/organisms/PromptInput/PromptInputFull.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,KAAK,EAAC,6BAA0B;AACxC,OAAO,EAAC,eAAe,EAAC,iDAAwC;AAChE,OAAO,EAAC,iBAAiB,EAAC,mDAA0C;AACpE,OAAO,EAAC,iBAAiB,EAAC,mDAA0C;AAKpE,MAAM,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAoBhC;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAA2B;IACvD,MAAM,EAAC,SAAS,EAAE,WAAW,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,SAAS,EAAE,EAAE,EAAC,GAAG,KAAK,CAAC;IAE7F,MAAM,EACF,UAAU,EACV,YAAY,GAAG,EAAE,EACjB,oBAAoB,GAAG,KAAK,EAC5B,qBAAqB,EACrB,EAAE,EAAE,QAAQ,GACf,GAAG,WAAW,CAAC;IAEhB,MAAM,EACF,WAAW,GAAG,qCAAqC,EACnD,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,EAAE,EACZ,SAAS,GAAG,KAAK,EACjB,QAAQ,EACR,EAAE,EAAE,MAAM,GACb,GAAG,SAAS,CAAC;IAEd,MAAM,EACF,aAAa,EACb,YAAY,GAAG,KAAK,EACpB,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,cAAc,GAAG,KAAK,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,cAAc,EACd,EAAE,EAAE,QAAQ,GACf,GAAG,WAAW,CAAC;IAEhB,MAAM,EAAC,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAC,GAAG,SAAS,CAAC;IAExF,MAAM,gBAAgB,GAAG,UAAU,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,IAAI,oBAAoB,CAAC;IAEvF,OAAO,CACH,eAAK,SAAS,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,EAAE,SAAS,CAAC,aAAW,EAAE,aACpD,gBAAgB,IAAI,CACjB,KAAC,iBAAiB,IACd,YAAY,EAAE,YAAY,EAC1B,oBAAoB,EAAE,oBAAoB,EAC1C,qBAAqB,EAAE,qBAAqB,EAC5C,EAAE,EAAE,QAAQ,YAEX,UAAU,GACK,CACvB,EAED,KAAC,eAAe,IACZ,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,QAAQ,EACb,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,aAAa,EACxB,cAAc,EAAE,CAAC,CAAC,UAAU,CAAC,EAC7B,EAAE,EAAE,MAAM,GACZ,EAEF,KAAC,iBAAiB,IACd,EAAE,EAAE,QAAQ,EACZ,YAAY,EAAE;oBACV,OAAO,EAAE,YAAY;oBACrB,KAAK,EAAE,iBAAiB;oBACxB,WAAW,EAAE,uBAAuB;oBACpC,aAAa,EAAE,yBAAyB;oBACxC,cAAc,EAAE,0BAA0B;oBAC1C,EAAE,EAAE,cAAc,IAAI,oBAAoB;iBAC7C,EACD,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,YAEnC,aAAa,GACE,IAClB,CACT,CAAC;AACN,CAAC","sourcesContent":["import {block} from '../../../utils/cn';\nimport {PromptInputBody} from '../../molecules/PromptInputBody';\nimport {PromptInputFooter} from '../../molecules/PromptInputFooter';\nimport {PromptInputHeader} from '../../molecules/PromptInputHeader';\n\nimport {PromptInputBodyConfig, PromptInputFooterConfig, PromptInputHeaderConfig} from './types';\nimport {UsePromptInputReturn} from './usePromptInput';\n\nconst b = block('prompt-input');\n\n/**\n * Props for the PromptInputFull component\n */\nexport type PromptInputFullProps = {\n /** Hook return value with state and handlers */\n hookState: UsePromptInputReturn;\n /** Header-related props */\n headerProps?: PromptInputHeaderConfig;\n /** Body/textarea-related props */\n bodyProps?: PromptInputBodyConfig;\n /** Footer-related props */\n footerProps?: PromptInputFooterConfig;\n /** Additional CSS class */\n className?: string;\n /** QA/test identifier */\n qa?: string;\n};\n\n/**\n * PromptInputFull component - full view with header, body, and footer\n *\n * @param props - Component props\n * @returns React component\n */\nexport function PromptInputFull(props: PromptInputFullProps) {\n const {hookState, headerProps = {}, bodyProps = {}, footerProps = {}, className, qa} = props;\n\n const {\n topContent,\n contextItems = [],\n showContextIndicator = false,\n contextIndicatorProps,\n qa: headerQa,\n } = headerProps;\n\n const {\n placeholder = 'Plan, code, build and test anything',\n minRows = 1,\n maxRows = 15,\n autoFocus = false,\n inputRef,\n qa: bodyQa,\n } = bodyProps;\n\n const {\n bottomContent,\n showSettings = false,\n onSettingsClick,\n attachmentContent,\n showAttachment,\n onAttachmentClick,\n showMicrophone = false,\n onMicrophoneClick,\n submitButtonTooltipSend,\n submitButtonTooltipCancel,\n submitButtonCancelableText,\n submitButtonQa,\n qa: footerQa,\n } = footerProps;\n\n const {value, submitButtonState, handleChange, handleKeyDown, handleSubmit} = hookState;\n\n const shouldShowHeader = topContent || contextItems.length > 0 || showContextIndicator;\n\n return (\n <div className={b({view: 'full'}, className)} data-qa={qa}>\n {shouldShowHeader && (\n <PromptInputHeader\n contextItems={contextItems}\n showContextIndicator={showContextIndicator}\n contextIndicatorProps={contextIndicatorProps}\n qa={headerQa}\n >\n {topContent}\n </PromptInputHeader>\n )}\n\n <PromptInputBody\n value={value}\n placeholder={placeholder}\n minRows={minRows}\n maxRows={maxRows}\n autoFocus={autoFocus}\n ref={inputRef}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n inputClassName={b('textarea')}\n qa={bodyQa}\n />\n\n <PromptInputFooter\n qa={footerQa}\n submitButton={{\n onClick: handleSubmit,\n state: submitButtonState,\n tooltipSend: submitButtonTooltipSend,\n tooltipCancel: submitButtonTooltipCancel,\n cancelableText: submitButtonCancelableText,\n qa: submitButtonQa || 'submit-button-full',\n }}\n showSettings={showSettings}\n onSettingsClick={onSettingsClick}\n showAttachment={showAttachment}\n onAttachmentClick={onAttachmentClick}\n attachmentContent={attachmentContent}\n showMicrophone={showMicrophone}\n onMicrophoneClick={onMicrophoneClick}\n >\n {bottomContent}\n </PromptInputFooter>\n </div>\n );\n}\n"]}
|
|
@@ -11,10 +11,10 @@ const b = block('prompt-input');
|
|
|
11
11
|
*/
|
|
12
12
|
export function PromptInputSimple(props) {
|
|
13
13
|
const { hookState, bodyProps = {}, footerProps = {}, className, qa } = props;
|
|
14
|
-
const { placeholder = 'Plan, code, build and test anything', minRows = 1, maxRows = 15, autoFocus = false, qa: bodyQa, } = bodyProps;
|
|
14
|
+
const { placeholder = 'Plan, code, build and test anything', minRows = 1, maxRows = 15, autoFocus = false, inputRef, qa: bodyQa, } = bodyProps;
|
|
15
15
|
const { bottomContent, showAttachment = false, onAttachmentClick, attachmentContent, showMicrophone = false, onMicrophoneClick, submitButtonTooltipSend, submitButtonTooltipCancel, submitButtonCancelableText, submitButtonQa, qa: footerQa, } = footerProps;
|
|
16
16
|
const { value, submitButtonState, handleChange, handleKeyDown, handleSubmit } = hookState;
|
|
17
|
-
return (_jsx("div", { className: b({ view: 'simple' }, className), "data-qa": qa, children: _jsxs("div", { className: b('content'), children: [_jsx(PromptInputBody, { value: value, placeholder: placeholder, minRows: minRows, maxRows: maxRows, autoFocus: autoFocus, onChange: handleChange, onKeyDown: handleKeyDown, qa: bodyQa }), _jsx(PromptInputFooter, { qa: footerQa, submitButton: {
|
|
17
|
+
return (_jsx("div", { className: b({ view: 'simple' }, className), "data-qa": qa, children: _jsxs("div", { className: b('content'), children: [_jsx(PromptInputBody, { value: value, placeholder: placeholder, minRows: minRows, maxRows: maxRows, autoFocus: autoFocus, ref: inputRef, onChange: handleChange, onKeyDown: handleKeyDown, qa: bodyQa }), _jsx(PromptInputFooter, { qa: footerQa, submitButton: {
|
|
18
18
|
onClick: handleSubmit,
|
|
19
19
|
state: submitButtonState,
|
|
20
20
|
tooltipSend: submitButtonTooltipSend,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PromptInputSimple.js","sourceRoot":"../../../../../src","sources":["components/organisms/PromptInput/PromptInputSimple.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,KAAK,EAAC,6BAA0B;AACxC,OAAO,EAAC,eAAe,EAAC,iDAAwC;AAChE,OAAO,EAAC,iBAAiB,EAAC,mDAA0C;AAKpE,MAAM,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;AAkBhC;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC3D,MAAM,EAAC,SAAS,EAAE,SAAS,GAAG,EAAE,EAAE,WAAW,GAAG,EAAE,EAAE,SAAS,EAAE,EAAE,EAAC,GAAG,KAAK,CAAC;IAE3E,MAAM,EACF,WAAW,GAAG,qCAAqC,EACnD,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,EAAE,EACZ,SAAS,GAAG,KAAK,EACjB,EAAE,EAAE,MAAM,GACb,GAAG,SAAS,CAAC;IAEd,MAAM,EACF,aAAa,EACb,cAAc,GAAG,KAAK,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,GAAG,KAAK,EACtB,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,cAAc,EACd,EAAE,EAAE,QAAQ,GACf,GAAG,WAAW,CAAC;IAEhB,MAAM,EAAC,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAC,GAAG,SAAS,CAAC;IAExF,OAAO,CACH,cAAK,SAAS,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAE,SAAS,CAAC,aAAW,EAAE,YACvD,eAAK,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,aACxB,KAAC,eAAe,IACZ,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,aAAa,EACxB,EAAE,EAAE,MAAM,GACZ,EACF,KAAC,iBAAiB,IACd,EAAE,EAAE,QAAQ,EACZ,YAAY,EAAE;wBACV,OAAO,EAAE,YAAY;wBACrB,KAAK,EAAE,iBAAiB;wBACxB,WAAW,EAAE,uBAAuB;wBACpC,aAAa,EAAE,yBAAyB;wBACxC,cAAc,EAAE,0BAA0B;wBAC1C,EAAE,EAAE,cAAc,IAAI,sBAAsB;qBAC/C,EACD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAC,GAAG,YAEb,aAAa,GACE,IAClB,GACJ,CACT,CAAC;AACN,CAAC","sourcesContent":["import {block} from '../../../utils/cn';\nimport {PromptInputBody} from '../../molecules/PromptInputBody';\nimport {PromptInputFooter} from '../../molecules/PromptInputFooter';\n\nimport {PromptInputBodyConfig, PromptInputFooterConfig} from './types';\nimport {UsePromptInputReturn} from './usePromptInput';\n\nconst b = block('prompt-input');\n\n/**\n * Props for the PromptInputSimple component\n */\nexport type PromptInputSimpleProps = {\n /** Hook return value with state and handlers */\n hookState: UsePromptInputReturn;\n /** Body/textarea-related props */\n bodyProps?: PromptInputBodyConfig;\n /** Footer-related props */\n footerProps?: PromptInputFooterConfig;\n /** Additional CSS class */\n className?: string;\n /** QA/test identifier */\n qa?: string;\n};\n\n/**\n * PromptInputSimple component - simple view with just body and footer\n *\n * @param props - Component props\n * @returns React component\n */\nexport function PromptInputSimple(props: PromptInputSimpleProps) {\n const {hookState, bodyProps = {}, footerProps = {}, className, qa} = props;\n\n const {\n placeholder = 'Plan, code, build and test anything',\n minRows = 1,\n maxRows = 15,\n autoFocus = false,\n qa: bodyQa,\n } = bodyProps;\n\n const {\n bottomContent,\n showAttachment = false,\n onAttachmentClick,\n attachmentContent,\n showMicrophone = false,\n onMicrophoneClick,\n submitButtonTooltipSend,\n submitButtonTooltipCancel,\n submitButtonCancelableText,\n submitButtonQa,\n qa: footerQa,\n } = footerProps;\n\n const {value, submitButtonState, handleChange, handleKeyDown, handleSubmit} = hookState;\n\n return (\n <div className={b({view: 'simple'}, className)} data-qa={qa}>\n <div className={b('content')}>\n <PromptInputBody\n value={value}\n placeholder={placeholder}\n minRows={minRows}\n maxRows={maxRows}\n autoFocus={autoFocus}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n qa={bodyQa}\n />\n <PromptInputFooter\n qa={footerQa}\n submitButton={{\n onClick: handleSubmit,\n state: submitButtonState,\n tooltipSend: submitButtonTooltipSend,\n tooltipCancel: submitButtonTooltipCancel,\n cancelableText: submitButtonCancelableText,\n qa: submitButtonQa || 'submit-button-simple',\n }}\n showAttachment={showAttachment}\n onAttachmentClick={onAttachmentClick}\n attachmentContent={attachmentContent}\n showMicrophone={showMicrophone}\n onMicrophoneClick={onMicrophoneClick}\n buttonSize=\"l\"\n >\n {bottomContent}\n </PromptInputFooter>\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PromptInputSimple.js","sourceRoot":"../../../../../src","sources":["components/organisms/PromptInput/PromptInputSimple.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,KAAK,EAAC,6BAA0B;AACxC,OAAO,EAAC,eAAe,EAAC,iDAAwC;AAChE,OAAO,EAAC,iBAAiB,EAAC,mDAA0C;AAKpE,MAAM,CAAC,GAAG,KAAK,CAAC,cAA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AAE,yBAAyB;wBACxC,cAAc,EAAE,0BAA0B;wBAC1C,EAAE,EAAE,cAAc,IAAI,sBAAsB;qBAC/C,EACD,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,cAAc,EAC9B,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAC,GAAG,YAEb,aAAa,GACE,IAClB,GACJ,CACT,CAAC;AACN,CAAC","sourcesContent":["import {block} from '../../../utils/cn';\nimport {PromptInputBody} from '../../molecules/PromptInputBody';\nimport {PromptInputFooter} from '../../molecules/PromptInputFooter';\n\nimport {PromptInputBodyConfig, PromptInputFooterConfig} from './types';\nimport {UsePromptInputReturn} from './usePromptInput';\n\nconst b = block('prompt-input');\n\n/**\n * Props for the PromptInputSimple component\n */\nexport type PromptInputSimpleProps = {\n /** Hook return value with state and handlers */\n hookState: UsePromptInputReturn;\n /** Body/textarea-related props */\n bodyProps?: PromptInputBodyConfig;\n /** Footer-related props */\n footerProps?: PromptInputFooterConfig;\n /** Additional CSS class */\n className?: string;\n /** QA/test identifier */\n qa?: string;\n};\n\n/**\n * PromptInputSimple component - simple view with just body and footer\n *\n * @param props - Component props\n * @returns React component\n */\nexport function PromptInputSimple(props: PromptInputSimpleProps) {\n const {hookState, bodyProps = {}, footerProps = {}, className, qa} = props;\n\n const {\n placeholder = 'Plan, code, build and test anything',\n minRows = 1,\n maxRows = 15,\n autoFocus = false,\n inputRef,\n qa: bodyQa,\n } = bodyProps;\n\n const {\n bottomContent,\n showAttachment = false,\n onAttachmentClick,\n attachmentContent,\n showMicrophone = false,\n onMicrophoneClick,\n submitButtonTooltipSend,\n submitButtonTooltipCancel,\n submitButtonCancelableText,\n submitButtonQa,\n qa: footerQa,\n } = footerProps;\n\n const {value, submitButtonState, handleChange, handleKeyDown, handleSubmit} = hookState;\n\n return (\n <div className={b({view: 'simple'}, className)} data-qa={qa}>\n <div className={b('content')}>\n <PromptInputBody\n value={value}\n placeholder={placeholder}\n minRows={minRows}\n maxRows={maxRows}\n autoFocus={autoFocus}\n ref={inputRef}\n onChange={handleChange}\n onKeyDown={handleKeyDown}\n qa={bodyQa}\n />\n <PromptInputFooter\n qa={footerQa}\n submitButton={{\n onClick: handleSubmit,\n state: submitButtonState,\n tooltipSend: submitButtonTooltipSend,\n tooltipCancel: submitButtonTooltipCancel,\n cancelableText: submitButtonCancelableText,\n qa: submitButtonQa || 'submit-button-simple',\n }}\n showAttachment={showAttachment}\n onAttachmentClick={onAttachmentClick}\n attachmentContent={attachmentContent}\n showMicrophone={showMicrophone}\n onMicrophoneClick={onMicrophoneClick}\n buttonSize=\"l\"\n >\n {bottomContent}\n </PromptInputFooter>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ReactNode, type Ref } from 'react';
|
|
2
2
|
import type { SuggestionsItem } from "../../../types/common.js";
|
|
3
3
|
import { PromptInputHeaderProps } from "../../molecules/PromptInputHeader/index.js";
|
|
4
4
|
import type { SuggestionsProps } from "../../molecules/Suggestions/index.js";
|
|
@@ -32,6 +32,8 @@ export type PromptInputHeaderConfig = {
|
|
|
32
32
|
export type PromptInputBodyConfig = {
|
|
33
33
|
/** QA/test identifier for body wrapper */
|
|
34
34
|
qa?: string;
|
|
35
|
+
/** Ref to the textarea input */
|
|
36
|
+
inputRef?: Ref<HTMLTextAreaElement>;
|
|
35
37
|
/** Placeholder text for textarea */
|
|
36
38
|
placeholder?: string;
|
|
37
39
|
/** Minimum number of textarea rows */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"../../../../../src","sources":["components/organisms/PromptInput/types.ts"],"names":[],"mappings":"","sourcesContent":["import {ReactNode} from 'react';\n\nimport type {SuggestionsItem} from '../../../types/common';\nimport {PromptInputHeaderProps} from '../../molecules/PromptInputHeader';\nimport type {SuggestionsProps} from '../../molecules/Suggestions';\n\n/**\n * Props for a panel (top or bottom)\n */\nexport type PromptInputPanelConfig = {\n /** Is panel open */\n isOpen: boolean;\n /** Panel content */\n children?: ReactNode;\n};\n\n/**\n * Props for the header section of PromptInput\n */\nexport type PromptInputHeaderConfig = {\n /** QA/test identifier for header wrapper */\n qa?: string;\n /** Custom content for header area */\n topContent?: ReactNode;\n /** Array of context items to display on the left */\n contextItems?: PromptInputHeaderProps['contextItems'];\n /** Show context indicator in header */\n showContextIndicator?: boolean;\n /** Props for context indicator */\n contextIndicatorProps?: PromptInputHeaderProps['contextIndicatorProps'];\n};\n\n/**\n * Props for the body/textarea section of PromptInput\n */\nexport type PromptInputBodyConfig = {\n /** QA/test identifier for body wrapper */\n qa?: string;\n /** Placeholder text for textarea */\n placeholder?: string;\n /** Minimum number of textarea rows */\n minRows?: number;\n /** Maximum number of textarea rows */\n maxRows?: number;\n /** Auto focus textarea on mount */\n autoFocus?: boolean;\n /**\n * Auto focus textarea when a new chat is opened via the plus icon.\n * Only applies inside ChatContainer. Defaults to false.\n */\n autoFocusOnNewChat?: boolean;\n /**\n * Auto focus textarea when a chat is selected from history.\n * Only applies inside ChatContainer. Defaults to false.\n */\n autoFocusOnChatSelect?: boolean;\n};\n\n/**\n * Props for the footer section of PromptInput\n */\nexport type PromptInputFooterConfig = {\n /** QA/test identifier for footer wrapper */\n qa?: string;\n /** Custom content for footer area (SubmitButton will still be shown) */\n bottomContent?: ReactNode;\n /** Show settings icon in footer */\n showSettings?: boolean;\n /** Settings icon click handler */\n onSettingsClick?: () => void;\n /** Show attachment icon in footer */\n showAttachment?: boolean;\n /** Attachment icon click handler */\n onAttachmentClick?: () => void;\n /**\n * Replaces the built-in attachment icon button with a custom node (e.g. AttachmentPicker).\n * When set, `showAttachment` and `onAttachmentClick` are ignored.\n */\n attachmentContent?: ReactNode;\n /** Show microphone icon in footer */\n showMicrophone?: boolean;\n /** Microphone icon click handler */\n onMicrophoneClick?: () => void;\n /** Custom tooltip for submit button in enabled state */\n submitButtonTooltipSend?: string;\n /** Custom tooltip for submit button in cancelable state */\n submitButtonTooltipCancel?: string;\n /** Custom cancelable text (if provided, will be shown in cancelable state) */\n submitButtonCancelableText?: string;\n /** QA/test identifier for submit button */\n submitButtonQa?: string;\n};\n\n/**\n * Props for the suggestions section of PromptInput\n */\nexport type PromptInputSuggestionsConfig = {\n /** Submit suggestions array */\n suggestions?: SuggestionsItem[];\n /** Show submit suggestions */\n showSuggestions?: boolean;\n /** Title for the suggestions section - can be string or custom React element */\n suggestTitle?: string | ReactNode;\n /** Layout orientation for suggestions: 'grid' for horizontal, 'list' for vertical */\n suggestionsLayout?: SuggestionsProps['layout'];\n /** Text alignment inside suggestion buttons */\n suggestionsTextAlign?: SuggestionsProps['textAlign'];\n /** Callback when suggestion is clicked */\n onSuggestionClick?: (content: string, id?: string) => void;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"../../../../../src","sources":["components/organisms/PromptInput/types.ts"],"names":[],"mappings":"","sourcesContent":["import {ReactNode, type Ref} from 'react';\n\nimport type {SuggestionsItem} from '../../../types/common';\nimport {PromptInputHeaderProps} from '../../molecules/PromptInputHeader';\nimport type {SuggestionsProps} from '../../molecules/Suggestions';\n\n/**\n * Props for a panel (top or bottom)\n */\nexport type PromptInputPanelConfig = {\n /** Is panel open */\n isOpen: boolean;\n /** Panel content */\n children?: ReactNode;\n};\n\n/**\n * Props for the header section of PromptInput\n */\nexport type PromptInputHeaderConfig = {\n /** QA/test identifier for header wrapper */\n qa?: string;\n /** Custom content for header area */\n topContent?: ReactNode;\n /** Array of context items to display on the left */\n contextItems?: PromptInputHeaderProps['contextItems'];\n /** Show context indicator in header */\n showContextIndicator?: boolean;\n /** Props for context indicator */\n contextIndicatorProps?: PromptInputHeaderProps['contextIndicatorProps'];\n};\n\n/**\n * Props for the body/textarea section of PromptInput\n */\nexport type PromptInputBodyConfig = {\n /** QA/test identifier for body wrapper */\n qa?: string;\n /** Ref to the textarea input */\n inputRef?: Ref<HTMLTextAreaElement>;\n /** Placeholder text for textarea */\n placeholder?: string;\n /** Minimum number of textarea rows */\n minRows?: number;\n /** Maximum number of textarea rows */\n maxRows?: number;\n /** Auto focus textarea on mount */\n autoFocus?: boolean;\n /**\n * Auto focus textarea when a new chat is opened via the plus icon.\n * Only applies inside ChatContainer. Defaults to false.\n */\n autoFocusOnNewChat?: boolean;\n /**\n * Auto focus textarea when a chat is selected from history.\n * Only applies inside ChatContainer. Defaults to false.\n */\n autoFocusOnChatSelect?: boolean;\n};\n\n/**\n * Props for the footer section of PromptInput\n */\nexport type PromptInputFooterConfig = {\n /** QA/test identifier for footer wrapper */\n qa?: string;\n /** Custom content for footer area (SubmitButton will still be shown) */\n bottomContent?: ReactNode;\n /** Show settings icon in footer */\n showSettings?: boolean;\n /** Settings icon click handler */\n onSettingsClick?: () => void;\n /** Show attachment icon in footer */\n showAttachment?: boolean;\n /** Attachment icon click handler */\n onAttachmentClick?: () => void;\n /**\n * Replaces the built-in attachment icon button with a custom node (e.g. AttachmentPicker).\n * When set, `showAttachment` and `onAttachmentClick` are ignored.\n */\n attachmentContent?: ReactNode;\n /** Show microphone icon in footer */\n showMicrophone?: boolean;\n /** Microphone icon click handler */\n onMicrophoneClick?: () => void;\n /** Custom tooltip for submit button in enabled state */\n submitButtonTooltipSend?: string;\n /** Custom tooltip for submit button in cancelable state */\n submitButtonTooltipCancel?: string;\n /** Custom cancelable text (if provided, will be shown in cancelable state) */\n submitButtonCancelableText?: string;\n /** QA/test identifier for submit button */\n submitButtonQa?: string;\n};\n\n/**\n * Props for the suggestions section of PromptInput\n */\nexport type PromptInputSuggestionsConfig = {\n /** Submit suggestions array */\n suggestions?: SuggestionsItem[];\n /** Show submit suggestions */\n showSuggestions?: boolean;\n /** Title for the suggestions section - can be string or custom React element */\n suggestTitle?: string | ReactNode;\n /** Layout orientation for suggestions: 'grid' for horizontal, 'list' for vertical */\n suggestionsLayout?: SuggestionsProps['layout'];\n /** Text alignment inside suggestion buttons */\n suggestionsTextAlign?: SuggestionsProps['textAlign'];\n /** Callback when suggestion is clicked */\n onSuggestionClick?: (content: string, id?: string) => void;\n};\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMemo, useRef } from 'react';
|
|
2
2
|
import transform from '@diplodoc/transform';
|
|
3
3
|
import '@diplodoc/transform/dist/js/yfm.js';
|
|
4
|
-
import { areOptionsEqual
|
|
4
|
+
import { areOptionsEqual } from "../utils/markdownUtils.js";
|
|
5
5
|
import { parseMarkdownIntoBlocks } from "../utils/parse-blocks.js";
|
|
6
6
|
export function useMarkdownTransform(content, options) {
|
|
7
7
|
const cacheRef = useRef(new Map());
|
|
@@ -15,7 +15,6 @@ export function useMarkdownTransform(content, options) {
|
|
|
15
15
|
cacheRef.current.clear();
|
|
16
16
|
prevOptionsRef.current = options;
|
|
17
17
|
}
|
|
18
|
-
const transformOptions = mergeMarkdownTransformOptions(options);
|
|
19
18
|
try {
|
|
20
19
|
const blocks = parseMarkdownIntoBlocks(content);
|
|
21
20
|
const cache = cacheRef.current;
|
|
@@ -24,7 +23,7 @@ export function useMarkdownTransform(content, options) {
|
|
|
24
23
|
let html = cache.get(block);
|
|
25
24
|
if (!html) {
|
|
26
25
|
try {
|
|
27
|
-
const result = transform(block,
|
|
26
|
+
const result = transform(block, options);
|
|
28
27
|
html = result.result.html;
|
|
29
28
|
cache.set(block, html);
|
|
30
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMarkdownTransform.js","sourceRoot":"../../../src","sources":["hooks/useMarkdownTransform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAEtC,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,oCAAoC,CAAC;AAG5C,OAAO,EAAC,eAAe,
|
|
1
|
+
{"version":3,"file":"useMarkdownTransform.js","sourceRoot":"../../../src","sources":["hooks/useMarkdownTransform.ts"],"names":[],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oBAC3B,CAAC;oBAAC,WAAM,CAAC;wBACL,IAAI,GAAG,EAAE,CAAC;oBACd,CAAC;gBACL,CAAC;gBACD,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACzB,CAAC;YAED,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;YACzC,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC;gBAC7B,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBAC7B,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBACtB,CAAC;YACL,CAAC;YAED,OAAO,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9B,CAAC;QAAC,WAAM,CAAC;YACL,OAAO,EAAE,CAAC;QACd,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import {useMemo, useRef} from 'react';\n\nimport transform from '@diplodoc/transform';\nimport '@diplodoc/transform/dist/js/yfm.js';\nimport {OptionsType} from '@diplodoc/transform/lib/typings';\n\nimport {areOptionsEqual} from '../utils/markdownUtils';\nimport {parseMarkdownIntoBlocks} from '../utils/parse-blocks';\n\nexport function useMarkdownTransform(content: string, options?: OptionsType): string {\n const cacheRef = useRef<Map<string, string>>(new Map());\n const prevOptionsRef = useRef<OptionsType | undefined>(options);\n\n return useMemo(() => {\n if (!content) {\n return '';\n }\n\n const optionsChanged = !areOptionsEqual(prevOptionsRef.current, options);\n if (optionsChanged) {\n cacheRef.current.clear();\n prevOptionsRef.current = options;\n }\n\n try {\n const blocks = parseMarkdownIntoBlocks(content);\n const cache = cacheRef.current;\n const htmlParts: string[] = [];\n\n for (const block of blocks) {\n let html = cache.get(block);\n if (!html) {\n try {\n const result = transform(block, options);\n html = result.result.html;\n cache.set(block, html);\n } catch {\n html = '';\n }\n }\n htmlParts.push(html);\n }\n\n const currentBlocksSet = new Set(blocks);\n for (const key of cache.keys()) {\n if (!currentBlocksSet.has(key)) {\n cache.delete(key);\n }\n }\n\n return htmlParts.join('');\n } catch {\n return '';\n }\n }, [content, options]);\n}\n"]}
|
package/build/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.
|
|
1
|
+
{"version":"2.8.0","type":"module","sideEffects":["*.css","*.scss"]}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import { OptionsType } from '@diplodoc/transform/lib/typings';
|
|
2
2
|
export declare function areOptionsEqual(prev?: OptionsType, next?: OptionsType): boolean;
|
|
3
|
-
/** AIKit default transform plugins; user plugins from `transformOptions` are appended after. */
|
|
4
|
-
export declare function mergeMarkdownTransformOptions(options?: OptionsType): OptionsType;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { markdownTableWrapPlugin } from "./markdownTableWrapPlugin.js";
|
|
2
1
|
export function areOptionsEqual(prev, next) {
|
|
3
2
|
if (prev === next) {
|
|
4
3
|
return true;
|
|
@@ -18,10 +17,4 @@ export function areOptionsEqual(prev, next) {
|
|
|
18
17
|
}
|
|
19
18
|
return true;
|
|
20
19
|
}
|
|
21
|
-
/** AIKit default transform plugins; user plugins from `transformOptions` are appended after. */
|
|
22
|
-
export function mergeMarkdownTransformOptions(options) {
|
|
23
|
-
var _a;
|
|
24
|
-
const userPlugins = (_a = options === null || options === void 0 ? void 0 : options.plugins) !== null && _a !== void 0 ? _a : [];
|
|
25
|
-
return Object.assign(Object.assign({}, options), { plugins: [markdownTableWrapPlugin, ...userPlugins] });
|
|
26
|
-
}
|
|
27
20
|
//# sourceMappingURL=markdownUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdownUtils.js","sourceRoot":"../../../src","sources":["utils/markdownUtils.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"markdownUtils.js","sourceRoot":"../../../src","sources":["utils/markdownUtils.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,eAAe,CAAC,IAAkB,EAAE,IAAkB;IAClE,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import {OptionsType} from '@diplodoc/transform/lib/typings';\n\nexport function areOptionsEqual(prev?: OptionsType, next?: OptionsType): boolean {\n if (prev === next) {\n return true;\n }\n if (!prev || !next) {\n return false;\n }\n const prevKeys = Object.keys(prev);\n const nextKeys = Object.keys(next);\n if (prevKeys.length !== nextKeys.length) {\n return false;\n }\n for (const key of prevKeys) {\n if (prev[key] !== next[key]) {\n return false;\n }\n }\n return true;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ExtendedPluginWithCollect } from '@diplodoc/transform/lib/typings';
|
|
2
|
-
/** Matches `.g-aikit-markdown-renderer__table-wrap` in MarkdownRenderer.scss */
|
|
3
|
-
export declare const MARKDOWN_TABLE_WRAP_CLASS = "g-aikit-markdown-renderer__table-wrap";
|
|
4
|
-
export declare const markdownTableWrapPlugin: ExtendedPluginWithCollect;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.markdownTableWrapPlugin = exports.MARKDOWN_TABLE_WRAP_CLASS = void 0;
|
|
4
|
-
const cn_1 = require("./cn.js");
|
|
5
|
-
/** Matches `.g-aikit-markdown-renderer__table-wrap` in MarkdownRenderer.scss */
|
|
6
|
-
exports.MARKDOWN_TABLE_WRAP_CLASS = `${cn_1.NAMESPACE}markdown-renderer__table-wrap`;
|
|
7
|
-
exports.markdownTableWrapPlugin = ((md) => {
|
|
8
|
-
const defaultTableOpen = md.renderer.rules.table_open ||
|
|
9
|
-
function (tokens, idx, options, _env, self) {
|
|
10
|
-
return self.renderToken(tokens, idx, options);
|
|
11
|
-
};
|
|
12
|
-
const defaultTableClose = md.renderer.rules.table_close ||
|
|
13
|
-
function (tokens, idx, options, _env, self) {
|
|
14
|
-
return self.renderToken(tokens, idx, options);
|
|
15
|
-
};
|
|
16
|
-
// eslint-disable-next-line no-param-reassign
|
|
17
|
-
md.renderer.rules.table_open = function (tokens, idx, options, env, self) {
|
|
18
|
-
return `<div class="${exports.MARKDOWN_TABLE_WRAP_CLASS}">${defaultTableOpen(tokens, idx, options, env, self)}`;
|
|
19
|
-
};
|
|
20
|
-
// eslint-disable-next-line no-param-reassign
|
|
21
|
-
md.renderer.rules.table_close = function (tokens, idx, options, env, self) {
|
|
22
|
-
return `${defaultTableClose(tokens, idx, options, env, self)}</div>`;
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=markdownTableWrapPlugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdownTableWrapPlugin.js","sourceRoot":"../../../src","sources":["utils/markdownTableWrapPlugin.ts"],"names":[],"mappings":";;;AAEA,gCAA+B;AAE/B,gFAAgF;AACnE,QAAA,yBAAyB,GAAG,GAAG,cAAS,+BAA+B,CAAC;AAExE,QAAA,uBAAuB,GAA8B,CAAC,CAAC,EAAc,EAAE,EAAE;IAClF,MAAM,gBAAgB,GAClB,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU;QAC5B,UAAU,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI;YACtC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC;IAEN,MAAM,iBAAiB,GACnB,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW;QAC7B,UAAU,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI;YACtC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC;IAEN,6CAA6C;IAC7C,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,GAAG,UAAU,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI;QACpE,OAAO,eAAe,iCAAyB,KAAK,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;IAC5G,CAAC,CAAC;IAEF,6CAA6C;IAC7C,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,GAAG,UAAU,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI;QACrE,OAAO,GAAG,iBAAiB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC;IACzE,CAAC,CAAC;AACN,CAAC,CAA8B,CAAC","sourcesContent":["import type {ExtendedPluginWithCollect, MarkdownIt} from '@diplodoc/transform/lib/typings';\n\nimport {NAMESPACE} from './cn';\n\n/** Matches `.g-aikit-markdown-renderer__table-wrap` in MarkdownRenderer.scss */\nexport const MARKDOWN_TABLE_WRAP_CLASS = `${NAMESPACE}markdown-renderer__table-wrap`;\n\nexport const markdownTableWrapPlugin: ExtendedPluginWithCollect = ((md: MarkdownIt) => {\n const defaultTableOpen =\n md.renderer.rules.table_open ||\n function (tokens, idx, options, _env, self) {\n return self.renderToken(tokens, idx, options);\n };\n\n const defaultTableClose =\n md.renderer.rules.table_close ||\n function (tokens, idx, options, _env, self) {\n return self.renderToken(tokens, idx, options);\n };\n\n // eslint-disable-next-line no-param-reassign\n md.renderer.rules.table_open = function (tokens, idx, options, env, self) {\n return `<div class=\"${MARKDOWN_TABLE_WRAP_CLASS}\">${defaultTableOpen(tokens, idx, options, env, self)}`;\n };\n\n // eslint-disable-next-line no-param-reassign\n md.renderer.rules.table_close = function (tokens, idx, options, env, self) {\n return `${defaultTableClose(tokens, idx, options, env, self)}</div>`;\n };\n}) as ExtendedPluginWithCollect;\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { ExtendedPluginWithCollect } from '@diplodoc/transform/lib/typings';
|
|
2
|
-
/** Matches `.g-aikit-markdown-renderer__table-wrap` in MarkdownRenderer.scss */
|
|
3
|
-
export declare const MARKDOWN_TABLE_WRAP_CLASS = "g-aikit-markdown-renderer__table-wrap";
|
|
4
|
-
export declare const markdownTableWrapPlugin: ExtendedPluginWithCollect;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { NAMESPACE } from "./cn.js";
|
|
2
|
-
/** Matches `.g-aikit-markdown-renderer__table-wrap` in MarkdownRenderer.scss */
|
|
3
|
-
export const MARKDOWN_TABLE_WRAP_CLASS = `${NAMESPACE}markdown-renderer__table-wrap`;
|
|
4
|
-
export const markdownTableWrapPlugin = ((md) => {
|
|
5
|
-
const defaultTableOpen = md.renderer.rules.table_open ||
|
|
6
|
-
function (tokens, idx, options, _env, self) {
|
|
7
|
-
return self.renderToken(tokens, idx, options);
|
|
8
|
-
};
|
|
9
|
-
const defaultTableClose = md.renderer.rules.table_close ||
|
|
10
|
-
function (tokens, idx, options, _env, self) {
|
|
11
|
-
return self.renderToken(tokens, idx, options);
|
|
12
|
-
};
|
|
13
|
-
// eslint-disable-next-line no-param-reassign
|
|
14
|
-
md.renderer.rules.table_open = function (tokens, idx, options, env, self) {
|
|
15
|
-
return `<div class="${MARKDOWN_TABLE_WRAP_CLASS}">${defaultTableOpen(tokens, idx, options, env, self)}`;
|
|
16
|
-
};
|
|
17
|
-
// eslint-disable-next-line no-param-reassign
|
|
18
|
-
md.renderer.rules.table_close = function (tokens, idx, options, env, self) {
|
|
19
|
-
return `${defaultTableClose(tokens, idx, options, env, self)}</div>`;
|
|
20
|
-
};
|
|
21
|
-
});
|
|
22
|
-
//# sourceMappingURL=markdownTableWrapPlugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdownTableWrapPlugin.js","sourceRoot":"../../../src","sources":["utils/markdownTableWrapPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAC,gBAAa;AAE/B,gFAAgF;AAChF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,SAAS,+BAA+B,CAAC;AAErF,MAAM,CAAC,MAAM,uBAAuB,GAA8B,CAAC,CAAC,EAAc,EAAE,EAAE;IAClF,MAAM,gBAAgB,GAClB,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU;QAC5B,UAAU,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI;YACtC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC;IAEN,MAAM,iBAAiB,GACnB,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW;QAC7B,UAAU,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI;YACtC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC;IAEN,6CAA6C;IAC7C,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,GAAG,UAAU,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI;QACpE,OAAO,eAAe,yBAAyB,KAAK,gBAAgB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;IAC5G,CAAC,CAAC;IAEF,6CAA6C;IAC7C,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,GAAG,UAAU,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI;QACrE,OAAO,GAAG,iBAAiB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC;IACzE,CAAC,CAAC;AACN,CAAC,CAA8B,CAAC","sourcesContent":["import type {ExtendedPluginWithCollect, MarkdownIt} from '@diplodoc/transform/lib/typings';\n\nimport {NAMESPACE} from './cn';\n\n/** Matches `.g-aikit-markdown-renderer__table-wrap` in MarkdownRenderer.scss */\nexport const MARKDOWN_TABLE_WRAP_CLASS = `${NAMESPACE}markdown-renderer__table-wrap`;\n\nexport const markdownTableWrapPlugin: ExtendedPluginWithCollect = ((md: MarkdownIt) => {\n const defaultTableOpen =\n md.renderer.rules.table_open ||\n function (tokens, idx, options, _env, self) {\n return self.renderToken(tokens, idx, options);\n };\n\n const defaultTableClose =\n md.renderer.rules.table_close ||\n function (tokens, idx, options, _env, self) {\n return self.renderToken(tokens, idx, options);\n };\n\n // eslint-disable-next-line no-param-reassign\n md.renderer.rules.table_open = function (tokens, idx, options, env, self) {\n return `<div class=\"${MARKDOWN_TABLE_WRAP_CLASS}\">${defaultTableOpen(tokens, idx, options, env, self)}`;\n };\n\n // eslint-disable-next-line no-param-reassign\n md.renderer.rules.table_close = function (tokens, idx, options, env, self) {\n return `${defaultTableClose(tokens, idx, options, env, self)}</div>`;\n };\n}) as ExtendedPluginWithCollect;\n"]}
|