Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mui-modal-provider

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mui-modal-provider - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

1

dist/ModalContext.d.ts

@@ -10,2 +10,3 @@ /// <reference types="react" />

destroy: () => void;
update: (newProps: Object) => void;
};

@@ -12,0 +13,0 @@ destroyModal(id: string): void;

31

dist/mui-modal-provider.cjs.development.js

@@ -62,5 +62,3 @@ 'use strict';

var ModalContext =
/*#__PURE__*/
React.createContext({
var ModalContext = /*#__PURE__*/React.createContext({
state: {},

@@ -72,3 +70,4 @@ hideModal: function hideModal() {},

hide: function hide() {},
destroy: function destroy() {}
destroy: function destroy() {},
update: function update() {}
};

@@ -112,11 +111,18 @@ },

var id = "" + (+new Date()).toString(16);
setState(function (prevState) {
var updateState = function updateState(prevState, newProps) {
var _extends3;
if (newProps === void 0) {
newProps = {};
}
return _extends({}, prevState, (_extends3 = {}, _extends3[id] = {
component: component,
props: _extends({}, props, {
open: true
})
props: _extends({}, props, newProps)
}, _extends3));
};
setState(function (prevState) {
return updateState(prevState);
});

@@ -130,2 +136,11 @@ return {

return destroyModal(id);
},
update: function update(newProps) {
if (newProps === void 0) {
newProps = {};
}
return setState(function (prevState) {
return updateState(prevState, newProps);
});
}

@@ -132,0 +147,0 @@ };

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("react"),n=(t=e)&&"object"==typeof t&&"default"in t?t.default:t;function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function o(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}var u=e.createContext({state:{},hideModal:function(){},showModal:function(){return{id:"id",hide:function(){},destroy:function(){}}},destroyModal:function(){}}),i={};exports.ModalContext=u,exports.default=function(t){var e=t.children,a=n.useState(i),c=a[0],l=a[1],f=n.useCallback((function(t){l((function(e){var n;return r({},e,((n={})[t]=r({},e[t],{props:r({},e[t]?e[t].props:{},{open:!1})}),n))}))}),[]),s=n.useCallback((function(t){l((function(e){return function(t,e){if(null==t)return{};var n,r,o={},u=Object.keys(t);for(r=0;r<u.length;r++)e.indexOf(n=u[r])>=0||(o[n]=t[n]);return o}(e,[t].map(o))}))}),[]),d=n.useCallback((function(t,e){void 0===e&&(e={});var n=""+(+new Date).toString(16);return l((function(o){var u;return r({},o,((u={})[n]={component:t,props:r({},e,{open:!0})},u))})),{id:n,hide:function(){return f(n)},destroy:function(){return s(n)}}}),[s,f]);return n.createElement(u.Provider,{value:{hideModal:f,showModal:d,destroyModal:s,state:c}},e,Object.keys(c).map((function(t){var e=c[t],r=e.component;return r?n.createElement(r,Object.assign({},e.props,{key:t,onClose:function(){return f(t)},onExited:function(){return s(t)}})):null})))},exports.useModal=function(){return e.useContext(u)};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("react"),n=(t=e)&&"object"==typeof t&&"default"in t?t.default:t;function r(){return(r=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function o(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==typeof e?e:String(e)}var u=e.createContext({state:{},hideModal:function(){},showModal:function(){return{id:"id",hide:function(){},destroy:function(){},update:function(){}}},destroyModal:function(){}}),i={};exports.ModalContext=u,exports.default=function(t){var e=t.children,a=n.useState(i),c=a[0],f=a[1],l=n.useCallback((function(t){f((function(e){var n;return r({},e,((n={})[t]=r({},e[t],{props:r({},e[t]?e[t].props:{},{open:!1})}),n))}))}),[]),s=n.useCallback((function(t){f((function(e){return function(t,e){if(null==t)return{};var n,r,o={},u=Object.keys(t);for(r=0;r<u.length;r++)e.indexOf(n=u[r])>=0||(o[n]=t[n]);return o}(e,[t].map(o))}))}),[]),d=n.useCallback((function(t,e){void 0===e&&(e={});var n=""+(+new Date).toString(16),o=function(o,u){var i;return void 0===u&&(u={}),r({},o,((i={})[n]={component:t,props:r({},e,u)},i))};return f((function(t){return o(t)})),{id:n,hide:function(){return l(n)},destroy:function(){return s(n)},update:function(t){return void 0===t&&(t={}),f((function(e){return o(e,t)}))}}}),[s,l]);return n.createElement(u.Provider,{value:{hideModal:l,showModal:d,destroyModal:s,state:c}},e,Object.keys(c).map((function(t){var e=c[t],r=e.component;return r?n.createElement(r,Object.assign({},e.props,{key:t,onClose:function(){return l(t)},onExited:function(){return s(t)}})):null})))},exports.useModal=function(){return e.useContext(u)};
//# sourceMappingURL=mui-modal-provider.cjs.production.min.js.map

@@ -55,5 +55,3 @@ import React, { createContext, useContext } from 'react';

var ModalContext =
/*#__PURE__*/
createContext({
var ModalContext = /*#__PURE__*/createContext({
state: {},

@@ -65,3 +63,4 @@ hideModal: function hideModal() {},

hide: function hide() {},
destroy: function destroy() {}
destroy: function destroy() {},
update: function update() {}
};

@@ -105,11 +104,18 @@ },

var id = "" + (+new Date()).toString(16);
setState(function (prevState) {
var updateState = function updateState(prevState, newProps) {
var _extends3;
if (newProps === void 0) {
newProps = {};
}
return _extends({}, prevState, (_extends3 = {}, _extends3[id] = {
component: component,
props: _extends({}, props, {
open: true
})
props: _extends({}, props, newProps)
}, _extends3));
};
setState(function (prevState) {
return updateState(prevState);
});

@@ -123,2 +129,11 @@ return {

return destroyModal(id);
},
update: function update(newProps) {
if (newProps === void 0) {
newProps = {};
}
return setState(function (prevState) {
return updateState(prevState, newProps);
});
}

@@ -125,0 +140,0 @@ };

{
"version": "1.0.2",
"version": "1.1.0",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

@@ -0,0 +0,0 @@ # mui-modal-provider

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc