@cypress-design/react-modal 0.0.3 → 0.2.0
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 +23 -0
- package/Modal.tsx +13 -1
- package/ModalReact.cy.tsx +8 -1
- package/ReadMe.md +5 -1
- package/dist/Modal.d.ts +1 -0
- package/dist/Modal.d.ts.map +1 -1
- package/dist/index.es.mjs +20 -11
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +20 -11
- package/dist/index.umd.js.map +1 -1
- package/package.json +4 -4
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 [1m16.7s[22m[39m
|
|
6
6
|
$ tsc --project ./tsconfig.build.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @cypress-design/react-modal
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#281](https://github.com/cypress-io/cypress-design/pull/281) [`9ec1a81`](https://github.com/cypress-io/cypress-design/commit/9ec1a81cbe0a136bb8bd74b5af968c41615cefbc) Thanks [@ryanjwilke](https://github.com/ryanjwilke)! - update visuals of a modal
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`e390827`](https://github.com/cypress-io/cypress-design/commit/e3908270ece513886c64cebcb78cebe0cd0d8c3d), [`9ec1a81`](https://github.com/cypress-io/cypress-design/commit/9ec1a81cbe0a136bb8bd74b5af968c41615cefbc)]:
|
|
12
|
+
- @cypress-design/react-icon@0.23.0
|
|
13
|
+
- @cypress-design/constants-modal@0.2.0
|
|
14
|
+
|
|
15
|
+
## 0.1.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#270](https://github.com/cypress-io/cypress-design/pull/270) [`2200d4f`](https://github.com/cypress-io/cypress-design/commit/2200d4fcca11f40509051e942b0eea22e5ec38b1) Thanks [@elevatebart](https://github.com/elevatebart)! - add fullscreen prop to modal
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`2200d4f`](https://github.com/cypress-io/cypress-design/commit/2200d4fcca11f40509051e942b0eea22e5ec38b1)]:
|
|
24
|
+
- @cypress-design/constants-modal@0.1.0
|
|
25
|
+
|
|
3
26
|
## 0.0.3
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/Modal.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { createPortal } from 'react-dom'
|
|
3
|
+
import clsx from 'clsx'
|
|
3
4
|
import {
|
|
4
5
|
IconActionQuestionMarkCircle,
|
|
5
6
|
IconActionDelete,
|
|
@@ -11,6 +12,8 @@ import {
|
|
|
11
12
|
ClassHelpLink,
|
|
12
13
|
ClassHelpLinkDash,
|
|
13
14
|
ClassModal,
|
|
15
|
+
ClassModalFullscreenDimensions,
|
|
16
|
+
ClassModalStandardDimensions,
|
|
14
17
|
ClassModalContainer,
|
|
15
18
|
ClassTitle,
|
|
16
19
|
ClassTitleBox,
|
|
@@ -24,6 +27,7 @@ export interface ModalProps {
|
|
|
24
27
|
children?: React.ReactNode
|
|
25
28
|
show?: boolean
|
|
26
29
|
onClose?: () => void
|
|
30
|
+
fullscreen?: boolean
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
export const Modal: React.FC<ModalProps> = ({
|
|
@@ -32,6 +36,7 @@ export const Modal: React.FC<ModalProps> = ({
|
|
|
32
36
|
helpLink,
|
|
33
37
|
onClose,
|
|
34
38
|
children,
|
|
39
|
+
fullscreen = false,
|
|
35
40
|
}) => {
|
|
36
41
|
React.useEffect(() => {
|
|
37
42
|
if (show) {
|
|
@@ -60,7 +65,14 @@ export const Modal: React.FC<ModalProps> = ({
|
|
|
60
65
|
aria-modal="true"
|
|
61
66
|
role="modal"
|
|
62
67
|
>
|
|
63
|
-
<div
|
|
68
|
+
<div
|
|
69
|
+
className={clsx(
|
|
70
|
+
ClassModal,
|
|
71
|
+
fullscreen
|
|
72
|
+
? ClassModalFullscreenDimensions
|
|
73
|
+
: ClassModalStandardDimensions
|
|
74
|
+
)}
|
|
75
|
+
>
|
|
64
76
|
<div className={ClassTitleBox}>
|
|
65
77
|
<div className={ClassTitle}>{title}</div>
|
|
66
78
|
{helpLink ? <div className={ClassHelpLinkDash} /> : null}
|
package/ModalReact.cy.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import assertions from '../assertions'
|
|
|
8
8
|
const ComponentUsingModal = (options: {
|
|
9
9
|
title?: string
|
|
10
10
|
helpLink?: string
|
|
11
|
+
fullscreen?: boolean
|
|
11
12
|
}) => {
|
|
12
13
|
const [visibleModal, setVisibleModal] = React.useState(false)
|
|
13
14
|
return (
|
|
@@ -32,7 +33,13 @@ const ComponentUsingModal = (options: {
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
describe('Modal', () => {
|
|
35
|
-
function mountStory(
|
|
36
|
+
function mountStory(
|
|
37
|
+
options: {
|
|
38
|
+
title?: string
|
|
39
|
+
helpLink?: string
|
|
40
|
+
fullscreen?: boolean
|
|
41
|
+
} = {}
|
|
42
|
+
) {
|
|
36
43
|
mount(<ComponentUsingModal {...options} />)
|
|
37
44
|
}
|
|
38
45
|
assertions(mountStory)
|
package/ReadMe.md
CHANGED
|
@@ -22,7 +22,11 @@ export default () => {
|
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
24
|
<>
|
|
25
|
-
<Modal
|
|
25
|
+
<Modal
|
|
26
|
+
show={visible}
|
|
27
|
+
title="Modal Title"
|
|
28
|
+
onClose={() => setVisible(false)}
|
|
29
|
+
>
|
|
26
30
|
Lorem ipsum dolor sit amet consectetur adipisicing elit. Id perspiciatis
|
|
27
31
|
hic ad minima ex recusandae autem incidunt, perferendis, illo voluptatum
|
|
28
32
|
repudiandae iste voluptate reiciendis quam officiis voluptas laboriosam
|
package/dist/Modal.d.ts
CHANGED
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;AAuB9B,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;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA8EtC,CAAA;AAED,eAAe,KAAK,CAAA"}
|
package/dist/index.es.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import 'clsx';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
4
|
import * as iconsRegistry from '@cypress-design/icon-registry';
|
|
5
5
|
import { ICON_COLOR_PROP_NAMES } from '@cypress-design/icon-registry';
|
|
6
6
|
|
|
@@ -30919,7 +30919,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
30919
30919
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
30920
30920
|
PERFORMANCE OF THIS SOFTWARE.
|
|
30921
30921
|
***************************************************************************** */
|
|
30922
|
-
/* global Reflect, Promise */
|
|
30922
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
30923
30923
|
|
|
30924
30924
|
|
|
30925
30925
|
var __assign = function() {
|
|
@@ -30943,7 +30943,12 @@ function __rest(s, e) {
|
|
|
30943
30943
|
t[p[i]] = s[p[i]];
|
|
30944
30944
|
}
|
|
30945
30945
|
return t;
|
|
30946
|
-
}
|
|
30946
|
+
}
|
|
30947
|
+
|
|
30948
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
30949
|
+
var e = new Error(message);
|
|
30950
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
30951
|
+
};
|
|
30947
30952
|
|
|
30948
30953
|
var compileReactIconProperties = function (_a) {
|
|
30949
30954
|
var body = _a.body, defs = _a.defs, compiledClasses = _a.compiledClasses, size = _a.size, name = _a.name, attributes = __rest(_a, ["body", "defs", "compiledClasses", "size", "name"]);
|
|
@@ -31026,18 +31031,20 @@ function freeBodyScroll() {
|
|
|
31026
31031
|
window.scrollTo({ top: scrollY });
|
|
31027
31032
|
}
|
|
31028
31033
|
|
|
31029
|
-
const ClassBackDrop = 'fixed left-0 top-0 z-[1000010] h-screen w-screen bg-gray-900/[.
|
|
31030
|
-
const ClassModalContainer = 'pointer-events-none fixed left-0 top-0 z-[1000020]
|
|
31031
|
-
const ClassModal = 'pointer-events-auto relative flex
|
|
31032
|
-
const
|
|
31034
|
+
const ClassBackDrop = 'fixed left-0 top-0 z-[1000010] h-screen w-screen bg-gray-900/[.80] backdrop-blur-sm';
|
|
31035
|
+
const ClassModalContainer = 'pointer-events-none fixed left-0 top-0 z-[1000020] h-full w-screen overflow-hidden flex items-center justify-center';
|
|
31036
|
+
const ClassModal = 'pointer-events-auto relative flex flex-col rounded outline outline-4 outline-gray-500/[.40] bg-white';
|
|
31037
|
+
const ClassModalStandardDimensions = 'max-h-[80vh] min-w-[200px] sm:min-w-[390px] max-w-[calc(100vw-32px)] sm:max-w-[70vw] shrink-0';
|
|
31038
|
+
const ClassModalFullscreenDimensions = 'h-[calc(100vh-32px)] sm:w-[calc(100vw-32px)]';
|
|
31039
|
+
const ClassTitleBox = 'flex shrink-0 items-center justify-between rounded-t-md border-b border-gray-100 p-[16px] px-16px sm:px-[24px]';
|
|
31033
31040
|
const ClassTitle = 'text-[18px] font-medium leading-[28px] text-gray-900';
|
|
31034
31041
|
const ClassHelpLinkDash = 'mx-[8px] h-[1px] w-[32px] bg-gray-100';
|
|
31035
31042
|
const ClassHelpLink = 'flex items-center text-[16px] font-normal leading-[24px] text-indigo-500';
|
|
31036
31043
|
const ClassCloseButton = 'group rounded-full border-transparent p-[4px] outline-none';
|
|
31037
|
-
const ClassContent = 'overflow-y-auto p-[16px]';
|
|
31044
|
+
const ClassContent = 'overflow-y-auto p-[16px] sm:px-[24px]';
|
|
31038
31045
|
|
|
31039
31046
|
var Modal = function (_a) {
|
|
31040
|
-
var _b = _a.show, show = _b === void 0 ? false : _b, title = _a.title, helpLink = _a.helpLink, onClose = _a.onClose, children = _a.children;
|
|
31047
|
+
var _b = _a.show, show = _b === void 0 ? false : _b, title = _a.title, helpLink = _a.helpLink, onClose = _a.onClose, children = _a.children, _c = _a.fullscreen, fullscreen = _c === void 0 ? false : _c;
|
|
31041
31048
|
React.useEffect(function () {
|
|
31042
31049
|
if (show) {
|
|
31043
31050
|
disableBodyScroll();
|
|
@@ -31053,7 +31060,9 @@ var Modal = function (_a) {
|
|
|
31053
31060
|
reactDomExports.createPortal(React.createElement("div", null,
|
|
31054
31061
|
React.createElement("div", { className: ClassBackDrop, onClick: function () { return onClose === null || onClose === void 0 ? void 0 : onClose(); } }),
|
|
31055
31062
|
React.createElement("div", { className: ClassModalContainer, tabIndex: -1, "aria-modal": "true", role: "modal" },
|
|
31056
|
-
React.createElement("div", { className: ClassModal
|
|
31063
|
+
React.createElement("div", { className: clsx(ClassModal, fullscreen
|
|
31064
|
+
? ClassModalFullscreenDimensions
|
|
31065
|
+
: ClassModalStandardDimensions) },
|
|
31057
31066
|
React.createElement("div", { className: ClassTitleBox },
|
|
31058
31067
|
React.createElement("div", { className: ClassTitle }, title),
|
|
31059
31068
|
helpLink ? React.createElement("div", { className: ClassHelpLinkDash }) : null,
|
|
@@ -31069,4 +31078,4 @@ var Modal = function (_a) {
|
|
|
31069
31078
|
export { Modal as default };
|
|
31070
31079
|
//# sourceMappingURL=index.es.mjs.map
|
|
31071
31080
|
|
|
31072
|
-
/* <wind-keep class="ml-[4px] grow fixed left-0 top-0 z-[1000010] h-screen w-screen bg-gray-900/[.
|
|
31081
|
+
/* <wind-keep class="ml-[4px] grow children:transition-all fixed left-0 top-0 z-[1000010] h-screen w-screen bg-gray-900/[.80] backdrop-blur-sm pointer-events-none z-[1000020] h-full overflow-hidden flex items-center justify-center pointer-events-auto relative flex-col rounded outline outline-4 outline-gray-500/[.40] bg-white max-h-[80vh] min-w-[200px] sm:min-w-[390px] max-w-[calc(100vw-32px)] sm:max-w-[70vw] shrink-0 h-[calc(100vh-32px)] sm:w-[calc(100vw-32px)] justify-between rounded-t-md border-b border-gray-100 p-[16px] sm:px-[24px] text-[18px] font-medium leading-[28px] text-gray-900 mx-[8px] h-[1px] w-[32px] bg-gray-100 text-[16px] font-normal leading-[24px] text-indigo-500 rounded-full border-transparent p-[4px] outline-none overflow-y-auto cy-modal-overflow-hidden cy-modal-overflow-scroll-x cy-modal-overflow-scroll-y"> */
|