@cypress-design/react-modal 0.0.3 → 0.1.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 +11 -0
- package/Modal.tsx +13 -1
- package/ModalReact.cy.tsx +8 -1
- package/dist/Modal.d.ts +1 -0
- package/dist/Modal.d.ts.map +1 -1
- package/dist/index.es.mjs +10 -6
- package/dist/index.es.mjs.map +1 -1
- package/dist/index.umd.js +10 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
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 [1m19.2s[22m[39m
|
|
6
6
|
$ tsc --project ./tsconfig.build.json
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @cypress-design/react-modal
|
|
2
2
|
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`2200d4f`](https://github.com/cypress-io/cypress-design/commit/2200d4fcca11f40509051e942b0eea22e5ec38b1)]:
|
|
12
|
+
- @cypress-design/constants-modal@0.1.0
|
|
13
|
+
|
|
3
14
|
## 0.0.3
|
|
4
15
|
|
|
5
16
|
### 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/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
|
|
|
@@ -31027,8 +31027,10 @@ function freeBodyScroll() {
|
|
|
31027
31027
|
}
|
|
31028
31028
|
|
|
31029
31029
|
const ClassBackDrop = 'fixed left-0 top-0 z-[1000010] h-screen w-screen bg-gray-900/[.92] backdrop-blur';
|
|
31030
|
-
const ClassModalContainer = 'pointer-events-none fixed left-0 top-0 z-[1000020]
|
|
31031
|
-
const ClassModal = 'pointer-events-auto relative flex
|
|
31030
|
+
const ClassModalContainer = 'pointer-events-none fixed left-0 top-0 z-[1000020] h-full w-screen overflow-hidden flex items-center justify-center';
|
|
31031
|
+
const ClassModal = 'pointer-events-auto relative flex flex-col rounded-lg border-4 border-gray-700 bg-white';
|
|
31032
|
+
const ClassModalStandardDimensions = 'max-h-[80vh] min-w-[200px] sm:min-w-[390px] sm:max-w-[70vw] shrink-0';
|
|
31033
|
+
const ClassModalFullscreenDimensions = 'h-[calc(100vh-32px)] sm:w-[calc(100vw-32px)]';
|
|
31032
31034
|
const ClassTitleBox = 'flex shrink-0 items-center justify-between rounded-t-md border-b border-gray-100 p-[16px] px-[24px]';
|
|
31033
31035
|
const ClassTitle = 'text-[18px] font-medium leading-[28px] text-gray-900';
|
|
31034
31036
|
const ClassHelpLinkDash = 'mx-[8px] h-[1px] w-[32px] bg-gray-100';
|
|
@@ -31037,7 +31039,7 @@ const ClassCloseButton = 'group rounded-full border-transparent p-[4px] outline-
|
|
|
31037
31039
|
const ClassContent = 'overflow-y-auto p-[16px]';
|
|
31038
31040
|
|
|
31039
31041
|
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;
|
|
31042
|
+
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
31043
|
React.useEffect(function () {
|
|
31042
31044
|
if (show) {
|
|
31043
31045
|
disableBodyScroll();
|
|
@@ -31053,7 +31055,9 @@ var Modal = function (_a) {
|
|
|
31053
31055
|
reactDomExports.createPortal(React.createElement("div", null,
|
|
31054
31056
|
React.createElement("div", { className: ClassBackDrop, onClick: function () { return onClose === null || onClose === void 0 ? void 0 : onClose(); } }),
|
|
31055
31057
|
React.createElement("div", { className: ClassModalContainer, tabIndex: -1, "aria-modal": "true", role: "modal" },
|
|
31056
|
-
React.createElement("div", { className: ClassModal
|
|
31058
|
+
React.createElement("div", { className: clsx(ClassModal, fullscreen
|
|
31059
|
+
? ClassModalFullscreenDimensions
|
|
31060
|
+
: ClassModalStandardDimensions) },
|
|
31057
31061
|
React.createElement("div", { className: ClassTitleBox },
|
|
31058
31062
|
React.createElement("div", { className: ClassTitle }, title),
|
|
31059
31063
|
helpLink ? React.createElement("div", { className: ClassHelpLinkDash }) : null,
|
|
@@ -31069,4 +31073,4 @@ var Modal = function (_a) {
|
|
|
31069
31073
|
export { Modal as default };
|
|
31070
31074
|
//# sourceMappingURL=index.es.mjs.map
|
|
31071
31075
|
|
|
31072
|
-
/* <wind-keep class="ml-[4px] grow fixed left-0 top-0 z-[1000010] h-screen w-screen bg-gray-900/[.92] backdrop-blur pointer-events-none z-[1000020]
|
|
31076
|
+
/* <wind-keep class="ml-[4px] grow fixed left-0 top-0 z-[1000010] h-screen w-screen bg-gray-900/[.92] backdrop-blur pointer-events-none z-[1000020] h-full overflow-hidden flex items-center justify-center pointer-events-auto relative flex-col rounded-lg border-4 border-gray-700 bg-white max-h-[80vh] min-w-[200px] sm:min-w-[390px] 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] 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"> */
|