piral-modals 0.15.0-alpha.4027 → 0.15.0-alpha.4034
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/components.d.ts +3 -4
- package/esm/components.js.map +1 -1
- package/lib/components.d.ts +3 -4
- package/lib/components.js.map +1 -1
- package/package.json +3 -3
- package/piral-modals.min.js +1 -1
- package/src/components.tsx +2 -4
package/esm/components.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const PiralModalsDialog: ComponentType<ModalsDialogProps>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const PiralModalsHost: import("react").ComponentType<import("./types").ModalsHostProps>;
|
|
3
|
+
export declare const PiralModalsDialog: import("react").ComponentType<import("./types").ModalsDialogProps>;
|
package/esm/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;AAC/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,cAAc,CAAC,CAAC"}
|
package/lib/components.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const PiralModalsDialog: ComponentType<ModalsDialogProps>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const PiralModalsHost: import("react").ComponentType<import("./types").ModalsHostProps>;
|
|
3
|
+
export declare const PiralModalsDialog: import("react").ComponentType<import("./types").ModalsDialogProps>;
|
package/lib/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;AAAA,2CAA+C;AAElC,QAAA,eAAe,GAAG,IAAA,8BAAiB,EAAC,YAAY,CAAC,CAAC;AAClD,QAAA,iBAAiB,GAAG,IAAA,8BAAiB,EAAC,cAAc,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "piral-modals",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.4034",
|
|
4
4
|
"description": "Plugin for the display of modal dialogs in Piral.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"piral",
|
|
@@ -45,12 +45,12 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/react": "^17.0.0",
|
|
48
|
-
"piral-core": "0.15.0-alpha.
|
|
48
|
+
"piral-core": "0.15.0-alpha.4034",
|
|
49
49
|
"react": "^17.0.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"piral-core": "0.14.x",
|
|
53
53
|
"react": ">=16.8.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "7f9158d7fd10d640ba9c092564275e4cc426dff9"
|
|
56
56
|
}
|
package/piral-modals.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var piralModals=(()=>{var
|
|
1
|
+
var piralModals=(()=>{var F=Object.create;var u=Object.defineProperty,N=Object.defineProperties,T=Object.getOwnPropertyDescriptor,$=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertyNames,G=Object.getOwnPropertySymbols,E=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var S=(o,t,a)=>t in o?u(o,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[t]=a,l=(o,t)=>{for(var a in t||(t={}))H.call(t,a)&&S(o,a,t[a]);if(G)for(var a of G(t))K.call(t,a)&&S(o,a,t[a]);return o},i=(o,t)=>N(o,$(t)),v=o=>u(o,"__esModule",{value:!0});var m=(o=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(o,{get:(t,a)=>(typeof require!="undefined"?require:t)[a]}):o)(function(o){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')});var w=(o,t)=>{v(o);for(var a in t)u(o,a,{get:t[a],enumerable:!0})},j=(o,t,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of B(t))!H.call(o,e)&&e!=="default"&&u(o,e,{get:()=>t[e],enumerable:!(a=T(t,e))||a.enumerable});return o},g=o=>j(v(u(o!=null?F(E(o)):{},"default",o&&o.__esModule&&"default"in o?{get:()=>o.default,enumerable:!0}:{value:o,enumerable:!0})),o);var X={};w(X,{Modals:()=>h,PiralModalsDialog:()=>b,PiralModalsHost:()=>R,createModalsApi:()=>W});var P={};w(P,{closeModal:()=>q,openModal:()=>_,registerModal:()=>z,unregisterModal:()=>J});var p=g(m("piral-core"));function _(o,t){o.dispatch(a=>i(l({},a),{modals:(0,p.prependItem)(a.modals,t)}))}function q(o,t){o.dispatch(a=>i(l({},a),{modals:(0,p.excludeOn)(a.modals,e=>e.id===t.id)}))}function z(o,t,a){o.dispatch(e=>i(l({},e),{registry:i(l({},e.registry),{modals:(0,p.withKey)(e.registry.modals,t,a)})}))}function J(o,t){o.dispatch(a=>i(l({},a),{registry:i(l({},a.registry),{modals:(0,p.withoutKey)(a.registry.modals,t)})}))}var n=g(m("piral-core"));var x=g(m("react")),O=g(m("piral-core")),I=o=>x.createElement("div",{className:"piral-modals-host",key:"default_modals"},o.open&&x.createElement("div",{className:"piral-modals-overlay"},o.children)),k=o=>(0,O.defaultRender)(o.children);var D=g(m("react")),A=g(m("piral-core"));var C=g(m("piral-core")),R=(0,C.getPiralComponent)("ModalsHost"),b=(0,C.getPiralComponent)("ModalsDialog");function L(o){o.forEach(t=>t.close())}function Q(o,t){if(t){let[a]=Object.keys(o).filter(e=>o[e].name===t).map(e=>o[e]);return a}}var h=()=>{let o=(0,A.useGlobalState)(r=>r.registry.modals),t=(0,A.useGlobalState)(r=>r.modals),a=()=>L(t),e=t.map(r=>{let d=o[r.name]||Q(o,r.alternative),s=d&&d.component,c=d&&d.defaults;return s&&D.createElement(b,i(l({},r),{key:r.name}),D.createElement(s,{onClose:r.close,options:l(l({},c),r.options)}))}).filter(r=>!!r),M=e.length>0;return D.createElement(R,{open:M,close:a},e)};h.displayName="Modals";function U(o){let t={};for(let{name:a,component:e,defaults:M}of o)t[`global-${a}`]={pilet:void 0,name:a,component:e,defaults:M};return t}function V(o){return t=>i(l({},t),{components:l({ModalsHost:I,ModalsDialog:k},t.components),registry:i(l({},t.registry),{modals:o}),modals:[]})}function W(o={}){let{dialogs:t=[],selectId:a=e=>`${e}-${~~(Math.random()*1e4)}`}=o;return e=>(e.defineActions(P),e.dispatch((0,n.withAll)(V(U(t)),(0,n.withRootExtension)("piral-modals",h))),(M,r)=>{let d=r.name;return{showModal(s,c){let y=(0,n.buildName)(d,s),f={id:a(y),name:y,alternative:s,options:c,close(){setTimeout(()=>e.closeModal(f),0)}};return e.openModal(f),f.close},registerModal(s,c,y){let f=(0,n.buildName)(d,s);return e.registerModal(f,{pilet:d,name:s,component:(0,n.withApi)(e,c,M,"modal"),defaults:y}),()=>M.unregisterModal(s)},unregisterModal(s){let c=(0,n.buildName)(d,s);e.unregisterModal(c)}}})}return X;})();
|
package/src/components.tsx
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { ComponentType } from 'react';
|
|
2
1
|
import { getPiralComponent } from 'piral-core';
|
|
3
|
-
import { ModalsHostProps, ModalsDialogProps } from './types';
|
|
4
2
|
|
|
5
|
-
export const PiralModalsHost
|
|
6
|
-
export const PiralModalsDialog
|
|
3
|
+
export const PiralModalsHost = getPiralComponent('ModalsHost');
|
|
4
|
+
export const PiralModalsDialog = getPiralComponent('ModalsDialog');
|