@neo4j-ndl/react 4.14.4 → 4.14.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/lib/cjs/ai/preview/Preview.js +5 -0
  2. package/lib/cjs/ai/preview/Preview.js.map +1 -1
  3. package/lib/cjs/ai/preview/stories/index.js +9 -1
  4. package/lib/cjs/ai/preview/stories/index.js.map +1 -1
  5. package/lib/cjs/ai/preview/stories/preview-simple-with-content.story.js +34 -0
  6. package/lib/cjs/ai/preview/stories/preview-simple-with-content.story.js.map +1 -0
  7. package/lib/cjs/ai/preview/stories/preview-simple.story.js +33 -0
  8. package/lib/cjs/ai/preview/stories/preview-simple.story.js.map +1 -0
  9. package/lib/cjs/ai/prompt/Prompt.js +4 -14
  10. package/lib/cjs/ai/prompt/Prompt.js.map +1 -1
  11. package/lib/cjs/ai/prompt/stories/index.js +5 -1
  12. package/lib/cjs/ai/prompt/stories/index.js.map +1 -1
  13. package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js +1 -1
  14. package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
  15. package/lib/cjs/ai/prompt/stories/prompt-header.story.js +39 -0
  16. package/lib/cjs/ai/prompt/stories/prompt-header.story.js.map +1 -0
  17. package/lib/cjs/ai/response/Response.js +23 -22
  18. package/lib/cjs/ai/response/Response.js.map +1 -1
  19. package/lib/cjs/ai/response/stories/response-all-components.story.js +2 -0
  20. package/lib/cjs/ai/response/stories/response-all-components.story.js.map +1 -1
  21. package/lib/cjs/date-picker/DatePicker.js +12 -7
  22. package/lib/cjs/date-picker/DatePicker.js.map +1 -1
  23. package/lib/cjs/date-picker/stories/date-picker-clearable.story.js +47 -0
  24. package/lib/cjs/date-picker/stories/date-picker-clearable.story.js.map +1 -0
  25. package/lib/cjs/date-picker/stories/index.js +5 -1
  26. package/lib/cjs/date-picker/stories/index.js.map +1 -1
  27. package/lib/esm/ai/preview/Preview.js +5 -0
  28. package/lib/esm/ai/preview/Preview.js.map +1 -1
  29. package/lib/esm/ai/preview/stories/index.js +6 -0
  30. package/lib/esm/ai/preview/stories/index.js.map +1 -1
  31. package/lib/esm/ai/preview/stories/preview-simple-with-content.story.js +32 -0
  32. package/lib/esm/ai/preview/stories/preview-simple-with-content.story.js.map +1 -0
  33. package/lib/esm/ai/preview/stories/preview-simple.story.js +31 -0
  34. package/lib/esm/ai/preview/stories/preview-simple.story.js.map +1 -0
  35. package/lib/esm/ai/prompt/Prompt.js +6 -16
  36. package/lib/esm/ai/prompt/Prompt.js.map +1 -1
  37. package/lib/esm/ai/prompt/stories/index.js +3 -0
  38. package/lib/esm/ai/prompt/stories/index.js.map +1 -1
  39. package/lib/esm/ai/prompt/stories/prompt-advanced.story.js +1 -1
  40. package/lib/esm/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
  41. package/lib/esm/ai/prompt/stories/prompt-header.story.js +37 -0
  42. package/lib/esm/ai/prompt/stories/prompt-header.story.js.map +1 -0
  43. package/lib/esm/ai/response/Response.js +23 -22
  44. package/lib/esm/ai/response/Response.js.map +1 -1
  45. package/lib/esm/ai/response/stories/response-all-components.story.js +2 -0
  46. package/lib/esm/ai/response/stories/response-all-components.story.js.map +1 -1
  47. package/lib/esm/date-picker/DatePicker.js +12 -7
  48. package/lib/esm/date-picker/DatePicker.js.map +1 -1
  49. package/lib/esm/date-picker/stories/date-picker-clearable.story.js +43 -0
  50. package/lib/esm/date-picker/stories/date-picker-clearable.story.js.map +1 -0
  51. package/lib/esm/date-picker/stories/index.js +3 -0
  52. package/lib/esm/date-picker/stories/index.js.map +1 -1
  53. package/lib/types/ai/preview/Preview.d.ts +4 -0
  54. package/lib/types/ai/preview/Preview.d.ts.map +1 -1
  55. package/lib/types/ai/preview/stories/index.d.ts +4 -0
  56. package/lib/types/ai/preview/stories/index.d.ts.map +1 -1
  57. package/lib/types/ai/preview/stories/preview-simple-with-content.story.d.ts +24 -0
  58. package/lib/types/ai/preview/stories/preview-simple-with-content.story.d.ts.map +1 -0
  59. package/lib/types/ai/preview/stories/preview-simple.story.d.ts +24 -0
  60. package/lib/types/ai/preview/stories/preview-simple.story.d.ts.map +1 -0
  61. package/lib/types/ai/prompt/Prompt.d.ts +6 -2
  62. package/lib/types/ai/prompt/Prompt.d.ts.map +1 -1
  63. package/lib/types/ai/prompt/stories/index.d.ts +2 -0
  64. package/lib/types/ai/prompt/stories/index.d.ts.map +1 -1
  65. package/lib/types/ai/prompt/stories/prompt-advanced.story.d.ts.map +1 -1
  66. package/lib/types/{_common/component-docs-page.d.ts → ai/prompt/stories/prompt-header.story.d.ts} +4 -3
  67. package/lib/types/ai/prompt/stories/prompt-header.story.d.ts.map +1 -0
  68. package/lib/types/ai/response/Response.d.ts.map +1 -1
  69. package/lib/types/ai/response/stories/response-all-components.story.d.ts.map +1 -1
  70. package/lib/types/date-picker/DatePicker.d.ts +6 -1
  71. package/lib/types/date-picker/DatePicker.d.ts.map +1 -1
  72. package/lib/types/date-picker/stories/date-picker-clearable.story.d.ts +24 -0
  73. package/lib/types/date-picker/stories/date-picker-clearable.story.d.ts.map +1 -0
  74. package/lib/types/date-picker/stories/index.d.ts +2 -0
  75. package/lib/types/date-picker/stories/index.d.ts.map +1 -1
  76. package/package.json +3 -2
  77. package/lib/cjs/_common/component-docs-page.js +0 -72
  78. package/lib/cjs/_common/component-docs-page.js.map +0 -1
  79. package/lib/esm/_common/component-docs-page.js +0 -69
  80. package/lib/esm/_common/component-docs-page.js.map +0 -1
  81. package/lib/types/_common/component-docs-page.d.ts.map +0 -1
@@ -97,9 +97,14 @@ const PreviewCode = (_a) => {
97
97
  // wrapLongLines
98
98
  codeTagProps: { className: 'n-ai-preview-code' }, showLineNumbers: false, children: code }) })] }))] })));
99
99
  };
100
+ const PreviewContent = (_a) => {
101
+ var { children, ref, style, className, htmlAttributes } = _a, restProps = __rest(_a, ["children", "ref", "style", "className", "htmlAttributes"]);
102
+ return (_jsx("div", Object.assign({ ref: ref, style: style, className: classNames('ndl-ai-preview-content', className) }, restProps, htmlAttributes, { children: children })));
103
+ };
100
104
  export const Preview = Object.assign(PreviewComponent, {
101
105
  Code: PreviewCode,
102
106
  Confirmation: PreviewConfirmation,
107
+ Content: PreviewContent,
103
108
  Header: PreviewHeader,
104
109
  });
105
110
  //# sourceMappingURL=Preview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Preview.js","sourceRoot":"","sources":["../../../../src/ai/preview/Preview.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,eAAe,EAEf,cAAc,EACd,WAAW,EACX,UAAU,EACV,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG3E,OAAO,EAEL,SAAS,EACT,YAAY,GACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,WAAW,MAAM,uCAAuC,CAAC;AAChE,OAAO,YAAY,MAAM,wCAAwC,CAAC;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,4BACE,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,UAAU,CAAC,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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C,6BAA6B,YAC1C,KAAC,iBAAiB,IAChB,QAAQ,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,MAAM,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;AAEF,MAAM,CAAC,MAAM,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":"","sources":["../../../../src/ai/preview/Preview.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,eAAe,EAEf,cAAc,EACd,WAAW,EACX,UAAU,EACV,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG3E,OAAO,EAEL,SAAS,EACT,YAAY,GACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,WAAW,MAAM,uCAAuC,CAAC;AAChE,OAAO,YAAY,MAAM,wCAAwC,CAAC;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,4BACE,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,UAAU,CAAC,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,6BACE,GAAG,EAAE,GAAG,EACR,KAAK,EAA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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;AAMF,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,4BACE,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,UAAU,CAAC,wBAAwB,EAAE,SAAS,CAAC,IACtD,SAAS,EACT,cAAc,cAEjB,QAAQ,IACL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,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"]}
@@ -25,6 +25,8 @@ export { default as PreviewCodeLoading } from './preview-code-loading.story';
25
25
  export { default as PreviewCodeRead } from './preview-code-read.story';
26
26
  export { default as PreviewCodeWrite } from './preview-code-write.story';
27
27
  export { default as PreviewCodeLanguages } from './preview-code-languages.story';
28
+ export { default as PreviewSimple } from './preview-simple.story';
29
+ export { default as PreviewSimpleWithContent } from './preview-simple-with-content.story';
28
30
  import { removeLicenseHeader } from '../../../_common/export-stories-utils';
29
31
  import PreviewCodeConfirmationSrcRaw from './preview-code-confirmation.story?raw';
30
32
  import PreviewCodeLanguagesSrcRaw from './preview-code-languages.story?raw';
@@ -33,6 +35,8 @@ import PreviewCodeReadSrcRaw from './preview-code-read.story?raw';
33
35
  import PreviewCodeWriteSrcRaw from './preview-code-write.story?raw';
34
36
  import PreviewConfirmationStandaloneSrcRaw from './preview-confirmation-standalone.story?raw';
35
37
  import PreviewDataGridSrcRaw from './preview-data-grid.story?raw';
38
+ import PreviewSimpleSrcRaw from './preview-simple.story?raw';
39
+ import PreviewSimpleWithContentSrcRaw from './preview-simple-with-content.story?raw';
36
40
  export const PreviewDataGridSrc = removeLicenseHeader(PreviewDataGridSrcRaw);
37
41
  export const PreviewConfirmationStandaloneSrc = removeLicenseHeader(PreviewConfirmationStandaloneSrcRaw);
38
42
  export const PreviewCodeConfirmationSrc = removeLicenseHeader(PreviewCodeConfirmationSrcRaw);
@@ -40,4 +44,6 @@ export const PreviewCodeLoadingSrc = removeLicenseHeader(PreviewCodeLoadingSrcRa
40
44
  export const PreviewCodeReadSrc = removeLicenseHeader(PreviewCodeReadSrcRaw);
41
45
  export const PreviewCodeWriteSrc = removeLicenseHeader(PreviewCodeWriteSrcRaw);
42
46
  export const PreviewCodeLanguagesSrc = removeLicenseHeader(PreviewCodeLanguagesSrcRaw);
47
+ export const PreviewSimpleSrc = removeLicenseHeader(PreviewSimpleSrcRaw);
48
+ export const PreviewSimpleWithContentSrc = removeLicenseHeader(PreviewSimpleWithContentSrcRaw);
43
49
  //# 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,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACnG,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,6BAA6B,MAAM,uCAAuC,CAAC;AAClF,OAAO,0BAA0B,MAAM,oCAAoC,CAAC;AAC5E,OAAO,wBAAwB,MAAM,kCAAkC,CAAC;AACxE,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAClE,OAAO,sBAAsB,MAAM,gCAAgC,CAAC;AACpE,OAAO,mCAAmC,MAAM,6CAA6C,CAAC;AAC9F,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAElE,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,gCAAgC,GAAG,mBAAmB,CACjE,mCAAmC,CACpC,CAAC;AACF,MAAM,CAAC,MAAM,0BAA0B,GAAG,mBAAmB,CAC3D,6BAA6B,CAC9B,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CACtD,wBAAwB,CACzB,CAAC;AACF,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;AAC/E,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CACxD,0BAA0B,CAC3B,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';\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';\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);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/preview/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,yCAAyC,CAAC;AACnG,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,mCAAm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AmB,CAAC,sBAAsB,CAAC,CAAC;AAC/E,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CACxD,0BAA0B,CAC3B,CAAC;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,2BAA2B,GAAG,mBAAmB,CAC5D,8BAA8B,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,32 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { FilledButton, OutlinedButton, ReadOnlyTag } from '@neo4j-ndl/react';
24
+ import { Preview } from '@neo4j-ndl/react/ai';
25
+ import { DeploymentsIcon } from '@neo4j-ndl/react/icons';
26
+ import { useState } from 'react';
27
+ const Component = () => {
28
+ const [status, setStatus] = useState('pending');
29
+ return (_jsxs(Preview, { children: [_jsx(Preview.Header, { children: "CONNECT TO INSTANCE" }), _jsx(Preview.Content, { children: _jsx(ReadOnlyTag, { size: "small", leadingVisual: _jsx(DeploymentsIcon, {}), children: "Instance 1" }) }), _jsx(Preview.Confirmation, { status: status, isFooter: true, confirmedActionText: "Allowed action", rejectedActionText: "Skipped action", actions: _jsxs(_Fragment, { children: [_jsx(OutlinedButton, { variant: "neutral", size: "small", onClick: () => setStatus('rejected'), children: "Skip" }), _jsx(FilledButton, { variant: "primary", size: "small", onClick: () => setStatus('confirmed'), children: "Allow" })] }) })] }));
30
+ };
31
+ export default Component;
32
+ //# 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,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACvB,QAAQ,CACN,SAAS,CACV,CAAC;IAEJ,OAAO,CACL,MAAC,OAAO,eACN,KAAC,OAAO,CAAC,MAAM,sCAAqC,EACpD,KAAC,OAAO,CAAC,OAAO,cACd,KAAC,WAAW,IAAC,IAAI,EAAC,OAAO,EAAC,aAAa,EAAE,KAAC,eAAe,KAAG,2BAE9C,GACE,EAClB,KAAC,OAAO,CAAC,YAAY,IACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,IAAI,EACd,mBAAmB,EAAC,gBAAgB,EACpC,kBAAkB,EAAC,gBAAgB,EACnC,OAAO,EACL,8BACE,KAAC,cAAc,IACb,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,qBAGrB,EACjB,KAAC,YAAY,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,eAAe,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,31 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { FilledButton, OutlinedButton } from '@neo4j-ndl/react';
24
+ import { Preview } from '@neo4j-ndl/react/ai';
25
+ import { useState } from 'react';
26
+ const Component = () => {
27
+ const [status, setStatus] = useState('pending');
28
+ return (_jsxs(Preview, { children: [_jsx(Preview.Header, { children: "CONNECT TO INSTANCE" }), _jsx(Preview.Confirmation, { status: status, isFooter: true, confirmedActionText: "Instance selected", rejectedActionText: "Skipped", actions: _jsxs(_Fragment, { children: [_jsx(OutlinedButton, { variant: "neutral", size: "small", onClick: () => setStatus('rejected'), children: "Skip" }), _jsx(FilledButton, { variant: "primary", size: "small", onClick: () => setStatus('confirmed'), children: "Select instance" })] }) })] }));
29
+ };
30
+ export default Component;
31
+ //# 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,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GACvB,QAAQ,CACN,SAAS,CACV,CAAC;IAEJ,OAAO,CACL,MAAC,OAAO,eACN,KAAC,OAAO,CAAC,MAAM,sCAAqC,EACpD,KAAC,OAAO,CAAC,YAAY,IACnB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,IAAI,EACd,mBAAmB,EAAC,mBAAmB,EACvC,kBAAkB,EAAC,SAAS,EAC5B,OAAO,EACL,8BACE,KAAC,cAAc,IACb,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,qBAGrB,EACjB,KAAC,YAAY,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,eAAe,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"]}
@@ -30,8 +30,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
30
30
  * You should have received a copy of the GNU General Public License
31
31
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
32
32
  */
33
- import { CleanIconButton, DropdownButton, LoadingSpinner, Menu, OutlinedButton, Tooltip, Typography, } from '@neo4j-ndl/react';
34
- import { ArrowSendIcon, ArrowSmallUpIconOutline, StopIconOutline, XMarkIconOutline, } from '@neo4j-ndl/react/icons';
33
+ import { CleanIconButton, DropdownButton, Menu, Tooltip, Typography, } from '@neo4j-ndl/react';
34
+ import { ArrowSendIcon, ArrowSmallUpIconOutline, StopCircleIconOutline, XMarkIconOutline, } from '@neo4j-ndl/react/icons';
35
35
  import classNames from 'classnames';
36
36
  import { useCallback, useEffect, useRef, useState } from 'react';
37
37
  /**
@@ -42,7 +42,7 @@ import { useCallback, useEffect, useRef, useState } from 'react';
42
42
  * @alpha - Changes to this component may be breaking.
43
43
  */
44
44
  const PromptComponent = (_a) => {
45
- 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"]);
45
+ 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"]);
46
46
  const classes = classNames('ndl-ai-prompt', className, {
47
47
  'ndl-disabled': isDisabled,
48
48
  });
@@ -121,9 +121,7 @@ const PromptComponent = (_a) => {
121
121
  adjustTextareaHeight();
122
122
  onChange === null || onChange === void 0 ? void 0 : onChange(e);
123
123
  };
124
- return (_jsxs("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [_jsxs("div", { className: "ndl-ai-prompt-wrapper", children: [_jsx("div", { className: classNames('ndl-ai-prompt-loading-container', {
125
- 'ndl-expanded': isRunningPrompt,
126
- }), "aria-hidden": !isRunningPrompt, inert: !isRunningPrompt, children: _jsx("div", { className: "ndl-ai-prompt-loading-shell", children: _jsxs("div", { className: "ndl-ai-prompt-loading-content", children: [_jsx(LoadingSpinner, { size: "medium" }), _jsxs(Typography, { variant: "body-medium", children: ["Working", _jsxs("span", { className: "ndl-ai-prompt-loading-dots", children: [_jsx("span", { children: "." }), _jsx("span", { children: "." }), _jsx("span", { children: "." })] })] })] }) }) }), _jsxs("div", { className: "ndl-ai-prompt-wrapper-inner", children: [Boolean(topContent) && (_jsx("div", { className: "ndl-ai-prompt-textarea-above", ref: textareaAboveRef, children: topContent })), _jsx("textarea", Object.assign({ placeholder: "Ask anything", className: "ndl-ai-prompt-textarea", rows: 1, onChange: handleInput, value: value, ref: textareaRef, disabled: isDisabled, onKeyDown: (e) => {
124
+ return (_jsxs("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [_jsxs("div", { className: "ndl-ai-prompt-wrapper", children: [Boolean(headerContent) && (_jsx("div", { className: "ndl-ai-prompt-header", children: headerContent })), _jsxs("div", { className: "ndl-ai-prompt-wrapper-inner", children: [Boolean(topContent) && (_jsx("div", { className: "ndl-ai-prompt-textarea-above", ref: textareaAboveRef, children: topContent })), _jsx("textarea", Object.assign({ placeholder: "Ask anything", className: "ndl-ai-prompt-textarea", rows: 1, onChange: handleInput, value: value, ref: textareaRef, disabled: isDisabled, onKeyDown: (e) => {
127
125
  if (e.key === 'Enter' &&
128
126
  !e.shiftKey &&
129
127
  isSubmitDisabled !== true) {
@@ -132,18 +130,10 @@ const PromptComponent = (_a) => {
132
130
  onSubmitPrompt === null || onSubmitPrompt === void 0 ? void 0 : onSubmitPrompt(e);
133
131
  }
134
132
  }
135
- } }, textareaProps)), _jsx("div", { className: "ndl-ai-prompt-textarea-below", children: Boolean(bottomContent) && (_jsx("div", { className: "ndl-ai-prompt-textarea-below-leading", children: bottomContent })) })] }), _jsx(SubmitPromptButton, { isDisabled: isSubmitDisabled, isRunningPrompt: isRunningPrompt, onSubmit: onSubmitPrompt, onCancel: onCancelPrompt })] }), Boolean(disclaimer) && (_jsx(Typography, { variant: "body-small", className: "ndl-ai-prompt-footer", children: disclaimer }))] })));
133
+ } }, textareaProps)), _jsxs("div", { className: "ndl-ai-prompt-textarea-below", children: [Boolean(bottomContent) && (_jsx("div", { className: "ndl-ai-prompt-textarea-below-leading", children: bottomContent })), _jsxs("div", { className: "ndl-ai-prompt-textarea-below-trailing", children: [bottomTrailingContent, _jsx(SubmitPromptButton, { isDisabled: isSubmitDisabled, isRunningPrompt: isRunningPrompt, onSubmit: onSubmitPrompt, onCancel: onCancelPrompt })] })] })] })] }), Boolean(disclaimer) && (_jsx(Typography, { variant: "body-small", className: "ndl-ai-prompt-footer", children: disclaimer }))] })));
136
134
  };
137
135
  const SubmitPromptButton = ({ onSubmit, onCancel, isDisabled, isRunningPrompt, }) => {
138
- return (_jsx("div", { className: classNames('ndl-ai-prompt-button-container', {
139
- 'ndl-in-loading': isRunningPrompt,
140
- }), children: _jsxs(Tooltip, { type: "simple", isDisabled: isDisabled || isRunningPrompt, hoverDelay: { close: 0, open: 500 }, shouldCloseOnReferenceClick: true, children: [_jsx(Tooltip.Trigger, { hasButtonWrapper: true, children: _jsx("button", { type: "button", style: {
141
- borderRadius: isRunningPrompt
142
- ? 'var(--border-radius-sm)'
143
- : 'var(--border-radius-lg)',
144
- }, onClick: isRunningPrompt ? onCancel : onSubmit, disabled: isDisabled, "aria-label": isRunningPrompt ? 'Stop' : 'Send', children: isRunningPrompt === true ? (_jsx(OutlinedButton, { as: "div", variant: "neutral", className: "ndl-ai-prompt-stop-button", size: "small", leadingVisual: _jsx(StopIconOutline, {}), children: "Stop" })) : (_jsx(CleanIconButton, { description: "Send", as: "div", className: "ndl-ai-prompt-submit-button", size: "medium", isDisabled: isDisabled, htmlAttributes: {
145
- 'aria-pressed': undefined,
146
- }, children: _jsx(ArrowSmallUpIconOutline, {}) })) }) }), _jsx(Tooltip.Content, { children: "Send" })] }) }));
136
+ return (_jsx(CleanIconButton, { className: "ndl-ai-prompt-submit-button", description: isRunningPrompt === true ? 'Stop' : 'Send', size: "small", isDisabled: isDisabled, onClick: isRunningPrompt === true ? onCancel : onSubmit, children: isRunningPrompt === true ? (_jsx(StopCircleIconOutline, {})) : (_jsx(ArrowSmallUpIconOutline, {})) }));
147
137
  };
148
138
  const AgentSelect = ({ value, options = [], onChange }) => {
149
139
  var _a, _b, _c;
@@ -1 +1 @@
1
- {"version":3,"file":"Prompt.js","sourceRoot":"","sources":["../../../../src/ai/prompt/Prompt.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACL,eAAe,EACf,cAAc,EACd,cAAc,EACd,IAAI,EACJ,cAAc,EACd,OAAO,EACP,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;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,cAAc,EACd,GAAG,EACH,aAAa,OAEmB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AAC,OAAO,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;AAEH,OAAO,EAAE,MAAM,EAAE,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 {\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,OAAO,EACL,eAAe,EACf,cAAc,EACd,IAAI,EACJ,OAAO,EACP,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QA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BAChB,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,KAAC,OAAO,CAAC,OAAO,IAAC,gBAAgB,kBAC/B,eAAK,SAAS,EAAC,2BAA2B,aACxC,KAAC,aAAa,IAAC,SAAS,EAAC,gCAAgC,GAAG,EAC5D,KAAC,UAAU,IACT,OAAO,EAAC,aAAa,EACrB,SAAS,EAAC,gCAAgC,EAC1C,GAAG,EAAE,OAAO,YAEX,QAAQ,GACE,EAEb,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,gBACJ,mBAAmB,QAAQ,EAAE,EACzC,SAAS,EAAC,wCAAwC,YAElD,KAAC,gBAAgB,IAAC,SAAS,EAAC,gCAAgC,GAAG,GACxD,IACL,GACU,EAClB,KAAC,OAAO,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;AAEH,OAAO,EAAE,MAAM,EAAE,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 {\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,15 +23,18 @@ export { default as PromptAdvanced } from './prompt-advanced.story';
23
23
  export { default as PromptLoading } from './prompt-loading.story';
24
24
  export { default as PromptContext } from './prompt-context.story';
25
25
  export { default as PromptDisabled } from './prompt-disabled.story';
26
+ export { default as PromptHeader } from './prompt-header.story';
26
27
  import { removeLicenseHeader } from '../../../_common/export-stories-utils';
27
28
  import PromptAdvancedSrcRaw from './prompt-advanced.story?raw';
28
29
  import PromptContextSrcRaw from './prompt-context.story?raw';
29
30
  import PromptDefaultSrcRaw from './prompt-default.story?raw';
30
31
  import PromptDisabledSrcRaw from './prompt-disabled.story?raw';
32
+ import PromptHeaderSrcRaw from './prompt-header.story?raw';
31
33
  import PromptLoadingSrcRaw from './prompt-loading.story?raw';
32
34
  export const PromptDefaultSrc = removeLicenseHeader(PromptDefaultSrcRaw);
33
35
  export const PromptAdvancedSrc = removeLicenseHeader(PromptAdvancedSrcRaw);
34
36
  export const PromptLoadingSrc = removeLicenseHeader(PromptLoadingSrcRaw);
35
37
  export const PromptContextSrc = removeLicenseHeader(PromptContextSrcRaw);
36
38
  export const PromptDisabledSrc = removeLicenseHeader(PromptDisabledSrcRaw);
39
+ export const PromptHeaderSrc = removeLicenseHeader(PromptHeaderSrcRaw);
37
40
  //# 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,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAC/D,OAAO,mBAAmB,MAAM,4BAA4B,CAAC;AAC7D,OAAO,mBAAmB,MAAM,4BAA4B,CAAC;AAC7D,OAAO,oBAAoB,MAAM,6BAA6B,CAAC;AAC/D,OAAO,mBAAmB,MAAM,4BAA4B,CAAC;AAE7D,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,mBAAmB,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,oBAAoB,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';\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 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 = removeLicenseHe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AmB,CAAC,kBAAkB,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"]}
@@ -46,7 +46,7 @@ const Component = () => {
46
46
  console.info('remove file');
47
47
  } }), _jsx(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: () => {
48
48
  console.info('remove image');
49
- } })] }), bottomContent: _jsxs(_Fragment, { children: [_jsx(Prompt.Select, { value: selectedOption, options: options, onChange: setSelectedOption }), _jsx(CleanIconButton, { description: "Add stuff", size: "small", children: _jsx(PlusIconOutline, {}) })] }) }));
49
+ } })] }), bottomContent: _jsx(_Fragment, { children: _jsx(CleanIconButton, { description: "Add stuff", size: "small", children: _jsx(PlusIconOutline, {}) }) }), bottomTrailingContent: _jsx(Prompt.Select, { value: selectedOption, options: options, onChange: setSelectedOption }) }));
50
50
  };
51
51
  export default Component;
52
52
  //# 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,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAqD;QAChE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE;QACrC,EAAE,KAAK,EAAE,eAAe,EAAE,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AC,CAAC;oBAC/B,CAAC,GACD,EACF,KAAC,OAAO,IACN,IAAI,EAAE,KAAC,mBAAmB,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,KAAC,QAAQ,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,8BACE,KAAC,MAAM,CAAC,MAAM,IACZ,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,iBAAiB,GAC3B,EACF,KAAC,eAAe,IAAC,WAAW,EAAC,WAAW,EAAC,IAAI,EAAC,OAAO,YACnD,KAAC,eAAe,KAAG,GACH,IACjB,GAEL,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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 <Prompt.Select\n value={selectedOption}\n options={options}\n onChange={setSelectedOption}\n />\n <CleanIconButton description=\"Add stuff\" size=\"small\">\n <PlusIconOutline />\n </CleanIconButton>\n </>\n }\n />\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"prompt-advanced.story.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt-advanced.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAqD;QAChE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE;QACrC,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE;QAClD,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE;KACnD,CAAC;IACF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEzC,MAAM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,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,4BACE,KAAC,eAAe,IAAC,WAAW,EAAC,WAAW,EAAC,IAAI,EAAC,OAAO,YACnD,KAAC,eAAe,KAAG,GACH,GACjB,EAEL,qBAAqB,EACnB,KAAC,MAAM,CAAC,MAAM,IACZ,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,iBAAiB,GAC3B,GAEJ,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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,37 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { CleanIconButton, TextButton, Typography } from '@neo4j-ndl/react';
24
+ import { Prompt } from '@neo4j-ndl/react/ai';
25
+ import { PlusIconOutline } from '@neo4j-ndl/react/icons';
26
+ import { useState } from 'react';
27
+ const Component = () => {
28
+ const [prompt, setPrompt] = useState('');
29
+ const [isRunningPrompt, setIsRunningPrompt] = useState(false);
30
+ const handleSubmitPrompt = () => {
31
+ setIsRunningPrompt(true);
32
+ setPrompt('');
33
+ };
34
+ return (_jsx(Prompt, { isRunningPrompt: isRunningPrompt, value: prompt, onChange: (e) => setPrompt(e.target.value), onSubmitPrompt: handleSubmitPrompt, onCancelPrompt: () => setIsRunningPrompt(false), headerContent: _jsxs(_Fragment, { children: [_jsx(Typography, { variant: "body-medium", children: "We would like your feedback" }), _jsx(TextButton, { size: "small", style: { marginLeft: 'auto' }, onClick: () => alert('Thanks for the feedback!'), children: "Give feedback" })] }), bottomContent: _jsx(CleanIconButton, { description: "Add files", size: "small", children: _jsx(PlusIconOutline, {}) }) }));
35
+ };
36
+ export default Component;
37
+ //# 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,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,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,KAAC,MAAM,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,8BACE,KAAC,UAAU,IAAC,OAAO,EAAC,aAAa,4CAEpB,EACb,KAAC,UAAU,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,KAAC,eAAe,IAAC,WAAW,EAAC,WAAW,EAAC,IAAI,EAAC,OAAO,YACnD,KAAC,eAAe,KAAG,GACH,GAEpB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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"]}