@neo4j-ndl/react 4.14.5 → 4.15.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/lib/cjs/ai/preview/Preview.js +5 -0
- package/lib/cjs/ai/preview/Preview.js.map +1 -1
- package/lib/cjs/ai/preview/stories/index.js +9 -1
- package/lib/cjs/ai/preview/stories/index.js.map +1 -1
- package/lib/cjs/ai/preview/stories/preview-simple-with-content.story.js +34 -0
- package/lib/cjs/ai/preview/stories/preview-simple-with-content.story.js.map +1 -0
- package/lib/cjs/ai/preview/stories/preview-simple.story.js +33 -0
- package/lib/cjs/ai/preview/stories/preview-simple.story.js.map +1 -0
- package/lib/cjs/ai/prompt/Prompt.js +4 -14
- package/lib/cjs/ai/prompt/Prompt.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/index.js +5 -1
- package/lib/cjs/ai/prompt/stories/index.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
- package/lib/cjs/ai/prompt/stories/prompt-header.story.js +39 -0
- package/lib/cjs/ai/prompt/stories/prompt-header.story.js.map +1 -0
- package/lib/cjs/ai/response/Response.js +23 -22
- package/lib/cjs/ai/response/Response.js.map +1 -1
- package/lib/cjs/ai/response/stories/response-all-components.story.js +2 -0
- package/lib/cjs/ai/response/stories/response-all-components.story.js.map +1 -1
- package/lib/cjs/data-grid/Components.js +25 -10
- package/lib/cjs/data-grid/Components.js.map +1 -1
- package/lib/cjs/data-grid/datagrid-types.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js +1 -0
- package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
- package/lib/cjs/data-grid/stories/datagrid-using-editable-cells.story.js +145 -52
- package/lib/cjs/data-grid/stories/datagrid-using-editable-cells.story.js.map +1 -1
- package/lib/esm/ai/preview/Preview.js +5 -0
- package/lib/esm/ai/preview/Preview.js.map +1 -1
- package/lib/esm/ai/preview/stories/index.js +6 -0
- package/lib/esm/ai/preview/stories/index.js.map +1 -1
- package/lib/esm/ai/preview/stories/preview-simple-with-content.story.js +32 -0
- package/lib/esm/ai/preview/stories/preview-simple-with-content.story.js.map +1 -0
- package/lib/esm/ai/preview/stories/preview-simple.story.js +31 -0
- package/lib/esm/ai/preview/stories/preview-simple.story.js.map +1 -0
- package/lib/esm/ai/prompt/Prompt.js +6 -16
- package/lib/esm/ai/prompt/Prompt.js.map +1 -1
- package/lib/esm/ai/prompt/stories/index.js +3 -0
- package/lib/esm/ai/prompt/stories/index.js.map +1 -1
- package/lib/esm/ai/prompt/stories/prompt-advanced.story.js +1 -1
- package/lib/esm/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
- package/lib/esm/ai/prompt/stories/prompt-header.story.js +37 -0
- package/lib/esm/ai/prompt/stories/prompt-header.story.js.map +1 -0
- package/lib/esm/ai/response/Response.js +23 -22
- package/lib/esm/ai/response/Response.js.map +1 -1
- package/lib/esm/ai/response/stories/response-all-components.story.js +2 -0
- package/lib/esm/ai/response/stories/response-all-components.story.js.map +1 -1
- package/lib/esm/data-grid/Components.js +25 -10
- package/lib/esm/data-grid/Components.js.map +1 -1
- package/lib/esm/data-grid/datagrid-types.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js +1 -0
- package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
- package/lib/esm/data-grid/stories/datagrid-using-editable-cells.story.js +147 -54
- package/lib/esm/data-grid/stories/datagrid-using-editable-cells.story.js.map +1 -1
- package/lib/types/ai/preview/Preview.d.ts +4 -0
- package/lib/types/ai/preview/Preview.d.ts.map +1 -1
- package/lib/types/ai/preview/stories/index.d.ts +4 -0
- package/lib/types/ai/preview/stories/index.d.ts.map +1 -1
- package/lib/types/ai/preview/stories/preview-simple-with-content.story.d.ts +24 -0
- package/lib/types/ai/preview/stories/preview-simple-with-content.story.d.ts.map +1 -0
- package/lib/types/ai/preview/stories/preview-simple.story.d.ts +24 -0
- package/lib/types/ai/preview/stories/preview-simple.story.d.ts.map +1 -0
- package/lib/types/ai/prompt/Prompt.d.ts +6 -2
- package/lib/types/ai/prompt/Prompt.d.ts.map +1 -1
- package/lib/types/ai/prompt/stories/index.d.ts +2 -0
- package/lib/types/ai/prompt/stories/index.d.ts.map +1 -1
- package/lib/types/ai/prompt/stories/prompt-advanced.story.d.ts.map +1 -1
- package/lib/types/ai/prompt/stories/prompt-header.story.d.ts +24 -0
- package/lib/types/ai/prompt/stories/prompt-header.story.d.ts.map +1 -0
- package/lib/types/ai/response/Response.d.ts.map +1 -1
- package/lib/types/ai/response/stories/response-all-components.story.d.ts.map +1 -1
- package/lib/types/data-grid/Components.d.ts +16 -1
- package/lib/types/data-grid/Components.d.ts.map +1 -1
- package/lib/types/data-grid/DataGrid.d.ts +10 -1
- package/lib/types/data-grid/DataGrid.d.ts.map +1 -1
- package/lib/types/data-grid/datagrid-types.d.ts +11 -1
- package/lib/types/data-grid/datagrid-types.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-in-dialog.story.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts +10 -1
- package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts +10 -1
- package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts.map +1 -1
- package/lib/types/data-grid/stories/datagrid-using-editable-cells.story.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -103,9 +103,14 @@ const PreviewCode = (_a) => {
|
|
|
103
103
|
// wrapLongLines
|
|
104
104
|
codeTagProps: { className: 'n-ai-preview-code' }, showLineNumbers: false, children: code }) })] }))] })));
|
|
105
105
|
};
|
|
106
|
+
const PreviewContent = (_a) => {
|
|
107
|
+
var { children, ref, style, className, htmlAttributes } = _a, restProps = __rest(_a, ["children", "ref", "style", "className", "htmlAttributes"]);
|
|
108
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref, style: style, className: (0, classnames_1.default)('ndl-ai-preview-content', className) }, restProps, htmlAttributes, { children: children })));
|
|
109
|
+
};
|
|
106
110
|
exports.Preview = Object.assign(PreviewComponent, {
|
|
107
111
|
Code: PreviewCode,
|
|
108
112
|
Confirmation: PreviewConfirmation,
|
|
113
|
+
Content: PreviewContent,
|
|
109
114
|
Header: PreviewHeader,
|
|
110
115
|
});
|
|
111
116
|
//# sourceMappingURL=Preview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Preview.js","sourceRoot":"","sources":["../../../../src/ai/preview/Preview.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4CAO0B;AAC1B,kDAA4E;AAC5E,4DAAoC;AACpC,iCAA4C;AAC5C,uEAA2E;AAG3E,oEAIyC;AACzC,0FAAgE;AAChE,4FAAkE;AAMlE;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,CAAC,EAOS,EAAE,EAAE;QAPb,EACxB,QAAQ,EACR,GAAG,EACH,KAAK,EACL,SAAS,EACT,cAAc,OAEmB,EAD9B,SAAS,cANY,2DAOzB,CADa;IAEZ,OAAO,CACL,8CACE,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,IAAA,oBAAU,EAAC,gBAAgB,EAAE,SAAS,CAAC,IAC9C,SAAS,EACT,cAAc,cAEjB,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC;AAOF,MAAM,aAAa,GAAG,CAAC,EAQkB,EAAE,EAAE;QARtB,EACrB,QAAQ,EACR,OAAO,EACP,GAAG,EACH,KAAK,EACL,SAAS,EACT,cAAc,OAEyB,EADpC,SAAS,cAPS,sEAQtB,CADa;IAEZ,OAAO,CACL,+CACE,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS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,EAClC,KAAK,kCACA,QAAQ,EAAE,KACb,yBAAyB,EAAE;oCACzB,MAAM,EAAE,CAAC;oCACT,KAAK,EAAE,yCAAyC;oCAChD,UAAU,EAAE,GAAG;oCACf,SAAS,EAAE,MAAM;oCACjB,OAAO,EAAE,iBAAiB;oCAC1B,KAAK,EAAE,aAAa;iCACrB;4BAEH,2FAA2F;4BAC3F,kFAAkF;4BAClF,gBAAgB;4BAChB,YAAY,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,EAChD,eAAe,EAAE,KAAK,YAErB,IAAI,GACa,GAChB,IACL,CACJ,KACG,CACP,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;IACrD,IAAI,EAAE,WAAW;IACjB,YAAY,EAAE,mBAAmB;IACjC,MAAM,EAAE,aAAa;CACtB,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n ClipboardButton,\n type CodeBlock,\n LoadingSpinner,\n StatusLabel,\n Typography,\n useNeedleTheme,\n} from '@neo4j-ndl/react';\nimport { CheckIconOutline, XMarkIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport { useEffect, useState } from 'react';\nimport { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter';\n\nimport { type CommonProps } from '../../_common/types';\nimport {\n type LanguageProp,\n Languages,\n loadLanguage,\n} from '../../code-block/code-languages';\nimport ndlCodeDark from '../../code-block/themes/ndl-code-dark';\nimport ndlCodeLight from '../../code-block/themes/ndl-code-light';\n\ntype PreviewProps = {\n children: React.ReactNode;\n};\n\n/**\n * Component to use for previewing certain content in AI chat applications.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst PreviewComponent = ({\n children,\n ref,\n style,\n className,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', PreviewProps>) => {\n return (\n <div\n ref={ref}\n style={style}\n className={classNames('ndl-ai-preview', className)}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\ntype PreviewHeaderProps = {\n children?: React.ReactNode;\n actions?: React.ReactNode;\n};\n\nconst PreviewHeader = ({\n children,\n actions,\n ref,\n style,\n className,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', PreviewHeaderProps>) => {\n return (\n <div\n ref={ref}\n style={style}\n className={classNames('ndl-ai-preview-header', className)}\n {...restProps}\n {...htmlAttributes}\n >\n <Typography\n variant=\"code\"\n as=\"div\"\n className=\"ndl-ai-preview-header-leading-content\"\n >\n {children}\n </Typography>\n\n {actions && (\n <div className=\"ndl-ai-preview-header-actions\">{actions}</div>\n )}\n </div>\n );\n};\n\ntype PreviewConfirmationProps = {\n /** The content to display in the confirmation */\n children?: React.ReactNode;\n /** The actions to display in the confirmation, usually two buttons; one for confirming and one for rejecting. */\n actions: React.ReactNode;\n /** Whether the confirmation is used as a footer */\n isFooter?: boolean;\n /** The status of the confirmation */\n status?: 'pending' | 'confirmed' | 'rejected';\n /** The text to display for the confirmed status */\n confirmedActionText?: string;\n /** The text to display for the rejected status */\n rejectedActionText?: string;\n};\n\nconst PreviewConfirmation = ({\n children,\n actions,\n isFooter = false,\n status = 'pending',\n confirmedActionText = 'Action confirmed',\n rejectedActionText = 'Action rejected',\n ref,\n style,\n className,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', PreviewConfirmationProps>) => {\n const classes = classNames('ndl-ai-preview-confirmation', className, {\n 'ndl-ai-preview-confirmation-footer': isFooter,\n });\n\n return (\n <div\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {!(isFooter && status !== 'pending') && (\n <Typography\n as=\"div\"\n variant={isFooter ? 'subheading-small' : 'body-medium'}\n className=\"ndl-ai-preview-confirmation-content\"\n >\n {children}\n </Typography>\n )}\n <Typography\n variant=\"body-medium\"\n as=\"div\"\n className=\"ndl-ai-preview-confirmation-actions\"\n >\n {status === 'pending' && actions}\n {status === 'confirmed' && (\n <div className=\"ndl-ai-preview-confirmation-confirm-reject\">\n <CheckIconOutline className=\"ndl-ai-preview-confirmation-action-icon\" />\n {confirmedActionText}\n </div>\n )}\n {status === 'rejected' && (\n <div className=\"ndl-ai-preview-confirmation-confirm-reject\">\n <XMarkIconOutline className=\"ndl-ai-preview-confirmation-action-icon\" />\n {rejectedActionText}\n </div>\n )}\n </Typography>\n </div>\n );\n};\n\ntype PreviewCodeProps = {\n /** The code content to display */\n code: string;\n /** The language of the code (e.g., 'cypher', 'python', 'javascript') */\n language: React.ComponentProps<typeof CodeBlock>['language'];\n /** The current state of the code block */\n label?: 'read' | 'write';\n /** Whether the code block is loading */\n isLoading?: boolean;\n /** The actions to display in the header. Should be small buttons or icon buttons only. */\n headerActions?: React.ReactNode;\n /** The theme of the code block */\n theme?: 'ndl-code-dark' | 'ndl-code-light';\n};\n\nconst PreviewCode = ({\n code,\n language,\n label,\n isLoading = false,\n headerActions,\n theme,\n ref,\n style,\n className,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', PreviewCodeProps>) => {\n const [loadedLanguage, setLoadedLanguage] = useState<\n PreviewCodeProps['language'] | null\n >(null);\n const { theme: ndlTheme } = useNeedleTheme();\n\n useEffect(() => {\n if (!language || !(Languages as readonly string[]).includes(language)) {\n setLoadedLanguage('text');\n return;\n }\n\n loadLanguage(language as LanguageProp)\n .then((module) => {\n SyntaxHighlighter.registerLanguage(language, module.default);\n setLoadedLanguage(language);\n })\n .catch((err) => console.error(err));\n }, [language]);\n\n const getTheme = () => {\n switch (theme) {\n case 'ndl-code-dark':\n return ndlCodeDark;\n case 'ndl-code-light':\n return ndlCodeLight;\n default:\n return ndlTheme === 'light' ? ndlCodeLight : ndlCodeDark;\n }\n };\n\n return (\n <div\n ref={ref}\n style={style}\n className={classNames('ndl-ai-preview-code', className)}\n {...restProps}\n {...htmlAttributes}\n >\n {isLoading && (\n <div className=\"ndl-ai-preview-code-loading\">\n <LoadingSpinner size=\"medium\" />\n <Typography variant=\"code\">\n WRITING {language.toUpperCase()}\n </Typography>\n </div>\n )}\n {!isLoading && (\n <>\n <PreviewHeader\n className=\"ndl-ai-preview-code-header\"\n actions={\n <>\n <ClipboardButton\n textToCopy={code}\n type=\"clean-icon-button\"\n size=\"small\"\n />\n {headerActions}\n </>\n }\n >\n {language} {language.toLowerCase() === 'cypher' ? 'QUERY' : ''}\n {label && (\n <StatusLabel\n variant={label === 'write' ? 'warning' : 'info'}\n size=\"small\"\n fill=\"semi-filled\"\n >\n {label.toUpperCase()}\n </StatusLabel>\n )}\n </PreviewHeader>\n <div className=\"ndl-ai-preview-code-content\">\n <SyntaxHighlighter\n language={loadedLanguage ?? 'text'}\n style={{\n ...getTheme(),\n 'pre[class*=\"language-\"]': {\n border: 0,\n color: 'var(--theme-color-neutral-text-default)',\n lineHeight: '1',\n overflowX: 'auto',\n padding: 'var(--space-12)',\n width: 'fit-content',\n },\n }}\n // Turn on 'shouldShowLineNumbers' & 'wrapLongLines' at the same time, the display is wrong\n // https://github.com/react-syntax-highlighter/react-syntax-highlighter/issues/402\n // wrapLongLines\n codeTagProps={{ className: 'n-ai-preview-code' }}\n showLineNumbers={false}\n >\n {code}\n </SyntaxHighlighter>\n </div>\n </>\n )}\n </div>\n );\n};\n\nexport const Preview = Object.assign(PreviewComponent, {\n Code: PreviewCode,\n Confirmation: PreviewConfirmation,\n Header: PreviewHeader,\n});\n"]}
|
|
1
|
+
{"version":3,"file":"Preview.js","sourceRoot":"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MF,MAAM,cAAc,GAAG,CAAC,EAOkB,EAAE,EAAE;QAPtB,EACtB,QAAQ,EACR,GAAG,EACH,KAAK,EACL,SAAS,EACT,cAAc,OAE0B,EADrC,SAAS,cANU,2DAOvB,CADa;IAEZ,OAAO,CACL,8CACE,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,IAAA,oBAAU,EAAC,wBAAwB,EAAE,SAAS,CAAC,IACtD,SAAS,EACT,cAAc,cAEjB,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;IACrD,IAAI,EAAE,WAAW;IACjB,YAAY,EAAE,mBAAmB;IACjC,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,aAAa;CACtB,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n ClipboardButton,\n type CodeBlock,\n LoadingSpinner,\n StatusLabel,\n Typography,\n useNeedleTheme,\n} from '@neo4j-ndl/react';\nimport { CheckIconOutline, XMarkIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport { useEffect, useState } from 'react';\nimport { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter';\n\nimport { type CommonProps } from '../../_common/types';\nimport {\n type LanguageProp,\n Languages,\n loadLanguage,\n} from '../../code-block/code-languages';\nimport ndlCodeDark from '../../code-block/themes/ndl-code-dark';\nimport ndlCodeLight from '../../code-block/themes/ndl-code-light';\n\ntype PreviewProps = {\n children: React.ReactNode;\n};\n\n/**\n * Component to use for previewing certain content in AI chat applications.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst PreviewComponent = ({\n children,\n ref,\n style,\n className,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', PreviewProps>) => {\n return (\n <div\n ref={ref}\n style={style}\n className={classNames('ndl-ai-preview', className)}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\ntype PreviewHeaderProps = {\n children?: React.ReactNode;\n actions?: React.ReactNode;\n};\n\nconst PreviewHeader = ({\n children,\n actions,\n ref,\n style,\n className,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', PreviewHeaderProps>) => {\n return (\n <div\n ref={ref}\n style={style}\n className={classNames('ndl-ai-preview-header', className)}\n {...restProps}\n {...htmlAttributes}\n >\n <Typography\n variant=\"code\"\n as=\"div\"\n className=\"ndl-ai-preview-header-leading-content\"\n >\n {children}\n </Typography>\n\n {actions && (\n <div className=\"ndl-ai-preview-header-actions\">{actions}</div>\n )}\n </div>\n );\n};\n\ntype PreviewConfirmationProps = {\n /** The content to display in the confirmation */\n children?: React.ReactNode;\n /** The actions to display in the confirmation, usually two buttons; one for confirming and one for rejecting. */\n actions: React.ReactNode;\n /** Whether the confirmation is used as a footer */\n isFooter?: boolean;\n /** The status of the confirmation */\n status?: 'pending' | 'confirmed' | 'rejected';\n /** The text to display for the confirmed status */\n confirmedActionText?: string;\n /** The text to display for the rejected status */\n rejectedActionText?: string;\n};\n\nconst PreviewConfirmation = ({\n children,\n actions,\n isFooter = false,\n status = 'pending',\n confirmedActionText = 'Action confirmed',\n rejectedActionText = 'Action rejected',\n ref,\n style,\n className,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', PreviewConfirmationProps>) => {\n const classes = classNames('ndl-ai-preview-confirmation', className, {\n 'ndl-ai-preview-confirmation-footer': isFooter,\n });\n\n return (\n <div\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {!(isFooter && status !== 'pending') && (\n <Typography\n as=\"div\"\n variant={isFooter ? 'subheading-small' : 'body-medium'}\n className=\"ndl-ai-preview-confirmation-content\"\n >\n {children}\n </Typography>\n )}\n <Typography\n variant=\"body-medium\"\n as=\"div\"\n className=\"ndl-ai-preview-confirmation-actions\"\n >\n {status === 'pending' && actions}\n {status === 'confirmed' && (\n <div className=\"ndl-ai-preview-confirmation-confirm-reject\">\n <CheckIconOutline className=\"ndl-ai-preview-confirmation-action-icon\" />\n {confirmedActionText}\n </div>\n )}\n {status === 'rejected' && (\n <div className=\"ndl-ai-preview-confirmation-confirm-reject\">\n <XMarkIconOutline className=\"ndl-ai-preview-confirmation-action-icon\" />\n {rejectedActionText}\n </div>\n )}\n </Typography>\n </div>\n );\n};\n\ntype PreviewCodeProps = {\n /** The code content to display */\n code: string;\n /** The language of the code (e.g., 'cypher', 'python', 'javascript') */\n language: React.ComponentProps<typeof CodeBlock>['language'];\n /** The current state of the code block */\n label?: 'read' | 'write';\n /** Whether the code block is loading */\n isLoading?: boolean;\n /** The actions to display in the header. Should be small buttons or icon buttons only. */\n headerActions?: React.ReactNode;\n /** The theme of the code block */\n theme?: 'ndl-code-dark' | 'ndl-code-light';\n};\n\nconst PreviewCode = ({\n code,\n language,\n label,\n isLoading = false,\n headerActions,\n theme,\n ref,\n style,\n className,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', PreviewCodeProps>) => {\n const [loadedLanguage, setLoadedLanguage] = useState<\n PreviewCodeProps['language'] | null\n >(null);\n const { theme: ndlTheme } = useNeedleTheme();\n\n useEffect(() => {\n if (!language || !(Languages as readonly string[]).includes(language)) {\n setLoadedLanguage('text');\n return;\n }\n\n loadLanguage(language as LanguageProp)\n .then((module) => {\n SyntaxHighlighter.registerLanguage(language, module.default);\n setLoadedLanguage(language);\n })\n .catch((err) => console.error(err));\n }, [language]);\n\n const getTheme = () => {\n switch (theme) {\n case 'ndl-code-dark':\n return ndlCodeDark;\n case 'ndl-code-light':\n return ndlCodeLight;\n default:\n return ndlTheme === 'light' ? ndlCodeLight : ndlCodeDark;\n }\n };\n\n return (\n <div\n ref={ref}\n style={style}\n className={classNames('ndl-ai-preview-code', className)}\n {...restProps}\n {...htmlAttributes}\n >\n {isLoading && (\n <div className=\"ndl-ai-preview-code-loading\">\n <LoadingSpinner size=\"medium\" />\n <Typography variant=\"code\">\n WRITING {language.toUpperCase()}\n </Typography>\n </div>\n )}\n {!isLoading && (\n <>\n <PreviewHeader\n className=\"ndl-ai-preview-code-header\"\n actions={\n <>\n <ClipboardButton\n textToCopy={code}\n type=\"clean-icon-button\"\n size=\"small\"\n />\n {headerActions}\n </>\n }\n >\n {language} {language.toLowerCase() === 'cypher' ? 'QUERY' : ''}\n {label && (\n <StatusLabel\n variant={label === 'write' ? 'warning' : 'info'}\n size=\"small\"\n fill=\"semi-filled\"\n >\n {label.toUpperCase()}\n </StatusLabel>\n )}\n </PreviewHeader>\n <div className=\"ndl-ai-preview-code-content\">\n <SyntaxHighlighter\n language={loadedLanguage ?? 'text'}\n style={{\n ...getTheme(),\n 'pre[class*=\"language-\"]': {\n border: 0,\n color: 'var(--theme-color-neutral-text-default)',\n lineHeight: '1',\n overflowX: 'auto',\n padding: 'var(--space-12)',\n width: 'fit-content',\n },\n }}\n // Turn on 'shouldShowLineNumbers' & 'wrapLongLines' at the same time, the display is wrong\n // https://github.com/react-syntax-highlighter/react-syntax-highlighter/issues/402\n // wrapLongLines\n codeTagProps={{ className: 'n-ai-preview-code' }}\n showLineNumbers={false}\n >\n {code}\n </SyntaxHighlighter>\n </div>\n </>\n )}\n </div>\n );\n};\n\ntype PreviewContentProps = {\n children?: React.ReactNode;\n};\n\nconst PreviewContent = ({\n children,\n ref,\n style,\n className,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', PreviewContentProps>) => {\n return (\n <div\n ref={ref}\n style={style}\n className={classNames('ndl-ai-preview-content', className)}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\nexport const Preview = Object.assign(PreviewComponent, {\n Code: PreviewCode,\n Confirmation: PreviewConfirmation,\n Content: PreviewContent,\n Header: PreviewHeader,\n});\n"]}
|
|
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.PreviewCodeLanguagesSrc = exports.PreviewCodeWriteSrc = exports.PreviewCodeReadSrc = exports.PreviewCodeLoadingSrc = exports.PreviewCodeConfirmationSrc = exports.PreviewConfirmationStandaloneSrc = exports.PreviewDataGridSrc = exports.PreviewCodeLanguages = exports.PreviewCodeWrite = exports.PreviewCodeRead = exports.PreviewCodeLoading = exports.PreviewCodeConfirmation = exports.PreviewConfirmationStandalone = exports.PreviewDataGrid = void 0;
|
|
26
|
+
exports.PreviewSimpleWithContentSrc = exports.PreviewSimpleSrc = exports.PreviewCodeLanguagesSrc = exports.PreviewCodeWriteSrc = exports.PreviewCodeReadSrc = exports.PreviewCodeLoadingSrc = exports.PreviewCodeConfirmationSrc = exports.PreviewConfirmationStandaloneSrc = exports.PreviewDataGridSrc = exports.PreviewSimpleWithContent = exports.PreviewSimple = exports.PreviewCodeLanguages = exports.PreviewCodeWrite = exports.PreviewCodeRead = exports.PreviewCodeLoading = exports.PreviewCodeConfirmation = exports.PreviewConfirmationStandalone = exports.PreviewDataGrid = void 0;
|
|
27
27
|
var preview_data_grid_story_1 = require("./preview-data-grid.story");
|
|
28
28
|
Object.defineProperty(exports, "PreviewDataGrid", { enumerable: true, get: function () { return __importDefault(preview_data_grid_story_1).default; } });
|
|
29
29
|
var preview_confirmation_standalone_story_1 = require("./preview-confirmation-standalone.story");
|
|
@@ -38,6 +38,10 @@ var preview_code_write_story_1 = require("./preview-code-write.story");
|
|
|
38
38
|
Object.defineProperty(exports, "PreviewCodeWrite", { enumerable: true, get: function () { return __importDefault(preview_code_write_story_1).default; } });
|
|
39
39
|
var preview_code_languages_story_1 = require("./preview-code-languages.story");
|
|
40
40
|
Object.defineProperty(exports, "PreviewCodeLanguages", { enumerable: true, get: function () { return __importDefault(preview_code_languages_story_1).default; } });
|
|
41
|
+
var preview_simple_story_1 = require("./preview-simple.story");
|
|
42
|
+
Object.defineProperty(exports, "PreviewSimple", { enumerable: true, get: function () { return __importDefault(preview_simple_story_1).default; } });
|
|
43
|
+
var preview_simple_with_content_story_1 = require("./preview-simple-with-content.story");
|
|
44
|
+
Object.defineProperty(exports, "PreviewSimpleWithContent", { enumerable: true, get: function () { return __importDefault(preview_simple_with_content_story_1).default; } });
|
|
41
45
|
const export_stories_utils_1 = require("../../../_common/export-stories-utils");
|
|
42
46
|
const preview_code_confirmation_story_raw_1 = __importDefault(require("./preview-code-confirmation.story?raw"));
|
|
43
47
|
const preview_code_languages_story_raw_1 = __importDefault(require("./preview-code-languages.story?raw"));
|
|
@@ -46,6 +50,8 @@ const preview_code_read_story_raw_1 = __importDefault(require("./preview-code-re
|
|
|
46
50
|
const preview_code_write_story_raw_1 = __importDefault(require("./preview-code-write.story?raw"));
|
|
47
51
|
const preview_confirmation_standalone_story_raw_1 = __importDefault(require("./preview-confirmation-standalone.story?raw"));
|
|
48
52
|
const preview_data_grid_story_raw_1 = __importDefault(require("./preview-data-grid.story?raw"));
|
|
53
|
+
const preview_simple_story_raw_1 = __importDefault(require("./preview-simple.story?raw"));
|
|
54
|
+
const preview_simple_with_content_story_raw_1 = __importDefault(require("./preview-simple-with-content.story?raw"));
|
|
49
55
|
exports.PreviewDataGridSrc = (0, export_stories_utils_1.removeLicenseHeader)(preview_data_grid_story_raw_1.default);
|
|
50
56
|
exports.PreviewConfirmationStandaloneSrc = (0, export_stories_utils_1.removeLicenseHeader)(preview_confirmation_standalone_story_raw_1.default);
|
|
51
57
|
exports.PreviewCodeConfirmationSrc = (0, export_stories_utils_1.removeLicenseHeader)(preview_code_confirmation_story_raw_1.default);
|
|
@@ -53,4 +59,6 @@ exports.PreviewCodeLoadingSrc = (0, export_stories_utils_1.removeLicenseHeader)(
|
|
|
53
59
|
exports.PreviewCodeReadSrc = (0, export_stories_utils_1.removeLicenseHeader)(preview_code_read_story_raw_1.default);
|
|
54
60
|
exports.PreviewCodeWriteSrc = (0, export_stories_utils_1.removeLicenseHeader)(preview_code_write_story_raw_1.default);
|
|
55
61
|
exports.PreviewCodeLanguagesSrc = (0, export_stories_utils_1.removeLicenseHeader)(preview_code_languages_story_raw_1.default);
|
|
62
|
+
exports.PreviewSimpleSrc = (0, export_stories_utils_1.removeLicenseHeader)(preview_simple_story_raw_1.default);
|
|
63
|
+
exports.PreviewSimpleWithContentSrc = (0, export_stories_utils_1.removeLicenseHeader)(preview_simple_with_content_story_raw_1.default);
|
|
56
64
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/preview/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,qEAAuE;AAA9D,2IAAA,OAAO,OAAmB;AACnC,iGAAmG;AAA1F,uKAAA,OAAO,OAAiC;AACjD,qFAAuF;AAA9E,2JAAA,OAAO,OAA2B;AAC3C,2EAA6E;AAApE,iJAAA,OAAO,OAAsB;AACtC,qEAAuE;AAA9D,2IAAA,OAAO,OAAmB;AACnC,uEAAyE;AAAhE,6IAAA,OAAO,OAAoB;AACpC,+EAAiF;AAAxE,qJAAA,OAAO,OAAwB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/preview/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,qEAAuE;AAA9D,2IAAA,OAAO,OAAmB;AACnC,iGAAmG;AAA1F,uKAAA,OAAO,OAAiC;AACjD,qFAAuF;AAA9E,2JAAA,OAAO,OAA2B;AAC3C,2EAA6E;AAApE,iJAAA,OAAO,OAAsB;AACtC,qEAAuE;AAA9D,2IAAA,OAAO,OAAmB;AACnC,uEAAyE;AAAhE,6IAAA,OAAO,OAAoB;AACpC,+EAAiF;AAAxE,qJAAA,OAAO,OAAwB;AACxC,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AACjC,yFAA0F;AAAjF,8JAAA,OAAO,OAA4B;AAE5C,gFAA4E;AAC5E,gHAAkF;AAClF,0GAA4E;AAC5E,sGAAwE;AACxE,gGAAkE;AAClE,kGAAoE;AACpE,4HAA8F;AAC9F,gGAAkE;AAClE,0FAA6D;AAC7D,oHAAqF;AAExE,QAAA,kBAAkB,GAAG,IAAA,0CAAmB,EAAC,qCAAqB,CAAC,CAAC;AAChE,QAAA,gCAAgC,GAAG,IAAA,0CAAmB,EACjE,mDAAmC,CACpC,CAAC;AACW,QAAA,0BAA0B,GAAG,IAAA,0CAAmB,EAC3D,6CAA6B,CAC9B,CAAC;AACW,QAAA,qBAAqB,GAAG,IAAA,0CAAmB,EACtD,wCAAwB,CACzB,CAAC;AACW,QAAA,kBAAkB,GAAG,IAAA,0CAAmB,EAAC,qCAAqB,CAAC,CAAC;AAChE,QAAA,mBAAmB,GAAG,IAAA,0CAAmB,EAAC,sCAAsB,CAAC,CAAC;AAClE,QAAA,uBAAuB,GAAG,IAAA,0CAAmB,EACxD,0CAA0B,CAC3B,CAAC;AACW,QAAA,gBAAgB,GAAG,IAAA,0CAAmB,EAAC,kCAAmB,CAAC,CAAC;AAC5D,QAAA,2BAA2B,GAAG,IAAA,0CAAmB,EAC5D,+CAA8B,CAC/B,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as PreviewDataGrid } from './preview-data-grid.story';\nexport { default as PreviewConfirmationStandalone } from './preview-confirmation-standalone.story';\nexport { default as PreviewCodeConfirmation } from './preview-code-confirmation.story';\nexport { default as PreviewCodeLoading } from './preview-code-loading.story';\nexport { default as PreviewCodeRead } from './preview-code-read.story';\nexport { default as PreviewCodeWrite } from './preview-code-write.story';\nexport { default as PreviewCodeLanguages } from './preview-code-languages.story';\nexport { default as PreviewSimple } from './preview-simple.story';\nexport { default as PreviewSimpleWithContent } from './preview-simple-with-content.story';\n\nimport { removeLicenseHeader } from '../../../_common/export-stories-utils';\nimport PreviewCodeConfirmationSrcRaw from './preview-code-confirmation.story?raw';\nimport PreviewCodeLanguagesSrcRaw from './preview-code-languages.story?raw';\nimport PreviewCodeLoadingSrcRaw from './preview-code-loading.story?raw';\nimport PreviewCodeReadSrcRaw from './preview-code-read.story?raw';\nimport PreviewCodeWriteSrcRaw from './preview-code-write.story?raw';\nimport PreviewConfirmationStandaloneSrcRaw from './preview-confirmation-standalone.story?raw';\nimport PreviewDataGridSrcRaw from './preview-data-grid.story?raw';\nimport PreviewSimpleSrcRaw from './preview-simple.story?raw';\nimport PreviewSimpleWithContentSrcRaw from './preview-simple-with-content.story?raw';\n\nexport const PreviewDataGridSrc = removeLicenseHeader(PreviewDataGridSrcRaw);\nexport const PreviewConfirmationStandaloneSrc = removeLicenseHeader(\n PreviewConfirmationStandaloneSrcRaw,\n);\nexport const PreviewCodeConfirmationSrc = removeLicenseHeader(\n PreviewCodeConfirmationSrcRaw,\n);\nexport const PreviewCodeLoadingSrc = removeLicenseHeader(\n PreviewCodeLoadingSrcRaw,\n);\nexport const PreviewCodeReadSrc = removeLicenseHeader(PreviewCodeReadSrcRaw);\nexport const PreviewCodeWriteSrc = removeLicenseHeader(PreviewCodeWriteSrcRaw);\nexport const PreviewCodeLanguagesSrc = removeLicenseHeader(\n PreviewCodeLanguagesSrcRaw,\n);\nexport const PreviewSimpleSrc = removeLicenseHeader(PreviewSimpleSrcRaw);\nexport const PreviewSimpleWithContentSrc = removeLicenseHeader(\n PreviewSimpleWithContentSrcRaw,\n);\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) "Neo4j"
|
|
7
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
8
|
+
*
|
|
9
|
+
* This file is part of Neo4j.
|
|
10
|
+
*
|
|
11
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
12
|
+
* it under the terms of the GNU General Public License as published by
|
|
13
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
14
|
+
* (at your option) any later version.
|
|
15
|
+
*
|
|
16
|
+
* This program is distributed in the hope that it will be useful,
|
|
17
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
+
* GNU General Public License for more details.
|
|
20
|
+
*
|
|
21
|
+
* You should have received a copy of the GNU General Public License
|
|
22
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
+
*/
|
|
24
|
+
require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
|
|
25
|
+
const react_1 = require("@neo4j-ndl/react");
|
|
26
|
+
const ai_1 = require("@neo4j-ndl/react/ai");
|
|
27
|
+
const icons_1 = require("@neo4j-ndl/react/icons");
|
|
28
|
+
const react_2 = require("react");
|
|
29
|
+
const Component = () => {
|
|
30
|
+
const [status, setStatus] = (0, react_2.useState)('pending');
|
|
31
|
+
return ((0, jsx_runtime_1.jsxs)(ai_1.Preview, { children: [(0, jsx_runtime_1.jsx)(ai_1.Preview.Header, { children: "CONNECT TO INSTANCE" }), (0, jsx_runtime_1.jsx)(ai_1.Preview.Content, { children: (0, jsx_runtime_1.jsx)(react_1.ReadOnlyTag, { size: "small", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DeploymentsIcon, {}), children: "Instance 1" }) }), (0, jsx_runtime_1.jsx)(ai_1.Preview.Confirmation, { status: status, isFooter: true, confirmedActionText: "Allowed action", rejectedActionText: "Skipped action", actions: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.OutlinedButton, { variant: "neutral", size: "small", onClick: () => setStatus('rejected'), children: "Skip" }), (0, jsx_runtime_1.jsx)(react_1.FilledButton, { variant: "primary", size: "small", onClick: () => setStatus('confirmed'), children: "Allow" })] }) })] }));
|
|
32
|
+
};
|
|
33
|
+
exports.default = Component;
|
|
34
|
+
//# sourceMappingURL=preview-simple-with-content.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-simple-with-content.story.js","sourceRoot":"","sources":["../../../../../src/ai/preview/stories/preview-simple-with-content.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAA6E;AAC7E,4CAA8C;AAC9C,kDAAyD;AACzD,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACvB,IAAA,gBAAQ,EACN,SAAS,CACV,CAAC;IAEJ,OAAO,CACL,wBAAC,YAAO,eACN,uBAAC,YAAO,CAAC,MAAM,sCAAqC,EACpD,uBAAC,YAAO,CAAC,OAAO,cACd,uBAAC,mBAAW,IAAC,IAAI,EAAC,OAAO,EAAC,aAAa,EAAE,uBAAC,uBAAe,KAAG,2BAE9C,GACE,EAClB,uBAAC,YAAO,CAAC,YAAY,IACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,IAAI,EACd,mBAAmB,EAAC,gBAAgB,EACpC,kBAAkB,EAAC,gBAAgB,EACnC,OAAO,EACL,6DACE,uBAAC,sBAAc,IACb,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,qBAGrB,EACjB,uBAAC,oBAAY,IACX,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,sBAGxB,IACd,GAEiB,IAChB,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { FilledButton, OutlinedButton, ReadOnlyTag } from '@neo4j-ndl/react';\nimport { Preview } from '@neo4j-ndl/react/ai';\nimport { DeploymentsIcon } from '@neo4j-ndl/react/icons';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [status, setStatus] =\n useState<React.ComponentProps<typeof Preview.Confirmation>['status']>(\n 'pending',\n );\n\n return (\n <Preview>\n <Preview.Header>CONNECT TO INSTANCE</Preview.Header>\n <Preview.Content>\n <ReadOnlyTag size=\"small\" leadingVisual={<DeploymentsIcon />}>\n Instance 1\n </ReadOnlyTag>\n </Preview.Content>\n <Preview.Confirmation\n status={status}\n isFooter={true}\n confirmedActionText=\"Allowed action\"\n rejectedActionText=\"Skipped action\"\n actions={\n <>\n <OutlinedButton\n variant=\"neutral\"\n size=\"small\"\n onClick={() => setStatus('rejected')}\n >\n Skip\n </OutlinedButton>\n <FilledButton\n variant=\"primary\"\n size=\"small\"\n onClick={() => setStatus('confirmed')}\n >\n Allow\n </FilledButton>\n </>\n }\n ></Preview.Confirmation>\n </Preview>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) "Neo4j"
|
|
7
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
8
|
+
*
|
|
9
|
+
* This file is part of Neo4j.
|
|
10
|
+
*
|
|
11
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
12
|
+
* it under the terms of the GNU General Public License as published by
|
|
13
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
14
|
+
* (at your option) any later version.
|
|
15
|
+
*
|
|
16
|
+
* This program is distributed in the hope that it will be useful,
|
|
17
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
+
* GNU General Public License for more details.
|
|
20
|
+
*
|
|
21
|
+
* You should have received a copy of the GNU General Public License
|
|
22
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
+
*/
|
|
24
|
+
require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
|
|
25
|
+
const react_1 = require("@neo4j-ndl/react");
|
|
26
|
+
const ai_1 = require("@neo4j-ndl/react/ai");
|
|
27
|
+
const react_2 = require("react");
|
|
28
|
+
const Component = () => {
|
|
29
|
+
const [status, setStatus] = (0, react_2.useState)('pending');
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)(ai_1.Preview, { children: [(0, jsx_runtime_1.jsx)(ai_1.Preview.Header, { children: "CONNECT TO INSTANCE" }), (0, jsx_runtime_1.jsx)(ai_1.Preview.Confirmation, { status: status, isFooter: true, confirmedActionText: "Instance selected", rejectedActionText: "Skipped", actions: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.OutlinedButton, { variant: "neutral", size: "small", onClick: () => setStatus('rejected'), children: "Skip" }), (0, jsx_runtime_1.jsx)(react_1.FilledButton, { variant: "primary", size: "small", onClick: () => setStatus('confirmed'), children: "Select instance" })] }) })] }));
|
|
31
|
+
};
|
|
32
|
+
exports.default = Component;
|
|
33
|
+
//# sourceMappingURL=preview-simple.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-simple.story.js","sourceRoot":"","sources":["../../../../../src/ai/preview/stories/preview-simple.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAgE;AAChE,4CAA8C;AAC9C,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACvB,IAAA,gBAAQ,EACN,SAAS,CACV,CAAC;IAEJ,OAAO,CACL,wBAAC,YAAO,eACN,uBAAC,YAAO,CAAC,MAAM,sCAAqC,EACpD,uBAAC,YAAO,CAAC,YAAY,IACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,IAAI,EACd,mBAAmB,EAAC,mBAAmB,EACvC,kBAAkB,EAAC,SAAS,EAC5B,OAAO,EACL,6DACE,uBAAC,sBAAc,IACb,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,qBAGrB,EACjB,uBAAC,oBAAY,IACX,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,gCAGxB,IACd,GAEiB,IAChB,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { FilledButton, OutlinedButton } from '@neo4j-ndl/react';\nimport { Preview } from '@neo4j-ndl/react/ai';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [status, setStatus] =\n useState<React.ComponentProps<typeof Preview.Confirmation>['status']>(\n 'pending',\n );\n\n return (\n <Preview>\n <Preview.Header>CONNECT TO INSTANCE</Preview.Header>\n <Preview.Confirmation\n status={status}\n isFooter={true}\n confirmedActionText=\"Instance selected\"\n rejectedActionText=\"Skipped\"\n actions={\n <>\n <OutlinedButton\n variant=\"neutral\"\n size=\"small\"\n onClick={() => setStatus('rejected')}\n >\n Skip\n </OutlinedButton>\n <FilledButton\n variant=\"primary\"\n size=\"small\"\n onClick={() => setStatus('confirmed')}\n >\n Select instance\n </FilledButton>\n </>\n }\n ></Preview.Confirmation>\n </Preview>\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -48,7 +48,7 @@ const react_2 = require("react");
|
|
|
48
48
|
* @alpha - Changes to this component may be breaking.
|
|
49
49
|
*/
|
|
50
50
|
const PromptComponent = (_a) => {
|
|
51
|
-
var { value, onChange, maxRows = 5, isDisabled = false, isRunningPrompt = false, onSubmitPrompt, onCancelPrompt, isSubmitDisabled = false, topContent, bottomContent, disclaimer = 'All information should be verified.', className, style, htmlAttributes, ref, textareaProps } = _a, restProps = __rest(_a, ["value", "onChange", "maxRows", "isDisabled", "isRunningPrompt", "onSubmitPrompt", "onCancelPrompt", "isSubmitDisabled", "topContent", "bottomContent", "disclaimer", "className", "style", "htmlAttributes", "ref", "textareaProps"]);
|
|
51
|
+
var { value, onChange, maxRows = 5, isDisabled = false, isRunningPrompt = false, onSubmitPrompt, onCancelPrompt, isSubmitDisabled = false, headerContent, topContent, bottomContent, bottomTrailingContent, disclaimer = 'All information should be verified.', className, style, htmlAttributes, ref, textareaProps } = _a, restProps = __rest(_a, ["value", "onChange", "maxRows", "isDisabled", "isRunningPrompt", "onSubmitPrompt", "onCancelPrompt", "isSubmitDisabled", "headerContent", "topContent", "bottomContent", "bottomTrailingContent", "disclaimer", "className", "style", "htmlAttributes", "ref", "textareaProps"]);
|
|
52
52
|
const classes = (0, classnames_1.default)('ndl-ai-prompt', className, {
|
|
53
53
|
'ndl-disabled': isDisabled,
|
|
54
54
|
});
|
|
@@ -127,9 +127,7 @@ const PromptComponent = (_a) => {
|
|
|
127
127
|
adjustTextareaHeight();
|
|
128
128
|
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
129
129
|
};
|
|
130
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-wrapper", children: [(0, jsx_runtime_1.jsx)("div", { className: (0,
|
|
131
|
-
'ndl-expanded': isRunningPrompt,
|
|
132
|
-
}), "aria-hidden": !isRunningPrompt, inert: !isRunningPrompt, children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-loading-shell", children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-loading-content", children: [(0, jsx_runtime_1.jsx)(react_1.LoadingSpinner, { size: "medium" }), (0, jsx_runtime_1.jsxs)(react_1.Typography, { variant: "body-medium", children: ["Working", (0, jsx_runtime_1.jsxs)("span", { className: "ndl-ai-prompt-loading-dots", children: [(0, jsx_runtime_1.jsx)("span", { children: "." }), (0, jsx_runtime_1.jsx)("span", { children: "." }), (0, jsx_runtime_1.jsx)("span", { children: "." })] })] })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-wrapper-inner", children: [Boolean(topContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-textarea-above", ref: textareaAboveRef, children: topContent })), (0, jsx_runtime_1.jsx)("textarea", Object.assign({ placeholder: "Ask anything", className: "ndl-ai-prompt-textarea", rows: 1, onChange: handleInput, value: value, ref: textareaRef, disabled: isDisabled, onKeyDown: (e) => {
|
|
130
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-wrapper", children: [Boolean(headerContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-header", children: headerContent })), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-wrapper-inner", children: [Boolean(topContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-textarea-above", ref: textareaAboveRef, children: topContent })), (0, jsx_runtime_1.jsx)("textarea", Object.assign({ placeholder: "Ask anything", className: "ndl-ai-prompt-textarea", rows: 1, onChange: handleInput, value: value, ref: textareaRef, disabled: isDisabled, onKeyDown: (e) => {
|
|
133
131
|
if (e.key === 'Enter' &&
|
|
134
132
|
!e.shiftKey &&
|
|
135
133
|
isSubmitDisabled !== true) {
|
|
@@ -138,18 +136,10 @@ const PromptComponent = (_a) => {
|
|
|
138
136
|
onSubmitPrompt === null || onSubmitPrompt === void 0 ? void 0 : onSubmitPrompt(e);
|
|
139
137
|
}
|
|
140
138
|
}
|
|
141
|
-
} }, textareaProps)), (0, jsx_runtime_1.
|
|
139
|
+
} }, textareaProps)), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-textarea-below", children: [Boolean(bottomContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-textarea-below-leading", children: bottomContent })), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-textarea-below-trailing", children: [bottomTrailingContent, (0, jsx_runtime_1.jsx)(SubmitPromptButton, { isDisabled: isSubmitDisabled, isRunningPrompt: isRunningPrompt, onSubmit: onSubmitPrompt, onCancel: onCancelPrompt })] })] })] })] }), Boolean(disclaimer) && ((0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-small", className: "ndl-ai-prompt-footer", children: disclaimer }))] })));
|
|
142
140
|
};
|
|
143
141
|
const SubmitPromptButton = ({ onSubmit, onCancel, isDisabled, isRunningPrompt, }) => {
|
|
144
|
-
return ((0, jsx_runtime_1.jsx)(
|
|
145
|
-
'ndl-in-loading': isRunningPrompt,
|
|
146
|
-
}), children: (0, jsx_runtime_1.jsxs)(react_1.Tooltip, { type: "simple", isDisabled: isDisabled || isRunningPrompt, hoverDelay: { close: 0, open: 500 }, shouldCloseOnReferenceClick: true, children: [(0, jsx_runtime_1.jsx)(react_1.Tooltip.Trigger, { hasButtonWrapper: true, children: (0, jsx_runtime_1.jsx)("button", { type: "button", style: {
|
|
147
|
-
borderRadius: isRunningPrompt
|
|
148
|
-
? 'var(--border-radius-sm)'
|
|
149
|
-
: 'var(--border-radius-lg)',
|
|
150
|
-
}, onClick: isRunningPrompt ? onCancel : onSubmit, disabled: isDisabled, "aria-label": isRunningPrompt ? 'Stop' : 'Send', children: isRunningPrompt === true ? ((0, jsx_runtime_1.jsx)(react_1.OutlinedButton, { as: "div", variant: "neutral", className: "ndl-ai-prompt-stop-button", size: "small", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.StopIconOutline, {}), children: "Stop" })) : ((0, jsx_runtime_1.jsx)(react_1.CleanIconButton, { description: "Send", as: "div", className: "ndl-ai-prompt-submit-button", size: "medium", isDisabled: isDisabled, htmlAttributes: {
|
|
151
|
-
'aria-pressed': undefined,
|
|
152
|
-
}, children: (0, jsx_runtime_1.jsx)(icons_1.ArrowSmallUpIconOutline, {}) })) }) }), (0, jsx_runtime_1.jsx)(react_1.Tooltip.Content, { children: "Send" })] }) }));
|
|
142
|
+
return ((0, jsx_runtime_1.jsx)(react_1.CleanIconButton, { className: "ndl-ai-prompt-submit-button", description: isRunningPrompt === true ? 'Stop' : 'Send', size: "small", isDisabled: isDisabled, onClick: isRunningPrompt === true ? onCancel : onSubmit, children: isRunningPrompt === true ? ((0, jsx_runtime_1.jsx)(icons_1.StopCircleIconOutline, {})) : ((0, jsx_runtime_1.jsx)(icons_1.ArrowSmallUpIconOutline, {})) }));
|
|
153
143
|
};
|
|
154
144
|
const AgentSelect = ({ value, options = [], onChange }) => {
|
|
155
145
|
var _a, _b, _c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Prompt.js","sourceRoot":"","sources":["../../../../src/ai/prompt/Prompt.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAQ0B;AAC1B,kDAKgC;AAChC,4DAAoC;AACpC,iCAAiE;AAmCjE;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,CAAC,EAkBS,EAAE,EAAE;QAlBb,EACvB,KAAK,EACL,QAAQ,EACR,OAAO,GAAG,CAAC,EACX,UAAU,GAAG,KAAK,EAClB,eAAe,GAAG,KAAK,EACvB,cAAc,EACd,cAAc,EACd,gBAAgB,GAAG,KAAK,EACxB,UAAU,EACV,aAAa,EACb,UAAU,GAAG,qCAAqC,EAClD,SAAS,EACT,KAAK,EACL,cA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AAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,gBACJ,mBAAmB,QAAQ,EAAE,EACzC,SAAS,EAAC,wCAAwC,YAElD,uBAAC,wBAAgB,IAAC,SAAS,EAAC,gCAAgC,GAAG,GACxD,IACL,GACU,EAClB,uBAAC,eAAO,CAAC,OAAO,cAAE,QAAQ,GAAmB,IACrC,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,UAAU,EAAE,UAAU;IACtB,MAAM,EAAE,WAAW;CACpB,CAAC,CAAC;AAEM,wBAAM","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport {\n CleanIconButton,\n DropdownButton,\n LoadingSpinner,\n Menu,\n OutlinedButton,\n Tooltip,\n Typography,\n} from '@neo4j-ndl/react';\nimport {\n ArrowSendIcon,\n ArrowSmallUpIconOutline,\n StopIconOutline,\n XMarkIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport type { CommonProps, HtmlAttributes } from '../../_common/types';\n\ntype PromptProps = {\n /** The prompt text */\n value?: React.ComponentPropsWithoutRef<'textarea'>['value'];\n /** Callback function called when the prompt text changes */\n onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n /** Maximum number of rows the textarea can expand to */\n maxRows?: number;\n /** Whether the textarea is disabled */\n isDisabled?: boolean;\n /** Whether the submit button is disabled */\n isSubmitDisabled?: boolean;\n /** Whether the submit button is \"running\". Shows a stop icon when true. */\n isRunningPrompt?: boolean;\n /** Callback function called when the submit button is clicked */\n onSubmitPrompt?: (\n e:\n | React.KeyboardEvent<HTMLTextAreaElement>\n | React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => void;\n /** Callback function called when the cancel button is clicked */\n onCancelPrompt?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Content to display above the textarea */\n topContent?: React.ReactNode;\n /** Content to display below the textarea */\n bottomContent?: React.ReactNode;\n /** Disclaimer to display below the component */\n disclaimer?: React.ReactNode;\n /** Props for the textarea element */\n textareaProps?: HtmlAttributes<'textarea'>;\n};\n\n/**\n * The component is used to display the prompt input for an LLM.\n * It includes a textarea for the user to enter their prompt and a submit button.\n * It can also display content above and below the textarea, like uploaded files or a select for changing agents.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst PromptComponent = ({\n value,\n onChange,\n maxRows = 5,\n isDisabled = false,\n isRunningPrompt = false,\n onSubmitPrompt,\n onCancelPrompt,\n isSubmitDisabled = false,\n topContent,\n bottomContent,\n disclaimer = 'All information should be verified.',\n className,\n style,\n htmlAttributes,\n ref,\n textareaProps,\n ...restProps\n}: CommonProps<'div', PromptProps>) => {\n const classes = classNames('ndl-ai-prompt', className, {\n 'ndl-disabled': isDisabled,\n });\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const textareaAboveRef = useRef<HTMLDivElement>(null);\n const [lineHeight, setLineHeight] = useState(0);\n\n /** File overflow stuff */\n useEffect(() => {\n let rafId: number | null = null;\n\n const checkOverflow = () => {\n if (textareaAboveRef.current !== null) {\n const element = textareaAboveRef.current;\n const maxHeight = parseFloat(\n getComputedStyle(element).maxHeight.replace('px', ''),\n );\n const scrollHeight = element.scrollHeight;\n\n if (scrollHeight > maxHeight) {\n element.classList.add('ndl-can-scroll');\n } else {\n element.classList.remove('ndl-can-scroll');\n }\n }\n };\n\n const debouncedCheck = () => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId);\n }\n rafId = requestAnimationFrame(checkOverflow);\n };\n\n // Initial check\n checkOverflow();\n\n const resizeObserver = new ResizeObserver(debouncedCheck);\n const mutationObserver = new MutationObserver(debouncedCheck);\n\n if (textareaAboveRef.current !== null) {\n resizeObserver.observe(textareaAboveRef.current);\n mutationObserver.observe(textareaAboveRef.current, {\n childList: true,\n subtree: true,\n });\n }\n\n return () => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId);\n }\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n }, []);\n\n /** Textarea stuff */\n useEffect(() => {\n if (textareaRef.current !== null) {\n const computed = window.getComputedStyle(textareaRef.current);\n setLineHeight(parseInt(computed.lineHeight));\n }\n }, []);\n\n const adjustTextareaHeight = useCallback(() => {\n const ta = textareaRef.current;\n\n if (ta !== null && lineHeight > 0) {\n // Reset height so scrollHeight measures correctly\n ta.style.height = 'auto';\n\n const maxHeight = lineHeight * maxRows;\n\n if (ta.scrollHeight <= maxHeight) {\n ta.style.overflowY = 'hidden';\n ta.style.height = `${ta.scrollHeight + 12}px`;\n } else {\n ta.style.overflowY = 'auto';\n ta.style.height = `${maxHeight + 12}px`;\n }\n }\n }, [lineHeight, maxRows]);\n\n // Adjust height when prompt value changes (including when cleared)\n useEffect(() => {\n adjustTextareaHeight();\n }, [value, adjustTextareaHeight]);\n\n const handleInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n adjustTextareaHeight();\n onChange?.(e);\n };\n\n return (\n <div\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-ai-prompt-wrapper\">\n <div\n className={classNames('ndl-ai-prompt-loading-container', {\n 'ndl-expanded': isRunningPrompt,\n })}\n aria-hidden={!isRunningPrompt}\n inert={!isRunningPrompt}\n >\n <div className=\"ndl-ai-prompt-loading-shell\">\n <div className=\"ndl-ai-prompt-loading-content\">\n <LoadingSpinner size=\"medium\" />\n <Typography variant=\"body-medium\">\n Working\n <span className=\"ndl-ai-prompt-loading-dots\">\n <span>.</span>\n <span>.</span>\n <span>.</span>\n </span>\n </Typography>\n </div>\n </div>\n </div>\n <div className=\"ndl-ai-prompt-wrapper-inner\">\n {Boolean(topContent) && (\n <div\n className=\"ndl-ai-prompt-textarea-above\"\n ref={textareaAboveRef}\n >\n {topContent}\n </div>\n )}\n <textarea\n placeholder=\"Ask anything\"\n className=\"ndl-ai-prompt-textarea\"\n rows={1}\n onChange={handleInput}\n value={value}\n ref={textareaRef}\n disabled={isDisabled}\n onKeyDown={(e) => {\n if (\n e.key === 'Enter' &&\n !e.shiftKey &&\n isSubmitDisabled !== true\n ) {\n e.preventDefault();\n\n if (isRunningPrompt !== true) {\n onSubmitPrompt?.(e);\n }\n }\n }}\n {...textareaProps}\n />\n <div className=\"ndl-ai-prompt-textarea-below\">\n {Boolean(bottomContent) && (\n <div className=\"ndl-ai-prompt-textarea-below-leading\">\n {bottomContent}\n </div>\n )}\n </div>\n </div>\n <SubmitPromptButton\n isDisabled={isSubmitDisabled}\n isRunningPrompt={isRunningPrompt}\n onSubmit={onSubmitPrompt}\n onCancel={onCancelPrompt}\n />\n </div>\n {Boolean(disclaimer) && (\n <Typography variant=\"body-small\" className=\"ndl-ai-prompt-footer\">\n {disclaimer}\n </Typography>\n )}\n </div>\n );\n};\n\nconst SubmitPromptButton = ({\n onSubmit,\n onCancel,\n isDisabled,\n isRunningPrompt,\n}: {\n isDisabled?: boolean;\n isRunningPrompt?: boolean;\n onSubmit?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n onCancel?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n}) => {\n return (\n <div\n className={classNames('ndl-ai-prompt-button-container', {\n 'ndl-in-loading': isRunningPrompt,\n })}\n >\n <Tooltip\n type=\"simple\"\n isDisabled={isDisabled || isRunningPrompt}\n hoverDelay={{ close: 0, open: 500 }}\n shouldCloseOnReferenceClick={true}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <button\n type=\"button\"\n style={{\n borderRadius: isRunningPrompt\n ? 'var(--border-radius-sm)'\n : 'var(--border-radius-lg)',\n }}\n onClick={isRunningPrompt ? onCancel : onSubmit}\n disabled={isDisabled}\n aria-label={isRunningPrompt ? 'Stop' : 'Send'}\n >\n {isRunningPrompt === true ? (\n <OutlinedButton\n as=\"div\"\n variant=\"neutral\"\n className=\"ndl-ai-prompt-stop-button\"\n size=\"small\"\n leadingVisual={<StopIconOutline />}\n >\n Stop\n </OutlinedButton>\n ) : (\n <CleanIconButton\n description=\"Send\"\n as=\"div\"\n className=\"ndl-ai-prompt-submit-button\"\n size=\"medium\"\n isDisabled={isDisabled}\n htmlAttributes={{\n 'aria-pressed': undefined,\n }}\n >\n <ArrowSmallUpIconOutline />\n </CleanIconButton>\n )}\n </button>\n </Tooltip.Trigger>\n <Tooltip.Content>Send</Tooltip.Content>\n </Tooltip>\n </div>\n );\n};\n\ntype AgentSelectProps = {\n value: { label: React.ReactNode; value: string };\n options: Array<{ label: React.ReactNode; value: string }>;\n onChange: (option: { label: React.ReactNode; value: string }) => void;\n};\n\nconst AgentSelect = ({ value, options = [], onChange }: AgentSelectProps) => {\n const anchorRef = useRef<HTMLButtonElement>(null);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n\n const displayLabel = value?.label ?? options[0]?.label ?? '';\n\n const handleItemClick = (option: {\n label: React.ReactNode;\n value: string;\n }) => {\n onChange?.(option);\n setIsMenuOpen(false);\n };\n\n return (\n <>\n <DropdownButton\n size=\"small\"\n className=\"ndl-ai-prompt-dropdown-button\"\n onClick={() => setIsMenuOpen((old) => !old)}\n isOpen={isMenuOpen}\n ref={anchorRef}\n >\n {displayLabel}\n </DropdownButton>\n <Menu\n isOpen={isMenuOpen}\n onClose={() => setIsMenuOpen(false)}\n anchorRef={anchorRef}\n placement=\"top-start-bottom-start\"\n >\n {options.map((option) => (\n <Menu.RadioItem\n key={option.value}\n title={option.label}\n isChecked={value?.value === option.value}\n onClick={() => handleItemClick(option)}\n />\n ))}\n </Menu>\n </>\n );\n};\n\ntype ContextTagProps = {\n children?: string;\n onClose: () => void;\n};\n\nconst ContextTag = ({ children, onClose }: ContextTagProps) => {\n const textRef = useRef<HTMLSpanElement>(null);\n const [isTooltipOpen, setIsTooltipOpen] = useState(false);\n\n return (\n <Tooltip\n type=\"simple\"\n isOpen={isTooltipOpen}\n onOpenChange={(isOpen) => {\n if (isOpen) {\n const isTruncated =\n textRef.current?.scrollWidth &&\n textRef.current?.clientWidth &&\n textRef.current.scrollWidth > textRef.current.clientWidth;\n if (isTruncated) {\n setIsTooltipOpen(true);\n }\n } else {\n setIsTooltipOpen(false);\n }\n }}\n hoverDelay={{ close: 0, open: 500 }}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <div className=\"ndl-ai-prompt-context-tag\">\n <ArrowSendIcon className=\"ndl-ai-prompt-context-tag-icon\" />\n <Typography\n variant=\"body-medium\"\n className=\"ndl-ai-prompt-context-tag-text\"\n ref={textRef}\n >\n {children}\n </Typography>\n\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={`Remove context: ${children}`}\n className=\"ndl-ai-prompt-context-tag-close-button\"\n >\n <XMarkIconOutline className=\"ndl-ai-prompt-context-tag-icon\" />\n </button>\n </div>\n </Tooltip.Trigger>\n <Tooltip.Content>{children}</Tooltip.Content>\n </Tooltip>\n );\n};\n\nconst Prompt = Object.assign(PromptComponent, {\n ContextTag: ContextTag,\n Select: AgentSelect,\n});\n\nexport { Prompt };\n"]}
|
|
1
|
+
{"version":3,"file":"Prompt.js","sourceRoot":"","sources":["../../../../src/ai/prompt/Prompt.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAM0B;AAC1B,kDAKgC;AAChC,4DAAoC;AACpC,iCAAiE;AAuCjE;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,CAAC,EAo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AI,WAAW,EAAE,CAAC;oBAChB,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC,EACD,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,aAEnC,uBAAC,eAAO,CAAC,OAAO,IAAC,gBAAgB,kBAC/B,iCAAK,SAAS,EAAC,2BAA2B,aACxC,uBAAC,qBAAa,IAAC,SAAS,EAAC,gCAAgC,GAAG,EAC5D,uBAAC,kBAAU,IACT,OAAO,EAAC,aAAa,EACrB,SAAS,EAAC,gCAAgC,EAC1C,GAAG,EAAE,OAAO,YAEX,QAAQ,GACE,EAEb,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,gBACJ,mBAAmB,QAAQ,EAAE,EACzC,SAAS,EAAC,wCAAwC,YAElD,uBAAC,wBAAgB,IAAC,SAAS,EAAC,gCAAgC,GAAG,GACxD,IACL,GACU,EAClB,uBAAC,eAAO,CAAC,OAAO,cAAE,QAAQ,GAAmB,IACrC,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,UAAU,EAAE,UAAU;IACtB,MAAM,EAAE,WAAW;CACpB,CAAC,CAAC;AAEM,wBAAM","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport {\n CleanIconButton,\n DropdownButton,\n Menu,\n Tooltip,\n Typography,\n} from '@neo4j-ndl/react';\nimport {\n ArrowSendIcon,\n ArrowSmallUpIconOutline,\n StopCircleIconOutline,\n XMarkIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport type { CommonProps, HtmlAttributes } from '../../_common/types';\n\ntype PromptProps = {\n /** The prompt text */\n value?: React.ComponentPropsWithoutRef<'textarea'>['value'];\n /** Callback function called when the prompt text changes */\n onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n /** Maximum number of rows the textarea can expand to */\n maxRows?: number;\n /** Whether the textarea is disabled */\n isDisabled?: boolean;\n /** Whether the submit button is disabled */\n isSubmitDisabled?: boolean;\n /** Whether the submit button is \"running\". Shows a stop icon when true. */\n isRunningPrompt?: boolean;\n /** Callback function called when the submit button is clicked */\n onSubmitPrompt?: (\n e:\n | React.KeyboardEvent<HTMLTextAreaElement>\n | React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => void;\n /** Callback function called when the cancel button is clicked */\n onCancelPrompt?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Content to display above the input card, e.g. a status message while a prompt is running */\n headerContent?: React.ReactNode;\n /** Content to display above the textarea */\n topContent?: React.ReactNode;\n /** Content to display below the textarea, on the leading side */\n bottomContent?: React.ReactNode;\n /** Content to display below the textarea, on the trailing side next to the submit button */\n bottomTrailingContent?: React.ReactNode;\n /** Disclaimer to display below the component */\n disclaimer?: React.ReactNode;\n /** Props for the textarea element */\n textareaProps?: HtmlAttributes<'textarea'>;\n};\n\n/**\n * The component is used to display the prompt input for an LLM.\n * It includes a textarea for the user to enter their prompt and a submit button.\n * It can also display content above and below the textarea, like uploaded files or a select for changing agents.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst PromptComponent = ({\n value,\n onChange,\n maxRows = 5,\n isDisabled = false,\n isRunningPrompt = false,\n onSubmitPrompt,\n onCancelPrompt,\n isSubmitDisabled = false,\n headerContent,\n topContent,\n bottomContent,\n bottomTrailingContent,\n disclaimer = 'All information should be verified.',\n className,\n style,\n htmlAttributes,\n ref,\n textareaProps,\n ...restProps\n}: CommonProps<'div', PromptProps>) => {\n const classes = classNames('ndl-ai-prompt', className, {\n 'ndl-disabled': isDisabled,\n });\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const textareaAboveRef = useRef<HTMLDivElement>(null);\n const [lineHeight, setLineHeight] = useState(0);\n\n /** File overflow stuff */\n useEffect(() => {\n let rafId: number | null = null;\n\n const checkOverflow = () => {\n if (textareaAboveRef.current !== null) {\n const element = textareaAboveRef.current;\n const maxHeight = parseFloat(\n getComputedStyle(element).maxHeight.replace('px', ''),\n );\n const scrollHeight = element.scrollHeight;\n\n if (scrollHeight > maxHeight) {\n element.classList.add('ndl-can-scroll');\n } else {\n element.classList.remove('ndl-can-scroll');\n }\n }\n };\n\n const debouncedCheck = () => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId);\n }\n rafId = requestAnimationFrame(checkOverflow);\n };\n\n // Initial check\n checkOverflow();\n\n const resizeObserver = new ResizeObserver(debouncedCheck);\n const mutationObserver = new MutationObserver(debouncedCheck);\n\n if (textareaAboveRef.current !== null) {\n resizeObserver.observe(textareaAboveRef.current);\n mutationObserver.observe(textareaAboveRef.current, {\n childList: true,\n subtree: true,\n });\n }\n\n return () => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId);\n }\n resizeObserver.disconnect();\n mutationObserver.disconnect();\n };\n }, []);\n\n /** Textarea stuff */\n useEffect(() => {\n if (textareaRef.current !== null) {\n const computed = window.getComputedStyle(textareaRef.current);\n setLineHeight(parseInt(computed.lineHeight));\n }\n }, []);\n\n const adjustTextareaHeight = useCallback(() => {\n const ta = textareaRef.current;\n\n if (ta !== null && lineHeight > 0) {\n // Reset height so scrollHeight measures correctly\n ta.style.height = 'auto';\n\n const maxHeight = lineHeight * maxRows;\n\n if (ta.scrollHeight <= maxHeight) {\n ta.style.overflowY = 'hidden';\n ta.style.height = `${ta.scrollHeight + 12}px`;\n } else {\n ta.style.overflowY = 'auto';\n ta.style.height = `${maxHeight + 12}px`;\n }\n }\n }, [lineHeight, maxRows]);\n\n // Adjust height when prompt value changes (including when cleared)\n useEffect(() => {\n adjustTextareaHeight();\n }, [value, adjustTextareaHeight]);\n\n const handleInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n adjustTextareaHeight();\n onChange?.(e);\n };\n\n return (\n <div\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-ai-prompt-wrapper\">\n {Boolean(headerContent) && (\n <div className=\"ndl-ai-prompt-header\">{headerContent}</div>\n )}\n <div className=\"ndl-ai-prompt-wrapper-inner\">\n {Boolean(topContent) && (\n <div\n className=\"ndl-ai-prompt-textarea-above\"\n ref={textareaAboveRef}\n >\n {topContent}\n </div>\n )}\n <textarea\n placeholder=\"Ask anything\"\n className=\"ndl-ai-prompt-textarea\"\n rows={1}\n onChange={handleInput}\n value={value}\n ref={textareaRef}\n disabled={isDisabled}\n onKeyDown={(e) => {\n if (\n e.key === 'Enter' &&\n !e.shiftKey &&\n isSubmitDisabled !== true\n ) {\n e.preventDefault();\n\n if (isRunningPrompt !== true) {\n onSubmitPrompt?.(e);\n }\n }\n }}\n {...textareaProps}\n />\n <div className=\"ndl-ai-prompt-textarea-below\">\n {Boolean(bottomContent) && (\n <div className=\"ndl-ai-prompt-textarea-below-leading\">\n {bottomContent}\n </div>\n )}\n <div className=\"ndl-ai-prompt-textarea-below-trailing\">\n {bottomTrailingContent}\n <SubmitPromptButton\n isDisabled={isSubmitDisabled}\n isRunningPrompt={isRunningPrompt}\n onSubmit={onSubmitPrompt}\n onCancel={onCancelPrompt}\n />\n </div>\n </div>\n </div>\n </div>\n {Boolean(disclaimer) && (\n <Typography variant=\"body-small\" className=\"ndl-ai-prompt-footer\">\n {disclaimer}\n </Typography>\n )}\n </div>\n );\n};\n\nconst SubmitPromptButton = ({\n onSubmit,\n onCancel,\n isDisabled,\n isRunningPrompt,\n}: {\n isDisabled?: boolean;\n isRunningPrompt?: boolean;\n onSubmit?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n onCancel?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n}) => {\n return (\n <CleanIconButton\n className=\"ndl-ai-prompt-submit-button\"\n description={isRunningPrompt === true ? 'Stop' : 'Send'}\n size=\"small\"\n isDisabled={isDisabled}\n onClick={isRunningPrompt === true ? onCancel : onSubmit}\n >\n {isRunningPrompt === true ? (\n <StopCircleIconOutline />\n ) : (\n <ArrowSmallUpIconOutline />\n )}\n </CleanIconButton>\n );\n};\n\ntype AgentSelectProps = {\n value: { label: React.ReactNode; value: string };\n options: Array<{ label: React.ReactNode; value: string }>;\n onChange: (option: { label: React.ReactNode; value: string }) => void;\n};\n\nconst AgentSelect = ({ value, options = [], onChange }: AgentSelectProps) => {\n const anchorRef = useRef<HTMLButtonElement>(null);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n\n const displayLabel = value?.label ?? options[0]?.label ?? '';\n\n const handleItemClick = (option: {\n label: React.ReactNode;\n value: string;\n }) => {\n onChange?.(option);\n setIsMenuOpen(false);\n };\n\n return (\n <>\n <DropdownButton\n size=\"small\"\n className=\"ndl-ai-prompt-dropdown-button\"\n onClick={() => setIsMenuOpen((old) => !old)}\n isOpen={isMenuOpen}\n ref={anchorRef}\n >\n {displayLabel}\n </DropdownButton>\n <Menu\n isOpen={isMenuOpen}\n onClose={() => setIsMenuOpen(false)}\n anchorRef={anchorRef}\n placement=\"top-start-bottom-start\"\n >\n {options.map((option) => (\n <Menu.RadioItem\n key={option.value}\n title={option.label}\n isChecked={value?.value === option.value}\n onClick={() => handleItemClick(option)}\n />\n ))}\n </Menu>\n </>\n );\n};\n\ntype ContextTagProps = {\n children?: string;\n onClose: () => void;\n};\n\nconst ContextTag = ({ children, onClose }: ContextTagProps) => {\n const textRef = useRef<HTMLSpanElement>(null);\n const [isTooltipOpen, setIsTooltipOpen] = useState(false);\n\n return (\n <Tooltip\n type=\"simple\"\n isOpen={isTooltipOpen}\n onOpenChange={(isOpen) => {\n if (isOpen) {\n const isTruncated =\n textRef.current?.scrollWidth &&\n textRef.current?.clientWidth &&\n textRef.current.scrollWidth > textRef.current.clientWidth;\n if (isTruncated) {\n setIsTooltipOpen(true);\n }\n } else {\n setIsTooltipOpen(false);\n }\n }}\n hoverDelay={{ close: 0, open: 500 }}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <div className=\"ndl-ai-prompt-context-tag\">\n <ArrowSendIcon className=\"ndl-ai-prompt-context-tag-icon\" />\n <Typography\n variant=\"body-medium\"\n className=\"ndl-ai-prompt-context-tag-text\"\n ref={textRef}\n >\n {children}\n </Typography>\n\n <button\n type=\"button\"\n onClick={onClose}\n aria-label={`Remove context: ${children}`}\n className=\"ndl-ai-prompt-context-tag-close-button\"\n >\n <XMarkIconOutline className=\"ndl-ai-prompt-context-tag-icon\" />\n </button>\n </div>\n </Tooltip.Trigger>\n <Tooltip.Content>{children}</Tooltip.Content>\n </Tooltip>\n );\n};\n\nconst Prompt = Object.assign(PromptComponent, {\n ContextTag: ContextTag,\n Select: AgentSelect,\n});\n\nexport { Prompt };\n"]}
|
|
@@ -23,7 +23,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.PromptDisabledSrc = exports.PromptContextSrc = exports.PromptLoadingSrc = exports.PromptAdvancedSrc = exports.PromptDefaultSrc = exports.PromptDisabled = exports.PromptContext = exports.PromptLoading = exports.PromptAdvanced = exports.PromptDefault = void 0;
|
|
26
|
+
exports.PromptHeaderSrc = exports.PromptDisabledSrc = exports.PromptContextSrc = exports.PromptLoadingSrc = exports.PromptAdvancedSrc = exports.PromptDefaultSrc = exports.PromptHeader = exports.PromptDisabled = exports.PromptContext = exports.PromptLoading = exports.PromptAdvanced = exports.PromptDefault = void 0;
|
|
27
27
|
var prompt_default_story_1 = require("./prompt-default.story");
|
|
28
28
|
Object.defineProperty(exports, "PromptDefault", { enumerable: true, get: function () { return __importDefault(prompt_default_story_1).default; } });
|
|
29
29
|
var prompt_advanced_story_1 = require("./prompt-advanced.story");
|
|
@@ -34,15 +34,19 @@ var prompt_context_story_1 = require("./prompt-context.story");
|
|
|
34
34
|
Object.defineProperty(exports, "PromptContext", { enumerable: true, get: function () { return __importDefault(prompt_context_story_1).default; } });
|
|
35
35
|
var prompt_disabled_story_1 = require("./prompt-disabled.story");
|
|
36
36
|
Object.defineProperty(exports, "PromptDisabled", { enumerable: true, get: function () { return __importDefault(prompt_disabled_story_1).default; } });
|
|
37
|
+
var prompt_header_story_1 = require("./prompt-header.story");
|
|
38
|
+
Object.defineProperty(exports, "PromptHeader", { enumerable: true, get: function () { return __importDefault(prompt_header_story_1).default; } });
|
|
37
39
|
const export_stories_utils_1 = require("../../../_common/export-stories-utils");
|
|
38
40
|
const prompt_advanced_story_raw_1 = __importDefault(require("./prompt-advanced.story?raw"));
|
|
39
41
|
const prompt_context_story_raw_1 = __importDefault(require("./prompt-context.story?raw"));
|
|
40
42
|
const prompt_default_story_raw_1 = __importDefault(require("./prompt-default.story?raw"));
|
|
41
43
|
const prompt_disabled_story_raw_1 = __importDefault(require("./prompt-disabled.story?raw"));
|
|
44
|
+
const prompt_header_story_raw_1 = __importDefault(require("./prompt-header.story?raw"));
|
|
42
45
|
const prompt_loading_story_raw_1 = __importDefault(require("./prompt-loading.story?raw"));
|
|
43
46
|
exports.PromptDefaultSrc = (0, export_stories_utils_1.removeLicenseHeader)(prompt_default_story_raw_1.default);
|
|
44
47
|
exports.PromptAdvancedSrc = (0, export_stories_utils_1.removeLicenseHeader)(prompt_advanced_story_raw_1.default);
|
|
45
48
|
exports.PromptLoadingSrc = (0, export_stories_utils_1.removeLicenseHeader)(prompt_loading_story_raw_1.default);
|
|
46
49
|
exports.PromptContextSrc = (0, export_stories_utils_1.removeLicenseHeader)(prompt_context_story_raw_1.default);
|
|
47
50
|
exports.PromptDisabledSrc = (0, export_stories_utils_1.removeLicenseHeader)(prompt_disabled_story_raw_1.default);
|
|
51
|
+
exports.PromptHeaderSrc = (0, export_stories_utils_1.removeLicenseHeader)(prompt_header_story_raw_1.default);
|
|
48
52
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AACjC,iEAAoE;AAA3D,wIAAA,OAAO,OAAkB;AAClC,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AACjC,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AACjC,iEAAoE;AAA3D,wIAAA,OAAO,OAAkB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AACjC,iEAAoE;AAA3D,wIAAA,OAAO,OAAkB;AAClC,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AACjC,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AACjC,iEAAoE;AAA3D,wIAAA,OAAO,OAAkB;AAClC,6DAAgE;AAAvD,oIAAA,OAAO,OAAgB;AAEhC,gFAA4E;AAC5E,4FAA+D;AAC/D,0FAA6D;AAC7D,0FAA6D;AAC7D,4FAA+D;AAC/D,wFAA2D;AAC3D,0FAA6D;AAEhD,QAAA,gBAAgB,GAAG,IAAA,0CAAmB,EAAC,kCAAmB,CAAC,CAAC;AAC5D,QAAA,iBAAiB,GAAG,IAAA,0CAAmB,EAAC,mCAAoB,CAAC,CAAC;AAC9D,QAAA,gBAAgB,GAAG,IAAA,0CAAmB,EAAC,kCAAmB,CAAC,CAAC;AAC5D,QAAA,gBAAgB,GAAG,IAAA,0CAAmB,EAAC,kCAAmB,CAAC,CAAC;AAC5D,QAAA,iBAAiB,GAAG,IAAA,0CAAmB,EAAC,mCAAoB,CAAC,CAAC;AAC9D,QAAA,eAAe,GAAG,IAAA,0CAAmB,EAAC,iCAAkB,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as PromptDefault } from './prompt-default.story';\nexport { default as PromptAdvanced } from './prompt-advanced.story';\nexport { default as PromptLoading } from './prompt-loading.story';\nexport { default as PromptContext } from './prompt-context.story';\nexport { default as PromptDisabled } from './prompt-disabled.story';\nexport { default as PromptHeader } from './prompt-header.story';\n\nimport { removeLicenseHeader } from '../../../_common/export-stories-utils';\nimport PromptAdvancedSrcRaw from './prompt-advanced.story?raw';\nimport PromptContextSrcRaw from './prompt-context.story?raw';\nimport PromptDefaultSrcRaw from './prompt-default.story?raw';\nimport PromptDisabledSrcRaw from './prompt-disabled.story?raw';\nimport PromptHeaderSrcRaw from './prompt-header.story?raw';\nimport PromptLoadingSrcRaw from './prompt-loading.story?raw';\n\nexport const PromptDefaultSrc = removeLicenseHeader(PromptDefaultSrcRaw);\nexport const PromptAdvancedSrc = removeLicenseHeader(PromptAdvancedSrcRaw);\nexport const PromptLoadingSrc = removeLicenseHeader(PromptLoadingSrcRaw);\nexport const PromptContextSrc = removeLicenseHeader(PromptContextSrcRaw);\nexport const PromptDisabledSrc = removeLicenseHeader(PromptDisabledSrcRaw);\nexport const PromptHeaderSrc = removeLicenseHeader(PromptHeaderSrcRaw);\n"]}
|
|
@@ -48,7 +48,7 @@ const Component = () => {
|
|
|
48
48
|
console.info('remove file');
|
|
49
49
|
} }), (0, jsx_runtime_1.jsx)(ai_1.ImageTag, { src: "https://plus.unsplash.com/premium_photo-1676496046182-356a6a0ed002?q=80&w=2952&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", alt: "Landscape image", fileName: "Landscape image", fileType: "jpg", isRemovable: true, onClick: () => {
|
|
50
50
|
console.info('remove image');
|
|
51
|
-
} })] }), bottomContent: (0, jsx_runtime_1.
|
|
51
|
+
} })] }), bottomContent: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(react_1.CleanIconButton, { description: "Add stuff", size: "small", children: (0, jsx_runtime_1.jsx)(icons_1.PlusIconOutline, {}) }) }), bottomTrailingContent: (0, jsx_runtime_1.jsx)(ai_1.Prompt.Select, { value: selectedOption, options: options, onChange: setSelectedOption }) }));
|
|
52
52
|
};
|
|
53
53
|
exports.default = Component;
|
|
54
54
|
//# sourceMappingURL=prompt-advanced.story.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt-advanced.story.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt-advanced.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAmD;AACnD,4CAAgE;AAChE,kDAA8E;AAC9E,iCAAiC;AAEjC,MAAM,SAAS,G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C,GACD,EACF,uBAAC,aAAQ,IACP,SAAS,EAAE,IAAI,EACf,GAAG,EAAC,8KAA8K,EAClL,GAAG,EAAC,iBAAiB,EACrB,QAAQ,EAAC,iBAAiB,EAC1B,QAAQ,EAAC,KAAK,EACd,WAAW,EAAE,IAAI,EACjB,OAAO,EAAE,GAAG,EAAE;wBACZ,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;oBAC/B,CAAC,GACD,EACF,uBAAC,YAAO,IACN,IAAI,EAAE,uBAAC,2BAAmB,KAAG,EAC7B,QAAQ,EAAC,6BAA6B,EACtC,QAAQ,EAAC,KAAK,EACd,WAAW,EAAE,IAAI,EACjB,OAAO,EAAE,GAAG,EAAE;wBACZ,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;oBAC9B,CAAC,GACD,EACF,uBAAC,aAAQ,IACP,GAAG,EAAC,8KAA8K,EAClL,GAAG,EAAC,iBAAiB,EACrB,QAAQ,EAAC,iBAAiB,EAC1B,QAAQ,EAAC,KAAK,EACd,WAAW,EAAE,IAAI,EACjB,OAAO,EAAE,GAAG,EAAE;wBACZ,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;oBAC/B,CAAC,GACD,IACD,EAEL,aAAa,EACX,
|
|
1
|
+
{"version":3,"file":"prompt-advanced.story.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt-advanced.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAmD;AACnD,4CAAgE;AAChE,kDAA8E;AAC9E,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAqD;QAChE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE;QACrC,EAAE,KAAK,EAAE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OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;oBAC/B,CAAC,GACD,EACF,uBAAC,YAAO,IACN,IAAI,EAAE,uBAAC,2BAAmB,KAAG,EAC7B,QAAQ,EAAC,6BAA6B,EACtC,QAAQ,EAAC,KAAK,EACd,WAAW,EAAE,IAAI,EACjB,OAAO,EAAE,GAAG,EAAE;wBACZ,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;oBAC9B,CAAC,GACD,EACF,uBAAC,aAAQ,IACP,GAAG,EAAC,8KAA8K,EAClL,GAAG,EAAC,iBAAiB,EACrB,QAAQ,EAAC,iBAAiB,EAC1B,QAAQ,EAAC,KAAK,EACd,WAAW,EAAE,IAAI,EACjB,OAAO,EAAE,GAAG,EAAE;wBACZ,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;oBAC/B,CAAC,GACD,IACD,EAEL,aAAa,EACX,2DACE,uBAAC,uBAAe,IAAC,WAAW,EAAC,WAAW,EAAC,IAAI,EAAC,OAAO,YACnD,uBAAC,uBAAe,KAAG,GACH,GACjB,EAEL,qBAAqB,EACnB,uBAAC,WAAM,CAAC,MAAM,IACZ,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,iBAAiB,GAC3B,GAEJ,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { CleanIconButton } from '@neo4j-ndl/react';\nimport { FileTag, ImageTag, Prompt } from '@neo4j-ndl/react/ai';\nimport { DocumentIconOutline, PlusIconOutline } from '@neo4j-ndl/react/icons';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isRunningPrompt, setIsRunningPrompt] = useState(false);\n const options: Array<{ label: React.ReactNode; value: string }> = [\n { label: 'Neo4j AI', value: 'neo4j' },\n { label: 'Special Agent', value: 'special-agent' },\n { label: 'Another Agent', value: 'another-agent' },\n ];\n const [selectedOption, setSelectedOption] = useState(options[0]);\n const [prompt, setPrompt] = useState('');\n\n const handleSubmitPrompt = () => {\n setIsRunningPrompt(true);\n alert(`You submitted the following prompt: ${prompt}`);\n setPrompt('');\n };\n\n return (\n <Prompt\n isRunningPrompt={isRunningPrompt}\n value={prompt}\n onChange={(e) => setPrompt(e.target.value)}\n onSubmitPrompt={handleSubmitPrompt}\n onCancelPrompt={() => setIsRunningPrompt(false)}\n topContent={\n <>\n <FileTag\n isLoading={true}\n icon={<DocumentIconOutline />}\n fileName=\"Science Fiction Bestsellers\"\n fileType=\"pdf\"\n isRemovable={true}\n onClick={() => {\n console.info('remove file');\n }}\n />\n <ImageTag\n isLoading={true}\n src=\"https://plus.unsplash.com/premium_photo-1676496046182-356a6a0ed002?q=80&w=2952&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D\"\n alt=\"Landscape image\"\n fileName=\"Landscape image\"\n fileType=\"jpg\"\n isRemovable={true}\n onClick={() => {\n console.info('remove image');\n }}\n />\n <FileTag\n icon={<DocumentIconOutline />}\n fileName=\"Science Fiction Bestsellers\"\n fileType=\"pdf\"\n isRemovable={true}\n onClick={() => {\n console.info('remove file');\n }}\n />\n <ImageTag\n src=\"https://plus.unsplash.com/premium_photo-1676496046182-356a6a0ed002?q=80&w=2952&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D\"\n alt=\"Landscape image\"\n fileName=\"Landscape image\"\n fileType=\"jpg\"\n isRemovable={true}\n onClick={() => {\n console.info('remove image');\n }}\n />\n </>\n }\n bottomContent={\n <>\n <CleanIconButton description=\"Add stuff\" size=\"small\">\n <PlusIconOutline />\n </CleanIconButton>\n </>\n }\n bottomTrailingContent={\n <Prompt.Select\n value={selectedOption}\n options={options}\n onChange={setSelectedOption}\n />\n }\n />\n );\n};\n\nexport default Component;\n"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) "Neo4j"
|
|
7
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
8
|
+
*
|
|
9
|
+
* This file is part of Neo4j.
|
|
10
|
+
*
|
|
11
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
12
|
+
* it under the terms of the GNU General Public License as published by
|
|
13
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
14
|
+
* (at your option) any later version.
|
|
15
|
+
*
|
|
16
|
+
* This program is distributed in the hope that it will be useful,
|
|
17
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
+
* GNU General Public License for more details.
|
|
20
|
+
*
|
|
21
|
+
* You should have received a copy of the GNU General Public License
|
|
22
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
+
*/
|
|
24
|
+
require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
|
|
25
|
+
const react_1 = require("@neo4j-ndl/react");
|
|
26
|
+
const ai_1 = require("@neo4j-ndl/react/ai");
|
|
27
|
+
const icons_1 = require("@neo4j-ndl/react/icons");
|
|
28
|
+
const react_2 = require("react");
|
|
29
|
+
const Component = () => {
|
|
30
|
+
const [prompt, setPrompt] = (0, react_2.useState)('');
|
|
31
|
+
const [isRunningPrompt, setIsRunningPrompt] = (0, react_2.useState)(false);
|
|
32
|
+
const handleSubmitPrompt = () => {
|
|
33
|
+
setIsRunningPrompt(true);
|
|
34
|
+
setPrompt('');
|
|
35
|
+
};
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(ai_1.Prompt, { isRunningPrompt: isRunningPrompt, value: prompt, onChange: (e) => setPrompt(e.target.value), onSubmitPrompt: handleSubmitPrompt, onCancelPrompt: () => setIsRunningPrompt(false), headerContent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-medium", children: "We would like your feedback" }), (0, jsx_runtime_1.jsx)(react_1.TextButton, { size: "small", style: { marginLeft: 'auto' }, onClick: () => alert('Thanks for the feedback!'), children: "Give feedback" })] }), bottomContent: (0, jsx_runtime_1.jsx)(react_1.CleanIconButton, { description: "Add files", size: "small", children: (0, jsx_runtime_1.jsx)(icons_1.PlusIconOutline, {}) }) }));
|
|
37
|
+
};
|
|
38
|
+
exports.default = Component;
|
|
39
|
+
//# sourceMappingURL=prompt-header.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-header.story.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt-header.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAA2E;AAC3E,4CAA6C;AAC7C,kDAAyD;AACzD,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE9D,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC9B,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACzB,SAAS,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO,CACL,uBAAC,WAAM,IACL,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,CAAyC,EAAE,EAAE,CACtD,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAE3B,cAAc,EAAE,kBAAkB,EAClC,cAAc,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAC/C,aAAa,EACX,6DACE,uBAAC,kBAAU,IAAC,OAAO,EAAC,aAAa,4CAEpB,EACb,uBAAC,kBAAU,IACT,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,EAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,0BAA0B,CAAC,8BAGrC,IACZ,EAEL,aAAa,EACX,uBAAC,uBAAe,IAAC,WAAW,EAAC,WAAW,EAAC,IAAI,EAAC,OAAO,YACnD,uBAAC,uBAAe,KAAG,GACH,GAEpB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { CleanIconButton, TextButton, Typography } from '@neo4j-ndl/react';\nimport { Prompt } from '@neo4j-ndl/react/ai';\nimport { PlusIconOutline } from '@neo4j-ndl/react/icons';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [prompt, setPrompt] = useState('');\n const [isRunningPrompt, setIsRunningPrompt] = useState(false);\n\n const handleSubmitPrompt = () => {\n setIsRunningPrompt(true);\n setPrompt('');\n };\n\n return (\n <Prompt\n isRunningPrompt={isRunningPrompt}\n value={prompt}\n onChange={(e: React.ChangeEvent<HTMLTextAreaElement>) =>\n setPrompt(e.target.value)\n }\n onSubmitPrompt={handleSubmitPrompt}\n onCancelPrompt={() => setIsRunningPrompt(false)}\n headerContent={\n <>\n <Typography variant=\"body-medium\">\n We would like your feedback\n </Typography>\n <TextButton\n size=\"small\"\n style={{ marginLeft: 'auto' }}\n onClick={() => alert('Thanks for the feedback!')}\n >\n Give feedback\n </TextButton>\n </>\n }\n bottomContent={\n <CleanIconButton description=\"Add files\" size=\"small\">\n <PlusIconOutline />\n </CleanIconButton>\n }\n />\n );\n};\n\nexport default Component;\n"]}
|