@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.
@@ -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,KAMN,MAAM,OAAO,CAAA;AACd,OAAO,KAAK,EACV,SAAS,EACT,QAAQ,EACR,eAAe,EAChB,MAAM,wBAAwB,CAAA;AAgB/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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,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 { Modal as Dialog } from '@mui/base/Modal';
13
- import React, { forwardRef, useEffect, useRef, useCallback, useContext, } from 'react';
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
- const handleClose = useCallback((_event, reason) => {
104
- if (reason === 'escapeKeyDown' && onClose) {
105
- onClose();
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
- else if (reason === 'backdropClick' && !disableBackdropClick) {
108
- if (onBackdropClick) {
109
- onBackdropClick();
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
- if (onClose) {
112
- onClose();
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
- }, [disableBackdropClick, onBackdropClick, onClose]);
116
- const duration = (transitionProps === null || transitionProps === void 0 ? void 0 : transitionProps.timeout) || transitionDuration;
117
- const backdropProps = { transitionDuration: duration };
118
- return (React.createElement(Dialog, Object.assign({}, rest, { ref: modalRef, className: twMerge(className, 'fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center'), style: style, slots: {
119
- backdrop: Backdrop,
120
- }, closeAfterTransition: true, slotProps: {
121
- backdrop: backdropProps,
122
- }, container: container || picassoRootContainer, hideBackdrop: hideBackdrop, onClose: handleClose, open: open, disableEnforceFocus // we need our own mechanism to keep focus inside the Modals
123
- : true, disableScrollLock: true }),
124
- React.createElement(Fade, { in: open, onEnter: onOpen, onExited: transitionProps === null || transitionProps === void 0 ? void 0 : transitionProps.onExited, timeout: transitionDuration },
125
- React.createElement(ModalPaper, Object.assign({ size: size, align: align, tabIndex: -1 }, paperProps),
126
- React.createElement(ModalContext.Provider, { value: true },
127
- children,
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,KAAK,IAAI,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,EACZ,UAAU,EACV,SAAS,EACT,MAAM,EACN,WAAW,EACX,UAAU,GACX,MAAM,OAAO,CAAA;AAMd,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EACL,eAAe,EACf,YAAY,EACZ,iBAAiB,GAClB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,cA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KAAK,EAAE,aAAa,GACpB,CACH;YACD,oBAAC,MAAM,CAAC,KAAK,oBACP,IAAI,IACR,GAAG,EAAE,QAAQ,EACb,YAAY,EAAE,GAAG,EAAE;;oBACjB,OAAA,CAAA,MAAA,QAAQ,CAAC,OAAO,0CAAE,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC;wBAChD,CAAC,CAAC,SAAS;wBACX,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAA;iBAAA,EAEtB,SAAS,EAAE,OAAO,CAChB,SAAS,EACT,uKAAuK,CACxK,EACD,KAAK,kCAAO,KAAK,GAAK,aAAa,GACnC,OAAO,EAAE,gBAAgB;gBAEzB,oBAAC,UAAU,kBAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,IAAM,UAAU;oBAChE,oBAAC,YAAY,CAAC,QAAQ,IAAC,KAAK;wBACzB,QAAQ;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
- top && (React.createElement("div", { className: twMerge(shadeClasses, gradientClasses, classes === null || classes === void 0 ? void 0 : classes.topShade, 'top-0 bg-gradient-to-b') })),
33
- bottom && (React.createElement("div", { className: twMerge(shadeClasses, gradientClasses, classes === null || classes === void 0 ? void 0 : classes.bottomShade, 'bottom-0 bg-gradient-to-t') })),
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,6DAA6D,CAAA;IAC/D,MAAM,eAAe,GACnB,gEAAgE,CAAA;IAElE,OAAO,CACL,6BACE,SAAS,EAAE,OAAO,CAChB,2CAA2C,EAC3C,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CACd;QAEA,GAAG,IAAI,CACN,6BACE,SAAS,EAAE,OAAO,CAChB,YAAY,EACZ,eAAe,EACf,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,EACjB,wBAAwB,CACzB,GACD,CACH;QACA,MAAM,IAAI,CACT,6BACE,SAAS,EAAE,OAAO,CAChB,YAAY,EACZ,eAAe,EACf,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EACpB,2BAA2B,CAC5B,GACD,CACH;QACD,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"}
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.2",
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
- "@mui/base": "5.0.0-beta.58",
21
+ "@base-ui/react": "^1.4.1",
22
22
  "debounce": "^1.2.1",
23
- "@toptal/picasso-backdrop": "2.0.1",
24
- "@toptal/picasso-fade": "1.0.10",
25
- "@toptal/picasso-paper": "4.0.6",
26
- "@toptal/picasso-shared": "16.0.0",
27
- "@toptal/picasso-button": "5.0.2",
28
- "@toptal/picasso-icons": "1.15.3",
29
- "@toptal/picasso-typography": "5.1.0",
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 < 19.0.0",
40
- "@toptal/picasso-tailwind": ">=2.5.0",
41
- "@toptal/picasso-tailwind-merge": "^2.0.0"
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.5",
49
- "@toptal/picasso-test-utils": "2.0.1"
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/**",
@@ -1,12 +1,6 @@
1
1
  import type { ReactNode, HTMLAttributes } from 'react'
2
- import { Modal as Dialog } from '@mui/base/Modal'
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
- const handleClose = useCallback(
209
- (_event, reason: 'backdropClick' | 'escapeKeyDown') => {
210
- if (reason === 'escapeKeyDown' && onClose) {
211
- onClose()
212
- } else if (reason === 'backdropClick' && !disableBackdropClick) {
213
- if (onBackdropClick) {
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 backdropProps = { transitionDuration: duration }
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
- {...rest}
231
- ref={modalRef}
232
- className={twMerge(
233
- className,
234
- 'fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center'
235
- )}
236
- style={style}
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
- closeAfterTransition
241
- slotProps={{
242
- backdrop: backdropProps,
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
- <Fade
252
- in={open}
253
- onEnter={onOpen}
254
- onExited={transitionProps?.onExited}
255
- timeout={transitionDuration}
256
- >
257
- <ModalPaper size={size} align={align} tabIndex={-1} {...paperProps}>
258
- <ModalContext.Provider value>
259
- {children}
260
- {onClose && (
261
- <ButtonCircular
262
- aria-label='Close'
263
- variant='flat'
264
- className={twMerge(
265
- 'absolute top-8 right-8',
266
- classes?.closeButton
267
- )}
268
- onClick={onClose}
269
- data-testid={testIds?.closeButton}
270
- >
271
- <CloseMinor16 />
272
- </ButtonCircular>
273
- )}
274
- </ModalContext.Provider>
275
- </ModalPaper>
276
- </Fade>
277
- </Dialog>
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
- class="base-Modal fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center"
13
- role="presentation"
31
+ data-base-ui-portal=""
32
+ id=":r2:"
14
33
  >
15
34
  <div
16
- aria-hidden="true"
17
- class="opacity-0 transition-opacity fixed -z inset-0 bg-black -webkit-tap-highlight-color bg-black/50"
18
- style="transition-duration: 300ms; opacity: 1;"
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
- <div
21
- data-testid="sentinelStart"
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="bg-white shadow-2 duration-300 delay-0 opacity-0 transition-opacity 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%_"
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="transition-duration: 300ms; opacity: 1;"
55
+ style="--nested-dialogs: 0; transition-duration: 300ms;"
28
56
  tabindex="-1"
29
57
  >
30
58
  <div
31
- class="pr-6 mt-8 mx-8 mb-0"
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
- <h2
34
- class="m-0 text-xl text-black font-semibold"
63
+ <div
64
+ class="pr-6 mt-8 mx-8 mb-0"
35
65
  >
36
- Title
37
- </h2>
38
- </div>
39
- <div
40
- class="flex relative flex-auto overflow-y"
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="pt-6 px-8 pb-8 overflow-auto flex-auto"
73
+ class="flex relative flex-auto overflow-y"
44
74
  >
45
- Modal test content
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
- </div>
48
- <div
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
- <span
60
- class="items-center inline-flex font-semibold whitespace-nowrap text-button"
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
- Cancel
63
- </span>
64
- </button>
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
- 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"
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
- Update
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
- <div
106
- data-testid="sentinelEnd"
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
- class="base-Modal fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center"
136
- role="presentation"
181
+ data-base-ui-portal=""
182
+ id=":r5:"
137
183
  >
138
184
  <div
139
- aria-hidden="true"
140
- class="opacity-0 transition-opacity fixed -z inset-0 bg-black -webkit-tap-highlight-color bg-black/50"
141
- style="transition-duration: 300ms; opacity: 1;"
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
- <div
144
- data-testid="sentinelStart"
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="bg-white shadow-2 duration-300 delay-0 opacity-0 transition-opacity 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%_"
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="transition-duration: 300ms; opacity: 1;"
207
+ style="--nested-dialogs: 0; transition-duration: 300ms;"
151
208
  tabindex="-1"
152
209
  >
153
- <p>
154
- Modal content
155
- </p>
156
- <button
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
- <span
165
- class="items-center inline-flex font-semibold whitespace-nowrap text-button"
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
- Hide
168
- </span>
169
- </button>
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
- <div
172
- data-testid="sentinelEnd"
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
- aria-hidden="true"
244
- class="base-Modal fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center"
245
- role="presentation"
331
+ data-base-ui-inert=""
332
+ data-base-ui-portal=""
333
+ id=":rg:"
246
334
  >
247
335
  <div
248
- aria-hidden="true"
249
- class="opacity-0 transition-opacity fixed -z inset-0 bg-black -webkit-tap-highlight-color bg-black/50"
250
- style="transition-duration: 300ms; opacity: 1;"
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
- <div
253
- data-testid="sentinelStart"
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="bg-white shadow-2 duration-300 delay-0 opacity-0 transition-opacity 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%_"
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="transition-duration: 300ms; opacity: 1;"
358
+ style="--nested-dialogs: 0; transition-duration: 300ms;"
260
359
  tabindex="-1"
261
360
  >
262
- <p>
263
- First modal content
264
- </p>
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
- <div
267
- data-testid="sentinelEnd"
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
- class="base-Modal fixed z-modal inset-0 flex flex-col text-lg leading-[normal] justify-center items-center"
273
- role="presentation"
402
+ data-base-ui-portal=""
403
+ id=":rh:"
274
404
  >
275
405
  <div
276
- aria-hidden="true"
277
- class="opacity-0 transition-opacity fixed -z inset-0 bg-black -webkit-tap-highlight-color bg-black/50"
278
- style="transition-duration: 300ms; opacity: 1;"
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
- <div
281
- data-testid="sentinelStart"
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="bg-white shadow-2 duration-300 delay-0 opacity-0 transition-opacity 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%_"
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="transition-duration: 300ms; opacity: 1;"
428
+ style="--nested-dialogs: 0; transition-duration: 300ms;"
288
429
  tabindex="-1"
289
430
  >
290
- <p>
291
- Second modal content
292
- </p>
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
- <div
295
- data-testid="sentinelEnd"
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>
@@ -4,7 +4,7 @@ import {
4
4
  screen,
5
5
  cleanup,
6
6
  fireEvent,
7
- waitForElementToBeRemoved,
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 waitForElementToBeRemoved(() => getByText('Hide'))
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
- {top && (
39
- <div
40
- className={twMerge(
41
- shadeClasses,
42
- gradientClasses,
43
- classes?.topShade,
44
- 'top-0 bg-gradient-to-b'
45
- )}
46
- />
47
- )}
48
- {bottom && (
49
- <div
50
- className={twMerge(
51
- shadeClasses,
52
- gradientClasses,
53
- classes?.bottomShade,
54
- 'bottom-0 bg-gradient-to-t'
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}