@ctrliq/quantic-components 1.67.3 → 1.67.4

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.
@@ -13,8 +13,7 @@ export declare class Card extends Card_base {
13
13
  target: string | undefined;
14
14
  rel: string | undefined;
15
15
  download: string | undefined;
16
- private hasActionIconSlot;
17
- static styles: import("lit").CSSResult;
16
+ static styles: import("lit").CSSResult[];
18
17
  render(): import("lit").TemplateResult;
19
18
  }
20
19
  export {};
@@ -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 } from 'lit';
8
- import { state } from 'lit/decorators.js';
9
8
  import { html } from 'lit/static-html.js';
10
- import { onSlotChange } from '../shared/slot-utils';
9
+ import { whenSlotPresent } from '../shared/slot-utils';
11
10
  import { CardVariant, CardSize } from './index.constants';
12
11
  import { classMap } from 'lit/directives/class-map.js';
13
12
  import { ifDefined } from 'lit/directives/if-defined.js';
@@ -22,7 +21,6 @@ let Card = class Card extends AutoHideEmptySlotsMixin(QuanticElement, ['header',
22
21
  this.size = CardSize.Medium;
23
22
  this.type = 'button';
24
23
  this.disabled = false;
25
- this.hasActionIconSlot = false;
26
24
  }
27
25
  render() {
28
26
  const classes = classMap({
@@ -31,7 +29,6 @@ let Card = class Card extends AutoHideEmptySlotsMixin(QuanticElement, ['header',
31
29
  [`size--${this.size}`]: true,
32
30
  ['is-interactive']: this.as === 'button' || this.as === 'a',
33
31
  ['is-disabled']: this.disabled,
34
- [`has-action-icon`]: this.hasActionIconSlot,
35
32
  });
36
33
  const slots = html `
37
34
  <slot
@@ -52,7 +49,6 @@ let Card = class Card extends AutoHideEmptySlotsMixin(QuanticElement, ['header',
52
49
  name="action-icon"
53
50
  class="action-icon"
54
51
  data-description="Icon in the top-right corner; only visible on interactive cards."
55
- @slotchange=${onSlotChange((has) => (this.hasActionIconSlot = has))}
56
52
  ></slot>
57
53
  `;
58
54
  if (this.as === 'button') {
@@ -94,7 +90,7 @@ Card.meta = {
94
90
  ],
95
91
  relatedTo: ['quantic-card-group', 'quantic-panel'],
96
92
  };
97
- Card.styles = css `
93
+ Card.styles = [css `
98
94
  :host {
99
95
  display: flex;
100
96
  flex-direction: column;
@@ -217,10 +213,6 @@ Card.styles = css `
217
213
  margin-top: auto;
218
214
  }
219
215
 
220
- .has-action-icon {
221
- padding-right: calc(var(--quantic-component-card-padding) * 2);
222
- }
223
-
224
216
  .action-icon {
225
217
  position: absolute;
226
218
  inset: calc(var(--quantic-component-card-padding) / 2);
@@ -268,7 +260,13 @@ Card.styles = css `
268
260
  [hidden] {
269
261
  display: none;
270
262
  }
271
- `;
263
+ `,
264
+ whenSlotPresent('action-icon', css `
265
+ .main {
266
+ padding-right: calc(var(--quantic-component-card-padding) * 2);
267
+ }
268
+ `),
269
+ ];
272
270
  __decorate([
273
271
  prop({
274
272
  type: '"div" | "button" | "a"',
@@ -319,9 +317,6 @@ __decorate([
319
317
  __decorate([
320
318
  prop({ type: 'string', description: 'Download filename (as="a" only).' })
321
319
  ], Card.prototype, "download", void 0);
322
- __decorate([
323
- state()
324
- ], Card.prototype, "hasActionIconSlot", void 0);
325
320
  Card = __decorate([
326
321
  quanticElement('quantic-card')
327
322
  ], Card);
@@ -4,8 +4,7 @@ declare const DropdownMenuGroup_base: typeof QuanticElement;
4
4
  export declare class DropdownMenuGroup extends DropdownMenuGroup_base {
5
5
  static meta: ComponentMeta;
6
6
  label: string;
7
- private hasLabelSlot;
8
- static styles: import("lit").CSSResult;
7
+ static styles: import("lit").CSSResult[];
9
8
  render(): import("lit").TemplateResult<1>;
10
9
  }
11
10
  export {};
@@ -5,22 +5,20 @@ 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, nothing } from 'lit';
8
- import { state } from 'lit/decorators.js';
9
8
  import { quanticElement, QuanticElement } from '../shared/quantic-element';
10
9
  import { prop } from '../shared/component-meta.decorators';
11
10
  import { AutoHideEmptySlotsMixin } from '../shared/auto-hide-empty-slots.mixin';
12
- import { onSlotChange } from '../shared/slot-utils';
11
+ import { whenSlotPresent } from '../shared/slot-utils';
13
12
  let DropdownMenuGroup = class DropdownMenuGroup extends AutoHideEmptySlotsMixin(QuanticElement, ['label']) {
14
13
  constructor() {
15
14
  super(...arguments);
16
15
  this.label = '';
17
- this.hasLabelSlot = false;
18
16
  }
19
17
  render() {
20
- const hasLabel = this.label || this.hasLabelSlot;
18
+ const hasLabel = !!this.label;
21
19
  return html `
22
20
  <div class="label" id="group-label" ?hidden=${!hasLabel}>
23
- <slot name="label" @slotchange=${onSlotChange((has) => (this.hasLabelSlot = has))}>${this.label}</slot>
21
+ <slot name="label">${this.label}</slot>
24
22
  </div>
25
23
  <div
26
24
  class="items"
@@ -48,7 +46,7 @@ DropdownMenuGroup.meta = {
48
46
  },
49
47
  relatedTo: ['quantic-dropdown-menu', 'quantic-dropdown-menu-item'],
50
48
  };
51
- DropdownMenuGroup.styles = css `
49
+ DropdownMenuGroup.styles = [css `
52
50
  :host {
53
51
  display: block;
54
52
  padding: var(--quantic-spacing-4) 0 var(--quantic-spacing-2);
@@ -81,7 +79,13 @@ DropdownMenuGroup.styles = css `
81
79
  flex-direction: column;
82
80
  gap: var(--quantic-spacing-0-5);
83
81
  }
84
- `;
82
+ `,
83
+ whenSlotPresent('label', css `
84
+ .label {
85
+ display: block;
86
+ }
87
+ `),
88
+ ];
85
89
  __decorate([
86
90
  prop({
87
91
  type: 'string',
@@ -89,9 +93,6 @@ __decorate([
89
93
  description: 'Section heading displayed above the group items.',
90
94
  })
91
95
  ], DropdownMenuGroup.prototype, "label", void 0);
92
- __decorate([
93
- state()
94
- ], DropdownMenuGroup.prototype, "hasLabelSlot", void 0);
95
96
  DropdownMenuGroup = __decorate([
96
97
  quanticElement('quantic-dropdown-menu-group')
97
98
  ], DropdownMenuGroup);
@@ -11,9 +11,6 @@ export declare class Field extends QuanticElement {
11
11
  status: FieldValidationStatus | undefined;
12
12
  size: FieldSize;
13
13
  hintPosition: FieldHintPosition;
14
- private hasLabelSlot;
15
- private hasHintSlot;
16
- private hasMessageSlot;
17
14
  static styles: import("lit").CSSResult[];
18
15
  render(): import("lit").TemplateResult<1>;
19
16
  }
@@ -5,12 +5,11 @@ 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 { html, css } from 'lit';
8
- import { state } from 'lit/decorators.js';
9
8
  import { quanticElement, QuanticElement } from '../shared/quantic-element';
10
9
  import { classMap } from 'lit/directives/class-map.js';
11
10
  import { FieldValidationStatus, FieldSize, FieldHintPosition, } from './index.constants';
12
11
  import { prop } from '../shared/component-meta.decorators';
13
- import { onSlotChange } from '../shared/slot-utils';
12
+ import { whenSlotPresent } from '../shared/slot-utils';
14
13
  let Field = class Field extends QuanticElement {
15
14
  constructor() {
16
15
  super(...arguments);
@@ -21,14 +20,11 @@ let Field = class Field extends QuanticElement {
21
20
  this.required = false;
22
21
  this.size = FieldSize.Medium;
23
22
  this.hintPosition = FieldHintPosition.Below;
24
- this.hasLabelSlot = false;
25
- this.hasHintSlot = false;
26
- this.hasMessageSlot = false;
27
23
  }
28
24
  render() {
29
- const hasLabel = this.hasLabelSlot || !!this.label;
30
- const hasHint = this.hasHintSlot || !!this.hint;
31
- const hasMessage = this.hasMessageSlot || !!this.message;
25
+ const hasLabel = !!this.label;
26
+ const hasHint = !!this.hint;
27
+ const hasMessage = !!this.message;
32
28
  const hintTemplate = html `
33
29
  <div
34
30
  id="hint-${this.fieldId}"
@@ -36,7 +32,6 @@ let Field = class Field extends QuanticElement {
36
32
  >
37
33
  <slot
38
34
  name="hint"
39
- @slotchange=${onSlotChange((v) => (this.hasHintSlot = v))}
40
35
  >${this.hint}</slot>
41
36
  </div>
42
37
  `;
@@ -48,7 +43,6 @@ let Field = class Field extends QuanticElement {
48
43
  >
49
44
  <slot
50
45
  name="label"
51
- @slotchange=${onSlotChange((v) => (this.hasLabelSlot = v))}
52
46
  >${this.label}</slot>
53
47
  ${this.required
54
48
  ? html `<span class="required-indicator">*</span>`
@@ -69,7 +63,6 @@ let Field = class Field extends QuanticElement {
69
63
  >
70
64
  <slot
71
65
  name="message"
72
- @slotchange=${onSlotChange((v) => (this.hasMessageSlot = v))}
73
66
  >${this.message}</slot>
74
67
  </div>
75
68
  </div>
@@ -137,7 +130,7 @@ Field.styles = [
137
130
  color: var(--quantic-text-secondary);
138
131
  }
139
132
 
140
- /* Sections render unconditionally so their slots exist to fire slotchange. */
133
+ /* Sections render unconditionally; is-empty hides them when no prop or slot content is present. */
141
134
  .is-empty {
142
135
  display: none;
143
136
  }
@@ -225,6 +218,21 @@ Field.styles = [
225
218
  color: var(--quantic-text-warning-primary);
226
219
  }
227
220
  `,
221
+ whenSlotPresent('label', css `
222
+ .label.is-empty {
223
+ display: revert;
224
+ }
225
+ `),
226
+ whenSlotPresent('hint', css `
227
+ .hint.is-empty {
228
+ display: revert;
229
+ }
230
+ `),
231
+ whenSlotPresent('message', css `
232
+ .message.is-empty {
233
+ display: revert;
234
+ }
235
+ `),
228
236
  ];
229
237
  __decorate([
230
238
  prop({ type: 'string', default: "''", description: 'ID linking the label and hint/message elements to the control for accessibility.' })
@@ -250,15 +258,6 @@ __decorate([
250
258
  __decorate([
251
259
  prop({ type: 'FieldHintPosition', options: Object.values(FieldHintPosition), default: FieldHintPosition.Below, attribute: 'hint-position', description: 'Position of the hint relative to the control.' })
252
260
  ], Field.prototype, "hintPosition", void 0);
253
- __decorate([
254
- state()
255
- ], Field.prototype, "hasLabelSlot", void 0);
256
- __decorate([
257
- state()
258
- ], Field.prototype, "hasHintSlot", void 0);
259
- __decorate([
260
- state()
261
- ], Field.prototype, "hasMessageSlot", void 0);
262
261
  Field = __decorate([
263
262
  quanticElement(`quantic-field`)
264
263
  ], Field);