@vialiq/web-components 0.13.0 → 0.14.0

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,5 +1,10 @@
1
1
  import { ReactiveController, ReactiveControllerHost } from 'lit';
2
2
  import { Placement } from '@floating-ui/dom';
3
+ /**
4
+ * FloatingControllerOptions
5
+ *
6
+ * Configuration options for the FloatingController.
7
+ */
3
8
  export interface FloatingControllerOptions {
4
9
  /** Function returning the reference element (e.g. trigger/input). */
5
10
  reference: () => HTMLElement | null;
@@ -9,7 +14,12 @@ export interface FloatingControllerOptions {
9
14
  placement?: () => Placement;
10
15
  /** Space in px between reference and floating. */
11
16
  offset?: number;
12
- /** Whether to use fixed positioning instead of absolute. */
17
+ /**
18
+ * When true, uses `position: fixed` instead of `absolute`.
19
+ * This allows the floating element to escape tight `overflow: hidden` containers
20
+ * (like modals) without needing to be physically moved (teleported) in the DOM,
21
+ * preserving Shadow DOM encapsulation and slotting.
22
+ */
13
23
  hoist?: () => boolean;
14
24
  /** Element or selector string to constrain flipping. */
15
25
  boundary?: () => HTMLElement | string | null;
@@ -17,27 +27,42 @@ export interface FloatingControllerOptions {
17
27
  matchWidth?: boolean;
18
28
  }
19
29
  /**
20
- * A Reactive Controller that manages @floating-ui/dom positioning.
21
- * Abstracts away the autoUpdate and positioning logic from complex components.
30
+ * FloatingController
31
+ *
32
+ * A Lit Reactive Controller that manages `@floating-ui/dom` positioning logic.
33
+ * It abstracts away the complex math and event listeners (autoUpdate) required to
34
+ * keep a popup/dropdown anchored to a reference element during scrolling/resizing.
35
+ *
36
+ * It also automatically registers the floating element with the `OverlayManager`
37
+ * to ensure correct z-index stacking when `hoist` is true.
22
38
  */
23
39
  export declare class FloatingController implements ReactiveController {
24
40
  private host;
25
41
  private options;
26
42
  private _cleanup?;
43
+ private _overlayZIndex;
27
44
  constructor(host: ReactiveControllerHost, options: FloatingControllerOptions);
28
45
  hostDisconnected(): void;
29
46
  /**
30
- * Starts the floating UI auto-update listener.
31
- * Call this when the popover opens.
47
+ * Starts the floating UI `autoUpdate` listener cycle.
48
+ * This should be called when the popover physically opens (e.g., in `updated()`).
49
+ *
50
+ * If `hoist` is true, it also acquires a high z-index from the `OverlayManager`.
32
51
  */
33
52
  start(): void;
34
53
  /**
35
- * Stops the floating UI auto-update listener.
36
- * Call this when the popover closes.
54
+ * Stops the floating UI `autoUpdate` listener cycle.
55
+ * This should be called when the popover closes, or when the host component disconnects.
56
+ *
57
+ * It also releases its z-index back to the `OverlayManager`.
37
58
  */
38
59
  stop(): void;
39
60
  /**
40
- * Imperatively update position.
61
+ * Imperatively calculates and applies the new coordinates (`x`, `y`) using Floating UI.
62
+ *
63
+ * This method applies various CSS property resets (`margin`, `bottom`, `right`, `minWidth`)
64
+ * to ensure that the base CSS of the floating element does not distort the absolute coordinates
65
+ * provided by Floating UI.
41
66
  */
42
67
  updatePosition(): Promise<void>;
43
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"floating-controller.d.ts","sourceRoot":"","sources":["../../../../../libs/web-components/src/base/controllers/floating-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AACjE,OAAO,EAAmD,KAAK,SAAS,EAAmB,MAAM,kBAAkB,CAAC;AAEpH,MAAM,WAAW,yBAAyB;IACxC,qEAAqE;IACrE,SAAS,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACpC,sEAAsE;IACtE,QAAQ,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACnC,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,SAAS,CAAC;IAC5B,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,CAAC;IAC7C,4FAA4F;IAC5F,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,qBAAa,kBAAmB,YAAW,kBAAkB;IAIzD,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO;IAJjB,OAAO,CAAC,QAAQ,CAAC,CAAa;gBAGpB,IAAI,EAAE,sBAAsB,EAC5B,OAAO,EAAE,yBAAyB;IAK5C,gBAAgB;IAIhB;;;OAGG;IACH,KAAK;IAgBL;;;OAGG;IACH,IAAI;IAOJ;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CA+CtC"}
1
+ {"version":3,"file":"floating-controller.d.ts","sourceRoot":"","sources":["../../../../../libs/web-components/src/base/controllers/floating-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AACjE,OAAO,EAAmD,KAAK,SAAS,EAAmB,MAAM,kBAAkB,CAAC;AAGpH;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,qEAAqE;IACrE,SAAS,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACpC,sEAAsE;IACtE,QAAQ,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IACnC,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,SAAS,CAAC;IAC5B,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;IACtB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,CAAC;IAC7C,4FAA4F;IAC5F,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,kBAAkB;IAKzD,OAAO,CAAC,IAAI;IACZ,OAAO,CAAC,OAAO;IALjB,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,cAAc,CAAuB;gBAGnC,IAAI,EAAE,sBAAsB,EAC5B,OAAO,EAAE,yBAAyB;IAK5C,gBAAgB;IAIhB;;;;;OAKG;IACH,KAAK;IAyBL;;;;;OAKG;IACH,IAAI;IAgBJ;;;;;;OAMG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAmDtC"}
@@ -0,0 +1,33 @@
1
+ import { LitElement } from 'lit';
2
+ type Constructor<T = object> = new (...args: any[]) => T;
3
+ export declare class DraggableInterface {
4
+ draggable: boolean;
5
+ protected get _dragTarget(): HTMLElement | null;
6
+ protected get _dragHandle(): HTMLElement | null;
7
+ protected _resetDrag(): void;
8
+ protected _stopDrag(): void;
9
+ }
10
+ /**
11
+ * DraggableMixin
12
+ *
13
+ * Provides native drag-and-drop capabilities using Pointer Events to any LitElement.
14
+ * It is primarily designed for modals and dialogs that need to be repositioned by the user.
15
+ *
16
+ * By default, this applies a `transform: translate3d(x, y, 0)` to the element returned
17
+ * by `_dragTarget`. This is highly performant and avoids reflowing the layout.
18
+ *
19
+ * Subclasses MUST implement:
20
+ * - `_dragTarget`: The HTML element that moves (usually the outer container or dialog).
21
+ * - `_dragHandle`: The HTML element that accepts pointer events to initiate the drag (usually a header).
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * class MyModal extends DraggableMixin(LitElement) {
26
+ * protected get _dragTarget() { return this.shadowRoot.querySelector('.modal'); }
27
+ * protected get _dragHandle() { return this.shadowRoot.querySelector('.header'); }
28
+ * }
29
+ * ```
30
+ */
31
+ export declare function DraggableMixin<T extends Constructor<LitElement>>(Base: T): T & Constructor<DraggableInterface>;
32
+ export {};
33
+ //# sourceMappingURL=draggable-mixin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draggable-mixin.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/base/draggable-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAItD,KAAK,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;AAEzD,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,KAAK,WAAW,IAAI,WAAW,GAAG,IAAI,CAAC;IAChD,SAAS,KAAK,WAAW,IAAI,WAAW,GAAG,IAAI,CAAC;IAChD,SAAS,CAAC,UAAU,IAAI,IAAI;IAC5B,SAAS,CAAC,SAAS,IAAI,IAAI;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAC9D,IAAI,EAAE,CAAC,GACN,CAAC,GAAG,WAAW,CAAC,kBAAkB,CAAC,CA+NrC"}
@@ -14,13 +14,13 @@ export declare class FocusTrapInterface {
14
14
  * @param initialFocus - Optional element to focus first. Defaults to the
15
15
  * first focusable element found in the shadow root.
16
16
  */
17
- protected _activateFocusTrap(initialFocus?: HTMLElement): void;
17
+ protected _activateFocusTrap(initialFocus?: HTMLElement | null, autofocus?: boolean): void;
18
18
  /**
19
19
  * Deactivates the focus trap.
20
- * Removes the Tab intercept and restores focus to the element that was
21
- * focused immediately before `_activateFocusTrap()` was called.
20
+ * Removes the Tab intercept and restores focus to the specified returnFocus
21
+ * element, or falls back to the element that was focused before activation.
22
22
  */
23
- protected _deactivateFocusTrap(): void;
23
+ protected _deactivateFocusTrap(returnFocus?: HTMLElement | null): void;
24
24
  }
25
25
  /**
26
26
  * FocusTrapMixin
@@ -1 +1 @@
1
- {"version":3,"file":"focus-trap-mixin.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/base/focus-trap-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAKjC,KAAK,WAAW,CAAC,CAAC,GAAG,MAAM,IAAI,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAA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G,WAAW,CAAC,kBAAkB,CAAC,CAqPrC"}
@@ -0,0 +1,58 @@
1
+ export type OverlayType = 'modal' | 'dropdown' | 'tooltip' | 'toast';
2
+ /**
3
+ * OverlayManagerService
4
+ *
5
+ * A singleton service responsible for managing the z-index stacking context
6
+ * of all floating elements (Modals, Dropdowns, Tooltips, Toasts) across the application.
7
+ *
8
+ * It ensures that newly opened overlays always appear on top of existing ones by
9
+ * maintaining a registry and dynamically calculating the next highest z-index.
10
+ * It also manages global state side-effects, such as locking `document.body` scroll
11
+ * when a modal is active.
12
+ */
13
+ declare class OverlayManagerService {
14
+ private _baseZIndexCache?;
15
+ private get baseZIndex();
16
+ private overlays;
17
+ private _previousOverflow;
18
+ /**
19
+ * Registers an element as an active overlay.
20
+ * Calculates and returns the appropriate z-index for this overlay.
21
+ *
22
+ * @param element The DOM element being registered (e.g., the modal dialog or dropdown listbox)
23
+ * @param type The type of overlay, used to determine behaviors like scroll-locking.
24
+ * @returns The calculated z-index to be applied to the element.
25
+ */
26
+ register(element: HTMLElement, type?: OverlayType): number;
27
+ /**
28
+ * Unregisters an element, removing it from the overlay stack.
29
+ * Should be called when the overlay is closed or disconnected from the DOM.
30
+ *
31
+ * @param element The DOM element to unregister.
32
+ */
33
+ unregister(element: HTMLElement): void;
34
+ /**
35
+ * Gets the assigned z-index for an element if it is currently registered.
36
+ *
37
+ * @param element The DOM element to query.
38
+ * @returns The z-index number, or null if the element is not registered.
39
+ */
40
+ getZIndex(element: HTMLElement): number | null;
41
+ /**
42
+ * Evaluates whether the provided element is currently the top-most active overlay.
43
+ * Useful for trapping focus or handling global Escape key presses.
44
+ *
45
+ * @param element The DOM element to check.
46
+ * @returns True if the element has the highest z-index in the registry.
47
+ */
48
+ isTopOverlay(element: HTMLElement): boolean;
49
+ /**
50
+ * Locks or unlocks the document.body scroll based on the presence of modals.
51
+ * Modals require the body to be unscrollable to trap scroll inside the modal.
52
+ * It applies a utility class `vi-scroll-locked` to the body.
53
+ */
54
+ private _updateBodyScroll;
55
+ }
56
+ export declare const OverlayManager: OverlayManagerService;
57
+ export {};
58
+ //# sourceMappingURL=overlay-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-manager.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/base/overlay-manager.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;AAQrE;;;;;;;;;;GAUG;AACH,cAAM,qBAAqB;IACzB,OAAO,CAAC,gBAAgB,CAAC,CAAS;IAClC,OAAO,KAAK,UAAU,GAarB;IACD,OAAO,CAAC,QAAQ,CAA6B;IAC7C,OAAO,CAAC,iBAAiB,CAAuB;IAEhD;;;;;;;OAOG;IACI,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,GAAE,WAAwB,GAAG,MAAM;IAiB7E;;;;;OAKG;IACI,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAK7C;;;;;OAKG;IACI,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,IAAI;IAKrD;;;;;;OAMG;IACI,YAAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO;IAMlD;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;CAqB1B;AAGD,eAAO,MAAM,cAAc,uBAA8B,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { unsafeCSS, css, html } from 'lit';
2
2
  import { customElement, property } from 'lit/decorators.js';
3
3
  import { F as FocusableMixin } from '../focusable-mixin-CmxOyPX5.js';
4
- import { V as ValidityMixin } from '../validity-mixin-H4aOFJEr.js';
4
+ import { V as ValidityMixin } from '../validity-mixin-DO0ycRH2.js';
5
5
  import { V as ViElement } from '../vi-element-C6GfDPs3.js';
6
6
  import { classMap } from 'lit/directives/class-map.js';
7
7