@neo4j-ndl/react 4.6.1 → 4.6.3

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.
@@ -125,27 +125,29 @@ const PromptComponent = (_a) => {
125
125
  adjustTextareaHeight();
126
126
  onChange === null || onChange === void 0 ? void 0 : onChange(e);
127
127
  };
128
- return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [(0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-wrapper", children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-wrapper-inner", children: [Boolean(topContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-textarea-above", ref: textareaAboveRef, children: topContent })), (0, jsx_runtime_1.jsx)("textarea", Object.assign({ placeholder: "Ask anything", className: "ndl-ai-prompt-textarea", rows: 1, onChange: handleInput, value: value, ref: textareaRef, onKeyDown: (e) => {
129
- if (e.key === 'Enter' &&
130
- !e.shiftKey &&
131
- isSubmitDisabled !== true) {
132
- e.preventDefault();
133
- if (isRunningPrompt !== true) {
134
- onSubmitPrompt === null || onSubmitPrompt === void 0 ? void 0 : onSubmitPrompt(e);
128
+ return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-wrapper", children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ndl-ai-prompt-loading-container', {
129
+ 'ndl-expanded': isRunningPrompt,
130
+ }), "aria-hidden": !isRunningPrompt, inert: !isRunningPrompt, children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-loading-shell", children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-loading-content", children: [(0, jsx_runtime_1.jsx)(react_1.LoadingSpinner, { size: "medium" }), (0, jsx_runtime_1.jsxs)(react_1.Typography, { variant: "body-medium", children: ["Working", (0, jsx_runtime_1.jsxs)("span", { className: "ndl-ai-prompt-loading-dots", children: [(0, jsx_runtime_1.jsx)("span", { children: "." }), (0, jsx_runtime_1.jsx)("span", { children: "." }), (0, jsx_runtime_1.jsx)("span", { children: "." })] })] })] }) }) }), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-wrapper-inner", children: [Boolean(topContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-textarea-above", ref: textareaAboveRef, children: topContent })), (0, jsx_runtime_1.jsx)("textarea", Object.assign({ placeholder: "Ask anything", className: "ndl-ai-prompt-textarea", rows: 1, onChange: handleInput, value: value, ref: textareaRef, onKeyDown: (e) => {
131
+ if (e.key === 'Enter' &&
132
+ !e.shiftKey &&
133
+ isSubmitDisabled !== true) {
134
+ e.preventDefault();
135
+ if (isRunningPrompt !== true) {
136
+ onSubmitPrompt === null || onSubmitPrompt === void 0 ? void 0 : onSubmitPrompt(e);
137
+ }
135
138
  }
136
- }
137
- } }, textareaProps)), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-ai-prompt-textarea-below", children: [Boolean(bottomContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-textarea-below-leading", children: bottomContent })), (0, jsx_runtime_1.jsx)(SumbitPromptButton, { isDisabled: isSubmitDisabled, isRunningPrompt: isRunningPrompt, onSubmit: onSubmitPrompt, onCancel: onCancelPrompt })] })] }) }), Boolean(disclaimer) && ((0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-small", className: "ndl-ai-prompt-footer", children: disclaimer }))] })));
139
+ } }, textareaProps)), (0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-textarea-below", children: Boolean(bottomContent) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-ai-prompt-textarea-below-leading", children: bottomContent })) })] }), (0, jsx_runtime_1.jsx)(SubmitPromptButton, { isDisabled: isSubmitDisabled, isRunningPrompt: isRunningPrompt, onSubmit: onSubmitPrompt, onCancel: onCancelPrompt })] }), Boolean(disclaimer) && ((0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-small", className: "ndl-ai-prompt-footer", children: disclaimer }))] })));
138
140
  };
139
- const SumbitPromptButton = ({ onSubmit, onCancel, isDisabled, isRunningPrompt, }) => {
140
- const description = isRunningPrompt === true ? 'Cancel' : 'Send';
141
- return ((0, jsx_runtime_1.jsxs)(react_1.CleanIconButton, { className: "ndl-ai-prompt-submit-button", description: description, size: "medium", onClick: isRunningPrompt === true ? onCancel : onSubmit, isDisabled: isDisabled, children: [(0, jsx_runtime_1.jsx)(icons_1.ArrowSmallUpIconOutline, { style: {
142
- opacity: isRunningPrompt === true ? 0 : 1,
143
- position: isRunningPrompt === true ? 'absolute' : 'relative',
144
- transform: isRunningPrompt === true ? 'translateY(-8px)' : 'translateY(0)',
145
- } }), (0, jsx_runtime_1.jsx)(icons_1.StopCircleIconOutline, { style: {
146
- opacity: isRunningPrompt === true ? 1 : 0,
147
- position: isRunningPrompt === true ? 'relative' : 'absolute',
148
- } })] }));
141
+ const SubmitPromptButton = ({ onSubmit, onCancel, isDisabled, isRunningPrompt, }) => {
142
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ndl-ai-prompt-button-container', {
143
+ 'ndl-in-loading': isRunningPrompt,
144
+ }), children: (0, jsx_runtime_1.jsxs)(react_1.Tooltip, { type: "simple", isDisabled: isDisabled || isRunningPrompt, hoverDelay: { close: 0, open: 500 }, shouldCloseOnReferenceClick: true, children: [(0, jsx_runtime_1.jsx)(react_1.Tooltip.Trigger, { hasButtonWrapper: true, children: (0, jsx_runtime_1.jsx)("button", { style: {
145
+ borderRadius: isRunningPrompt
146
+ ? 'var(--border-radius-sm)'
147
+ : 'var(--border-radius-lg)',
148
+ }, onClick: isRunningPrompt ? onCancel : onSubmit, disabled: isDisabled, "aria-label": isRunningPrompt ? 'Stop' : 'Send', children: isRunningPrompt === true ? ((0, jsx_runtime_1.jsx)(react_1.OutlinedButton, { as: "div", variant: "neutral", className: "ndl-ai-prompt-stop-button", size: "small", isDisabled: isDisabled, leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.StopIconOutline, {}), children: "Stop" })) : ((0, jsx_runtime_1.jsx)(react_1.CleanIconButton, { description: "Send", as: "div", className: "ndl-ai-prompt-submit-button", size: "medium", isDisabled: isDisabled, htmlAttributes: {
149
+ 'aria-pressed': undefined,
150
+ }, children: (0, jsx_runtime_1.jsx)(icons_1.ArrowSmallUpIconOutline, {}) })) }) }), (0, jsx_runtime_1.jsx)(react_1.Tooltip.Content, { children: "Send" })] }) }));
149
151
  };
150
152
  const AgentSelect = ({ value, options = [], onChange }) => {
151
153
  var _a, _b, _c;
@@ -1 +1 @@
1
- {"version":3,"file":"Prompt.js","sourceRoot":"","sources":["../../../../src/ai/prompt/Prompt.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAM0B;AAC1B,kDAKgC;AAChC,4DAAoC;AACpC,iCAAiE;AAiCjE;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,CAAC,EAiBS,EAAE,EAAE;QAjBb,EACvB,KAAK,EACL,QAAQ,EACR,OAAO,GAAG,CAAC,EACX,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,EAD7B,SAAS,cAhBW,wNAiBxB,CADa;IAEZ,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAEvD,MAAM,WAAW,GAAG,IAAA,cAAM,EAAsB,IAAI,CAAC,CAAC;IACtD,MAAM,gBAAgB,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IACtD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,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EAC5D,uBAAC,kBAAU,IACT,OAAO,EAAC,aAAa,EACrB,SAAS,EAAC,gCAAgC,EAC1C,GAAG,EAAE,OAAO,YAEX,QAAQ,GACE,EAEb,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,gBACJ,mBAAmB,QAAQ,EAAE,EACzC,SAAS,EAAC,wCAAwC,YAElD,uBAAC,wBAAgB,IAAC,SAAS,EAAC,gCAAgC,GAAG,GACxD,IACL,GACU,EAClB,uBAAC,eAAO,CAAC,OAAO,cAAE,QAAQ,GAAmB,IACrC,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,UAAU,EAAE,UAAU;IACtB,MAAM,EAAE,WAAW;CACpB,CAAC,CAAC;AAEM,wBAAM","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport {\n CleanIconButton,\n DropdownButton,\n Menu,\n Tooltip,\n Typography,\n} from '@neo4j-ndl/react';\nimport {\n ArrowSendIcon,\n ArrowSmallUpIconOutline,\n StopCircleIconOutline,\n XMarkIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nimport type { CommonProps, HtmlAttributes } from '../../_common/types';\n\ntype PromptProps = {\n /** The prompt text */\n value?: React.ComponentPropsWithoutRef<'textarea'>['value'];\n /** Callback function called when the prompt text changes */\n onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;\n /** Whether the submit button is disabled */\n isSubmitDisabled?: boolean;\n /** Maximum number of rows the textarea can expand to */\n maxRows?: number;\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 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\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}px`;\n } else {\n ta.style.overflowY = 'auto';\n ta.style.height = `${maxHeight}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 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 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 <SumbitPromptButton\n isDisabled={isSubmitDisabled}\n isRunningPrompt={isRunningPrompt}\n onSubmit={onSubmitPrompt}\n onCancel={onCancelPrompt}\n />\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 SumbitPromptButton = ({\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 const description = isRunningPrompt === true ? 'Cancel' : 'Send';\n\n return (\n <CleanIconButton\n className=\"ndl-ai-prompt-submit-button\"\n description={description}\n size=\"medium\"\n onClick={isRunningPrompt === true ? onCancel : onSubmit}\n isDisabled={isDisabled}\n >\n <ArrowSmallUpIconOutline\n style={{\n opacity: isRunningPrompt === true ? 0 : 1,\n position: isRunningPrompt === true ? 'absolute' : 'relative',\n transform:\n isRunningPrompt === true ? 'translateY(-8px)' : 'translateY(0)',\n }}\n />\n <StopCircleIconOutline\n style={{\n opacity: isRunningPrompt === true ? 1 : 0,\n position: isRunningPrompt === true ? 'relative' : 'absolute',\n }}\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"]}
1
+ {"version":3,"file":"Prompt.js","sourceRoot":"","sources":["../../../../src/ai/prompt/Prompt.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4CAQ0B;AAC1B,kDAKgC;AAChC,4DAAoC;AACpC,iCAAiE;AAiCjE;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,CAAC,EAiBS,EAAE,EAAE;QAjBb,EACvB,KAAK,EACL,QAAQ,EACR,OAAO,GAAG,CAAC,EACX,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,EAD7B,SAAS,cAhBW,wNAiBxB,CADa;IAEZ,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAEvD,MAAM,WAAW,GAAG,IAAA,cAAM,EAAsB,IAAI,CAAC,CAAC;IACtD,MAAM,gBAAgB,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IACtD,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAEhD,0BAA0B;IAC1B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,KAAK,GAAkB,IAAI,CAAC;QA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MAAM,WAAW,GACf,CAAA,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW;qBAC5B,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,CAAA;oBAC5B,OAAO,CAAC,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;gBAC5D,IAAI,WAAW,EAAE,CAAC;oBAChB,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,gBAAgB,CAAC,KAAK,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC,EACD,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,aAEnC,uBAAC,eAAO,CAAC,OAAO,IAAC,gBAAgB,kBAC/B,iCAAK,SAAS,EAAC,2BAA2B,aACxC,uBAAC,qBAAa,IAAC,SAAS,EAAC,gCAAgC,GAAG,EAC5D,uBAAC,kBAAU,IACT,OAAO,EAAC,aAAa,EACrB,SAAS,EAAC,gCAAgC,EAC1C,GAAG,EAAE,OAAO,YAEX,QAAQ,GACE,EAEb,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,gBACJ,mBAAmB,QAAQ,EAAE,EACzC,SAAS,EAAC,wCAAwC,YAElD,uBAAC,wBAAgB,IAAC,SAAS,EAAC,gCAAgC,GAAG,GACxD,IACL,GACU,EAClB,uBAAC,eAAO,CAAC,OAAO,cAAE,QAAQ,GAAmB,IACrC,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,UAAU,EAAE,UAAU;IACtB,MAAM,EAAE,WAAW;CACpB,CAAC,CAAC;AAEM,wBAAM","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport {\n CleanIconButton,\n DropdownButton,\n 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 /** Whether the submit button is disabled */\n isSubmitDisabled?: boolean;\n /** Maximum number of rows the textarea can expand to */\n maxRows?: number;\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 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\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}px`;\n } else {\n ta.style.overflowY = 'auto';\n ta.style.height = `${maxHeight}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 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 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 isDisabled={isDisabled}\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"]}
@@ -23,18 +23,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23
23
  return (mod && mod.__esModule) ? mod : { "default": mod };
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.PromptContextSrc = exports.PromptAdvancedSrc = exports.PromptDefaultSrc = exports.PromptContext = exports.PromptAdvanced = exports.PromptDefault = void 0;
26
+ exports.PromptContextSrc = exports.PromptLoadingSrc = exports.PromptAdvancedSrc = exports.PromptDefaultSrc = exports.PromptContext = exports.PromptLoading = exports.PromptAdvanced = exports.PromptDefault = void 0;
27
27
  var prompt_default_story_1 = require("./prompt-default.story");
28
28
  Object.defineProperty(exports, "PromptDefault", { enumerable: true, get: function () { return __importDefault(prompt_default_story_1).default; } });
29
29
  var prompt_advanced_story_1 = require("./prompt-advanced.story");
30
30
  Object.defineProperty(exports, "PromptAdvanced", { enumerable: true, get: function () { return __importDefault(prompt_advanced_story_1).default; } });
31
+ var prompt_loading_story_1 = require("./prompt-loading.story");
32
+ Object.defineProperty(exports, "PromptLoading", { enumerable: true, get: function () { return __importDefault(prompt_loading_story_1).default; } });
31
33
  var prompt_context_story_1 = require("./prompt-context.story");
32
34
  Object.defineProperty(exports, "PromptContext", { enumerable: true, get: function () { return __importDefault(prompt_context_story_1).default; } });
33
35
  const export_stories_utils_1 = require("../../../_common/export-stories-utils");
34
36
  const prompt_advanced_story_raw_1 = __importDefault(require("./prompt-advanced.story?raw"));
35
37
  const prompt_context_story_raw_1 = __importDefault(require("./prompt-context.story?raw"));
36
38
  const prompt_default_story_raw_1 = __importDefault(require("./prompt-default.story?raw"));
39
+ const prompt_loading_story_raw_1 = __importDefault(require("./prompt-loading.story?raw"));
37
40
  exports.PromptDefaultSrc = (0, export_stories_utils_1.removeLicenseHeader)(prompt_default_story_raw_1.default);
38
41
  exports.PromptAdvancedSrc = (0, export_stories_utils_1.removeLicenseHeader)(prompt_advanced_story_raw_1.default);
42
+ exports.PromptLoadingSrc = (0, export_stories_utils_1.removeLicenseHeader)(prompt_loading_story_raw_1.default);
39
43
  exports.PromptContextSrc = (0, export_stories_utils_1.removeLicenseHeader)(prompt_context_story_raw_1.default);
40
44
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AACjC,iEAAoE;AAA3D,wIAAA,OAAO,OAAkB;AAClC,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AAEjC,gFAA4E;AAC5E,4FAA+D;AAC/D,0FAA6D;AAC7D,0FAA6D;AAEhD,QAAA,gBAAgB,GAAG,IAAA,0CAAmB,EAAC,kCAAmB,CAAC,CAAC;AAC5D,QAAA,iBAAiB,GAAG,IAAA,0CAAmB,EAAC,mCAAoB,CAAC,CAAC;AAC9D,QAAA,gBAAgB,GAAG,IAAA,0CAAmB,EAAC,kCAAmB,CAAC,CAAC","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 PromptContext } from './prompt-context.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';\n\nexport const PromptDefaultSrc = removeLicenseHeader(PromptDefaultSrcRaw);\nexport const PromptAdvancedSrc = removeLicenseHeader(PromptAdvancedSrcRaw);\nexport const PromptContextSrc = removeLicenseHeader(PromptContextSrcRaw);\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AACjC,iEAAoE;AAA3D,wIAAA,OAAO,OAAkB;AAClC,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AACjC,+DAAkE;AAAzD,sIAAA,OAAO,OAAiB;AAEjC,gFAA4E;AAC5E,4FAA+D;AAC/D,0FAA6D;AAC7D,0FAA6D;AAC7D,0FAA6D;AAEhD,QAAA,gBAAgB,GAAG,IAAA,0CAAmB,EAAC,kCAAmB,CAAC,CAAC;AAC5D,QAAA,iBAAiB,GAAG,IAAA,0CAAmB,EAAC,mCAAoB,CAAC,CAAC;AAC9D,QAAA,gBAAgB,GAAG,IAAA,0CAAmB,EAAC,kCAAmB,CAAC,CAAC;AAC5D,QAAA,gBAAgB,GAAG,IAAA,0CAAmB,EAAC,kCAAmB,CAAC,CAAC","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';\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 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);\n"]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const ai_1 = require("@neo4j-ndl/react/ai");
26
+ const react_1 = require("react");
27
+ const Component = () => {
28
+ const [isRunningPrompt, setIsRunningPrompt] = (0, react_1.useState)(true);
29
+ return ((0, jsx_runtime_1.jsx)(ai_1.Prompt, { isRunningPrompt: isRunningPrompt, onSubmitPrompt: () => setIsRunningPrompt(true), onCancelPrompt: () => setIsRunningPrompt(false) }));
30
+ };
31
+ exports.default = Component;
32
+ //# sourceMappingURL=prompt-loading.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-loading.story.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt-loading.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAA6C;AAC7C,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAE7D,OAAO,CACL,uBAAC,WAAM,IACL,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAC9C,cAAc,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAC/C,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { Prompt } from '@neo4j-ndl/react/ai';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isRunningPrompt, setIsRunningPrompt] = useState(true);\n\n return (\n <Prompt\n isRunningPrompt={isRunningPrompt}\n onSubmitPrompt={() => setIsRunningPrompt(true)}\n onCancelPrompt={() => setIsRunningPrompt(false)}\n />\n );\n};\n\nexport default Component;\n"]}
@@ -21,7 +21,7 @@
21
21
 
22
22
  "use strict";
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.WithContext = exports.Advanced = exports.Basic = void 0;
24
+ exports.WithContext = exports.Loading = exports.Advanced = exports.Basic = void 0;
25
25
  const Prompt_1 = require("../Prompt");
26
26
  const _1 = require(".");
27
27
  const componentMeta = {
@@ -60,6 +60,21 @@ exports.Advanced = {
60
60
  },
61
61
  render: _1.PromptAdvanced,
62
62
  };
63
+ exports.Loading = {
64
+ args: {},
65
+ parameters: {
66
+ docs: {
67
+ source: {
68
+ // TODO: this one is too animated to snapshot. We'll cover it with Happo later instead
69
+ chromatic: { disableSnapshot: true },
70
+ code: _1.PromptLoadingSrc,
71
+ language: 'tsx',
72
+ type: 'code',
73
+ },
74
+ },
75
+ },
76
+ render: _1.PromptLoading,
77
+ };
63
78
  exports.WithContext = {
64
79
  args: {},
65
80
  parameters: {
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.stories.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt.stories.tsx"],"names":[],"mappings":";;;AAsBA,sCAAmC;AACnC,wBAOW;AAEX,MAAM,aAAa,GAAwB;IACzC,SAAS,EAAE,eAAM;IACjB,EAAE,EAAE,sBAAsB;IAC1B,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,sBAAsB;CAC9B,CAAC;AAEF,kBAAe,aAAa,CAAC;AAIhB,QAAA,KAAK,GAAU;IAC1B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,mBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,gBAAa;CACtB,CAAC;AAEW,QAAA,QAAQ,GAAU;IAC7B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,oBAAiB;gBACvB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,iBAAc;CACvB,CAAC;AAEW,QAAA,WAAW,GAAU;IAChC,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,mBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,gBAAa;CACtB,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 { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Prompt } from '../Prompt';\nimport {\n PromptAdvanced,\n PromptAdvancedSrc,\n PromptContext,\n PromptContextSrc,\n PromptDefault,\n PromptDefaultSrc,\n} from '.';\n\nconst componentMeta: Meta<typeof Prompt> = {\n component: Prompt,\n id: 'components-ai-prompt',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/AI/Prompt',\n};\n\nexport default componentMeta;\n\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Basic: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: PromptDefaultSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptDefault,\n};\n\nexport const Advanced: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: PromptAdvancedSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptAdvanced,\n};\n\nexport const WithContext: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: PromptContextSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptContext,\n};\n"]}
1
+ {"version":3,"file":"prompt.stories.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt.stories.tsx"],"names":[],"mappings":";;;AAsBA,sCAAmC;AACnC,wBASW;AAEX,MAAM,aAAa,GAAwB;IACzC,SAAS,EAAE,eAAM;IACjB,EAAE,EAAE,sBAAsB;IAC1B,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,sBAAsB;CAC9B,CAAC;AAEF,kBAAe,aAAa,CAAC;AAIhB,QAAA,KAAK,GAAU;IAC1B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,mBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,gBAAa;CACtB,CAAC;AAEW,QAAA,QAAQ,GAAU;IAC7B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,oBAAiB;gBACvB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,iBAAc;CACvB,CAAC;AAEW,QAAA,OAAO,GAAU;IAC5B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,sFAAsF;gBACtF,SAAS,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE;gBACpC,IAAI,EAAE,mBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,gBAAa;CACtB,CAAC;AAEW,QAAA,WAAW,GAAU;IAChC,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,mBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,gBAAa;CACtB,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 { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Prompt } from '../Prompt';\nimport {\n PromptAdvanced,\n PromptAdvancedSrc,\n PromptContext,\n PromptContextSrc,\n PromptDefault,\n PromptDefaultSrc,\n PromptLoading,\n PromptLoadingSrc,\n} from '.';\n\nconst componentMeta: Meta<typeof Prompt> = {\n component: Prompt,\n id: 'components-ai-prompt',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/AI/Prompt',\n};\n\nexport default componentMeta;\n\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Basic: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: PromptDefaultSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptDefault,\n};\n\nexport const Advanced: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: PromptAdvancedSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptAdvanced,\n};\n\nexport const Loading: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n // TODO: this one is too animated to snapshot. We'll cover it with Happo later instead\n chromatic: { disableSnapshot: true },\n code: PromptLoadingSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptLoading,\n};\n\nexport const WithContext: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: PromptContextSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptContext,\n};\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, Menu, Tooltip, Typography, } from '@neo4j-ndl/react';
34
- import { ArrowSendIcon, ArrowSmallUpIconOutline, StopCircleIconOutline, XMarkIconOutline, } from '@neo4j-ndl/react/icons';
33
+ import { CleanIconButton, DropdownButton, LoadingSpinner, Menu, OutlinedButton, Tooltip, Typography, } from '@neo4j-ndl/react';
34
+ import { ArrowSendIcon, ArrowSmallUpIconOutline, StopIconOutline, XMarkIconOutline, } from '@neo4j-ndl/react/icons';
35
35
  import classNames from 'classnames';
36
36
  import { useCallback, useEffect, useRef, useState } from 'react';
37
37
  /**
@@ -119,27 +119,29 @@ const PromptComponent = (_a) => {
119
119
  adjustTextareaHeight();
120
120
  onChange === null || onChange === void 0 ? void 0 : onChange(e);
121
121
  };
122
- return (_jsxs("div", Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [_jsx("div", { className: "ndl-ai-prompt-wrapper", 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, onKeyDown: (e) => {
123
- if (e.key === 'Enter' &&
124
- !e.shiftKey &&
125
- isSubmitDisabled !== true) {
126
- e.preventDefault();
127
- if (isRunningPrompt !== true) {
128
- onSubmitPrompt === null || onSubmitPrompt === void 0 ? void 0 : onSubmitPrompt(e);
122
+ 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', {
123
+ 'ndl-expanded': isRunningPrompt,
124
+ }), "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, onKeyDown: (e) => {
125
+ if (e.key === 'Enter' &&
126
+ !e.shiftKey &&
127
+ isSubmitDisabled !== true) {
128
+ e.preventDefault();
129
+ if (isRunningPrompt !== true) {
130
+ onSubmitPrompt === null || onSubmitPrompt === void 0 ? void 0 : onSubmitPrompt(e);
131
+ }
129
132
  }
130
- }
131
- } }, textareaProps)), _jsxs("div", { className: "ndl-ai-prompt-textarea-below", children: [Boolean(bottomContent) && (_jsx("div", { className: "ndl-ai-prompt-textarea-below-leading", children: bottomContent })), _jsx(SumbitPromptButton, { isDisabled: isSubmitDisabled, isRunningPrompt: isRunningPrompt, onSubmit: onSubmitPrompt, onCancel: onCancelPrompt })] })] }) }), Boolean(disclaimer) && (_jsx(Typography, { variant: "body-small", className: "ndl-ai-prompt-footer", children: disclaimer }))] })));
133
+ } }, 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 }))] })));
132
134
  };
133
- const SumbitPromptButton = ({ onSubmit, onCancel, isDisabled, isRunningPrompt, }) => {
134
- const description = isRunningPrompt === true ? 'Cancel' : 'Send';
135
- return (_jsxs(CleanIconButton, { className: "ndl-ai-prompt-submit-button", description: description, size: "medium", onClick: isRunningPrompt === true ? onCancel : onSubmit, isDisabled: isDisabled, children: [_jsx(ArrowSmallUpIconOutline, { style: {
136
- opacity: isRunningPrompt === true ? 0 : 1,
137
- position: isRunningPrompt === true ? 'absolute' : 'relative',
138
- transform: isRunningPrompt === true ? 'translateY(-8px)' : 'translateY(0)',
139
- } }), _jsx(StopCircleIconOutline, { style: {
140
- opacity: isRunningPrompt === true ? 1 : 0,
141
- position: isRunningPrompt === true ? 'relative' : 'absolute',
142
- } })] }));
135
+ const SubmitPromptButton = ({ onSubmit, onCancel, isDisabled, isRunningPrompt, }) => {
136
+ return (_jsx("div", { className: classNames('ndl-ai-prompt-button-container', {
137
+ 'ndl-in-loading': isRunningPrompt,
138
+ }), children: _jsxs(Tooltip, { type: "simple", isDisabled: isDisabled || isRunningPrompt, hoverDelay: { close: 0, open: 500 }, shouldCloseOnReferenceClick: true, children: [_jsx(Tooltip.Trigger, { hasButtonWrapper: true, children: _jsx("button", { style: {
139
+ borderRadius: isRunningPrompt
140
+ ? 'var(--border-radius-sm)'
141
+ : 'var(--border-radius-lg)',
142
+ }, 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", isDisabled: isDisabled, leadingVisual: _jsx(StopIconOutline, {}), children: "Stop" })) : (_jsx(CleanIconButton, { description: "Send", as: "div", className: "ndl-ai-prompt-submit-button", size: "medium", isDisabled: isDisabled, htmlAttributes: {
143
+ 'aria-pressed': undefined,
144
+ }, children: _jsx(ArrowSmallUpIconOutline, {}) })) }) }), _jsx(Tooltip.Content, { children: "Send" })] }) }));
143
145
  };
144
146
  const AgentSelect = ({ value, options = [], onChange }) => {
145
147
  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,IAAI,EACJ,OAAO,EACP,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC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":["/**\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 /** Whether the submit button is disabled */\n isSubmitDisabled?: boolean;\n /** Maximum number of rows the textarea can expand to */\n maxRows?: number;\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 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\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}px`;\n } else {\n ta.style.overflowY = 'auto';\n ta.style.height = `${maxHeight}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 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 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 <SumbitPromptButton\n isDisabled={isSubmitDisabled}\n isRunningPrompt={isRunningPrompt}\n onSubmit={onSubmitPrompt}\n onCancel={onCancelPrompt}\n />\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 SumbitPromptButton = ({\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 const description = isRunningPrompt === true ? 'Cancel' : 'Send';\n\n return (\n <CleanIconButton\n className=\"ndl-ai-prompt-submit-button\"\n description={description}\n size=\"medium\"\n onClick={isRunningPrompt === true ? onCancel : onSubmit}\n isDisabled={isDisabled}\n >\n <ArrowSmallUpIconOutline\n style={{\n opacity: isRunningPrompt === true ? 0 : 1,\n position: isRunningPrompt === true ? 'absolute' : 'relative',\n transform:\n isRunningPrompt === true ? 'translateY(-8px)' : 'translateY(0)',\n }}\n />\n <StopCircleIconOutline\n style={{\n opacity: isRunningPrompt === true ? 1 : 0,\n position: isRunningPrompt === true ? 'relative' : 'absolute',\n }}\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"]}
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,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,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 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 /** Whether the submit button is disabled */\n isSubmitDisabled?: boolean;\n /** Maximum number of rows the textarea can expand to */\n maxRows?: number;\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 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\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}px`;\n } else {\n ta.style.overflowY = 'auto';\n ta.style.height = `${maxHeight}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 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 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 isDisabled={isDisabled}\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"]}
@@ -20,12 +20,15 @@
20
20
  */
21
21
  export { default as PromptDefault } from './prompt-default.story';
22
22
  export { default as PromptAdvanced } from './prompt-advanced.story';
23
+ export { default as PromptLoading } from './prompt-loading.story';
23
24
  export { default as PromptContext } from './prompt-context.story';
24
25
  import { removeLicenseHeader } from '../../../_common/export-stories-utils';
25
26
  import PromptAdvancedSrcRaw from './prompt-advanced.story?raw';
26
27
  import PromptContextSrcRaw from './prompt-context.story?raw';
27
28
  import PromptDefaultSrcRaw from './prompt-default.story?raw';
29
+ import PromptLoadingSrcRaw from './prompt-loading.story?raw';
28
30
  export const PromptDefaultSrc = removeLicenseHeader(PromptDefaultSrcRaw);
29
31
  export const PromptAdvancedSrc = removeLicenseHeader(PromptAdvancedSrcRaw);
32
+ export const PromptLoadingSrc = removeLicenseHeader(PromptLoadingSrcRaw);
30
33
  export const PromptContextSrc = removeLicenseHeader(PromptContextSrcRaw);
31
34
  //# 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;AAElE,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;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","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 PromptContext } from './prompt-context.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';\n\nexport const PromptDefaultSrc = removeLicenseHeader(PromptDefaultSrcRaw);\nexport const PromptAdvancedSrc = removeLicenseHeader(PromptAdvancedSrcRaw);\nexport const PromptContextSrc = removeLicenseHeader(PromptContextSrcRaw);\n"]}
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;AAElE,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,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","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';\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 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);\n"]}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } 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 { Prompt } from '@neo4j-ndl/react/ai';
24
+ import { useState } from 'react';
25
+ const Component = () => {
26
+ const [isRunningPrompt, setIsRunningPrompt] = useState(true);
27
+ return (_jsx(Prompt, { isRunningPrompt: isRunningPrompt, onSubmitPrompt: () => setIsRunningPrompt(true), onCancelPrompt: () => setIsRunningPrompt(false) }));
28
+ };
29
+ export default Component;
30
+ //# sourceMappingURL=prompt-loading.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-loading.story.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt-loading.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAE7D,OAAO,CACL,KAAC,MAAM,IACL,eAAe,EAAE,eAAe,EAChC,cAAc,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAC9C,cAAc,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAC/C,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 { Prompt } from '@neo4j-ndl/react/ai';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isRunningPrompt, setIsRunningPrompt] = useState(true);\n\n return (\n <Prompt\n isRunningPrompt={isRunningPrompt}\n onSubmitPrompt={() => setIsRunningPrompt(true)}\n onCancelPrompt={() => setIsRunningPrompt(false)}\n />\n );\n};\n\nexport default Component;\n"]}
@@ -20,7 +20,7 @@
20
20
  */
21
21
 
22
22
  import { Prompt } from '../Prompt';
23
- import { PromptAdvanced, PromptAdvancedSrc, PromptContext, PromptContextSrc, PromptDefault, PromptDefaultSrc, } from '.';
23
+ import { PromptAdvanced, PromptAdvancedSrc, PromptContext, PromptContextSrc, PromptDefault, PromptDefaultSrc, PromptLoading, PromptLoadingSrc, } from '.';
24
24
  const componentMeta = {
25
25
  component: Prompt,
26
26
  id: 'components-ai-prompt',
@@ -57,6 +57,21 @@ export const Advanced = {
57
57
  },
58
58
  render: PromptAdvanced,
59
59
  };
60
+ export const Loading = {
61
+ args: {},
62
+ parameters: {
63
+ docs: {
64
+ source: {
65
+ // TODO: this one is too animated to snapshot. We'll cover it with Happo later instead
66
+ chromatic: { disableSnapshot: true },
67
+ code: PromptLoadingSrc,
68
+ language: 'tsx',
69
+ type: 'code',
70
+ },
71
+ },
72
+ },
73
+ render: PromptLoading,
74
+ };
60
75
  export const WithContext = {
61
76
  args: {},
62
77
  parameters: {
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.stories.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt.stories.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,GAAG,CAAC;AAEX,MAAM,aAAa,GAAwB;IACzC,SAAS,EAAE,MAAM;IACjB,EAAE,EAAE,sBAAsB;IAC1B,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,sBAAsB;CAC9B,CAAC;AAEF,eAAe,aAAa,CAAC;AAI7B,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,aAAa;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,iBAAiB;gBACvB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,cAAc;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAU;IAChC,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,aAAa;CACtB,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 { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Prompt } from '../Prompt';\nimport {\n PromptAdvanced,\n PromptAdvancedSrc,\n PromptContext,\n PromptContextSrc,\n PromptDefault,\n PromptDefaultSrc,\n} from '.';\n\nconst componentMeta: Meta<typeof Prompt> = {\n component: Prompt,\n id: 'components-ai-prompt',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/AI/Prompt',\n};\n\nexport default componentMeta;\n\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Basic: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: PromptDefaultSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptDefault,\n};\n\nexport const Advanced: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: PromptAdvancedSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptAdvanced,\n};\n\nexport const WithContext: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: PromptContextSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptContext,\n};\n"]}
1
+ {"version":3,"file":"prompt.stories.js","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt.stories.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,GACjB,MAAM,GAAG,CAAC;AAEX,MAAM,aAAa,GAAwB;IACzC,SAAS,EAAE,MAAM;IACjB,EAAE,EAAE,sBAAsB;IAC1B,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,sBAAsB;CAC9B,CAAC;AAEF,eAAe,aAAa,CAAC;AAI7B,MAAM,CAAC,MAAM,KAAK,GAAU;IAC1B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,aAAa;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,iBAAiB;gBACvB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,cAAc;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,sFAAsF;gBACtF,SAAS,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE;gBACpC,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,aAAa;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAU;IAChC,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,gBAAgB;gBACtB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,aAAa;CACtB,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 { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Prompt } from '../Prompt';\nimport {\n PromptAdvanced,\n PromptAdvancedSrc,\n PromptContext,\n PromptContextSrc,\n PromptDefault,\n PromptDefaultSrc,\n PromptLoading,\n PromptLoadingSrc,\n} from '.';\n\nconst componentMeta: Meta<typeof Prompt> = {\n component: Prompt,\n id: 'components-ai-prompt',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/AI/Prompt',\n};\n\nexport default componentMeta;\n\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Basic: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: PromptDefaultSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptDefault,\n};\n\nexport const Advanced: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: PromptAdvancedSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptAdvanced,\n};\n\nexport const Loading: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n // TODO: this one is too animated to snapshot. We'll cover it with Happo later instead\n chromatic: { disableSnapshot: true },\n code: PromptLoadingSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptLoading,\n};\n\nexport const WithContext: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: PromptContextSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: PromptContext,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Prompt.d.ts","sourceRoot":"","sources":["../../../../src/ai/prompt/Prompt.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAkBH,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEvE,KAAK,WAAW,GAAG;IACjB,sBAAsB;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;IAC5D,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC/D,4CAA4C;IAC5C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,iEAAiE;IACjE,cAAc,CAAC,EAAE,CACf,CAAC,EACG,KAAK,CAAC,aAAa,CAAC,mBAAmB,CAAC,GAC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,EAAE,KAAK,CAAC,SAAS,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1D,QAAQ,EAAE,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACvE,CAAC;AA8CF,KAAK,eAAe,GAAG;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAmDF,QAAA,MAAM,MAAM,gNA9VT,WAAW,CAAC,KAAK,EAAE,WAAW,CAAC;wCA6SS,eAAe;2CAjDF,gBAAgB;CAqGtE,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -20,8 +20,10 @@
20
20
  */
21
21
  export { default as PromptDefault } from './prompt-default.story';
22
22
  export { default as PromptAdvanced } from './prompt-advanced.story';
23
+ export { default as PromptLoading } from './prompt-loading.story';
23
24
  export { default as PromptContext } from './prompt-context.story';
24
25
  export declare const PromptDefaultSrc: string;
25
26
  export declare const PromptAdvancedSrc: string;
27
+ export declare const PromptLoadingSrc: string;
26
28
  export declare const PromptContextSrc: string;
27
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","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;AAOlE,eAAO,MAAM,gBAAgB,QAA2C,CAAC;AACzE,eAAO,MAAM,iBAAiB,QAA4C,CAAC;AAC3E,eAAO,MAAM,gBAAgB,QAA2C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","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;AAQlE,eAAO,MAAM,gBAAgB,QAA2C,CAAC;AACzE,eAAO,MAAM,iBAAiB,QAA4C,CAAC;AAC3E,eAAO,MAAM,gBAAgB,QAA2C,CAAC;AACzE,eAAO,MAAM,gBAAgB,QAA2C,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
22
+ declare const Component: () => import("react/jsx-runtime").JSX.Element;
23
+ export default Component;
24
+ //# sourceMappingURL=prompt-loading.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-loading.story.d.ts","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt-loading.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAKjD,QAAA,MAAM,SAAS,+CAUd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -25,5 +25,6 @@ export default componentMeta;
25
25
  type Story = StoryObj<typeof componentMeta>;
26
26
  export declare const Basic: Story;
27
27
  export declare const Advanced: Story;
28
+ export declare const Loading: Story;
28
29
  export declare const WithContext: Story;
29
30
  //# sourceMappingURL=prompt.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.stories.d.ts","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt.stories.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAUnC,QAAA,MAAM,aAAa,EAAE,IAAI,CAAC,OAAO,MAAM,CAQtC,CAAC;AAEF,eAAe,aAAa,CAAC;AAE7B,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5C,eAAO,MAAM,KAAK,EAAE,KAYnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAYtB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAYzB,CAAC"}
1
+ {"version":3,"file":"prompt.stories.d.ts","sourceRoot":"","sources":["../../../../../src/ai/prompt/stories/prompt.stories.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAYnC,QAAA,MAAM,aAAa,EAAE,IAAI,CAAC,OAAO,MAAM,CAQtC,CAAC;AAEF,eAAe,aAAa,CAAC;AAE7B,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,aAAa,CAAC,CAAC;AAE5C,eAAO,MAAM,KAAK,EAAE,KAYnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAYtB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAcrB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAYzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react",
3
- "version": "4.6.1",
3
+ "version": "4.6.3",
4
4
  "sideEffects": false,
5
5
  "description": "React implementation of Neo4j Design System",
6
6
  "keywords": [
@@ -85,7 +85,7 @@
85
85
  "@tanstack/react-table": "8.21.3",
86
86
  "react": ">=19.0.0",
87
87
  "react-dom": ">=19.0.0",
88
- "@neo4j-ndl/base": "^4.6.1"
88
+ "@neo4j-ndl/base": "^4.6.3"
89
89
  },
90
90
  "dependencies": {
91
91
  "@dnd-kit/core": "6.3.1",