@vialiq/web-components 0.12.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,4 +1,4 @@
1
- import { type TemplateResult } from 'lit';
1
+ import { TemplateResult } from 'lit';
2
2
  import { ViElement } from '../base/vi-element.js';
3
3
  export type BadgeVariant = 'neutral' | 'primary' | 'success' | 'warning' | 'danger' | 'info';
4
4
  export type BadgeSize = 'sm' | 'md' | 'lg';
@@ -23,7 +23,7 @@ export type BadgeSize = 'sm' | 'md' | 'lg';
23
23
  * @csspart icon - Icon slot wrapper
24
24
  */
25
25
  export declare class ViBadge extends ViElement {
26
- static styles: import("lit").CSSResult;
26
+ static styles: import('lit').CSSResult;
27
27
  /** Colour semantic */
28
28
  accessor variant: BadgeVariant;
29
29
  /** Size */
@@ -0,0 +1,69 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ import { Placement } from '@floating-ui/dom';
3
+ /**
4
+ * FloatingControllerOptions
5
+ *
6
+ * Configuration options for the FloatingController.
7
+ */
8
+ export interface FloatingControllerOptions {
9
+ /** Function returning the reference element (e.g. trigger/input). */
10
+ reference: () => HTMLElement | null;
11
+ /** Function returning the floating element (e.g. popover/listbox). */
12
+ floating: () => HTMLElement | null;
13
+ /** Function returning the desired placement. */
14
+ placement?: () => Placement;
15
+ /** Space in px between reference and floating. */
16
+ offset?: number;
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
+ */
23
+ hoist?: () => boolean;
24
+ /** Element or selector string to constrain flipping. */
25
+ boundary?: () => HTMLElement | string | null;
26
+ /** Whether the floating element should be forced to match the reference element's width. */
27
+ matchWidth?: boolean;
28
+ }
29
+ /**
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.
38
+ */
39
+ export declare class FloatingController implements ReactiveController {
40
+ private host;
41
+ private options;
42
+ private _cleanup?;
43
+ private _overlayZIndex;
44
+ constructor(host: ReactiveControllerHost, options: FloatingControllerOptions);
45
+ hostDisconnected(): void;
46
+ /**
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`.
51
+ */
52
+ start(): void;
53
+ /**
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`.
58
+ */
59
+ stop(): void;
60
+ /**
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.
66
+ */
67
+ updatePosition(): Promise<void>;
68
+ }
69
+ //# sourceMappingURL=floating-controller.d.ts.map
@@ -0,0 +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;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,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC;;;;;;;;OAQG;IACH,SAAS,CAAC,kBAAkB,CAAC,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI;IAE9D;;;;OAIG;IACH,SAAS,CAAC,oBAAoB,IAAI,IAAI;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAC9D,IAAI,EAAE,CAAC,GACN,CAAC,GAAG,WAAW,CAAC,kBAAkB,CAAC,CA2KrC"}
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,CAAC,CAAC;AAEzD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC;;;;;;;;OAQG;IACH,SAAS,CAAC,kBAAkB,CAC1B,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,EACjC,SAAS,CAAC,EAAE,OAAO,GAClB,IAAI;IAEP;;;;OAIG;IACH,SAAS,CAAC,oBAAoB,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI;CACvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6FG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAC9D,IAAI,EAAE,CAAC,GACN,CAAC,GAAG,WAAW,CAAC,kBAAkB,CAAC,CAqPrC"}
@@ -58,5 +58,5 @@
58
58
  * - You need the attribute to literally be "" (rare, document when intentional)
59
59
  * - The binding is to a custom element property — use .prop=${val} instead
60
60
  */
61
- export declare const ifNonEmpty: (value: string | null | undefined) => string | typeof import("lit-html").nothing;
61
+ export declare const ifNonEmpty: (value: string | null | undefined) => string | typeof import('lit-html').nothing;
62
62
  //# sourceMappingURL=if-non-empty.d.ts.map
@@ -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,4 +1,4 @@
1
- import { type PropertyValues, type TemplateResult } from 'lit';
1
+ import { PropertyValues, TemplateResult } from 'lit';
2
2
  import { ViElement } from '../base/vi-element.js';
3
3
  /**
4
4
  * Button visual variant.
@@ -18,7 +18,7 @@ export type ButtonSize = 'xs' | 'sm' | 'md' | 'lg';
18
18
  * Controlled via CSS `order` — no extra wrapper elements needed.
19
19
  */
20
20
  export type ButtonIconPlacement = 'start' | 'end';
21
- declare const ViButton_base: typeof ViElement & (new (...args: any[]) => import("../base/focusable-mixin.js").FocusableInterface);
21
+ declare const ViButton_base: typeof ViElement & (new (...args: any[]) => import('../base/focusable-mixin.js').FocusableInterface);
22
22
  /**
23
23
  * vi-button
24
24
  * Self-styled button component using Flux UI token fallbacks.
@@ -39,7 +39,7 @@ declare const ViButton_base: typeof ViElement & (new (...args: any[]) => import(
39
39
  * @csspart label - The label span
40
40
  */
41
41
  export declare class ViButton extends ViButton_base {
42
- static styles: import("lit").CSSResult;
42
+ static styles: import('lit').CSSResult;
43
43
  protected get _focusableElement(): HTMLButtonElement | null;
44
44
  /** Visual variant. */
45
45
  accessor variant: ButtonVariant;
@@ -1,8 +1,8 @@
1
- import { type PropertyValues, type TemplateResult } from 'lit';
2
- import { type ControlStatus } from '../base/validity-mixin.js';
1
+ import { PropertyValues, TemplateResult } from 'lit';
2
+ import { ControlStatus } from '../base/validity-mixin.js';
3
3
  import { ViElement } from '../base/vi-element.js';
4
4
  export type CheckboxSize = 'xs' | 'sm' | 'md' | 'lg';
5
- declare const ViCheckbox_base: typeof ViElement & (new (...args: any[]) => import("../base/focusable-mixin.js").FocusableInterface) & (new (...args: any[]) => import("../base/validity-mixin.js").ValidityInterface<unknown>);
5
+ declare const ViCheckbox_base: typeof ViElement & (new (...args: any[]) => import('../base/focusable-mixin.js').FocusableInterface) & (new (...args: any[]) => import('../base/validity-mixin.js').ValidityInterface<unknown>);
6
6
  /**
7
7
  * vi-checkbox
8
8
  * Form-associated checkbox control using Flux UI tokens.
@@ -29,7 +29,7 @@ declare const ViCheckbox_base: typeof ViElement & (new (...args: any[]) => impor
29
29
  * @csspart label - The label text wrapper.
30
30
  */
31
31
  export declare class ViCheckbox extends ViCheckbox_base {
32
- static styles: import("lit").CSSResult;
32
+ static styles: import('lit').CSSResult;
33
33
  private _initialChecked;
34
34
  protected get _focusableElement(): HTMLInputElement | null;
35
35
  accessor status: ControlStatus;
@@ -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
 
@@ -1,4 +1,4 @@
1
- import { type PropertyValues, type TemplateResult } from 'lit';
1
+ import { PropertyValues, TemplateResult } from 'lit';
2
2
  import { ViElement } from '../base/vi-element.js';
3
3
  /**
4
4
  * vi-icon
@@ -17,7 +17,7 @@ import { ViElement } from '../base/vi-element.js';
17
17
  * @attr label - Accessible label; omit for decorative icons
18
18
  */
19
19
  export declare class ViIcon extends ViElement {
20
- static styles: import("lit").CSSResult;
20
+ static styles: import('lit').CSSResult;
21
21
  /**
22
22
  * The registered icon name to render.
23
23
  * @attr
package/icons/vi-icon.js CHANGED
@@ -444,7 +444,7 @@ new class extends _identity {
444
444
  width: 100%;
445
445
  height: 100%;
446
446
  fill: none;
447
- stroke: currentColor;
447
+ stroke: var(--vi-icon-color, currentColor);
448
448
  stroke-width: 2;
449
449
  stroke-linecap: round;
450
450
  stroke-linejoin: round;