UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

52 lines 3.56 kB
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; /** * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css'; import { CleanIconButton } from '@neo4j-ndl/react'; import { FileTag, ImageTag, Prompt } from '@neo4j-ndl/react/ai'; import { DocumentIconOutline, PlusIconOutline } from '@neo4j-ndl/react/icons'; import { useState } from 'react'; const Component = () => { const [isRunningPrompt, setIsRunningPrompt] = useState(false); const options = [ { label: 'Neo4j AI', value: 'neo4j' }, { label: 'Special Agent', value: 'special-agent' }, { label: 'Another Agent', value: 'another-agent' }, ]; const [selectedOption, setSelectedOption] = useState(options[0]); const [prompt, setPrompt] = useState(''); const handleSubmitPrompt = () => { setIsRunningPrompt(true); alert(`You submitted the following prompt: ${prompt}`); setPrompt(''); }; return (_jsx(Prompt, { isRunningPrompt: isRunningPrompt, value: prompt, onChange: (e) => setPrompt(e.target.value), onSubmitPrompt: handleSubmitPrompt, onCancelPrompt: () => setIsRunningPrompt(false), topContent: _jsxs(_Fragment, { children: [_jsx(FileTag, { isLoading: true, icon: _jsx(DocumentIconOutline, {}), fileName: "Science Fiction Bestsellers", fileType: "pdf", isRemovable: true, onClick: () => { console.info('remove file'); } }), _jsx(ImageTag, { isLoading: true, src: "https://plus.unsplash.com/premium_photo-1676496046182-356a6a0ed002?q=80&w=2952&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", alt: "Landscape image", fileName: "Landscape image", fileType: "jpg", isRemovable: true, onClick: () => { console.info('remove image'); } }), _jsx(FileTag, { icon: _jsx(DocumentIconOutline, {}), fileName: "Science Fiction Bestsellers", fileType: "pdf", isRemovable: true, onClick: () => { console.info('remove file'); } }), _jsx(ImageTag, { src: "https://plus.unsplash.com/premium_photo-1676496046182-356a6a0ed002?q=80&w=2952&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", alt: "Landscape image", fileName: "Landscape image", fileType: "jpg", isRemovable: true, onClick: () => { console.info('remove image'); } })] }), bottomContent: _jsx(_Fragment, { children: _jsx(CleanIconButton, { description: "Add stuff", size: "small", children: _jsx(PlusIconOutline, {}) }) }), bottomTrailingContent: _jsx(Prompt.Select, { value: selectedOption, options: options, onChange: setSelectedOption }) })); }; export default Component; //# sourceMappingURL=prompt-advanced.story.js.map