mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
1 line
10 KiB
JSON
1 line
10 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport FormGroup from '../FormGroup';\nimport useForkRef from '../utils/useForkRef';\nimport useControlled from '../utils/useControlled';\nimport RadioGroupContext from './RadioGroupContext';\nimport useId from '../utils/unstable_useId';\nvar RadioGroup = /*#__PURE__*/React.forwardRef(function RadioGroup(props, ref) {\n var actions = props.actions,\n children = props.children,\n nameProp = props.name,\n valueProp = props.value,\n onChange = props.onChange,\n other = _objectWithoutProperties(props, [\"actions\", \"children\", \"name\", \"value\", \"onChange\"]);\n\n var rootRef = React.useRef(null);\n\n var _useControlled = useControlled({\n controlled: valueProp,\n default: props.defaultValue,\n name: 'RadioGroup'\n }),\n _useControlled2 = _slicedToArray(_useControlled, 2),\n value = _useControlled2[0],\n setValue = _useControlled2[1];\n\n React.useImperativeHandle(actions, function () {\n return {\n focus: function focus() {\n var input = rootRef.current.querySelector('input:not(:disabled):checked');\n\n if (!input) {\n input = rootRef.current.querySelector('input:not(:disabled)');\n }\n\n if (input) {\n input.focus();\n }\n }\n };\n }, []);\n var handleRef = useForkRef(ref, rootRef);\n\n var handleChange = function handleChange(event) {\n setValue(event.target.value);\n\n if (onChange) {\n onChange(event, event.target.value);\n }\n };\n\n var name = useId(nameProp);\n return /*#__PURE__*/React.createElement(RadioGroupContext.Provider, {\n value: {\n name: name,\n onChange: handleChange,\n value: value\n }\n }, /*#__PURE__*/React.createElement(FormGroup, _extends({\n role: \"radiogroup\",\n ref: handleRef\n }, other), children));\n});\nprocess.env.NODE_ENV !== \"production\" ? RadioGroup.propTypes = {\n // ----------------------------- Warning --------------------------------\n // | These PropTypes are generated from the TypeScript type definitions |\n // | To update them edit the d.ts file and run \"yarn proptypes\" |\n // ----------------------------------------------------------------------\n\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n\n /**\n * The default `input` element value. Use when the component is not controlled.\n */\n defaultValue: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.number, PropTypes.string]),\n\n /**\n * The name used to reference the value of the control.\n * If you don't provide this prop, it falls back to a randomly generated name.\n */\n name: PropTypes.string,\n\n /**\n * Callback fired when a radio button is selected.\n *\n * @param {object} event The event source of the callback.\n * You can pull out the new value by accessing `event.target.value` (string).\n */\n onChange: PropTypes.func,\n\n /**\n * Value of the selected radio button. The DOM API casts this to a string.\n */\n value: PropTypes.any\n} : void 0;\nexport default RadioGroup;","map":{"version":3,"sources":["/app/node_modules/@material-ui/core/esm/RadioGroup/RadioGroup.js"],"names":["_extends","_slicedToArray","_objectWithoutProperties","React","PropTypes","FormGroup","useForkRef","useControlled","RadioGroupContext","useId","RadioGroup","forwardRef","props","ref","actions","children","nameProp","name","valueProp","value","onChange","other","rootRef","useRef","_useControlled","controlled","default","defaultValue","_useControlled2","setValue","useImperativeHandle","focus","input","current","querySelector","handleRef","handleChange","event","target","createElement","Provider","role","process","env","NODE_ENV","propTypes","node","oneOfType","arr
|