UNPKG

taxonium-component

Version:

React component for exploring large phylogenetic trees in the browser

100 lines (99 loc) 3.05 kB
import { c as x, p as N } from "./index-DvVXAaWp.js"; import * as s from "react"; import e from "prop-types"; import { A as V, z as w, aG as I, aH as P, aI as U, F, I as M } from "./JBrowsePanel-ClL6pWQW.js"; import { a as S } from "./Radio-BumicwV1.js"; import { jsx as f } from "react/jsx-runtime"; function b(r) { return V("MuiRadioGroup", r); } w("MuiRadioGroup", ["root", "row", "error"]); const k = (r) => { const { classes: a, row: t, error: n } = r; return M({ root: ["root", t && "row", n && "error"] }, b, a); }, q = /* @__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, ...y } = a, u = s.useRef(null), C = k(a), [c, d] = I({ 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 v = P(t, u), p = U(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(S.Provider, { value: G, children: /* @__PURE__ */ f(F, { role: "radiogroup", ref: v, className: x(C.root, m), ...y, children: i }) }); }); N.env.NODE_ENV !== "production" && (q.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 { q as R }; //# sourceMappingURL=RadioGroup-BjfNaBEs.js.map