@andoniaina/react-modal 1.0.6 → 1.0.7

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 CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";const g=require("react");var w={exports:{}},_={};var L;function re(){if(L)return _;L=1;var l=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function i(c,o,s){var f=null;if(s!==void 0&&(f=""+s),o.key!==void 0&&(f=""+o.key),"key"in o){s={};for(var d in o)d!=="key"&&(s[d]=o[d])}else s=o;return o=s.ref,{$$typeof:l,type:c,key:f,ref:o!==void 0?o:null,props:s}}return _.Fragment=u,_.jsx=i,_.jsxs=i,_}var v={};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 O:return"Fragment";case J:return"Profiler";case q:return"StrictMode";case X:return"Suspense";case H:return"SuspenseList";case B: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 Z:return r=e.displayName||null,r!==null?r:l(e.type)||"Memo";case h:r=e._payload,e=e._init;try{return l(e(r))}catch{}}return null}function u(e){return""+e}function i(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 c(e){if(e===O)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===h)return"<...>";try{var r=l(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function o(){var e=A.A;return e===null?null:e.getOwner()}function s(){return Error("react-stack-top-frame")}function f(e){if(C.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function d(e,r){function t(){Y||(Y=!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 b(){var e=l(this.type);return $[e]||($[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 R(e,r,t,n,y,S){var a=t.ref;return e={$$typeof:N,type:e,key:r,props:t,_owner:n},(a!==void 0?a:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:b}):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:y}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:S}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function p(e,r,t,n,y,S){var a=r.children;if(a!==void 0)if(n)if(K(a)){for(n=0;n<a.length;n++)m(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 m(a);if(C.call(r,"key")){a=l(e);var E=Object.keys(r).filter(function(ee){return ee!=="key"});n=0<E.length?"{key: someKey, "+E.join(": ..., ")+": ...}":"{key: someKey}",F[a+n]||(E=0<E.length?"{"+E.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ "use strict";const N=require("react");var w={exports:{}},_={};var L;function te(){if(L)return _;L=1;var s=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function i(f,o,l){var d=null;if(l!==void 0&&(d=""+l),o.key!==void 0&&(d=""+o.key),"key"in o){l={};for(var m in o)m!=="key"&&(l[m]=o[m])}else l=o;return o=l.ref,{$$typeof:s,type:f,key:d,ref:o!==void 0?o:null,props:l}}return _.Fragment=u,_.jsx=i,_.jsxs=i,_}var R={};var M;function ne(){return M||(M=1,process.env.NODE_ENV!=="production"&&(function(){function s(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===K?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case g:return"Fragment";case z:return"Profiler";case q:return"StrictMode";case H:return"Suspense";case Z:return"SuspenseList";case Q: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 V:return"Portal";case G:return e.displayName||"Context";case J:return(e._context.displayName||"Context")+".Consumer";case X:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case B:return r=e.displayName||null,r!==null?r:s(e.type)||"Memo";case A:r=e._payload,e=e._init;try{return s(e(r))}catch{}}return null}function u(e){return""+e}function i(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 f(e){if(e===g)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===A)return"<...>";try{var r=s(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function o(){var e=j.A;return e===null?null:e.getOwner()}function l(){return Error("react-stack-top-frame")}function d(e){if(C.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(){Y||(Y=!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 h(){var e=s(this.type);return $[e]||($[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 T(e,r,t,n,y,S){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:h}):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:y}),Object.defineProperty(e,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:S}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function v(e,r,t,n,y,S){var a=r.children;if(a!==void 0)if(n)if(ee(a)){for(n=0;n<a.length;n++)k(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 k(a);if(C.call(r,"key")){a=s(e);var E=Object.keys(r).filter(function(re){return re!=="key"});n=0<E.length?"{key: someKey, "+E.join(": ..., ")+": ...}":"{key: someKey}",F[a+n]||(E=0<E.length?"{"+E.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,E,a),F[a+n]=!0)}if(a=null,t!==void 0&&(i(t),a=""+t),f(r)&&(i(r.key),a=""+r.key),"key"in r){t={};for(var x in r)x!=="key"&&(t[x]=r[x])}else t=r;return a&&d(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),R(e,a,t,o(),y,S)}function m(e){T(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===h&&(e._payload.status==="fulfilled"?T(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function T(e){return typeof e=="object"&&e!==null&&e.$$typeof===N}var k=g,N=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),O=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"),H=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),Q=Symbol.for("react.client.reference"),A=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=Object.prototype.hasOwnProperty,K=Array.isArray,P=console.createTask?console.createTask:function(){return null};k={react_stack_bottom_frame:function(e){return e()}};var Y,$={},I=k.react_stack_bottom_frame.bind(k,s)(),D=P(c(s)),F={};v.Fragment=O,v.jsx=function(e,r,t){var n=1e4>A.recentlyCreatedOwnerStacks++;return p(e,r,t,!1,n?Error("react-stack-top-frame"):I,n?P(c(e)):D)},v.jsxs=function(e,r,t){var n=1e4>A.recentlyCreatedOwnerStacks++;return p(e,r,t,!0,n?Error("react-stack-top-frame"):I,n?P(c(e)):D)}})()),v}var W;function ne(){return W||(W=1,process.env.NODE_ENV==="production"?w.exports=re():w.exports=te()),w.exports}var j=ne();function ae({isOpen:l,onClose:u,children:i,closeOnEsc:c=!0,closeOnOverlayClick:o=!0,animationDuration:s=300,onBeforeOpen:f,onAfterOpen:d,onBeforeClose:b,onAfterClose:R}){if(g.useEffect(()=>(l?(f?.(),d?.(),document.body.style.overflow="hidden"):document.body.style.overflow="",()=>{document.body.style.overflow=""}),[l]),g.useEffect(()=>{if(!c)return;const m=T=>{T.key==="Escape"&&(b?.(),u(),R?.())};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[c,u]),!l)return null;const p=()=>{o&&(b?.(),u(),R?.())};return j.jsx("div",{className:"modal-overlay show",style:{transitionDuration:`${s}ms`},onClick:p,role:"dialog","aria-modal":"true",children:j.jsxs("div",{className:"modal-content",onClick:m=>m.stopPropagation(),children:[j.jsx("button",{className:"modal-close",onClick:u,children:"×"}),i]})})}module.exports=ae;
6
+ <%s key={someKey} {...props} />`,n,a,E,a),F[a+n]=!0)}if(a=null,t!==void 0&&(i(t),a=""+t),d(r)&&(i(r.key),a=""+r.key),"key"in r){t={};for(var P in r)P!=="key"&&(t[P]=r[P])}else t=r;return a&&m(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),T(e,a,t,o(),y,S)}function k(e){b(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===A&&(e._payload.status==="fulfilled"?b(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function b(e){return typeof e=="object"&&e!==null&&e.$$typeof===x}var c=N,x=Symbol.for("react.transitional.element"),V=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),q=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),J=Symbol.for("react.consumer"),G=Symbol.for("react.context"),X=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),K=Symbol.for("react.client.reference"),j=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,C=Object.prototype.hasOwnProperty,ee=Array.isArray,O=console.createTask?console.createTask:function(){return null};c={react_stack_bottom_frame:function(e){return e()}};var Y,$={},I=c.react_stack_bottom_frame.bind(c,l)(),D=O(f(l)),F={};R.Fragment=g,R.jsx=function(e,r,t){var n=1e4>j.recentlyCreatedOwnerStacks++;return v(e,r,t,!1,n?Error("react-stack-top-frame"):I,n?O(f(e)):D)},R.jsxs=function(e,r,t){var n=1e4>j.recentlyCreatedOwnerStacks++;return v(e,r,t,!0,n?Error("react-stack-top-frame"):I,n?O(f(e)):D)}})()),R}var W;function ae(){return W||(W=1,process.env.NODE_ENV==="production"?w.exports=te():w.exports=ne()),w.exports}var p=ae();const U={default:{border:"border-gray-200",icon:null},success:{border:"border-green-500",title:"text-green-600"},error:{border:"border-red-500",title:"text-red-600"}};function oe({isOpen:s,onClose:u,children:i,variant:f="default",closeOnEsc:o=!0,closeOnOverlayClick:l=!0,animationDuration:d=300,onBeforeOpen:m,onAfterOpen:h,onBeforeClose:T,onAfterClose:v}){if(N.useEffect(()=>(s?(m?.(),h?.(),document.body.style.overflow="hidden"):document.body.style.overflow="",()=>{document.body.style.overflow=""}),[s]),N.useEffect(()=>{if(!o)return;const c=x=>{x.key==="Escape"&&(T?.(),u(),v?.())};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[o,u]),!s)return null;const k=()=>{l&&(T?.(),u(),v?.())},b=U[f]||U.default;return p.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 transition-opacity",style:{transitionDuration:`${d}ms`},onClick:k,role:"dialog","aria-modal":"true",children:p.jsxs("div",{className:`relative w-[90%] max-w-md rounded-xl bg-white px-10 py-8 text-center shadow-xl border-2 ${b.border} animate-fadeIn`,onClick:c=>c.stopPropagation(),children:[b.icon&&p.jsx("div",{className:"mb-4 text-4xl",children:b.icon}),p.jsx("button",{className:"absolute top-3 right-3 text-2xl font-bold text-gray-500 hover:text-black",onClick:u,"aria-label":"Close modal",children:"×"}),p.jsx("div",{className:b.title,children:i})]})})}module.exports=oe;
package/dist/index.es.js CHANGED
@@ -1,66 +1,66 @@
1
- import re, { useEffect as F } from "react";
1
+ import te, { useEffect as F } from "react";
2
2
  var w = { exports: {} }, _ = {};
3
3
  var L;
4
- function te() {
4
+ function ne() {
5
5
  if (L) return _;
6
6
  L = 1;
7
7
  var s = /* @__PURE__ */ Symbol.for("react.transitional.element"), u = /* @__PURE__ */ Symbol.for("react.fragment");
8
- function i(c, o, l) {
9
- var f = null;
10
- if (l !== void 0 && (f = "" + l), o.key !== void 0 && (f = "" + o.key), "key" in o) {
8
+ function i(f, o, l) {
9
+ var d = null;
10
+ if (l !== void 0 && (d = "" + l), o.key !== void 0 && (d = "" + o.key), "key" in o) {
11
11
  l = {};
12
- for (var d in o)
13
- d !== "key" && (l[d] = o[d]);
12
+ for (var m in o)
13
+ m !== "key" && (l[m] = o[m]);
14
14
  } else l = o;
15
15
  return o = l.ref, {
16
16
  $$typeof: s,
17
- type: c,
18
- key: f,
17
+ type: f,
18
+ key: d,
19
19
  ref: o !== void 0 ? o : null,
20
20
  props: l
21
21
  };
22
22
  }
23
23
  return _.Fragment = u, _.jsx = i, _.jsxs = i, _;
24
24
  }
25
- var v = {};
25
+ var R = {};
26
26
  var M;
27
- function ne() {
27
+ function ae() {
28
28
  return M || (M = 1, process.env.NODE_ENV !== "production" && (function() {
29
29
  function s(e) {
30
30
  if (e == null) return null;
31
31
  if (typeof e == "function")
32
- return e.$$typeof === Q ? null : e.displayName || e.name || null;
32
+ return e.$$typeof === K ? null : e.displayName || e.name || null;
33
33
  if (typeof e == "string") return e;
34
34
  switch (e) {
35
- case O:
35
+ case g:
36
36
  return "Fragment";
37
- case J:
37
+ case z:
38
38
  return "Profiler";
39
39
  case q:
40
40
  return "StrictMode";
41
- case X:
42
- return "Suspense";
43
41
  case H:
42
+ return "Suspense";
43
+ case Z:
44
44
  return "SuspenseList";
45
- case B:
45
+ case Q:
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 U:
52
+ case V:
53
53
  return "Portal";
54
- case z:
54
+ case G:
55
55
  return e.displayName || "Context";
56
- case V:
56
+ case J:
57
57
  return (e._context.displayName || "Context") + ".Consumer";
58
- case G:
58
+ case X:
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 Z:
61
+ case B:
62
62
  return r = e.displayName || null, r !== null ? r : s(e.type) || "Memo";
63
- case h:
63
+ case A:
64
64
  r = e._payload, e = e._init;
65
65
  try {
66
66
  return s(e(r));
@@ -89,9 +89,9 @@ function ne() {
89
89
  ), u(e);
90
90
  }
91
91
  }
92
- function c(e) {
93
- if (e === O) return "<>";
94
- if (typeof e == "object" && e !== null && e.$$typeof === h)
92
+ function f(e) {
93
+ if (e === g) return "<>";
94
+ if (typeof e == "object" && e !== null && e.$$typeof === A)
95
95
  return "<...>";
96
96
  try {
97
97
  var r = s(e);
@@ -101,20 +101,20 @@ function ne() {
101
101
  }
102
102
  }
103
103
  function o() {
104
- var e = A.A;
104
+ var e = j.A;
105
105
  return e === null ? null : e.getOwner();
106
106
  }
107
107
  function l() {
108
108
  return Error("react-stack-top-frame");
109
109
  }
110
- function f(e) {
110
+ function d(e) {
111
111
  if (N.call(e, "key")) {
112
112
  var r = Object.getOwnPropertyDescriptor(e, "key").get;
113
113
  if (r && r.isReactWarning) return !1;
114
114
  }
115
115
  return e.key !== void 0;
116
116
  }
117
- function d(e, r) {
117
+ function m(e, r) {
118
118
  function t() {
119
119
  C || (C = !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)",
@@ -126,23 +126,23 @@ function ne() {
126
126
  configurable: !0
127
127
  });
128
128
  }
129
- function b() {
129
+ function h() {
130
130
  var e = s(this.type);
131
131
  return Y[e] || (Y[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 R(e, r, t, n, y, S) {
135
+ function T(e, r, t, n, y, S) {
136
136
  var a = t.ref;
137
137
  return e = {
138
- $$typeof: g,
138
+ $$typeof: x,
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: b
145
+ get: h
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,
@@ -165,23 +165,23 @@ function ne() {
165
165
  value: S
166
166
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
167
167
  }
168
- function p(e, r, t, n, y, S) {
168
+ function v(e, r, t, n, y, S) {
169
169
  var a = r.children;
170
170
  if (a !== void 0)
171
171
  if (n)
172
- if (K(a)) {
172
+ if (ee(a)) {
173
173
  for (n = 0; n < a.length; n++)
174
- m(a[n]);
174
+ k(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 m(a);
180
+ else k(a);
181
181
  if (N.call(r, "key")) {
182
182
  a = s(e);
183
- var E = Object.keys(r).filter(function(ee) {
184
- return ee !== "key";
183
+ var E = Object.keys(r).filter(function(re) {
184
+ return re !== "key";
185
185
  });
186
186
  n = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", D[a + n] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
187
187
  `A props object containing a "key" prop is being spread into JSX:
@@ -196,15 +196,15 @@ React keys must be passed directly to JSX without using spread:
196
196
  a
197
197
  ), D[a + n] = !0);
198
198
  }
199
- if (a = null, t !== void 0 && (i(t), a = "" + t), f(r) && (i(r.key), a = "" + r.key), "key" in r) {
199
+ if (a = null, t !== void 0 && (i(t), a = "" + t), d(r) && (i(r.key), a = "" + r.key), "key" in r) {
200
200
  t = {};
201
- for (var x in r)
202
- x !== "key" && (t[x] = r[x]);
201
+ for (var P in r)
202
+ P !== "key" && (t[P] = r[P]);
203
203
  } else t = r;
204
- return a && d(
204
+ return a && m(
205
205
  t,
206
206
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
207
- ), R(
207
+ ), T(
208
208
  e,
209
209
  a,
210
210
  t,
@@ -213,92 +213,116 @@ React keys must be passed directly to JSX without using spread:
213
213
  S
214
214
  );
215
215
  }
216
- function m(e) {
217
- T(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === h && (e._payload.status === "fulfilled" ? T(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
216
+ function k(e) {
217
+ b(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === A && (e._payload.status === "fulfilled" ? b(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
218
218
  }
219
- function T(e) {
220
- return typeof e == "object" && e !== null && e.$$typeof === g;
219
+ function b(e) {
220
+ return typeof e == "object" && e !== null && e.$$typeof === x;
221
221
  }
222
- var k = re, g = /* @__PURE__ */ Symbol.for("react.transitional.element"), U = /* @__PURE__ */ Symbol.for("react.portal"), O = /* @__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"), H = /* @__PURE__ */ Symbol.for("react.suspense_list"), Z = /* @__PURE__ */ Symbol.for("react.memo"), h = /* @__PURE__ */ Symbol.for("react.lazy"), B = /* @__PURE__ */ Symbol.for("react.activity"), Q = /* @__PURE__ */ Symbol.for("react.client.reference"), A = k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, N = Object.prototype.hasOwnProperty, K = Array.isArray, P = console.createTask ? console.createTask : function() {
222
+ var c = te, x = /* @__PURE__ */ Symbol.for("react.transitional.element"), V = /* @__PURE__ */ Symbol.for("react.portal"), g = /* @__PURE__ */ Symbol.for("react.fragment"), q = /* @__PURE__ */ Symbol.for("react.strict_mode"), z = /* @__PURE__ */ Symbol.for("react.profiler"), J = /* @__PURE__ */ Symbol.for("react.consumer"), G = /* @__PURE__ */ Symbol.for("react.context"), X = /* @__PURE__ */ Symbol.for("react.forward_ref"), H = /* @__PURE__ */ Symbol.for("react.suspense"), Z = /* @__PURE__ */ Symbol.for("react.suspense_list"), B = /* @__PURE__ */ Symbol.for("react.memo"), A = /* @__PURE__ */ Symbol.for("react.lazy"), Q = /* @__PURE__ */ Symbol.for("react.activity"), K = /* @__PURE__ */ Symbol.for("react.client.reference"), j = c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, N = Object.prototype.hasOwnProperty, ee = Array.isArray, O = console.createTask ? console.createTask : function() {
223
223
  return null;
224
224
  };
225
- k = {
225
+ c = {
226
226
  react_stack_bottom_frame: function(e) {
227
227
  return e();
228
228
  }
229
229
  };
230
- var C, Y = {}, $ = k.react_stack_bottom_frame.bind(
231
- k,
230
+ var C, Y = {}, $ = c.react_stack_bottom_frame.bind(
231
+ c,
232
232
  l
233
- )(), I = P(c(l)), D = {};
234
- v.Fragment = O, v.jsx = function(e, r, t) {
235
- var n = 1e4 > A.recentlyCreatedOwnerStacks++;
236
- return p(
233
+ )(), I = O(f(l)), D = {};
234
+ R.Fragment = g, R.jsx = function(e, r, t) {
235
+ var n = 1e4 > j.recentlyCreatedOwnerStacks++;
236
+ return v(
237
237
  e,
238
238
  r,
239
239
  t,
240
240
  !1,
241
241
  n ? Error("react-stack-top-frame") : $,
242
- n ? P(c(e)) : I
242
+ n ? O(f(e)) : I
243
243
  );
244
- }, v.jsxs = function(e, r, t) {
245
- var n = 1e4 > A.recentlyCreatedOwnerStacks++;
246
- return p(
244
+ }, R.jsxs = function(e, r, t) {
245
+ var n = 1e4 > j.recentlyCreatedOwnerStacks++;
246
+ return v(
247
247
  e,
248
248
  r,
249
249
  t,
250
250
  !0,
251
251
  n ? Error("react-stack-top-frame") : $,
252
- n ? P(c(e)) : I
252
+ n ? O(f(e)) : I
253
253
  );
254
254
  };
255
- })()), v;
255
+ })()), R;
256
256
  }
257
257
  var W;
258
- function ae() {
259
- return W || (W = 1, process.env.NODE_ENV === "production" ? w.exports = te() : w.exports = ne()), w.exports;
258
+ function oe() {
259
+ return W || (W = 1, process.env.NODE_ENV === "production" ? w.exports = ne() : w.exports = ae()), w.exports;
260
260
  }
261
- var j = ae();
262
- function le({
261
+ var p = oe();
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
+ };
276
+ function se({
263
277
  isOpen: s,
264
278
  onClose: u,
265
279
  children: i,
266
- closeOnEsc: c = !0,
267
- closeOnOverlayClick: o = !0,
268
- animationDuration: l = 300,
269
- onBeforeOpen: f,
270
- onAfterOpen: d,
271
- onBeforeClose: b,
272
- onAfterClose: R
280
+ variant: f = "default",
281
+ closeOnEsc: o = !0,
282
+ closeOnOverlayClick: l = !0,
283
+ animationDuration: d = 300,
284
+ onBeforeOpen: m,
285
+ onAfterOpen: h,
286
+ onBeforeClose: T,
287
+ onAfterClose: v
273
288
  }) {
274
- if (F(() => (s ? (f?.(), d?.(), document.body.style.overflow = "hidden") : document.body.style.overflow = "", () => {
289
+ if (F(() => (s ? (m?.(), h?.(), document.body.style.overflow = "hidden") : document.body.style.overflow = "", () => {
275
290
  document.body.style.overflow = "";
276
291
  }), [s]), F(() => {
277
- if (!c) return;
278
- const m = (T) => {
279
- T.key === "Escape" && (b?.(), u(), R?.());
292
+ if (!o) return;
293
+ const c = (x) => {
294
+ x.key === "Escape" && (T?.(), u(), v?.());
280
295
  };
281
- return document.addEventListener("keydown", m), () => document.removeEventListener("keydown", m);
282
- }, [c, u]), !s) return null;
283
- const p = () => {
284
- o && (b?.(), u(), R?.());
285
- };
286
- return /* @__PURE__ */ j.jsx(
296
+ return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
297
+ }, [o, u]), !s) return null;
298
+ const k = () => {
299
+ l && (T?.(), u(), v?.());
300
+ }, b = U[f] || U.default;
301
+ return /* @__PURE__ */ p.jsx(
287
302
  "div",
288
303
  {
289
- className: "modal-overlay show",
290
- style: { transitionDuration: `${l}ms` },
291
- onClick: p,
304
+ className: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 transition-opacity",
305
+ style: { transitionDuration: `${d}ms` },
306
+ onClick: k,
292
307
  role: "dialog",
293
308
  "aria-modal": "true",
294
- children: /* @__PURE__ */ j.jsxs(
309
+ children: /* @__PURE__ */ p.jsxs(
295
310
  "div",
296
311
  {
297
- className: "modal-content",
298
- onClick: (m) => m.stopPropagation(),
312
+ className: `relative w-[90%] max-w-md rounded-xl bg-white px-10 py-8 text-center shadow-xl border-2 ${b.border} animate-fadeIn`,
313
+ onClick: (c) => c.stopPropagation(),
299
314
  children: [
300
- /* @__PURE__ */ j.jsx("button", { className: "modal-close", onClick: u, children: "×" }),
301
- i
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 })
302
326
  ]
303
327
  }
304
328
  )
@@ -306,5 +330,5 @@ function le({
306
330
  );
307
331
  }
308
332
  export {
309
- le as default
333
+ se as default
310
334
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andoniaina/react-modal",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Reusable, accessible and customizable React modal component",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
@@ -1 +0,0 @@
1
- .modal-overlay{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#00000080;display:flex;justify-content:center;align-items:center;z-index:1000;transition:opacity .3s ease}.modal-content{background-color:#fff;padding:2rem 2.5rem;border-radius:12px;box-shadow:0 4px 16px #00000040;max-width:400px;width:90%;text-align:center;position:relative;animation:fadeIn .3s ease-in-out}.modal-close{position:absolute;top:10px;right:10px;border:none;background:transparent;font-size:1.5rem;font-weight:700;cursor:pointer;line-height:1;color:#333}.modal-close:hover{color:#000}.modal-success h2{color:green;margin-bottom:.5rem;font-size:1.5rem}.modal-success p{margin-top:.5rem;font-size:1rem}.modal-error h2{color:red;margin-bottom:.5rem;font-size:1.5rem}.modal-error p{margin-top:.5rem;font-size:1rem}@keyframes fadeIn{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}.modal-content button{margin-top:1.5rem;padding:.5rem 1.2rem;border:none;border-radius:6px;background-color:#007bff;color:#fff;cursor:pointer;font-size:1rem}.modal-content button:hover{background-color:#0056b3}