mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 09:25:15 +00:00
1 line
6.6 KiB
JSON
1 line
6.6 KiB
JSON
|
{"ast":null,"code":"/* eslint-disable react-hooks/rules-of-hooks, react-hooks/exhaustive-deps */\nimport * as React from 'react';\nexport default function useControlled(_ref) {\n var controlled = _ref.controlled,\n defaultProp = _ref.default,\n name = _ref.name,\n _ref$state = _ref.state,\n state = _ref$state === void 0 ? 'value' : _ref$state;\n\n var _React$useRef = React.useRef(controlled !== undefined),\n isControlled = _React$useRef.current;\n\n var _React$useState = React.useState(defaultProp),\n valueState = _React$useState[0],\n setValue = _React$useState[1];\n\n var value = isControlled ? controlled : valueState;\n\n if (process.env.NODE_ENV !== 'production') {\n React.useEffect(function () {\n if (isControlled !== (controlled !== undefined)) {\n console.error([\"Material-UI: A component is changing the \".concat(isControlled ? '' : 'un', \"controlled \").concat(state, \" state of \").concat(name, \" to be \").concat(isControlled ? 'un' : '', \"controlled.\"), 'Elements should not switch from uncontrolled to controlled (or vice versa).', \"Decide between using a controlled or uncontrolled \".concat(name, \" \") + 'element for the lifetime of the component.', \"The nature of the state is determined during the first render, it's considered controlled if the value is not `undefined`.\", 'More info: https://fb.me/react-controlled-components'].join('\\n'));\n }\n }, [controlled]);\n\n var _React$useRef2 = React.useRef(defaultProp),\n defaultValue = _React$useRef2.current;\n\n React.useEffect(function () {\n if (!isControlled && defaultValue !== defaultProp) {\n console.error([\"Material-UI: A component is changing the default \".concat(state, \" state of an uncontrolled \").concat(name, \" after being initialized. \") + \"To suppress this warning opt to use a controlled \".concat(name, \".\")].join('\\n'));\n }\n }, [JSON.stringify(defaultProp)]);\n }\n\n var setValueIfUncontrolled = React.useCallback(function (newValue) {\n if (!isControlled) {\n setValue(newValue);\n }\n }, []);\n return [value, setValueIfUncontrolled];\n}","map":{"version":3,"sources":["/app/node_modules/@material-ui/core/esm/utils/useControlled.js"],"names":["React","useControlled","_ref","controlled","defaultProp","default","name","_ref$state","state","_React$useRef","useRef","undefined","isControlled","current","_React$useState","useState","valueState","setValue","value","process","env","NODE_ENV","useEffect","console","error","concat","join","_React$useRef2","defaultValue","JSON","stringify","setValueIfUncontrolled","useCallback","newValue"],"mappings":"AAAA;AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,eAAe,SAASC,aAAT,CAAuBC,IAAvB,EAA6B;AAC1C,MAAIC,UAAU,GAAGD,IAAI,CAACC,UAAtB;AAAA,MACIC,WAAW,GAAGF,IAAI,CAACG,OADvB;AAAA,MAEIC,IAAI,GAAGJ,IAAI,CAACI,IAFhB;AAAA,MAGIC,UAAU,GAAGL,IAAI,CAACM,KAHtB;AAAA,MAIIA,KAAK,GAAGD,UAAU,KAAK,KAAK,CAApB,GAAwB,OAAxB,GAAkCA,UAJ9C;;AAMA,MAAIE,aAAa,GAAGT,KAAK,CAACU,MAAN,CAAaP,UAAU,KAAKQ,SAA5B,CAApB;AAAA,MACIC,YAAY,GAAGH,aAAa,CAACI,OADjC;;AAGA,MAAIC,eAAe,GAAGd,KAAK,CAACe,QAAN,CAAeX,WAAf,CAAtB;AAAA,MACIY,UAAU,GAAGF,eAAe,CAAC,CAAD,CADhC;AAAA,MAEIG,QAAQ,GAAGH,eAAe,CAAC,CAAD,CAF9B;;AAIA,MAAII,KAAK,GAAGN,YAAY,GAAGT,UAAH,GAAgBa,UAAxC;;AAEA,MAAIG,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;AACzCrB,IAAAA,KAAK,CAACsB,SAAN,CAAgB,YAAY;AAC1B,UAAIV,YAAY,MAAMT,UAAU,KAAKQ,SAArB,CAAhB,EAAiD;AAC/CY,QAAAA,OAAO,CAACC,KAAR,CAAc,CAAC,4CAA4CC,MAA5C,CAAmDb,YAAY,GAAG,EAAH,GAAQ,IAAvE,EAA6E,aAA7E,EAA4Fa,MAA5F,CAAmGjB,KAAnG,EAA0G,YAA1G,EAAwHiB,MAAxH,CAA+HnB,IAA/H,EAAqI,SAArI,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