@ctrliq/quantic-components 1.67.2 → 1.67.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { type PropertyValues } from 'lit';
1
+ import { type CSSResultGroup, type PropertyValues } from 'lit';
2
2
  import { LayoutVariant } from './index.constants';
3
3
  import { QuanticElement } from '../shared/quantic-element';
4
4
  import type { ComponentMeta } from '../shared/meta.types';
@@ -10,8 +10,6 @@ export declare class Layout extends Layout_base {
10
10
  private previousIsSmallViewport?;
11
11
  private hasSidebarSlot;
12
12
  private hasTitlebarSlot;
13
- private hasNavbarSlot;
14
- private hasLogoSlot;
15
13
  private asideElement?;
16
14
  private toggleButtonElement?;
17
15
  private focusTrap?;
@@ -28,10 +26,10 @@ export declare class Layout extends Layout_base {
28
26
  protected willUpdate(_props: PropertyValues): void;
29
27
  protected updated(props: PropertyValues): void;
30
28
  static styles: import("lit").CSSResult;
29
+ static finalizeStyles(styles?: CSSResultGroup): import("lit").CSSResultOrNative[];
31
30
  private get isAsideCollapsible();
32
31
  private get hasSidebar();
33
32
  private get hasTitlebar();
34
- private get hasHeader();
35
33
  render(): import("lit").TemplateResult;
36
34
  }
37
35
  export {};
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { css } from 'lit';
7
+ import { css, unsafeCSS } from 'lit';
8
8
  import { query, state } from 'lit/decorators.js';
9
9
  import { html } from 'lit/static-html.js';
10
10
  import { classMap } from 'lit/directives/class-map.js';
@@ -27,8 +27,6 @@ let Layout = class Layout extends AutoHideEmptySlotsMixin(QuanticElement, ['logo
27
27
  this.variant = LayoutVariant.Default;
28
28
  this.hasSidebarSlot = false;
29
29
  this.hasTitlebarSlot = false;
30
- this.hasNavbarSlot = false;
31
- this.hasLogoSlot = false;
32
30
  this._isAsideExpanded = true;
33
31
  this.handleAsideExpand = (event) => {
34
32
  this.isAsideExpanded = event.detail.expanded;
@@ -116,6 +114,24 @@ let Layout = class Layout extends AutoHideEmptySlotsMixin(QuanticElement, ['logo
116
114
  }
117
115
  this.previousIsSmallViewport = this.isSmallViewport;
118
116
  }
117
+ static finalizeStyles(styles) {
118
+ const base = super.finalizeStyles(styles) ?? [];
119
+ return [
120
+ ...base,
121
+ unsafeCSS(`@layer quantic-header-visibility {
122
+ .header { display: none; }
123
+ .header.collapsible,
124
+ :host(:has([slot="navbar"])) .header,
125
+ :host(:has([slot="titlebar"])) .header,
126
+ :host(:has([slot="logo"])) .header { display: revert-layer; }
127
+ @scope {
128
+ :scope:has([slot="navbar"]) .header,
129
+ :scope:has([slot="titlebar"]) .header,
130
+ :scope:has([slot="logo"]) .header { display: revert-layer; }
131
+ }
132
+ }`),
133
+ ];
134
+ }
119
135
  get isAsideCollapsible() {
120
136
  return this.isSmallViewport && this.hasSidebar;
121
137
  }
@@ -125,12 +141,6 @@ let Layout = class Layout extends AutoHideEmptySlotsMixin(QuanticElement, ['logo
125
141
  get hasTitlebar() {
126
142
  return this.hasTitlebarSlot;
127
143
  }
128
- get hasHeader() {
129
- return (this.isAsideCollapsible ||
130
- this.hasTitlebarSlot ||
131
- this.hasNavbarSlot ||
132
- this.hasLogoSlot);
133
- }
134
144
  render() {
135
145
  const toggleButton = html `<quantic-button
136
146
  class="toggle-button"
@@ -146,7 +156,6 @@ let Layout = class Layout extends AutoHideEmptySlotsMixin(QuanticElement, ['logo
146
156
  const logo = html `<slot
147
157
  name="logo"
148
158
  class="logo"
149
- @slotchange=${onSlotChange((has) => (this.hasLogoSlot = has))}
150
159
  ></slot>`;
151
160
  const titlebar = html `<slot
152
161
  class="titlebar"
@@ -163,14 +172,13 @@ let Layout = class Layout extends AutoHideEmptySlotsMixin(QuanticElement, ['logo
163
172
  })}
164
173
  @expanded-changed=${this.handleAsideExpand}
165
174
  >
166
- <header class="header" ?hidden=${!this.hasHeader}>
175
+ <header class=${classMap({ header: true, collapsible: this.isAsideCollapsible })}>
167
176
  ${!this.hasSidebar ? logo : null}
168
177
  ${this.isAsideCollapsible ? toggleButton : null}
169
178
  ${this.isSmallViewport ? null : titlebar}
170
179
  <slot
171
180
  class="navbar"
172
181
  name="navbar"
173
- @slotchange=${onSlotChange((has) => (this.hasNavbarSlot = has))}
174
182
  ></slot>
175
183
  </header>
176
184
 
@@ -183,7 +191,6 @@ let Layout = class Layout extends AutoHideEmptySlotsMixin(QuanticElement, ['logo
183
191
 
184
192
  <div
185
193
  class="aside-backdrop"
186
- ?hidden=${!this.hasSidebar}
187
194
  aria-hidden="true"
188
195
  @click=${this.toggleAsideExpanded}
189
196
  ></div>
@@ -374,7 +381,7 @@ Layout.styles = css `
374
381
  opacity: 0;
375
382
  }
376
383
 
377
- .is-aside-expanded .aside-backdrop {
384
+ .has-sidebar.is-aside-expanded .aside-backdrop {
378
385
  display: block;
379
386
  pointer-events: auto;
380
387
  opacity: var(--quantic-component-layout-aside-backdrop-opacity);
@@ -399,8 +406,6 @@ Layout.styles = css `
399
406
 
400
407
  .header {
401
408
  grid-area: header;
402
- display: flex;
403
- align-items: center;
404
409
  }
405
410
 
406
411
  .logo {
@@ -427,7 +432,7 @@ Layout.styles = css `
427
432
  pointer-events: auto;
428
433
  }
429
434
 
430
- .is-aside-expanded .aside-backdrop {
435
+ .has-sidebar.is-aside-expanded .aside-backdrop {
431
436
  display: none;
432
437
  }
433
438
 
@@ -490,12 +495,6 @@ __decorate([
490
495
  __decorate([
491
496
  state()
492
497
  ], Layout.prototype, "hasTitlebarSlot", void 0);
493
- __decorate([
494
- state()
495
- ], Layout.prototype, "hasNavbarSlot", void 0);
496
- __decorate([
497
- state()
498
- ], Layout.prototype, "hasLogoSlot", void 0);
499
498
  __decorate([
500
499
  query('.aside')
501
500
  ], Layout.prototype, "asideElement", void 0);