UNPKG

taxonium-component

Version:

React component for exploring large phylogenetic trees in the browser

100 lines (99 loc) 3.06 kB
import { c as x, p as w } from "./index-CoM8QAjP.js"; import * as s from "react"; import e from "prop-types"; import { A as N, z as V, av as P, aw as U, ax as F, F as M, H as S } from "./JBrowsePanel-BNE3gNW1.js"; import { a as b } from "./Radio-Bf0n3fp_.js"; import { jsx as f } from "react/jsx-runtime"; function k(r) { return N("MuiRadioGroup", r); } V("MuiRadioGroup", ["root", "row", "error"]); const q = (r) => { const { classes: a, row: t, error: n } = r; return S({ root: ["root", t && "row", n && "error"] }, k, a); }, E = /* @__PURE__ */ s.forwardRef(function(a, t) { const { // private // eslint-disable-next-line react/prop-types actions: n, children: i, className: m, defaultValue: R, name: g, onChange: l, value: h, ...v } = a, u = s.useRef(null), y = q(a), [c, d] = P({ controlled: h, default: R, name: "RadioGroup" }); s.useImperativeHandle(n, () => ({ focus: () => { let o = u.current.querySelector("input:not(:disabled):checked"); o || (o = u.current.querySelector("input:not(:disabled)")), o && o.focus(); } }), []); const C = U(t, u), p = F(g), G = s.useMemo(() => ({ name: p, onChange(o) { d(o.target.value), l && l(o, o.target.value); }, value: c }), [p, l, d, c]); return /* @__PURE__ */ f(b.Provider, { value: G, children: /* @__PURE__ */ f(M, { role: "radiogroup", ref: C, className: x(y.root, m), ...v, children: i }) }); }); w.env.NODE_ENV !== "production" && (E.propTypes = { // ┌────────────────────────────── Warning ──────────────────────────────┐ // │ These PropTypes are generated from the TypeScript type definitions. │ // │ To update them, edit the d.ts file and run `pnpm proptypes`. │ // └─────────────────────────────────────────────────────────────────────┘ /** * The content of the component. */ children: e.node, /** * @ignore */ className: e.string, /** * The default value. Use when the component is not controlled. */ defaultValue: e.any, /** * The name used to reference the value of the control. * If you don't provide this prop, it falls back to a randomly generated name. */ name: e.string, /** * Callback fired when a radio button is selected. * * @param {React.ChangeEvent<HTMLInputElement>} event The event source of the callback. * @param {string} value The value of the selected radio button. * You can pull out the new value by accessing `event.target.value` (string). */ onChange: e.func, /** * Value of the selected radio button. The DOM API casts this to a string. */ value: e.any }); export { E as R }; //# sourceMappingURL=RadioGroup-VjVK5G6V.js.map