UNPKG

@neo4j-ndl/react

Version:

React implementation of Neo4j Design System

41 lines (40 loc) 2.28 kB
/** * * 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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { forwardRef } from 'react'; import { classNames } from '../_common/defaultImports'; import { default as ResizeCornerIcon } from '../icons/generated/custom/ResizeCorner'; /** * * * Widget Component * * */ export const Widget = forwardRef(function Widget({ header, subheader, leftMenu, rightMenu, isElevated = false, isResizeable = false, resizeableProps, children, className, htmlAttributes, }, ref) { var _a; const classes = classNames('ndl-widget', className, { 'ndl-leftmenu': leftMenu, 'ndl-elevated': isElevated, }); return (_jsxs("div", Object.assign({ className: classes, ref: ref }, htmlAttributes, { children: [_jsxs("header", { className: "ndl-header-wrapper", children: [_jsxs("div", { className: "ndl-header-left", children: [leftMenu, _jsxs("div", { className: "ndl-headers n-flex n-flex-col", children: [_jsx("div", { className: "ndl-header", children: header }), _jsx("div", { className: "ndl-subheader", children: subheader })] })] }), rightMenu] }), _jsx("div", { className: "ndl-widget-content n-flex-grow", children: children }), isResizeable && (_jsx("button", Object.assign({ "aria-label": "Resizing handle" }, resizeableProps, { className: `ndl-resize-handle ${(_a = resizeableProps === null || resizeableProps === void 0 ? void 0 : resizeableProps.className) !== null && _a !== void 0 ? _a : ''}`, children: _jsx(ResizeCornerIcon, {}) })))] }))); }); //# sourceMappingURL=Widget.js.map