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, d as N } from "./index-dFotuATn.js"; import * as a from "react"; import e from "prop-types"; import { A as V, z as w, aG as I, aH as P, aI as U, F as E, I as F } from "./JBrowsePanel-uJIA-L6s.js"; import { a as M } from "./Radio-D7as17u0.js"; import { jsx as f } from "react/jsx-runtime"; function S(r) { return V("MuiRadioGroup", r); } w("MuiRadioGroup", ["root", "row", "error"]); const b = (r) => { const { classes: s, row: t, error: n } = r; return F({ root: ["root", t && "row", n && "error"] }, S, s); }, k = /* @__PURE__ */ a.forwardRef(function(s, 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 } = s, u = a.useRef(null), C = b(s), [c, d] = I({ controlled: h, default: R, name: "RadioGroup" }); a.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 = a.useMemo(() => ({ name: p, onChange(o) { d(o.target.value), l && l(o, o.target.value); }, value: c }), [p, l, d, c]); return /* @__PURE__ */ f(M.Provider, { value: G, children: /* @__PURE__ */ f(E, { role: "radiogroup", ref: v, className: x(C.root, m), ...y, children: i }) }); }); N.process.env.NODE_ENV !== "production" && (k.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 { k as R }; //# sourceMappingURL=RadioGroup-CXR2ISZ8.js.map