2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt odlux
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
19 import React from 'react';
20 import InputAdornment from '@mui/material/InputAdornment';
21 import Input, { InputProps } from '@mui/material/Input';
22 import Tooltip from '@mui/material/Tooltip';
23 import FormControl from '@mui/material/FormControl';
24 import InputLabel from '@mui/material/InputLabel';
25 import FormHelperText from '@mui/material/FormHelperText';
27 import makeStyles from '@mui/styles/makeStyles';
28 import createStyles from '@mui/styles/createStyles';
30 import { faAdjust } from '@fortawesome/free-solid-svg-icons/faAdjust';
31 import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
33 import { ViewElementBase } from '../models/uiModels';
35 const useStyles = makeStyles(() =>
50 type IfWhenProps = InputProps & {
52 element: ViewElementBase;
55 onChangeTooltipVisibility(value: boolean): void;
58 export const IfWhenTextInput = (props: IfWhenProps) => {
60 const { element, id, label, helperText: errorText, error, style, ...otherProps } = props;
61 const classes = useStyles();
63 const ifFeature = element.ifFeature
66 title={element.ifFeature}
68 onMouseMove={() => props.onChangeTooltipVisibility(false)}
69 onMouseOut={() => props.onChangeTooltipVisibility(true)}
71 <InputAdornment position="start">
72 <FontAwesomeIcon icon={faAdjust} className={classes.iconDark} />
78 const whenFeature = element.when
83 className={classes.padding}
84 onMouseMove={() => props.onChangeTooltipVisibility(false)}
85 onMouseOut={() => props.onChangeTooltipVisibility(true)}
87 <InputAdornment className={classes.padding} position="end">
88 <FontAwesomeIcon icon={faAdjust} className={classes.iconLight}/>
95 <FormControl variant="standard" error={error} style={style}>
96 <InputLabel htmlFor={id} >{label}</InputLabel>
97 <Input id={id} inputProps={{ 'aria-label': label + '-input' }} endAdornment={<div>{ifFeature}{whenFeature}</div>} {...otherProps} />
98 <FormHelperText>{errorText}</FormHelperText>