@vaadin/dialog
Advanced tools
Comparing version 23.1.0-alpha1 to 23.1.0-alpha2
{ | ||
"name": "@vaadin/dialog", | ||
"version": "23.1.0-alpha1", | ||
"version": "23.1.0-alpha2", | ||
"publishConfig": { | ||
@@ -38,16 +38,16 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/component-base": "23.1.0-alpha1", | ||
"@vaadin/vaadin-lumo-styles": "23.1.0-alpha1", | ||
"@vaadin/vaadin-material-styles": "23.1.0-alpha1", | ||
"@vaadin/vaadin-overlay": "23.1.0-alpha1", | ||
"@vaadin/vaadin-themable-mixin": "23.1.0-alpha1" | ||
"@vaadin/component-base": "23.1.0-alpha2", | ||
"@vaadin/vaadin-lumo-styles": "23.1.0-alpha2", | ||
"@vaadin/vaadin-material-styles": "23.1.0-alpha2", | ||
"@vaadin/vaadin-overlay": "23.1.0-alpha2", | ||
"@vaadin/vaadin-themable-mixin": "23.1.0-alpha2" | ||
}, | ||
"devDependencies": { | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@vaadin/polymer-legacy-adapter": "23.1.0-alpha1", | ||
"@vaadin/polymer-legacy-adapter": "23.1.0-alpha2", | ||
"@vaadin/testing-helpers": "^0.3.2", | ||
"@vaadin/text-area": "23.1.0-alpha1", | ||
"@vaadin/text-area": "23.1.0-alpha2", | ||
"sinon": "^9.2.1" | ||
}, | ||
"gitHead": "5d0cdee069f866037c507265fafb4d0476795333" | ||
"gitHead": "6842dcb8b163d4512fae8d3d12a6559077a4aee6" | ||
} |
@@ -27,2 +27,3 @@ /** | ||
flex-grow: 1; | ||
border-radius: inherit; /* prevent child elements being drawn outside part=overlay */ | ||
} | ||
@@ -39,2 +40,8 @@ | ||
:host([resizable]) [part='title'] { | ||
cursor: move; | ||
-webkit-user-select: none; | ||
user-select: none; | ||
} | ||
.resizer { | ||
@@ -41,0 +48,0 @@ position: absolute; |
@@ -113,2 +113,3 @@ /** | ||
* `has-footer` | Set when the element has footer renderer | ||
* `overflow` | Set to `top`, `bottom`, none or both | ||
* | ||
@@ -115,0 +116,0 @@ * Note: the `theme` attribute value set on `<vaadin-dialog>` is |
@@ -18,7 +18,22 @@ /** | ||
css` | ||
/* prefixing with the element tag to avoid styling confirm-dialog header part */ | ||
header[part='header'] { | ||
/* prefixing with the element tags to avoid styling confirm-dialog header part */ | ||
header[part='header'], | ||
[part='header-content'], | ||
footer[part='footer'] { | ||
display: flex; | ||
align-items: center; | ||
flex-wrap: wrap; | ||
flex: none; | ||
pointer-events: none; | ||
z-index: 1; | ||
} | ||
:host(:is([has-title], [has-header])) ::slotted([slot='header']), | ||
::slotted([slot='header-content']), | ||
::slotted([slot='title']), | ||
:host([has-footer]) ::slotted([slot='footer']) { | ||
display: contents; | ||
pointer-events: auto; | ||
} | ||
[part='header-content'] { | ||
@@ -29,4 +44,4 @@ flex: 1; | ||
/* prefixing with the element tag to avoid styling confirm-dialog footer part */ | ||
[part='header-content'], | ||
footer[part='footer'] { | ||
display: flex; | ||
justify-content: flex-end; | ||
@@ -45,3 +60,2 @@ } | ||
:host(:is([has-title], [has-header], [has-footer])) [part='content'] { | ||
min-height: 100%; | ||
height: auto; | ||
@@ -60,4 +74,2 @@ } | ||
overflow: auto; | ||
min-height: auto; | ||
height: 100%; | ||
} | ||
@@ -157,2 +169,3 @@ } | ||
/** @protected */ | ||
ready() { | ||
@@ -163,2 +176,13 @@ super.ready(); | ||
this._titleId = `${this.constructor.is}-title-${uniqueId}`; | ||
// Update overflow attribute on resize | ||
this.__resizeObserver = new ResizeObserver(() => { | ||
this.__updateOverflow(); | ||
}); | ||
this.__resizeObserver.observe(this.$.resizerContainer); | ||
// Update overflow attribute on scroll | ||
this.$.content.addEventListener('scroll', () => { | ||
this.__updateOverflow(); | ||
}); | ||
} | ||
@@ -205,2 +229,6 @@ | ||
// Set attributes here to update styles before detecting content overflow | ||
this.toggleAttribute('has-header', !!headerRenderer); | ||
this.toggleAttribute('has-footer', !!footerRenderer); | ||
if (headerRendererChanged) { | ||
@@ -212,2 +240,3 @@ if (headerRenderer) { | ||
this.headerContainer = null; | ||
this.__updateOverflow(); | ||
} | ||
@@ -222,2 +251,3 @@ } | ||
this.footerContainer = null; | ||
this.__updateOverflow(); | ||
} | ||
@@ -234,5 +264,2 @@ } | ||
} | ||
this.toggleAttribute('has-header', !!headerRenderer); | ||
this.toggleAttribute('has-footer', !!footerRenderer); | ||
} | ||
@@ -242,2 +269,4 @@ | ||
_headerTitleChanged(headerTitle, opened) { | ||
this.toggleAttribute('has-title', !!headerTitle); | ||
if (opened && (headerTitle || this._oldHeaderTitle)) { | ||
@@ -247,3 +276,2 @@ this.requestContentUpdate(); | ||
this._oldHeaderTitle = headerTitle; | ||
this.toggleAttribute('has-title', !!headerTitle); | ||
} | ||
@@ -274,20 +302,29 @@ | ||
// If a new renderer has been set, make sure to reattach the header/footer roots | ||
if (this.headerContainer && !this.headerContainer.parentElement) { | ||
this.appendChild(this.headerContainer); | ||
} | ||
if (this.headerContainer) { | ||
// If a new renderer has been set, make sure to reattach the container | ||
if (!this.headerContainer.parentElement) { | ||
this.appendChild(this.headerContainer); | ||
} | ||
if (this.footerContainer && !this.footerContainer.parentElement) { | ||
this.appendChild(this.footerContainer); | ||
if (this.headerRenderer) { | ||
// Only call header renderer after the container has been initialized | ||
this.headerRenderer.call(this.owner, this.headerContainer, this.owner); | ||
} | ||
} | ||
if (this.headerRenderer) { | ||
this.headerRenderer.call(this.owner, this.headerContainer, this.owner); | ||
} | ||
if (this.footerContainer) { | ||
// If a new renderer has been set, make sure to reattach the container | ||
if (!this.footerContainer.parentElement) { | ||
this.appendChild(this.footerContainer); | ||
} | ||
if (this.footerRenderer) { | ||
this.footerRenderer.call(this.owner, this.footerContainer, this.owner); | ||
if (this.footerRenderer) { | ||
// Only call header renderer after the container has been initialized | ||
this.footerRenderer.call(this.owner, this.footerContainer, this.owner); | ||
} | ||
} | ||
this._headerTitleRenderer(); | ||
this.__updateOverflow(); | ||
} | ||
@@ -347,2 +384,28 @@ | ||
} | ||
/** @private */ | ||
__updateOverflow() { | ||
let overflow = ''; | ||
// Only set "overflow" attribute if the dialog has a header, title or footer. | ||
// Check for state attributes as extending components might not use renderers. | ||
if (this.hasAttribute('has-header') || this.hasAttribute('has-footer') || this.headerTitle) { | ||
const content = this.$.content; | ||
if (content.scrollTop > 0) { | ||
overflow += ' top'; | ||
} | ||
if (content.scrollTop < content.scrollHeight - content.clientHeight) { | ||
overflow += ' bottom'; | ||
} | ||
} | ||
const value = overflow.trim(); | ||
if (value.length > 0 && this.getAttribute('overflow') !== value) { | ||
this.setAttribute('overflow', value); | ||
} else if (value.length === 0 && this.hasAttribute('overflow')) { | ||
this.removeAttribute('overflow'); | ||
} | ||
} | ||
} | ||
@@ -403,2 +466,3 @@ | ||
* `has-footer` | Set when the element has footer renderer | ||
* `overflow` | Set to `top`, `bottom`, none or both | ||
* | ||
@@ -585,4 +649,15 @@ * Note: the `theme` attribute value set on `<vaadin-dialog>` is | ||
/** @protected */ | ||
connectedCallback() { | ||
super.connectedCallback(); | ||
// Restore opened state if overlay was opened when disconnecting | ||
if (this.__restoreOpened) { | ||
this.opened = true; | ||
} | ||
} | ||
/** @protected */ | ||
disconnectedCallback() { | ||
super.disconnectedCallback(); | ||
// Close overlay and memorize opened state | ||
this.__restoreOpened = this.opened; | ||
this.opened = false; | ||
@@ -589,0 +664,0 @@ } |
@@ -30,17 +30,36 @@ import '@vaadin/vaadin-lumo-styles/spacing.js'; | ||
[part='header'] { | ||
gap: var(--lumo-space-s); | ||
:host(:is([has-header], [has-title])) [part='header'] + [part='content'] { | ||
padding-top: 0; | ||
} | ||
:host([has-header]) [part='header'], | ||
:host([has-title]) [part='header'] { | ||
padding: var(--lumo-space-m) var(--lumo-space-l); | ||
border-bottom: 1px solid var(--lumo-contrast-10pct); | ||
:host(:is([has-header], [has-title])) [part='header'], | ||
:host([has-header]) [part='header-content'], | ||
:host([has-footer]) [part='footer'] { | ||
gap: var(--lumo-space-xs) var(--lumo-space-s); | ||
line-height: var(--lumo-line-height-s); | ||
} | ||
:host(:is([has-header], [has-title])) [part='header'] { | ||
padding: var(--lumo-space-s) var(--lumo-space-m); | ||
min-height: var(--lumo-size-xl); | ||
box-sizing: border-box; | ||
background-color: var(--lumo-base-color); | ||
border-radius: var(--lumo-border-radius-l) var(--lumo-border-radius-l) 0 0; /* Needed for Safari */ | ||
} | ||
:host([has-footer]) [part='footer'] { | ||
padding: var(--lumo-space-s) var(--lumo-space-m); | ||
border-top: 1px solid var(--lumo-contrast-10pct); | ||
min-height: var(--lumo-size-l); | ||
box-sizing: border-box; | ||
background-color: var(--lumo-contrast-5pct); | ||
border-radius: 0 0 var(--lumo-border-radius-l) var(--lumo-border-radius-l); /* Needed for Safari */ | ||
} | ||
[part='title'] { | ||
font-size: var(--lumo-font-size-xl); | ||
font-weight: 600; | ||
color: var(--lumo-header-text-color); | ||
margin-inline-start: calc(var(--lumo-space-l) - var(--lumo-space-m)); | ||
} | ||
/* No padding */ | ||
@@ -51,4 +70,3 @@ :host([theme~='no-padding']) [part='content'] { | ||
:host([theme~='no-padding'][has-header]) [part='header'], | ||
:host([theme~='no-padding'][has-title]) [part='header'] { | ||
:host([theme~='no-padding']:is([has-header], [has-title])) [part='header'] { | ||
padding: 0; | ||
@@ -61,2 +79,8 @@ } | ||
@media (min-height: 320px) { | ||
:host(:is([has-header], [has-title])[overflow~='top']) [part='header'] { | ||
box-shadow: 0 1px 0 0 var(--lumo-contrast-10pct); | ||
} | ||
} | ||
/* Animations */ | ||
@@ -63,0 +87,0 @@ |
@@ -19,15 +19,37 @@ import '@vaadin/vaadin-material-styles/shadow.js'; | ||
:host([has-header]) [part='header'], | ||
:host([has-title]) [part='header'] { | ||
padding: 9px 24px; | ||
font-weight: 500; | ||
:host(:is([has-header], [has-title])) [part='header'] { | ||
padding: 16px; | ||
} | ||
:host(:is([has-header], [has-title])) [part='header'] + [part='content'] { | ||
padding-top: 0; | ||
} | ||
:host(:is([has-header], [has-title])) [part='header'], | ||
:host([has-header]) [part='header-content'], | ||
:host([has-footer]) [part='footer'] { | ||
gap: 8px; | ||
border-bottom: 1px solid var(--material-divider-color); | ||
line-height: 1.2; | ||
} | ||
[part='title'] { | ||
font-size: var(--material-h5-font-size); | ||
font-weight: 500; | ||
margin-inline-start: 8px; | ||
} | ||
:host([has-footer]) [part='footer'] { | ||
padding: 8px; | ||
border-top: 1px solid var(--material-divider-color); | ||
} | ||
@media (min-height: 320px) { | ||
:host(:is([has-header], [has-title])[overflow~='top']) [part='header'] { | ||
box-shadow: 0 1px 0 0 var(--material-divider-color); | ||
} | ||
:host([has-footer][overflow~='bottom']) [part='footer'] { | ||
box-shadow: 0 -1px 0 0 var(--material-divider-color); | ||
} | ||
} | ||
/* No padding */ | ||
@@ -34,0 +56,0 @@ :host([theme~='no-padding']) [part='content'] { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63339
1386
+ Added@vaadin/component-base@23.1.0-alpha2(transitive)
+ Added@vaadin/icon@23.1.0-alpha2(transitive)
+ Added@vaadin/vaadin-lumo-styles@23.1.0-alpha2(transitive)
+ Added@vaadin/vaadin-material-styles@23.1.0-alpha2(transitive)
+ Added@vaadin/vaadin-overlay@23.1.0-alpha2(transitive)
+ Added@vaadin/vaadin-themable-mixin@23.1.0-alpha2(transitive)
- Removed@vaadin/component-base@23.1.0-alpha1(transitive)
- Removed@vaadin/icon@23.1.0-alpha1(transitive)
- Removed@vaadin/vaadin-lumo-styles@23.1.0-alpha1(transitive)
- Removed@vaadin/vaadin-material-styles@23.1.0-alpha1(transitive)
- Removed@vaadin/vaadin-overlay@23.1.0-alpha1(transitive)
- Removed@vaadin/vaadin-themable-mixin@23.1.0-alpha1(transitive)