@andoniaina/react-modal 1.0.9 → 1.1.1
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/dist/index.cjs.js +2 -2
- package/dist/index.es.js +122 -163
- package/dist/react-hrnet-modal.css +1 -0
- package/package.json +4 -5
package/dist/index.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("react");var R={exports:{}},E={};var F;function re(){if(F)return E;F=1;var l=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function c(i,s,o){var f=null;if(o!==void 0&&(f=""+o),s.key!==void 0&&(f=""+s.key),"key"in s){o={};for(var m in s)m!=="key"&&(o[m]=s[m])}else o=s;return s=o.ref,{$$typeof:l,type:i,key:f,ref:s!==void 0?s:null,props:o}}return E.Fragment=u,E.jsx=c,E.jsxs=c,E}var _={};var M;function te(){return M||(M=1,process.env.NODE_ENV!=="production"&&(function(){function l(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Q?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case J:return"Profiler";case q:return"StrictMode";case X:return"Suspense";case B:return"SuspenseList";case Z:return"Activity"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case U:return"Portal";case z:return e.displayName||"Context";case V:return(e._context.displayName||"Context")+".Consumer";case G:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case H:return r=e.displayName||null,r!==null?r:l(e.type)||"Memo";case k:r=e._payload,e=e._init;try{return l(e(r))}catch{}}return null}function u(e){return""+e}function c(e){try{u(e);var r=!1}catch{r=!0}if(r){r=console;var t=r.error,n=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t.call(r,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",n),u(e)}}function i(e){if(e===T)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===k)return"<...>";try{var r=l(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function s(){var e=y.A;return e===null?null:e.getOwner()}function o(){return Error("react-stack-top-frame")}function f(e){if(g.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function m(e,r){function t(){N||(N=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",r))}t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}function L(){var e=l(this.type);return C[e]||(C[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function W(e,r,t,n,b,w){var a=t.ref;return e={$$typeof:x,type:e,key:r,props:t,_owner:n},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:L}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(e,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:b}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:w}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function P(e,r,t,n,b,w){var a=r.children;if(a!==void 0)if(n)if(K(a)){for(n=0;n<a.length;n++)j(a[n]);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else j(a);if(g.call(r,"key")){a=l(e);var d=Object.keys(r).filter(function(ee){return ee!=="key"});n=0<d.length?"{key: someKey, "+d.join(": ..., ")+": ...}":"{key: someKey}",I[a+n]||(d=0<d.length?"{"+d.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,n,a,
|
|
6
|
+
<%s key={someKey} {...props} />`,n,a,d,a),I[a+n]=!0)}if(a=null,t!==void 0&&(c(t),a=""+t),f(r)&&(c(r.key),a=""+r.key),"key"in r){t={};for(var O in r)O!=="key"&&(t[O]=r[O])}else t=r;return a&&m(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),W(e,a,t,s(),b,w)}function j(e){h(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===k&&(e._payload.status==="fulfilled"?h(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function h(e){return typeof e=="object"&&e!==null&&e.$$typeof===x}var v=A,x=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),J=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),z=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),X=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),Q=Symbol.for("react.client.reference"),y=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,g=Object.prototype.hasOwnProperty,K=Array.isArray,S=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(e){return e()}};var N,C={},Y=v.react_stack_bottom_frame.bind(v,o)(),$=S(i(o)),I={};_.Fragment=T,_.jsx=function(e,r,t){var n=1e4>y.recentlyCreatedOwnerStacks++;return P(e,r,t,!1,n?Error("react-stack-top-frame"):Y,n?S(i(e)):$)},_.jsxs=function(e,r,t){var n=1e4>y.recentlyCreatedOwnerStacks++;return P(e,r,t,!0,n?Error("react-stack-top-frame"):Y,n?S(i(e)):$)}})()),_}var D;function ne(){return D||(D=1,process.env.NODE_ENV==="production"?R.exports=re():R.exports=te()),R.exports}var p=ne();function ae({isOpen:l,onClose:u,type:c="success",message:i="",closeOnEsc:s=!0}){return A.useEffect(()=>(l?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[l]),A.useEffect(()=>{if(!s)return;const o=f=>{f.key==="Escape"&&u()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[s,u]),l?p.jsx("div",{className:"modal-overlay",onClick:u,role:"dialog","aria-modal":"true","aria-label":c==="success"?"Succès":"Erreur",children:p.jsxs("div",{className:`modal ${c}`,onClick:o=>o.stopPropagation(),children:[p.jsx("p",{children:i}),p.jsx("button",{onClick:u,children:"OK"})]})}):null}exports.Modal=ae;
|
package/dist/index.es.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
if (
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
function i
|
|
9
|
-
var
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
for (var m in
|
|
13
|
-
m !== "key" && (
|
|
14
|
-
} else
|
|
15
|
-
return
|
|
16
|
-
$$typeof:
|
|
17
|
-
type:
|
|
18
|
-
key:
|
|
19
|
-
ref:
|
|
20
|
-
props:
|
|
1
|
+
import re, { useEffect as I } from "react";
|
|
2
|
+
var R = { exports: {} }, E = {};
|
|
3
|
+
var F;
|
|
4
|
+
function te() {
|
|
5
|
+
if (F) return E;
|
|
6
|
+
F = 1;
|
|
7
|
+
var l = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
8
|
+
function c(i, s, o) {
|
|
9
|
+
var f = null;
|
|
10
|
+
if (o !== void 0 && (f = "" + o), s.key !== void 0 && (f = "" + s.key), "key" in s) {
|
|
11
|
+
o = {};
|
|
12
|
+
for (var m in s)
|
|
13
|
+
m !== "key" && (o[m] = s[m]);
|
|
14
|
+
} else o = s;
|
|
15
|
+
return s = o.ref, {
|
|
16
|
+
$$typeof: l,
|
|
17
|
+
type: i,
|
|
18
|
+
key: f,
|
|
19
|
+
ref: s !== void 0 ? s : null,
|
|
20
|
+
props: o
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
return
|
|
23
|
+
return E.Fragment = u, E.jsx = c, E.jsxs = c, E;
|
|
24
24
|
}
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
function
|
|
28
|
-
return
|
|
29
|
-
function
|
|
25
|
+
var _ = {};
|
|
26
|
+
var D;
|
|
27
|
+
function ne() {
|
|
28
|
+
return D || (D = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
29
|
+
function l(e) {
|
|
30
30
|
if (e == null) return null;
|
|
31
31
|
if (typeof e == "function")
|
|
32
|
-
return e.$$typeof ===
|
|
32
|
+
return e.$$typeof === Q ? null : e.displayName || e.name || null;
|
|
33
33
|
if (typeof e == "string") return e;
|
|
34
34
|
switch (e) {
|
|
35
|
-
case
|
|
35
|
+
case T:
|
|
36
36
|
return "Fragment";
|
|
37
|
-
case
|
|
37
|
+
case J:
|
|
38
38
|
return "Profiler";
|
|
39
39
|
case q:
|
|
40
40
|
return "StrictMode";
|
|
41
|
-
case
|
|
41
|
+
case X:
|
|
42
42
|
return "Suspense";
|
|
43
|
-
case
|
|
43
|
+
case B:
|
|
44
44
|
return "SuspenseList";
|
|
45
|
-
case
|
|
45
|
+
case Z:
|
|
46
46
|
return "Activity";
|
|
47
47
|
}
|
|
48
48
|
if (typeof e == "object")
|
|
49
49
|
switch (typeof e.tag == "number" && console.error(
|
|
50
50
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
51
51
|
), e.$$typeof) {
|
|
52
|
-
case
|
|
52
|
+
case U:
|
|
53
53
|
return "Portal";
|
|
54
|
-
case
|
|
54
|
+
case z:
|
|
55
55
|
return e.displayName || "Context";
|
|
56
|
-
case
|
|
56
|
+
case V:
|
|
57
57
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
58
|
-
case
|
|
58
|
+
case G:
|
|
59
59
|
var r = e.render;
|
|
60
60
|
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
61
|
-
case
|
|
62
|
-
return r = e.displayName || null, r !== null ? r :
|
|
63
|
-
case
|
|
61
|
+
case H:
|
|
62
|
+
return r = e.displayName || null, r !== null ? r : l(e.type) || "Memo";
|
|
63
|
+
case k:
|
|
64
64
|
r = e._payload, e = e._init;
|
|
65
65
|
try {
|
|
66
|
-
return
|
|
66
|
+
return l(e(r));
|
|
67
67
|
} catch {
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -72,7 +72,7 @@ function ae() {
|
|
|
72
72
|
function u(e) {
|
|
73
73
|
return "" + e;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function c(e) {
|
|
76
76
|
try {
|
|
77
77
|
u(e);
|
|
78
78
|
var r = !1;
|
|
@@ -89,26 +89,26 @@ function ae() {
|
|
|
89
89
|
), u(e);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
if (e ===
|
|
94
|
-
if (typeof e == "object" && e !== null && e.$$typeof ===
|
|
92
|
+
function i(e) {
|
|
93
|
+
if (e === T) return "<>";
|
|
94
|
+
if (typeof e == "object" && e !== null && e.$$typeof === k)
|
|
95
95
|
return "<...>";
|
|
96
96
|
try {
|
|
97
|
-
var r =
|
|
97
|
+
var r = l(e);
|
|
98
98
|
return r ? "<" + r + ">" : "<...>";
|
|
99
99
|
} catch {
|
|
100
100
|
return "<...>";
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
var e =
|
|
103
|
+
function s() {
|
|
104
|
+
var e = y.A;
|
|
105
105
|
return e === null ? null : e.getOwner();
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function o() {
|
|
108
108
|
return Error("react-stack-top-frame");
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
if (
|
|
110
|
+
function f(e) {
|
|
111
|
+
if (j.call(e, "key")) {
|
|
112
112
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
113
113
|
if (r && r.isReactWarning) return !1;
|
|
114
114
|
}
|
|
@@ -116,7 +116,7 @@ function ae() {
|
|
|
116
116
|
}
|
|
117
117
|
function m(e, r) {
|
|
118
118
|
function t() {
|
|
119
|
-
|
|
119
|
+
g || (g = !0, console.error(
|
|
120
120
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
121
121
|
r
|
|
122
122
|
));
|
|
@@ -126,23 +126,23 @@ function ae() {
|
|
|
126
126
|
configurable: !0
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
function
|
|
130
|
-
var e =
|
|
131
|
-
return
|
|
129
|
+
function M() {
|
|
130
|
+
var e = l(this.type);
|
|
131
|
+
return N[e] || (N[e] = !0, console.error(
|
|
132
132
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
133
133
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function W(e, r, t, n, b, A) {
|
|
136
136
|
var a = t.ref;
|
|
137
137
|
return e = {
|
|
138
|
-
$$typeof:
|
|
138
|
+
$$typeof: h,
|
|
139
139
|
type: e,
|
|
140
140
|
key: r,
|
|
141
141
|
props: t,
|
|
142
142
|
_owner: n
|
|
143
143
|
}, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
|
|
144
144
|
enumerable: !1,
|
|
145
|
-
get:
|
|
145
|
+
get: M
|
|
146
146
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
147
147
|
configurable: !1,
|
|
148
148
|
enumerable: !1,
|
|
@@ -157,33 +157,33 @@ function ae() {
|
|
|
157
157
|
configurable: !1,
|
|
158
158
|
enumerable: !1,
|
|
159
159
|
writable: !0,
|
|
160
|
-
value:
|
|
160
|
+
value: b
|
|
161
161
|
}), Object.defineProperty(e, "_debugTask", {
|
|
162
162
|
configurable: !1,
|
|
163
163
|
enumerable: !1,
|
|
164
164
|
writable: !0,
|
|
165
|
-
value:
|
|
165
|
+
value: A
|
|
166
166
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function S(e, r, t, n, b, A) {
|
|
169
169
|
var a = r.children;
|
|
170
170
|
if (a !== void 0)
|
|
171
171
|
if (n)
|
|
172
|
-
if (
|
|
172
|
+
if (K(a)) {
|
|
173
173
|
for (n = 0; n < a.length; n++)
|
|
174
|
-
|
|
174
|
+
x(a[n]);
|
|
175
175
|
Object.freeze && Object.freeze(a);
|
|
176
176
|
} else
|
|
177
177
|
console.error(
|
|
178
178
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
179
179
|
);
|
|
180
|
-
else
|
|
181
|
-
if (
|
|
182
|
-
a =
|
|
183
|
-
var
|
|
184
|
-
return
|
|
180
|
+
else x(a);
|
|
181
|
+
if (j.call(r, "key")) {
|
|
182
|
+
a = l(e);
|
|
183
|
+
var d = Object.keys(r).filter(function(ee) {
|
|
184
|
+
return ee !== "key";
|
|
185
185
|
});
|
|
186
|
-
n = 0 <
|
|
186
|
+
n = 0 < d.length ? "{key: someKey, " + d.join(": ..., ") + ": ...}" : "{key: someKey}", $[a + n] || (d = 0 < d.length ? "{" + d.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
187
187
|
`A props object containing a "key" prop is being spread into JSX:
|
|
188
188
|
let props = %s;
|
|
189
189
|
<%s {...props} />
|
|
@@ -192,144 +192,103 @@ React keys must be passed directly to JSX without using spread:
|
|
|
192
192
|
<%s key={someKey} {...props} />`,
|
|
193
193
|
n,
|
|
194
194
|
a,
|
|
195
|
-
|
|
195
|
+
d,
|
|
196
196
|
a
|
|
197
|
-
),
|
|
197
|
+
), $[a + n] = !0);
|
|
198
198
|
}
|
|
199
|
-
if (a = null, t !== void 0 && (
|
|
199
|
+
if (a = null, t !== void 0 && (c(t), a = "" + t), f(r) && (c(r.key), a = "" + r.key), "key" in r) {
|
|
200
200
|
t = {};
|
|
201
|
-
for (var
|
|
202
|
-
|
|
201
|
+
for (var O in r)
|
|
202
|
+
O !== "key" && (t[O] = r[O]);
|
|
203
203
|
} else t = r;
|
|
204
204
|
return a && m(
|
|
205
205
|
t,
|
|
206
206
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
207
|
-
),
|
|
207
|
+
), W(
|
|
208
208
|
e,
|
|
209
209
|
a,
|
|
210
210
|
t,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
211
|
+
s(),
|
|
212
|
+
b,
|
|
213
|
+
A
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
|
-
function
|
|
217
|
-
|
|
216
|
+
function x(e) {
|
|
217
|
+
P(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === k && (e._payload.status === "fulfilled" ? P(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
219
|
+
function P(e) {
|
|
220
|
+
return typeof e == "object" && e !== null && e.$$typeof === h;
|
|
221
221
|
}
|
|
222
|
-
var
|
|
222
|
+
var v = re, h = /* @__PURE__ */ Symbol.for("react.transitional.element"), U = /* @__PURE__ */ Symbol.for("react.portal"), T = /* @__PURE__ */ Symbol.for("react.fragment"), q = /* @__PURE__ */ Symbol.for("react.strict_mode"), J = /* @__PURE__ */ Symbol.for("react.profiler"), V = /* @__PURE__ */ Symbol.for("react.consumer"), z = /* @__PURE__ */ Symbol.for("react.context"), G = /* @__PURE__ */ Symbol.for("react.forward_ref"), X = /* @__PURE__ */ Symbol.for("react.suspense"), B = /* @__PURE__ */ Symbol.for("react.suspense_list"), H = /* @__PURE__ */ Symbol.for("react.memo"), k = /* @__PURE__ */ Symbol.for("react.lazy"), Z = /* @__PURE__ */ Symbol.for("react.activity"), Q = /* @__PURE__ */ Symbol.for("react.client.reference"), y = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, j = Object.prototype.hasOwnProperty, K = Array.isArray, w = console.createTask ? console.createTask : function() {
|
|
223
223
|
return null;
|
|
224
224
|
};
|
|
225
|
-
|
|
225
|
+
v = {
|
|
226
226
|
react_stack_bottom_frame: function(e) {
|
|
227
227
|
return e();
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
|
-
var
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
)(),
|
|
234
|
-
|
|
235
|
-
var n = 1e4 >
|
|
236
|
-
return
|
|
230
|
+
var g, N = {}, C = v.react_stack_bottom_frame.bind(
|
|
231
|
+
v,
|
|
232
|
+
o
|
|
233
|
+
)(), Y = w(i(o)), $ = {};
|
|
234
|
+
_.Fragment = T, _.jsx = function(e, r, t) {
|
|
235
|
+
var n = 1e4 > y.recentlyCreatedOwnerStacks++;
|
|
236
|
+
return S(
|
|
237
237
|
e,
|
|
238
238
|
r,
|
|
239
239
|
t,
|
|
240
240
|
!1,
|
|
241
|
-
n ? Error("react-stack-top-frame") :
|
|
242
|
-
n ?
|
|
241
|
+
n ? Error("react-stack-top-frame") : C,
|
|
242
|
+
n ? w(i(e)) : Y
|
|
243
243
|
);
|
|
244
|
-
},
|
|
245
|
-
var n = 1e4 >
|
|
246
|
-
return
|
|
244
|
+
}, _.jsxs = function(e, r, t) {
|
|
245
|
+
var n = 1e4 > y.recentlyCreatedOwnerStacks++;
|
|
246
|
+
return S(
|
|
247
247
|
e,
|
|
248
248
|
r,
|
|
249
249
|
t,
|
|
250
250
|
!0,
|
|
251
|
-
n ? Error("react-stack-top-frame") :
|
|
252
|
-
n ?
|
|
251
|
+
n ? Error("react-stack-top-frame") : C,
|
|
252
|
+
n ? w(i(e)) : Y
|
|
253
253
|
);
|
|
254
254
|
};
|
|
255
|
-
})()),
|
|
255
|
+
})()), _;
|
|
256
256
|
}
|
|
257
|
-
var
|
|
258
|
-
function
|
|
259
|
-
return
|
|
257
|
+
var L;
|
|
258
|
+
function ae() {
|
|
259
|
+
return L || (L = 1, process.env.NODE_ENV === "production" ? R.exports = te() : R.exports = ne()), R.exports;
|
|
260
260
|
}
|
|
261
|
-
var p =
|
|
262
|
-
const U = {
|
|
263
|
-
default: {
|
|
264
|
-
border: "border-gray-200",
|
|
265
|
-
icon: null
|
|
266
|
-
},
|
|
267
|
-
success: {
|
|
268
|
-
border: "border-green-500",
|
|
269
|
-
title: "text-green-600"
|
|
270
|
-
},
|
|
271
|
-
error: {
|
|
272
|
-
border: "border-red-500",
|
|
273
|
-
title: "text-red-600"
|
|
274
|
-
}
|
|
275
|
-
};
|
|
261
|
+
var p = ae();
|
|
276
262
|
function se({
|
|
277
|
-
isOpen:
|
|
263
|
+
isOpen: l,
|
|
278
264
|
onClose: u,
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
closeOnEsc:
|
|
282
|
-
closeOnOverlayClick: l = !0,
|
|
283
|
-
animationDuration: d = 300,
|
|
284
|
-
onBeforeOpen: m,
|
|
285
|
-
onAfterOpen: h,
|
|
286
|
-
onBeforeClose: T,
|
|
287
|
-
onAfterClose: v
|
|
265
|
+
type: c = "success",
|
|
266
|
+
message: i = "",
|
|
267
|
+
closeOnEsc: s = !0
|
|
288
268
|
}) {
|
|
289
|
-
|
|
269
|
+
return I(() => (l ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
290
270
|
document.body.style.overflow = "";
|
|
291
|
-
}), [
|
|
292
|
-
if (!
|
|
293
|
-
const
|
|
294
|
-
|
|
271
|
+
}), [l]), I(() => {
|
|
272
|
+
if (!s) return;
|
|
273
|
+
const o = (f) => {
|
|
274
|
+
f.key === "Escape" && u();
|
|
295
275
|
};
|
|
296
|
-
return document.addEventListener("keydown",
|
|
297
|
-
}, [
|
|
298
|
-
const k = () => {
|
|
299
|
-
l && (T?.(), u(), v?.());
|
|
300
|
-
}, b = U[f] || U.default;
|
|
301
|
-
return /* @__PURE__ */ p.jsx(
|
|
276
|
+
return document.addEventListener("keydown", o), () => document.removeEventListener("keydown", o);
|
|
277
|
+
}, [s, u]), l ? /* @__PURE__ */ p.jsx(
|
|
302
278
|
"div",
|
|
303
279
|
{
|
|
304
|
-
className: "
|
|
305
|
-
|
|
306
|
-
onClick: k,
|
|
280
|
+
className: "modal-overlay",
|
|
281
|
+
onClick: u,
|
|
307
282
|
role: "dialog",
|
|
308
283
|
"aria-modal": "true",
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
{
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
children: [
|
|
315
|
-
b.icon && /* @__PURE__ */ p.jsx("div", { className: "mb-4 text-4xl", children: b.icon }),
|
|
316
|
-
/* @__PURE__ */ p.jsx(
|
|
317
|
-
"button",
|
|
318
|
-
{
|
|
319
|
-
className: "absolute top-3 right-3 text-2xl font-bold text-gray-500 hover:text-black",
|
|
320
|
-
onClick: u,
|
|
321
|
-
"aria-label": "Close modal",
|
|
322
|
-
children: "×"
|
|
323
|
-
}
|
|
324
|
-
),
|
|
325
|
-
/* @__PURE__ */ p.jsx("div", { className: b.title, children: i })
|
|
326
|
-
]
|
|
327
|
-
}
|
|
328
|
-
)
|
|
284
|
+
"aria-label": c === "success" ? "Succès" : "Erreur",
|
|
285
|
+
children: /* @__PURE__ */ p.jsxs("div", { className: `modal ${c}`, onClick: (o) => o.stopPropagation(), children: [
|
|
286
|
+
/* @__PURE__ */ p.jsx("p", { children: i }),
|
|
287
|
+
/* @__PURE__ */ p.jsx("button", { onClick: u, children: "OK" })
|
|
288
|
+
] })
|
|
329
289
|
}
|
|
330
|
-
);
|
|
290
|
+
) : null;
|
|
331
291
|
}
|
|
332
292
|
export {
|
|
333
|
-
se as Modal
|
|
334
|
-
se as default
|
|
293
|
+
se as Modal
|
|
335
294
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.modal-overlay{position:fixed;inset:0;background-color:#0006;display:flex;align-items:center;justify-content:center;z-index:999}.modal{background:#fff;padding:1.5rem;border-radius:8px;min-width:300px;text-align:center;animation:fadeIn .2s ease-in-out}.modal.success{border-left:6px solid #2ecc71}.modal.error{border-left:6px solid #e74c3c}.modal button{margin-top:1rem;padding:.5rem 1rem;cursor:pointer}@keyframes fadeIn{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}
|
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andoniaina/react-modal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Reusable, accessible and customizable React modal component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/index.es.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
8
|
"files": [
|
|
10
9
|
"dist"
|
|
11
10
|
],
|
|
12
|
-
"style": "dist/react-modal.css",
|
|
13
11
|
"exports": {
|
|
14
12
|
".": {
|
|
15
|
-
"types": "./dist/index.d.ts",
|
|
16
13
|
"import": "./dist/index.es.js",
|
|
17
14
|
"require": "./dist/index.cjs.js"
|
|
18
15
|
}
|
|
@@ -54,6 +51,8 @@
|
|
|
54
51
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
55
52
|
"eslint-plugin-react-refresh": "^0.4.24",
|
|
56
53
|
"globals": "^16.5.0",
|
|
57
|
-
"vite": "^7.2.4"
|
|
54
|
+
"vite": "^7.2.4",
|
|
55
|
+
"react": ">=18",
|
|
56
|
+
"react-dom": ">=18"
|
|
58
57
|
}
|
|
59
58
|
}
|