@kvdbil/components 17.2.2 → 17.2.3

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.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("react-dom"),o=require("react-transition-group"),r=require("styled-components"),n=require("../../icons/components/CloseIcon.js"),a=require("../../utils/utils.js"),s=require("../FocusTrap.js");var d,l=(d=r)&&d.__esModule?d:{default:d};const u=r.css`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),i=require("react-dom"),o=require("react-transition-group"),n=require("styled-components"),r=require("../../icons/components/CloseIcon.js"),a=require("../../utils/utils.js"),s=require("../FocusTrap.js");var d,l=(d=n)&&d.__esModule?d:{default:d};const c=n.css`
2
2
  .backgroundTransition-enter {
3
3
  opacity: 0;
4
4
  }
@@ -16,8 +16,8 @@
16
16
  opacity: 0;
17
17
  transition: opacity 0.25s ease-in-out;
18
18
  }
19
- `,c=l.default.div`
20
- ${u}
19
+ `,u=l.default.div`
20
+ ${c}
21
21
  position: fixed;
22
22
  width: 100%;
23
23
  height: 100%;
@@ -25,15 +25,19 @@
25
25
  left: 0;
26
26
  z-index: 200;
27
27
  `,p=l.default.div`
28
+ width: 100%;
29
+ height: 100%;
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ `,x=l.default.div`
28
34
  z-index: -1;
29
35
  position: absolute;
30
36
  width: 100%;
31
37
  height: 100%;
32
38
  background-color: rgba(34, 34, 34, 0.3);
33
- `,x=l.default.div`
39
+ `,b=l.default.div`
34
40
  position: relative;
35
- max-width: 512px;
36
- max-height: 90vh;
37
41
  overflow-y: auto;
38
42
 
39
43
  padding: 1rem;
@@ -45,17 +49,9 @@
45
49
  0px 11px 15px rgba(0, 0, 0, 0.15);
46
50
 
47
51
  margin: 1rem;
48
- margin-top: 50vh;
49
- transform: translateY(-50%);
50
- margin-left: 1rem;
51
- margin-right: 1rem;
52
-
53
- @media (min-width: 500px) {
54
- margin-left: auto;
55
- margin-right: auto;
56
- min-width: 355px;
57
- }
58
- `,m=l.default.button`
52
+ width: 80vw;
53
+ max-width: 512px;
54
+ `,w=l.default.button`
59
55
  ${a.resetButtonStyle}
60
56
  display: flex;
61
57
  justify-self: flex-end;
@@ -71,12 +67,12 @@
71
67
  svg {
72
68
  font-size: 1.5rem;
73
69
  }
74
- `,g=r.createGlobalStyle`
70
+ `,g=n.createGlobalStyle`
75
71
  body {
76
72
  overflow: hidden;
77
73
 
78
74
  ${typeof window<"u"&&window.innerWidth>1024&&"\n padding-right: 15px !important;\n "}
79
75
  }
80
- `,h=r.createGlobalStyle`
81
- ${u}
82
- `,b=({children:r,isOpen:a,contentStyles:d,withPortal:l=!1,withCloseIcon:u=!0,onClose:b,focusTrapProps:w={},...f})=>{t.useEffect((()=>{const e=e=>{"Escape"===e.key&&a&&b()};return a&&window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}}),[b,a]);const y=!!(typeof window<"u"&&window.document&&window.document.createElement),v=e.jsx(o.CSSTransition,{in:a,mountOnEnter:!0,unmountOnExit:!0,timeout:400,classNames:"backgroundTransition",children:e.jsxs(e.Fragment,{children:[e.jsx(h,{}),e.jsxs(c,{...f,children:[e.jsx(p,{"data-testid":"background",onClick:b}),e.jsx(s.FocusTrap,{pause:!a,...w,children:e.jsxs(x,{style:d,role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[u&&e.jsx(m,{onClick:b,"data-testid":"close",type:"button","aria-label":"Close dialog",children:e.jsx(n.default,{})}),r]})}),e.jsx(g,{})]})]})});return l&&y?i.createPortal(v,document.body):v};exports.Modal=b,exports.default=b;
76
+ `,h=n.createGlobalStyle`
77
+ ${c}
78
+ `,y=({children:n,isOpen:a,contentStyles:d,withPortal:l=!1,withCloseIcon:c=!0,onClose:y,focusTrapProps:f={},...m})=>{t.useEffect((()=>{const e=e=>{"Escape"===e.key&&a&&y()};return a&&window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}}),[y,a]);const v=!!(typeof window<"u"&&window.document&&window.document.createElement),j=e.jsx(o.CSSTransition,{in:a,mountOnEnter:!0,unmountOnExit:!0,timeout:400,classNames:"backgroundTransition",children:e.jsxs(e.Fragment,{children:[e.jsx(h,{}),e.jsxs(u,{...m,children:[e.jsx(x,{"data-testid":"background",onClick:y}),e.jsx(s.FocusTrap,{pause:!a,...f,children:e.jsx(p,{children:e.jsxs(b,{style:d,role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[c&&e.jsx(w,{onClick:y,"data-testid":"close",type:"button","aria-label":"Close dialog",children:e.jsx(r.default,{})}),n]})})}),e.jsx(g,{})]})]})});return l&&v?i.createPortal(j,document.body):j};exports.Modal=y,exports.default=y;
@@ -1,4 +1,4 @@
1
- import{jsx as t,jsxs as r,Fragment as w}from"react/jsx-runtime";import{useEffect as b}from"react";import{createPortal as y}from"react-dom";import{CSSTransition as v}from"react-transition-group";import e,{css as k,createGlobalStyle as d}from"styled-components";import T from"../../icons/components/CloseIcon.js";import{resetButtonStyle as E}from"../../utils/utils.js";import{FocusTrap as C}from"../FocusTrap.js";const s=k`
1
+ import{jsx as t,jsxs as n,Fragment as b}from"react/jsx-runtime";import{useEffect as g}from"react";import{createPortal as y}from"react-dom";import{CSSTransition as v}from"react-transition-group";import e,{css as k,createGlobalStyle as d}from"styled-components";import T from"../../icons/components/CloseIcon.js";import{resetButtonStyle as E}from"../../utils/utils.js";import{FocusTrap as C}from"../FocusTrap.js";const s=k`
2
2
  .backgroundTransition-enter {
3
3
  opacity: 0;
4
4
  }
@@ -24,16 +24,20 @@ import{jsx as t,jsxs as r,Fragment as w}from"react/jsx-runtime";import{useEffect
24
24
  top: 0;
25
25
  left: 0;
26
26
  z-index: 200;
27
+ `,j=e.div`
28
+ width: 100%;
29
+ height: 100%;
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
27
33
  `,P=e.div`
28
34
  z-index: -1;
29
35
  position: absolute;
30
36
  width: 100%;
31
37
  height: 100%;
32
38
  background-color: rgba(34, 34, 34, 0.3);
33
- `,$=e.div`
39
+ `,z=e.div`
34
40
  position: relative;
35
- max-width: 512px;
36
- max-height: 90vh;
37
41
  overflow-y: auto;
38
42
 
39
43
  padding: 1rem;
@@ -45,17 +49,9 @@ import{jsx as t,jsxs as r,Fragment as w}from"react/jsx-runtime";import{useEffect
45
49
  0px 11px 15px rgba(0, 0, 0, 0.15);
46
50
 
47
51
  margin: 1rem;
48
- margin-top: 50vh;
49
- transform: translateY(-50%);
50
- margin-left: 1rem;
51
- margin-right: 1rem;
52
-
53
- @media (min-width: 500px) {
54
- margin-left: auto;
55
- margin-right: auto;
56
- min-width: 355px;
57
- }
58
- `,j=e.button`
52
+ width: 80vw;
53
+ max-width: 512px;
54
+ `,F=e.button`
59
55
  ${E}
60
56
  display: flex;
61
57
  justify-self: flex-end;
@@ -71,7 +67,7 @@ import{jsx as t,jsxs as r,Fragment as w}from"react/jsx-runtime";import{useEffect
71
67
  svg {
72
68
  font-size: 1.5rem;
73
69
  }
74
- `,z=d`
70
+ `,O=d`
75
71
  body {
76
72
  overflow: hidden;
77
73
 
@@ -79,6 +75,6 @@ import{jsx as t,jsxs as r,Fragment as w}from"react/jsx-runtime";import{useEffect
79
75
  padding-right: 15px !important;
80
76
  `}
81
77
  }
82
- `,F=d`
78
+ `,L=d`
83
79
  ${s}
84
- `,l=({children:c,isOpen:o,contentStyles:p,withPortal:m=!1,withCloseIcon:u=!0,onClose:i,focusTrapProps:g={},...h})=>{b(()=>{const a=x=>{x.key==="Escape"&&o&&i()};return o&&window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[i,o]);const f=!!(typeof window<"u"&&window.document&&window.document.createElement),n=t(v,{in:o,mountOnEnter:!0,unmountOnExit:!0,timeout:400,classNames:"backgroundTransition",children:r(w,{children:[t(F,{}),r(S,{...h,children:[t(P,{"data-testid":"background",onClick:i}),t(C,{pause:!o,...g,children:r($,{style:p,role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[u&&t(j,{onClick:i,"data-testid":"close",type:"button","aria-label":"Close dialog",children:t(T,{})}),c]})}),t(z,{})]})]})});return m&&f?y(n,document.body):n};export{l as Modal,l as default};
80
+ `,c=({children:l,isOpen:o,contentStyles:p,withPortal:u=!1,withCloseIcon:m=!0,onClose:i,focusTrapProps:f={},...w})=>{g(()=>{const a=x=>{x.key==="Escape"&&o&&i()};return o&&window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[i,o]);const h=!!(typeof window<"u"&&window.document&&window.document.createElement),r=t(v,{in:o,mountOnEnter:!0,unmountOnExit:!0,timeout:400,classNames:"backgroundTransition",children:n(b,{children:[t(L,{}),n(S,{...w,children:[t(P,{"data-testid":"background",onClick:i}),t(C,{pause:!o,...f,children:t(j,{children:n(z,{style:p,role:"dialog","aria-modal":"true","aria-labelledby":"modal-title",children:[m&&t(F,{onClick:i,"data-testid":"close",type:"button","aria-label":"Close dialog",children:t(T,{})}),l]})})}),t(O,{})]})]})});return u&&h?y(r,document.body):r};export{c as Modal,c as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvdbil/components",
3
- "version": "17.2.2",
3
+ "version": "17.2.3",
4
4
  "sideEffects": false,
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
package/package.json.tmp CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvdbil/components",
3
- "version": "17.2.2",
3
+ "version": "17.2.3",
4
4
  "sideEffects": false,
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",