@kvdbil/components 11.11.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.
- package/cjs/components/Dialog/index.js +6 -24
- package/cjs/components/Modal/index.js +4 -4
- package/esm/components/Dialog/index.js +6 -24
- package/esm/components/Modal/index.js +11 -11
- package/package.json +1 -1
- package/types/components/Dialog/index.d.ts +5 -14
- package/types/components/Modal/index.d.ts +2 -1
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),r=require("
|
|
2
|
-
|
|
3
|
-
`,d=u.default.div`
|
|
4
|
-
top: 20px;
|
|
5
|
-
left: 32px;
|
|
6
|
-
position: absolute;
|
|
7
|
-
`,c=u.default(i.TinyTitleBold)`
|
|
8
|
-
font-weight: ${({theme:x})=>x.typography.fontAlternativeRegularWeight};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("styled-components"),r=require("../Modal/index.js"),l=require("../../theme.js"),i=require("../../typography/Heading/index.js");function n(f){return f&&typeof f=="object"&&"default"in f?f:{default:f}}require("react-dom"),require("react-transition-group"),require("../Icons/Close.js"),require("../../shared/media-queries.js");var o=n(e),a=n(t);const u=a.default(i.TinyTitleBold)`
|
|
2
|
+
font-weight: ${l.default.typography.fontAlternativeRegularWeight};
|
|
9
3
|
margin: 0;
|
|
10
|
-
`,
|
|
4
|
+
`,d=a.default.div`
|
|
11
5
|
display: flex;
|
|
12
|
-
justify-content:
|
|
13
|
-
|
|
14
|
-
justify-content: flex-start;
|
|
15
|
-
}
|
|
6
|
+
justify-content: flex-end;
|
|
7
|
+
gap: 1rem;
|
|
16
8
|
overflow-x: hidden;
|
|
17
|
-
`,y
|
|
18
|
-
overflow-x: hidden;
|
|
19
|
-
margin-right: 2rem;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
width: 100%;
|
|
22
|
-
max-width: 110px;
|
|
23
|
-
`,p=u.default(n.Button)`
|
|
24
|
-
justify-content: center;
|
|
25
|
-
width: 100%;
|
|
26
|
-
max-width: 245px;
|
|
27
|
-
`,m=({isOpen:x,title:h,children:g,modalStyles:B,titleStyles:v,primaryButtonText:w,primaryButtonStyles:E,secondaryButtonStyles:S,secondaryButtonText:b,primaryButtonAction:q,secondaryButtonAction:j,onClose:C,withPortal:T,color:A="success"})=>a.default.createElement(l.Modal,{contentStyles:B,isOpen:x,onClose:C,withPortal:T},h&&a.default.createElement(d,null,a.default.createElement(c,{style:v},h)),a.default.createElement(s,null,g),a.default.createElement(f,null,j&&a.default.createElement(y,{style:S,onClick:j,variant:"outline",color:"neutral"},b),q&&a.default.createElement(p,{style:E,onClick:q,variant:"solid",color:A},w)));exports.Dialog=m,exports.default=m;
|
|
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;
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
`,s=d.default.div`
|
|
34
34
|
position: relative;
|
|
35
35
|
max-width: 512px;
|
|
36
|
-
padding:
|
|
36
|
+
padding: 1rem;
|
|
37
37
|
background-color: white;
|
|
38
38
|
border-radius: 3px;
|
|
39
39
|
box-shadow: 0px 24px 38px rgba(0, 0, 0, 0.1), 0px 9px 46px rgba(0, 0, 0, 0.09),
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
}
|
|
54
54
|
`,p=d.default.div`
|
|
55
55
|
position: absolute;
|
|
56
|
-
top:
|
|
57
|
-
right:
|
|
56
|
+
top: 1rem;
|
|
57
|
+
right: 1rem;
|
|
58
58
|
|
|
59
59
|
:hover {
|
|
60
60
|
cursor: pointer;
|
|
@@ -74,4 +74,4 @@
|
|
|
74
74
|
}
|
|
75
75
|
`,f=i.createGlobalStyle`
|
|
76
76
|
${l}
|
|
77
|
-
`,g=({children:x,isOpen:
|
|
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,27 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
`,E=e.div`
|
|
4
|
-
top: 20px;
|
|
5
|
-
left: 32px;
|
|
6
|
-
position: absolute;
|
|
7
|
-
`,B=e(v)`
|
|
8
|
-
font-weight: ${({theme:o})=>o.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};
|
|
9
3
|
margin: 0;
|
|
10
|
-
`,
|
|
4
|
+
`,u=r.div`
|
|
11
5
|
display: flex;
|
|
12
|
-
justify-content:
|
|
13
|
-
|
|
14
|
-
justify-content: flex-start;
|
|
15
|
-
}
|
|
6
|
+
justify-content: flex-end;
|
|
7
|
+
gap: 1rem;
|
|
16
8
|
overflow-x: hidden;
|
|
17
|
-
`,
|
|
18
|
-
overflow-x: hidden;
|
|
19
|
-
margin-right: 2rem;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
width: 100%;
|
|
22
|
-
max-width: 110px;
|
|
23
|
-
`,b=e(l)`
|
|
24
|
-
justify-content: center;
|
|
25
|
-
width: 100%;
|
|
26
|
-
max-width: 245px;
|
|
27
|
-
`,a=({isOpen:o,title:n,children:s,modalStyles:m,titleStyles:p,primaryButtonText:c,primaryButtonStyles:d,secondaryButtonStyles:u,secondaryButtonText:f,primaryButtonAction:r,secondaryButtonAction:i,onClose:y,withPortal:x,color:h="success"})=>t.createElement(j,{contentStyles:m,isOpen:o,onClose:y,withPortal:x},n&&t.createElement(E,null,t.createElement(B,{style:p},n)),t.createElement(w,null,s),t.createElement(C,null,i&&t.createElement(T,{style:u,onClick:i,variant:"outline",color:"neutral"},f),r&&t.createElement(b,{style:d,onClick:r,variant:"solid",color:h},c)));export{a as Dialog,a 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
|
|
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 g}from"react";import{createPortal as x}from"react-dom";im
|
|
|
16
16
|
opacity: 0;
|
|
17
17
|
transition: opacity 0.25s ease-in-out;
|
|
18
18
|
}
|
|
19
|
-
`,
|
|
19
|
+
`,k=n.div`
|
|
20
20
|
${d}
|
|
21
21
|
position: fixed;
|
|
22
22
|
width: 100%;
|
|
@@ -24,16 +24,16 @@ import t,{useEffect as g}from"react";import{createPortal as x}from"react-dom";im
|
|
|
24
24
|
top: 0;
|
|
25
25
|
left: 0;
|
|
26
26
|
z-index: 200;
|
|
27
|
-
`,
|
|
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
|
-
`,
|
|
33
|
+
`,v=n.div`
|
|
34
34
|
position: relative;
|
|
35
35
|
max-width: 512px;
|
|
36
|
-
padding:
|
|
36
|
+
padding: 1rem;
|
|
37
37
|
background-color: white;
|
|
38
38
|
border-radius: 3px;
|
|
39
39
|
box-shadow: 0px 24px 38px rgba(0, 0, 0, 0.1), 0px 9px 46px rgba(0, 0, 0, 0.09),
|
|
@@ -51,10 +51,10 @@ import t,{useEffect as g}from"react";import{createPortal as x}from"react-dom";im
|
|
|
51
51
|
margin-right: auto;
|
|
52
52
|
min-width: 355px;
|
|
53
53
|
}
|
|
54
|
-
`,
|
|
54
|
+
`,T=n.div`
|
|
55
55
|
position: absolute;
|
|
56
|
-
top:
|
|
57
|
-
right:
|
|
56
|
+
top: 1rem;
|
|
57
|
+
right: 1rem;
|
|
58
58
|
|
|
59
59
|
:hover {
|
|
60
60
|
cursor: pointer;
|
|
@@ -64,7 +64,7 @@ import t,{useEffect as g}from"react";import{createPortal as x}from"react-dom";im
|
|
|
64
64
|
width: 1rem;
|
|
65
65
|
height: 1rem;
|
|
66
66
|
}
|
|
67
|
-
`,
|
|
67
|
+
`,C=a`
|
|
68
68
|
body {
|
|
69
69
|
overflow: hidden;
|
|
70
70
|
|
|
@@ -72,6 +72,6 @@ import t,{useEffect as g}from"react";import{createPortal as x}from"react-dom";im
|
|
|
72
72
|
padding-right: 15px !important;
|
|
73
73
|
`}
|
|
74
74
|
}
|
|
75
|
-
`,
|
|
75
|
+
`,S=a`
|
|
76
76
|
${d}
|
|
77
|
-
`,c=({children:s,isOpen:o,contentStyles:m,withPortal:l=!1,onClose:e})=>{
|
|
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,21 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Color } from '../../Types';
|
|
3
2
|
export interface DialogProps {
|
|
4
|
-
title?:
|
|
5
|
-
children: ReactNode;
|
|
3
|
+
title?: ReactNode;
|
|
6
4
|
isOpen: boolean;
|
|
7
|
-
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
actions?: ReactNode;
|
|
8
7
|
withPortal?: boolean;
|
|
9
|
-
|
|
10
|
-
secondaryButtonText?: string;
|
|
11
|
-
modalStyles?: {};
|
|
12
|
-
titleStyles?: {};
|
|
13
|
-
primaryButtonStyles?: {};
|
|
14
|
-
secondaryButtonStyles?: {};
|
|
8
|
+
withCloseIcon?: boolean;
|
|
15
9
|
onClose(): void;
|
|
16
|
-
primaryButtonAction?(): void;
|
|
17
|
-
secondaryButtonAction?(): void;
|
|
18
|
-
color?: Color;
|
|
19
10
|
}
|
|
20
|
-
export declare const Dialog: ({ isOpen, title, children,
|
|
11
|
+
export declare const Dialog: ({ isOpen, title, children, actions, onClose, withPortal, withCloseIcon, ...props }: DialogProps) => JSX.Element;
|
|
21
12
|
export default Dialog;
|
|
@@ -6,6 +6,7 @@ export interface ModalProps {
|
|
|
6
6
|
withPortal?: boolean;
|
|
7
7
|
onClose(): void;
|
|
8
8
|
contentStyles?: {};
|
|
9
|
+
withCloseIcon?: boolean;
|
|
9
10
|
}
|
|
10
|
-
export declare const Modal: ({ children, isOpen, contentStyles, withPortal, onClose, }: ModalProps) => JSX.Element;
|
|
11
|
+
export declare const Modal: ({ children, isOpen, contentStyles, withPortal, withCloseIcon, onClose, ...props }: ModalProps) => JSX.Element;
|
|
11
12
|
export default Modal;
|