@ctrliq/quantic-components 1.67.1 → 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.
Files changed (74) hide show
  1. package/dist/alert/alert.d.ts +1 -1
  2. package/dist/alert/alert.js +4 -12
  3. package/dist/card/card-title.component.d.ts +1 -1
  4. package/dist/card/card-title.component.js +4 -12
  5. package/dist/card/card.component.d.ts +2 -1
  6. package/dist/card/card.component.js +9 -10
  7. package/dist/dialog/dialog-title.d.ts +1 -1
  8. package/dist/dialog/dialog-title.js +3 -11
  9. package/dist/dialog/dialog.d.ts +1 -1
  10. package/dist/dialog/dialog.js +4 -13
  11. package/dist/dropdown-menu/group.component.d.ts +2 -1
  12. package/dist/dropdown-menu/group.component.js +9 -3
  13. package/dist/field/field.component.d.ts +4 -3
  14. package/dist/field/field.component.js +59 -35
  15. package/dist/field/render-as-field.hoc.d.ts +1 -1
  16. package/dist/field/render-as-field.hoc.js +21 -8
  17. package/dist/index.js.map +1 -1
  18. package/dist/inline-edit/index.d.ts +2 -3
  19. package/dist/inline-edit/index.js +16 -8
  20. package/dist/layout/layout.component.d.ts +5 -4
  21. package/dist/layout/layout.component.js +37 -24
  22. package/dist/layout/sidebar.component.d.ts +1 -1
  23. package/dist/layout/sidebar.component.js +5 -5
  24. package/dist/meta/index.js.map +1 -1
  25. package/dist/option-card/option-card.component.d.ts +1 -1
  26. package/dist/option-card/option-card.component.js +4 -12
  27. package/dist/panel/panel-header.component.d.ts +1 -1
  28. package/dist/panel/panel-header.component.js +4 -16
  29. package/dist/panel/panel.component.d.ts +1 -1
  30. package/dist/panel/panel.component.js +4 -12
  31. package/dist/popover/popover-popup.d.ts +1 -1
  32. package/dist/popover/popover-popup.js +3 -3
  33. package/dist/popover/popover.d.ts +2 -2
  34. package/dist/quantic-components.js +260 -316
  35. package/dist/quantic-components.js.map +1 -1
  36. package/dist/quantic-components.min.js +1918 -1983
  37. package/dist/quantic-components.min.js.map +1 -1
  38. package/dist/shared/auto-hide-empty-slots.mixin.d.ts +19 -20
  39. package/dist/shared/auto-hide-empty-slots.mixin.js +43 -43
  40. package/dist/shared/quantic-element.d.ts +11 -1
  41. package/dist/shared/slot-utils.d.ts +24 -0
  42. package/dist/shared/slot-utils.js +38 -0
  43. package/dist/table/index.stories.d.ts +1 -0
  44. package/dist/table/index.stories.js +19 -0
  45. package/dist/table/table.component.d.ts +1 -1
  46. package/dist/table/table.component.js +3 -11
  47. package/dist/toast/toast.d.ts +1 -1
  48. package/dist/toast/toast.js +4 -12
  49. package/dist/toggle/index.d.ts +1 -1
  50. package/dist/toggle/index.js +1 -2
  51. package/dist/types/alert/alert.d.ts +1 -1
  52. package/dist/types/card/card-title.component.d.ts +1 -1
  53. package/dist/types/card/card.component.d.ts +2 -1
  54. package/dist/types/dialog/dialog-title.d.ts +1 -1
  55. package/dist/types/dialog/dialog.d.ts +1 -1
  56. package/dist/types/dropdown-menu/group.component.d.ts +2 -1
  57. package/dist/types/field/field.component.d.ts +4 -3
  58. package/dist/types/field/render-as-field.hoc.d.ts +1 -1
  59. package/dist/types/inline-edit/index.d.ts +2 -3
  60. package/dist/types/layout/layout.component.d.ts +5 -4
  61. package/dist/types/layout/sidebar.component.d.ts +1 -1
  62. package/dist/types/option-card/option-card.component.d.ts +1 -1
  63. package/dist/types/panel/panel-header.component.d.ts +1 -1
  64. package/dist/types/panel/panel.component.d.ts +1 -1
  65. package/dist/types/popover/popover-popup.d.ts +1 -1
  66. package/dist/types/popover/popover.d.ts +2 -2
  67. package/dist/types/shared/auto-hide-empty-slots.mixin.d.ts +19 -20
  68. package/dist/types/shared/quantic-element.d.ts +11 -1
  69. package/dist/types/shared/slot-utils.d.ts +24 -0
  70. package/dist/types/table/index.stories.d.ts +1 -0
  71. package/dist/types/table/table.component.d.ts +1 -1
  72. package/dist/types/toast/toast.d.ts +1 -1
  73. package/dist/types/toggle/index.d.ts +1 -1
  74. package/package.json +1 -1
@@ -1,27 +1,26 @@
1
- import { SlotContentInterface } from './slot-content.mixin';
2
1
  import { LitConstructor } from './shared.types';
3
2
  import { QuanticElement } from './quantic-element';
4
- export interface AutoHideEmptySlotsInterface extends SlotContentInterface {
5
- handleAutoHide(e: Event): void;
6
- }
7
3
  /**
8
- * Mixin that automatically hides empty slots using the `hidden` attribute.
9
- * Extends SlotContentMixin to inherit slot checking functionality.
4
+ * Mixin that automatically hides empty named slots using CSS only.
10
5
  *
11
- * This is useful for components with optional sections that should not
12
- * take up space or affect layout when empty.
6
+ * Each named slot is hidden by default and revealed when the host has a light
7
+ * DOM child with a matching `slot` attribute. Two rules cover all browsers:
8
+ *
9
+ * - `:host(:has([slot="name"]))` — Safari and Firefox
10
+ * - `@scope { :scope:has([slot="name"]) }` — Chrome (@scope changes the
11
+ * evaluation context so :has() can see light DOM children)
12
+ *
13
+ * The reveal value is `display: revert-layer` rather than `display: block` so
14
+ * that the component's own display value is restored instead of overridden.
15
+ * Component styles are placed in `@layer quantic-component` and the
16
+ * hide/reveal rules in `@layer quantic-slot-visibility` (declared after, so
17
+ * higher priority). `revert-layer` then falls back to whatever the component
18
+ * set in `quantic-component`.
19
+ *
20
+ * CSS is injected via `finalizeStyles` so it lands in Lit SSR's Declarative
21
+ * Shadow DOM output — no JS, no layout shift.
13
22
  *
14
23
  * @example
15
- * ```typescript
16
- * class MyComponent extends AutoHideEmptySlotsMixin(QuanticElement) {
17
- * render() {
18
- * return html`
19
- * <slot name="header" @slotchange=${this.handleAutoHide}></slot>
20
- * <slot></slot>
21
- * <slot name="footer" @slotchange=${this.handleAutoHide}></slot>
22
- * `;
23
- * }
24
- * }
25
- * ```
24
+ * class MyElement extends AutoHideEmptySlotsMixin(QuanticElement, ['header', 'footer']) {}
26
25
  */
27
- export declare const AutoHideEmptySlotsMixin: <T extends LitConstructor<QuanticElement>>(superClass: T) => T & LitConstructor<AutoHideEmptySlotsInterface>;
26
+ export declare const AutoHideEmptySlotsMixin: <T extends LitConstructor<QuanticElement>>(superClass: T, namedSlots?: string[]) => T;
@@ -1,4 +1,5 @@
1
1
  import { LitElement } from 'lit';
2
+ import type { LitConstructor } from './shared.types';
2
3
  import type { ComponentMeta } from './meta.types';
3
4
  /**
4
5
  * Base class for Quantic components.
@@ -8,10 +9,19 @@ export declare class QuanticElement extends LitElement {
8
9
  static meta?: ComponentMeta;
9
10
  static ensureDefined(): void;
10
11
  }
12
+ /**
13
+ * Any QuanticElement subclass, including the anonymous ones mixins and HOCs
14
+ * return — those are plain constructors, so their statics are declared here
15
+ * rather than inferred from `typeof QuanticElement`.
16
+ */
17
+ export type QuanticElementConstructor = LitConstructor<QuanticElement> & {
18
+ tagName?: string;
19
+ meta?: ComponentMeta;
20
+ };
11
21
  /**
12
22
  * Decorator that registers a QuanticElement subclass as a custom element and sets its tagName.
13
23
  * The class must extend QuanticElement to inherit the ensureDefined() static method.
14
24
  *
15
25
  * @param tagName - The custom element tag name (e.g., 'quantic-badge')
16
26
  */
17
- export declare function quanticElement(tagName: string): <T extends typeof QuanticElement>(target: T) => T;
27
+ export declare function quanticElement(tagName: string): <T extends QuanticElementConstructor>(target: T) => T;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Returns true if a slot has at least one non-whitespace node assigned.
3
+ */
4
+ export declare function slotHasContent(slot: HTMLSlotElement): boolean;
5
+ /**
6
+ * Returns the concatenated trimmed text content of all assigned nodes.
7
+ */
8
+ export declare function slotTextContent(slot: HTMLSlotElement): string;
9
+ /**
10
+ * Returns a slotchange event handler that calls `setter` with whether the slot
11
+ * has non-empty content.
12
+ *
13
+ * @example
14
+ * html`<slot @slotchange=${onSlotChange((has) => (this._hasLabel = has))}></slot>`
15
+ */
16
+ export declare function onSlotChange(setter: (has: boolean) => void): (e: Event) => void;
17
+ /**
18
+ * Returns a slotchange event handler that calls `setter` with the slot's text
19
+ * content, falling back to `''` when empty.
20
+ *
21
+ * @example
22
+ * html`<slot @slotchange=${onSlotTextChange((t) => (this._labelText = t))}></slot>`
23
+ */
24
+ export declare function onSlotTextChange(setter: (text: string) => void): (e: Event) => void;
@@ -20,4 +20,5 @@ export declare const WithToolbar: import("../shared/story").StoryObject<Args>;
20
20
  export declare const WithControls: import("../shared/story").StoryObject<Args>;
21
21
  export declare const WithToolbarAndControls: import("../shared/story").StoryObject<Args>;
22
22
  export declare const SortChange: import("../shared/story").StoryObject<Args>;
23
+ export declare const EmptyOptionalSlots: any;
23
24
  export declare const CustomColumnWidths: import("../shared/story").StoryObject<Args>;
@@ -1,7 +1,7 @@
1
1
  import { QuanticElement } from '../shared/quantic-element';
2
2
  import { TableSize, TableVariant } from './index.constants';
3
3
  import type { ComponentMeta } from '../shared/meta.types';
4
- declare const Table_base: typeof QuanticElement & import("../shared/shared.types").LitConstructor<import("../shared/auto-hide-empty-slots.mixin").AutoHideEmptySlotsInterface>;
4
+ declare const Table_base: typeof QuanticElement;
5
5
  export declare class Table extends Table_base {
6
6
  static meta: ComponentMeta;
7
7
  size: TableSize;
@@ -3,7 +3,7 @@ import { QuanticElement } from '../shared/quantic-element';
3
3
  import { ToastType } from './index.constants';
4
4
  import type { ComponentMeta } from '../shared/meta.types';
5
5
  export { ToastType } from './index.constants';
6
- declare const Toast_base: typeof QuanticElement & import("../shared/shared.types").LitConstructor<import("../shared/auto-hide-empty-slots.mixin").AutoHideEmptySlotsInterface>;
6
+ declare const Toast_base: typeof QuanticElement;
7
7
  export declare class Toast extends Toast_base {
8
8
  static meta: ComponentMeta;
9
9
  open: boolean;
@@ -14,7 +14,7 @@ declare const Toggle_base: {
14
14
  invalid?: boolean;
15
15
  } | undefined): import("../shared/a11y-attributes.mixin").A11yAttributeValues;
16
16
  };
17
- } & typeof QuanticElement & import("../shared/shared.types").LitConstructor<import("../shared/slot-content.mixin").SlotContentInterface>;
17
+ } & typeof QuanticElement;
18
18
  export declare class Toggle extends Toggle_base {
19
19
  static meta: ComponentMeta;
20
20
  static formAssociated: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctrliq/quantic-components",
3
- "version": "1.67.1",
3
+ "version": "1.67.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/types/index.d.ts",
6
6
  "exports": {