benal18-modal 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -1,15 +1,12 @@
1
- # Modal
2
-
3
- ## Prérequis
4
-
5
- - version de node JS
6
- - éditeur de texte recommandé
7
- - version de React
8
-
9
- ## Installation
10
-
11
- - commande npm install
12
-
13
- ## Utilisation
14
-
15
- ................
1
+ # React + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## Expanding the ESLint configuration
11
+
12
+ If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
@@ -0,0 +1,346 @@
1
+ import te, { useEffect as ne } from "react";
2
+ import O from "styled-components";
3
+ var R = { exports: {} }, p = {};
4
+ /**
5
+ * @license React
6
+ * react-jsx-runtime.production.js
7
+ *
8
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ */
13
+ var D;
14
+ function oe() {
15
+ if (D) return p;
16
+ D = 1;
17
+ var u = Symbol.for("react.transitional.element"), i = Symbol.for("react.fragment");
18
+ function m(f, a, s) {
19
+ var c = null;
20
+ if (s !== void 0 && (c = "" + s), a.key !== void 0 && (c = "" + a.key), "key" in a) {
21
+ s = {};
22
+ for (var b in a)
23
+ b !== "key" && (s[b] = a[b]);
24
+ } else s = a;
25
+ return a = s.ref, {
26
+ $$typeof: u,
27
+ type: f,
28
+ key: c,
29
+ ref: a !== void 0 ? a : null,
30
+ props: s
31
+ };
32
+ }
33
+ return p.Fragment = i, p.jsx = m, p.jsxs = m, p;
34
+ }
35
+ var v = {};
36
+ /**
37
+ * @license React
38
+ * react-jsx-runtime.development.js
39
+ *
40
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
41
+ *
42
+ * This source code is licensed under the MIT license found in the
43
+ * LICENSE file in the root directory of this source tree.
44
+ */
45
+ var M;
46
+ function ae() {
47
+ return M || (M = 1, process.env.NODE_ENV !== "production" && (function() {
48
+ function u(e) {
49
+ if (e == null) return null;
50
+ if (typeof e == "function")
51
+ return e.$$typeof === K ? null : e.displayName || e.name || null;
52
+ if (typeof e == "string") return e;
53
+ switch (e) {
54
+ case T:
55
+ return "Fragment";
56
+ case J:
57
+ return "Profiler";
58
+ case q:
59
+ return "StrictMode";
60
+ case B:
61
+ return "Suspense";
62
+ case H:
63
+ return "SuspenseList";
64
+ case Q:
65
+ return "Activity";
66
+ }
67
+ if (typeof e == "object")
68
+ switch (typeof e.tag == "number" && console.error(
69
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
70
+ ), e.$$typeof) {
71
+ case z:
72
+ return "Portal";
73
+ case G:
74
+ return (e.displayName || "Context") + ".Provider";
75
+ case V:
76
+ return (e._context.displayName || "Context") + ".Consumer";
77
+ case X:
78
+ var r = e.render;
79
+ return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
80
+ case Z:
81
+ return r = e.displayName || null, r !== null ? r : u(e.type) || "Memo";
82
+ case P:
83
+ r = e._payload, e = e._init;
84
+ try {
85
+ return u(e(r));
86
+ } catch {
87
+ }
88
+ }
89
+ return null;
90
+ }
91
+ function i(e) {
92
+ return "" + e;
93
+ }
94
+ function m(e) {
95
+ try {
96
+ i(e);
97
+ var r = !1;
98
+ } catch {
99
+ r = !0;
100
+ }
101
+ if (r) {
102
+ r = console;
103
+ var t = r.error, n = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
104
+ return t.call(
105
+ r,
106
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
107
+ n
108
+ ), i(e);
109
+ }
110
+ }
111
+ function f(e) {
112
+ if (e === T) return "<>";
113
+ if (typeof e == "object" && e !== null && e.$$typeof === P)
114
+ return "<...>";
115
+ try {
116
+ var r = u(e);
117
+ return r ? "<" + r + ">" : "<...>";
118
+ } catch {
119
+ return "<...>";
120
+ }
121
+ }
122
+ function a() {
123
+ var e = k.A;
124
+ return e === null ? null : e.getOwner();
125
+ }
126
+ function s() {
127
+ return Error("react-stack-top-frame");
128
+ }
129
+ function c(e) {
130
+ if (N.call(e, "key")) {
131
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
132
+ if (r && r.isReactWarning) return !1;
133
+ }
134
+ return e.key !== void 0;
135
+ }
136
+ function b(e, r) {
137
+ function t() {
138
+ C || (C = !0, console.error(
139
+ "%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)",
140
+ r
141
+ ));
142
+ }
143
+ t.isReactWarning = !0, Object.defineProperty(e, "key", {
144
+ get: t,
145
+ configurable: !0
146
+ });
147
+ }
148
+ function W() {
149
+ var e = u(this.type);
150
+ return Y[e] || (Y[e] = !0, console.error(
151
+ "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."
152
+ )), e = this.props.ref, e !== void 0 ? e : null;
153
+ }
154
+ function U(e, r, t, n, d, l, h, g) {
155
+ return t = l.ref, e = {
156
+ $$typeof: S,
157
+ type: e,
158
+ key: r,
159
+ props: l,
160
+ _owner: d
161
+ }, (t !== void 0 ? t : null) !== null ? Object.defineProperty(e, "ref", {
162
+ enumerable: !1,
163
+ get: W
164
+ }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
165
+ configurable: !1,
166
+ enumerable: !1,
167
+ writable: !0,
168
+ value: 0
169
+ }), Object.defineProperty(e, "_debugInfo", {
170
+ configurable: !1,
171
+ enumerable: !1,
172
+ writable: !0,
173
+ value: null
174
+ }), Object.defineProperty(e, "_debugStack", {
175
+ configurable: !1,
176
+ enumerable: !1,
177
+ writable: !0,
178
+ value: h
179
+ }), Object.defineProperty(e, "_debugTask", {
180
+ configurable: !1,
181
+ enumerable: !1,
182
+ writable: !0,
183
+ value: g
184
+ }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
185
+ }
186
+ function j(e, r, t, n, d, l, h, g) {
187
+ var o = r.children;
188
+ if (o !== void 0)
189
+ if (n)
190
+ if (ee(o)) {
191
+ for (n = 0; n < o.length; n++)
192
+ A(o[n]);
193
+ Object.freeze && Object.freeze(o);
194
+ } else
195
+ console.error(
196
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
197
+ );
198
+ else A(o);
199
+ if (N.call(r, "key")) {
200
+ o = u(e);
201
+ var E = Object.keys(r).filter(function(re) {
202
+ return re !== "key";
203
+ });
204
+ n = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", $[o + n] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
205
+ `A props object containing a "key" prop is being spread into JSX:
206
+ let props = %s;
207
+ <%s {...props} />
208
+ React keys must be passed directly to JSX without using spread:
209
+ let props = %s;
210
+ <%s key={someKey} {...props} />`,
211
+ n,
212
+ o,
213
+ E,
214
+ o
215
+ ), $[o + n] = !0);
216
+ }
217
+ if (o = null, t !== void 0 && (m(t), o = "" + t), c(r) && (m(r.key), o = "" + r.key), "key" in r) {
218
+ t = {};
219
+ for (var w in r)
220
+ w !== "key" && (t[w] = r[w]);
221
+ } else t = r;
222
+ return o && b(
223
+ t,
224
+ typeof e == "function" ? e.displayName || e.name || "Unknown" : e
225
+ ), U(
226
+ e,
227
+ o,
228
+ l,
229
+ d,
230
+ a(),
231
+ t,
232
+ h,
233
+ g
234
+ );
235
+ }
236
+ function A(e) {
237
+ typeof e == "object" && e !== null && e.$$typeof === S && e._store && (e._store.validated = 1);
238
+ }
239
+ var _ = te, S = Symbol.for("react.transitional.element"), z = 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"), G = Symbol.for("react.context"), X = Symbol.for("react.forward_ref"), B = Symbol.for("react.suspense"), H = Symbol.for("react.suspense_list"), Z = Symbol.for("react.memo"), P = Symbol.for("react.lazy"), Q = Symbol.for("react.activity"), K = Symbol.for("react.client.reference"), k = _.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, N = Object.prototype.hasOwnProperty, ee = Array.isArray, x = console.createTask ? console.createTask : function() {
240
+ return null;
241
+ };
242
+ _ = {
243
+ react_stack_bottom_frame: function(e) {
244
+ return e();
245
+ }
246
+ };
247
+ var C, Y = {}, F = _.react_stack_bottom_frame.bind(
248
+ _,
249
+ s
250
+ )(), I = x(f(s)), $ = {};
251
+ v.Fragment = T, v.jsx = function(e, r, t, n, d) {
252
+ var l = 1e4 > k.recentlyCreatedOwnerStacks++;
253
+ return j(
254
+ e,
255
+ r,
256
+ t,
257
+ !1,
258
+ n,
259
+ d,
260
+ l ? Error("react-stack-top-frame") : F,
261
+ l ? x(f(e)) : I
262
+ );
263
+ }, v.jsxs = function(e, r, t, n, d) {
264
+ var l = 1e4 > k.recentlyCreatedOwnerStacks++;
265
+ return j(
266
+ e,
267
+ r,
268
+ t,
269
+ !0,
270
+ n,
271
+ d,
272
+ l ? Error("react-stack-top-frame") : F,
273
+ l ? x(f(e)) : I
274
+ );
275
+ };
276
+ })()), v;
277
+ }
278
+ var L;
279
+ function se() {
280
+ return L || (L = 1, process.env.NODE_ENV === "production" ? R.exports = oe() : R.exports = ae()), R.exports;
281
+ }
282
+ var y = se();
283
+ function de({
284
+ isOpen: u,
285
+ onClose: i,
286
+ closeOnOverlayClick: m = !0,
287
+ closeOnEsc: f = !0,
288
+ children: a
289
+ }) {
290
+ const s = (c) => {
291
+ m && c.target === c.currentTarget && i();
292
+ };
293
+ return ne(() => {
294
+ if (!u || !f) return;
295
+ const c = (b) => {
296
+ b.key === "Escape" && i();
297
+ };
298
+ return document.addEventListener("keydown", c), () => document.removeEventListener("keydown", c);
299
+ }, [u, f, i]), u ? /* @__PURE__ */ y.jsx(ue, { onClick: s, children: /* @__PURE__ */ y.jsxs(ce, { children: [
300
+ /* @__PURE__ */ y.jsx(le, { onClick: i, "aria-label": "Fermer la modale", children: "×" }),
301
+ a
302
+ ] }) }) : null;
303
+ }
304
+ const ue = O.div`
305
+ position: fixed;
306
+ top: 0;
307
+ left: 0;
308
+ right: 0;
309
+ bottom: 0;
310
+ background-color: rgba(0, 0, 0, 0.5);
311
+ display: flex;
312
+ align-items: center;
313
+ justify-content: center;
314
+ z-index: 50;
315
+ `, ce = O.div`
316
+ background-color: white;
317
+ border-radius: 12px;
318
+ padding: 24px;
319
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
320
+ position: relative;
321
+ max-width: 90vw;
322
+ max-height: 90vh;
323
+ overflow: auto;
324
+ `, le = O.button`
325
+ position: absolute;
326
+ top: 8px;
327
+ right: 8px;
328
+ color: #666;
329
+ background: none;
330
+ border: none;
331
+ font-size: 18px;
332
+ cursor: pointer;
333
+ width: 30px;
334
+ height: 30px;
335
+ display: flex;
336
+ align-items: center;
337
+ justify-content: center;
338
+
339
+ &:hover {
340
+ color: #000;
341
+ background-color: #f5f5f5;
342
+ }
343
+ `;
344
+ export {
345
+ de as default
346
+ };
@@ -0,0 +1,61 @@
1
+ (function(f,p){typeof exports=="object"&&typeof module<"u"?module.exports=p(require("react"),require("styled-components")):typeof define=="function"&&define.amd?define(["react","styled-components"],p):(f=typeof globalThis<"u"?globalThis:f||self,f.BenalModal=p(f.React,f.styled))})(this,(function(f,p){"use strict";var T={exports:{}},R={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var A;function U(){if(A)return R;A=1;var u=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function E(d,a,s){var c=null;if(s!==void 0&&(c=""+s),a.key!==void 0&&(c=""+a.key),"key"in a){s={};for(var b in a)b!=="key"&&(s[b]=a[b])}else s=a;return a=s.ref,{$$typeof:u,type:d,key:c,ref:a!==void 0?a:null,props:s}}return R.Fragment=l,R.jsx=E,R.jsxs=E,R}var _={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var S;function z(){return S||(S=1,process.env.NODE_ENV!=="production"&&(function(){function u(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===ue?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case h:return"Fragment";case K:return"Profiler";case Q:return"StrictMode";case ne:return"Suspense";case oe:return"SuspenseList";case se: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 Z:return"Portal";case re:return(e.displayName||"Context")+".Provider";case ee:return(e._context.displayName||"Context")+".Consumer";case te:var r=e.render;return e=e.displayName,e||(e=r.displayName||r.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ae:return r=e.displayName||null,r!==null?r:u(e.type)||"Memo";case F:r=e._payload,e=e._init;try{return u(e(r))}catch{}}return null}function l(e){return""+e}function E(e){try{l(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),l(e)}}function d(e){if(e===h)return"<>";if(typeof e=="object"&&e!==null&&e.$$typeof===F)return"<...>";try{var r=u(e);return r?"<"+r+">":"<...>"}catch{return"<...>"}}function a(){var e=g.A;return e===null?null:e.getOwner()}function s(){return Error("react-stack-top-frame")}function c(e){if(I.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function b(e,r){function t(){M||(M=!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=u(this.type);return D[e]||(D[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 H(e,r,t,n,m,i,y,j){return t=i.ref,e={$$typeof:Y,type:e,key:r,props:i,_owner:m},(t!==void 0?t: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:j}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function N(e,r,t,n,m,i,y,j){var o=r.children;if(o!==void 0)if(n)if(ce(o)){for(n=0;n<o.length;n++)C(o[n]);Object.freeze&&Object.freeze(o)}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 C(o);if(I.call(r,"key")){o=u(e);var v=Object.keys(r).filter(function(ie){return ie!=="key"});n=0<v.length?"{key: someKey, "+v.join(": ..., ")+": ...}":"{key: someKey}",$[o+n]||(v=0<v.length?"{"+v.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
+ let props = %s;
19
+ <%s {...props} />
20
+ React keys must be passed directly to JSX without using spread:
21
+ let props = %s;
22
+ <%s key={someKey} {...props} />`,n,o,v,o),$[o+n]=!0)}if(o=null,t!==void 0&&(E(t),o=""+t),c(r)&&(E(r.key),o=""+r.key),"key"in r){t={};for(var O in r)O!=="key"&&(t[O]=r[O])}else t=r;return o&&b(t,typeof e=="function"?e.displayName||e.name||"Unknown":e),H(e,o,i,m,a(),t,y,j)}function C(e){typeof e=="object"&&e!==null&&e.$$typeof===Y&&e._store&&(e._store.validated=1)}var k=f,Y=Symbol.for("react.transitional.element"),Z=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),re=Symbol.for("react.context"),te=Symbol.for("react.forward_ref"),ne=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),ue=Symbol.for("react.client.reference"),g=k.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=Object.prototype.hasOwnProperty,ce=Array.isArray,w=console.createTask?console.createTask:function(){return null};k={react_stack_bottom_frame:function(e){return e()}};var M,D={},L=k.react_stack_bottom_frame.bind(k,s)(),W=w(d(s)),$={};_.Fragment=h,_.jsx=function(e,r,t,n,m){var i=1e4>g.recentlyCreatedOwnerStacks++;return N(e,r,t,!1,n,m,i?Error("react-stack-top-frame"):L,i?w(d(e)):W)},_.jsxs=function(e,r,t,n,m){var i=1e4>g.recentlyCreatedOwnerStacks++;return N(e,r,t,!0,n,m,i?Error("react-stack-top-frame"):L,i?w(d(e)):W)}})()),_}var P;function q(){return P||(P=1,process.env.NODE_ENV==="production"?T.exports=U():T.exports=z()),T.exports}var x=q();function J({isOpen:u,onClose:l,closeOnOverlayClick:E=!0,closeOnEsc:d=!0,children:a}){const s=c=>{E&&c.target===c.currentTarget&&l()};return f.useEffect(()=>{if(!u||!d)return;const c=b=>{b.key==="Escape"&&l()};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[u,d,l]),u?x.jsx(V,{onClick:s,children:x.jsxs(G,{children:[x.jsx(X,{onClick:l,"aria-label":"Fermer la modale",children:"×"}),a]})}):null}const V=p.div`
23
+ position: fixed;
24
+ top: 0;
25
+ left: 0;
26
+ right: 0;
27
+ bottom: 0;
28
+ background-color: rgba(0, 0, 0, 0.5);
29
+ display: flex;
30
+ align-items: center;
31
+ justify-content: center;
32
+ z-index: 50;
33
+ `,G=p.div`
34
+ background-color: white;
35
+ border-radius: 12px;
36
+ padding: 24px;
37
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
38
+ position: relative;
39
+ max-width: 90vw;
40
+ max-height: 90vh;
41
+ overflow: auto;
42
+ `,X=p.button`
43
+ position: absolute;
44
+ top: 8px;
45
+ right: 8px;
46
+ color: #666;
47
+ background: none;
48
+ border: none;
49
+ font-size: 18px;
50
+ cursor: pointer;
51
+ width: 30px;
52
+ height: 30px;
53
+ display: flex;
54
+ align-items: center;
55
+ justify-content: center;
56
+
57
+ &:hover {
58
+ color: #000;
59
+ background-color: #f5f5f5;
60
+ }
61
+ `;return J}));
package/package.json CHANGED
@@ -1,7 +1,19 @@
1
1
  {
2
2
  "name": "benal18-modal",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
+ "description": "Modale réutilisable",
5
+ "keywords": [
6
+ "Modale",
7
+ "react"
8
+ ],
9
+ "author": "BEN SALAH Walid",
4
10
  "type": "module",
11
+ "main": "dist/BenalModal.cjs.js",
12
+ "module": "dist/BenalModal.esm.js",
13
+ "types": "dist/BenalModal.d.ts",
14
+ "files": [
15
+ "dist"
16
+ ],
5
17
  "scripts": {
6
18
  "dev": "vite",
7
19
  "build": "vite build",
package/eslint.config.js DELETED
@@ -1,29 +0,0 @@
1
- import js from '@eslint/js'
2
- import globals from 'globals'
3
- import reactHooks from 'eslint-plugin-react-hooks'
4
- import reactRefresh from 'eslint-plugin-react-refresh'
5
- import { defineConfig, globalIgnores } from 'eslint/config'
6
-
7
- export default defineConfig([
8
- globalIgnores(['dist']),
9
- {
10
- files: ['**/*.{js,jsx}'],
11
- extends: [
12
- js.configs.recommended,
13
- reactHooks.configs['recommended-latest'],
14
- reactRefresh.configs.vite,
15
- ],
16
- languageOptions: {
17
- ecmaVersion: 2020,
18
- globals: globals.browser,
19
- parserOptions: {
20
- ecmaVersion: 'latest',
21
- ecmaFeatures: { jsx: true },
22
- sourceType: 'module',
23
- },
24
- },
25
- rules: {
26
- 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
27
- },
28
- },
29
- ])
package/index.html DELETED
@@ -1,13 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Vite + React</title>
8
- </head>
9
- <body>
10
- <div id="root"></div>
11
- <script type="module" src="/src/main.jsx"></script>
12
- </body>
13
- </html>
package/src/App.css DELETED
@@ -1,42 +0,0 @@
1
- #root {
2
- max-width: 1280px;
3
- margin: 0 auto;
4
- padding: 2rem;
5
- text-align: center;
6
- }
7
-
8
- .logo {
9
- height: 6em;
10
- padding: 1.5em;
11
- will-change: filter;
12
- transition: filter 300ms;
13
- }
14
- .logo:hover {
15
- filter: drop-shadow(0 0 2em #646cffaa);
16
- }
17
- .logo.react:hover {
18
- filter: drop-shadow(0 0 2em #61dafbaa);
19
- }
20
-
21
- @keyframes logo-spin {
22
- from {
23
- transform: rotate(0deg);
24
- }
25
- to {
26
- transform: rotate(360deg);
27
- }
28
- }
29
-
30
- @media (prefers-reduced-motion: no-preference) {
31
- a:nth-of-type(2) .logo {
32
- animation: logo-spin infinite 20s linear;
33
- }
34
- }
35
-
36
- .card {
37
- padding: 2em;
38
- }
39
-
40
- .read-the-docs {
41
- color: #888;
42
- }
package/src/App.jsx DELETED
@@ -1,19 +0,0 @@
1
- import { useState } from "react";
2
- import Modal from "../src/components/Modal";
3
-
4
- function App() {
5
- const [isOpen, setIsOpen] = useState(false);
6
-
7
- return (
8
- <div>
9
- <button onClick={() => setIsOpen(true)}>Ouvrir la modale</button>
10
-
11
- <Modal isOpen={isOpen} onClose={() => setIsOpen(false)}>
12
- <p>Contenu de la modale</p>
13
- <button onClick={() => setIsOpen(false)}>Fermer</button>
14
- </Modal>
15
- </div>
16
- );
17
- }
18
-
19
- export default App;
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
@@ -1,90 +0,0 @@
1
- import { useEffect } from "react";
2
- import styled from "styled-components";
3
-
4
- function Modal({
5
- isOpen,
6
- onClose,
7
- closeOnOverlayClick = true,
8
- closeOnEsc = true,
9
- children,
10
- }) {
11
- const handleOverlayClick = (e) => {
12
- // Vérifie si on a cliqué directement sur l'overlay (et non sur son contenu)
13
- if (closeOnOverlayClick && e.target === e.currentTarget) {
14
- onClose();
15
- }
16
- };
17
-
18
- useEffect(() => {
19
- if (!isOpen || !closeOnEsc) return;
20
-
21
- const handleKeyDown = (e) => {
22
- if (e.key === "Escape") {
23
- onClose();
24
- }
25
- };
26
-
27
- document.addEventListener("keydown", handleKeyDown);
28
- return () => document.removeEventListener("keydown", handleKeyDown);
29
- }, [isOpen, closeOnEsc, onClose]);
30
-
31
- if (!isOpen) return null;
32
-
33
- return (
34
- <ModalOverlay onClick={handleOverlayClick}>
35
- <ModalContent>
36
- <CloseButton onClick={onClose} aria-label="Fermer la modale">
37
- ×
38
- </CloseButton>
39
- {children}
40
- </ModalContent>
41
- </ModalOverlay>
42
- );
43
- }
44
-
45
- export default Modal;
46
-
47
- const ModalOverlay = styled.div`
48
- position: fixed;
49
- top: 0;
50
- left: 0;
51
- right: 0;
52
- bottom: 0;
53
- background-color: rgba(0, 0, 0, 0.5);
54
- display: flex;
55
- align-items: center;
56
- justify-content: center;
57
- z-index: 50;
58
- `;
59
-
60
- const ModalContent = styled.div`
61
- background-color: white;
62
- border-radius: 12px;
63
- padding: 24px;
64
- box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
65
- position: relative;
66
- max-width: 90vw;
67
- max-height: 90vh;
68
- overflow: auto;
69
- `;
70
-
71
- const CloseButton = styled.button`
72
- position: absolute;
73
- top: 8px;
74
- right: 8px;
75
- color: #666;
76
- background: none;
77
- border: none;
78
- font-size: 18px;
79
- cursor: pointer;
80
- width: 30px;
81
- height: 30px;
82
- display: flex;
83
- align-items: center;
84
- justify-content: center;
85
-
86
- &:hover {
87
- color: #000;
88
- background-color: #f5f5f5;
89
- }
90
- `;
package/src/index.css DELETED
@@ -1,68 +0,0 @@
1
- :root {
2
- font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
3
- line-height: 1.5;
4
- font-weight: 400;
5
-
6
- color-scheme: light dark;
7
- color: rgba(255, 255, 255, 0.87);
8
- background-color: #242424;
9
-
10
- font-synthesis: none;
11
- text-rendering: optimizeLegibility;
12
- -webkit-font-smoothing: antialiased;
13
- -moz-osx-font-smoothing: grayscale;
14
- }
15
-
16
- a {
17
- font-weight: 500;
18
- color: #646cff;
19
- text-decoration: inherit;
20
- }
21
- a:hover {
22
- color: #535bf2;
23
- }
24
-
25
- body {
26
- margin: 0;
27
- display: flex;
28
- place-items: center;
29
- min-width: 320px;
30
- min-height: 100vh;
31
- }
32
-
33
- h1 {
34
- font-size: 3.2em;
35
- line-height: 1.1;
36
- }
37
-
38
- button {
39
- border-radius: 8px;
40
- border: 1px solid transparent;
41
- padding: 0.6em 1.2em;
42
- font-size: 1em;
43
- font-weight: 500;
44
- font-family: inherit;
45
- background-color: #1a1a1a;
46
- cursor: pointer;
47
- transition: border-color 0.25s;
48
- }
49
- button:hover {
50
- border-color: #646cff;
51
- }
52
- button:focus,
53
- button:focus-visible {
54
- outline: 4px auto -webkit-focus-ring-color;
55
- }
56
-
57
- @media (prefers-color-scheme: light) {
58
- :root {
59
- color: #213547;
60
- background-color: #ffffff;
61
- }
62
- a:hover {
63
- color: #747bff;
64
- }
65
- button {
66
- background-color: #f9f9f9;
67
- }
68
- }
package/src/main.jsx DELETED
@@ -1,10 +0,0 @@
1
- import { StrictMode } from 'react'
2
- import { createRoot } from 'react-dom/client'
3
- import './index.css'
4
- import App from './App.jsx'
5
-
6
- createRoot(document.getElementById('root')).render(
7
- <StrictMode>
8
- <App />
9
- </StrictMode>,
10
- )
package/vite.config.js DELETED
@@ -1,7 +0,0 @@
1
- import { defineConfig } from 'vite'
2
- import react from '@vitejs/plugin-react'
3
-
4
- // https://vite.dev/config/
5
- export default defineConfig({
6
- plugins: [react()],
7
- })
File without changes