UNPKG

@mantine/core

Version:

React components library focused on usability, accessibility and developer experience

49 lines (48 loc) 1.95 kB
"use client"; require("../../../_virtual/_rolldown/runtime.cjs"); const require_use_props = require("../../../core/MantineProvider/use-props/use-props.cjs"); const require_factory = require("../../../core/factory/factory.cjs"); const require_Input = require("../../Input/Input.cjs"); const require_InputsGroupFieldset = require("../../../utils/InputsGroupFieldset/InputsGroupFieldset.cjs"); let react = require("react"); let _mantine_hooks = require("@mantine/hooks"); let react_jsx_runtime = require("react/jsx-runtime"); //#region packages/@mantine/core/src/components/Radio/RadioGroup/RadioGroup.tsx const RadioGroupContext = (0, react.createContext)(null); const RadioGroup = require_factory.genericFactory(((props) => { const { value, defaultValue, onChange, size, wrapperProps, children, name, readOnly, disabled, ...others } = require_use_props.useProps("RadioGroup", null, props); const _name = (0, _mantine_hooks.useId)(name); const [_value, setValue] = (0, _mantine_hooks.useUncontrolled)({ value, defaultValue, finalValue: "", onChange }); const handleChange = (event) => !readOnly && setValue(typeof event === "string" ? event : event.currentTarget.value); return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RadioGroupContext, { value: { value: _value, onChange: handleChange, size, name: _name, disabled }, children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Input.Input.Wrapper, { size, ...wrapperProps, ...others, labelElement: "div", __staticSelector: "RadioGroup", children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_InputsGroupFieldset.InputsGroupFieldset, { role: "radiogroup", children }) }) }); })); RadioGroup.classes = require_Input.Input.Wrapper.classes; RadioGroup.displayName = "@mantine/core/RadioGroup"; //#endregion exports.RadioGroup = RadioGroup; exports.RadioGroupContext = RadioGroupContext; //# sourceMappingURL=RadioGroup.cjs.map