@ctrliq/quantic-components 1.67.3 → 1.67.5

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.
@@ -5,10 +5,9 @@ export declare class InlineEdit extends QuanticElement {
5
5
  label: string;
6
6
  active: boolean;
7
7
  invalid: boolean;
8
- private hasLabelSlot;
9
8
  connectedCallback(): void;
10
9
  disconnectedCallback(): void;
11
- static styles: import("lit").CSSResult;
10
+ static styles: import("lit").CSSResult[];
12
11
  private activate;
13
12
  private deactivate;
14
13
  private handleActivateClick;
@@ -5,9 +5,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  import { css, html } from 'lit';
8
- import { state } from 'lit/decorators.js';
9
8
  import { quanticElement, QuanticElement } from '../shared/quantic-element';
10
- import { onSlotChange } from '../shared/slot-utils';
9
+ import { whenSlotPresent } from '../shared/slot-utils';
11
10
  import { IconSize } from '../icon/index.constants';
12
11
  import { LucideIconPencil } from '../icon/__generated__/lucide/pencil';
13
12
  import { classMap } from 'lit/directives/class-map.js';
@@ -19,7 +18,6 @@ let InlineEdit = class InlineEdit extends QuanticElement {
19
18
  this.label = '';
20
19
  this.active = false;
21
20
  this.invalid = false;
22
- this.hasLabelSlot = false;
23
21
  this.handleActivateClick = () => {
24
22
  if (!this.active)
25
23
  this.activate();
@@ -77,7 +75,7 @@ let InlineEdit = class InlineEdit extends QuanticElement {
77
75
  }
78
76
  }
79
77
  render() {
80
- const hasLabel = this.hasLabelSlot || !!this.label;
78
+ const hasLabel = !!this.label;
81
79
  return html `
82
80
  <div
83
81
  class="${classMap({
@@ -90,7 +88,7 @@ let InlineEdit = class InlineEdit extends QuanticElement {
90
88
  @keydown=${this.handleTriggerKey}
91
89
  >
92
90
  <span class=${classMap({ label: true, 'is-empty': !hasLabel })}
93
- ><slot name="label" @slotchange=${onSlotChange((has) => (this.hasLabelSlot = has))}>${this.label}</slot></span
91
+ ><slot name="label">${this.label}</slot></span
94
92
  >
95
93
  <span class="value">
96
94
  <span class="display">
@@ -120,7 +118,7 @@ InlineEdit.meta = {
120
118
  editor: { description: 'Input element shown when the field is active.' },
121
119
  },
122
120
  };
123
- InlineEdit.styles = css `
121
+ InlineEdit.styles = [css `
124
122
  :host {
125
123
  display: block;
126
124
  padding: var(
@@ -164,7 +162,6 @@ InlineEdit.styles = css `
164
162
  );
165
163
  }
166
164
 
167
- /* The label renders unconditionally so its slot exists to fire slotchange. */
168
165
  .label.is-empty {
169
166
  display: none;
170
167
  }
@@ -234,7 +231,13 @@ InlineEdit.styles = css `
234
231
  .is-active .editor {
235
232
  display: block;
236
233
  }
237
- `;
234
+ `,
235
+ whenSlotPresent('label', css `
236
+ .label.is-empty {
237
+ display: revert;
238
+ }
239
+ `),
240
+ ];
238
241
  __decorate([
239
242
  prop({ type: 'string', default: '', description: 'Fallback label text when no label slot content is provided.' })
240
243
  ], InlineEdit.prototype, "label", void 0);
@@ -244,9 +247,6 @@ __decorate([
244
247
  __decorate([
245
248
  prop({ type: 'boolean', default: 'false', description: 'When true, focusout does not close the editor. The editor stays open until the value is valid or the user cancels.' })
246
249
  ], InlineEdit.prototype, "invalid", void 0);
247
- __decorate([
248
- state()
249
- ], InlineEdit.prototype, "hasLabelSlot", void 0);
250
250
  InlineEdit = __decorate([
251
251
  event('cancel', { description: 'Fired on Escape. Consumer should revert optimistic state.' }),
252
252
  quanticElement('quantic-inline-edit')
@@ -258,18 +258,28 @@ export const SidebarWithStickyHeader = story().render(({ html }) => html `
258
258
  slot="header"
259
259
  style="display: flex; align-items: center; gap: var(--quantic-spacing-2); padding: var(--quantic-spacing-2); border-bottom: 1px solid var(--quantic-border-secondary); margin-bottom: var(--quantic-spacing-2);"
260
260
  >
261
- <quantic-icon-brand-fuzzball-solid size="sm"></quantic-icon-brand-fuzzball-solid>
262
- <span style="font-weight: var(--quantic-font-weight-semibold); font-size: var(--quantic-font-size-sm);">CIQ Engineering</span>
261
+ <quantic-icon-brand-fuzzball-solid
262
+ size="sm"
263
+ ></quantic-icon-brand-fuzzball-solid>
264
+ <span
265
+ style="font-weight: var(--quantic-font-weight-semibold); font-size: var(--quantic-font-size-sm);"
266
+ >CIQ Engineering</span
267
+ >
263
268
  </div>
264
269
  ${Array.from({ length: 20 }, (_, i) => html `
265
270
  <quantic-sidebar-menu-item href="#" label="Nav item ${i + 1}">
266
- <quantic-icon-lucide-circle slot="icon" size="sm"></quantic-icon-lucide-circle>
271
+ <quantic-icon-lucide-circle
272
+ slot="icon"
273
+ size="sm"
274
+ ></quantic-icon-lucide-circle>
267
275
  </quantic-sidebar-menu-item>
268
276
  `)}
269
277
  </quantic-sidebar>
270
278
  <quantic-page slot="body">
271
279
  <quantic-panel variant="solid">
272
- <quantic-panel-header slot="header">Sticky sidebar header</quantic-panel-header>
280
+ <quantic-panel-header slot="header"
281
+ >Sticky sidebar header</quantic-panel-header
282
+ >
273
283
  Scroll the sidebar — the header above the nav items stays fixed.
274
284
  </quantic-panel>
275
285
  </quantic-page>
@@ -10,7 +10,7 @@ import { html } from 'lit/static-html.js';
10
10
  import { classMap } from 'lit/directives/class-map.js';
11
11
  import { provide } from '@lit/context';
12
12
  import { AutoHideEmptySlotsMixin } from '../shared/auto-hide-empty-slots.mixin';
13
- import { onSlotChange } from '../shared/slot-utils';
13
+ import { onSlotChange, whenSlotPresent } from '../shared/slot-utils';
14
14
  import { respond, Breakpoint } from '../shared/respond.decorator';
15
15
  import { LayoutVariant } from './index.constants';
16
16
  import { asideExpandedContext } from './index.context';
@@ -94,6 +94,10 @@ let Layout = class Layout extends AutoHideEmptySlotsMixin(QuanticElement, ['logo
94
94
  }
95
95
  connectedCallback() {
96
96
  super.connectedCallback();
97
+ if (this.hasAttribute('ssr-has-sidebar')) {
98
+ this.hasSidebarSlot = true;
99
+ this.removeAttribute('ssr-has-sidebar');
100
+ }
97
101
  document.addEventListener('keydown', this.handleKeydown);
98
102
  }
99
103
  disconnectedCallback() {
@@ -120,16 +124,60 @@ let Layout = class Layout extends AutoHideEmptySlotsMixin(QuanticElement, ['logo
120
124
  ...base,
121
125
  unsafeCSS(`@layer quantic-header-visibility {
122
126
  .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; }
127
+ .header.collapsible { display: revert-layer; }
128
+ }`),
129
+ whenSlotPresent('navbar', css `
130
+ @layer quantic-header-visibility {
131
+ .header {
132
+ display: revert-layer;
133
+ }
131
134
  }
135
+ `),
136
+ whenSlotPresent('titlebar', css `
137
+ @layer quantic-header-visibility {
138
+ .header {
139
+ display: revert-layer;
140
+ }
141
+ }
142
+ `),
143
+ unsafeCSS(`@layer quantic-header-visibility {
144
+ :host(:has([slot="logo"]):not(:has([slot="sidebar"]))) .header { display: revert-layer; }
145
+ @scope { :scope:has([slot="logo"]):not(:has([slot="sidebar"])) .header { display: revert-layer; } }
132
146
  }`),
147
+ whenSlotPresent('sidebar', css `
148
+ .aside { display: flex; }
149
+ @media only screen and (min-width: 1024px) {
150
+ .wrapper {
151
+ display: grid;
152
+ grid-template-areas: 'aside header' 'aside toolbar' 'aside main';
153
+ grid-template-rows: auto auto 1fr;
154
+ grid-template-columns: var(--quantic-component-layout-aside-width-collapsed) 1fr;
155
+ }
156
+ .is-aside-expanded.wrapper {
157
+ grid-template-columns: var(--quantic-component-layout-aside-width) 1fr;
158
+ }
159
+ .aside {
160
+ grid-area: aside;
161
+ position: sticky;
162
+ top: 0;
163
+ align-self: start;
164
+ transform: translateX(0);
165
+ opacity: 1;
166
+ pointer-events: auto;
167
+ }
168
+ .is-aside-expanded.wrapper .aside,
169
+ .is-aside-expanded.wrapper .logo {
170
+ width: var(--quantic-component-layout-aside-width);
171
+ }
172
+ .wrapper:not(.is-aside-expanded) .aside,
173
+ .wrapper:not(.is-aside-expanded) .logo {
174
+ width: var(--quantic-component-layout-aside-width-collapsed);
175
+ padding-inline: 0;
176
+ }
177
+ .toolbar { grid-area: toolbar; min-width: 0; }
178
+ .body { grid-area: main; min-width: 0; }
179
+ }
180
+ `),
133
181
  ];
134
182
  }
135
183
  get isAsideCollapsible() {
@@ -197,7 +245,6 @@ let Layout = class Layout extends AutoHideEmptySlotsMixin(QuanticElement, ['logo
197
245
 
198
246
  <aside
199
247
  class="aside"
200
- ?hidden=${!this.hasSidebar}
201
248
  tabindex="-1"
202
249
  ?inert=${this.isSmallViewport && !this.isAsideExpanded}
203
250
  >
@@ -338,7 +385,7 @@ Layout.styles = css `
338
385
  padding-block: var(--quantic-component-layout-aside-padding-block);
339
386
  border-right: 1px solid var(--quantic-component-layout-aside-border);
340
387
  overflow: visible;
341
- display: flex;
388
+ display: none;
342
389
  flex-direction: column;
343
390
  gap: var(--quantic-component-layout-aside-padding-block);
344
391
  transform: translateX(