@kvdbil/components 12.0.0 → 12.0.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.
@@ -6,4 +6,4 @@
6
6
  justify-content: flex-end;
7
7
  gap: 1rem;
8
8
  overflow-x: hidden;
9
- `,s=({isOpen:f,title:c,children:h,actions:p,onClose:g,withPortal:y,withCloseIcon:m=!0})=>o.default.createElement(r.Modal,{onClose:g,withPortal:y,isOpen:f,withCloseIcon:m},typeof c=="string"?o.default.createElement(u,null,c):c,o.default.createElement("div",null,h),p&&o.default.createElement(d,null,p));exports.Dialog=s,exports.default=s;
9
+ `,s=({isOpen:f,title:c,children:h,actions:p,onClose:g,withPortal:y,withCloseIcon:m=!0,...q})=>o.default.createElement(r.Modal,{onClose:g,withPortal:y,isOpen:f,withCloseIcon:m,...q},typeof c=="string"?o.default.createElement(u,null,c):c,o.default.createElement("div",null,h),p&&o.default.createElement(d,null,p));exports.Dialog=s,exports.default=s;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-dom"),n=require("react-transition-group"),i=require("styled-components"),r=require("../Icons/Close.js");function o(h){return h&&typeof h=="object"&&"default"in h?h:{default:h}}var a=o(e),d=o(i);const l=i.css`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react-dom"),n=require("react-transition-group"),i=require("styled-components"),r=require("../Icons/Close.js");function o(x){return x&&typeof x=="object"&&"default"in x?x:{default:x}}var a=o(e),d=o(i);const l=i.css`
2
2
  .backgroundTransition-enter {
3
3
  opacity: 0;
4
4
  }
@@ -74,4 +74,4 @@
74
74
  }
75
75
  `,f=i.createGlobalStyle`
76
76
  ${l}
77
- `,g=({children:h,isOpen:w,contentStyles:v,withPortal:E=!1,withCloseIcon:k=!0,onClose:x})=>{e.useEffect(()=>{const y=C=>{C.key==="Escape"&&w&&x()};return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}},[x,w]);const T=!(typeof window=="undefined"||!window.document||!window.document.createElement),b=a.default.createElement(n.CSSTransition,{in:w,mountOnEnter:!0,unmountOnExit:!0,timeout:400,classNames:"backgroundTransition"},a.default.createElement(a.default.Fragment,null,a.default.createElement(f,null),a.default.createElement(u,null,a.default.createElement(c,{"data-testid":"background",onClick:x}),a.default.createElement(s,{style:v},k&&a.default.createElement(p,{onClick:x,"data-testid":"close"},a.default.createElement(r.default,null)),h),a.default.createElement(m,null))));return E&&T?t.createPortal(b,document.body):b};exports.Modal=g,exports.default=g;
77
+ `,g=({children:x,isOpen:b,contentStyles:v,withPortal:E=!1,withCloseIcon:k=!0,onClose:h,...T})=>{e.useEffect(()=>{const y=q=>{q.key==="Escape"&&b&&h()};return window.addEventListener("keydown",y),()=>{window.removeEventListener("keydown",y)}},[h,b]);const C=!(typeof window=="undefined"||!window.document||!window.document.createElement),w=a.default.createElement(n.CSSTransition,{in:b,mountOnEnter:!0,unmountOnExit:!0,timeout:400,classNames:"backgroundTransition"},a.default.createElement(a.default.Fragment,null,a.default.createElement(f,null),a.default.createElement(u,{...T},a.default.createElement(c,{"data-testid":"background",onClick:h}),a.default.createElement(s,{style:v},k&&a.default.createElement(p,{onClick:h,"data-testid":"close"},a.default.createElement(r.default,null)),x),a.default.createElement(m,null))));return E&&C?t.createPortal(w,document.body):w};exports.Modal=g,exports.default=g;
@@ -1,9 +1,9 @@
1
- import e from"react";import r from"styled-components";import{Modal as d}from"../Modal/index.js";import p from"../../theme.js";import{TinyTitleBold as c}from"../../typography/Heading/index.js";import"react-dom";import"react-transition-group";import"../Icons/Close.js";import"../../shared/media-queries.js";const f=r(c)`
2
- font-weight: ${p.typography.fontAlternativeRegularWeight};
1
+ import e from"react";import r from"styled-components";import{Modal as p}from"../Modal/index.js";import c from"../../theme.js";import{TinyTitleBold as f}from"../../typography/Heading/index.js";import"react-dom";import"react-transition-group";import"../Icons/Close.js";import"../../shared/media-queries.js";const g=r(f)`
2
+ font-weight: ${c.typography.fontAlternativeRegularWeight};
3
3
  margin: 0;
4
- `,g=r.div`
4
+ `,u=r.div`
5
5
  display: flex;
6
6
  justify-content: flex-end;
7
7
  gap: 1rem;
8
8
  overflow-x: hidden;
9
- `,n=({isOpen:i,title:t,children:l,actions:o,onClose:m,withPortal:a,withCloseIcon:s=!0})=>e.createElement(d,{onClose:m,withPortal:a,isOpen:i,withCloseIcon:s},typeof t=="string"?e.createElement(f,null,t):t,e.createElement("div",null,l),o&&e.createElement(g,null,o));export{n as Dialog,n as default};
9
+ `,n=({isOpen:i,title:t,children:l,actions:o,onClose:m,withPortal:a,withCloseIcon:s=!0,...d})=>e.createElement(p,{onClose:m,withPortal:a,isOpen:i,withCloseIcon:s,...d},typeof t=="string"?e.createElement(g,null,t):t,e.createElement("div",null,l),o&&e.createElement(u,null,o));export{n as Dialog,n as default};
@@ -1,4 +1,4 @@
1
- import t,{useEffect as w}from"react";import{createPortal as h}from"react-dom";import{CSSTransition as x}from"react-transition-group";import n,{css as f,createGlobalStyle as a}from"styled-components";import b from"../Icons/Close.js";const d=f`
1
+ import t,{useEffect as h}from"react";import{createPortal as x}from"react-dom";import{CSSTransition as f}from"react-transition-group";import n,{css as b,createGlobalStyle as a}from"styled-components";import y from"../Icons/Close.js";const d=b`
2
2
  .backgroundTransition-enter {
3
3
  opacity: 0;
4
4
  }
@@ -16,7 +16,7 @@ import t,{useEffect as w}from"react";import{createPortal as h}from"react-dom";im
16
16
  opacity: 0;
17
17
  transition: opacity 0.25s ease-in-out;
18
18
  }
19
- `,y=n.div`
19
+ `,k=n.div`
20
20
  ${d}
21
21
  position: fixed;
22
22
  width: 100%;
@@ -24,13 +24,13 @@ import t,{useEffect as w}from"react";import{createPortal as h}from"react-dom";im
24
24
  top: 0;
25
25
  left: 0;
26
26
  z-index: 200;
27
- `,k=n.div`
27
+ `,E=n.div`
28
28
  z-index: -1;
29
29
  position: absolute;
30
30
  width: 100%;
31
31
  height: 100%;
32
32
  background-color: rgba(34, 34, 34, 0.3);
33
- `,E=n.div`
33
+ `,v=n.div`
34
34
  position: relative;
35
35
  max-width: 512px;
36
36
  padding: 1rem;
@@ -51,7 +51,7 @@ import t,{useEffect as w}from"react";import{createPortal as h}from"react-dom";im
51
51
  margin-right: auto;
52
52
  min-width: 355px;
53
53
  }
54
- `,v=n.div`
54
+ `,T=n.div`
55
55
  position: absolute;
56
56
  top: 1rem;
57
57
  right: 1rem;
@@ -64,7 +64,7 @@ import t,{useEffect as w}from"react";import{createPortal as h}from"react-dom";im
64
64
  width: 1rem;
65
65
  height: 1rem;
66
66
  }
67
- `,T=a`
67
+ `,C=a`
68
68
  body {
69
69
  overflow: hidden;
70
70
 
@@ -72,6 +72,6 @@ import t,{useEffect as w}from"react";import{createPortal as h}from"react-dom";im
72
72
  padding-right: 15px !important;
73
73
  `}
74
74
  }
75
- `,C=a`
75
+ `,S=a`
76
76
  ${d}
77
- `,c=({children:s,isOpen:o,contentStyles:m,withPortal:l=!1,withCloseIcon:u=!0,onClose:e})=>{w(()=>{const r=g=>{g.key==="Escape"&&o&&e()};return window.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",r)}},[e,o]);const p=!!(typeof window!="undefined"&&window.document&&window.document.createElement),i=t.createElement(x,{in:o,mountOnEnter:!0,unmountOnExit:!0,timeout:400,classNames:"backgroundTransition"},t.createElement(t.Fragment,null,t.createElement(C,null),t.createElement(y,null,t.createElement(k,{"data-testid":"background",onClick:e}),t.createElement(E,{style:m},u&&t.createElement(v,{onClick:e,"data-testid":"close"},t.createElement(b,null)),s),t.createElement(T,null))));return l&&p?h(i,document.body):i};export{c as Modal,c as default};
77
+ `,c=({children:s,isOpen:o,contentStyles:m,withPortal:l=!1,withCloseIcon:p=!0,onClose:e,...u})=>{h(()=>{const r=w=>{w.key==="Escape"&&o&&e()};return window.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",r)}},[e,o]);const g=!!(typeof window!="undefined"&&window.document&&window.document.createElement),i=t.createElement(f,{in:o,mountOnEnter:!0,unmountOnExit:!0,timeout:400,classNames:"backgroundTransition"},t.createElement(t.Fragment,null,t.createElement(S,null),t.createElement(k,{...u},t.createElement(E,{"data-testid":"background",onClick:e}),t.createElement(v,{style:m},p&&t.createElement(T,{onClick:e,"data-testid":"close"},t.createElement(y,null)),s),t.createElement(C,null))));return l&&g?x(i,document.body):i};export{c as Modal,c as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvdbil/components",
3
- "version": "12.0.0",
3
+ "version": "12.0.1",
4
4
  "sideEffects": false,
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -8,5 +8,5 @@ export interface DialogProps {
8
8
  withCloseIcon?: boolean;
9
9
  onClose(): void;
10
10
  }
11
- export declare const Dialog: ({ isOpen, title, children, actions, onClose, withPortal, withCloseIcon, }: DialogProps) => JSX.Element;
11
+ export declare const Dialog: ({ isOpen, title, children, actions, onClose, withPortal, withCloseIcon, ...props }: DialogProps) => JSX.Element;
12
12
  export default Dialog;
@@ -8,5 +8,5 @@ export interface ModalProps {
8
8
  contentStyles?: {};
9
9
  withCloseIcon?: boolean;
10
10
  }
11
- export declare const Modal: ({ children, isOpen, contentStyles, withPortal, withCloseIcon, onClose, }: ModalProps) => JSX.Element;
11
+ export declare const Modal: ({ children, isOpen, contentStyles, withPortal, withCloseIcon, onClose, ...props }: ModalProps) => JSX.Element;
12
12
  export default Modal;