diff --git a/src/components/Modal/Modal.tsx b/src/components/Modal/Modal.tsx index 2c220ee022..7d14950d1b 100644 --- a/src/components/Modal/Modal.tsx +++ b/src/components/Modal/Modal.tsx @@ -102,34 +102,32 @@ export function Modal({ }); return ( - - - containerRef.current?.addEventListener('animationend', done) - } - classNames={getCSSTransitionClassNames(b)} - mountOnEnter={!keepMounted} - unmountOnExit={!keepMounted} - appear={true} - onEnter={() => { - setInTransition(true); - onTransitionEnter?.(); - }} - onExit={() => { - setInTransition(true); - onTransitionExit?.(); - }} - onEntered={() => { - setInTransition(false); - onTransitionEntered?.(); - }} - onExited={() => { - setInTransition(false); - onTransitionExited?.(); - }} - > + containerRef.current?.addEventListener('animationend', done)} + classNames={getCSSTransitionClassNames(b)} + mountOnEnter={!keepMounted} + unmountOnExit={!keepMounted} + appear={true} + onEnter={() => { + setInTransition(true); + onTransitionEnter?.(); + }} + onExit={() => { + setInTransition(true); + onTransitionExit?.(); + }} + onEntered={() => { + setInTransition(false); + onTransitionEntered?.(); + }} + onExited={() => { + setInTransition(false); + onTransitionExited?.(); + }} + > + @@ -157,7 +155,7 @@ export function Modal({ - - + + ); } diff --git a/src/components/Popup/Popup.tsx b/src/components/Popup/Popup.tsx index f0e436b897..b25b2e03cb 100644 --- a/src/components/Popup/Popup.tsx +++ b/src/components/Popup/Popup.tsx @@ -151,30 +151,28 @@ export function Popup({ }); return ( - - - containerRef.current?.addEventListener('animationend', done) - } - classNames={getCSSTransitionClassNames(b)} - mountOnEnter={!keepMounted} - unmountOnExit={!keepMounted} - appear={true} - onEnter={() => { - onTransitionEnter?.(); - }} - onEntered={() => { - onTransitionEntered?.(); - }} - onExit={() => { - onTransitionExit?.(); - }} - onExited={() => { - onTransitionExited?.(); - }} - > + containerRef.current?.addEventListener('animationend', done)} + classNames={getCSSTransitionClassNames(b)} + mountOnEnter={!keepMounted} + unmountOnExit={!keepMounted} + appear={true} + onEnter={() => { + onTransitionEnter?.(); + }} + onEntered={() => { + onTransitionEntered?.(); + }} + onExit={() => { + onTransitionExit?.(); + }} + onExited={() => { + onTransitionExited?.(); + }} + > + - - + + ); } diff --git a/src/components/Portal/Portal.scss b/src/components/Portal/Portal.scss new file mode 100644 index 0000000000..58fa6954a2 --- /dev/null +++ b/src/components/Portal/Portal.scss @@ -0,0 +1,9 @@ +@use '../variables'; + +$block: '.#{variables.$ns}portal'; + +#{$block} { + &__theme-wrapper { + display: contents; + } +} diff --git a/src/components/Portal/Portal.tsx b/src/components/Portal/Portal.tsx index cbc0bdb7ea..cd23982888 100644 --- a/src/components/Portal/Portal.tsx +++ b/src/components/Portal/Portal.tsx @@ -3,6 +3,12 @@ import React from 'react'; import ReactDOM from 'react-dom'; import {usePortalContainer} from '../../hooks'; +import {ThemeProvider} from '../theme'; +import {block} from '../utils/cn'; + +import './Portal.scss'; + +const b = block('portal'); export interface PortalProps { container?: HTMLElement; @@ -19,5 +25,12 @@ export function Portal({container, children, disablePortal}: PortalProps) { return {children}; } - return containerNode ? ReactDOM.createPortal(children, containerNode) : null; + return containerNode + ? ReactDOM.createPortal( + + {children} + , + containerNode, + ) + : null; } diff --git a/src/components/theme/ThemeProvider.tsx b/src/components/theme/ThemeProvider.tsx index 5fc22bc764..75fe5a51fe 100644 --- a/src/components/theme/ThemeProvider.tsx +++ b/src/components/theme/ThemeProvider.tsx @@ -97,11 +97,7 @@ export function ThemeProvider({ }, rootClassName, )} - dir={ - hasParentProvider && direction === parentDirection - ? undefined - : direction - } + dir={direction} > {children} diff --git a/src/components/theme/__stories__/Theme.stories.tsx b/src/components/theme/__stories__/Theme.stories.tsx index 38cd6ed0ac..98542d3e93 100644 --- a/src/components/theme/__stories__/Theme.stories.tsx +++ b/src/components/theme/__stories__/Theme.stories.tsx @@ -3,7 +3,9 @@ import React from 'react'; import type {Meta, StoryObj} from '@storybook/react'; import {Button} from '../../Button'; +import {Dialog} from '../../Dialog'; import {Text} from '../../Text'; +import {Tooltip} from '../../Tooltip'; import {ThemeProvider} from '../ThemeProvider'; import {useDirection} from '../useDirection'; @@ -38,9 +40,20 @@ export default meta; type Story = StoryObj; function ScopedComponent() { + const [open, setOpen] = React.useState(false); return ( - - {`current direction: ${useDirection()}`} + + + { + setOpen(!open); + }} + >{`current direction: ${useDirection()}`} + + setOpen(false)}> + + Dialog.Body + ); }