text: var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:true});exports.default=exports.MenuOptionContext=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var _react=_interopRequireWildcard(require("react"));var _MenuGroup=_interopRequireDefault(require("./MenuGroup"));var _useHasResponsiveProps=require("../../../hooks/useHasResponsiveProps");var _this=this,_jsxFileName="/Users/adityajamuar/Sites/projects/nativebase/NativeBase/src/components/composites/Menu/MenuOptionGroup.tsx";var MenuOptionContext=_react.default.createContext({values:[],onChange:function onChange(_val){},type:'checkbox'});exports.MenuOptionContext=MenuOptionContext;var MenuOptionGroup=function MenuOptionGroup(_ref,ref){var type=_ref.type,defaultValue=_ref.defaultValue,value=_ref.value,onChange=_ref.onChange,props=(0,_objectWithoutProperties2.default)(_ref,["type","defaultValue","value","onChange"]);var internalDefaultValue=defaultValue?Array.isArray(defaultValue)?defaultValue:[defaultValue]:[];var _React$useState=_react.default.useState(internalDefaultValue),_React$useState2=(0,_slicedToArray2.default)(_React$useState,2),internalValues=_React$useState2[0],setValues=_React$useState2[1];onChange=function onChange(newValue){if(type==='checkbox'){var newValues=(0,_toConsumableArray2.default)(internalValues);if(internalValues.includes(newValue)){newValues.splice(newValues.indexOf(newValue),1);setValues(newValues);}else{newValues.push(newValue);setValues(newValues);}}else if(type==='radio'){setValues([newValue]);}};if((0,_useHasResponsiveProps.useHasResponsiveProps)(props)){return null;}return _react.default.createElement(MenuOptionContext.Provider,{value:{values:!value?internalValues:Array.isArray(value)?value:[value],onChange:onChange,type:type},__self:_this,__source:{fileName:_jsxFileName,lineNumber:44,columnNumber:5}},_react.default.createElement(_MenuGroup.default,(0,_extends2.default)({},props,{ref:ref,__self:_this,__source:{fileName:_jsxFileName,lineNumber:55,columnNumber:7}})));};var _default=(0,_react.memo)((0,_react.forwardRef)(MenuOptionGroup));exports.default=_default;
  //# sourceMappingURL=MenuOptionGroup.js.map