@vialiq/web-components 0.8.1 → 0.10.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.
package/index.js CHANGED
@@ -2,7 +2,8 @@ import { 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';
5
- export { getIcon, registerIcons } from './icons/registry.js';
5
+ import { registerIcons } from './icons/registry.js';
6
+ export { getIcon } from './icons/registry.js';
6
7
  export { ViRadio } from './radio/vi-radio.js';
7
8
  export { ViRadioGroup } from './radio/vi-radio-group.js';
8
9
  export { ViCheckbox } from './checkbox/vi-checkbox.js';
@@ -11,11 +12,13 @@ export { ViTextarea } from './textarea/vi-textarea.js';
11
12
  export { ViAccordion } from './accordion/vi-accordion.js';
12
13
  export { ViAccordionItem } from './accordion/vi-accordion-item.js';
13
14
  import { unsafeCSS, css, html } from 'lit';
14
- import { customElement, property, state } from 'lit/decorators.js';
15
+ import { customElement, property, state, queryAssignedElements } from 'lit/decorators.js';
16
+ import { F as FocusableMixin } from './focusable-mixin-CmxOyPX5.js';
17
+ import { V as ValidityMixin } from './validity-mixin-H4aOFJEr.js';
15
18
 
16
19
  const badgeStyles = "@charset \"UTF-8\";@layer reset,components,utilities;@layer components{.badge{display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;box-sizing:border-box;font-size:var(--vi-badge-font-size, 11px);font-weight:var(--vi-badge-font-weight, var(--vi-font-weight-semibold, 600));padding:var(--vi-badge-padding, 2px 8px);border-radius:var(--vi-badge-border-radius, 9999px);gap:var(--vi-badge-gap, 4px);border:var(--vi-border-width-thin, 1px) solid transparent}.dot{display:inline-block;width:var(--vi-badge-dot-size, 8px);height:var(--vi-badge-dot-size, 8px);border-radius:50%;background-color:currentColor;flex-shrink:0}.icon{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}}:host{display:inline-block;vertical-align:middle}:host([hidden]),:host([count=\"0\"]:not([show-zero])){display:none!important}:host([size=sm]){--vi-badge-font-size: 10px;--vi-badge-padding: 0 6px;--vi-badge-gap: 2px;--vi-badge-dot-size: 6px}:host([size=md]){--vi-badge-font-size: 11px;--vi-badge-padding: 2px 8px;--vi-badge-gap: 4px;--vi-badge-dot-size: 8px}:host([size=lg]){--vi-badge-font-size: 13px;--vi-badge-padding: 4px 12px;--vi-badge-gap: 6px;--vi-badge-dot-size: 10px}:host([pill]){--vi-badge-border-radius: 9999px}:host(:not([pill])){--vi-badge-border-radius: var(--vi-border-radius-sm, 2px)}.badge.dot-only{--vi-badge-padding: 4px}:host([variant=neutral]) .badge{background-color:var(--vi-badge-neutral-bg, var(--vi-border-02, #eeeeee));color:var(--vi-badge-neutral-color, var(--vi-text-secondary, #4b5563))}:host([variant=primary]) .badge{background-color:var(--vi-badge-primary-bg, var(--vi-bg-info, #e3f2fd));color:var(--vi-badge-primary-color, var(--vi-text-info, #3676d0))}:host([variant=success]) .badge{background-color:var(--vi-badge-success-bg, var(--vi-bg-success, #e6f9f0));color:var(--vi-badge-success-color, var(--vi-text-success, #265a3d))}:host([variant=warning]) .badge{background-color:var(--vi-badge-warning-bg, var(--vi-bg-warning, #fff8e1));color:var(--vi-badge-warning-color, var(--vi-text-warning, #e68300))}:host([variant=danger]) .badge{background-color:var(--vi-badge-danger-bg, var(--vi-bg-error, #ffebee));color:var(--vi-badge-danger-color, var(--vi-text-error, #db231b))}:host([variant=info]) .badge{background-color:var(--vi-badge-info-bg, var(--vi-bg-info, #e3f2fd));color:var(--vi-badge-info-color, var(--vi-text-info, #3676d0))}:host([outline][variant=neutral]) .badge{background-color:transparent;color:var(--vi-badge-neutral-color, var(--vi-text-secondary, #4b5563));border-color:var(--vi-badge-neutral-border, var(--vi-border-03, #e0e0e0))}:host([outline][variant=primary]) .badge{background-color:transparent;color:var(--vi-badge-primary-color, var(--vi-text-info, #3676d0));border-color:var(--vi-badge-primary-border, var(--vi-color-primary, #3676d0))}:host([outline][variant=success]) .badge{background-color:transparent;color:var(--vi-badge-success-color, var(--vi-text-success, #265a3d));border-color:var(--vi-badge-success-border, var(--vi-color-success, #489167))}:host([outline][variant=warning]) .badge{background-color:transparent;color:var(--vi-badge-warning-color, var(--vi-text-warning, #e68300));border-color:var(--vi-badge-warning-border, var(--vi-color-warning, #ffba00))}:host([outline][variant=danger]) .badge{background-color:transparent;color:var(--vi-badge-danger-color, var(--vi-text-error, #db231b));border-color:var(--vi-badge-danger-border, var(--vi-color-error, #ef4444))}:host([outline][variant=info]) .badge{background-color:transparent;color:var(--vi-badge-info-color, var(--vi-text-info, #3676d0));border-color:var(--vi-badge-info-border, var(--vi-color-info, #3676d0))}.icon{display:inline-flex;flex-shrink:0}.icon[hidden]{display:none}::slotted(vi-icon),::slotted(svg){--vi-icon-size: 1em;width:1em;height:1em}";
17
20
 
18
- function applyDecs2203RFactory() {
21
+ function applyDecs2203RFactory$3() {
19
22
  function createAddInitializerMethod(initializers, decoratorFinishedRef) {
20
23
  return function addInitializer(initializer) {
21
24
  assertNotFinished(decoratorFinishedRef, "addInitializer");
@@ -384,110 +387,110 @@ function applyDecs2203RFactory() {
384
387
  };
385
388
  };
386
389
  }
387
- function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
388
- return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
390
+ function _apply_decs_2203_r$3(targetClass, memberDecs, classDecs, parentClass) {
391
+ return (_apply_decs_2203_r$3 = applyDecs2203RFactory$3())(targetClass, memberDecs, classDecs, parentClass);
389
392
  }
390
- function _identity(x) {
393
+ function _identity$3(x) {
391
394
  return x;
392
395
  }
393
- var _dec, _initClass, _ViElement, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, /** Colour semantic */ _init_variant, /** Size */ _init_size, /** Show coloured dot */ _init_dot, /** Fully rounded (pill shape) vs. square */ _init_pill, /** Numeric count to display */ _init_count, /** Show the badge even if the count is zero */ _init_showZero, /** Max count before showing {max}+ */ _init_max, /** Outlined/ghost style */ _init_outline, _init__hasIcon, _init__hasDefaultSlot, _initProto;
396
+ var _dec$3, _initClass$3, _ViElement$1, _dec1$3, _dec2$3, _dec3$3, _dec4$3, _dec5$3, _dec6$3, _dec7$3, _dec8$3, _dec9$3, _dec10$3, /** Colour semantic */ _init_variant$2, /** Size */ _init_size$1, /** Show coloured dot */ _init_dot, /** Fully rounded (pill shape) vs. square */ _init_pill, /** Numeric count to display */ _init_count, /** Show the badge even if the count is zero */ _init_showZero, /** Max count before showing {max}+ */ _init_max, /** Outlined/ghost style */ _init_outline, _init__hasIcon$1, _init__hasDefaultSlot, _initProto$3;
394
397
  let _ViBadge;
395
- _dec = customElement('vi-badge'), _dec1 = property({
398
+ _dec$3 = customElement('vi-badge'), _dec1$3 = property({
396
399
  type: String,
397
400
  reflect: true
398
- }), _dec2 = property({
401
+ }), _dec2$3 = property({
399
402
  type: String,
400
403
  reflect: true
401
- }), _dec3 = property({
404
+ }), _dec3$3 = property({
402
405
  type: Boolean,
403
406
  reflect: true
404
- }), _dec4 = property({
407
+ }), _dec4$3 = property({
405
408
  type: Boolean,
406
409
  reflect: true
407
- }), _dec5 = property({
410
+ }), _dec5$3 = property({
408
411
  type: Number,
409
412
  reflect: true
410
- }), _dec6 = property({
413
+ }), _dec6$3 = property({
411
414
  type: Boolean,
412
415
  reflect: true,
413
416
  attribute: 'show-zero'
414
- }), _dec7 = property({
417
+ }), _dec7$3 = property({
415
418
  type: Number
416
- }), _dec8 = property({
419
+ }), _dec8$3 = property({
417
420
  type: Boolean,
418
421
  reflect: true
419
- }), _dec9 = state(), _dec10 = state();
420
- new class extends _identity {
422
+ }), _dec9$3 = state(), _dec10$3 = state();
423
+ new class extends _identity$3 {
421
424
  constructor(){
422
- super(_ViBadge), _initClass();
425
+ super(_ViBadge), _initClass$3();
423
426
  }
424
427
  static{
425
- class ViBadge extends (_ViElement = ViElement) {
428
+ class ViBadge extends (_ViElement$1 = ViElement) {
426
429
  static{
427
- ({ e: [_init_variant, _init_size, _init_dot, _init_pill, _init_count, _init_showZero, _init_max, _init_outline, _init__hasIcon, _init__hasDefaultSlot, _initProto], c: [_ViBadge, _initClass] } = _apply_decs_2203_r(this, [
430
+ ({ e: [_init_variant$2, _init_size$1, _init_dot, _init_pill, _init_count, _init_showZero, _init_max, _init_outline, _init__hasIcon$1, _init__hasDefaultSlot, _initProto$3], c: [_ViBadge, _initClass$3] } = _apply_decs_2203_r$3(this, [
428
431
  [
429
- _dec1,
432
+ _dec1$3,
430
433
  1,
431
434
  "variant"
432
435
  ],
433
436
  [
434
- _dec2,
437
+ _dec2$3,
435
438
  1,
436
439
  "size"
437
440
  ],
438
441
  [
439
- _dec3,
442
+ _dec3$3,
440
443
  1,
441
444
  "dot"
442
445
  ],
443
446
  [
444
- _dec4,
447
+ _dec4$3,
445
448
  1,
446
449
  "pill"
447
450
  ],
448
451
  [
449
- _dec5,
452
+ _dec5$3,
450
453
  1,
451
454
  "count"
452
455
  ],
453
456
  [
454
- _dec6,
457
+ _dec6$3,
455
458
  1,
456
459
  "showZero"
457
460
  ],
458
461
  [
459
- _dec7,
462
+ _dec7$3,
460
463
  1,
461
464
  "max"
462
465
  ],
463
466
  [
464
- _dec8,
467
+ _dec8$3,
465
468
  1,
466
469
  "outline"
467
470
  ],
468
471
  [
469
- _dec9,
472
+ _dec9$3,
470
473
  1,
471
474
  "_hasIcon"
472
475
  ],
473
476
  [
474
- _dec10,
477
+ _dec10$3,
475
478
  1,
476
479
  "_hasDefaultSlot"
477
480
  ]
478
481
  ], [
479
- _dec
480
- ], _ViElement));
482
+ _dec$3
483
+ ], _ViElement$1));
481
484
  }
482
485
  static styles = css`${unsafeCSS(badgeStyles)}`;
483
- #___private_variant_1 = (_initProto(this), _init_variant(this, 'neutral'));
486
+ #___private_variant_1 = (_initProto$3(this), _init_variant$2(this, 'neutral'));
484
487
  get variant() {
485
488
  return this.#___private_variant_1;
486
489
  }
487
490
  set variant(_v) {
488
491
  this.#___private_variant_1 = _v;
489
492
  }
490
- #___private_size_2 = _init_size(this, 'md');
493
+ #___private_size_2 = _init_size$1(this, 'md');
491
494
  get size() {
492
495
  return this.#___private_size_2;
493
496
  }
@@ -536,7 +539,7 @@ new class extends _identity {
536
539
  set outline(_v) {
537
540
  this.#___private_outline_8 = _v;
538
541
  }
539
- #___private__hasIcon_9 = _init__hasIcon(this, false);
542
+ #___private__hasIcon_9 = _init__hasIcon$1(this, false);
540
543
  get _hasIcon() {
541
544
  return this.#___private__hasIcon_9;
542
545
  }
@@ -611,4 +614,2277 @@ new class extends _identity {
611
614
  }
612
615
  }();
613
616
 
614
- export { _ViBadge as ViBadge, ViElement };
617
+ const alertStyles = "@charset \"UTF-8\";@layer reset,components,utilities;@layer components{.alert-root{display:flex;align-items:flex-start;box-sizing:border-box;width:100%;border-radius:var(--vi-alert-border-radius, 6px);padding:var(--vi-alert-padding, 12px 16px);gap:var(--vi-alert-gap, 12px);border-width:var(--vi-alert-border-width, 1px);border-style:solid;font-family:var(--vi-font-family-base, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif);font-size:var(--vi-font-size-sm, 14px);line-height:var(--vi-line-height-normal, 1.5)}.alert-icon{display:flex;align-items:center;justify-content:center;flex-shrink:0;padding-top:2px}.alert-content{display:flex;flex-direction:column;flex-grow:1;min-width:0}.alert-title{font-weight:var(--vi-font-weight-semibold, 600);margin-bottom:4px;display:block}.alert-actions{display:flex;align-items:center;gap:var(--vi-spacing-xs, 8px);margin-top:var(--vi-spacing-sm, 16px)}}:host{display:block;width:100%}:host([floating]){position:absolute;top:0;left:0;right:0;z-index:var(--vi-alert-floating-z-index, 10);box-shadow:var(--vi-alert-floating-shadow, 0 4px 12px rgba(0, 0, 0, .12))}:host([hidden]){display:none!important}.alert-root{overflow:hidden}.alert-root[data-variant=neutral]{background-color:var(--vi-alert-neutral-bg, var(--vi-layer-02, #f3f4f6));border-color:var(--vi-alert-neutral-border, var(--vi-border-04, #bdbdbd));color:var(--vi-alert-neutral-text-color, var(--vi-text-primary, #111827))}.alert-root[data-variant=neutral] .alert-title{color:var(--vi-alert-neutral-title-color, var(--vi-text-primary, #111827))}.alert-root[data-variant=neutral] .alert-icon{color:var(--vi-alert-neutral-icon-color, var(--vi-text-secondary, #4b5563))}.alert-root[data-variant=info]{background-color:var(--vi-alert-info-bg, var(--vi-bg-info, #e3f2fd));border-color:var(--vi-alert-info-border, var(--vi-color-info, #3676d0));color:var(--vi-alert-info-text-color, var(--vi-text-info, #3676d0))}.alert-root[data-variant=info] .alert-title{color:var(--vi-alert-info-title-color, var(--vi-text-info, #3676d0))}.alert-root[data-variant=info] .alert-icon{color:var(--vi-alert-info-icon-color, var(--vi-color-info, #3676d0))}.alert-root[data-variant=success]{background-color:var(--vi-alert-success-bg, var(--vi-bg-success, #e6f9f0));border-color:var(--vi-alert-success-border, var(--vi-color-success, #489167));color:var(--vi-alert-success-text-color, var(--vi-text-success, #265a3d))}.alert-root[data-variant=success] .alert-title{color:var(--vi-alert-success-title-color, var(--vi-text-success, #265a3d))}.alert-root[data-variant=success] .alert-icon{color:var(--vi-alert-success-icon-color, var(--vi-color-success, #489167))}.alert-root[data-variant=warning]{background-color:var(--vi-alert-warning-bg, var(--vi-bg-warning, #fff8e1));border-color:var(--vi-alert-warning-border, var(--vi-color-warning, #ffba00));color:var(--vi-alert-warning-text-color, var(--vi-text-warning, #e68300))}.alert-root[data-variant=warning] .alert-title{color:var(--vi-alert-warning-title-color, var(--vi-text-warning, #e68300))}.alert-root[data-variant=warning] .alert-icon{color:var(--vi-alert-warning-icon-color, var(--vi-color-warning, #ffba00))}.alert-root[data-variant=danger]{background-color:var(--vi-alert-danger-bg, var(--vi-bg-error, #ffebee));border-color:var(--vi-alert-danger-border, var(--vi-color-error, #ef4444));color:var(--vi-alert-danger-text-color, var(--vi-text-error, #db231b))}.alert-root[data-variant=danger] .alert-title{color:var(--vi-alert-danger-title-color, var(--vi-text-error, #db231b))}.alert-root[data-variant=danger] .alert-icon{color:var(--vi-alert-danger-icon-color, var(--vi-color-error, #ef4444))}vi-icon,::slotted(vi-icon),::slotted(svg){--vi-icon-size: 1.25em;width:1.25em;height:1.25em}vi-button[part=close-btn]{margin-top:-4px;margin-right:-4px;margin-left:4px}";
618
+
619
+ function applyDecs2203RFactory$2() {
620
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
621
+ return function addInitializer(initializer) {
622
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
623
+ assertCallable(initializer, "An initializer");
624
+ initializers.push(initializer);
625
+ };
626
+ }
627
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
628
+ var kindStr;
629
+ switch(kind){
630
+ case 1:
631
+ kindStr = "accessor";
632
+ break;
633
+ case 2:
634
+ kindStr = "method";
635
+ break;
636
+ case 3:
637
+ kindStr = "getter";
638
+ break;
639
+ case 4:
640
+ kindStr = "setter";
641
+ break;
642
+ default:
643
+ kindStr = "field";
644
+ }
645
+ var ctx = {
646
+ kind: kindStr,
647
+ name: isPrivate ? "#" + name : name,
648
+ static: isStatic,
649
+ private: isPrivate,
650
+ metadata: metadata
651
+ };
652
+ var decoratorFinishedRef = {
653
+ v: false
654
+ };
655
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
656
+ var get, set;
657
+ if (kind === 0) {
658
+ if (isPrivate) {
659
+ get = desc.get;
660
+ set = desc.set;
661
+ } else {
662
+ get = function() {
663
+ return this[name];
664
+ };
665
+ set = function(v) {
666
+ this[name] = v;
667
+ };
668
+ }
669
+ } else if (kind === 2) {
670
+ get = function() {
671
+ return desc.value;
672
+ };
673
+ } else {
674
+ if (kind === 1 || kind === 3) {
675
+ get = function() {
676
+ return desc.get.call(this);
677
+ };
678
+ }
679
+ if (kind === 1 || kind === 4) {
680
+ set = function(v) {
681
+ desc.set.call(this, v);
682
+ };
683
+ }
684
+ }
685
+ ctx.access = get && set ? {
686
+ get: get,
687
+ set: set
688
+ } : get ? {
689
+ get: get
690
+ } : {
691
+ set: set
692
+ };
693
+ try {
694
+ return dec(value, ctx);
695
+ } finally{
696
+ decoratorFinishedRef.v = true;
697
+ }
698
+ }
699
+ function assertNotFinished(decoratorFinishedRef, fnName) {
700
+ if (decoratorFinishedRef.v) {
701
+ throw new Error("attempted to call " + fnName + " after decoration was finished");
702
+ }
703
+ }
704
+ function assertCallable(fn, hint) {
705
+ if (typeof fn !== "function") {
706
+ throw new TypeError(hint + " must be a function");
707
+ }
708
+ }
709
+ function assertValidReturnValue(kind, value) {
710
+ var type = typeof value;
711
+ if (kind === 1) {
712
+ if (type !== "object" || value === null) {
713
+ throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
714
+ }
715
+ if (value.get !== undefined) {
716
+ assertCallable(value.get, "accessor.get");
717
+ }
718
+ if (value.set !== undefined) {
719
+ assertCallable(value.set, "accessor.set");
720
+ }
721
+ if (value.init !== undefined) {
722
+ assertCallable(value.init, "accessor.init");
723
+ }
724
+ } else if (type !== "function") {
725
+ var hint;
726
+ if (kind === 0) {
727
+ hint = "field";
728
+ } else if (kind === 10) {
729
+ hint = "class";
730
+ } else {
731
+ hint = "method";
732
+ }
733
+ throw new TypeError(hint + " decorators must return a function or void 0");
734
+ }
735
+ }
736
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
737
+ var decs = decInfo[0];
738
+ var desc, init, value;
739
+ if (isPrivate) {
740
+ if (kind === 0 || kind === 1) {
741
+ desc = {
742
+ get: decInfo[3],
743
+ set: decInfo[4]
744
+ };
745
+ } else if (kind === 3) {
746
+ desc = {
747
+ get: decInfo[3]
748
+ };
749
+ } else if (kind === 4) {
750
+ desc = {
751
+ set: decInfo[3]
752
+ };
753
+ } else {
754
+ desc = {
755
+ value: decInfo[3]
756
+ };
757
+ }
758
+ } else if (kind !== 0) {
759
+ desc = Object.getOwnPropertyDescriptor(base, name);
760
+ }
761
+ if (kind === 1) {
762
+ value = {
763
+ get: desc.get,
764
+ set: desc.set
765
+ };
766
+ } else if (kind === 2) {
767
+ value = desc.value;
768
+ } else if (kind === 3) {
769
+ value = desc.get;
770
+ } else if (kind === 4) {
771
+ value = desc.set;
772
+ }
773
+ var newValue, get, set;
774
+ if (typeof decs === "function") {
775
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
776
+ if (newValue !== void 0) {
777
+ assertValidReturnValue(kind, newValue);
778
+ if (kind === 0) {
779
+ init = newValue;
780
+ } else if (kind === 1) {
781
+ init = newValue.init;
782
+ get = newValue.get || value.get;
783
+ set = newValue.set || value.set;
784
+ value = {
785
+ get: get,
786
+ set: set
787
+ };
788
+ } else {
789
+ value = newValue;
790
+ }
791
+ }
792
+ } else {
793
+ for(var i = decs.length - 1; i >= 0; i--){
794
+ var dec = decs[i];
795
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
796
+ if (newValue !== void 0) {
797
+ assertValidReturnValue(kind, newValue);
798
+ var newInit;
799
+ if (kind === 0) {
800
+ newInit = newValue;
801
+ } else if (kind === 1) {
802
+ newInit = newValue.init;
803
+ get = newValue.get || value.get;
804
+ set = newValue.set || value.set;
805
+ value = {
806
+ get: get,
807
+ set: set
808
+ };
809
+ } else {
810
+ value = newValue;
811
+ }
812
+ if (newInit !== void 0) {
813
+ if (init === void 0) {
814
+ init = newInit;
815
+ } else if (typeof init === "function") {
816
+ init = [
817
+ init,
818
+ newInit
819
+ ];
820
+ } else {
821
+ init.push(newInit);
822
+ }
823
+ }
824
+ }
825
+ }
826
+ }
827
+ if (kind === 0 || kind === 1) {
828
+ if (init === void 0) {
829
+ init = function(instance, init) {
830
+ return init;
831
+ };
832
+ } else if (typeof init !== "function") {
833
+ var ownInitializers = init;
834
+ init = function(instance, init) {
835
+ var value = init;
836
+ for(var i = 0; i < ownInitializers.length; i++){
837
+ value = ownInitializers[i].call(instance, value);
838
+ }
839
+ return value;
840
+ };
841
+ } else {
842
+ var originalInitializer = init;
843
+ init = function(instance, init) {
844
+ return originalInitializer.call(instance, init);
845
+ };
846
+ }
847
+ ret.push(init);
848
+ }
849
+ if (kind !== 0) {
850
+ if (kind === 1) {
851
+ desc.get = value.get;
852
+ desc.set = value.set;
853
+ } else if (kind === 2) {
854
+ desc.value = value;
855
+ } else if (kind === 3) {
856
+ desc.get = value;
857
+ } else if (kind === 4) {
858
+ desc.set = value;
859
+ }
860
+ if (isPrivate) {
861
+ if (kind === 1) {
862
+ ret.push(function(instance, args) {
863
+ return value.get.call(instance, args);
864
+ });
865
+ ret.push(function(instance, args) {
866
+ return value.set.call(instance, args);
867
+ });
868
+ } else if (kind === 2) {
869
+ ret.push(value);
870
+ } else {
871
+ ret.push(function(instance, args) {
872
+ return value.call(instance, args);
873
+ });
874
+ }
875
+ } else {
876
+ Object.defineProperty(base, name, desc);
877
+ }
878
+ }
879
+ }
880
+ function applyMemberDecs(Class, decInfos, metadata) {
881
+ var ret = [];
882
+ var protoInitializers;
883
+ var staticInitializers;
884
+ var existingProtoNonFields = new Map();
885
+ var existingStaticNonFields = new Map();
886
+ for(var i = 0; i < decInfos.length; i++){
887
+ var decInfo = decInfos[i];
888
+ if (!Array.isArray(decInfo)) continue;
889
+ var kind = decInfo[1];
890
+ var name = decInfo[2];
891
+ var isPrivate = decInfo.length > 3;
892
+ var isStatic = kind >= 5;
893
+ var base;
894
+ var initializers;
895
+ if (isStatic) {
896
+ base = Class;
897
+ kind = kind - 5;
898
+ staticInitializers = staticInitializers || [];
899
+ initializers = staticInitializers;
900
+ } else {
901
+ base = Class.prototype;
902
+ protoInitializers = protoInitializers || [];
903
+ initializers = protoInitializers;
904
+ }
905
+ if (kind !== 0 && !isPrivate) {
906
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
907
+ var existingKind = existingNonFields.get(name) || 0;
908
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
909
+ 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);
910
+ } else if (!existingKind && kind > 2) {
911
+ existingNonFields.set(name, kind);
912
+ } else {
913
+ existingNonFields.set(name, true);
914
+ }
915
+ }
916
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
917
+ }
918
+ pushInitializers(ret, protoInitializers);
919
+ pushInitializers(ret, staticInitializers);
920
+ return ret;
921
+ }
922
+ function pushInitializers(ret, initializers) {
923
+ if (initializers) {
924
+ ret.push(function(instance) {
925
+ for(var i = 0; i < initializers.length; i++){
926
+ initializers[i].call(instance);
927
+ }
928
+ return instance;
929
+ });
930
+ }
931
+ }
932
+ function applyClassDecs(targetClass, classDecs, metadata) {
933
+ if (classDecs.length > 0) {
934
+ var initializers = [];
935
+ var newClass = targetClass;
936
+ var name = targetClass.name;
937
+ for(var i = classDecs.length - 1; i >= 0; i--){
938
+ var decoratorFinishedRef = {
939
+ v: false
940
+ };
941
+ try {
942
+ var nextNewClass = classDecs[i](newClass, {
943
+ kind: "class",
944
+ name: name,
945
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
946
+ metadata
947
+ });
948
+ } finally{
949
+ decoratorFinishedRef.v = true;
950
+ }
951
+ if (nextNewClass !== undefined) {
952
+ assertValidReturnValue(10, nextNewClass);
953
+ newClass = nextNewClass;
954
+ }
955
+ }
956
+ return [
957
+ defineMetadata(newClass, metadata),
958
+ function() {
959
+ for(var i = 0; i < initializers.length; i++){
960
+ initializers[i].call(newClass);
961
+ }
962
+ }
963
+ ];
964
+ }
965
+ }
966
+ function defineMetadata(Class, metadata) {
967
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
968
+ configurable: true,
969
+ enumerable: true,
970
+ value: metadata
971
+ });
972
+ }
973
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
974
+ if (parentClass !== void 0) {
975
+ var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
976
+ }
977
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
978
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
979
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
980
+ return {
981
+ e: e,
982
+ get c () {
983
+ return applyClassDecs(targetClass, classDecs, metadata);
984
+ }
985
+ };
986
+ };
987
+ }
988
+ function _apply_decs_2203_r$2(targetClass, memberDecs, classDecs, parentClass) {
989
+ return (_apply_decs_2203_r$2 = applyDecs2203RFactory$2())(targetClass, memberDecs, classDecs, parentClass);
990
+ }
991
+ function _identity$2(x) {
992
+ return x;
993
+ }
994
+ var _dec$2, _initClass$2, _ViElement, _dec1$2, _dec2$2, _dec3$2, _dec4$2, _dec5$2, _dec6$2, _dec7$2, _dec8$2, _dec9$2, _dec10$2, _dec11$1, _dec12, _dec13, /** Colour, icon, ARIA role */ _init_variant$1, /** Bold headline (optional) */ _init_title, /** Show × dismiss button */ _init_dismissible, /** Accessible label for the dismiss button */ _init_dismissLabel, /**
995
+ * Enables auto-hiding after a duration (default: 5000ms).
996
+ * Note: Setting a positive `duration` or `auto-hide-duration` also implicitly enables auto-hiding.
997
+ */ _init_autoHide, /** Auto hide duration in milliseconds (default: 5000ms) */ _init_autoHideDuration, /**
998
+ * Alias for auto-hide-duration in milliseconds.
999
+ * Setting a positive duration enables auto-hiding automatically.
1000
+ */ _init_duration, /** Override the default status icon name */ _init_icon, /** Controls whether the alert is displayed */ _init_open, /** Position alert absolutely over parent container without pushing layout */ _init_floating, /** Hide the icon */ _init_noIcon, _init__hasTitleSlot, _init__hasActionsSlot, _initProto$2;
1001
+ const checkCircleIcon = {
1002
+ name: 'check-circle',
1003
+ data: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>`
1004
+ };
1005
+ const alertTriangleIcon = {
1006
+ name: 'alert-triangle',
1007
+ data: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1="12" y1="9" x2="12" y2="13"></line><line x1="12" y1="17" x2="12.01" y2="17"></line></svg>`
1008
+ };
1009
+ const infoIcon = {
1010
+ name: 'info',
1011
+ data: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>`
1012
+ };
1013
+ const xIcon = {
1014
+ name: 'x',
1015
+ data: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>`
1016
+ };
1017
+ const lockIcon = {
1018
+ name: 'lock',
1019
+ data: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>`
1020
+ };
1021
+ registerIcons([
1022
+ checkCircleIcon,
1023
+ alertTriangleIcon,
1024
+ infoIcon,
1025
+ xIcon,
1026
+ lockIcon
1027
+ ]);
1028
+ let _ViAlert;
1029
+ _dec$2 = customElement('vi-alert'), _dec1$2 = property({
1030
+ type: String,
1031
+ reflect: true
1032
+ }), _dec2$2 = property({
1033
+ type: String
1034
+ }), _dec3$2 = property({
1035
+ type: Boolean,
1036
+ reflect: true
1037
+ }), _dec4$2 = property({
1038
+ type: String,
1039
+ attribute: 'dismiss-label'
1040
+ }), _dec5$2 = property({
1041
+ type: Boolean,
1042
+ attribute: 'auto-hide',
1043
+ reflect: true
1044
+ }), _dec6$2 = property({
1045
+ type: Number,
1046
+ attribute: 'auto-hide-duration'
1047
+ }), _dec7$2 = property({
1048
+ type: Number
1049
+ }), _dec8$2 = property({
1050
+ type: String
1051
+ }), _dec9$2 = property({
1052
+ type: Boolean,
1053
+ reflect: true
1054
+ }), _dec10$2 = property({
1055
+ type: Boolean,
1056
+ reflect: true
1057
+ }), _dec11$1 = property({
1058
+ type: Boolean,
1059
+ attribute: 'no-icon',
1060
+ reflect: true
1061
+ }), _dec12 = state(), _dec13 = state();
1062
+ new class extends _identity$2 {
1063
+ constructor(){
1064
+ super(_ViAlert), _initClass$2();
1065
+ }
1066
+ static{
1067
+ class ViAlert extends (_ViElement = ViElement) {
1068
+ static{
1069
+ ({ e: [_init_variant$1, _init_title, _init_dismissible, _init_dismissLabel, _init_autoHide, _init_autoHideDuration, _init_duration, _init_icon, _init_open, _init_floating, _init_noIcon, _init__hasTitleSlot, _init__hasActionsSlot, _initProto$2], c: [_ViAlert, _initClass$2] } = _apply_decs_2203_r$2(this, [
1070
+ [
1071
+ _dec1$2,
1072
+ 1,
1073
+ "variant"
1074
+ ],
1075
+ [
1076
+ _dec2$2,
1077
+ 1,
1078
+ "title"
1079
+ ],
1080
+ [
1081
+ _dec3$2,
1082
+ 1,
1083
+ "dismissible"
1084
+ ],
1085
+ [
1086
+ _dec4$2,
1087
+ 1,
1088
+ "dismissLabel"
1089
+ ],
1090
+ [
1091
+ _dec5$2,
1092
+ 1,
1093
+ "autoHide"
1094
+ ],
1095
+ [
1096
+ _dec6$2,
1097
+ 1,
1098
+ "autoHideDuration"
1099
+ ],
1100
+ [
1101
+ _dec7$2,
1102
+ 1,
1103
+ "duration"
1104
+ ],
1105
+ [
1106
+ _dec8$2,
1107
+ 1,
1108
+ "icon"
1109
+ ],
1110
+ [
1111
+ _dec9$2,
1112
+ 1,
1113
+ "open"
1114
+ ],
1115
+ [
1116
+ _dec10$2,
1117
+ 1,
1118
+ "floating"
1119
+ ],
1120
+ [
1121
+ _dec11$1,
1122
+ 1,
1123
+ "noIcon"
1124
+ ],
1125
+ [
1126
+ _dec12,
1127
+ 1,
1128
+ "_hasTitleSlot"
1129
+ ],
1130
+ [
1131
+ _dec13,
1132
+ 1,
1133
+ "_hasActionsSlot"
1134
+ ]
1135
+ ], [
1136
+ _dec$2
1137
+ ], _ViElement));
1138
+ }
1139
+ static styles = css`
1140
+ ${unsafeCSS(alertStyles)}
1141
+ `;
1142
+ #___private_variant_1 = (_initProto$2(this), _init_variant$1(this, 'info'));
1143
+ get variant() {
1144
+ return this.#___private_variant_1;
1145
+ }
1146
+ set variant(_v) {
1147
+ this.#___private_variant_1 = _v;
1148
+ }
1149
+ #___private_title_2 = _init_title(this, '');
1150
+ get title() {
1151
+ return this.#___private_title_2;
1152
+ }
1153
+ set title(_v) {
1154
+ this.#___private_title_2 = _v;
1155
+ }
1156
+ #___private_dismissible_3 = _init_dismissible(this, false);
1157
+ get dismissible() {
1158
+ return this.#___private_dismissible_3;
1159
+ }
1160
+ set dismissible(_v) {
1161
+ this.#___private_dismissible_3 = _v;
1162
+ }
1163
+ #___private_dismissLabel_4 = _init_dismissLabel(this, 'Dismiss alert');
1164
+ get dismissLabel() {
1165
+ return this.#___private_dismissLabel_4;
1166
+ }
1167
+ set dismissLabel(_v) {
1168
+ this.#___private_dismissLabel_4 = _v;
1169
+ }
1170
+ #___private_autoHide_5 = _init_autoHide(this, false);
1171
+ get autoHide() {
1172
+ return this.#___private_autoHide_5;
1173
+ }
1174
+ set autoHide(_v) {
1175
+ this.#___private_autoHide_5 = _v;
1176
+ }
1177
+ #___private_autoHideDuration_6 = _init_autoHideDuration(this, 5000);
1178
+ get autoHideDuration() {
1179
+ return this.#___private_autoHideDuration_6;
1180
+ }
1181
+ set autoHideDuration(_v) {
1182
+ this.#___private_autoHideDuration_6 = _v;
1183
+ }
1184
+ #___private_duration_7 = _init_duration(this, undefined);
1185
+ get duration() {
1186
+ return this.#___private_duration_7;
1187
+ }
1188
+ set duration(_v) {
1189
+ this.#___private_duration_7 = _v;
1190
+ }
1191
+ #___private_icon_8 = _init_icon(this, undefined);
1192
+ get icon() {
1193
+ return this.#___private_icon_8;
1194
+ }
1195
+ set icon(_v) {
1196
+ this.#___private_icon_8 = _v;
1197
+ }
1198
+ #___private_open_9 = _init_open(this, true);
1199
+ get open() {
1200
+ return this.#___private_open_9;
1201
+ }
1202
+ set open(_v) {
1203
+ this.#___private_open_9 = _v;
1204
+ }
1205
+ #___private_floating_10 = _init_floating(this, false);
1206
+ get floating() {
1207
+ return this.#___private_floating_10;
1208
+ }
1209
+ set floating(_v) {
1210
+ this.#___private_floating_10 = _v;
1211
+ }
1212
+ #___private_noIcon_11 = _init_noIcon(this, false);
1213
+ get noIcon() {
1214
+ return this.#___private_noIcon_11;
1215
+ }
1216
+ set noIcon(_v) {
1217
+ this.#___private_noIcon_11 = _v;
1218
+ }
1219
+ #___private__hasTitleSlot_12 = _init__hasTitleSlot(this, false);
1220
+ get _hasTitleSlot() {
1221
+ return this.#___private__hasTitleSlot_12;
1222
+ }
1223
+ set _hasTitleSlot(_v) {
1224
+ this.#___private__hasTitleSlot_12 = _v;
1225
+ }
1226
+ #___private__hasActionsSlot_13 = _init__hasActionsSlot(this, false);
1227
+ get _hasActionsSlot() {
1228
+ return this.#___private__hasActionsSlot_13;
1229
+ }
1230
+ set _hasActionsSlot(_v) {
1231
+ this.#___private__hasActionsSlot_13 = _v;
1232
+ }
1233
+ _autoHideTimer = null;
1234
+ /** Helper to check whether auto-hide is enabled via boolean toggle or duration setting */ get _shouldAutoHide() {
1235
+ return this.autoHide || this.duration !== undefined && this.duration > 0;
1236
+ }
1237
+ connectedCallback() {
1238
+ super.connectedCallback();
1239
+ this.updateRole();
1240
+ if (!this.open) {
1241
+ this.hidden = true;
1242
+ } else if (this._shouldAutoHide) {
1243
+ this._startAutoHideTimer();
1244
+ }
1245
+ }
1246
+ disconnectedCallback() {
1247
+ super.disconnectedCallback();
1248
+ this._clearAutoHideTimer();
1249
+ }
1250
+ updated(changedProperties) {
1251
+ super.updated(changedProperties);
1252
+ if (changedProperties.has('variant')) {
1253
+ this.updateRole();
1254
+ }
1255
+ if (changedProperties.has('open') && changedProperties.get('open') !== undefined) {
1256
+ if (this.open) {
1257
+ this._handleOpen();
1258
+ } else if (!this.hidden) {
1259
+ this.handleDismiss();
1260
+ }
1261
+ }
1262
+ if (changedProperties.has('autoHide') || changedProperties.has('autoHideDuration') || changedProperties.has('duration')) {
1263
+ if (this.open && this._shouldAutoHide) {
1264
+ this._startAutoHideTimer();
1265
+ } else {
1266
+ this._clearAutoHideTimer();
1267
+ }
1268
+ }
1269
+ }
1270
+ updateRole() {
1271
+ switch(this.variant){
1272
+ case 'warning':
1273
+ case 'danger':
1274
+ this.setAttribute('role', 'alert');
1275
+ break;
1276
+ case 'info':
1277
+ case 'success':
1278
+ this.setAttribute('role', 'status');
1279
+ break;
1280
+ case 'neutral':
1281
+ default:
1282
+ this.removeAttribute('role');
1283
+ break;
1284
+ }
1285
+ }
1286
+ get defaultIcon() {
1287
+ switch(this.variant){
1288
+ case 'success':
1289
+ return 'check-circle';
1290
+ case 'warning':
1291
+ case 'danger':
1292
+ return 'alert-triangle';
1293
+ case 'info':
1294
+ default:
1295
+ return 'info';
1296
+ }
1297
+ }
1298
+ onTitleSlotChange(e) {
1299
+ const slot = e.target;
1300
+ this._hasTitleSlot = slot.assignedNodes({
1301
+ flatten: true
1302
+ }).length > 0;
1303
+ }
1304
+ onActionsSlotChange(e) {
1305
+ const slot = e.target;
1306
+ this._hasActionsSlot = slot.assignedNodes({
1307
+ flatten: true
1308
+ }).length > 0;
1309
+ }
1310
+ _startAutoHideTimer() {
1311
+ this._clearAutoHideTimer();
1312
+ const timeout = this.duration ?? this.autoHideDuration;
1313
+ if (timeout > 0) {
1314
+ this._autoHideTimer = setTimeout(()=>{
1315
+ this.hide();
1316
+ }, timeout);
1317
+ }
1318
+ }
1319
+ _clearAutoHideTimer() {
1320
+ if (this._autoHideTimer !== null) {
1321
+ clearTimeout(this._autoHideTimer);
1322
+ this._autoHideTimer = null;
1323
+ }
1324
+ }
1325
+ _handleOpen() {
1326
+ this.hidden = false;
1327
+ if (this.shadowRoot) {
1328
+ const root = this.shadowRoot.querySelector('.alert-root');
1329
+ if (root && typeof root.getAnimations === 'function') {
1330
+ root.getAnimations().forEach((anim)=>anim.cancel());
1331
+ }
1332
+ }
1333
+ if (this._shouldAutoHide) {
1334
+ this._startAutoHideTimer();
1335
+ }
1336
+ this.dispatchEvent(new CustomEvent('vialiq-alert-show', {
1337
+ bubbles: true,
1338
+ composed: true,
1339
+ detail: {
1340
+ id: this.id
1341
+ }
1342
+ }));
1343
+ }
1344
+ _dismissPromise = null;
1345
+ async handleDismiss() {
1346
+ this._clearAutoHideTimer();
1347
+ if (this._dismissPromise) {
1348
+ return this._dismissPromise;
1349
+ }
1350
+ this._dismissPromise = (async ()=>{
1351
+ if (this.shadowRoot) {
1352
+ const root = this.shadowRoot.querySelector('.alert-root');
1353
+ if (root && typeof root.animate === 'function') {
1354
+ try {
1355
+ const computed = getComputedStyle(root);
1356
+ const currentHeight = root.offsetHeight;
1357
+ const currentPadding = computed.padding;
1358
+ const currentMargin = computed.margin;
1359
+ const animation = root.animate([
1360
+ {
1361
+ height: `${currentHeight}px`,
1362
+ opacity: 1,
1363
+ margin: currentMargin,
1364
+ padding: currentPadding
1365
+ },
1366
+ {
1367
+ height: '0px',
1368
+ opacity: 0,
1369
+ margin: '0px',
1370
+ padding: '0px'
1371
+ }
1372
+ ], {
1373
+ duration: 200,
1374
+ easing: 'ease-out',
1375
+ fill: 'forwards'
1376
+ });
1377
+ await animation.finished;
1378
+ } catch {
1379
+ // Animation was cancelled or failed; swallow rejection and proceed
1380
+ }
1381
+ }
1382
+ }
1383
+ this.hidden = true;
1384
+ this.open = false;
1385
+ this.dispatchEvent(new CustomEvent('vialiq-alert-close', {
1386
+ bubbles: true,
1387
+ composed: true,
1388
+ detail: {
1389
+ id: this.id
1390
+ }
1391
+ }));
1392
+ })();
1393
+ try {
1394
+ await this._dismissPromise;
1395
+ } finally{
1396
+ this._dismissPromise = null;
1397
+ }
1398
+ }
1399
+ /** Programmatically shows the alert */ async show() {
1400
+ this.open = true;
1401
+ await this.updateComplete;
1402
+ }
1403
+ /** Programmatically hides/dismisses the alert */ async hide() {
1404
+ if (this.open) {
1405
+ this.open = false;
1406
+ await this.updateComplete;
1407
+ if (this._dismissPromise) {
1408
+ await this._dismissPromise;
1409
+ }
1410
+ }
1411
+ }
1412
+ render() {
1413
+ return html`
1414
+ <div part="alert" class="alert-root" data-variant=${this.variant}>
1415
+ ${!this.noIcon ? html`
1416
+ <div part="icon" class="alert-icon">
1417
+ <slot name="icon">
1418
+ <vi-icon
1419
+ name=${this.icon || this.defaultIcon}
1420
+ aria-hidden="true"
1421
+ ></vi-icon>
1422
+ </slot>
1423
+ </div>
1424
+ ` : ''}
1425
+
1426
+ <div part="content" class="alert-content">
1427
+ <div
1428
+ part="title"
1429
+ class="alert-title"
1430
+ ?hidden=${!(this.title || this._hasTitleSlot)}
1431
+ >
1432
+ <slot name="title" @slotchange=${this.onTitleSlotChange}>
1433
+ ${this.title}
1434
+ </slot>
1435
+ </div>
1436
+
1437
+ <div part="body" class="alert-body">
1438
+ <slot></slot>
1439
+ </div>
1440
+
1441
+ <div
1442
+ part="actions"
1443
+ class="alert-actions"
1444
+ ?hidden=${!this._hasActionsSlot}
1445
+ >
1446
+ <slot name="actions" @slotchange=${this.onActionsSlotChange}></slot>
1447
+ </div>
1448
+ </div>
1449
+
1450
+ ${this.dismissible ? html`
1451
+ <vi-button
1452
+ part="close-btn"
1453
+ variant="ghost"
1454
+ size="sm"
1455
+ icon-only
1456
+ aria-label=${this.dismissLabel}
1457
+ @click=${this.handleDismiss}
1458
+ >
1459
+ <vi-icon name="x" slot="icon"></vi-icon>
1460
+ </vi-button>
1461
+ ` : ''}
1462
+ </div>
1463
+ `;
1464
+ }
1465
+ }
1466
+ }
1467
+ }();
1468
+
1469
+ const chipStyles = "@charset \"UTF-8\";@layer reset,components,utilities;@layer components{.chip,button{display:inline-flex;align-items:center;box-sizing:border-box;cursor:pointer;-webkit-user-select:none;user-select:none;vertical-align:middle;outline:none;border-style:solid;height:var(--vi-chip-height, var(--vi-chip-height-md, 32px));padding:var(--vi-chip-padding, 0 10px);border-radius:var(--vi-chip-border-radius, 999px);border-width:var(--vi-chip-border-width, 1px);gap:var(--vi-chip-gap, 6px);font-size:var(--vi-chip-font-size, var(--vi-font-size-sm));font-weight:var(--vi-chip-font-weight, var(--vi-font-weight-medium));transition:all var(--vi-chip-transition, .1s ease);background-color:var(--vi-chip-bg-color, var(--vi-layer-02, #f3f4f6));border-color:var(--vi-chip-border-color, var(--vi-border-03, #e0e0e0));color:var(--vi-chip-text-color, var(--vi-color-foreground, #111827))}.chip:focus-visible,button:focus-visible{outline:var(--vi-border-width-base, 2px) solid var(--vi-chip-focus-ring-color, var(--vi-focus, #3676d0));outline-offset:0;box-shadow:0 0 0 3px var(--vi-chip-focus-ring-glow, var(--vi-color-blue-200, #cee6ff))}.chip[aria-disabled=true],button[aria-disabled=true]{cursor:not-allowed}.chip-avatar{display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:50%;width:calc(100% - 8px);height:calc(100% - 8px);margin-inline-start:-4px}.chip-icon{display:inline-flex;align-items:center}.chip-label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.chip-group{display:flex;align-items:center}}:host{display:inline-block;vertical-align:middle}:host([hidden]){display:none!important}:host([size=sm]) button{--vi-chip-height: var(--vi-chip-height-sm);--vi-chip-font-size: var(--vi-font-size-xs);--vi-chip-padding: 0 8px}:host([size=md]) button{--vi-chip-height: var(--vi-chip-height-md);--vi-chip-font-size: var(--vi-font-size-sm);--vi-chip-padding: 0 10px}:host([size=lg]) button{--vi-chip-height: var(--vi-chip-height-lg);--vi-chip-font-size: var(--vi-font-size-base);--vi-chip-padding: 0 12px}:host([variant=neutral]) button{--vi-chip-bg-color: var(--vi-color-grey-100, #f5f5f5);--vi-chip-border-color: var(--vi-color-grey-300, #e0e0e0);--vi-chip-text-color: var(--vi-color-grey-700, #616161)}:host([variant=neutral]:not([disabled])) button:hover{--vi-chip-bg-color: var(--vi-color-grey-200, #eeeeee);--vi-chip-border-color: var(--vi-color-grey-400, #bdbdbd);--vi-chip-text-color: var(--vi-color-grey-900, #212121)}:host([variant=neutral][selected]) button{--vi-chip-bg-color: var(--vi-color-primary, #3676d0);--vi-chip-border-color: var(--vi-color-primary, #3676d0);--vi-chip-text-color: var(--vi-text-primary-inverse, #ffffff)}:host([variant=neutral][selected]:not([disabled])) button:hover{--vi-chip-bg-color: var(--vi-color-blue-800, #2d5fa8);--vi-chip-border-color: var(--vi-color-blue-800, #2d5fa8)}:host([variant=primary]) button{--vi-chip-bg-color: var(--vi-bg-info, #e3f2fd);--vi-chip-border-color: var(--vi-bg-info, #e3f2fd);--vi-chip-text-color: var(--vi-text-info, #3676d0)}:host([variant=primary]:not([disabled])) button:hover{--vi-chip-bg-color: var(--vi-color-blue-100, #ebf5ff);--vi-chip-border-color: var(--vi-color-blue-200, #cee6ff)}:host([variant=primary][selected]) button{--vi-chip-bg-color: var(--vi-color-info, #3676d0);--vi-chip-border-color: var(--vi-color-info, #3676d0);--vi-chip-text-color: var(--vi-text-primary-inverse, #ffffff)}:host([variant=success]) button{--vi-chip-bg-color: var(--vi-bg-success, #e6f9f0);--vi-chip-border-color: var(--vi-bg-success, #e6f9f0);--vi-chip-text-color: var(--vi-text-success, #265a3d)}:host([variant=success]:not([disabled])) button:hover{--vi-chip-bg-color: var(--vi-color-green-100, #e6f0eb);--vi-chip-border-color: var(--vi-color-green-200, #c0dbcd)}:host([variant=success][selected]) button{--vi-chip-bg-color: var(--vi-color-success, #489167);--vi-chip-border-color: var(--vi-color-success, #489167);--vi-chip-text-color: var(--vi-text-primary-inverse, #ffffff)}:host([variant=warning]) button{--vi-chip-bg-color: var(--vi-bg-warning, #fff8e1);--vi-chip-border-color: var(--vi-bg-warning, #fff8e1);--vi-chip-text-color: var(--vi-text-warning, #e68300)}:host([variant=warning]:not([disabled])) button:hover{--vi-chip-bg-color: var(--vi-color-yellow-100, #ffeab1);--vi-chip-border-color: var(--vi-color-yellow-200, #ffde85)}:host([variant=warning][selected]) button{--vi-chip-bg-color: var(--vi-color-warning, #ffba00);--vi-chip-border-color: var(--vi-color-warning, #ffba00);--vi-chip-text-color: var(--vi-text-primary-inverse, #ffffff)}:host([variant=danger]) button{--vi-chip-bg-color: var(--vi-bg-error, #ffebee);--vi-chip-border-color: var(--vi-bg-error, #ffebee);--vi-chip-text-color: var(--vi-text-error, #db231b)}:host([variant=danger]:not([disabled])) button:hover{--vi-chip-bg-color: var(--vi-color-red-100, #ffccce);--vi-chip-border-color: var(--vi-color-red-200, #f69892)}:host([variant=danger][selected]) button{--vi-chip-bg-color: var(--vi-color-error, #ef4444);--vi-chip-border-color: var(--vi-color-error, #ef4444);--vi-chip-text-color: var(--vi-text-primary-inverse, #ffffff)}:host([variant=info]) button{--vi-chip-bg-color: var(--vi-bg-info, #e3f2fd);--vi-chip-border-color: var(--vi-bg-info, #e3f2fd);--vi-chip-text-color: var(--vi-text-info, #3676d0)}:host([variant=info]:not([disabled])) button:hover{--vi-chip-bg-color: var(--vi-color-blue-100, #ebf5ff);--vi-chip-border-color: var(--vi-color-blue-200, #cee6ff)}:host([variant=info][selected]) button{--vi-chip-bg-color: var(--vi-color-info, #3676d0);--vi-chip-border-color: var(--vi-color-info, #3676d0);--vi-chip-text-color: var(--vi-text-primary-inverse, #ffffff)}:host([disabled]) button{--vi-chip-bg-color: var(--vi-color-grey-50, #fafafa);--vi-chip-border-color: var(--vi-color-grey-200, #eeeeee);--vi-chip-text-color: var(--vi-color-grey-300, #e0e0e0)}.chip-avatar[hidden],.chip-icon[hidden],::slotted([slot=trailing-icon][hidden]){display:none!important}vi-button[part=remove-btn]{margin-inline-start:4px;margin-inline-end:-6px;border-radius:50%;color:inherit}";
1470
+
1471
+ function applyDecs2203RFactory$1() {
1472
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
1473
+ return function addInitializer(initializer) {
1474
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
1475
+ assertCallable(initializer, "An initializer");
1476
+ initializers.push(initializer);
1477
+ };
1478
+ }
1479
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
1480
+ var kindStr;
1481
+ switch(kind){
1482
+ case 1:
1483
+ kindStr = "accessor";
1484
+ break;
1485
+ case 2:
1486
+ kindStr = "method";
1487
+ break;
1488
+ case 3:
1489
+ kindStr = "getter";
1490
+ break;
1491
+ case 4:
1492
+ kindStr = "setter";
1493
+ break;
1494
+ default:
1495
+ kindStr = "field";
1496
+ }
1497
+ var ctx = {
1498
+ kind: kindStr,
1499
+ name: isPrivate ? "#" + name : name,
1500
+ static: isStatic,
1501
+ private: isPrivate,
1502
+ metadata: metadata
1503
+ };
1504
+ var decoratorFinishedRef = {
1505
+ v: false
1506
+ };
1507
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
1508
+ var get, set;
1509
+ if (kind === 0) {
1510
+ if (isPrivate) {
1511
+ get = desc.get;
1512
+ set = desc.set;
1513
+ } else {
1514
+ get = function() {
1515
+ return this[name];
1516
+ };
1517
+ set = function(v) {
1518
+ this[name] = v;
1519
+ };
1520
+ }
1521
+ } else if (kind === 2) {
1522
+ get = function() {
1523
+ return desc.value;
1524
+ };
1525
+ } else {
1526
+ if (kind === 1 || kind === 3) {
1527
+ get = function() {
1528
+ return desc.get.call(this);
1529
+ };
1530
+ }
1531
+ if (kind === 1 || kind === 4) {
1532
+ set = function(v) {
1533
+ desc.set.call(this, v);
1534
+ };
1535
+ }
1536
+ }
1537
+ ctx.access = get && set ? {
1538
+ get: get,
1539
+ set: set
1540
+ } : get ? {
1541
+ get: get
1542
+ } : {
1543
+ set: set
1544
+ };
1545
+ try {
1546
+ return dec(value, ctx);
1547
+ } finally{
1548
+ decoratorFinishedRef.v = true;
1549
+ }
1550
+ }
1551
+ function assertNotFinished(decoratorFinishedRef, fnName) {
1552
+ if (decoratorFinishedRef.v) {
1553
+ throw new Error("attempted to call " + fnName + " after decoration was finished");
1554
+ }
1555
+ }
1556
+ function assertCallable(fn, hint) {
1557
+ if (typeof fn !== "function") {
1558
+ throw new TypeError(hint + " must be a function");
1559
+ }
1560
+ }
1561
+ function assertValidReturnValue(kind, value) {
1562
+ var type = typeof value;
1563
+ if (kind === 1) {
1564
+ if (type !== "object" || value === null) {
1565
+ throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
1566
+ }
1567
+ if (value.get !== undefined) {
1568
+ assertCallable(value.get, "accessor.get");
1569
+ }
1570
+ if (value.set !== undefined) {
1571
+ assertCallable(value.set, "accessor.set");
1572
+ }
1573
+ if (value.init !== undefined) {
1574
+ assertCallable(value.init, "accessor.init");
1575
+ }
1576
+ } else if (type !== "function") {
1577
+ var hint;
1578
+ if (kind === 0) {
1579
+ hint = "field";
1580
+ } else if (kind === 10) {
1581
+ hint = "class";
1582
+ } else {
1583
+ hint = "method";
1584
+ }
1585
+ throw new TypeError(hint + " decorators must return a function or void 0");
1586
+ }
1587
+ }
1588
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
1589
+ var decs = decInfo[0];
1590
+ var desc, init, value;
1591
+ if (isPrivate) {
1592
+ if (kind === 0 || kind === 1) {
1593
+ desc = {
1594
+ get: decInfo[3],
1595
+ set: decInfo[4]
1596
+ };
1597
+ } else if (kind === 3) {
1598
+ desc = {
1599
+ get: decInfo[3]
1600
+ };
1601
+ } else if (kind === 4) {
1602
+ desc = {
1603
+ set: decInfo[3]
1604
+ };
1605
+ } else {
1606
+ desc = {
1607
+ value: decInfo[3]
1608
+ };
1609
+ }
1610
+ } else if (kind !== 0) {
1611
+ desc = Object.getOwnPropertyDescriptor(base, name);
1612
+ }
1613
+ if (kind === 1) {
1614
+ value = {
1615
+ get: desc.get,
1616
+ set: desc.set
1617
+ };
1618
+ } else if (kind === 2) {
1619
+ value = desc.value;
1620
+ } else if (kind === 3) {
1621
+ value = desc.get;
1622
+ } else if (kind === 4) {
1623
+ value = desc.set;
1624
+ }
1625
+ var newValue, get, set;
1626
+ if (typeof decs === "function") {
1627
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
1628
+ if (newValue !== void 0) {
1629
+ assertValidReturnValue(kind, newValue);
1630
+ if (kind === 0) {
1631
+ init = newValue;
1632
+ } else if (kind === 1) {
1633
+ init = newValue.init;
1634
+ get = newValue.get || value.get;
1635
+ set = newValue.set || value.set;
1636
+ value = {
1637
+ get: get,
1638
+ set: set
1639
+ };
1640
+ } else {
1641
+ value = newValue;
1642
+ }
1643
+ }
1644
+ } else {
1645
+ for(var i = decs.length - 1; i >= 0; i--){
1646
+ var dec = decs[i];
1647
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
1648
+ if (newValue !== void 0) {
1649
+ assertValidReturnValue(kind, newValue);
1650
+ var newInit;
1651
+ if (kind === 0) {
1652
+ newInit = newValue;
1653
+ } else if (kind === 1) {
1654
+ newInit = newValue.init;
1655
+ get = newValue.get || value.get;
1656
+ set = newValue.set || value.set;
1657
+ value = {
1658
+ get: get,
1659
+ set: set
1660
+ };
1661
+ } else {
1662
+ value = newValue;
1663
+ }
1664
+ if (newInit !== void 0) {
1665
+ if (init === void 0) {
1666
+ init = newInit;
1667
+ } else if (typeof init === "function") {
1668
+ init = [
1669
+ init,
1670
+ newInit
1671
+ ];
1672
+ } else {
1673
+ init.push(newInit);
1674
+ }
1675
+ }
1676
+ }
1677
+ }
1678
+ }
1679
+ if (kind === 0 || kind === 1) {
1680
+ if (init === void 0) {
1681
+ init = function(instance, init) {
1682
+ return init;
1683
+ };
1684
+ } else if (typeof init !== "function") {
1685
+ var ownInitializers = init;
1686
+ init = function(instance, init) {
1687
+ var value = init;
1688
+ for(var i = 0; i < ownInitializers.length; i++){
1689
+ value = ownInitializers[i].call(instance, value);
1690
+ }
1691
+ return value;
1692
+ };
1693
+ } else {
1694
+ var originalInitializer = init;
1695
+ init = function(instance, init) {
1696
+ return originalInitializer.call(instance, init);
1697
+ };
1698
+ }
1699
+ ret.push(init);
1700
+ }
1701
+ if (kind !== 0) {
1702
+ if (kind === 1) {
1703
+ desc.get = value.get;
1704
+ desc.set = value.set;
1705
+ } else if (kind === 2) {
1706
+ desc.value = value;
1707
+ } else if (kind === 3) {
1708
+ desc.get = value;
1709
+ } else if (kind === 4) {
1710
+ desc.set = value;
1711
+ }
1712
+ if (isPrivate) {
1713
+ if (kind === 1) {
1714
+ ret.push(function(instance, args) {
1715
+ return value.get.call(instance, args);
1716
+ });
1717
+ ret.push(function(instance, args) {
1718
+ return value.set.call(instance, args);
1719
+ });
1720
+ } else if (kind === 2) {
1721
+ ret.push(value);
1722
+ } else {
1723
+ ret.push(function(instance, args) {
1724
+ return value.call(instance, args);
1725
+ });
1726
+ }
1727
+ } else {
1728
+ Object.defineProperty(base, name, desc);
1729
+ }
1730
+ }
1731
+ }
1732
+ function applyMemberDecs(Class, decInfos, metadata) {
1733
+ var ret = [];
1734
+ var protoInitializers;
1735
+ var staticInitializers;
1736
+ var existingProtoNonFields = new Map();
1737
+ var existingStaticNonFields = new Map();
1738
+ for(var i = 0; i < decInfos.length; i++){
1739
+ var decInfo = decInfos[i];
1740
+ if (!Array.isArray(decInfo)) continue;
1741
+ var kind = decInfo[1];
1742
+ var name = decInfo[2];
1743
+ var isPrivate = decInfo.length > 3;
1744
+ var isStatic = kind >= 5;
1745
+ var base;
1746
+ var initializers;
1747
+ if (isStatic) {
1748
+ base = Class;
1749
+ kind = kind - 5;
1750
+ staticInitializers = staticInitializers || [];
1751
+ initializers = staticInitializers;
1752
+ } else {
1753
+ base = Class.prototype;
1754
+ protoInitializers = protoInitializers || [];
1755
+ initializers = protoInitializers;
1756
+ }
1757
+ if (kind !== 0 && !isPrivate) {
1758
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
1759
+ var existingKind = existingNonFields.get(name) || 0;
1760
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
1761
+ 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);
1762
+ } else if (!existingKind && kind > 2) {
1763
+ existingNonFields.set(name, kind);
1764
+ } else {
1765
+ existingNonFields.set(name, true);
1766
+ }
1767
+ }
1768
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
1769
+ }
1770
+ pushInitializers(ret, protoInitializers);
1771
+ pushInitializers(ret, staticInitializers);
1772
+ return ret;
1773
+ }
1774
+ function pushInitializers(ret, initializers) {
1775
+ if (initializers) {
1776
+ ret.push(function(instance) {
1777
+ for(var i = 0; i < initializers.length; i++){
1778
+ initializers[i].call(instance);
1779
+ }
1780
+ return instance;
1781
+ });
1782
+ }
1783
+ }
1784
+ function applyClassDecs(targetClass, classDecs, metadata) {
1785
+ if (classDecs.length > 0) {
1786
+ var initializers = [];
1787
+ var newClass = targetClass;
1788
+ var name = targetClass.name;
1789
+ for(var i = classDecs.length - 1; i >= 0; i--){
1790
+ var decoratorFinishedRef = {
1791
+ v: false
1792
+ };
1793
+ try {
1794
+ var nextNewClass = classDecs[i](newClass, {
1795
+ kind: "class",
1796
+ name: name,
1797
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
1798
+ metadata
1799
+ });
1800
+ } finally{
1801
+ decoratorFinishedRef.v = true;
1802
+ }
1803
+ if (nextNewClass !== undefined) {
1804
+ assertValidReturnValue(10, nextNewClass);
1805
+ newClass = nextNewClass;
1806
+ }
1807
+ }
1808
+ return [
1809
+ defineMetadata(newClass, metadata),
1810
+ function() {
1811
+ for(var i = 0; i < initializers.length; i++){
1812
+ initializers[i].call(newClass);
1813
+ }
1814
+ }
1815
+ ];
1816
+ }
1817
+ }
1818
+ function defineMetadata(Class, metadata) {
1819
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
1820
+ configurable: true,
1821
+ enumerable: true,
1822
+ value: metadata
1823
+ });
1824
+ }
1825
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
1826
+ if (parentClass !== void 0) {
1827
+ var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
1828
+ }
1829
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
1830
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
1831
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
1832
+ return {
1833
+ e: e,
1834
+ get c () {
1835
+ return applyClassDecs(targetClass, classDecs, metadata);
1836
+ }
1837
+ };
1838
+ };
1839
+ }
1840
+ function _apply_decs_2203_r$1(targetClass, memberDecs, classDecs, parentClass) {
1841
+ return (_apply_decs_2203_r$1 = applyDecs2203RFactory$1())(targetClass, memberDecs, classDecs, parentClass);
1842
+ }
1843
+ function _identity$1(x) {
1844
+ return x;
1845
+ }
1846
+ var _dec$1, _initClass$1, _FocusableMixin, _dec1$1, _dec2$1, _dec3$1, _dec4$1, _dec5$1, _dec6$1, _dec7$1, _dec8$1, _dec9$1, _dec10$1, _dec11, /** Value for group selection tracking. */ _init_value$1, /** Selected / active state. */ _init_selected, /** Disables the chip. */ _init_disabled$1, /** Show × remove button. */ _init_removable, /** Screen reader text for the remove button (default: 'Remove') */ _init_removeAriaLabel, /** Base colour. */ _init_variant, /** Chip size. */ _init_size, _init__inGroup, _init__hasAvatar, _init__hasIcon, _init__hasTrailingIcon, _initProto$1;
1847
+ let _ViChip;
1848
+ _dec$1 = customElement('vi-chip'), _dec1$1 = property({
1849
+ type: String,
1850
+ reflect: true
1851
+ }), _dec2$1 = property({
1852
+ type: Boolean,
1853
+ reflect: true
1854
+ }), _dec3$1 = property({
1855
+ type: Boolean,
1856
+ reflect: true
1857
+ }), _dec4$1 = property({
1858
+ type: Boolean,
1859
+ reflect: true
1860
+ }), _dec5$1 = property({
1861
+ type: String,
1862
+ attribute: 'remove-aria-label'
1863
+ }), _dec6$1 = property({
1864
+ type: String,
1865
+ reflect: true
1866
+ }), _dec7$1 = property({
1867
+ type: String,
1868
+ reflect: true
1869
+ }), _dec8$1 = state(), _dec9$1 = state(), _dec10$1 = state(), _dec11 = state();
1870
+ new class extends _identity$1 {
1871
+ constructor(){
1872
+ super(_ViChip), _initClass$1();
1873
+ }
1874
+ static{
1875
+ class ViChip extends (_FocusableMixin = FocusableMixin(ViElement)) {
1876
+ static{
1877
+ ({ e: [_init_value$1, _init_selected, _init_disabled$1, _init_removable, _init_removeAriaLabel, _init_variant, _init_size, _init__inGroup, _init__hasAvatar, _init__hasIcon, _init__hasTrailingIcon, _initProto$1], c: [_ViChip, _initClass$1] } = _apply_decs_2203_r$1(this, [
1878
+ [
1879
+ _dec1$1,
1880
+ 1,
1881
+ "value"
1882
+ ],
1883
+ [
1884
+ _dec2$1,
1885
+ 1,
1886
+ "selected"
1887
+ ],
1888
+ [
1889
+ _dec3$1,
1890
+ 1,
1891
+ "disabled"
1892
+ ],
1893
+ [
1894
+ _dec4$1,
1895
+ 1,
1896
+ "removable"
1897
+ ],
1898
+ [
1899
+ _dec5$1,
1900
+ 1,
1901
+ "removeAriaLabel"
1902
+ ],
1903
+ [
1904
+ _dec6$1,
1905
+ 1,
1906
+ "variant"
1907
+ ],
1908
+ [
1909
+ _dec7$1,
1910
+ 1,
1911
+ "size"
1912
+ ],
1913
+ [
1914
+ _dec8$1,
1915
+ 1,
1916
+ "_inGroup"
1917
+ ],
1918
+ [
1919
+ _dec9$1,
1920
+ 1,
1921
+ "_hasAvatar"
1922
+ ],
1923
+ [
1924
+ _dec10$1,
1925
+ 1,
1926
+ "_hasIcon"
1927
+ ],
1928
+ [
1929
+ _dec11,
1930
+ 1,
1931
+ "_hasTrailingIcon"
1932
+ ]
1933
+ ], [
1934
+ _dec$1
1935
+ ], _FocusableMixin));
1936
+ }
1937
+ static styles = css`${unsafeCSS(chipStyles)}`;
1938
+ get _focusableElement() {
1939
+ return this.shadowRoot?.querySelector('button') ?? null;
1940
+ }
1941
+ #___private_value_1 = (_initProto$1(this), _init_value$1(this, ''));
1942
+ get value() {
1943
+ return this.#___private_value_1;
1944
+ }
1945
+ set value(_v) {
1946
+ this.#___private_value_1 = _v;
1947
+ }
1948
+ #___private_selected_2 = _init_selected(this, false);
1949
+ get selected() {
1950
+ return this.#___private_selected_2;
1951
+ }
1952
+ set selected(_v) {
1953
+ this.#___private_selected_2 = _v;
1954
+ }
1955
+ #___private_disabled_3 = _init_disabled$1(this, false);
1956
+ get disabled() {
1957
+ return this.#___private_disabled_3;
1958
+ }
1959
+ set disabled(_v) {
1960
+ this.#___private_disabled_3 = _v;
1961
+ }
1962
+ #___private_removable_4 = _init_removable(this, false);
1963
+ get removable() {
1964
+ return this.#___private_removable_4;
1965
+ }
1966
+ set removable(_v) {
1967
+ this.#___private_removable_4 = _v;
1968
+ }
1969
+ #___private_removeAriaLabel_5 = _init_removeAriaLabel(this, 'Remove');
1970
+ get removeAriaLabel() {
1971
+ return this.#___private_removeAriaLabel_5;
1972
+ }
1973
+ set removeAriaLabel(_v) {
1974
+ this.#___private_removeAriaLabel_5 = _v;
1975
+ }
1976
+ #___private_variant_6 = _init_variant(this, 'neutral');
1977
+ get variant() {
1978
+ return this.#___private_variant_6;
1979
+ }
1980
+ set variant(_v) {
1981
+ this.#___private_variant_6 = _v;
1982
+ }
1983
+ #___private_size_7 = _init_size(this, 'md');
1984
+ get size() {
1985
+ return this.#___private_size_7;
1986
+ }
1987
+ set size(_v) {
1988
+ this.#___private_size_7 = _v;
1989
+ }
1990
+ #___private__inGroup_8 = _init__inGroup(this, false);
1991
+ get _inGroup() {
1992
+ return this.#___private__inGroup_8;
1993
+ }
1994
+ set _inGroup(_v) {
1995
+ this.#___private__inGroup_8 = _v;
1996
+ }
1997
+ #___private__hasAvatar_9 = _init__hasAvatar(this, false);
1998
+ get _hasAvatar() {
1999
+ return this.#___private__hasAvatar_9;
2000
+ }
2001
+ set _hasAvatar(_v) {
2002
+ this.#___private__hasAvatar_9 = _v;
2003
+ }
2004
+ #___private__hasIcon_10 = _init__hasIcon(this, false);
2005
+ get _hasIcon() {
2006
+ return this.#___private__hasIcon_10;
2007
+ }
2008
+ set _hasIcon(_v) {
2009
+ this.#___private__hasIcon_10 = _v;
2010
+ }
2011
+ #___private__hasTrailingIcon_11 = _init__hasTrailingIcon(this, false);
2012
+ get _hasTrailingIcon() {
2013
+ return this.#___private__hasTrailingIcon_11;
2014
+ }
2015
+ set _hasTrailingIcon(_v) {
2016
+ this.#___private__hasTrailingIcon_11 = _v;
2017
+ }
2018
+ connectedCallback() {
2019
+ super.connectedCallback();
2020
+ this._inGroup = this.closest('vi-chip-group') !== null;
2021
+ this._syncSlotsFromLightDom();
2022
+ }
2023
+ firstUpdated(changed) {
2024
+ super.firstUpdated(changed);
2025
+ this._syncSlots();
2026
+ }
2027
+ updated(changed) {
2028
+ super.updated(changed);
2029
+ if (changed.has('disabled')) {
2030
+ if (this.disabled) {
2031
+ this._setHostFocusable(false);
2032
+ } else if (changed.get('disabled') !== undefined) {
2033
+ this._setHostFocusable(true);
2034
+ }
2035
+ }
2036
+ }
2037
+ _syncSlotsFromLightDom() {
2038
+ if (this.querySelector('[slot="avatar"]')) this._hasAvatar = true;
2039
+ if (this.querySelector('[slot="icon"]')) this._hasIcon = true;
2040
+ if (this.querySelector('[slot="trailing-icon"]')) this._hasTrailingIcon = true;
2041
+ }
2042
+ _syncSlots() {
2043
+ const avatarSlot = this.shadowRoot?.querySelector('slot[name="avatar"]');
2044
+ const iconSlot = this.shadowRoot?.querySelector('slot[name="icon"]');
2045
+ const trailingSlot = this.shadowRoot?.querySelector('slot[name="trailing-icon"]');
2046
+ if (avatarSlot) {
2047
+ this._hasAvatar = avatarSlot.assignedElements({
2048
+ flatten: true
2049
+ }).length > 0;
2050
+ }
2051
+ if (iconSlot) {
2052
+ this._hasIcon = iconSlot.assignedElements({
2053
+ flatten: true
2054
+ }).length > 0;
2055
+ }
2056
+ if (trailingSlot) {
2057
+ this._hasTrailingIcon = trailingSlot.assignedElements({
2058
+ flatten: true
2059
+ }).length > 0;
2060
+ }
2061
+ }
2062
+ onAvatarSlotChange(e) {
2063
+ const slot = e.target;
2064
+ this._hasAvatar = slot.assignedElements({
2065
+ flatten: true
2066
+ }).length > 0;
2067
+ }
2068
+ onIconSlotChange(e) {
2069
+ const slot = e.target;
2070
+ this._hasIcon = slot.assignedElements({
2071
+ flatten: true
2072
+ }).length > 0;
2073
+ }
2074
+ onTrailingIconSlotChange(e) {
2075
+ const slot = e.target;
2076
+ this._hasTrailingIcon = slot.assignedElements({
2077
+ flatten: true
2078
+ }).length > 0;
2079
+ }
2080
+ _handleSelect(e) {
2081
+ if (this.disabled) {
2082
+ e.preventDefault();
2083
+ e.stopImmediatePropagation();
2084
+ return;
2085
+ }
2086
+ this.dispatchEvent(new CustomEvent('vialiq-select', {
2087
+ detail: {
2088
+ value: this.value,
2089
+ selected: !this.selected
2090
+ },
2091
+ bubbles: true,
2092
+ composed: true
2093
+ }));
2094
+ }
2095
+ _handleRemove(e) {
2096
+ if (this.disabled) {
2097
+ e.preventDefault();
2098
+ e.stopImmediatePropagation();
2099
+ return;
2100
+ }
2101
+ e.stopPropagation();
2102
+ this.dispatchEvent(new CustomEvent('vialiq-remove', {
2103
+ detail: {
2104
+ value: this.value
2105
+ },
2106
+ bubbles: true,
2107
+ composed: true
2108
+ }));
2109
+ }
2110
+ _handleKeyDown(e) {
2111
+ if (this.disabled) return;
2112
+ if (e.key === 'Enter' || e.key === ' ') {
2113
+ e.preventDefault();
2114
+ this._handleSelect(e);
2115
+ } else if (this.removable && (e.key === 'Backspace' || e.key === 'Delete')) {
2116
+ e.preventDefault();
2117
+ this._handleRemove(e);
2118
+ }
2119
+ }
2120
+ render() {
2121
+ const role = this._inGroup ? 'option' : 'button';
2122
+ const ariaSelected = this._inGroup ? this.selected ? 'true' : 'false' : null;
2123
+ const ariaPressed = !this._inGroup ? this.selected ? 'true' : 'false' : null;
2124
+ return html`
2125
+ <button
2126
+ part="chip"
2127
+ type="button"
2128
+ role=${role}
2129
+ aria-selected=${ariaSelected ?? undefined}
2130
+ aria-pressed=${ariaPressed ?? undefined}
2131
+ aria-disabled=${this.disabled ? 'true' : 'false'}
2132
+ tabindex=${this.disabled ? -1 : 0}
2133
+ @click=${this._handleSelect}
2134
+ @keydown=${this._handleKeyDown}
2135
+ >
2136
+ <slot name="avatar" class="chip-avatar" @slotchange=${this.onAvatarSlotChange} ?hidden=${!this._hasAvatar}></slot>
2137
+ <slot name="icon" class="chip-icon" @slotchange=${this.onIconSlotChange} ?hidden=${this._hasAvatar || !this._hasIcon}></slot>
2138
+
2139
+ ${this.selected ? html`<vi-icon part="check-icon" name="check" size="12"></vi-icon>` : ''}
2140
+
2141
+ <span part="label" class="chip-label">
2142
+ <slot></slot>
2143
+ </span>
2144
+
2145
+ <slot name="trailing-icon" @slotchange=${this.onTrailingIconSlotChange} ?hidden=${!this._hasTrailingIcon}></slot>
2146
+
2147
+ ${this.removable ? html`
2148
+ <vi-button
2149
+ part="remove-btn"
2150
+ variant="ghost"
2151
+ size="xs"
2152
+ icon-only
2153
+ aria-label=${this.removeAriaLabel || 'Remove'}
2154
+ @click=${this._handleRemove}
2155
+ tabindex=${this.disabled ? -1 : 0}
2156
+ >
2157
+ <vi-icon name="x" size="12" slot="icon"></vi-icon>
2158
+ </vi-button>
2159
+ ` : ''}
2160
+ </button>
2161
+ `;
2162
+ }
2163
+ }
2164
+ }
2165
+ }();
2166
+
2167
+ const groupStyles = ":host{display:block}:host([hidden]){display:none!important}[part=group]{display:flex;align-items:center}";
2168
+
2169
+ function applyDecs2203RFactory() {
2170
+ function createAddInitializerMethod(initializers, decoratorFinishedRef) {
2171
+ return function addInitializer(initializer) {
2172
+ assertNotFinished(decoratorFinishedRef, "addInitializer");
2173
+ assertCallable(initializer, "An initializer");
2174
+ initializers.push(initializer);
2175
+ };
2176
+ }
2177
+ function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
2178
+ var kindStr;
2179
+ switch(kind){
2180
+ case 1:
2181
+ kindStr = "accessor";
2182
+ break;
2183
+ case 2:
2184
+ kindStr = "method";
2185
+ break;
2186
+ case 3:
2187
+ kindStr = "getter";
2188
+ break;
2189
+ case 4:
2190
+ kindStr = "setter";
2191
+ break;
2192
+ default:
2193
+ kindStr = "field";
2194
+ }
2195
+ var ctx = {
2196
+ kind: kindStr,
2197
+ name: isPrivate ? "#" + name : name,
2198
+ static: isStatic,
2199
+ private: isPrivate,
2200
+ metadata: metadata
2201
+ };
2202
+ var decoratorFinishedRef = {
2203
+ v: false
2204
+ };
2205
+ ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
2206
+ var get, set;
2207
+ if (kind === 0) {
2208
+ if (isPrivate) {
2209
+ get = desc.get;
2210
+ set = desc.set;
2211
+ } else {
2212
+ get = function() {
2213
+ return this[name];
2214
+ };
2215
+ set = function(v) {
2216
+ this[name] = v;
2217
+ };
2218
+ }
2219
+ } else if (kind === 2) {
2220
+ get = function() {
2221
+ return desc.value;
2222
+ };
2223
+ } else {
2224
+ if (kind === 1 || kind === 3) {
2225
+ get = function() {
2226
+ return desc.get.call(this);
2227
+ };
2228
+ }
2229
+ if (kind === 1 || kind === 4) {
2230
+ set = function(v) {
2231
+ desc.set.call(this, v);
2232
+ };
2233
+ }
2234
+ }
2235
+ ctx.access = get && set ? {
2236
+ get: get,
2237
+ set: set
2238
+ } : get ? {
2239
+ get: get
2240
+ } : {
2241
+ set: set
2242
+ };
2243
+ try {
2244
+ return dec(value, ctx);
2245
+ } finally{
2246
+ decoratorFinishedRef.v = true;
2247
+ }
2248
+ }
2249
+ function assertNotFinished(decoratorFinishedRef, fnName) {
2250
+ if (decoratorFinishedRef.v) {
2251
+ throw new Error("attempted to call " + fnName + " after decoration was finished");
2252
+ }
2253
+ }
2254
+ function assertCallable(fn, hint) {
2255
+ if (typeof fn !== "function") {
2256
+ throw new TypeError(hint + " must be a function");
2257
+ }
2258
+ }
2259
+ function assertValidReturnValue(kind, value) {
2260
+ var type = typeof value;
2261
+ if (kind === 1) {
2262
+ if (type !== "object" || value === null) {
2263
+ throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
2264
+ }
2265
+ if (value.get !== undefined) {
2266
+ assertCallable(value.get, "accessor.get");
2267
+ }
2268
+ if (value.set !== undefined) {
2269
+ assertCallable(value.set, "accessor.set");
2270
+ }
2271
+ if (value.init !== undefined) {
2272
+ assertCallable(value.init, "accessor.init");
2273
+ }
2274
+ } else if (type !== "function") {
2275
+ var hint;
2276
+ if (kind === 0) {
2277
+ hint = "field";
2278
+ } else if (kind === 10) {
2279
+ hint = "class";
2280
+ } else {
2281
+ hint = "method";
2282
+ }
2283
+ throw new TypeError(hint + " decorators must return a function or void 0");
2284
+ }
2285
+ }
2286
+ function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
2287
+ var decs = decInfo[0];
2288
+ var desc, init, value;
2289
+ if (isPrivate) {
2290
+ if (kind === 0 || kind === 1) {
2291
+ desc = {
2292
+ get: decInfo[3],
2293
+ set: decInfo[4]
2294
+ };
2295
+ } else if (kind === 3) {
2296
+ desc = {
2297
+ get: decInfo[3]
2298
+ };
2299
+ } else if (kind === 4) {
2300
+ desc = {
2301
+ set: decInfo[3]
2302
+ };
2303
+ } else {
2304
+ desc = {
2305
+ value: decInfo[3]
2306
+ };
2307
+ }
2308
+ } else if (kind !== 0) {
2309
+ desc = Object.getOwnPropertyDescriptor(base, name);
2310
+ }
2311
+ if (kind === 1) {
2312
+ value = {
2313
+ get: desc.get,
2314
+ set: desc.set
2315
+ };
2316
+ } else if (kind === 2) {
2317
+ value = desc.value;
2318
+ } else if (kind === 3) {
2319
+ value = desc.get;
2320
+ } else if (kind === 4) {
2321
+ value = desc.set;
2322
+ }
2323
+ var newValue, get, set;
2324
+ if (typeof decs === "function") {
2325
+ newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
2326
+ if (newValue !== void 0) {
2327
+ assertValidReturnValue(kind, newValue);
2328
+ if (kind === 0) {
2329
+ init = newValue;
2330
+ } else if (kind === 1) {
2331
+ init = newValue.init;
2332
+ get = newValue.get || value.get;
2333
+ set = newValue.set || value.set;
2334
+ value = {
2335
+ get: get,
2336
+ set: set
2337
+ };
2338
+ } else {
2339
+ value = newValue;
2340
+ }
2341
+ }
2342
+ } else {
2343
+ for(var i = decs.length - 1; i >= 0; i--){
2344
+ var dec = decs[i];
2345
+ newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
2346
+ if (newValue !== void 0) {
2347
+ assertValidReturnValue(kind, newValue);
2348
+ var newInit;
2349
+ if (kind === 0) {
2350
+ newInit = newValue;
2351
+ } else if (kind === 1) {
2352
+ newInit = newValue.init;
2353
+ get = newValue.get || value.get;
2354
+ set = newValue.set || value.set;
2355
+ value = {
2356
+ get: get,
2357
+ set: set
2358
+ };
2359
+ } else {
2360
+ value = newValue;
2361
+ }
2362
+ if (newInit !== void 0) {
2363
+ if (init === void 0) {
2364
+ init = newInit;
2365
+ } else if (typeof init === "function") {
2366
+ init = [
2367
+ init,
2368
+ newInit
2369
+ ];
2370
+ } else {
2371
+ init.push(newInit);
2372
+ }
2373
+ }
2374
+ }
2375
+ }
2376
+ }
2377
+ if (kind === 0 || kind === 1) {
2378
+ if (init === void 0) {
2379
+ init = function(instance, init) {
2380
+ return init;
2381
+ };
2382
+ } else if (typeof init !== "function") {
2383
+ var ownInitializers = init;
2384
+ init = function(instance, init) {
2385
+ var value = init;
2386
+ for(var i = 0; i < ownInitializers.length; i++){
2387
+ value = ownInitializers[i].call(instance, value);
2388
+ }
2389
+ return value;
2390
+ };
2391
+ } else {
2392
+ var originalInitializer = init;
2393
+ init = function(instance, init) {
2394
+ return originalInitializer.call(instance, init);
2395
+ };
2396
+ }
2397
+ ret.push(init);
2398
+ }
2399
+ if (kind !== 0) {
2400
+ if (kind === 1) {
2401
+ desc.get = value.get;
2402
+ desc.set = value.set;
2403
+ } else if (kind === 2) {
2404
+ desc.value = value;
2405
+ } else if (kind === 3) {
2406
+ desc.get = value;
2407
+ } else if (kind === 4) {
2408
+ desc.set = value;
2409
+ }
2410
+ if (isPrivate) {
2411
+ if (kind === 1) {
2412
+ ret.push(function(instance, args) {
2413
+ return value.get.call(instance, args);
2414
+ });
2415
+ ret.push(function(instance, args) {
2416
+ return value.set.call(instance, args);
2417
+ });
2418
+ } else if (kind === 2) {
2419
+ ret.push(value);
2420
+ } else {
2421
+ ret.push(function(instance, args) {
2422
+ return value.call(instance, args);
2423
+ });
2424
+ }
2425
+ } else {
2426
+ Object.defineProperty(base, name, desc);
2427
+ }
2428
+ }
2429
+ }
2430
+ function applyMemberDecs(Class, decInfos, metadata) {
2431
+ var ret = [];
2432
+ var protoInitializers;
2433
+ var staticInitializers;
2434
+ var existingProtoNonFields = new Map();
2435
+ var existingStaticNonFields = new Map();
2436
+ for(var i = 0; i < decInfos.length; i++){
2437
+ var decInfo = decInfos[i];
2438
+ if (!Array.isArray(decInfo)) continue;
2439
+ var kind = decInfo[1];
2440
+ var name = decInfo[2];
2441
+ var isPrivate = decInfo.length > 3;
2442
+ var isStatic = kind >= 5;
2443
+ var base;
2444
+ var initializers;
2445
+ if (isStatic) {
2446
+ base = Class;
2447
+ kind = kind - 5;
2448
+ staticInitializers = staticInitializers || [];
2449
+ initializers = staticInitializers;
2450
+ } else {
2451
+ base = Class.prototype;
2452
+ protoInitializers = protoInitializers || [];
2453
+ initializers = protoInitializers;
2454
+ }
2455
+ if (kind !== 0 && !isPrivate) {
2456
+ var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
2457
+ var existingKind = existingNonFields.get(name) || 0;
2458
+ if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) {
2459
+ 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);
2460
+ } else if (!existingKind && kind > 2) {
2461
+ existingNonFields.set(name, kind);
2462
+ } else {
2463
+ existingNonFields.set(name, true);
2464
+ }
2465
+ }
2466
+ applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
2467
+ }
2468
+ pushInitializers(ret, protoInitializers);
2469
+ pushInitializers(ret, staticInitializers);
2470
+ return ret;
2471
+ }
2472
+ function pushInitializers(ret, initializers) {
2473
+ if (initializers) {
2474
+ ret.push(function(instance) {
2475
+ for(var i = 0; i < initializers.length; i++){
2476
+ initializers[i].call(instance);
2477
+ }
2478
+ return instance;
2479
+ });
2480
+ }
2481
+ }
2482
+ function applyClassDecs(targetClass, classDecs, metadata) {
2483
+ if (classDecs.length > 0) {
2484
+ var initializers = [];
2485
+ var newClass = targetClass;
2486
+ var name = targetClass.name;
2487
+ for(var i = classDecs.length - 1; i >= 0; i--){
2488
+ var decoratorFinishedRef = {
2489
+ v: false
2490
+ };
2491
+ try {
2492
+ var nextNewClass = classDecs[i](newClass, {
2493
+ kind: "class",
2494
+ name: name,
2495
+ addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
2496
+ metadata
2497
+ });
2498
+ } finally{
2499
+ decoratorFinishedRef.v = true;
2500
+ }
2501
+ if (nextNewClass !== undefined) {
2502
+ assertValidReturnValue(10, nextNewClass);
2503
+ newClass = nextNewClass;
2504
+ }
2505
+ }
2506
+ return [
2507
+ defineMetadata(newClass, metadata),
2508
+ function() {
2509
+ for(var i = 0; i < initializers.length; i++){
2510
+ initializers[i].call(newClass);
2511
+ }
2512
+ }
2513
+ ];
2514
+ }
2515
+ }
2516
+ function defineMetadata(Class, metadata) {
2517
+ return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
2518
+ configurable: true,
2519
+ enumerable: true,
2520
+ value: metadata
2521
+ });
2522
+ }
2523
+ return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
2524
+ if (parentClass !== void 0) {
2525
+ var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
2526
+ }
2527
+ var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
2528
+ var e = applyMemberDecs(targetClass, memberDecs, metadata);
2529
+ if (!classDecs.length) defineMetadata(targetClass, metadata);
2530
+ return {
2531
+ e: e,
2532
+ get c () {
2533
+ return applyClassDecs(targetClass, classDecs, metadata);
2534
+ }
2535
+ };
2536
+ };
2537
+ }
2538
+ function _apply_decs_2203_r(targetClass, memberDecs, classDecs, parentClass) {
2539
+ return (_apply_decs_2203_r = applyDecs2203RFactory())(targetClass, memberDecs, classDecs, parentClass);
2540
+ }
2541
+ function _identity(x) {
2542
+ return x;
2543
+ }
2544
+ var _dec, _initClass, _ValidityMixin, _dec1, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, /** Currently selected chip values. */ _init_value, /** Allow multiple selections. */ _init_multi, /** Form field name. */ _init_name, /** At least one chip must be selected. */ _init_required, /** Disable all chips. */ _init_disabled, /** Chips wrap to next line. */ _init_wrap, /** Gap between chips. */ _init_gap, // ValidityMixin requirements
2545
+ _init_status, _init_validityMessage, _init__chips, _initProto;
2546
+ let _ViChipGroup;
2547
+ _dec = customElement('vi-chip-group'), _dec1 = property({
2548
+ type: Array
2549
+ }), _dec2 = property({
2550
+ type: Boolean
2551
+ }), _dec3 = property({
2552
+ type: String
2553
+ }), _dec4 = property({
2554
+ type: Boolean,
2555
+ reflect: true
2556
+ }), _dec5 = property({
2557
+ type: Boolean,
2558
+ reflect: true
2559
+ }), _dec6 = property({
2560
+ type: Boolean
2561
+ }), _dec7 = property({
2562
+ type: String
2563
+ }), _dec8 = property({
2564
+ reflect: true
2565
+ }), _dec9 = property(), _dec10 = queryAssignedElements({
2566
+ selector: 'vi-chip'
2567
+ });
2568
+ new class extends _identity {
2569
+ constructor(){
2570
+ super(_ViChipGroup), _initClass();
2571
+ }
2572
+ static{
2573
+ class ViChipGroup extends (_ValidityMixin = ValidityMixin(ViElement)) {
2574
+ static{
2575
+ ({ e: [_init_value, _init_multi, _init_name, _init_required, _init_disabled, _init_wrap, _init_gap, _init_status, _init_validityMessage, _init__chips, _initProto], c: [_ViChipGroup, _initClass] } = _apply_decs_2203_r(this, [
2576
+ [
2577
+ _dec1,
2578
+ 1,
2579
+ "value"
2580
+ ],
2581
+ [
2582
+ _dec2,
2583
+ 1,
2584
+ "multi"
2585
+ ],
2586
+ [
2587
+ _dec3,
2588
+ 1,
2589
+ "name"
2590
+ ],
2591
+ [
2592
+ _dec4,
2593
+ 1,
2594
+ "required"
2595
+ ],
2596
+ [
2597
+ _dec5,
2598
+ 1,
2599
+ "disabled"
2600
+ ],
2601
+ [
2602
+ _dec6,
2603
+ 1,
2604
+ "wrap"
2605
+ ],
2606
+ [
2607
+ _dec7,
2608
+ 1,
2609
+ "gap"
2610
+ ],
2611
+ [
2612
+ _dec8,
2613
+ 1,
2614
+ "status"
2615
+ ],
2616
+ [
2617
+ _dec9,
2618
+ 1,
2619
+ "validityMessage"
2620
+ ],
2621
+ [
2622
+ _dec10,
2623
+ 1,
2624
+ "_chips"
2625
+ ]
2626
+ ], [
2627
+ _dec
2628
+ ], _ValidityMixin));
2629
+ }
2630
+ static styles = css`${unsafeCSS(groupStyles)}`;
2631
+ #___private_value_1 = (_initProto(this), _init_value(this, []));
2632
+ get value() {
2633
+ return this.#___private_value_1;
2634
+ }
2635
+ set value(_v) {
2636
+ this.#___private_value_1 = _v;
2637
+ }
2638
+ #___private_multi_2 = _init_multi(this, true);
2639
+ get multi() {
2640
+ return this.#___private_multi_2;
2641
+ }
2642
+ set multi(_v) {
2643
+ this.#___private_multi_2 = _v;
2644
+ }
2645
+ #___private_name_3 = _init_name(this, '');
2646
+ get name() {
2647
+ return this.#___private_name_3;
2648
+ }
2649
+ set name(_v) {
2650
+ this.#___private_name_3 = _v;
2651
+ }
2652
+ #___private_required_4 = _init_required(this, false);
2653
+ get required() {
2654
+ return this.#___private_required_4;
2655
+ }
2656
+ set required(_v) {
2657
+ this.#___private_required_4 = _v;
2658
+ }
2659
+ #___private_disabled_5 = _init_disabled(this, false);
2660
+ get disabled() {
2661
+ return this.#___private_disabled_5;
2662
+ }
2663
+ set disabled(_v) {
2664
+ this.#___private_disabled_5 = _v;
2665
+ }
2666
+ #___private_wrap_6 = _init_wrap(this, true);
2667
+ get wrap() {
2668
+ return this.#___private_wrap_6;
2669
+ }
2670
+ set wrap(_v) {
2671
+ this.#___private_wrap_6 = _v;
2672
+ }
2673
+ #___private_gap_7 = _init_gap(this, '8px');
2674
+ get gap() {
2675
+ return this.#___private_gap_7;
2676
+ }
2677
+ set gap(_v) {
2678
+ this.#___private_gap_7 = _v;
2679
+ }
2680
+ #___private_status_8 = _init_status(this, 'default');
2681
+ get status() {
2682
+ return this.#___private_status_8;
2683
+ }
2684
+ set status(_v) {
2685
+ this.#___private_status_8 = _v;
2686
+ }
2687
+ #___private_validityMessage_9 = _init_validityMessage(this, '');
2688
+ get validityMessage() {
2689
+ return this.#___private_validityMessage_9;
2690
+ }
2691
+ set validityMessage(_v) {
2692
+ this.#___private_validityMessage_9 = _v;
2693
+ }
2694
+ #___private__chips_10 = _init__chips(this);
2695
+ get _chips() {
2696
+ return this.#___private__chips_10;
2697
+ }
2698
+ set _chips(_v) {
2699
+ this.#___private__chips_10 = _v;
2700
+ }
2701
+ _mutationObserver;
2702
+ constructor(){
2703
+ super();
2704
+ this._mutationObserver = new MutationObserver(()=>this._syncChips());
2705
+ this.addEventListener('vialiq-select', this._handleChipSelect);
2706
+ }
2707
+ connectedCallback() {
2708
+ super.connectedCallback();
2709
+ this._syncInternals();
2710
+ }
2711
+ disconnectedCallback() {
2712
+ super.disconnectedCallback();
2713
+ this._mutationObserver.disconnect();
2714
+ }
2715
+ updated(changed) {
2716
+ super.updated(changed);
2717
+ if (changed.has('value')) {
2718
+ this._syncInternals();
2719
+ this._syncChips();
2720
+ }
2721
+ if (changed.has('disabled')) {
2722
+ this._syncChips();
2723
+ }
2724
+ }
2725
+ formResetCallback() {
2726
+ this.value = [];
2727
+ this.status = 'default';
2728
+ this.validityMessage = '';
2729
+ }
2730
+ formDisabledCallback(disabled) {
2731
+ this.disabled = disabled;
2732
+ }
2733
+ _testValidity() {
2734
+ if (this.required && this.value.length === 0) {
2735
+ return {
2736
+ valueMissing: true
2737
+ };
2738
+ }
2739
+ return {};
2740
+ }
2741
+ /** Selects all available child chips (if multi is true) */ selectAll() {
2742
+ if (!this.multi) return;
2743
+ this.value = this._chips.map((chip)=>chip.value).filter((val)=>val !== undefined);
2744
+ this.dispatchEvent(new CustomEvent('vialiq-change', {
2745
+ detail: {
2746
+ value: this.value
2747
+ },
2748
+ bubbles: true,
2749
+ composed: true
2750
+ }));
2751
+ }
2752
+ /** Deselects all child chips */ clearAll() {
2753
+ this.value = [];
2754
+ this.dispatchEvent(new CustomEvent('vialiq-change', {
2755
+ detail: {
2756
+ value: this.value
2757
+ },
2758
+ bubbles: true,
2759
+ composed: true
2760
+ }));
2761
+ }
2762
+ _syncInternals() {
2763
+ const formData = new FormData();
2764
+ this.value.forEach((val)=>formData.append(this.name, val));
2765
+ this._internals.setFormValue(formData);
2766
+ }
2767
+ _syncChips() {
2768
+ if (!this._chips) return;
2769
+ let hasFocusable = false;
2770
+ this._chips.forEach((chip)=>{
2771
+ chip.selected = this.value.includes(chip.value);
2772
+ if (this.disabled) {
2773
+ chip.disabled = true;
2774
+ } else {
2775
+ chip.disabled = chip.hasAttribute('disabled');
2776
+ }
2777
+ // Roving tabindex: Only the first selected chip (or the first chip if none selected) is focusable
2778
+ if (!chip.disabled && (chip.selected || !hasFocusable && this.value.length === 0)) {
2779
+ chip.tabIndex = 0;
2780
+ hasFocusable = true;
2781
+ } else {
2782
+ chip.tabIndex = -1;
2783
+ }
2784
+ });
2785
+ // If no chip was focusable yet (e.g. none selected), make the first non-disabled chip focusable
2786
+ if (!hasFocusable && this._chips.length > 0) {
2787
+ const firstEnabled = this._chips.find((c)=>!c.disabled);
2788
+ if (firstEnabled) firstEnabled.tabIndex = 0;
2789
+ }
2790
+ }
2791
+ _handleSlotChange() {
2792
+ this._syncChips();
2793
+ // Disconnect old, connect new observers for child mutations
2794
+ this._mutationObserver.disconnect();
2795
+ this._chips.forEach((chip)=>{
2796
+ this._mutationObserver.observe(chip, {
2797
+ attributes: true,
2798
+ attributeFilter: [
2799
+ 'value',
2800
+ 'disabled'
2801
+ ]
2802
+ });
2803
+ });
2804
+ }
2805
+ _handleChipSelect(e) {
2806
+ e.stopPropagation(); // Stop the inner event
2807
+ const { value, selected } = e.detail;
2808
+ let newValue = [
2809
+ ...this.value
2810
+ ];
2811
+ if (this.multi) {
2812
+ if (selected) {
2813
+ if (!newValue.includes(value)) newValue.push(value);
2814
+ } else {
2815
+ newValue = newValue.filter((v)=>v !== value);
2816
+ }
2817
+ } else {
2818
+ if (selected) {
2819
+ newValue = [
2820
+ value
2821
+ ];
2822
+ } else {
2823
+ // In single select, clicking a selected chip could deselect it depending on requirements.
2824
+ // Assuming it toggles.
2825
+ newValue = [];
2826
+ }
2827
+ }
2828
+ this.value = newValue;
2829
+ this.dispatchEvent(new CustomEvent('vialiq-change', {
2830
+ detail: {
2831
+ value: this.value
2832
+ },
2833
+ bubbles: true,
2834
+ composed: true
2835
+ }));
2836
+ }
2837
+ _handleKeyDown(e) {
2838
+ const focusableChips = this._chips.filter((c)=>!c.disabled);
2839
+ if (focusableChips.length === 0) return;
2840
+ const currentIndex = focusableChips.findIndex((c)=>c === document.activeElement || c.shadowRoot?.activeElement);
2841
+ if (currentIndex === -1) return;
2842
+ let nextIndex = currentIndex;
2843
+ switch(e.key){
2844
+ case 'ArrowRight':
2845
+ case 'ArrowDown':
2846
+ e.preventDefault();
2847
+ nextIndex = (currentIndex + 1) % focusableChips.length;
2848
+ break;
2849
+ case 'ArrowLeft':
2850
+ case 'ArrowUp':
2851
+ e.preventDefault();
2852
+ nextIndex = (currentIndex - 1 + focusableChips.length) % focusableChips.length;
2853
+ break;
2854
+ case 'Home':
2855
+ e.preventDefault();
2856
+ nextIndex = 0;
2857
+ break;
2858
+ case 'End':
2859
+ e.preventDefault();
2860
+ nextIndex = focusableChips.length - 1;
2861
+ break;
2862
+ default:
2863
+ return; // Let other keys do their thing
2864
+ }
2865
+ this._chips.forEach((c)=>c.tabIndex = -1);
2866
+ const nextChip = focusableChips[nextIndex];
2867
+ nextChip.tabIndex = 0;
2868
+ nextChip.focus();
2869
+ }
2870
+ render() {
2871
+ const style = `gap: ${this.gap}; flex-wrap: ${this.wrap ? 'wrap' : 'nowrap'};`;
2872
+ return html`
2873
+ <div
2874
+ part="group"
2875
+ role="listbox"
2876
+ aria-multiselectable=${this.multi ? 'true' : 'false'}
2877
+ aria-required=${this.required ? 'true' : 'false'}
2878
+ aria-disabled=${this.disabled ? 'true' : 'false'}
2879
+ style=${style}
2880
+ @keydown=${this._handleKeyDown}
2881
+ >
2882
+ <slot @slotchange=${this._handleSlotChange}></slot>
2883
+ </div>
2884
+ `;
2885
+ }
2886
+ }
2887
+ }
2888
+ }();
2889
+
2890
+ export { _ViAlert as ViAlert, _ViBadge as ViBadge, _ViChip as ViChip, _ViChipGroup as ViChipGroup, ViElement, registerIcons };