UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

54 lines 3.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("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/>. */ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css"); const react_1 = require("@neo4j-ndl/react"); const ai_1 = require("@neo4j-ndl/react/ai"); const icons_1 = require("@neo4j-ndl/react/icons"); const react_2 = require("react"); const Component = () => { const [isRunningPrompt, setIsRunningPrompt] = (0, react_2.useState)(false); const options = [ { label: 'Neo4j AI', value: 'neo4j' }, { label: 'Special Agent', value: 'special-agent' }, { label: 'Another Agent', value: 'another-agent' }, ]; const [selectedOption, setSelectedOption] = (0, react_2.useState)(options[0]); const [prompt, setPrompt] = (0, react_2.useState)(''); const handleSubmitPrompt = () => { setIsRunningPrompt(true); alert(`You submitted the following prompt: ${prompt}`); setPrompt(''); }; return ((0, jsx_runtime_1.jsx)(ai_1.Prompt, { isRunningPrompt: isRunningPrompt, value: prompt, onChange: (e) => setPrompt(e.target.value), onSubmitPrompt: handleSubmitPrompt, onCancelPrompt: () => setIsRunningPrompt(false), topContent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ai_1.FileTag, { isLoading: true, icon: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}), fileName: "Science Fiction Bestsellers", fileType: "pdf", isRemovable: true, onClick: () => { console.info('remove file'); } }), (0, jsx_runtime_1.jsx)(ai_1.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'); } }), (0, jsx_runtime_1.jsx)(ai_1.FileTag, { icon: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}), fileName: "Science Fiction Bestsellers", fileType: "pdf", isRemovable: true, onClick: () => { console.info('remove file'); } }), (0, jsx_runtime_1.jsx)(ai_1.ImageTag, { src: "https://plus.unsplash.com/premium_photo-1676496046182-356a6a0ed002?q=80&w=2952&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D", alt: "Landscape image", fileName: "Landscape image", fileType: "jpg", isRemovable: true, onClick: () => { console.info('remove image'); } })] }), bottomContent: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(react_1.CleanIconButton, { description: "Add stuff", size: "small", children: (0, jsx_runtime_1.jsx)(icons_1.PlusIconOutline, {}) }) }), bottomTrailingContent: (0, jsx_runtime_1.jsx)(ai_1.Prompt.Select, { value: selectedOption, options: options, onChange: setSelectedOption }) })); }; exports.default = Component; //# sourceMappingURL=prompt-advanced.story.js.map