UNPKG

@etsoo/materialui

Version:

TypeScript Material-UI Implementation

25 lines (24 loc) 896 B
import { jsx as _jsx } from "react/jsx-runtime"; import { useAppContext } from "./app/ReactApp"; import { OptionGroup } from "./OptionGroup"; import { MUGlobal } from "./MUGlobal"; /** * OptionBool (yes/no) * @param props Props * @returns Component */ export function OptionBool(props) { // Destruct const { defaultValue = false, onValueChange, variant = MUGlobal.inputFieldVariant, ...rest } = props; // Global app const app = useAppContext(); // Options const options = app?.getBools() ?? []; // Layout return (_jsx(OptionGroup, { options: options, row: true, multiple: false, variant: variant, defaultValue: defaultValue.toString(), onValueChange: (value) => { if (onValueChange) { const v = value == "true" ? true : value == "false" ? false : undefined; onValueChange(v); } }, ...rest })); }