From b5739a4ca0c84ffcbfcc595f16e8999b6ac643ac Mon Sep 17 00:00:00 2001 From: Vlad Babich Date: Fri, 26 Jul 2024 15:10:10 -0600 Subject: [PATCH 1/2] fix: DH-17454: Combine modal classes instead of replacing (#2173) --- packages/components/src/modal/Modal.tsx | 4 ++-- packages/components/src/modal/ModalBody.tsx | 9 +++++++-- packages/components/src/modal/ModalFooter.tsx | 8 ++++++-- packages/components/src/modal/ModalHeader.tsx | 3 ++- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/packages/components/src/modal/Modal.tsx b/packages/components/src/modal/Modal.tsx index 0cc86fc61..710b2d43a 100644 --- a/packages/components/src/modal/Modal.tsx +++ b/packages/components/src/modal/Modal.tsx @@ -25,7 +25,7 @@ interface ModalProps { } function Modal({ - className = '', + className, children, role = 'role', keyboard = true, @@ -153,7 +153,7 @@ function Modal({ style={{ display: 'block' }} >
+
{children}
); diff --git a/packages/components/src/modal/ModalFooter.tsx b/packages/components/src/modal/ModalFooter.tsx index 3c6a7ee2f..8a20be419 100644 --- a/packages/components/src/modal/ModalFooter.tsx +++ b/packages/components/src/modal/ModalFooter.tsx @@ -1,4 +1,5 @@ import React, { ReactElement, ReactNode } from 'react'; +import classNames from 'classnames'; interface ModalFooterProps { className?: string; @@ -7,12 +8,15 @@ interface ModalFooterProps { } function ModalFooter({ - className = 'modal-footer', + className, children, 'data-testid': dataTestId, }: ModalFooterProps): ReactElement { return ( -
+
{children}
); diff --git a/packages/components/src/modal/ModalHeader.tsx b/packages/components/src/modal/ModalHeader.tsx index f9ea6c5f1..0e8b5602d 100644 --- a/packages/components/src/modal/ModalHeader.tsx +++ b/packages/components/src/modal/ModalHeader.tsx @@ -1,4 +1,5 @@ import React, { CSSProperties, ReactElement, ReactNode } from 'react'; +import classNames from 'classnames'; interface ModalHeaderProps { className?: string; @@ -18,7 +19,7 @@ function ModalHeader({ 'data-testid': dataTestId, }: ModalHeaderProps): ReactElement { return ( -
+
{children}
{closeButton && (
- , + , element.current ) : null; diff --git a/packages/components/src/theme/SpectrumThemeProvider.tsx b/packages/components/src/theme/SpectrumThemeProvider.tsx index 7998643a2..a127a1cd5 100644 --- a/packages/components/src/theme/SpectrumThemeProvider.tsx +++ b/packages/components/src/theme/SpectrumThemeProvider.tsx @@ -9,6 +9,8 @@ export interface SpectrumThemeProviderProps { isPortal?: boolean; theme?: Theme; colorScheme?: 'light' | 'dark'; + zIndex?: number; + position?: 'static' | 'absolute' | 'fixed' | 'relative' | 'sticky'; } /** @@ -23,6 +25,8 @@ export function SpectrumThemeProvider({ isPortal = false, theme = themeDHDefault, colorScheme, + zIndex, + position, }: SpectrumThemeProviderProps): JSX.Element { // a unique ID is used per provider to force it to render the theme wrapper element inside portals // based on https://github.com/adobe/react-spectrum/issues/1697#issuecomment-999827266 @@ -34,6 +38,8 @@ export function SpectrumThemeProvider({ UNSAFE_className="spectrum-theme-provider" theme={theme} colorScheme={colorScheme} + zIndex={zIndex} + position={position} data-unique-id={id} > {children}