diff --git a/webapp/packages/core-blocks/src/Fill.m.css b/webapp/packages/core-blocks/src/Fill.m.css new file mode 100644 index 0000000000..d023b7abd3 --- /dev/null +++ b/webapp/packages/core-blocks/src/Fill.m.css @@ -0,0 +1,3 @@ +.fill { + flex: 1; +} diff --git a/webapp/packages/core-blocks/src/Fill.tsx b/webapp/packages/core-blocks/src/Fill.tsx new file mode 100644 index 0000000000..ff6837a52b --- /dev/null +++ b/webapp/packages/core-blocks/src/Fill.tsx @@ -0,0 +1,19 @@ +/* + * CloudBeaver - Cloud Database Manager + * Copyright (C) 2020-2023 DBeaver Corp and others + * + * Licensed under the Apache License, Version 2.0. + * you may not use this file except in compliance with the License. + */ +import style from './Fill.m.css'; +import { s } from './s'; +import { useS } from './useS'; + +interface Props { + className?: string; +} + +export const Fill: React.FC = function Fill({ className }) { + const styles = useS(style); + return
; +}; diff --git a/webapp/packages/core-blocks/src/index.ts b/webapp/packages/core-blocks/src/index.ts index dece735ae4..c84e73ef53 100644 --- a/webapp/packages/core-blocks/src/index.ts +++ b/webapp/packages/core-blocks/src/index.ts @@ -119,6 +119,7 @@ export * from './FormControls/Checkboxes/useCheckboxState'; export * from './FormControls/BASE_DROPDOWN_STYLES'; export * from './FormControls/FormBox'; export * from './FormControls/Filter'; +export * from './Fill'; export * from './Containers/Container'; export * from './Containers/Group'; diff --git a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogBody.m.css b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogBody.m.css new file mode 100644 index 0000000000..d8544a0497 --- /dev/null +++ b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogBody.m.css @@ -0,0 +1,61 @@ +.body { + flex: 1; + box-sizing: content-box; + display: flex; + max-height: 100%; + overflow: auto; + padding-top: 0px; + padding-right: 0px; + flex-shrink: 0; + padding: 24px; + + &.noBodyPadding { + padding: 0px; + } + + padding-top: 0px; + padding-right: 0px; + + &.noBodyPadding + footer { + padding-top: 24px; + } + + &.noBodyPadding .dialogBodyOverflowBox { + padding-right: 0px; + } + + &.noOverflow .dialogBodyContent { + overflow: auto; + } +} + +.dialogBodyOverflow { + composes: branding-overflow from global; + position: sticky; + bottom: 0; + left: 0; + flex-shrink: 0; + width: 100%; + height: 24px; + pointer-events: none; +} + +.dialogBodyOverflowBox { + position: relative; + flex: 1; + box-sizing: border-box; + display: flex; + flex-direction: column; + overflow: auto; + word-break: break-word; + white-space: pre-wrap; + padding-right: 24px; +} + +.dialogBodyContent { + flex: 1; + position: relative; + display: flex; + flex-direction: column; + box-sizing: border-box; +} diff --git a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogBody.tsx b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogBody.tsx index 178275a055..c083e86d3e 100644 --- a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogBody.tsx +++ b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogBody.tsx @@ -6,13 +6,11 @@ * you may not use this file except in compliance with the License. */ import { observer } from 'mobx-react-lite'; -import styled, { use } from 'reshadow'; -import { useStyles } from '@cloudbeaver/core-blocks'; +import { s, useS } from '@cloudbeaver/core-blocks'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; -import { dialogStyles } from '../styles'; -import { commonDialogBaseStyle, commonDialogThemeStyle } from './styles'; +import styles from './CommonDialogBody.m.css'; interface Props { noBodyPadding?: boolean; @@ -23,12 +21,14 @@ interface Props { } export const CommonDialogBody = observer(function CommonDialogBody({ noBodyPadding, noOverflow, className, children, style }) { - return styled(useStyles(commonDialogThemeStyle, commonDialogBaseStyle, dialogStyles, style))( - - - {children} - {!noOverflow && } - - , + const computedStyles = useS(styles, style); + + return ( +
+
+
{children}
+ {!noOverflow &&
} +
+
); }); diff --git a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogFooter.m.css b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogFooter.m.css new file mode 100644 index 0000000000..8ef2b4237b --- /dev/null +++ b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogFooter.m.css @@ -0,0 +1,11 @@ +.footer { + flex-shrink: 0; + padding: 0 24px 24px 24px; + display: flex; + z-index: 0; + box-sizing: border-box; + + &:empty { + display: none; + } +} diff --git a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogFooter.tsx b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogFooter.tsx index ca7c9a0cd0..73a3c83406 100644 --- a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogFooter.tsx +++ b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogFooter.tsx @@ -6,13 +6,11 @@ * you may not use this file except in compliance with the License. */ import { observer } from 'mobx-react-lite'; -import styled from 'reshadow'; -import { useStyles } from '@cloudbeaver/core-blocks'; +import { s, useS } from '@cloudbeaver/core-blocks'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; -import { dialogStyles } from '../styles'; -import { commonDialogBaseStyle, commonDialogThemeStyle } from './styles'; +import styles from './CommonDialogFooter.m.css'; interface Props { className?: string; @@ -21,5 +19,7 @@ interface Props { } export const CommonDialogFooter = observer(function CommonDialogFooter({ children, className, style }) { - return styled(useStyles(commonDialogThemeStyle, commonDialogBaseStyle, dialogStyles, style))(
{children}
); + const computedStyles = useS(styles, style); + + return
{children}
; }); diff --git a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogHeader.m.css b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogHeader.m.css new file mode 100644 index 0000000000..2be5ec8633 --- /dev/null +++ b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogHeader.m.css @@ -0,0 +1,58 @@ +.header { + position: relative; + display: grid; + grid-template-columns: max-content 1fr; + flex-shrink: 0; + padding: 24px; + + &.noPadding { + padding: 0px; + } +} + +.headerTitleContainer { + display: flex; + align-items: center; + justify-content: space-between; + position: relative; + min-height: 24px; + overflow: hidden; +} + +.headerTitle { + margin: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.iconContainer { + display: flex; + align-items: center; + justify-content: center; +} + +.icon { + width: 24px; + height: 24px; + margin-right: 16px; + &.bigIcon { + width: 40px; + height: 40px; + } +} + +.subTitle { + composes: theme-typography--caption from global; + grid-column: 2; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.reject { + cursor: pointer; + width: 18px; + height: 18px; + flex-shrink: 0; +} diff --git a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogHeader.tsx b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogHeader.tsx index 94276b6554..347ada1ff2 100644 --- a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogHeader.tsx +++ b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogHeader.tsx @@ -6,13 +6,11 @@ * you may not use this file except in compliance with the License. */ import { observer } from 'mobx-react-lite'; -import styled, { use } from 'reshadow'; -import { Icon, IconOrImage, useStyles, useTranslate } from '@cloudbeaver/core-blocks'; +import { Icon, IconOrImage, s, useS, useTranslate } from '@cloudbeaver/core-blocks'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; -import { dialogStyles } from '../styles'; -import { commonDialogBaseStyle, commonDialogThemeStyle } from './styles'; +import styles from './CommonDialogHeader.m.css'; interface Props { title?: string; @@ -38,19 +36,22 @@ export const CommonDialogHeader = observer(function CommonDialogHeader({ style, }) { const translate = useTranslate(); + const computedStyles = useS(styles, style); - return styled(useStyles(commonDialogThemeStyle, commonDialogBaseStyle, dialogStyles, style))( -
- {icon && } - -

{translate(title)}

+ return ( +
+
+ {icon && } +
+
+

{translate(title)}

{onReject && ( - +
- +
)} - - {subTitle && {typeof subTitle === 'string' ? translate(subTitle) : subTitle}} -
, +
+ {subTitle &&
{typeof subTitle === 'string' ? translate(subTitle) : subTitle}
} + ); }); diff --git a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogWrapper.m.css b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogWrapper.m.css new file mode 100644 index 0000000000..9cfc79c109 --- /dev/null +++ b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogWrapper.m.css @@ -0,0 +1,64 @@ +.container { + box-sizing: border-box; + display: flex; + outline: none; +} + +.dialog { + composes: theme-background-surface theme-text-on-surface theme-elevation-z10 from global; + border-radius: 0.25rem; + display: flex; + flex-direction: column; + position: relative; + overflow: hidden; + margin: 0; + border: none; + height: auto; + max-height: 100%; + max-width: 748px; + padding: 0px; + + &.small { + min-width: 404px; + min-height: 262px; + max-height: max(100vh - 48px, 262px); + + &.fixedSize { + width: 404px; + height: 262px; + } + &.fixedWidth { + width: 404px; + } + } + &.medium { + min-width: 576px; + min-height: 374px; + max-height: max(100vh - 48px, 374px); + + &.fixedSize { + width: 576px; + height: 374px; + } + &.fixedWidth { + width: 576px; + } + } + &.large { + min-width: 720px; + min-height: 468px; + max-height: max(100vh - 48px, 468px); + + &.fixedSize { + width: 720px; + height: 468px; + } + &.fixedWidth { + width: 720px; + } + } +} + +.loader { + height: 100%; +} diff --git a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogWrapper.tsx b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogWrapper.tsx index 194f3ec171..beeb8ec6fe 100644 --- a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogWrapper.tsx +++ b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/CommonDialogWrapper.tsx @@ -8,14 +8,12 @@ import { observer } from 'mobx-react-lite'; import { forwardRef, useContext, useEffect } from 'react'; import { Dialog, useDialogState } from 'reakit/Dialog'; -import styled, { use } from 'reshadow'; -import { Loader, useStyles } from '@cloudbeaver/core-blocks'; +import { Loader, s, useS } from '@cloudbeaver/core-blocks'; import type { ComponentStyle } from '@cloudbeaver/core-theming'; import { DialogContext } from '../DialogContext'; -import { dialogStyles } from '../styles'; -import { commonDialogBaseStyle, commonDialogThemeStyle } from './styles'; +import styles from './CommonDialogWrapper.m.css'; export interface CommonDialogWrapperProps { size?: 'small' | 'medium' | 'large'; @@ -29,6 +27,7 @@ export interface CommonDialogWrapperProps { export const CommonDialogWrapper = observer( forwardRef(function CommonDialogWrapper({ size = 'medium', fixedSize, fixedWidth, 'aria-label': ariaLabel, className, children, style }, ref) { + const computedStyles = useS(styles, style); const context = useContext(DialogContext); const dialogState = useDialogState({ visible: true }); @@ -38,12 +37,28 @@ export const CommonDialogWrapper = observer - - {children} + return ( + + + + {children} + - , + ); }), ); diff --git a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/styles.ts b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/styles.ts deleted file mode 100644 index 4a6f3cc023..0000000000 --- a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/styles.ts +++ /dev/null @@ -1,210 +0,0 @@ -/* - * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2023 DBeaver Corp and others - * - * Licensed under the Apache License, Version 2.0. - * you may not use this file except in compliance with the License. - */ -import { css } from 'reshadow'; - -import type { ThemeSelector } from '@cloudbeaver/core-theming'; - -export const commonDialogThemeStyle: ThemeSelector = async theme => { - let styles: any; - - switch (theme) { - case 'dark': - styles = await import('./themes/dark.module.scss'); - break; - default: - styles = await import('./themes/light.module.scss'); - break; - } - - return [styles.default]; -}; - -export const commonDialogContainerStyles = css` - error, - dialog { - composes: theme-background-surface theme-text-on-surface theme-elevation-z10 from global; - border-radius: 0.25rem; - } -`; - -export const commonDialogBaseStyle = [ - commonDialogContainerStyles, - css` - dialog { - display: flex; - flex-direction: column; - position: relative; - overflow: hidden; - margin: 0; - border: none; - height: auto; - max-height: 100%; - max-width: 748px; - padding: 0px; - - &[|size='small'] { - min-width: 404px; - min-height: 262px; - max-height: max(100vh - 48px, 262px); - - &[|fixedSize] { - width: 404px; - height: 262px; - } - &[|fixedWidth] { - width: 404px; - } - } - &[|size='medium'] { - min-width: 576px; - min-height: 374px; - max-height: max(100vh - 48px, 374px); - - &[|fixedSize] { - width: 576px; - height: 374px; - } - &[|fixedWidth] { - width: 576px; - } - } - &[|size='large'] { - min-width: 720px; - min-height: 468px; - max-height: max(100vh - 48px, 468px); - - &[|fixedSize] { - width: 720px; - height: 468px; - } - &[|fixedWidth] { - width: 720px; - } - } - } - header, - dialog-body, - footer { - flex-shrink: 0; - padding: 24px; - - &[|no-padding] { - padding: 0px; - } - } - dialog-body { - padding-top: 0px; - padding-right: 0px; - } - footer { - padding-top: 0px; - } - header { - position: relative; - display: grid; - grid-template-columns: max-content 1fr; - } - header-title { - display: flex; - align-items: center; - justify-content: space-between; - position: relative; - min-height: 24px; - overflow: hidden; - } - icon-container { - display: flex; - align-items: center; - justify-content: center; - } - IconOrImage { - width: 24px; - height: 24px; - margin-right: 16px; - &[|bigIcon] { - width: 40px; - height: 40px; - } - } - dialog-body { - flex: 1; - box-sizing: content-box; - display: flex; - max-height: 100%; - overflow: auto; - } - dialog-body-overflow-box { - position: relative; - flex: 1; - box-sizing: border-box; - display: flex; - flex-direction: column; - overflow: auto; - word-break: break-word; - white-space: pre-wrap; - padding-right: 24px; - } - dialog-body-content { - flex: 1; - position: relative; - display: flex; - flex-direction: column; - box-sizing: border-box; - } - Loader { - height: 100%; - } - dialog-body[|no-padding] + footer { - padding-top: 24px; - } - dialog-body[|no-padding] dialog-body-overflow-box { - padding-right: 0; - } - dialog-body[|no-overflow] dialog-body-content { - overflow: auto; - } - dialog-body-overflow { - composes: branding-overflow from global; - position: sticky; - bottom: 0; - left: 0; - flex-shrink: 0; - width: 100%; - height: 24px; - pointer-events: none; - } - h3 { - margin: 0; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - sub-title { - composes: theme-typography--caption from global; - grid-column: 2; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - reject { - cursor: pointer; - width: 18px; - height: 18px; - flex-shrink: 0; - } - footer { - display: flex; - z-index: 0; - box-sizing: border-box; - - &:empty { - display: none; - } - } - `, -]; diff --git a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/themes/_base-common-dialog.scss b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/themes/_base-common-dialog.scss deleted file mode 100644 index 8eb478f26d..0000000000 --- a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/themes/_base-common-dialog.scss +++ /dev/null @@ -1,15 +0,0 @@ -/* - * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2023 DBeaver Corp and others - * - * Licensed under the Apache License, Version 2.0. - * you may not use this file except in compliance with the License. - */ - -@mixin base-common-dialog() { - :global(.#{$theme-class}) { - dialog-body-overflow { - background-image: linear-gradient(to top, $mdc-theme-surface, rgba($mdc-theme-surface, 0)); - } - } -} diff --git a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/themes/dark.module.scss b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/themes/dark.module.scss deleted file mode 100644 index 3e1295e285..0000000000 --- a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/themes/dark.module.scss +++ /dev/null @@ -1,12 +0,0 @@ -/* - * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2023 DBeaver Corp and others - * - * Licensed under the Apache License, Version 2.0. - * you may not use this file except in compliance with the License. - */ - -@import "@cloudbeaver/core-theming/src/styles/theme-dark"; -@import "base-common-dialog"; - -@include base-common-dialog; diff --git a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/themes/light.module.scss b/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/themes/light.module.scss deleted file mode 100644 index 10d9953980..0000000000 --- a/webapp/packages/core-dialogs/src/CommonDialog/CommonDialog/themes/light.module.scss +++ /dev/null @@ -1,12 +0,0 @@ -/* - * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2023 DBeaver Corp and others - * - * Licensed under the Apache License, Version 2.0. - * you may not use this file except in compliance with the License. - */ - -@import "@cloudbeaver/core-theming/src/styles/theme-light"; -@import "base-common-dialog"; - -@include base-common-dialog; diff --git a/webapp/packages/core-dialogs/src/CommonDialog/ConfirmationDialog.m.css b/webapp/packages/core-dialogs/src/CommonDialog/ConfirmationDialog.m.css new file mode 100644 index 0000000000..25fe6fea27 --- /dev/null +++ b/webapp/packages/core-dialogs/src/CommonDialog/ConfirmationDialog.m.css @@ -0,0 +1,4 @@ +.footer { + align-items: center; + gap: 16px; +} diff --git a/webapp/packages/core-dialogs/src/CommonDialog/ConfirmationDialog.tsx b/webapp/packages/core-dialogs/src/CommonDialog/ConfirmationDialog.tsx index 1db91e26ca..4cae3d4fb7 100644 --- a/webapp/packages/core-dialogs/src/CommonDialog/ConfirmationDialog.tsx +++ b/webapp/packages/core-dialogs/src/CommonDialog/ConfirmationDialog.tsx @@ -5,9 +5,7 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import styled, { css } from 'reshadow'; - -import { Button, Translate, useFocus, useStyles } from '@cloudbeaver/core-blocks'; +import { Button, Fill, s, Translate, useFocus, useS } from '@cloudbeaver/core-blocks'; import type { TLocalizationToken } from '@cloudbeaver/core-localization'; import { CommonDialogBody } from './CommonDialog/CommonDialogBody'; @@ -15,17 +13,7 @@ import { CommonDialogFooter } from './CommonDialog/CommonDialogFooter'; import { CommonDialogHeader } from './CommonDialog/CommonDialogHeader'; import { CommonDialogWrapper } from './CommonDialog/CommonDialogWrapper'; import type { DialogComponent, DialogueStateResult } from './CommonDialogService'; - -const style = css` - CommonDialogFooter { - align-items: center; - gap: 16px; - } - - fill { - flex: 1; - } -`; +import style from './ConfirmationDialog.m.css'; export interface ConfirmationDialogPayload { icon?: string; @@ -46,20 +34,21 @@ export const ConfirmationDialog: DialogComponent({ focusFirstChild: true }); const { icon, title, subTitle, bigIcon, viewBox, message, confirmActionText, cancelActionText } = payload; - return styled(useStyles(style))( + return ( - + - + {payload.extraStatus !== undefined && ( - , + ); }; diff --git a/webapp/packages/core-dialogs/src/CommonDialog/DialogsPortal.m.css b/webapp/packages/core-dialogs/src/CommonDialog/DialogsPortal.m.css new file mode 100644 index 0000000000..90f5ead351 --- /dev/null +++ b/webapp/packages/core-dialogs/src/CommonDialog/DialogsPortal.m.css @@ -0,0 +1,35 @@ +.loader { + height: 100%; +} + +.backdrop { + box-sizing: border-box; + background-color: rgba(0, 0, 0, 0.48); + /*backdrop-filter: blur(4px); + background-color: rgba(221, 221, 221, 0.25);*/ + position: fixed; + top: 0px; + right: 0px; + bottom: 0px; + left: 0px; + z-index: 999; + display: flex; + overflow: auto; +} + +.innerBox { + display: flex; + margin: auto; + padding: 24px; + flex-direction: column; + align-items: center; + + & > :not(:last-child) { + display: none; + } +} + +.error { + composes: theme-background-surface theme-text-on-surface theme-elevation-z10 from global; + border-radius: 0.25rem; +} diff --git a/webapp/packages/core-dialogs/src/CommonDialog/DialogsPortal.tsx b/webapp/packages/core-dialogs/src/CommonDialog/DialogsPortal.tsx index 53adecf4ae..f7b8d7c96b 100644 --- a/webapp/packages/core-dialogs/src/CommonDialog/DialogsPortal.tsx +++ b/webapp/packages/core-dialogs/src/CommonDialog/DialogsPortal.tsx @@ -8,18 +8,16 @@ import { observer } from 'mobx-react-lite'; import { useLayoutEffect, useMemo, useRef } from 'react'; import { DialogBackdrop } from 'reakit/Dialog'; -import styled from 'reshadow'; -import { ErrorBoundary, Loader, useObjectRef, useStyles } from '@cloudbeaver/core-blocks'; +import { ErrorBoundary, Loader, s, useObjectRef, useS } from '@cloudbeaver/core-blocks'; import { useService } from '@cloudbeaver/core-di'; -import { commonDialogContainerStyles } from './CommonDialog/styles'; import { CommonDialogService, DialogInternal } from './CommonDialogService'; import { DialogContext, IDialogContext } from './DialogContext'; -import { dialogStyles } from './styles'; +import style from './DialogsPortal.m.css'; export const DialogsPortal = observer(function DialogsPortal() { - const styles = useStyles(dialogStyles); + const styles = useS(style); const commonDialogService = useService(CommonDialogService); const focusedElementRef = useRef(null); @@ -81,12 +79,12 @@ export const DialogsPortal = observer(function DialogsPortal() { }; }, [activeDialog]); - return styled(styles)( - - - + return ( + + +
{commonDialogService.dialogs.map((dialog, i, arr) => ( - + ))} - +
-
, +
); }); diff --git a/webapp/packages/core-dialogs/src/CommonDialog/RenameDialog.m.css b/webapp/packages/core-dialogs/src/CommonDialog/RenameDialog.m.css new file mode 100644 index 0000000000..060df06e60 --- /dev/null +++ b/webapp/packages/core-dialogs/src/CommonDialog/RenameDialog.m.css @@ -0,0 +1,3 @@ +.footer { + align-items: center; +} diff --git a/webapp/packages/core-dialogs/src/CommonDialog/RenameDialog.tsx b/webapp/packages/core-dialogs/src/CommonDialog/RenameDialog.tsx index bc401781f8..ab2b931eff 100644 --- a/webapp/packages/core-dialogs/src/CommonDialog/RenameDialog.tsx +++ b/webapp/packages/core-dialogs/src/CommonDialog/RenameDialog.tsx @@ -8,9 +8,8 @@ import { observable } from 'mobx'; import { observer } from 'mobx-react-lite'; import { useEffect } from 'react'; -import styled, { css } from 'reshadow'; -import { Button, Container, InputField, SubmittingForm, useFocus, useObservableRef, useStyles, useTranslate } from '@cloudbeaver/core-blocks'; +import { Button, Container, Fill, InputField, s, SubmittingForm, useFocus, useObservableRef, useS, useTranslate } from '@cloudbeaver/core-blocks'; import { throttleAsync } from '@cloudbeaver/core-utils'; import { CommonDialogBody } from './CommonDialog/CommonDialogBody'; @@ -18,16 +17,7 @@ import { CommonDialogFooter } from './CommonDialog/CommonDialogFooter'; import { CommonDialogHeader } from './CommonDialog/CommonDialogHeader'; import { CommonDialogWrapper } from './CommonDialog/CommonDialogWrapper'; import type { DialogComponent } from './CommonDialogService'; - -const style = css` - CommonDialogFooter { - align-items: center; - } - - fill { - flex: 1; - } -`; +import style from './RenameDialog.m.css'; interface IRenameDialogState { value: string; @@ -59,6 +49,7 @@ export const RenameDialog: DialogComponent = observ }) { const translate = useTranslate(); const [focusedRef] = useFocus({ focusFirstChild: true }); + const styles = useS(style); const { icon, subTitle, bigIcon, viewBox, value, objectName, create, confirmActionText } = payload; let { title } = payload; @@ -102,7 +93,7 @@ export const RenameDialog: DialogComponent = observ const errorMessage = state.valid ? ' ' : translate(state.message ?? 'ui_rename_taken_or_invalid'); - return styled(useStyles(style))( + return ( @@ -114,15 +105,15 @@ export const RenameDialog: DialogComponent = observ - + - + - , + ); }); diff --git a/webapp/packages/core-dialogs/src/CommonDialog/styles.ts b/webapp/packages/core-dialogs/src/CommonDialog/styles.ts deleted file mode 100644 index 4e02b53727..0000000000 --- a/webapp/packages/core-dialogs/src/CommonDialog/styles.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CloudBeaver - Cloud Database Manager - * Copyright (C) 2020-2023 DBeaver Corp and others - * - * Licensed under the Apache License, Version 2.0. - * you may not use this file except in compliance with the License. - */ -import { css } from 'reshadow'; - -export const dialogStyles = css` - DialogBackdrop { - box-sizing: border-box; - background-color: rgba(0, 0, 0, 0.48); - /*backdrop-filter: blur(4px); - background-color: rgba(221, 221, 221, 0.25);*/ - position: fixed; - top: 0px; - right: 0px; - bottom: 0px; - left: 0px; - z-index: 999; - display: flex; - overflow: auto; - } - - inner-box { - display: flex; - margin: auto; - padding: 24px; - flex-direction: column; - align-items: center; - - & > :not(:last-child) { - display: none; - } - } - - Dialog { - box-sizing: border-box; - display: flex; - outline: none; - } -`; diff --git a/webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog.m.css b/webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog.m.css new file mode 100644 index 0000000000..a3c5c590cb --- /dev/null +++ b/webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog.m.css @@ -0,0 +1,27 @@ +.code, +.message { + display: block; + white-space: pre-wrap; +} +.textarea { + min-height: 270px !important; +} +.message { + overflow: auto; + max-height: 96px; +} +.property { + padding: 8px 16px; +} +.errorDetails { + border: solid 1px; +} +.footer { + align-items: center; + justify-content: flex-end; + gap: 24px; +} +.errorInfoContainer { + display: flex; + flex-direction: column; +} diff --git a/webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog.tsx b/webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog.tsx index dea16631ce..e1ac728334 100644 --- a/webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog.tsx +++ b/webapp/packages/core-notifications/src/NotificationsItem/ErrorDetailsDialog/ErrorDetailsDialog.tsx @@ -7,47 +7,51 @@ */ import { observer } from 'mobx-react-lite'; import { useCallback, useMemo } from 'react'; -import styled from 'reshadow'; -import { Button, Iframe, Textarea, useClipboard, useStyles, useTranslate } from '@cloudbeaver/core-blocks'; +import { Button, Iframe, s, Textarea, useClipboard, useS, useTranslate } from '@cloudbeaver/core-blocks'; import { CommonDialogBody, CommonDialogFooter, CommonDialogHeader, CommonDialogWrapper, DialogComponent } from '@cloudbeaver/core-dialogs'; +import style from './ErrorDetailsDialog.m.css'; import { ErrorModel, IErrorInfo } from './ErrorModel'; -import { styles } from './styles'; function DisplayErrorInfo({ error }: { error: IErrorInfo }) { - return styled(useStyles(styles))( + const styles = useS(style); + + return ( <> - {error.isHtml ?