/** * Contains the select entry field renderer for fast prototyping * * The select entry field renderer is used for types, number, integer and string when * they have defined values * * @module */ import React, { useEffect, useRef } from "react"; import { IPropertyEntrySelectRendererProps } from "../../../internal/components/PropertyEntry/PropertyEntrySelect"; import Alert from '@mui/material/Alert'; import Typography from "@mui/material/Typography"; import InputLabel from "@mui/material/InputLabel"; import RestoreIcon from "@mui/icons-material/Restore"; import InputAdornment from "@mui/material/InputAdornment"; import Select, { SelectChangeEvent } from "@mui/material/Select"; import FilledInput from "@mui/material/FilledInput"; import OutlinedInput from "@mui/material/OutlinedInput"; import Input from "@mui/material/Input"; import Chip from "@mui/material/Chip"; import MenuItem from "@mui/material/MenuItem"; import Divider from "@mui/material/Divider"; import FormControl from "@mui/material/FormControl"; import ListItemText from "@mui/material/ListItemText"; import { ListItemIcon } from "@mui/material"; import Box from "@mui/system/Box"; import { RestoreIconButton } from "./general"; import ExpandMoreOutlinedIcon from '@mui/icons-material/ExpandMoreOutlined'; /** * A simple helper function that says when it should show invalid * @param props the renderer props * @returns a boolean on whether is invalid */ function shouldShowInvalid(props: IPropertyEntrySelectRendererProps) { return !props.currentValid; } function ForcefulRepairOfAriaLabelledByDueToMaterialUIBugNotWorking(props: any) { const ref = useRef(); useEffect(() => { // force the aria labelledby to be set to what it is intended to be set // material ui is jank const element = ref.current.querySelector("div[role]"); const id = element.id; element.setAttribute("aria-labelledby", (props["aria-labelledby"] || "") + " " + id); if (props["aria-describedby"]) { element.setAttribute("aria-describedby", props["aria-describedby"]); } else { element.removeAttribute("aria-describedby"); } }, [props]); return (