@vialiq/web-components 0.16.0 → 0.18.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,7 +1,9 @@
1
1
  import { LitElement } from 'lit';
2
2
  type Constructor<T = object> = new (...args: any[]) => T;
3
+ export type DragContainment = 'none' | 'viewport' | 'parent';
3
4
  export declare class DraggableInterface {
4
5
  draggable: boolean;
6
+ dragContainment: DragContainment;
5
7
  protected get _dragTarget(): HTMLElement | null;
6
8
  protected get _dragHandle(): HTMLElement | null;
7
9
  protected _resetDrag(): void;
@@ -11,22 +13,11 @@ export declare class DraggableInterface {
11
13
  * DraggableMixin
12
14
  *
13
15
  * 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.
16
+ * It applies performant `transform: translate3d(x, y, 0)` positioning to `_dragTarget`.
18
17
  *
19
18
  * Subclasses MUST implement:
20
19
  * - `_dragTarget`: The HTML element that moves (usually the outer container or dialog).
21
20
  * - `_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
21
  */
31
22
  export declare function DraggableMixin<T extends Constructor<LitElement>>(Base: T): T & Constructor<DraggableInterface>;
32
23
  export {};
@@ -1 +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,GAA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A0SrC"}
@@ -1,4 +1,5 @@
1
1
  export type OverlayType = 'modal' | 'dropdown' | 'tooltip' | 'toast';
2
+ export type ScrollStrategy = 'block' | 'noop';
2
3
  /**
3
4
  * OverlayManagerService
4
5
  *
@@ -11,8 +12,7 @@ export type OverlayType = 'modal' | 'dropdown' | 'tooltip' | 'toast';
11
12
  * when a modal is active.
12
13
  */
13
14
  declare class OverlayManagerService {
14
- private _baseZIndexCache?;
15
- private get baseZIndex();
15
+ private getBaseZIndex;
16
16
  private overlays;
17
17
  private _previousOverflow;
18
18
  /**
@@ -21,9 +21,10 @@ declare class OverlayManagerService {
21
21
  *
22
22
  * @param element The DOM element being registered (e.g., the modal dialog or dropdown listbox)
23
23
  * @param type The type of overlay, used to determine behaviors like scroll-locking.
24
+ * @param scrollStrategy How this overlay interacts with background scrolling.
24
25
  * @returns The calculated z-index to be applied to the element.
25
26
  */
26
- register(element: HTMLElement, type?: OverlayType): number;
27
+ register(element: HTMLElement, type?: OverlayType, scrollStrategy?: ScrollStrategy): number;
27
28
  /**
28
29
  * Unregisters an element, removing it from the overlay stack.
29
30
  * Should be called when the overlay is closed or disconnected from the DOM.
@@ -47,9 +48,9 @@ declare class OverlayManagerService {
47
48
  */
48
49
  isTopOverlay(element: HTMLElement): boolean;
49
50
  /**
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.
51
+ * Locks or unlocks the document.body scroll based on the active overlays.
52
+ * Modals (and other overlays with scrollStrategy='block') require the body
53
+ * to be unscrollable. It applies a utility class `vi-scroll-locked` to the body.
53
54
  */
54
55
  private _updateBodyScroll;
55
56
  }
@@ -1 +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,C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AAY,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO;IAQlD;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;CAsB1B;AAGD,eAAO,MAAM,cAAc,uBAA8B,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { LitElement, TemplateResult } from 'lit';
2
+ type Constructor<T = object> = new (...args: any[]) => T;
3
+ export declare class ResizableInterface {
4
+ resizable: boolean;
5
+ minWidth: number;
6
+ minHeight: number;
7
+ maxWidth: number;
8
+ maxHeight: number;
9
+ protected get _resizeTarget(): HTMLElement | null;
10
+ protected _renderResizeHandles(): TemplateResult;
11
+ protected _resetResize(): void;
12
+ }
13
+ /**
14
+ * ResizableMixin
15
+ *
16
+ * Provides native 8-direction resize capabilities using Pointer Events.
17
+ * Applies `width` and `height` inline styles to `_resizeTarget`.
18
+ *
19
+ * **Important**: All private fields use the `_rsz_` prefix to prevent
20
+ * name collisions when composed with other mixins (e.g., DraggableMixin).
21
+ *
22
+ * Subclasses MUST implement:
23
+ * - `_resizeTarget`: The HTML element that resizes (usually the dialog box).
24
+ * - Render `${this._renderResizeHandles()}` inside the component's template.
25
+ */
26
+ export declare function ResizableMixin<T extends Constructor<LitElement>>(Base: T): T & Constructor<ResizableInterface>;
27
+ export {};
28
+ //# sourceMappingURL=resizable-mixin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizable-mixin.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/base/resizable-mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA6B,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAIjF,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,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,KAAK,aAAa,IAAI,WAAW,GAAG,IAAI,CAAC;IAClD,SAAS,CAAC,oBAAoB,IAAI,cAAc;IAChD,SAAS,CAAC,YAAY,IAAI,IAAI;CAC/B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,WAAW,CAAC,UAAU,CAAC,EAC9D,IAAI,EAAE,CAAC,GACN,CAAC,GAAG,WAAW,CAAC,kBAAkB,CAAC,CAgNrC"}
@@ -53,6 +53,8 @@ export declare class ViButton extends ViButton_base {
53
53
  accessor iconOnly: boolean;
54
54
  /** Disables the button. */
55
55
  accessor disabled: boolean;
56
+ /** Accessible label forwarded to the inner native button. */
57
+ accessor ariaLabel: string | null;
56
58
  private accessor _hasIcon;
57
59
  updated(changed: PropertyValues): void;
58
60
  private onIconSlotChange;
@@ -1 +1 @@
1
- {"version":3,"file":"vi-button.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/button/vi-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGrF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAE9F;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,KAAK,CAAC;;AAElD;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,QAAS,SAAQ,aAAyB;IACrD,OAAgB,MAAM,0BAAmC;IAEzD,cAAuB,iBAAiB,IAAI,iBAAiB,GAAG,IAAI,CAEnE;I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CAEnE;IAED,sBAAsB;IACqB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAa;IAEvF,mDAAmD;IACR,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAQ;IAE5E,sHAAsH;IAC9C,QAAQ,CAAC,aAAa,EAAE,mBAAmB,CAAW;IAE9H,0EAA0E;IACL,QAAQ,CAAC,SAAS,UAAS;IAEhG,kGAAkG;IAC9B,QAAQ,CAAC,QAAQ,UAAS;IAE9F,2BAA2B;IACiB,QAAQ,CAAC,QAAQ,UAAS;IAEtE,6DAA6D;IAC7D,SAAyD,SAAS,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEhF,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAElC,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAe/C,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,OAAO;IAON,MAAM,IAAI,cAAc;CAwBlC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
@@ -1,4 +1,4 @@
1
- import { unsafeCSS, css, html } from 'lit';
1
+ import { unsafeCSS, css, nothing, html } from 'lit';
2
2
  import { customElement, property, state } from 'lit/decorators.js';
3
3
  import { F as FocusableMixin } from '../focusable-mixin-CmxOyPX5.js';
4
4
  import { V as ViElement } from '../vi-element-C6GfDPs3.js';
@@ -380,7 +380,7 @@ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
380
380
  function _identity(x) {
381
381
  return x;
382
382
  }
383
- var _dec, _initClass, _FocusableMixin, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, /** Visual variant. */ _init_variant, /** Size scale — controls padding and font-size. */ _init_size, /** Icon placement: 'start' (before label) or 'end' (after label). CSS order handles it — no DOM changes on toggle. */ _init_iconPlacement, /** When true, stretches the button to fill the width of its container. */ _init_fullWidth, /** When true, styles the button for an icon-only layout (typically square with equal padding). */ _init_iconOnly, /** Disables the button. */ _init_disabled, _init__hasIcon, _initProto;
383
+ var _dec, _initClass, _FocusableMixin, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, /** Visual variant. */ _init_variant, /** Size scale — controls padding and font-size. */ _init_size, /** Icon placement: 'start' (before label) or 'end' (after label). CSS order handles it — no DOM changes on toggle. */ _init_iconPlacement, /** When true, stretches the button to fill the width of its container. */ _init_fullWidth, /** When true, styles the button for an icon-only layout (typically square with equal padding). */ _init_iconOnly, /** Disables the button. */ _init_disabled, /** Accessible label forwarded to the inner native button. */ _init_ariaLabel, _init__hasIcon, _initProto;
384
384
  let _ViButton;
385
385
  _dec = customElement('vi-button'), _dec1 = property({
386
386
  type: String,
@@ -403,7 +403,9 @@ _dec = customElement('vi-button'), _dec1 = property({
403
403
  }), _dec6 = property({
404
404
  type: Boolean,
405
405
  reflect: true
406
- }), _dec7 = state();
406
+ }), _dec7 = property({
407
+ attribute: 'aria-label'
408
+ }), _dec8 = state();
407
409
  new class extends _identity {
408
410
  constructor(){
409
411
  super(_ViButton), _initClass();
@@ -411,7 +413,7 @@ new class extends _identity {
411
413
  static{
412
414
  class ViButton extends (_FocusableMixin = FocusableMixin(ViElement)) {
413
415
  static{
414
- ({ e: [_init_variant, _init_size, _init_iconPlacement, _init_fullWidth, _init_iconOnly, _init_disabled, _init__hasIcon, _initProto], c: [_ViButton, _initClass] } = _apply_decs_2203_r(this, [
416
+ ({ e: [_init_variant, _init_size, _init_iconPlacement, _init_fullWidth, _init_iconOnly, _init_disabled, _init_ariaLabel, _init__hasIcon, _initProto], c: [_ViButton, _initClass] } = _apply_decs_2203_r(this, [
415
417
  [
416
418
  _dec1,
417
419
  1,
@@ -445,6 +447,11 @@ new class extends _identity {
445
447
  [
446
448
  _dec7,
447
449
  1,
450
+ "ariaLabel"
451
+ ],
452
+ [
453
+ _dec8,
454
+ 1,
448
455
  "_hasIcon"
449
456
  ]
450
457
  ], [
@@ -497,12 +504,19 @@ new class extends _identity {
497
504
  set disabled(_v) {
498
505
  this.#___private_disabled_6 = _v;
499
506
  }
500
- #___private__hasIcon_7 = _init__hasIcon(this, false);
507
+ #___private_ariaLabel_7 = _init_ariaLabel(this, null);
508
+ get ariaLabel() {
509
+ return this.#___private_ariaLabel_7;
510
+ }
511
+ set ariaLabel(_v) {
512
+ this.#___private_ariaLabel_7 = _v;
513
+ }
514
+ #___private__hasIcon_8 = _init__hasIcon(this, false);
501
515
  get _hasIcon() {
502
- return this.#___private__hasIcon_7;
516
+ return this.#___private__hasIcon_8;
503
517
  }
504
518
  set _hasIcon(_v) {
505
- this.#___private__hasIcon_7 = _v;
519
+ this.#___private__hasIcon_8 = _v;
506
520
  }
507
521
  updated(changed) {
508
522
  super.updated(changed);
@@ -539,6 +553,7 @@ new class extends _identity {
539
553
  type="button"
540
554
  tabindex="0"
541
555
  ?disabled=${disabled}
556
+ aria-label=${this.ariaLabel ?? nothing}
542
557
  @click=${onClick}
543
558
  >
544
559
  <slot
@@ -1 +1 @@
1
- {"version":3,"file":"vi-icon.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/icons/vi-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGnF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD;;;;;;;;;;;;;;;GAeG;AACH,qBACa,MAAO,SAAQ,SAAS;IACnC,OAAgB,MAAM,0BAkBpB;IAEF;;;OAGG;IACwC,QAAQ,CAAC,IAAI,SAAM;IAE9D;;;OAGG;IACyB,QAAQ,CAAC,IAAI,SAAM;IAE/C;;;;OAIG;IACyB,QAAQ,CAAC,KAAK,SAAM;IAEvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqC;IAE3D,UAAU,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;IAOnD,OAAO,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;IAchD,YAAY,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;IAOrD,MAAM,IAAI,cAAc;CAoBlC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
1
+ {"version":3,"file":"vi-icon.d.ts","sourceRoot":"","sources":["../../../../libs/web-components/src/icons/vi-icon.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGnF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD;;;;;;;;;;;;;;;GAeG;AACH,qBACa,MAAO,SAAQ,SAAS;IACnC,OAAgB,MAAM,0BA6BpB;IAEF;;;OAGG;IACwC,QAAQ,CAAC,IAAI,SAAM;IAE9D;;;OAGG;IACyB,QAAQ,CAAC,IAAI,SAAM;IAE/C;;;;OAIG;IACyB,QAAQ,CAAC,KAAK,SAAM;IAEvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAqC;IAE3D,UAAU,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;IAOnD,OAAO,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;IAchD,YAAY,CAAC,iBAAiB,EAAE,cAAc,GAAG,IAAI;IAOrD,MAAM,IAAI,cAAc;CAoBlC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,MAAM,CAAC;KACnB;CACF"}
package/icons/vi-icon.js CHANGED
@@ -438,9 +438,20 @@ new class extends _identity {
438
438
  justify-content: center;
439
439
  width: var(--vi-icon-size, 24px);
440
440
  height: var(--vi-icon-size, 24px);
441
+ line-height: 1;
442
+ }
443
+
444
+ span {
445
+ display: inline-flex;
446
+ align-items: center;
447
+ justify-content: center;
448
+ width: 100%;
449
+ height: 100%;
450
+ line-height: 1;
441
451
  }
442
452
 
443
453
  svg {
454
+ display: block;
444
455
  width: 100%;
445
456
  height: 100%;
446
457
  fill: none;
package/index.d.ts CHANGED
@@ -30,6 +30,8 @@ export type { ChipVariant, ChipSize } from './chip/vi-chip.js';
30
30
  export { ViChipGroup } from './chip/vi-chip-group.js';
31
31
  export { ViAnimation } from './animation/vi-animation.js';
32
32
  export type { AnimationPreset, StaggerDirection, AnimationPhase, ViAnimationEventDetail, } from './animation/vi-animation.js';
33
+ export { ViTag } from './tag/vi-tag.js';
34
+ export type { TagVariant, TagAppearance, TagSize } from './tag/vi-tag.js';
33
35
  export { ViSwitch } from './switch/vi-switch.js';
34
36
  export type { SwitchSize, LabelPlacement } from './switch/vi-switch.js';
35
37
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { V as ViElement } from './vi-element-C6GfDPs3.js';
1
+ export { V as ViElement } from './vi-element-C6GfDPs3.js';
2
2
  export { ViButton } from './button/vi-button.js';
3
3
  export { ViInput } from './input/vi-input.js';
4
4
  export { ViIcon } from './icons/vi-icon.js';
@@ -15,635 +15,5 @@ export { ViAlert } from './alert/vi-alert.js';
15
15
  export { ViChip } from './chip/vi-chip.js';
16
16
  export { ViChipGroup } from './chip/vi-chip-group.js';
17
17
  export { ViAnimation } from './animation/vi-animation.js';
18
- import { unsafeCSS, css, nothing, html } from 'lit';
19
- import { customElement, property } from 'lit/decorators.js';
20
- import { F as FocusableMixin } from './focusable-mixin-CmxOyPX5.js';
21
- import { V as ValidityMixin } from './validity-mixin-DO0ycRH2.js';
22
- import { classMap } from 'lit/directives/class-map.js';
23
-
24
- const switchStyles = "@charset \"UTF-8\";@layer reset,components,utilities;@layer components{.switch-wrapper{display:inline-flex;align-items:flex-start;gap:var(--vi-switch-label-gap, 8px);cursor:pointer;font-family:var(--vi-font-family-base, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);font-size:var(--vi-switch-label-font-size, var(--vi-font-size-base, 16px));line-height:var(--vi-line-height-normal, 1.5);color:var(--vi-switch-label-color, var(--vi-text-primary, #111827));-webkit-user-select:none;user-select:none}.switch-label{flex:1 1 auto;min-width:0;word-break:break-word;overflow-wrap:break-word}.switch-input{position:absolute!important;clip-path:inset(50%)!important;overflow:hidden!important;width:1px!important;height:1px!important;margin:-1px!important;padding:0!important;border:0!important;white-space:nowrap!important}.switch-track{box-sizing:border-box;position:relative;width:var(--vi-switch-track-width, 44px);height:var(--vi-switch-track-height, 24px);background-color:var(--vi-switch-track-color-off, var(--vi-border-03, #e0e0e0));border-radius:var(--vi-border-radius-full, 9999px);transition:background-color var(--vi-switch-transition-duration, .15s) ease;flex-shrink:0;margin-top:calc((1em * var(--vi-line-height-normal, 1.5) - var(--vi-switch-track-height, 24px)) / 2)}.switch-thumb{position:absolute;top:50%;left:var(--vi-switch-thumb-offset, 2px);transform:translateY(-50%);width:var(--vi-switch-thumb-size, 18px);height:var(--vi-switch-thumb-size, 18px);background-color:var(--vi-switch-thumb-color, var(--vi-text-primary-inverse, #ffffff));border-radius:50%;box-shadow:var(--vi-switch-thumb-shadow, 0 1px 3px rgba(0, 0, 0, .2));transition:left var(--vi-switch-transition-duration, .15s) ease}.switch-input:checked~.switch-track{background-color:var(--vi-switch-track-color-on, var(--vi-color-primary, #3676d0))}.switch-input:checked~.switch-track .switch-thumb{left:calc(100% - var(--vi-switch-thumb-size, 18px) - var(--vi-switch-thumb-offset, 2px))}.switch-input:focus-visible~.switch-track{outline:var(--vi-border-width-base, 2px) solid var(--vi-switch-focus-ring-color, var(--vi-focus, #3676d0));outline-offset:2px;box-shadow:0 0 0 3px var(--vi-switch-focus-ring-glow, var(--vi-color-blue-200, #cee6ff))}.switch-wrapper--disabled{cursor:not-allowed;opacity:var(--vi-switch-disabled-opacity, .5)}.switch-wrapper--disabled .switch-track{background-color:var(--vi-border-03, #e0e0e0)}.switch-wrapper--disabled .switch-input:checked~.switch-track{background-color:var(--vi-text-disabled, #9e9e9e)}@media(prefers-reduced-motion:reduce){.switch-track,.switch-thumb{transition:none}}}:host{display:inline-block;outline:none}:host([disabled]){cursor:not-allowed;pointer-events:none}::slotted(*){font-family:inherit;font-size:inherit;color:inherit}:host([size=sm]){--vi-switch-track-width: 36px;--vi-switch-track-height: 20px;--vi-switch-thumb-size: 14px}:host([size=md]){--vi-switch-track-width: 44px;--vi-switch-track-height: 24px;--vi-switch-thumb-size: 18px}:host([size=lg]){--vi-switch-track-width: 52px;--vi-switch-track-height: 28px;--vi-switch-thumb-size: 22px}";
25
-
26
- function applyDecs2203RFactory() {
27
- function createAddInitializerMethod(initializers, decoratorFinishedRef) {
28
- return function addInitializer(initializer) {
29
- assertNotFinished(decoratorFinishedRef, "addInitializer");
30
- assertCallable(initializer, "An initializer");
31
- initializers.push(initializer);
32
- };
33
- }
34
- function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
35
- var kindStr;
36
- switch(kind){
37
- case 1:
38
- kindStr = "accessor";
39
- break;
40
- case 2:
41
- kindStr = "method";
42
- break;
43
- case 3:
44
- kindStr = "getter";
45
- break;
46
- case 4:
47
- kindStr = "setter";
48
- break;
49
- default:
50
- kindStr = "field";
51
- }
52
- var ctx = {
53
- kind: kindStr,
54
- name: isPrivate ? "#" + name : name,
55
- static: isStatic,
56
- private: isPrivate,
57
- metadata: metadata
58
- };
59
- var decoratorFinishedRef = {
60
- v: false
61
- };
62
- ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
63
- var get, set;
64
- if (kind === 0) {
65
- if (isPrivate) {
66
- get = desc.get;
67
- set = desc.set;
68
- } else {
69
- get = function() {
70
- return this[name];
71
- };
72
- set = function(v) {
73
- this[name] = v;
74
- };
75
- }
76
- } else if (kind === 2) {
77
- get = function() {
78
- return desc.value;
79
- };
80
- } else {
81
- if (kind === 1 || kind === 3) {
82
- get = function() {
83
- return desc.get.call(this);
84
- };
85
- }
86
- if (kind === 1 || kind === 4) {
87
- set = function(v) {
88
- desc.set.call(this, v);
89
- };
90
- }
91
- }
92
- ctx.access = get && set ? {
93
- get: get,
94
- set: set
95
- } : get ? {
96
- get: get
97
- } : {
98
- set: set
99
- };
100
- try {
101
- return dec(value, ctx);
102
- } finally{
103
- decoratorFinishedRef.v = true;
104
- }
105
- }
106
- function assertNotFinished(decoratorFinishedRef, fnName) {
107
- if (decoratorFinishedRef.v) {
108
- throw new Error("attempted to call " + fnName + " after decoration was finished");
109
- }
110
- }
111
- function assertCallable(fn, hint) {
112
- if (typeof fn !== "function") {
113
- throw new TypeError(hint + " must be a function");
114
- }
115
- }
116
- function assertValidReturnValue(kind, value) {
117
- var type = typeof value;
118
- if (kind === 1) {
119
- if (type !== "object" || value === null) {
120
- throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
121
- }
122
- if (value.get !== undefined) {
123
- assertCallable(value.get, "accessor.get");
124
- }
125
- if (value.set !== undefined) {
126
- assertCallable(value.set, "accessor.set");
127
- }
128
- if (value.init !== undefined) {
129
- assertCallable(value.init, "accessor.init");
130
- }
131
- } else if (type !== "function") {
132
- var hint;
133
- if (kind === 0) {
134
- hint = "field";
135
- } else if (kind === 10) {
136
- hint = "class";
137
- } else {
138
- hint = "method";
139
- }
140
- throw new TypeError(hint + " decorators must return a function or void 0");
141
- }
142
- }
143
- function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
144
- var decs = decInfo[0];
145
- var desc, init, value;
146
- if (isPrivate) {
147
- if (kind === 0 || kind === 1) {
148
- desc = {
149
- get: decInfo[3],
150
- set: decInfo[4]
151
- };
152
- } else if (kind === 3) {
153
- desc = {
154
- get: decInfo[3]
155
- };
156
- } else if (kind === 4) {
157
- desc = {
158
- set: decInfo[3]
159
- };
160
- } else {
161
- desc = {
162
- value: decInfo[3]
163
- };
164
- }
165
- } else if (kind !== 0) {
166
- desc = Object.getOwnPropertyDescriptor(base, name);
167
- }
168
- if (kind === 1) {
169
- value = {
170
- get: desc.get,
171
- set: desc.set
172
- };
173
- } else if (kind === 2) {
174
- value = desc.value;
175
- } else if (kind === 3) {
176
- value = desc.get;
177
- } else if (kind === 4) {
178
- value = desc.set;
179
- }
180
- var newValue, get, set;
181
- if (typeof decs === "function") {
182
- newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
183
- if (newValue !== void 0) {
184
- assertValidReturnValue(kind, newValue);
185
- if (kind === 0) {
186
- init = newValue;
187
- } else if (kind === 1) {
188
- init = newValue.init;
189
- get = newValue.get || value.get;
190
- set = newValue.set || value.set;
191
- value = {
192
- get: get,
193
- set: set
194
- };
195
- } else {
196
- value = newValue;
197
- }
198
- }
199
- } else {
200
- for(var i = decs.length - 1; i >= 0; i--){
201
- var dec = decs[i];
202
- newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
203
- if (newValue !== void 0) {
204
- assertValidReturnValue(kind, newValue);
205
- var newInit;
206
- if (kind === 0) {
207
- newInit = newValue;
208
- } else if (kind === 1) {
209
- newInit = newValue.init;
210
- get = newValue.get || value.get;
211
- set = newValue.set || value.set;
212
- value = {
213
- get: get,
214
- set: set
215
- };
216
- } else {
217
- value = newValue;
218
- }
219
- if (newInit !== void 0) {
220
- if (init === void 0) {
221
- init = newInit;
222
- } else if (typeof init === "function") {
223
- init = [
224
- init,
225
- newInit
226
- ];
227
- } else {
228
- init.push(newInit);
229
- }
230
- }
231
- }
232
- }
233
- }
234
- if (kind === 0 || kind === 1) {
235
- if (init === void 0) {
236
- init = function(instance, init) {
237
- return init;
238
- };
239
- } else if (typeof init !== "function") {
240
- var ownInitializers = init;
241
- init = function(instance, init) {
242
- var value = init;
243
- for(var i = 0; i < ownInitializers.length; i++){
244
- value = ownInitializers[i].call(instance, value);
245
- }
246
- return value;
247
- };
248
- } else {
249
- var originalInitializer = init;
250
- init = function(instance, init) {
251
- return originalInitializer.call(instance, init);
252
- };
253
- }
254
- ret.push(init);
255
- }
256
- if (kind !== 0) {
257
- if (kind === 1) {
258
- desc.get = value.get;
259
- desc.set = value.set;
260
- } else if (kind === 2) {
261
- desc.value = value;
262
- } else if (kind === 3) {
263
- desc.get = value;
264
- } else if (kind === 4) {
265
- desc.set = value;
266
- }
267
- if (isPrivate) {
268
- if (kind === 1) {
269
- ret.push(function(instance, args) {
270
- return value.get.call(instance, args);
271
- });
272
- ret.push(function(instance, args) {
273
- return value.set.call(instance, args);
274
- });
275
- } else if (kind === 2) {
276
- ret.push(value);
277
- } else {
278
- ret.push(function(instance, args) {
279
- return value.call(instance, args);
280
- });
281
- }
282
- } else {
283
- Object.defineProperty(base, name, desc);
284
- }
285
- }
286
- }
287
- function applyMemberDecs(Class, decInfos, metadata) {
288
- var ret = [];
289
- var protoInitializers;
290
- var staticInitializers;
291
- var existingProtoNonFields = new Map();
292
- var existingStaticNonFields = new Map();
293
- for(var i = 0; i < decInfos.length; i++){
294
- var decInfo = decInfos[i];
295
- if (!Array.isArray(decInfo)) continue;
296
- var kind = decInfo[1];
297
- var name = decInfo[2];
298
- var isPrivate = decInfo.length > 3;
299
- var isStatic = kind >= 5;
300
- var base;
301
- var initializers;
302
- if (isStatic) {
303
- base = Class;
304
- kind = kind - 5;
305
- staticInitializers = staticInitializers || [];
306
- initializers = staticInitializers;
307
- } else {
308
- base = Class.prototype;
309
- protoInitializers = protoInitializers || [];
310
- initializers = protoInitializers;
311
- }
312
- if (kind !== 0 && !isPrivate) {
313
- var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
314
- var existingKind = existingNonFields.get(name) || 0;
315
- if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
316
- throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
317
- } else if (!existingKind && kind > 2) {
318
- existingNonFields.set(name, kind);
319
- } else {
320
- existingNonFields.set(name, true);
321
- }
322
- }
323
- applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
324
- }
325
- pushInitializers(ret, protoInitializers);
326
- pushInitializers(ret, staticInitializers);
327
- return ret;
328
- }
329
- function pushInitializers(ret, initializers) {
330
- if (initializers) {
331
- ret.push(function(instance) {
332
- for(var i = 0; i < initializers.length; i++){
333
- initializers[i].call(instance);
334
- }
335
- return instance;
336
- });
337
- }
338
- }
339
- function applyClassDecs(targetClass, classDecs, metadata) {
340
- if (classDecs.length > 0) {
341
- var initializers = [];
342
- var newClass = targetClass;
343
- var name = targetClass.name;
344
- for(var i = classDecs.length - 1; i >= 0; i--){
345
- var decoratorFinishedRef = {
346
- v: false
347
- };
348
- try {
349
- var nextNewClass = classDecs[i](newClass, {
350
- kind: "class",
351
- name: name,
352
- addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
353
- metadata
354
- });
355
- } finally{
356
- decoratorFinishedRef.v = true;
357
- }
358
- if (nextNewClass !== undefined) {
359
- assertValidReturnValue(10, nextNewClass);
360
- newClass = nextNewClass;
361
- }
362
- }
363
- return [
364
- defineMetadata(newClass, metadata),
365
- function() {
366
- for(var i = 0; i < initializers.length; i++){
367
- initializers[i].call(newClass);
368
- }
369
- }
370
- ];
371
- }
372
- }
373
- function defineMetadata(Class, metadata) {
374
- return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
375
- configurable: true,
376
- enumerable: true,
377
- value: metadata
378
- });
379
- }
380
- return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
381
- if (parentClass !== void 0) {
382
- var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
383
- }
384
- var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
385
- var e = applyMemberDecs(targetClass, memberDecs, metadata);
386
- if (!classDecs.length) defineMetadata(targetClass, metadata);
387
- return {
388
- e: e,
389
- get c () {
390
- return applyClassDecs(targetClass, classDecs, metadata);
391
- }
392
- };
393
- };
394
- }
395
- function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
396
- return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
397
- }
398
- function _identity(x) {
399
- return x;
400
- }
401
- var _dec, _initClass, _ValidityMixin, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, // ── ValidityMixin contract ───────────────────────────────────────────────
402
- _init_status, _init_required, _init_validityMessage, // ── Public API ────────────────────────────────────────────────────────────
403
- /** Checked state. */ _init_checked, /** Size scale — controls size, padding, and font-size. */ _init_size, /** Label position relative to switch. */ _init_labelPlacement, /** Form submission value when checked. */ _init_value, /** Form field name. */ _init_name, /** Disables the switch. */ _init_disabled, _initProto;
404
- let _ViSwitch;
405
- _dec = customElement('vi-switch'), _dec1 = property({
406
- reflect: true
407
- }), _dec2 = property({
408
- type: Boolean,
409
- reflect: true
410
- }), _dec3 = property(), _dec4 = property({
411
- type: Boolean,
412
- reflect: true
413
- }), _dec5 = property({
414
- type: String,
415
- reflect: true
416
- }), _dec6 = property({
417
- type: String,
418
- reflect: true,
419
- attribute: 'label-placement'
420
- }), _dec7 = property(), _dec8 = property(), _dec9 = property({
421
- type: Boolean,
422
- reflect: true
423
- });
424
- new class extends _identity {
425
- constructor(){
426
- super(_ViSwitch), _initClass();
427
- }
428
- static{
429
- class ViSwitch extends (_ValidityMixin = ValidityMixin(FocusableMixin(ViElement))) {
430
- static{
431
- ({ e: [_init_status, _init_required, _init_validityMessage, _init_checked, _init_size, _init_labelPlacement, _init_value, _init_name, _init_disabled, _initProto], c: [_ViSwitch, _initClass] } = _apply_decs_2203_r(this, [
432
- [
433
- _dec1,
434
- 1,
435
- "status"
436
- ],
437
- [
438
- _dec2,
439
- 1,
440
- "required"
441
- ],
442
- [
443
- _dec3,
444
- 1,
445
- "validityMessage"
446
- ],
447
- [
448
- _dec4,
449
- 1,
450
- "checked"
451
- ],
452
- [
453
- _dec5,
454
- 1,
455
- "size"
456
- ],
457
- [
458
- _dec6,
459
- 1,
460
- "labelPlacement"
461
- ],
462
- [
463
- _dec7,
464
- 1,
465
- "value"
466
- ],
467
- [
468
- _dec8,
469
- 1,
470
- "name"
471
- ],
472
- [
473
- _dec9,
474
- 1,
475
- "disabled"
476
- ]
477
- ], [
478
- _dec
479
- ], _ValidityMixin));
480
- }
481
- static styles = css`
482
- ${unsafeCSS(switchStyles)}
483
- `;
484
- _initialChecked = (_initProto(this), false);
485
- get _focusableElement() {
486
- return this.shadowRoot?.querySelector('input') ?? null;
487
- }
488
- #___private_status_1 = _init_status(this, 'default');
489
- get status() {
490
- return this.#___private_status_1;
491
- }
492
- set status(_v) {
493
- this.#___private_status_1 = _v;
494
- }
495
- #___private_required_2 = _init_required(this, false);
496
- get required() {
497
- return this.#___private_required_2;
498
- }
499
- set required(_v) {
500
- this.#___private_required_2 = _v;
501
- }
502
- #___private_validityMessage_3 = _init_validityMessage(this, '');
503
- get validityMessage() {
504
- return this.#___private_validityMessage_3;
505
- }
506
- set validityMessage(_v) {
507
- this.#___private_validityMessage_3 = _v;
508
- }
509
- #___private_checked_4 = _init_checked(this, false);
510
- get checked() {
511
- return this.#___private_checked_4;
512
- }
513
- set checked(_v) {
514
- this.#___private_checked_4 = _v;
515
- }
516
- #___private_size_5 = _init_size(this, 'md');
517
- get size() {
518
- return this.#___private_size_5;
519
- }
520
- set size(_v) {
521
- this.#___private_size_5 = _v;
522
- }
523
- #___private_labelPlacement_6 = _init_labelPlacement(this, 'end');
524
- get labelPlacement() {
525
- return this.#___private_labelPlacement_6;
526
- }
527
- set labelPlacement(_v) {
528
- this.#___private_labelPlacement_6 = _v;
529
- }
530
- #___private_value_7 = _init_value(this, 'on');
531
- get value() {
532
- return this.#___private_value_7;
533
- }
534
- set value(_v) {
535
- this.#___private_value_7 = _v;
536
- }
537
- #___private_name_8 = _init_name(this, '');
538
- get name() {
539
- return this.#___private_name_8;
540
- }
541
- set name(_v) {
542
- this.#___private_name_8 = _v;
543
- }
544
- #___private_disabled_9 = _init_disabled(this, false);
545
- get disabled() {
546
- return this.#___private_disabled_9;
547
- }
548
- set disabled(_v) {
549
- this.#___private_disabled_9 = _v;
550
- }
551
- // ── ValidityMixin hook ───────────────────────────────────────────────────
552
- _testValidity() {
553
- const input = this._focusableElement;
554
- if (input) {
555
- if (input.checked !== this.checked) {
556
- input.checked = this.checked;
557
- }
558
- const validity = input.validity;
559
- if (!validity.valid) {
560
- this.validityMessage = input.validationMessage;
561
- return {
562
- customError: validity.customError
563
- };
564
- }
565
- }
566
- this.validityMessage = '';
567
- return {};
568
- }
569
- // ── Lifecycle ──────────────────────────────────────────────────────────────
570
- connectedCallback() {
571
- super.connectedCallback();
572
- this._initialChecked = this.hasAttribute('checked');
573
- }
574
- updated(changed) {
575
- super.updated(changed);
576
- // Sync form value for form submission participation
577
- if (changed.has('checked') || changed.has('value')) {
578
- this._internals.setFormValue(this.checked ? this.value : null);
579
- }
580
- // Centralize host focusability via FocusableMixin
581
- if (changed.has('disabled')) {
582
- this._setHostFocusable(!this.disabled);
583
- }
584
- }
585
- /** Resets value and validation state when the associated form resets. */ formResetCallback() {
586
- this.checked = this._initialChecked;
587
- this.status = 'default';
588
- this.validityMessage = '';
589
- }
590
- /** Keeps disabled in sync when a containing fieldset or form is disabled. */ formDisabledCallback(disabled) {
591
- this.disabled = disabled;
592
- }
593
- // ── Event Handlers ─────────────────────────────────────────────────────────
594
- _onChange(e) {
595
- e.stopPropagation();
596
- if (this.disabled) return;
597
- const input = e.target;
598
- this.checked = input.checked;
599
- this.dispatchEvent(new CustomEvent('vi-switch-change', {
600
- detail: {
601
- checked: this.checked
602
- },
603
- bubbles: true,
604
- composed: true
605
- }));
606
- }
607
- // ── Render ─────────────────────────────────────────────────────────────────
608
- render() {
609
- const isValDisabled = this.disabled;
610
- const inputClasses = classMap({
611
- 'switch-input': true,
612
- 'sr-only': true
613
- });
614
- const wrapperClasses = classMap({
615
- 'switch-wrapper': true,
616
- 'switch-wrapper--disabled': isValDisabled
617
- });
618
- return html`
619
- <label class=${wrapperClasses} data-placement=${this.labelPlacement}>
620
- ${this.labelPlacement === 'start' ? html`
621
- <span part="label" class="switch-label"><slot></slot></span>
622
- ` : nothing}
623
-
624
- <input
625
- type="checkbox"
626
- role="switch"
627
- class=${inputClasses}
628
- .name=${this.name}
629
- .value=${this.value}
630
- ?checked=${this.checked}
631
- ?disabled=${isValDisabled}
632
- aria-checked=${this.checked ? 'true' : 'false'}
633
- @change=${this._onChange}
634
- />
635
- <span part="track" class="switch-track" aria-hidden="true">
636
- <span part="thumb" class="switch-thumb"></span>
637
- </span>
638
-
639
- ${this.labelPlacement === 'end' ? html`
640
- <span part="label" class="switch-label"><slot></slot></span>
641
- ` : nothing}
642
- </label>
643
- `;
644
- }
645
- }
646
- }
647
- }();
648
-
649
- export { ViElement, _ViSwitch as ViSwitch };
18
+ export { ViTag } from './tag/vi-tag.js';
19
+ export { ViSwitch } from './switch/vi-switch.js';
@@ -1,48 +1,49 @@
1
1
  /**
2
2
  * OverlayManagerService
3
- *
4
- * A singleton service responsible for managing the z-index stacking context
3
+ *
4
+ * A singleton service responsible for managing the z-index stacking context
5
5
  * of all floating elements (Modals, Dropdowns, Tooltips, Toasts) across the application.
6
- *
7
- * It ensures that newly opened overlays always appear on top of existing ones by
6
+ *
7
+ * It ensures that newly opened overlays always appear on top of existing ones by
8
8
  * maintaining a registry and dynamically calculating the next highest z-index.
9
- * It also manages global state side-effects, such as locking `document.body` scroll
9
+ * It also manages global state side-effects, such as locking `document.body` scroll
10
10
  * when a modal is active.
11
11
  */ class OverlayManagerService {
12
- _baseZIndexCache;
13
- get baseZIndex() {
14
- if (this._baseZIndexCache !== undefined) return this._baseZIndexCache;
12
+ getBaseZIndex(element) {
15
13
  if (typeof document !== 'undefined' && typeof getComputedStyle !== 'undefined') {
16
14
  // Derive base stacking context from the modal z-index token (minus 10 to start slightly below it)
17
- const cssVar = getComputedStyle(document.documentElement).getPropertyValue('--vi-modal-z-index').trim();
15
+ // Read directly from the element if provided to support CSS variable scoping/theming.
16
+ const target = element || document.documentElement;
17
+ const cssVar = getComputedStyle(target).getPropertyValue('--vi-modal-z-index').trim();
18
18
  const parsed = parseInt(cssVar, 10);
19
- this._baseZIndexCache = !isNaN(parsed) ? parsed - 10 : 1040;
20
- } else {
21
- this._baseZIndexCache = 1040;
19
+ return !isNaN(parsed) ? parsed - 10 : 1040;
22
20
  }
23
- return this._baseZIndexCache;
21
+ return 1040;
24
22
  }
25
23
  overlays = [];
26
24
  _previousOverflow = null;
27
25
  /**
28
26
  * Registers an element as an active overlay.
29
27
  * Calculates and returns the appropriate z-index for this overlay.
30
- *
28
+ *
31
29
  * @param element The DOM element being registered (e.g., the modal dialog or dropdown listbox)
32
30
  * @param type The type of overlay, used to determine behaviors like scroll-locking.
31
+ * @param scrollStrategy How this overlay interacts with background scrolling.
33
32
  * @returns The calculated z-index to be applied to the element.
34
- */ register(element, type = 'dropdown') {
33
+ */ register(element, type = 'dropdown', scrollStrategy) {
35
34
  this.unregister(element); // Ensure no duplicates
36
- let highestZIndex = this.baseZIndex;
35
+ let highestZIndex = this.getBaseZIndex(element);
37
36
  if (this.overlays.length > 0) {
38
- highestZIndex = Math.max(...this.overlays.map((o)=>o.zIndex));
37
+ highestZIndex = Math.max(...this.overlays.map((o)=>o.zIndex), highestZIndex);
39
38
  }
40
39
  // Increment by 10 to allow room for backdrops (which typically sit at z-index - 1)
41
40
  const newZIndex = highestZIndex + 10;
41
+ const finalStrategy = scrollStrategy ?? (type === 'modal' ? 'block' : 'noop');
42
42
  this.overlays.push({
43
43
  element,
44
44
  type,
45
- zIndex: newZIndex
45
+ zIndex: newZIndex,
46
+ scrollStrategy: finalStrategy
46
47
  });
47
48
  this._updateBodyScroll();
48
49
  return newZIndex;
@@ -50,7 +51,7 @@
50
51
  /**
51
52
  * Unregisters an element, removing it from the overlay stack.
52
53
  * Should be called when the overlay is closed or disconnected from the DOM.
53
- *
54
+ *
54
55
  * @param element The DOM element to unregister.
55
56
  */ unregister(element) {
56
57
  this.overlays = this.overlays.filter((o)=>o.element !== element);
@@ -58,7 +59,7 @@
58
59
  }
59
60
  /**
60
61
  * Gets the assigned z-index for an element if it is currently registered.
61
- *
62
+ *
62
63
  * @param element The DOM element to query.
63
64
  * @returns The z-index number, or null if the element is not registered.
64
65
  */ getZIndex(element) {
@@ -68,7 +69,7 @@
68
69
  /**
69
70
  * Evaluates whether the provided element is currently the top-most active overlay.
70
71
  * Useful for trapping focus or handling global Escape key presses.
71
- *
72
+ *
72
73
  * @param element The DOM element to check.
73
74
  * @returns True if the element has the highest z-index in the registry.
74
75
  */ isTopOverlay(element) {
@@ -77,12 +78,12 @@
77
78
  return topOverlay.element === element;
78
79
  }
79
80
  /**
80
- * Locks or unlocks the document.body scroll based on the presence of modals.
81
- * Modals require the body to be unscrollable to trap scroll inside the modal.
82
- * It applies a utility class `vi-scroll-locked` to the body.
81
+ * Locks or unlocks the document.body scroll based on the active overlays.
82
+ * Modals (and other overlays with scrollStrategy='block') require the body
83
+ * to be unscrollable. It applies a utility class `vi-scroll-locked` to the body.
83
84
  */ _updateBodyScroll() {
84
- const hasModal = this.overlays.some((o)=>o.type === 'modal');
85
- if (hasModal) {
85
+ const hasBlock = this.overlays.some((o)=>o.scrollStrategy === 'block');
86
+ if (hasBlock) {
86
87
  // Prevent double-setting if already locked
87
88
  if (!document.body.classList.contains('vi-scroll-locked')) {
88
89
  document.body.classList.add('vi-scroll-locked');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vialiq/web-components",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -103,8 +103,8 @@
103
103
  },
104
104
  "peerDependencies": {
105
105
  "@floating-ui/dom": ">=1.0.0",
106
- "@vialiq/flux-ui": "^0.13.0",
107
- "@vialiq/icons": "^0.3.0",
106
+ "@vialiq/flux-ui": ">=0.0.4 <0.1.0",
107
+ "@vialiq/icons": ">=0.0.3 <0.1.0",
108
108
  "lit": "^3.0.0"
109
109
  },
110
110
  "keywords": [
@@ -2,7 +2,7 @@ import { unsafeCSS, css, nothing, html } from 'lit';
2
2
  import { customElement, property, state, query } from 'lit/decorators.js';
3
3
  import { V as ViElement } from '../vi-element-C6GfDPs3.js';
4
4
  import { autoUpdate, offset, flip, shift, arrow, computePosition } from '@floating-ui/dom';
5
- import { O as OverlayManager } from '../overlay-manager-CZSDXl6Z.js';
5
+ import { O as OverlayManager } from '../overlay-manager-xco6S92C.js';
6
6
 
7
7
  const tooltipStyles = "@charset \"UTF-8\";@layer reset,components,utilities;.tooltip-panel{position:fixed;z-index:var(--vi-tooltip-z-index, var(--vi-tooltip-z-index, 1070));pointer-events:none;opacity:0;transform:scale(.95);transition:opacity .15s ease-out,transform .15s ease-out;margin:0;border:none;background:transparent;padding:0;overflow:visible;font-family:var(--vi-font-family-base, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif)}.tooltip-panel[popover]:popover-open{display:block;pointer-events:auto;opacity:1;transform:scale(1)}.tooltip-panel{transition-property:opacity,transform,display,overlay;transition-behavior:allow-discrete}@media(prefers-reduced-motion:reduce){.tooltip-panel{transition:none;transform:none}}.tooltip-content{background-color:var(--vi-tooltip-background, var(--vi-layer-inverse, #111827));color:var(--vi-tooltip-color, var(--vi-text-primary-inverse, #ffffff));font-size:var(--vi-tooltip-font-size, 12px);line-height:1.4;padding:var(--vi-tooltip-padding, 6px 10px);border-radius:var(--vi-tooltip-border-radius, 4px);box-shadow:var(--vi-tooltip-shadow, var(--vi-shadow-md, 0 4px 6px -1px rgba(0, 0, 0, .1)));max-width:var(--vi-tooltip-max-width, 240px);word-wrap:break-word;white-space:normal;position:relative}.tooltip-arrow{position:absolute;width:0;height:0;border-style:solid;border-color:transparent;pointer-events:none}.tooltip-panel[placement^=top] .tooltip-arrow,.tooltip-panel[data-placement^=top] .tooltip-arrow{bottom:calc(-1 * var(--vi-tooltip-arrow-size, 6px));left:50%;transform:translate(-50%);border-width:var(--vi-tooltip-arrow-size, 6px) var(--vi-tooltip-arrow-size, 6px) 0;border-top-color:var(--vi-tooltip-background, var(--vi-layer-inverse, #111827))}.tooltip-panel[placement^=bottom] .tooltip-arrow,.tooltip-panel[data-placement^=bottom] .tooltip-arrow{top:calc(-1 * var(--vi-tooltip-arrow-size, 6px));left:50%;transform:translate(-50%);border-width:0 var(--vi-tooltip-arrow-size, 6px) var(--vi-tooltip-arrow-size, 6px);border-bottom-color:var(--vi-tooltip-background, var(--vi-layer-inverse, #111827))}.tooltip-panel[placement=left] .tooltip-arrow,.tooltip-panel[data-placement=left] .tooltip-arrow{right:calc(-1 * var(--vi-tooltip-arrow-size, 6px));top:50%;transform:translateY(-50%);border-width:var(--vi-tooltip-arrow-size, 6px) 0 var(--vi-tooltip-arrow-size, 6px) var(--vi-tooltip-arrow-size, 6px);border-left-color:var(--vi-tooltip-background, var(--vi-layer-inverse, #111827))}.tooltip-panel[placement=right] .tooltip-arrow,.tooltip-panel[data-placement=right] .tooltip-arrow{left:calc(-1 * var(--vi-tooltip-arrow-size, 6px));top:50%;transform:translateY(-50%);border-width:var(--vi-tooltip-arrow-size, 6px) var(--vi-tooltip-arrow-size, 6px) var(--vi-tooltip-arrow-size, 6px) 0;border-right-color:var(--vi-tooltip-background, var(--vi-layer-inverse, #111827))}.tooltip-panel[placement$=-start] .tooltip-arrow,.tooltip-panel[data-placement$=-start] .tooltip-arrow{left:12px;transform:none}.tooltip-panel[placement$=-end] .tooltip-arrow,.tooltip-panel[data-placement$=-end] .tooltip-arrow{left:auto;right:12px;transform:none}:host{display:inline-block}";
8
8