-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract crud styles into reusable css literal (#8158)
- Loading branch information
1 parent
2f388cf
commit d8edaff
Showing
4 changed files
with
154 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2000 - 2024 Vaadin Ltd. | ||
* | ||
* This program is available under Vaadin Commercial License and Service Terms. | ||
* | ||
* | ||
* See https://vaadin.com/commercial-license-and-service-terms for the full | ||
* license. | ||
*/ | ||
import type { CSSResult } from 'lit'; | ||
|
||
export const crudStyles: CSSResult; | ||
|
||
export const crudDialogOverlayStyles: CSSResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/** | ||
* @license | ||
* Copyright (c) 2000 - 2024 Vaadin Ltd. | ||
* | ||
* This program is available under Vaadin Commercial License and Service Terms. | ||
* | ||
* | ||
* See https://vaadin.com/commercial-license-and-service-terms for the full | ||
* license. | ||
*/ | ||
import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
|
||
export const crudStyles = css` | ||
:host { | ||
width: 100%; | ||
height: 400px; | ||
--vaadin-crud-editor-max-height: 40%; | ||
--vaadin-crud-editor-max-width: 40%; | ||
} | ||
:host, | ||
#main { | ||
display: flex; | ||
flex-direction: column; | ||
align-self: stretch; | ||
position: relative; | ||
overflow: hidden; | ||
} | ||
#main { | ||
flex: 1 1 100%; | ||
height: 100%; | ||
} | ||
:host([hidden]), | ||
[hidden] { | ||
display: none !important; | ||
} | ||
[part='toolbar'] { | ||
display: flex; | ||
flex-shrink: 0; | ||
align-items: baseline; | ||
justify-content: flex-end; | ||
} | ||
:host([no-toolbar]) [part='toolbar'] { | ||
display: none; | ||
} | ||
#container { | ||
display: flex; | ||
height: 100%; | ||
} | ||
:host([editor-position='bottom']) #container { | ||
flex-direction: column; | ||
} | ||
[part='editor'] { | ||
z-index: 1; | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
outline: none; | ||
} | ||
:host(:not([editor-position=''])[editor-opened]:not([fullscreen])) [part='editor'] { | ||
flex: 1 0 100%; | ||
} | ||
:host([editor-position='bottom'][editor-opened]:not([fullscreen])) [part='editor'] { | ||
max-height: var(--vaadin-crud-editor-max-height); | ||
} | ||
:host([editor-position='aside'][editor-opened]:not([fullscreen])) [part='editor'] { | ||
min-width: 300px; | ||
max-width: var(--vaadin-crud-editor-max-width); | ||
} | ||
[part='scroller'] { | ||
display: flex; | ||
flex-direction: column; | ||
overflow: auto; | ||
flex: auto; | ||
} | ||
[part='footer'] { | ||
display: flex; | ||
flex: none; | ||
flex-direction: row-reverse; | ||
} | ||
`; | ||
|
||
export const crudDialogOverlayStyles = css` | ||
[part='overlay'] { | ||
max-width: 54em; | ||
min-width: 20em; | ||
} | ||
[part='footer'] { | ||
justify-content: flex-start; | ||
flex-direction: row-reverse; | ||
} | ||
/* Make buttons clickable */ | ||
[part='footer'] ::slotted(:not([disabled])) { | ||
pointer-events: all; | ||
} | ||
:host([fullscreen]) { | ||
inset: 0; | ||
padding: 0; | ||
} | ||
:host([fullscreen]) [part='overlay'] { | ||
height: 100vh; | ||
width: 100vw; | ||
border-radius: 0 !important; | ||
} | ||
:host([fullscreen]) [part='content'] { | ||
flex: 1; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters