UNPKG

@gpa-gemstone/react-forms

Version:
45 lines (44 loc) 2.63 kB
"use strict"; // ****************************************************************************************************** // HelpIcon.tsx - Gbtc // // Copyright © 2020, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this // file except in compliance with the License. You may obtain a copy of the License at: // // http://opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 02/19/2026 - Preston Crawford // Generated original version of source code. // // ****************************************************************************************************** Object.defineProperty(exports, "__esModule", { value: true }); var React = require("react"); var helper_functions_1 = require("@gpa-gemstone/helper-functions"); var gpa_symbols_1 = require("@gpa-gemstone/gpa-symbols"); var ToolTip_1 = require("./ToolTip"); /** * HelpIcon component. * Renders a question-mark icon that displays a tooltip on hover. */ var HelpIcon = function (props) { var _a, _b, _c; var _d = React.useState(false), showHelp = _d[0], setShowHelp = _d[1]; var guid = React.useRef((0, helper_functions_1.CreateGuid)()); if (props.Help == null || props.Help === '') return null; return (React.createElement(React.Fragment, null, React.createElement("span", { className: (_a = props.Class) !== null && _a !== void 0 ? _a : "ml-2 d-flex align-items-center", onMouseEnter: function () { return setShowHelp(true); }, onMouseLeave: function () { return setShowHelp(false); }, "data-tooltip": guid.current }, React.createElement(gpa_symbols_1.ReactIcons.QuestionMark, { Color: (_b = props.Color) !== null && _b !== void 0 ? _b : "var(--info)", Size: (_c = props.Size) !== null && _c !== void 0 ? _c : 20 })), React.createElement(ToolTip_1.default, { Show: showHelp, Target: guid.current, Class: "info", Position: "top" }, props.Help))); }; exports.default = HelpIcon;