@toptal/picasso-modal 4.0.2 → 4.0.3-alpha-pf-fix-alpha-release-ea13b5aca.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/dist-package/src/Modal/Modal.d.ts.map +1 -1
- package/dist-package/src/Modal/Modal.js +41 -29
- package/dist-package/src/Modal/Modal.js.map +1 -1
- package/dist-package/src/ModalContent/ModalContent.js +3 -3
- package/dist-package/src/ModalContent/ModalContent.js.map +1 -1
- package/package.json +16 -18
- package/src/Modal/Modal.tsx +80 -73
- package/src/Modal/__snapshots__/test.tsx.snap +296 -124
- package/src/Modal/test.tsx +2 -2
- package/src/ModalContent/ModalContent.tsx +21 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAEtD,OAAO,
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/Modal/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAEtD,OAAO,KAAoD,MAAM,OAAO,CAAA;AACxE,OAAO,KAAK,EACV,SAAS,EACT,QAAQ,EACR,eAAe,EAChB,MAAM,wBAAwB,CAAA;AAc/B,KAAK,cAAc,GAAG,WAAW,GAAG,CAAC,MAAM,WAAW,CAAC,CAAA;AACvD,KAAK,SAAS,GAAG,KAAK,GAAG,UAAU,CAAA;AAEnC,MAAM,WAAW,KAAM,SAAQ,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC;IACtE,iCAAiC;IACjC,QAAQ,EAAE,SAAS,CAAA;IACnB,wCAAwC;IACxC,IAAI,EAAE,OAAO,CAAA;IACb,qBAAqB;IACrB,IAAI,CAAC,EACD,QAAQ,CAAC,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC,GAC5D,aAAa,CAAA;IACjB,kDAAkD;IAClD,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B,oFAAoF;IACpF,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,2GAA2G;IAC3G,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B,8CAA8C;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,kKAAkK;IAClK,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,gFAAgF;IAChF,UAAU,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAA;IACjD,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;CACF;AAuDD,eAAO,MAAM,KAAK,8EA4KhB,CAAA;AAIF,eAAe,KAAK,CAAA"}
|
|
@@ -9,14 +9,12 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
13
|
-
import React, { forwardRef, useEffect, useRef,
|
|
12
|
+
import { Dialog } from '@base-ui/react/dialog';
|
|
13
|
+
import React, { forwardRef, useEffect, useRef, useContext } from 'react';
|
|
14
14
|
import { usePicassoRoot, RootContext } from '@toptal/picasso-provider';
|
|
15
15
|
import { CloseMinor16 } from '@toptal/picasso-icons';
|
|
16
16
|
import { useCombinedRefs, ModalManager, usePageScrollLock, } from '@toptal/picasso-utils';
|
|
17
17
|
import { ButtonCircular } from '@toptal/picasso-button';
|
|
18
|
-
import { Fade } from '@toptal/picasso-fade';
|
|
19
|
-
import { Backdrop } from '@toptal/picasso-backdrop';
|
|
20
18
|
import ModalContext from '@toptal/picasso-modal-context';
|
|
21
19
|
import { twMerge } from '@toptal/picasso-tailwind-merge';
|
|
22
20
|
import { ModalPaper } from '../ModalPaper';
|
|
@@ -58,10 +56,11 @@ const generateKey = (() => {
|
|
|
58
56
|
// eslint-disable-next-line react/display-name
|
|
59
57
|
export const Modal = forwardRef(function Modal(_a, ref) {
|
|
60
58
|
var { hideBackdrop = false, disableBackdropClick = false, size = 'medium', transitionDuration = 300, align = 'centered' } = _a, props = __rest(_a, ["hideBackdrop", "disableBackdropClick", "size", "transitionDuration", "align"]);
|
|
61
|
-
const { children, open, onBackdropClick, onClose, onOpen, className, style, container, paperProps, testIds, transitionProps, classes } = props, rest = __rest(props, ["children", "open", "onBackdropClick", "onClose", "onOpen", "className", "style", "container", "paperProps", "testIds", "transitionProps", "classes"]);
|
|
59
|
+
const { children, open, onBackdropClick, onClose, onOpen, onClick, className, style, container, paperProps, testIds, transitionProps, classes } = props, rest = __rest(props, ["children", "open", "onBackdropClick", "onClose", "onOpen", "onClick", "className", "style", "container", "paperProps", "testIds", "transitionProps", "classes"]);
|
|
62
60
|
const picassoRootContainer = usePicassoRoot();
|
|
63
61
|
const modalRef = useCombinedRefs(ref, useRef(null));
|
|
64
62
|
const modalId = useRef(generateKey());
|
|
63
|
+
const wasOpen = useRef(false);
|
|
65
64
|
const { rootRef } = useContext(RootContext);
|
|
66
65
|
useEffect(() => {
|
|
67
66
|
const handleDocumentFocus = () => {
|
|
@@ -100,33 +99,46 @@ export const Modal = forwardRef(function Modal(_a, ref) {
|
|
|
100
99
|
};
|
|
101
100
|
}, [open]);
|
|
102
101
|
usePageScrollLock(open);
|
|
103
|
-
|
|
104
|
-
if (
|
|
105
|
-
|
|
102
|
+
useEffect(() => {
|
|
103
|
+
if (open && !wasOpen.current) {
|
|
104
|
+
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
|
|
105
|
+
}
|
|
106
|
+
wasOpen.current = open;
|
|
107
|
+
}, [open, onOpen]);
|
|
108
|
+
const duration = (transitionProps === null || transitionProps === void 0 ? void 0 : transitionProps.timeout) || transitionDuration;
|
|
109
|
+
const durationStyle = { transitionDuration: `${duration}ms` };
|
|
110
|
+
const resolvedContainer = (typeof container === 'function' ? container() : container) ||
|
|
111
|
+
picassoRootContainer;
|
|
112
|
+
const handlePopupClick = (event) => {
|
|
113
|
+
if (event.target === event.currentTarget && !disableBackdropClick) {
|
|
114
|
+
onBackdropClick === null || onBackdropClick === void 0 ? void 0 : onBackdropClick();
|
|
115
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
106
116
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
117
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
118
|
+
};
|
|
119
|
+
return (React.createElement(Dialog.Root, { open: open, modal: false, disablePointerDismissal: true, onOpenChange: isOpen => {
|
|
120
|
+
if (!isOpen) {
|
|
121
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
110
122
|
}
|
|
111
|
-
|
|
112
|
-
|
|
123
|
+
}, onOpenChangeComplete: isOpen => {
|
|
124
|
+
var _a;
|
|
125
|
+
if (!isOpen && modalRef.current) {
|
|
126
|
+
(_a = transitionProps === null || transitionProps === void 0 ? void 0 : transitionProps.onExited) === null || _a === void 0 ? void 0 : _a.call(transitionProps, modalRef.current);
|
|
113
127
|
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
onClose && (React.createElement(ButtonCircular, { "aria-label": 'Close', variant: 'flat', className: twMerge('absolute top-8 right-8', classes === null || classes === void 0 ? void 0 : classes.closeButton), onClick: onClose, "data-testid": testIds === null || testIds === void 0 ? void 0 : testIds.closeButton },
|
|
129
|
-
React.createElement(CloseMinor16, null))))))));
|
|
128
|
+
} },
|
|
129
|
+
React.createElement(Dialog.Portal, { container: resolvedContainer },
|
|
130
|
+
!hideBackdrop && (React.createElement(Dialog.Backdrop, { className: 'fixed z-modal inset-0 bg-black/50 transition-opacity data-starting-style:opacity-0 data-ending-style:opacity-0', style: durationStyle })),
|
|
131
|
+
React.createElement(Dialog.Popup, Object.assign({}, rest, { ref: modalRef, initialFocus: () => {
|
|
132
|
+
var _a;
|
|
133
|
+
return ((_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement))
|
|
134
|
+
? undefined
|
|
135
|
+
: modalRef.current;
|
|
136
|
+
}, className: twMerge(className, 'fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center transition-opacity data-starting-style:opacity-0 data-ending-style:opacity-0'), style: Object.assign(Object.assign({}, style), durationStyle), onClick: handlePopupClick }),
|
|
137
|
+
React.createElement(ModalPaper, Object.assign({ size: size, align: align, tabIndex: -1 }, paperProps),
|
|
138
|
+
React.createElement(ModalContext.Provider, { value: true },
|
|
139
|
+
children,
|
|
140
|
+
onClose && (React.createElement(ButtonCircular, { "aria-label": 'Close', variant: 'flat', className: twMerge('absolute top-8 right-8', classes === null || classes === void 0 ? void 0 : classes.closeButton), onClick: onClose, "data-testid": testIds === null || testIds === void 0 ? void 0 : testIds.closeButton },
|
|
141
|
+
React.createElement(CloseMinor16, null)))))))));
|
|
130
142
|
});
|
|
131
143
|
Modal.displayName = 'Modal';
|
|
132
144
|
export default Modal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/Modal/Modal.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../../../src/Modal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Q;wBACR,OAAO,IAAI,CACV,oBAAC,cAAc,kBACF,OAAO,EAClB,OAAO,EAAC,MAAM,EACd,SAAS,EAAE,OAAO,CAChB,wBAAwB,EACxB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,CACrB,EACD,OAAO,EAAE,OAAO,iBACH,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW;4BAEjC,oBAAC,YAAY,OAAG,CACD,CAClB,CACqB,CACb,CACA,CACD,CACJ,CACf,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAA;AAE3B,eAAe,KAAK,CAAA"}
|
|
@@ -26,11 +26,11 @@ export const ModalContent = forwardRef(function ModalContent(props, ref) {
|
|
|
26
26
|
*/
|
|
27
27
|
const modalContentRef = useCombinedRefs(ref);
|
|
28
28
|
const { top, bottom } = useScrollableShades(modalContentRef);
|
|
29
|
-
const shadeClasses = 'z-[1] absolute pointer-events-none right-8 left-8 h-[112px]';
|
|
29
|
+
const shadeClasses = 'z-[1] absolute pointer-events-none right-8 left-8 h-[112px] opacity-0 transition-opacity duration-300 data-[active=true]:opacity-100';
|
|
30
30
|
const gradientClasses = 'from-white to-transparent to-100% from-0% via-[2rem] via-white';
|
|
31
31
|
return (React.createElement("div", { className: twMerge('flex relative flex-auto overflow-y-hidden', classes === null || classes === void 0 ? void 0 : classes.root) },
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
React.createElement("div", { "data-active": top, className: twMerge(shadeClasses, gradientClasses, classes === null || classes === void 0 ? void 0 : classes.topShade, 'top-0 bg-linear-to-b') }),
|
|
33
|
+
React.createElement("div", { "data-active": bottom, className: twMerge(shadeClasses, gradientClasses, classes === null || classes === void 0 ? void 0 : classes.bottomShade, 'bottom-0 bg-linear-to-t') }),
|
|
34
34
|
React.createElement("div", Object.assign({}, rest, { style: style, ref: modalContentRef, className: twMerge('pt-6 px-8 pb-8 overflow-auto flex-auto', className) }), children)));
|
|
35
35
|
});
|
|
36
36
|
ModalContent.displayName = 'ModalContent';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalContent.js","sourceRoot":"","sources":["../../../src/ModalContent/ModalContent.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAExD,OAAO,mBAAmB,MAAM,+BAA+B,CAAA;AAO/D,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CACpC,SAAS,YAAY,CAAC,KAAK,EAAE,GAAG;IAC9B,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK;IAE9D;;;OAGG;MALG,6CAAgD,CAAQ,CAAA;IAE9D;;;OAGG;IACH,MAAM,eAAe,GAAG,eAAe,CAAiB,GAAG,CAAC,CAAA;IAE5D,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAA;IAE5D,MAAM,YAAY,GAChB,
|
|
1
|
+
{"version":3,"file":"ModalContent.js","sourceRoot":"","sources":["../../../src/ModalContent/ModalContent.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAExD,OAAO,mBAAmB,MAAM,+BAA+B,CAAA;AAO/D,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CACpC,SAAS,YAAY,CAAC,KAAK,EAAE,GAAG;IAC9B,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK;IAE9D;;;OAGG;MALG,6CAAgD,CAAQ,CAAA;IAE9D;;;OAGG;IACH,MAAM,eAAe,GAAG,eAAe,CAAiB,GAAG,CAAC,CAAA;IAE5D,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAA;IAE5D,MAAM,YAAY,GAChB,sIAAsI,CAAA;IACxI,MAAM,eAAe,GACnB,gEAAgE,CAAA;IAElE,OAAO,CACL,6BACE,SAAS,EAAE,OAAO,CAChB,2CAA2C,EAC3C,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CACd;QAED,4CACe,GAAG,EAChB,SAAS,EAAE,OAAO,CAChB,YAAY,EACZ,eAAe,EACf,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,EACjB,sBAAsB,CACvB,GACD;QAEF,4CACe,MAAM,EACnB,SAAS,EAAE,OAAO,CAChB,YAAY,EACZ,eAAe,EACf,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EACpB,yBAAyB,CAC1B,GACD;QAEF,6CACM,IAAI,IACR,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,eAAe,EACpB,SAAS,EAAE,OAAO,CAChB,wCAAwC,EACxC,SAAS,CACV,KAEA,QAAQ,CACL,CACF,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,YAAY,CAAC,WAAW,GAAG,cAAc,CAAA;AAEzC,eAAe,YAAY,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/picasso-modal",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3-alpha-pf-fix-alpha-release-ea13b5aca.0",
|
|
4
4
|
"description": "Toptal UI components library - Modal",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -18,35 +18,33 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/toptal/picasso/tree/master/packages/picasso#readme",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@
|
|
21
|
+
"@base-ui/react": "^1.4.1",
|
|
22
22
|
"debounce": "^1.2.1",
|
|
23
|
-
"@toptal/picasso-
|
|
24
|
-
"@toptal/picasso-
|
|
25
|
-
"@toptal/picasso-
|
|
26
|
-
"@toptal/picasso-
|
|
27
|
-
"@toptal/picasso-
|
|
28
|
-
"@toptal/picasso-
|
|
29
|
-
"@toptal/picasso-
|
|
30
|
-
"@toptal/picasso-utils": "4.0.1",
|
|
31
|
-
"@toptal/picasso-modal-context": "1.0.1"
|
|
23
|
+
"@toptal/picasso-paper": "4.0.7-alpha-pf-fix-alpha-release-ea13b5aca.0",
|
|
24
|
+
"@toptal/picasso-shared": "16.0.1-alpha-pf-fix-alpha-release-ea13b5aca.0",
|
|
25
|
+
"@toptal/picasso-button": "5.0.3-alpha-pf-fix-alpha-release-ea13b5aca.0",
|
|
26
|
+
"@toptal/picasso-icons": "1.15.4-alpha-pf-fix-alpha-release-ea13b5aca.0",
|
|
27
|
+
"@toptal/picasso-typography": "5.1.1-alpha-pf-fix-alpha-release-ea13b5aca.0",
|
|
28
|
+
"@toptal/picasso-utils": "4.0.2-alpha-pf-fix-alpha-release-ea13b5aca.0",
|
|
29
|
+
"@toptal/picasso-modal-context": "1.0.2-alpha-pf-fix-alpha-release-ea13b5aca.0"
|
|
32
30
|
},
|
|
33
31
|
"sideEffects": [
|
|
34
32
|
"**/styles.ts",
|
|
35
33
|
"**/styles.js"
|
|
36
34
|
],
|
|
37
35
|
"peerDependencies": {
|
|
38
|
-
"@toptal/picasso-provider": "
|
|
39
|
-
"react": ">=16.12.0
|
|
40
|
-
"@toptal/picasso-tailwind": "
|
|
41
|
-
"@toptal/picasso-tailwind-merge": "
|
|
36
|
+
"@toptal/picasso-provider": "6.0.1-alpha-pf-fix-alpha-release-ea13b5aca.0",
|
|
37
|
+
"react": ">=16.12.0",
|
|
38
|
+
"@toptal/picasso-tailwind": "4.0.1-alpha-pf-fix-alpha-release-ea13b5aca.0",
|
|
39
|
+
"@toptal/picasso-tailwind-merge": "2.0.6-alpha-pf-fix-alpha-release-ea13b5aca.0"
|
|
42
40
|
},
|
|
43
41
|
"exports": {
|
|
44
42
|
".": "./dist-package/src/index.js"
|
|
45
43
|
},
|
|
46
44
|
"devDependencies": {
|
|
47
|
-
"@toptal/picasso-provider": "6.0.0",
|
|
48
|
-
"@toptal/picasso-tailwind-merge": "2.0.
|
|
49
|
-
"@toptal/picasso-test-utils": "2.0.
|
|
45
|
+
"@toptal/picasso-provider": "6.0.1-alpha-pf-fix-alpha-release-ea13b5aca.0",
|
|
46
|
+
"@toptal/picasso-tailwind-merge": "2.0.6-alpha-pf-fix-alpha-release-ea13b5aca.0",
|
|
47
|
+
"@toptal/picasso-test-utils": "2.0.2-alpha-pf-fix-alpha-release-ea13b5aca.0"
|
|
50
48
|
},
|
|
51
49
|
"files": [
|
|
52
50
|
"dist-package/**",
|
package/src/Modal/Modal.tsx
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import type { ReactNode, HTMLAttributes } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
import React, {
|
|
4
|
-
forwardRef,
|
|
5
|
-
useEffect,
|
|
6
|
-
useRef,
|
|
7
|
-
useCallback,
|
|
8
|
-
useContext,
|
|
9
|
-
} from 'react'
|
|
2
|
+
import { Dialog } from '@base-ui/react/dialog'
|
|
3
|
+
import React, { forwardRef, useEffect, useRef, useContext } from 'react'
|
|
10
4
|
import type {
|
|
11
5
|
BaseProps,
|
|
12
6
|
SizeType,
|
|
@@ -20,8 +14,6 @@ import {
|
|
|
20
14
|
usePageScrollLock,
|
|
21
15
|
} from '@toptal/picasso-utils'
|
|
22
16
|
import { ButtonCircular } from '@toptal/picasso-button'
|
|
23
|
-
import { Fade } from '@toptal/picasso-fade'
|
|
24
|
-
import { Backdrop } from '@toptal/picasso-backdrop'
|
|
25
17
|
import ModalContext from '@toptal/picasso-modal-context'
|
|
26
18
|
import { twMerge } from '@toptal/picasso-tailwind-merge'
|
|
27
19
|
|
|
@@ -136,6 +128,7 @@ export const Modal = forwardRef<HTMLDivElement, Props>(function Modal(
|
|
|
136
128
|
onBackdropClick,
|
|
137
129
|
onClose,
|
|
138
130
|
onOpen,
|
|
131
|
+
onClick,
|
|
139
132
|
className,
|
|
140
133
|
style,
|
|
141
134
|
container,
|
|
@@ -151,6 +144,7 @@ export const Modal = forwardRef<HTMLDivElement, Props>(function Modal(
|
|
|
151
144
|
useRef<HTMLDivElement>(null)
|
|
152
145
|
)
|
|
153
146
|
const modalId = useRef(generateKey())
|
|
147
|
+
const wasOpen = useRef(false)
|
|
154
148
|
const { rootRef } = useContext(RootContext)
|
|
155
149
|
|
|
156
150
|
useEffect(() => {
|
|
@@ -205,76 +199,89 @@ export const Modal = forwardRef<HTMLDivElement, Props>(function Modal(
|
|
|
205
199
|
|
|
206
200
|
usePageScrollLock(open)
|
|
207
201
|
|
|
208
|
-
|
|
209
|
-
(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
onBackdropClick()
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (onClose) {
|
|
218
|
-
onClose()
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
[disableBackdropClick, onBackdropClick, onClose]
|
|
223
|
-
)
|
|
202
|
+
useEffect(() => {
|
|
203
|
+
if (open && !wasOpen.current) {
|
|
204
|
+
onOpen?.()
|
|
205
|
+
}
|
|
206
|
+
wasOpen.current = open
|
|
207
|
+
}, [open, onOpen])
|
|
224
208
|
|
|
225
209
|
const duration = transitionProps?.timeout || transitionDuration
|
|
226
|
-
const
|
|
210
|
+
const durationStyle = { transitionDuration: `${duration}ms` }
|
|
211
|
+
|
|
212
|
+
const resolvedContainer =
|
|
213
|
+
(typeof container === 'function' ? container() : container) ||
|
|
214
|
+
picassoRootContainer
|
|
215
|
+
|
|
216
|
+
const handlePopupClick = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
217
|
+
if (event.target === event.currentTarget && !disableBackdropClick) {
|
|
218
|
+
onBackdropClick?.()
|
|
219
|
+
onClose?.()
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
onClick?.(event)
|
|
223
|
+
}
|
|
227
224
|
|
|
228
225
|
return (
|
|
229
|
-
<Dialog
|
|
230
|
-
{
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
slots={{
|
|
238
|
-
backdrop: Backdrop,
|
|
226
|
+
<Dialog.Root
|
|
227
|
+
open={open}
|
|
228
|
+
modal={false}
|
|
229
|
+
disablePointerDismissal
|
|
230
|
+
onOpenChange={isOpen => {
|
|
231
|
+
if (!isOpen) {
|
|
232
|
+
onClose?.()
|
|
233
|
+
}
|
|
239
234
|
}}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
235
|
+
onOpenChangeComplete={isOpen => {
|
|
236
|
+
if (!isOpen && modalRef.current) {
|
|
237
|
+
transitionProps?.onExited?.(modalRef.current)
|
|
238
|
+
}
|
|
243
239
|
}}
|
|
244
|
-
container={container || picassoRootContainer}
|
|
245
|
-
hideBackdrop={hideBackdrop}
|
|
246
|
-
onClose={handleClose}
|
|
247
|
-
open={open}
|
|
248
|
-
disableEnforceFocus // we need our own mechanism to keep focus inside the Modals
|
|
249
|
-
disableScrollLock
|
|
250
240
|
>
|
|
251
|
-
<
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
241
|
+
<Dialog.Portal container={resolvedContainer}>
|
|
242
|
+
{!hideBackdrop && (
|
|
243
|
+
<Dialog.Backdrop
|
|
244
|
+
className='fixed z-modal inset-0 bg-black/50 transition-opacity data-starting-style:opacity-0 data-ending-style:opacity-0'
|
|
245
|
+
style={durationStyle}
|
|
246
|
+
/>
|
|
247
|
+
)}
|
|
248
|
+
<Dialog.Popup
|
|
249
|
+
{...rest}
|
|
250
|
+
ref={modalRef}
|
|
251
|
+
initialFocus={() =>
|
|
252
|
+
modalRef.current?.contains(document.activeElement)
|
|
253
|
+
? undefined
|
|
254
|
+
: modalRef.current
|
|
255
|
+
}
|
|
256
|
+
className={twMerge(
|
|
257
|
+
className,
|
|
258
|
+
'fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center transition-opacity data-starting-style:opacity-0 data-ending-style:opacity-0'
|
|
259
|
+
)}
|
|
260
|
+
style={{ ...style, ...durationStyle }}
|
|
261
|
+
onClick={handlePopupClick}
|
|
262
|
+
>
|
|
263
|
+
<ModalPaper size={size} align={align} tabIndex={-1} {...paperProps}>
|
|
264
|
+
<ModalContext.Provider value>
|
|
265
|
+
{children}
|
|
266
|
+
{onClose && (
|
|
267
|
+
<ButtonCircular
|
|
268
|
+
aria-label='Close'
|
|
269
|
+
variant='flat'
|
|
270
|
+
className={twMerge(
|
|
271
|
+
'absolute top-8 right-8',
|
|
272
|
+
classes?.closeButton
|
|
273
|
+
)}
|
|
274
|
+
onClick={onClose}
|
|
275
|
+
data-testid={testIds?.closeButton}
|
|
276
|
+
>
|
|
277
|
+
<CloseMinor16 />
|
|
278
|
+
</ButtonCircular>
|
|
279
|
+
)}
|
|
280
|
+
</ModalContext.Provider>
|
|
281
|
+
</ModalPaper>
|
|
282
|
+
</Dialog.Popup>
|
|
283
|
+
</Dialog.Portal>
|
|
284
|
+
</Dialog.Root>
|
|
278
285
|
)
|
|
279
286
|
})
|
|
280
287
|
|
|
@@ -5,67 +5,125 @@ exports[`Modal renders 1`] = `
|
|
|
5
5
|
id="modal-root"
|
|
6
6
|
>
|
|
7
7
|
<div
|
|
8
|
-
aria-hidden="true"
|
|
9
8
|
class="Picasso-root"
|
|
10
|
-
|
|
9
|
+
data-base-ui-inert=""
|
|
10
|
+
>
|
|
11
|
+
<span
|
|
12
|
+
data-base-ui-focus-guard=""
|
|
13
|
+
data-type="outside"
|
|
14
|
+
role="button"
|
|
15
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
16
|
+
tabindex="0"
|
|
17
|
+
/>
|
|
18
|
+
<span
|
|
19
|
+
aria-owns=":r2:"
|
|
20
|
+
style="clip-path: inset(50%); position: fixed; top: 0px; left: 0px;"
|
|
21
|
+
/>
|
|
22
|
+
<span
|
|
23
|
+
data-base-ui-focus-guard=""
|
|
24
|
+
data-type="outside"
|
|
25
|
+
role="button"
|
|
26
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
27
|
+
tabindex="0"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
11
30
|
<div
|
|
12
|
-
|
|
13
|
-
|
|
31
|
+
data-base-ui-portal=""
|
|
32
|
+
id=":r2:"
|
|
14
33
|
>
|
|
15
34
|
<div
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
35
|
+
class="fixed z-modal inset-0 bg-black/50 transition-opacity data-starting-style:opacity data-ending-style:opacity"
|
|
36
|
+
data-base-ui-inert=""
|
|
37
|
+
data-open=""
|
|
38
|
+
role="presentation"
|
|
39
|
+
style="user-select: none; transition-duration: 300ms;"
|
|
19
40
|
/>
|
|
20
|
-
<
|
|
21
|
-
data-
|
|
41
|
+
<span
|
|
42
|
+
data-base-ui-focus-guard=""
|
|
43
|
+
data-base-ui-inert=""
|
|
44
|
+
data-type="inside"
|
|
45
|
+
role="button"
|
|
46
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
22
47
|
tabindex="0"
|
|
23
48
|
/>
|
|
24
49
|
<div
|
|
25
|
-
class="
|
|
50
|
+
class="fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center transition-opacity data-starting-style:opacity data-ending-style:opacity"
|
|
51
|
+
data-base-ui-focusable=""
|
|
52
|
+
data-open=""
|
|
53
|
+
id=":r0:"
|
|
26
54
|
role="dialog"
|
|
27
|
-
style="
|
|
55
|
+
style="--nested-dialogs: 0; transition-duration: 300ms;"
|
|
28
56
|
tabindex="-1"
|
|
29
57
|
>
|
|
30
58
|
<div
|
|
31
|
-
class="
|
|
59
|
+
class="bg-white shadow-2 transition-shadow duration-300 delay-0 outline-hidden overflow-y flex flex-col m-4 sm:h-auto sm:m-8 max-w-[calc(100%_ sm:max-w-[calc(100%_ rounded-md w-[40.625rem] relative max-h-[calc(100%_ sm:max-h-[calc(100%_"
|
|
60
|
+
role="dialog"
|
|
61
|
+
tabindex="-1"
|
|
32
62
|
>
|
|
33
|
-
<
|
|
34
|
-
class="
|
|
63
|
+
<div
|
|
64
|
+
class="pr-6 mt-8 mx-8 mb-0"
|
|
35
65
|
>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
66
|
+
<h2
|
|
67
|
+
class="m-0 text-xl text-black font-semibold"
|
|
68
|
+
>
|
|
69
|
+
Title
|
|
70
|
+
</h2>
|
|
71
|
+
</div>
|
|
42
72
|
<div
|
|
43
|
-
class="
|
|
73
|
+
class="flex relative flex-auto overflow-y"
|
|
44
74
|
>
|
|
45
|
-
|
|
75
|
+
<div
|
|
76
|
+
class="z-[1] absolute pointer-events right-8 left-8 h-[112px] opacity-0 transition-opacity duration-300 data-[active=true]:opacity-100 from-white to-transparent to-100% from-0% via-[2rem] via-white top-0 bg-linear-to"
|
|
77
|
+
data-active="false"
|
|
78
|
+
/>
|
|
79
|
+
<div
|
|
80
|
+
class="z-[1] absolute pointer-events right-8 left-8 h-[112px] opacity-0 transition-opacity duration-300 data-[active=true]:opacity-100 from-white to-transparent to-100% from-0% via-[2rem] via-white bottom-0 bg-linear-to"
|
|
81
|
+
data-active="false"
|
|
82
|
+
/>
|
|
83
|
+
<div
|
|
84
|
+
class="pt-6 px-8 pb-8 overflow-auto flex-auto"
|
|
85
|
+
>
|
|
86
|
+
Modal test content
|
|
87
|
+
</div>
|
|
46
88
|
</div>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
class="mt-0 mx-8 mb-8 text-right"
|
|
50
|
-
>
|
|
51
|
-
<button
|
|
52
|
-
aria-disabled="false"
|
|
53
|
-
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-hidden [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border border-solid text-black hover:border-black visited:text-black active:bg-gray active:border-black bg-white border-gray min-w h-8 py-0 px-4"
|
|
54
|
-
data-component-type="button"
|
|
55
|
-
role="button"
|
|
56
|
-
tabindex="0"
|
|
57
|
-
type="button"
|
|
89
|
+
<div
|
|
90
|
+
class="mt-0 mx-8 mb-8 text-right"
|
|
58
91
|
>
|
|
59
|
-
<
|
|
60
|
-
|
|
92
|
+
<button
|
|
93
|
+
aria-disabled="false"
|
|
94
|
+
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-hidden [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border border-solid text-black hover:border-black visited:text-black active:bg-gray active:border-black bg-white border-gray min-w h-8 py-0 px-4"
|
|
95
|
+
data-component-type="button"
|
|
96
|
+
role="button"
|
|
97
|
+
tabindex="0"
|
|
98
|
+
type="button"
|
|
61
99
|
>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
100
|
+
<span
|
|
101
|
+
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
102
|
+
>
|
|
103
|
+
Cancel
|
|
104
|
+
</span>
|
|
105
|
+
</button>
|
|
106
|
+
<button
|
|
107
|
+
aria-disabled="false"
|
|
108
|
+
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-hidden [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border-none text-white visited:text-white hover:bg-[#27D496] active:bg-[#00A96C] bg-green min-w h-8 py-0 px-4"
|
|
109
|
+
data-component-type="button"
|
|
110
|
+
role="button"
|
|
111
|
+
tabindex="0"
|
|
112
|
+
type="button"
|
|
113
|
+
>
|
|
114
|
+
<span
|
|
115
|
+
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
116
|
+
>
|
|
117
|
+
Update
|
|
118
|
+
</span>
|
|
119
|
+
</button>
|
|
120
|
+
</div>
|
|
65
121
|
<button
|
|
66
122
|
aria-disabled="false"
|
|
67
|
-
|
|
123
|
+
aria-label="Close"
|
|
124
|
+
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-hidden [[data-component-type="button"]+&]:ml cursor-pointer rounded-full p-0 w-[1.5em] h-[1.5em] border-none text-graphite hover:bg-gray active:bg-gray focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] bg-transparent absolute top-8 right-8"
|
|
68
125
|
data-component-type="button"
|
|
126
|
+
data-testid="close-modal"
|
|
69
127
|
role="button"
|
|
70
128
|
tabindex="0"
|
|
71
129
|
type="button"
|
|
@@ -73,37 +131,25 @@ exports[`Modal renders 1`] = `
|
|
|
73
131
|
<span
|
|
74
132
|
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
75
133
|
>
|
|
76
|
-
|
|
134
|
+
<svg
|
|
135
|
+
class="fill-current inline-block text-inherit h-[1em] align-[-.125em]"
|
|
136
|
+
style="min-width: 16px; min-height: 16px;"
|
|
137
|
+
viewBox="0 0 16 16"
|
|
138
|
+
>
|
|
139
|
+
<path
|
|
140
|
+
d="m8.707 8 3.5 3.5-.707.707-3.5-3.5-3.5 3.5-.707-.707 3.5-3.5-3.5-3.5.707-.707 3.5 3.5 3.5-3.5.707.707-3.5 3.5Z"
|
|
141
|
+
/>
|
|
142
|
+
</svg>
|
|
77
143
|
</span>
|
|
78
144
|
</button>
|
|
79
145
|
</div>
|
|
80
|
-
<button
|
|
81
|
-
aria-disabled="false"
|
|
82
|
-
aria-label="Close"
|
|
83
|
-
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-hidden [[data-component-type="button"]+&]:ml cursor-pointer rounded-full p-0 w-[1.5em] h-[1.5em] border-none text-graphite hover:bg-gray active:bg-gray focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] bg-transparent absolute top-8 right-8"
|
|
84
|
-
data-component-type="button"
|
|
85
|
-
data-testid="close-modal"
|
|
86
|
-
role="button"
|
|
87
|
-
tabindex="0"
|
|
88
|
-
type="button"
|
|
89
|
-
>
|
|
90
|
-
<span
|
|
91
|
-
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
92
|
-
>
|
|
93
|
-
<svg
|
|
94
|
-
class="fill-current inline-block text-inherit h-[1em] align-[-.125em]"
|
|
95
|
-
style="min-width: 16px; min-height: 16px;"
|
|
96
|
-
viewBox="0 0 16 16"
|
|
97
|
-
>
|
|
98
|
-
<path
|
|
99
|
-
d="m8.707 8 3.5 3.5-.707.707-3.5-3.5-3.5 3.5-.707-.707 3.5-3.5-3.5-3.5.707-.707 3.5 3.5 3.5-3.5.707.707-3.5 3.5Z"
|
|
100
|
-
/>
|
|
101
|
-
</svg>
|
|
102
|
-
</span>
|
|
103
|
-
</button>
|
|
104
146
|
</div>
|
|
105
|
-
<
|
|
106
|
-
data-
|
|
147
|
+
<span
|
|
148
|
+
data-base-ui-focus-guard=""
|
|
149
|
+
data-base-ui-inert=""
|
|
150
|
+
data-type="inside"
|
|
151
|
+
role="button"
|
|
152
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
107
153
|
tabindex="0"
|
|
108
154
|
/>
|
|
109
155
|
</div>
|
|
@@ -118,8 +164,8 @@ exports[`Modal useModal opens and closes modal 1`] = `
|
|
|
118
164
|
>
|
|
119
165
|
<button
|
|
120
166
|
aria-disabled="false"
|
|
121
|
-
aria-hidden="true"
|
|
122
167
|
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-hidden [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border-none text-white visited:text-white hover:bg-[#4269D6] active:bg-[#1A41AB] bg-blue min-w h-8 py-0 px-4"
|
|
168
|
+
data-base-ui-inert=""
|
|
123
169
|
data-component-type="button"
|
|
124
170
|
role="button"
|
|
125
171
|
tabindex="0"
|
|
@@ -132,47 +178,89 @@ exports[`Modal useModal opens and closes modal 1`] = `
|
|
|
132
178
|
</span>
|
|
133
179
|
</button>
|
|
134
180
|
<div
|
|
135
|
-
|
|
136
|
-
|
|
181
|
+
data-base-ui-portal=""
|
|
182
|
+
id=":r5:"
|
|
137
183
|
>
|
|
138
184
|
<div
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
185
|
+
class="fixed z-modal inset-0 bg-black/50 transition-opacity data-starting-style:opacity data-ending-style:opacity"
|
|
186
|
+
data-base-ui-inert=""
|
|
187
|
+
data-open=""
|
|
188
|
+
data-starting-style=""
|
|
189
|
+
role="presentation"
|
|
190
|
+
style="user-select: none; transition-duration: 300ms;"
|
|
142
191
|
/>
|
|
143
|
-
<
|
|
144
|
-
data-
|
|
192
|
+
<span
|
|
193
|
+
data-base-ui-focus-guard=""
|
|
194
|
+
data-base-ui-inert=""
|
|
195
|
+
data-type="inside"
|
|
196
|
+
role="button"
|
|
197
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
145
198
|
tabindex="0"
|
|
146
199
|
/>
|
|
147
200
|
<div
|
|
148
|
-
class="
|
|
201
|
+
class="fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center transition-opacity data-starting-style:opacity data-ending-style:opacity"
|
|
202
|
+
data-base-ui-focusable=""
|
|
203
|
+
data-open=""
|
|
204
|
+
data-starting-style=""
|
|
205
|
+
id=":r3:"
|
|
149
206
|
role="dialog"
|
|
150
|
-
style="
|
|
207
|
+
style="--nested-dialogs: 0; transition-duration: 300ms;"
|
|
151
208
|
tabindex="-1"
|
|
152
209
|
>
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
aria-disabled="false"
|
|
158
|
-
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-hidden [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border-none text-white visited:text-white hover:bg-[#4269D6] active:bg-[#1A41AB] bg-blue min-w h-8 py-0 px-4"
|
|
159
|
-
data-component-type="button"
|
|
160
|
-
role="button"
|
|
161
|
-
tabindex="0"
|
|
162
|
-
type="button"
|
|
210
|
+
<div
|
|
211
|
+
class="bg-white shadow-2 transition-shadow duration-300 delay-0 outline-hidden overflow-y flex flex-col m-4 sm:h-auto sm:m-8 max-w-[calc(100%_ sm:max-w-[calc(100%_ rounded-md w-[40.625rem] relative max-h-[calc(100%_ sm:max-h-[calc(100%_"
|
|
212
|
+
role="dialog"
|
|
213
|
+
tabindex="-1"
|
|
163
214
|
>
|
|
164
|
-
<
|
|
165
|
-
|
|
215
|
+
<p>
|
|
216
|
+
Modal content
|
|
217
|
+
</p>
|
|
218
|
+
<button
|
|
219
|
+
aria-disabled="false"
|
|
220
|
+
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-hidden [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border-none text-white visited:text-white hover:bg-[#4269D6] active:bg-[#1A41AB] bg-blue min-w h-8 py-0 px-4"
|
|
221
|
+
data-component-type="button"
|
|
222
|
+
role="button"
|
|
223
|
+
tabindex="0"
|
|
224
|
+
type="button"
|
|
166
225
|
>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
226
|
+
<span
|
|
227
|
+
class="items-center inline-flex font-semibold whitespace-nowrap text-button"
|
|
228
|
+
>
|
|
229
|
+
Hide
|
|
230
|
+
</span>
|
|
231
|
+
</button>
|
|
232
|
+
</div>
|
|
170
233
|
</div>
|
|
171
|
-
<
|
|
172
|
-
data-
|
|
234
|
+
<span
|
|
235
|
+
data-base-ui-focus-guard=""
|
|
236
|
+
data-base-ui-inert=""
|
|
237
|
+
data-type="inside"
|
|
238
|
+
role="button"
|
|
239
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
173
240
|
tabindex="0"
|
|
174
241
|
/>
|
|
175
242
|
</div>
|
|
243
|
+
<span
|
|
244
|
+
data-base-ui-focus-guard=""
|
|
245
|
+
data-base-ui-inert=""
|
|
246
|
+
data-type="outside"
|
|
247
|
+
role="button"
|
|
248
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
249
|
+
tabindex="0"
|
|
250
|
+
/>
|
|
251
|
+
<span
|
|
252
|
+
aria-owns=":r5:"
|
|
253
|
+
data-base-ui-inert=""
|
|
254
|
+
style="clip-path: inset(50%); position: fixed; top: 0px; left: 0px;"
|
|
255
|
+
/>
|
|
256
|
+
<span
|
|
257
|
+
data-base-ui-focus-guard=""
|
|
258
|
+
data-base-ui-inert=""
|
|
259
|
+
data-type="outside"
|
|
260
|
+
role="button"
|
|
261
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
262
|
+
tabindex="0"
|
|
263
|
+
/>
|
|
176
264
|
</div>
|
|
177
265
|
</div>
|
|
178
266
|
</body>
|
|
@@ -211,8 +299,8 @@ exports[`Modal useModal shows multiple modals at the same time 1`] = `
|
|
|
211
299
|
>
|
|
212
300
|
<button
|
|
213
301
|
aria-disabled="false"
|
|
214
|
-
aria-hidden="true"
|
|
215
302
|
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-hidden [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border-none text-white visited:text-white hover:bg-[#4269D6] active:bg-[#1A41AB] bg-blue min-w h-8 py-0 px-4"
|
|
303
|
+
data-base-ui-inert=""
|
|
216
304
|
data-component-type="button"
|
|
217
305
|
role="button"
|
|
218
306
|
tabindex="0"
|
|
@@ -226,8 +314,8 @@ exports[`Modal useModal shows multiple modals at the same time 1`] = `
|
|
|
226
314
|
</button>
|
|
227
315
|
<button
|
|
228
316
|
aria-disabled="false"
|
|
229
|
-
aria-hidden="true"
|
|
230
317
|
class="base-Button text-lg inline-flex items-center justify-center select-none appearance-none m-0 relative normal-case align-middle transition-colors duration-350 ease-out shrink-0 outline-hidden [[data-component-type="button"]+&]:ml cursor-pointer no-underline hover:no-underline rounded-sm shadow-none focus-visible:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] focus-within:shadow-[0_0_0_3px_rgba(32,78,207,0.48)] border-none text-white visited:text-white hover:bg-[#4269D6] active:bg-[#1A41AB] bg-blue min-w h-8 py-0 px-4"
|
|
318
|
+
data-base-ui-inert=""
|
|
231
319
|
data-component-type="button"
|
|
232
320
|
role="button"
|
|
233
321
|
tabindex="0"
|
|
@@ -240,62 +328,146 @@ exports[`Modal useModal shows multiple modals at the same time 1`] = `
|
|
|
240
328
|
</span>
|
|
241
329
|
</button>
|
|
242
330
|
<div
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
331
|
+
data-base-ui-inert=""
|
|
332
|
+
data-base-ui-portal=""
|
|
333
|
+
id=":rg:"
|
|
246
334
|
>
|
|
247
335
|
<div
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
336
|
+
class="fixed z-modal inset-0 bg-black/50 transition-opacity data-starting-style:opacity data-ending-style:opacity"
|
|
337
|
+
data-base-ui-inert=""
|
|
338
|
+
data-open=""
|
|
339
|
+
data-starting-style=""
|
|
340
|
+
role="presentation"
|
|
341
|
+
style="user-select: none; transition-duration: 300ms;"
|
|
251
342
|
/>
|
|
252
|
-
<
|
|
253
|
-
data-
|
|
343
|
+
<span
|
|
344
|
+
data-base-ui-focus-guard=""
|
|
345
|
+
data-base-ui-inert=""
|
|
346
|
+
data-type="inside"
|
|
347
|
+
role="button"
|
|
348
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
254
349
|
tabindex="0"
|
|
255
350
|
/>
|
|
256
351
|
<div
|
|
257
|
-
class="
|
|
352
|
+
class="fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center transition-opacity data-starting-style:opacity data-ending-style:opacity"
|
|
353
|
+
data-base-ui-focusable=""
|
|
354
|
+
data-open=""
|
|
355
|
+
data-starting-style=""
|
|
356
|
+
id=":rc:"
|
|
258
357
|
role="dialog"
|
|
259
|
-
style="
|
|
358
|
+
style="--nested-dialogs: 0; transition-duration: 300ms;"
|
|
260
359
|
tabindex="-1"
|
|
261
360
|
>
|
|
262
|
-
<
|
|
263
|
-
|
|
264
|
-
|
|
361
|
+
<div
|
|
362
|
+
class="bg-white shadow-2 transition-shadow duration-300 delay-0 outline-hidden overflow-y flex flex-col m-4 sm:h-auto sm:m-8 max-w-[calc(100%_ sm:max-w-[calc(100%_ rounded-md w-[40.625rem] relative max-h-[calc(100%_ sm:max-h-[calc(100%_"
|
|
363
|
+
role="dialog"
|
|
364
|
+
tabindex="-1"
|
|
365
|
+
>
|
|
366
|
+
<p>
|
|
367
|
+
First modal content
|
|
368
|
+
</p>
|
|
369
|
+
</div>
|
|
265
370
|
</div>
|
|
266
|
-
<
|
|
267
|
-
data-
|
|
371
|
+
<span
|
|
372
|
+
data-base-ui-focus-guard=""
|
|
373
|
+
data-base-ui-inert=""
|
|
374
|
+
data-type="inside"
|
|
375
|
+
role="button"
|
|
376
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
268
377
|
tabindex="0"
|
|
269
378
|
/>
|
|
270
379
|
</div>
|
|
380
|
+
<span
|
|
381
|
+
data-base-ui-focus-guard=""
|
|
382
|
+
data-base-ui-inert=""
|
|
383
|
+
data-type="outside"
|
|
384
|
+
role="button"
|
|
385
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
386
|
+
tabindex="0"
|
|
387
|
+
/>
|
|
388
|
+
<span
|
|
389
|
+
aria-owns=":rg:"
|
|
390
|
+
data-base-ui-inert=""
|
|
391
|
+
style="clip-path: inset(50%); position: fixed; top: 0px; left: 0px;"
|
|
392
|
+
/>
|
|
393
|
+
<span
|
|
394
|
+
data-base-ui-focus-guard=""
|
|
395
|
+
data-base-ui-inert=""
|
|
396
|
+
data-type="outside"
|
|
397
|
+
role="button"
|
|
398
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
399
|
+
tabindex="0"
|
|
400
|
+
/>
|
|
271
401
|
<div
|
|
272
|
-
|
|
273
|
-
|
|
402
|
+
data-base-ui-portal=""
|
|
403
|
+
id=":rh:"
|
|
274
404
|
>
|
|
275
405
|
<div
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
406
|
+
class="fixed z-modal inset-0 bg-black/50 transition-opacity data-starting-style:opacity data-ending-style:opacity"
|
|
407
|
+
data-base-ui-inert=""
|
|
408
|
+
data-open=""
|
|
409
|
+
data-starting-style=""
|
|
410
|
+
role="presentation"
|
|
411
|
+
style="user-select: none; transition-duration: 300ms;"
|
|
279
412
|
/>
|
|
280
|
-
<
|
|
281
|
-
data-
|
|
413
|
+
<span
|
|
414
|
+
data-base-ui-focus-guard=""
|
|
415
|
+
data-base-ui-inert=""
|
|
416
|
+
data-type="inside"
|
|
417
|
+
role="button"
|
|
418
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
282
419
|
tabindex="0"
|
|
283
420
|
/>
|
|
284
421
|
<div
|
|
285
|
-
class="
|
|
422
|
+
class="fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center transition-opacity data-starting-style:opacity data-ending-style:opacity"
|
|
423
|
+
data-base-ui-focusable=""
|
|
424
|
+
data-open=""
|
|
425
|
+
data-starting-style=""
|
|
426
|
+
id=":re:"
|
|
286
427
|
role="dialog"
|
|
287
|
-
style="
|
|
428
|
+
style="--nested-dialogs: 0; transition-duration: 300ms;"
|
|
288
429
|
tabindex="-1"
|
|
289
430
|
>
|
|
290
|
-
<
|
|
291
|
-
|
|
292
|
-
|
|
431
|
+
<div
|
|
432
|
+
class="bg-white shadow-2 transition-shadow duration-300 delay-0 outline-hidden overflow-y flex flex-col m-4 sm:h-auto sm:m-8 max-w-[calc(100%_ sm:max-w-[calc(100%_ rounded-md w-[40.625rem] relative max-h-[calc(100%_ sm:max-h-[calc(100%_"
|
|
433
|
+
role="dialog"
|
|
434
|
+
tabindex="-1"
|
|
435
|
+
>
|
|
436
|
+
<p>
|
|
437
|
+
Second modal content
|
|
438
|
+
</p>
|
|
439
|
+
</div>
|
|
293
440
|
</div>
|
|
294
|
-
<
|
|
295
|
-
data-
|
|
441
|
+
<span
|
|
442
|
+
data-base-ui-focus-guard=""
|
|
443
|
+
data-base-ui-inert=""
|
|
444
|
+
data-type="inside"
|
|
445
|
+
role="button"
|
|
446
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
296
447
|
tabindex="0"
|
|
297
448
|
/>
|
|
298
449
|
</div>
|
|
450
|
+
<span
|
|
451
|
+
data-base-ui-focus-guard=""
|
|
452
|
+
data-base-ui-inert=""
|
|
453
|
+
data-type="outside"
|
|
454
|
+
role="button"
|
|
455
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
456
|
+
tabindex="0"
|
|
457
|
+
/>
|
|
458
|
+
<span
|
|
459
|
+
aria-owns=":rh:"
|
|
460
|
+
data-base-ui-inert=""
|
|
461
|
+
style="clip-path: inset(50%); position: fixed; top: 0px; left: 0px;"
|
|
462
|
+
/>
|
|
463
|
+
<span
|
|
464
|
+
data-base-ui-focus-guard=""
|
|
465
|
+
data-base-ui-inert=""
|
|
466
|
+
data-type="outside"
|
|
467
|
+
role="button"
|
|
468
|
+
style="clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0px; padding: 0px; width: 1px; height: 1px; margin: -1px; position: fixed; top: 0px; left: 0px;"
|
|
469
|
+
tabindex="0"
|
|
470
|
+
/>
|
|
299
471
|
</div>
|
|
300
472
|
</div>
|
|
301
473
|
</body>
|
package/src/Modal/test.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
screen,
|
|
5
5
|
cleanup,
|
|
6
6
|
fireEvent,
|
|
7
|
-
|
|
7
|
+
waitFor,
|
|
8
8
|
} from '@toptal/picasso-test-utils'
|
|
9
9
|
import type { OmitInternalProps } from '@toptal/picasso-shared'
|
|
10
10
|
import { useModal } from '@toptal/picasso-utils'
|
|
@@ -102,7 +102,7 @@ describe('Modal', () => {
|
|
|
102
102
|
const hideModalButton = getByText('Hide')
|
|
103
103
|
|
|
104
104
|
fireEvent.click(hideModalButton)
|
|
105
|
-
await
|
|
105
|
+
await waitFor(() => expect(queryByText('Hide')).toBeFalsy())
|
|
106
106
|
|
|
107
107
|
expect(queryByText('Modal content')).toBeFalsy()
|
|
108
108
|
expect(baseElement).toMatchSnapshot()
|
|
@@ -24,7 +24,7 @@ export const ModalContent = forwardRef<HTMLDivElement, Props>(
|
|
|
24
24
|
const { top, bottom } = useScrollableShades(modalContentRef)
|
|
25
25
|
|
|
26
26
|
const shadeClasses =
|
|
27
|
-
'z-[1] absolute pointer-events-none right-8 left-8 h-[112px]'
|
|
27
|
+
'z-[1] absolute pointer-events-none right-8 left-8 h-[112px] opacity-0 transition-opacity duration-300 data-[active=true]:opacity-100'
|
|
28
28
|
const gradientClasses =
|
|
29
29
|
'from-white to-transparent to-100% from-0% via-[2rem] via-white'
|
|
30
30
|
|
|
@@ -35,26 +35,26 @@ export const ModalContent = forwardRef<HTMLDivElement, Props>(
|
|
|
35
35
|
classes?.root
|
|
36
36
|
)}
|
|
37
37
|
>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
38
|
+
<div
|
|
39
|
+
data-active={top}
|
|
40
|
+
className={twMerge(
|
|
41
|
+
shadeClasses,
|
|
42
|
+
gradientClasses,
|
|
43
|
+
classes?.topShade,
|
|
44
|
+
'top-0 bg-linear-to-b'
|
|
45
|
+
)}
|
|
46
|
+
/>
|
|
47
|
+
|
|
48
|
+
<div
|
|
49
|
+
data-active={bottom}
|
|
50
|
+
className={twMerge(
|
|
51
|
+
shadeClasses,
|
|
52
|
+
gradientClasses,
|
|
53
|
+
classes?.bottomShade,
|
|
54
|
+
'bottom-0 bg-linear-to-t'
|
|
55
|
+
)}
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
58
|
<div
|
|
59
59
|
{...rest}
|
|
60
60
|
style={style}
|