@cypress-design/react-modal 0.0.2 → 0.0.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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +6 -0
- package/Modal.tsx +44 -49
- package/ReadMe.md +13 -8
- package/dist/Modal.d.ts.map +1 -1
- package/dist/index.es.mjs +15 -14
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +15 -14
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -2,5 +2,5 @@ $ yarn build:module && yarn build:types
|
|
|
2
2
|
$ rollup -c ./rollup.config.mjs
|
|
3
3
|
[36m
|
|
4
4
|
[1m./index.ts[22m → [1m./dist/index.umd.js, ./dist/index.es.mjs[22m...[39m
|
|
5
|
-
[32mcreated [1m./dist/index.umd.js, ./dist/index.es.mjs[22m in [
|
|
5
|
+
[32mcreated [1m./dist/index.umd.js, ./dist/index.es.mjs[22m in [1m44.5s[22m[39m
|
|
6
6
|
$ tsc --project ./tsconfig.build.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @cypress-design/react-modal
|
|
2
2
|
|
|
3
|
+
## 0.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#265](https://github.com/cypress-io/cypress-design/pull/265) [`a69b7ee`](https://github.com/cypress-io/cypress-design/commit/a69b7ee3e7ca0900362b463f9925ba6ff6f4332f) Thanks [@elevatebart](https://github.com/elevatebart)! - avoid creating empty divs
|
|
8
|
+
|
|
3
9
|
## 0.0.2
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/Modal.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { createPortal } from 'react-dom'
|
|
3
|
-
import clsx from 'clsx'
|
|
4
3
|
import {
|
|
5
4
|
IconActionQuestionMarkCircle,
|
|
6
5
|
IconActionDelete,
|
|
@@ -50,56 +49,52 @@ export const Modal: React.FC<ModalProps> = ({
|
|
|
50
49
|
)
|
|
51
50
|
|
|
52
51
|
return (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<div className={ClassBackDrop} onClick={() => onClose?.()}></div>
|
|
58
|
-
) : null}
|
|
59
|
-
{show ? (
|
|
60
|
-
<div
|
|
61
|
-
className={ClassModalContainer}
|
|
62
|
-
tabIndex={-1}
|
|
63
|
-
aria-modal="true"
|
|
64
|
-
role="modal"
|
|
65
|
-
>
|
|
66
|
-
<div className={ClassModal}>
|
|
67
|
-
<div className={ClassTitleBox}>
|
|
68
|
-
<div className={ClassTitle}>{title}</div>
|
|
69
|
-
{helpLink ? <div className={ClassHelpLinkDash} /> : null}
|
|
70
|
-
{helpLink ? (
|
|
71
|
-
<a href={helpLink} className={ClassHelpLink}>
|
|
72
|
-
Need help
|
|
73
|
-
<IconActionQuestionMarkCircle
|
|
74
|
-
className="ml-[4px]"
|
|
75
|
-
stroke-color="indigo-500"
|
|
76
|
-
fill-color="indigo-100"
|
|
77
|
-
/>
|
|
78
|
-
</a>
|
|
79
|
-
) : null}
|
|
52
|
+
show &&
|
|
53
|
+
createPortal(
|
|
54
|
+
<div>
|
|
55
|
+
<div className={ClassBackDrop} onClick={() => onClose?.()}></div>
|
|
80
56
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
57
|
+
<div
|
|
58
|
+
className={ClassModalContainer}
|
|
59
|
+
tabIndex={-1}
|
|
60
|
+
aria-modal="true"
|
|
61
|
+
role="modal"
|
|
62
|
+
>
|
|
63
|
+
<div className={ClassModal}>
|
|
64
|
+
<div className={ClassTitleBox}>
|
|
65
|
+
<div className={ClassTitle}>{title}</div>
|
|
66
|
+
{helpLink ? <div className={ClassHelpLinkDash} /> : null}
|
|
67
|
+
{helpLink ? (
|
|
68
|
+
<a href={helpLink} className={ClassHelpLink}>
|
|
69
|
+
Need help
|
|
70
|
+
<IconActionQuestionMarkCircle
|
|
71
|
+
className="ml-[4px]"
|
|
72
|
+
stroke-color="indigo-500"
|
|
73
|
+
fill-color="indigo-100"
|
|
74
|
+
/>
|
|
75
|
+
</a>
|
|
76
|
+
) : null}
|
|
77
|
+
|
|
78
|
+
<div className="grow" />
|
|
79
|
+
<button
|
|
80
|
+
aria-label="Close"
|
|
81
|
+
className={ClassCloseButton}
|
|
82
|
+
onClick={() => onClose?.()}
|
|
83
|
+
>
|
|
84
|
+
<IconActionDelete
|
|
85
|
+
className="children:transition-all"
|
|
86
|
+
stroke-color="gray-400"
|
|
87
|
+
hover-stroke-color="gray-700"
|
|
88
|
+
interactiveColorsOnGroup
|
|
89
|
+
/>
|
|
90
|
+
</button>
|
|
97
91
|
</div>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
<div className={ClassContent}>{children}</div>
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
</div>,
|
|
96
|
+
document.body
|
|
97
|
+
)
|
|
103
98
|
)
|
|
104
99
|
}
|
|
105
100
|
|
package/ReadMe.md
CHANGED
|
@@ -16,15 +16,20 @@ yarn add @cypress-design/react-modal
|
|
|
16
16
|
import React from 'react'
|
|
17
17
|
import Button from '@cypress-design/react-button'
|
|
18
18
|
import Modal from '@cypress-design/react-modal'
|
|
19
|
-
const [visible, setVisible] = React.useState(false)
|
|
20
19
|
|
|
21
20
|
export default () => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
const [visible, setVisible] = React.useState(false)
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<>
|
|
25
|
+
<Modal show={visible} title="modal" onClose={() => setVisible(false)}>
|
|
26
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Id perspiciatis
|
|
27
|
+
hic ad minima ex recusandae autem incidunt, perferendis, illo voluptatum
|
|
28
|
+
repudiandae iste voluptate reiciendis quam officiis voluptas laboriosam
|
|
29
|
+
eligendi explicabo!
|
|
30
|
+
</Modal>
|
|
31
|
+
<Button onClick={() => setVisible(true)}>Open Modal</Button>
|
|
32
|
+
</>
|
|
33
|
+
)
|
|
29
34
|
}
|
|
30
35
|
```
|
package/dist/Modal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"./","sources":["Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"./","sources":["Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAoB9B,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAsEtC,CAAA;AAED,eAAe,KAAK,CAAA"}
|
package/dist/index.es.mjs
CHANGED
|
@@ -31049,20 +31049,21 @@ var Modal = function (_a) {
|
|
|
31049
31049
|
React.useEffect(function () { return function () {
|
|
31050
31050
|
freeBodyScroll();
|
|
31051
31051
|
}; }, []);
|
|
31052
|
-
return (
|
|
31053
|
-
|
|
31054
|
-
|
|
31055
|
-
React.createElement("div", { className:
|
|
31056
|
-
React.createElement("div", { className:
|
|
31057
|
-
React.createElement("div", { className:
|
|
31058
|
-
|
|
31059
|
-
|
|
31060
|
-
|
|
31061
|
-
|
|
31062
|
-
|
|
31063
|
-
|
|
31064
|
-
React.createElement(
|
|
31065
|
-
|
|
31052
|
+
return (show &&
|
|
31053
|
+
reactDomExports.createPortal(React.createElement("div", null,
|
|
31054
|
+
React.createElement("div", { className: ClassBackDrop, onClick: function () { return onClose === null || onClose === void 0 ? void 0 : onClose(); } }),
|
|
31055
|
+
React.createElement("div", { className: ClassModalContainer, tabIndex: -1, "aria-modal": "true", role: "modal" },
|
|
31056
|
+
React.createElement("div", { className: ClassModal },
|
|
31057
|
+
React.createElement("div", { className: ClassTitleBox },
|
|
31058
|
+
React.createElement("div", { className: ClassTitle }, title),
|
|
31059
|
+
helpLink ? React.createElement("div", { className: ClassHelpLinkDash }) : null,
|
|
31060
|
+
helpLink ? (React.createElement("a", { href: helpLink, className: ClassHelpLink },
|
|
31061
|
+
"Need help",
|
|
31062
|
+
React.createElement(IconActionQuestionMarkCircle, { className: "ml-[4px]", "stroke-color": "indigo-500", "fill-color": "indigo-100" }))) : null,
|
|
31063
|
+
React.createElement("div", { className: "grow" }),
|
|
31064
|
+
React.createElement("button", { "aria-label": "Close", className: ClassCloseButton, onClick: function () { return onClose === null || onClose === void 0 ? void 0 : onClose(); } },
|
|
31065
|
+
React.createElement(IconActionDelete, { className: "children:transition-all", "stroke-color": "gray-400", "hover-stroke-color": "gray-700", interactiveColorsOnGroup: true }))),
|
|
31066
|
+
React.createElement("div", { className: ClassContent }, children)))), document.body));
|
|
31066
31067
|
};
|
|
31067
31068
|
|
|
31068
31069
|
export { Modal as default };
|