@compa11y/web 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +608 -0
  2. package/dist/compa11y.iife.js +1126 -26
  3. package/dist/compa11y.iife.js.map +1 -1
  4. package/dist/compa11y.js +3671 -715
  5. package/dist/compa11y.js.map +1 -1
  6. package/dist/compa11y.umd.cjs +1129 -29
  7. package/dist/compa11y.umd.cjs.map +1 -1
  8. package/dist/components/button.d.ts +32 -0
  9. package/dist/components/button.d.ts.map +1 -0
  10. package/dist/components/checkbox.d.ts +160 -0
  11. package/dist/components/checkbox.d.ts.map +1 -0
  12. package/dist/components/combobox.d.ts +2 -2
  13. package/dist/components/combobox.d.ts.map +1 -1
  14. package/dist/components/dialog.d.ts +2 -2
  15. package/dist/components/dialog.d.ts.map +1 -1
  16. package/dist/components/input.d.ts +41 -0
  17. package/dist/components/input.d.ts.map +1 -0
  18. package/dist/components/listbox.d.ts +86 -0
  19. package/dist/components/listbox.d.ts.map +1 -0
  20. package/dist/components/menu.d.ts +2 -2
  21. package/dist/components/menu.d.ts.map +1 -1
  22. package/dist/components/radio-group.d.ts +87 -0
  23. package/dist/components/radio-group.d.ts.map +1 -0
  24. package/dist/components/select.d.ts +47 -0
  25. package/dist/components/select.d.ts.map +1 -0
  26. package/dist/components/switch.d.ts +2 -2
  27. package/dist/components/switch.d.ts.map +1 -1
  28. package/dist/components/tabs.d.ts +2 -2
  29. package/dist/components/tabs.d.ts.map +1 -1
  30. package/dist/components/textarea.d.ts +41 -0
  31. package/dist/components/textarea.d.ts.map +1 -0
  32. package/dist/index.d.ts +8 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/utils/base-element.d.ts +1 -1
  35. package/dist/utils/base-element.d.ts.map +1 -1
  36. package/dist/utils/styles.d.ts +44 -0
  37. package/dist/utils/styles.d.ts.map +1 -1
  38. package/package.json +39 -3
@@ -1,4 +1,4 @@
1
- (function(a,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@compa11y/core")):typeof define=="function"&&define.amd?define(["exports","@compa11y/core"],o):(a=typeof globalThis<"u"?globalThis:a||self,o(a.compa11y={},a.compa11yCore))})(this,function(a,o){"use strict";class d extends HTMLElement{constructor(){super(),this._internals=null,this._id=o.generateId(this.tagName.toLowerCase().replace("a11y-","")),"attachInternals"in this&&(this._internals=this.attachInternals())}static get observedAttributes(){return[]}connectedCallback(){this.setupAccessibility(),this.render(),this.setupEventListeners()}disconnectedCallback(){this.cleanupEventListeners()}attributeChangedCallback(e,t,i){t!==i&&this.onAttributeChange(e,t,i)}setupEventListeners(){}cleanupEventListeners(){}onAttributeChange(e,t,i){}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:!0}))}getSlot(e){var t;return((t=this.shadowRoot)==null?void 0:t.querySelector(`slot[name="${e}"]`))??null}getSlottedElements(e){var s;const t=e?`slot[name="${e}"]`:"slot:not([name])",i=(s=this.shadowRoot)==null?void 0:s.querySelector(t);return(i==null?void 0:i.assignedElements())??[]}}function c(l,e){customElements.get(l)||customElements.define(l,e)}const _=`
1
+ (function(l,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("@compa11y/core")):typeof define=="function"&&define.amd?define(["exports","@compa11y/core"],o):(l=typeof globalThis<"u"?globalThis:l||self,o(l.compa11y={},l.compa11yCore))})(this,function(l,o){"use strict";class u extends HTMLElement{constructor(){super(),this._internals=null,this._id=o.generateId(this.tagName.toLowerCase().replace("a11y-","")),"attachInternals"in this&&(this._internals=this.attachInternals())}static get observedAttributes(){return[]}connectedCallback(){this.setupAccessibility(),this.render(),this.setupEventListeners()}disconnectedCallback(){this.cleanupEventListeners()}attributeChangedCallback(e,t,i){t!==i&&this.onAttributeChange(e,t,i)}setupEventListeners(){}cleanupEventListeners(){}onAttributeChange(e,t,i){}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,cancelable:!0}))}getSlot(e){var t;return((t=this.shadowRoot)==null?void 0:t.querySelector(`slot[name="${e}"]`))??null}getSlottedElements(e){var s;const t=e?`slot[name="${e}"]`:"slot:not([name])",i=(s=this.shadowRoot)==null?void 0:s.querySelector(t);return(i==null?void 0:i.assignedElements())??[]}}function b(d,e){customElements.get(d)||customElements.define(d,e)}const V=`
2
2
  appearance: none;
3
3
  background: none;
4
4
  border: none;
@@ -7,7 +7,7 @@
7
7
  font: inherit;
8
8
  color: inherit;
9
9
  cursor: pointer;
10
- `,u=`
10
+ `,p=`
11
11
  :host {
12
12
  display: block;
13
13
  box-sizing: border-box;
@@ -30,8 +30,8 @@
30
30
  outline-offset: 2px;
31
31
  }
32
32
 
33
- `,x=`
34
- ${u}
33
+ `,W=`
34
+ ${p}
35
35
 
36
36
  :host {
37
37
  position: fixed;
@@ -69,8 +69,8 @@
69
69
  margin: 0 0 1rem 0;
70
70
  color: var(--compa11y-dialog-description-color, #666);
71
71
  }
72
- `,w=`
73
- ${u}
72
+ `,J=`
73
+ ${p}
74
74
 
75
75
  :host {
76
76
  position: relative;
@@ -121,8 +121,8 @@
121
121
  margin: 0.25rem 0;
122
122
  background: var(--compa11y-menu-separator-color, #e0e0e0);
123
123
  }
124
- `,E=`
125
- ${u}
124
+ `,Q=`
125
+ ${p}
126
126
 
127
127
  .tablist {
128
128
  display: flex;
@@ -137,7 +137,7 @@
137
137
  }
138
138
 
139
139
  ::slotted([role="tab"]) {
140
- ${_}
140
+ ${V}
141
141
  padding: var(--compa11y-tab-padding, 0.75rem 1rem);
142
142
  border-bottom: 2px solid transparent;
143
143
  margin-bottom: -1px;
@@ -167,8 +167,8 @@
167
167
  ::slotted([role="tabpanel"][hidden]) {
168
168
  display: none;
169
169
  }
170
- `,A=`
171
- ${u}
170
+ `,Z=`
171
+ ${p}
172
172
 
173
173
  :host {
174
174
  display: inline-block;
@@ -226,7 +226,7 @@
226
226
  }
227
227
 
228
228
  .clear-button {
229
- ${_}
229
+ ${V}
230
230
  position: absolute;
231
231
  right: 1.5rem;
232
232
  width: 1.25rem;
@@ -308,8 +308,138 @@
308
308
  .options-source {
309
309
  display: none;
310
310
  }
311
- `,k=`
312
- ${u}
311
+ `,ee=`
312
+ ${p}
313
+
314
+ :host {
315
+ display: inline-block;
316
+ position: relative;
317
+ width: var(--compa11y-select-width, 250px);
318
+ }
319
+
320
+ .select-wrapper {
321
+ position: relative;
322
+ }
323
+
324
+ .select-trigger {
325
+ width: 100%;
326
+ display: flex;
327
+ align-items: center;
328
+ justify-content: space-between;
329
+ padding: var(--compa11y-select-trigger-padding, 0.5rem 2rem 0.5rem 0.75rem);
330
+ border: var(--compa11y-select-border, 1px solid #ccc);
331
+ border-radius: var(--compa11y-select-radius, 4px);
332
+ font: inherit;
333
+ background: var(--compa11y-select-bg, white);
334
+ color: var(--compa11y-select-color, inherit);
335
+ cursor: pointer;
336
+ text-align: left;
337
+ position: relative;
338
+ appearance: none;
339
+ }
340
+
341
+ .select-trigger:focus {
342
+ outline: 2px solid var(--compa11y-focus-color, #0066cc);
343
+ outline-offset: -1px;
344
+ border-color: var(--compa11y-focus-color, #0066cc);
345
+ }
346
+
347
+ .select-trigger:disabled {
348
+ background: var(--compa11y-select-disabled-bg, #f5f5f5);
349
+ cursor: not-allowed;
350
+ opacity: 0.7;
351
+ }
352
+
353
+ .select-value {
354
+ flex: 1;
355
+ overflow: hidden;
356
+ text-overflow: ellipsis;
357
+ white-space: nowrap;
358
+ }
359
+
360
+ .select-value.placeholder {
361
+ color: var(--compa11y-select-placeholder-color, #999);
362
+ }
363
+
364
+ .chevron {
365
+ position: absolute;
366
+ right: 0.5rem;
367
+ pointer-events: none;
368
+ font-size: 0.75rem;
369
+ color: var(--compa11y-select-chevron-color, #666);
370
+ transition: transform 0.15s ease;
371
+ }
372
+
373
+ :host([open]) .chevron {
374
+ transform: rotate(180deg);
375
+ }
376
+
377
+ :host([data-position="top"]) .chevron {
378
+ transform: rotate(180deg);
379
+ }
380
+
381
+ :host([data-position="top"][open]) .chevron {
382
+ transform: rotate(0deg);
383
+ }
384
+
385
+ .listbox {
386
+ position: absolute;
387
+ top: 100%;
388
+ left: 0;
389
+ right: 0;
390
+ z-index: var(--compa11y-select-z-index, 1000);
391
+ max-height: var(--compa11y-select-max-height, 200px);
392
+ overflow-y: auto;
393
+ margin: 0;
394
+ padding: var(--compa11y-select-listbox-padding, 0.25rem 0);
395
+ background: var(--compa11y-select-listbox-bg, white);
396
+ border: var(--compa11y-select-listbox-border, 1px solid #e0e0e0);
397
+ border-radius: var(--compa11y-select-radius, 4px);
398
+ box-shadow: var(--compa11y-select-shadow, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
399
+ list-style: none;
400
+ margin-top: 4px;
401
+ }
402
+
403
+ .listbox[hidden] {
404
+ display: none;
405
+ }
406
+
407
+ .listbox li[role="option"] {
408
+ display: flex;
409
+ align-items: center;
410
+ justify-content: space-between;
411
+ padding: var(--compa11y-select-option-padding, 0.5rem 0.75rem);
412
+ cursor: pointer;
413
+ transition: background 0.1s ease;
414
+ }
415
+
416
+ .listbox li[role="option"]:hover,
417
+ .listbox li[role="option"].highlighted {
418
+ background: var(--compa11y-select-option-hover-bg, #f5f5f5);
419
+ }
420
+
421
+ .listbox li[role="option"][aria-selected="true"] {
422
+ background: var(--compa11y-select-option-selected-bg, #e6f0ff);
423
+ font-weight: 500;
424
+ }
425
+
426
+ .listbox li[role="option"].disabled,
427
+ .listbox li[role="option"][aria-disabled="true"] {
428
+ opacity: 0.5;
429
+ cursor: not-allowed;
430
+ }
431
+
432
+ .check-mark {
433
+ font-size: 0.875rem;
434
+ color: var(--compa11y-select-check-color, #0066cc);
435
+ margin-left: 0.5rem;
436
+ }
437
+
438
+ .options-source {
439
+ display: none;
440
+ }
441
+ `,te=`
442
+ ${p}
313
443
 
314
444
  :host {
315
445
  display: inline-block;
@@ -412,8 +542,762 @@
412
542
  opacity: 0.5;
413
543
  cursor: not-allowed;
414
544
  }
415
- `,v='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';class b extends d{constructor(){super(...arguments),this._open=!1,this._previouslyFocused=null,this._triggerElement=null,this.handleTriggerClick=()=>{this.open=!0},this.handleClose=()=>{this.open=!1},this.handleKeyDown=e=>{var t;if(this._open){if(e.key==="Escape"){this.getAttribute("close-on-escape")!=="false"&&(e.preventDefault(),this.handleClose());return}if(e.key==="Tab"){e.preventDefault();const i=this.getFocusableElements();if(i.length===0)return;const s=((t=this.shadowRoot)==null?void 0:t.activeElement)||document.activeElement;let n=i.findIndex(p=>p===s);n===-1&&(n=e.shiftKey?0:i.length-1);let r;e.shiftKey?r=n===0?i.length-1:n-1:r=n===i.length-1?0:n+1;const h=i[r];h&&h.focus()}}}}static get observedAttributes(){return["open","trigger","close-on-outside-click","close-on-escape"]}get open(){return this._open}set open(e){const t=this._open;this._open=e,e!==t&&(e?this.showDialog():this.hideDialog()),this.toggleAttribute("open",e)}setupAccessibility(){}render(){const e=this.attachShadow({mode:"open"}),t=`${this._id}-title`,i=`${this._id}-desc`;e.innerHTML=`
416
- <style>${x}</style>
545
+ `,ie=`
546
+ ${p}
547
+
548
+ :host {
549
+ display: block;
550
+ width: var(--compa11y-input-width, 100%);
551
+ }
552
+
553
+ .input-wrapper {
554
+ display: flex;
555
+ flex-direction: column;
556
+ gap: 0.25rem;
557
+ }
558
+
559
+ .input-label {
560
+ display: block;
561
+ color: var(--compa11y-input-label-color, inherit);
562
+ font-size: var(--compa11y-input-label-size, 0.875rem);
563
+ font-weight: var(--compa11y-input-label-weight, 500);
564
+ }
565
+
566
+ :host([disabled]) .input-label {
567
+ color: var(--compa11y-input-disabled-color, #999);
568
+ }
569
+
570
+ .input-required {
571
+ color: var(--compa11y-input-required-color, #ef4444);
572
+ margin-left: 0.125rem;
573
+ }
574
+
575
+ input {
576
+ width: 100%;
577
+ padding: var(--compa11y-input-padding, 0.5rem 0.75rem);
578
+ border: var(--compa11y-input-border, 1px solid #ccc);
579
+ border-radius: var(--compa11y-input-radius, 4px);
580
+ font: inherit;
581
+ font-size: var(--compa11y-input-font-size, 0.875rem);
582
+ background: var(--compa11y-input-bg, white);
583
+ color: inherit;
584
+ }
585
+
586
+ input:focus {
587
+ outline: 2px solid var(--compa11y-focus-color, #0066cc);
588
+ outline-offset: -1px;
589
+ border-color: var(--compa11y-input-border-focus, #0066cc);
590
+ }
591
+
592
+ input::placeholder {
593
+ color: var(--compa11y-input-placeholder-color, #999);
594
+ }
595
+
596
+ input:disabled {
597
+ background: var(--compa11y-input-disabled-bg, #f5f5f5);
598
+ cursor: not-allowed;
599
+ opacity: var(--compa11y-input-disabled-opacity, 0.7);
600
+ }
601
+
602
+ input[readonly] {
603
+ background: var(--compa11y-input-readonly-bg, #f9f9f9);
604
+ }
605
+
606
+ :host([data-error="true"]) input {
607
+ border-color: var(--compa11y-input-border-error, #ef4444);
608
+ }
609
+
610
+ :host([data-error="true"]) input:focus {
611
+ outline-color: var(--compa11y-input-border-error, #ef4444);
612
+ border-color: var(--compa11y-input-border-error, #ef4444);
613
+ }
614
+
615
+ .input-hint {
616
+ color: var(--compa11y-input-hint-color, #666);
617
+ font-size: var(--compa11y-input-hint-size, 0.8125rem);
618
+ }
619
+
620
+ .input-error {
621
+ color: var(--compa11y-input-error-color, #ef4444);
622
+ font-size: var(--compa11y-input-error-size, 0.8125rem);
623
+ }
624
+ `,se=`
625
+ ${p}
626
+
627
+ :host {
628
+ display: block;
629
+ width: var(--compa11y-textarea-width, 100%);
630
+ }
631
+
632
+ .textarea-wrapper {
633
+ display: flex;
634
+ flex-direction: column;
635
+ gap: 0.25rem;
636
+ }
637
+
638
+ .textarea-label {
639
+ display: block;
640
+ color: var(--compa11y-textarea-label-color, inherit);
641
+ font-size: var(--compa11y-textarea-label-size, 0.875rem);
642
+ font-weight: var(--compa11y-textarea-label-weight, 500);
643
+ }
644
+
645
+ :host([disabled]) .textarea-label {
646
+ color: var(--compa11y-textarea-disabled-color, #999);
647
+ }
648
+
649
+ .textarea-required {
650
+ color: var(--compa11y-textarea-required-color, #ef4444);
651
+ margin-left: 0.125rem;
652
+ }
653
+
654
+ textarea {
655
+ width: 100%;
656
+ padding: var(--compa11y-textarea-padding, 0.5rem 0.75rem);
657
+ border: var(--compa11y-textarea-border, 1px solid #ccc);
658
+ border-radius: var(--compa11y-textarea-radius, 4px);
659
+ font: inherit;
660
+ font-size: var(--compa11y-textarea-font-size, 0.875rem);
661
+ line-height: 1.5;
662
+ background: var(--compa11y-textarea-bg, white);
663
+ color: inherit;
664
+ resize: var(--compa11y-textarea-resize, vertical);
665
+ }
666
+
667
+ textarea:focus {
668
+ outline: 2px solid var(--compa11y-focus-color, #0066cc);
669
+ outline-offset: -1px;
670
+ border-color: var(--compa11y-textarea-border-focus, #0066cc);
671
+ }
672
+
673
+ textarea::placeholder {
674
+ color: var(--compa11y-textarea-placeholder-color, #999);
675
+ }
676
+
677
+ textarea:disabled {
678
+ background: var(--compa11y-textarea-disabled-bg, #f5f5f5);
679
+ cursor: not-allowed;
680
+ opacity: var(--compa11y-textarea-disabled-opacity, 0.7);
681
+ }
682
+
683
+ textarea[readonly] {
684
+ background: var(--compa11y-textarea-readonly-bg, #f9f9f9);
685
+ }
686
+
687
+ :host([data-error="true"]) textarea {
688
+ border-color: var(--compa11y-textarea-border-error, #ef4444);
689
+ }
690
+
691
+ :host([data-error="true"]) textarea:focus {
692
+ outline-color: var(--compa11y-textarea-border-error, #ef4444);
693
+ border-color: var(--compa11y-textarea-border-error, #ef4444);
694
+ }
695
+
696
+ .textarea-hint {
697
+ color: var(--compa11y-textarea-hint-color, #666);
698
+ font-size: var(--compa11y-textarea-hint-size, 0.8125rem);
699
+ }
700
+
701
+ .textarea-error {
702
+ color: var(--compa11y-textarea-error-color, #ef4444);
703
+ font-size: var(--compa11y-textarea-error-size, 0.8125rem);
704
+ }
705
+ `,ae=`
706
+ ${p}
707
+
708
+ :host {
709
+ display: inline-block;
710
+ }
711
+
712
+ @keyframes compa11y-spin {
713
+ to { transform: rotate(360deg); }
714
+ }
715
+
716
+ button {
717
+ display: inline-flex;
718
+ align-items: center;
719
+ justify-content: center;
720
+ gap: 0.5rem;
721
+ border-radius: var(--compa11y-button-radius, 4px);
722
+ font: inherit;
723
+ font-weight: var(--compa11y-button-font-weight, 500);
724
+ line-height: 1.5;
725
+ cursor: pointer;
726
+ transition: background-color 0.15s ease, border-color 0.15s ease;
727
+ appearance: none;
728
+ text-decoration: none;
729
+ }
730
+
731
+ button:focus-visible {
732
+ outline: 2px solid var(--compa11y-focus-color, #0066cc);
733
+ outline-offset: 2px;
734
+ }
735
+
736
+ /* Sizes */
737
+ button.size-sm {
738
+ padding: var(--compa11y-button-padding-sm, 0.25rem 0.5rem);
739
+ font-size: var(--compa11y-button-font-size-sm, 0.75rem);
740
+ }
741
+
742
+ button.size-md {
743
+ padding: var(--compa11y-button-padding-md, 0.5rem 1rem);
744
+ font-size: var(--compa11y-button-font-size-md, 0.875rem);
745
+ }
746
+
747
+ button.size-lg {
748
+ padding: var(--compa11y-button-padding-lg, 0.75rem 1.5rem);
749
+ font-size: var(--compa11y-button-font-size-lg, 1rem);
750
+ }
751
+
752
+ /* Variants */
753
+ button.variant-primary {
754
+ background: var(--compa11y-button-primary-bg, #0066cc);
755
+ color: var(--compa11y-button-primary-color, white);
756
+ border: var(--compa11y-button-primary-border, 1px solid #0066cc);
757
+ }
758
+
759
+ button.variant-primary:hover:not(:disabled):not([aria-disabled="true"]) {
760
+ background: var(--compa11y-button-primary-hover-bg, #0052a3);
761
+ }
762
+
763
+ button.variant-secondary {
764
+ background: var(--compa11y-button-secondary-bg, white);
765
+ color: var(--compa11y-button-secondary-color, #333);
766
+ border: var(--compa11y-button-secondary-border, 1px solid #ccc);
767
+ }
768
+
769
+ button.variant-secondary:hover:not(:disabled):not([aria-disabled="true"]) {
770
+ background: var(--compa11y-button-secondary-hover-bg, #f0f0f0);
771
+ }
772
+
773
+ button.variant-danger {
774
+ background: var(--compa11y-button-danger-bg, #ef4444);
775
+ color: var(--compa11y-button-danger-color, white);
776
+ border: var(--compa11y-button-danger-border, 1px solid #ef4444);
777
+ }
778
+
779
+ button.variant-danger:hover:not(:disabled):not([aria-disabled="true"]) {
780
+ background: var(--compa11y-button-danger-hover-bg, #dc2626);
781
+ }
782
+
783
+ button.variant-outline {
784
+ background: var(--compa11y-button-outline-bg, transparent);
785
+ color: var(--compa11y-button-outline-color, #0066cc);
786
+ border: var(--compa11y-button-outline-border, 1px solid #0066cc);
787
+ }
788
+
789
+ button.variant-outline:hover:not(:disabled):not([aria-disabled="true"]) {
790
+ background: var(--compa11y-button-outline-hover-bg, rgba(0, 102, 204, 0.05));
791
+ }
792
+
793
+ button.variant-ghost {
794
+ background: var(--compa11y-button-ghost-bg, transparent);
795
+ color: var(--compa11y-button-ghost-color, #333);
796
+ border: var(--compa11y-button-ghost-border, 1px solid transparent);
797
+ }
798
+
799
+ button.variant-ghost:hover:not(:disabled):not([aria-disabled="true"]) {
800
+ background: var(--compa11y-button-ghost-hover-bg, rgba(0, 0, 0, 0.05));
801
+ }
802
+
803
+ /* Disabled */
804
+ button:disabled,
805
+ button[aria-disabled="true"] {
806
+ opacity: var(--compa11y-button-disabled-opacity, 0.5);
807
+ cursor: not-allowed;
808
+ }
809
+
810
+ /* Loading spinner */
811
+ .button-spinner {
812
+ display: inline-block;
813
+ width: 1em;
814
+ height: 1em;
815
+ border: 2px solid currentColor;
816
+ border-right-color: transparent;
817
+ border-radius: 50%;
818
+ animation: compa11y-spin 0.6s linear infinite;
819
+ }
820
+ `,re=`
821
+ ${p}
822
+
823
+ :host {
824
+ display: block;
825
+ width: var(--compa11y-listbox-width, 250px);
826
+ }
827
+
828
+ .listbox-wrapper {
829
+ max-height: var(--compa11y-listbox-max-height, 300px);
830
+ overflow-y: auto;
831
+ border: var(--compa11y-listbox-border, 1px solid #e0e0e0);
832
+ border-radius: var(--compa11y-listbox-radius, 4px);
833
+ background: var(--compa11y-listbox-bg, white);
834
+ padding: var(--compa11y-listbox-padding, 0.25rem 0);
835
+ }
836
+
837
+ :host([disabled]) .listbox-wrapper {
838
+ opacity: var(--compa11y-listbox-disabled-opacity, 0.5);
839
+ cursor: not-allowed;
840
+ }
841
+
842
+ :host(:focus-visible) .listbox-wrapper {
843
+ outline: 2px solid var(--compa11y-focus-color, #0066cc);
844
+ outline-offset: 2px;
845
+ }
846
+
847
+ :host([orientation="horizontal"]) .listbox-wrapper {
848
+ display: flex;
849
+ flex-wrap: wrap;
850
+ max-height: none;
851
+ overflow-y: visible;
852
+ }
853
+ `,oe=`
854
+ ${p}
855
+
856
+ :host {
857
+ display: block;
858
+ }
859
+
860
+ .option-wrapper {
861
+ display: flex;
862
+ align-items: center;
863
+ justify-content: space-between;
864
+ padding: var(--compa11y-listbox-option-padding, 0.5rem 0.75rem);
865
+ cursor: pointer;
866
+ transition: background 0.1s ease;
867
+ user-select: none;
868
+ }
869
+
870
+ :host([data-focused]) .option-wrapper {
871
+ background: var(--compa11y-listbox-option-hover-bg, #f5f5f5);
872
+ }
873
+
874
+ :host([aria-selected="true"]) .option-wrapper {
875
+ background: var(--compa11y-listbox-option-selected-bg, #e6f0ff);
876
+ font-weight: 500;
877
+ }
878
+
879
+ :host([aria-selected="true"][data-focused]) .option-wrapper {
880
+ background: var(--compa11y-listbox-option-selected-hover-bg, #cce0ff);
881
+ }
882
+
883
+ :host([aria-disabled="true"]) .option-wrapper {
884
+ opacity: 0.5;
885
+ cursor: not-allowed;
886
+ }
887
+
888
+ .option-content {
889
+ flex: 1;
890
+ }
891
+
892
+ .check-mark {
893
+ font-size: 0.875rem;
894
+ color: var(--compa11y-listbox-check-color, #0066cc);
895
+ margin-left: 0.5rem;
896
+ visibility: hidden;
897
+ }
898
+
899
+ :host([aria-selected="true"]) .check-mark {
900
+ visibility: visible;
901
+ }
902
+ `,le=`
903
+ ${p}
904
+
905
+ :host {
906
+ display: block;
907
+ }
908
+
909
+ .optgroup-label {
910
+ padding: var(--compa11y-listbox-group-label-padding, 0.5rem 0.75rem 0.25rem);
911
+ font-size: var(--compa11y-listbox-group-label-size, 0.75rem);
912
+ font-weight: var(--compa11y-listbox-group-label-weight, 600);
913
+ color: var(--compa11y-listbox-group-label-color, #666);
914
+ text-transform: uppercase;
915
+ letter-spacing: 0.05em;
916
+ }
917
+
918
+ :host([disabled]) {
919
+ opacity: 0.5;
920
+ }
921
+ `,ne=`
922
+ ${p}
923
+
924
+ :host {
925
+ display: inline-block;
926
+ }
927
+
928
+ .checkbox-wrapper {
929
+ display: inline-flex;
930
+ align-items: flex-start;
931
+ gap: var(--compa11y-checkbox-gap, 0.5rem);
932
+ cursor: pointer;
933
+ user-select: none;
934
+ }
935
+
936
+ :host([disabled]) .checkbox-wrapper {
937
+ cursor: not-allowed;
938
+ opacity: 0.5;
939
+ }
940
+
941
+ .checkbox-control {
942
+ position: relative;
943
+ display: inline-flex;
944
+ align-items: center;
945
+ justify-content: center;
946
+ flex-shrink: 0;
947
+ }
948
+
949
+ .checkbox-input {
950
+ position: absolute;
951
+ opacity: 0;
952
+ width: 100%;
953
+ height: 100%;
954
+ margin: 0;
955
+ cursor: inherit;
956
+ z-index: 1;
957
+ }
958
+
959
+ .checkbox-indicator {
960
+ width: var(--compa11y-checkbox-size, 1.25rem);
961
+ height: var(--compa11y-checkbox-size, 1.25rem);
962
+ min-width: 24px;
963
+ min-height: 24px;
964
+ border: var(--compa11y-checkbox-border, 2px solid #666);
965
+ border-radius: var(--compa11y-checkbox-radius, 3px);
966
+ background: var(--compa11y-checkbox-bg, white);
967
+ display: flex;
968
+ align-items: center;
969
+ justify-content: center;
970
+ flex-shrink: 0;
971
+ transition: all 0.15s ease;
972
+ pointer-events: none;
973
+ }
974
+
975
+ :host([checked]) .checkbox-indicator {
976
+ background: var(--compa11y-checkbox-checked-bg, #0066cc);
977
+ border-color: var(--compa11y-checkbox-checked-border, #0066cc);
978
+ }
979
+
980
+ :host([indeterminate]) .checkbox-indicator {
981
+ background: var(--compa11y-checkbox-checked-bg, #0066cc);
982
+ border-color: var(--compa11y-checkbox-checked-border, #0066cc);
983
+ }
984
+
985
+ /* Size variants */
986
+ .checkbox-wrapper.size-sm .checkbox-indicator {
987
+ width: var(--compa11y-checkbox-size-sm, 1rem);
988
+ height: var(--compa11y-checkbox-size-sm, 1rem);
989
+ min-width: 24px;
990
+ min-height: 24px;
991
+ }
992
+
993
+ .checkbox-wrapper.size-lg .checkbox-indicator {
994
+ width: var(--compa11y-checkbox-size-lg, 1.5rem);
995
+ height: var(--compa11y-checkbox-size-lg, 1.5rem);
996
+ }
997
+
998
+ /* Check mark SVG */
999
+ .checkbox-check {
1000
+ opacity: 0;
1001
+ transform: scale(0);
1002
+ transition: all 0.15s ease;
1003
+ color: var(--compa11y-checkbox-check-color, white);
1004
+ }
1005
+
1006
+ :host([checked]) .checkbox-check {
1007
+ opacity: 1;
1008
+ transform: scale(1);
1009
+ }
1010
+
1011
+ :host([indeterminate]) .checkbox-check {
1012
+ opacity: 0;
1013
+ transform: scale(0);
1014
+ }
1015
+
1016
+ /* Indeterminate dash */
1017
+ .checkbox-dash {
1018
+ opacity: 0;
1019
+ transition: all 0.15s ease;
1020
+ color: var(--compa11y-checkbox-check-color, white);
1021
+ }
1022
+
1023
+ :host([indeterminate]) .checkbox-dash {
1024
+ opacity: 1;
1025
+ }
1026
+
1027
+ /* Focus visible on indicator when input is focused */
1028
+ .checkbox-input:focus-visible + .checkbox-indicator {
1029
+ outline: 2px solid var(--compa11y-focus-color, #0066cc);
1030
+ outline-offset: 2px;
1031
+ }
1032
+
1033
+ /* Hover */
1034
+ .checkbox-wrapper:hover:not([disabled]) .checkbox-indicator {
1035
+ border-color: var(--compa11y-checkbox-hover-border, #0066cc);
1036
+ }
1037
+
1038
+ /* Label and text */
1039
+ .checkbox-content {
1040
+ display: flex;
1041
+ flex-direction: column;
1042
+ gap: 0.125rem;
1043
+ padding-top: 0.125rem;
1044
+ }
1045
+
1046
+ .checkbox-label {
1047
+ color: var(--compa11y-checkbox-label-color, inherit);
1048
+ font-size: var(--compa11y-checkbox-label-size, 1rem);
1049
+ cursor: inherit;
1050
+ }
1051
+
1052
+ .checkbox-hint {
1053
+ color: var(--compa11y-checkbox-hint-color, #666);
1054
+ font-size: var(--compa11y-checkbox-hint-size, 0.8125rem);
1055
+ }
1056
+
1057
+ .checkbox-error {
1058
+ color: var(--compa11y-checkbox-error-color, #ef4444);
1059
+ font-size: var(--compa11y-checkbox-error-size, 0.8125rem);
1060
+ }
1061
+
1062
+ .checkbox-required {
1063
+ color: var(--compa11y-checkbox-required-color, #ef4444);
1064
+ margin-left: 0.125rem;
1065
+ }
1066
+
1067
+ /* Forced colors / high contrast mode */
1068
+ @media (forced-colors: active) {
1069
+ .checkbox-indicator {
1070
+ border: 2px solid ButtonText;
1071
+ }
1072
+
1073
+ :host([checked]) .checkbox-indicator,
1074
+ :host([indeterminate]) .checkbox-indicator {
1075
+ background: Highlight;
1076
+ border-color: Highlight;
1077
+ }
1078
+
1079
+ .checkbox-check,
1080
+ .checkbox-dash {
1081
+ color: HighlightText;
1082
+ }
1083
+ }
1084
+ `,he=`
1085
+ ${p}
1086
+
1087
+ :host {
1088
+ display: block;
1089
+ }
1090
+
1091
+ fieldset {
1092
+ border: none;
1093
+ margin: 0;
1094
+ padding: 0;
1095
+ min-width: 0;
1096
+ }
1097
+
1098
+ legend {
1099
+ padding: 0;
1100
+ margin-bottom: var(--compa11y-checkbox-group-legend-gap, 0.5rem);
1101
+ font-weight: var(--compa11y-checkbox-group-legend-weight, 600);
1102
+ color: var(--compa11y-checkbox-group-legend-color, inherit);
1103
+ font-size: var(--compa11y-checkbox-group-legend-size, 1rem);
1104
+ }
1105
+
1106
+ .checkbox-group-items {
1107
+ display: flex;
1108
+ flex-direction: column;
1109
+ gap: var(--compa11y-checkbox-group-gap, 0.75rem);
1110
+ }
1111
+
1112
+ :host([orientation="horizontal"]) .checkbox-group-items {
1113
+ flex-direction: row;
1114
+ flex-wrap: wrap;
1115
+ }
1116
+
1117
+ .checkbox-group-error {
1118
+ color: var(--compa11y-checkbox-group-error-color, #ef4444);
1119
+ font-size: var(--compa11y-checkbox-group-error-size, 0.8125rem);
1120
+ margin-top: 0.25rem;
1121
+ }
1122
+
1123
+ :host([disabled]) {
1124
+ opacity: 0.5;
1125
+ }
1126
+ `,de=`
1127
+ ${p}
1128
+
1129
+ :host {
1130
+ display: block;
1131
+ }
1132
+
1133
+ fieldset {
1134
+ border: none;
1135
+ margin: 0;
1136
+ padding: 0;
1137
+ min-width: 0;
1138
+ }
1139
+
1140
+ legend {
1141
+ padding: 0;
1142
+ margin-bottom: var(--compa11y-radio-group-legend-gap, 0.5rem);
1143
+ font-weight: var(--compa11y-radio-group-legend-weight, 600);
1144
+ color: var(--compa11y-radio-group-legend-color, inherit);
1145
+ font-size: var(--compa11y-radio-group-legend-size, 1rem);
1146
+ }
1147
+
1148
+ .radio-group-items {
1149
+ display: flex;
1150
+ flex-direction: column;
1151
+ gap: var(--compa11y-radio-group-gap, 0.75rem);
1152
+ }
1153
+
1154
+ :host([orientation="horizontal"]) .radio-group-items {
1155
+ flex-direction: row;
1156
+ flex-wrap: wrap;
1157
+ }
1158
+
1159
+ .radio-group-hint {
1160
+ color: var(--compa11y-radio-group-hint-color, #666);
1161
+ font-size: var(--compa11y-radio-group-hint-size, 0.8125rem);
1162
+ margin-top: 0.25rem;
1163
+ }
1164
+
1165
+ .radio-group-error {
1166
+ color: var(--compa11y-radio-group-error-color, #ef4444);
1167
+ font-size: var(--compa11y-radio-group-error-size, 0.8125rem);
1168
+ margin-top: 0.25rem;
1169
+ }
1170
+
1171
+ .radio-group-required {
1172
+ color: var(--compa11y-radio-group-required-color, #ef4444);
1173
+ margin-left: 0.125rem;
1174
+ }
1175
+
1176
+ :host([disabled]) {
1177
+ opacity: 0.5;
1178
+ }
1179
+ `,ce=`
1180
+ ${p}
1181
+
1182
+ :host {
1183
+ display: inline-block;
1184
+ }
1185
+
1186
+ .radio-wrapper {
1187
+ display: inline-flex;
1188
+ align-items: flex-start;
1189
+ gap: var(--compa11y-radio-gap, 0.5rem);
1190
+ cursor: pointer;
1191
+ user-select: none;
1192
+ }
1193
+
1194
+ :host([disabled]) .radio-wrapper {
1195
+ cursor: not-allowed;
1196
+ opacity: 0.5;
1197
+ }
1198
+
1199
+ .radio-control {
1200
+ position: relative;
1201
+ display: inline-flex;
1202
+ align-items: center;
1203
+ justify-content: center;
1204
+ flex-shrink: 0;
1205
+ }
1206
+
1207
+ .radio-input {
1208
+ position: absolute;
1209
+ opacity: 0;
1210
+ width: 100%;
1211
+ height: 100%;
1212
+ margin: 0;
1213
+ cursor: inherit;
1214
+ z-index: 1;
1215
+ }
1216
+
1217
+ .radio-circle {
1218
+ width: var(--compa11y-radio-size, 1.25rem);
1219
+ height: var(--compa11y-radio-size, 1.25rem);
1220
+ min-width: 24px;
1221
+ min-height: 24px;
1222
+ border: var(--compa11y-radio-border, 2px solid #666);
1223
+ border-radius: 50%;
1224
+ background: var(--compa11y-radio-bg, white);
1225
+ display: flex;
1226
+ align-items: center;
1227
+ justify-content: center;
1228
+ flex-shrink: 0;
1229
+ transition: all 0.15s ease;
1230
+ pointer-events: none;
1231
+ }
1232
+
1233
+ :host([checked]) .radio-circle {
1234
+ background: var(--compa11y-radio-checked-bg, #0066cc);
1235
+ border-color: var(--compa11y-radio-checked-border, #0066cc);
1236
+ }
1237
+
1238
+ /* Focus visible on circle when input is focused */
1239
+ .radio-input:focus-visible + .radio-circle {
1240
+ outline: 2px solid var(--compa11y-focus-color, #0066cc);
1241
+ outline-offset: 2px;
1242
+ }
1243
+
1244
+ /* Hover */
1245
+ .radio-wrapper:hover:not([disabled]) .radio-circle {
1246
+ border-color: var(--compa11y-radio-hover-border, #0066cc);
1247
+ }
1248
+
1249
+ /* Inner dot */
1250
+ .radio-dot {
1251
+ width: var(--compa11y-radio-dot-size, 0.5rem);
1252
+ height: var(--compa11y-radio-dot-size, 0.5rem);
1253
+ border-radius: 50%;
1254
+ background: var(--compa11y-radio-dot-color, white);
1255
+ opacity: 0;
1256
+ transform: scale(0);
1257
+ transition: all 0.15s ease;
1258
+ }
1259
+
1260
+ :host([checked]) .radio-dot {
1261
+ opacity: 1;
1262
+ transform: scale(1);
1263
+ }
1264
+
1265
+ /* Label and text */
1266
+ .radio-content {
1267
+ display: flex;
1268
+ flex-direction: column;
1269
+ gap: 0.125rem;
1270
+ padding-top: 0.125rem;
1271
+ }
1272
+
1273
+ .radio-label {
1274
+ color: var(--compa11y-radio-label-color, inherit);
1275
+ font-size: var(--compa11y-radio-label-size, 1rem);
1276
+ cursor: inherit;
1277
+ }
1278
+
1279
+ .radio-hint {
1280
+ color: var(--compa11y-radio-hint-color, #666);
1281
+ font-size: var(--compa11y-radio-hint-size, 0.8125rem);
1282
+ }
1283
+
1284
+ /* Forced colors / high contrast mode */
1285
+ @media (forced-colors: active) {
1286
+ .radio-circle {
1287
+ border: 2px solid ButtonText;
1288
+ }
1289
+
1290
+ :host([checked]) .radio-circle {
1291
+ background: Highlight;
1292
+ border-color: Highlight;
1293
+ }
1294
+
1295
+ .radio-dot {
1296
+ background: HighlightText;
1297
+ }
1298
+ }
1299
+ `,X='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';class O extends u{constructor(){super(...arguments),this._open=!1,this._previouslyFocused=null,this._triggerElement=null,this.handleTriggerClick=()=>{this.open=!0},this.handleClose=()=>{this.open=!1},this.handleKeyDown=e=>{var t;if(this._open){if(e.key==="Escape"){this.getAttribute("close-on-escape")!=="false"&&(e.preventDefault(),this.handleClose());return}if(e.key==="Tab"){e.preventDefault();const i=this.getFocusableElements();if(i.length===0)return;const s=((t=this.shadowRoot)==null?void 0:t.activeElement)||document.activeElement;let a=i.findIndex(n=>n===s);a===-1&&(a=e.shiftKey?0:i.length-1);let r;e.shiftKey?r=a===0?i.length-1:a-1:r=a===i.length-1?0:a+1;const h=i[r];h&&h.focus()}}}}static get observedAttributes(){return["open","trigger","close-on-outside-click","close-on-escape"]}get open(){return this._open}set open(e){const t=this._open;this._open=e,e!==t&&(e?this.showDialog():this.hideDialog()),this.toggleAttribute("open",e)}setupAccessibility(){}render(){const e=this.attachShadow({mode:"open"}),t=`${this._id}-title`,i=`${this._id}-desc`;e.innerHTML=`
1300
+ <style>${W}</style>
417
1301
  <div class="overlay" part="overlay"></div>
418
1302
  <div
419
1303
  class="dialog"
@@ -436,8 +1320,8 @@
436
1320
  <slot name="actions"></slot>
437
1321
  </div>
438
1322
  </div>
439
- `,this._open||(this.style.display="none")}setupEventListeners(){var i;const e=this.getAttribute("trigger");if(e){const s=()=>{this._triggerElement=document.querySelector(e),this._triggerElement&&(this._triggerElement.addEventListener("click",this.handleTriggerClick),this._triggerElement.hasAttribute("tabindex")||this._triggerElement.setAttribute("tabindex","0"))};s(),this._triggerElement||requestAnimationFrame(()=>{s(),this._triggerElement||setTimeout(s,0)})}const t=(i=this.shadowRoot)==null?void 0:i.querySelector(".overlay");this.getAttribute("close-on-outside-click")!=="false"&&(t==null||t.addEventListener("click",this.handleClose)),this.addEventListener("keydown",this.handleKeyDown)}cleanupEventListeners(){var e;(e=this._triggerElement)==null||e.removeEventListener("click",this.handleTriggerClick),this.removeEventListener("keydown",this.handleKeyDown)}onAttributeChange(e,t,i){e==="open"&&(this.open=i!==null)}getFocusableElements(){const e=[];return this.querySelectorAll(v).forEach(i=>e.push(i)),this.shadowRoot&&this.shadowRoot.querySelectorAll(v).forEach(s=>{s.classList.contains("overlay")||e.push(s)}),e}showDialog(){this._previouslyFocused=document.activeElement,this.style.display="flex",requestAnimationFrame(()=>{const t=this.getFocusableElements()[0];t&&t.focus()}),document.body.style.overflow="hidden",o.announce("Dialog opened",{politeness:"polite"}),this.emit("a11y-dialog-open")}hideDialog(){var e;this.style.display="none",document.body.style.overflow="",(e=this._previouslyFocused)==null||e.focus(),this._previouslyFocused=null,o.announce("Dialog closed",{politeness:"polite"}),this.emit("a11y-dialog-close")}show(){this.open=!0}close(){this.open=!1}}c("a11y-dialog",b);class m extends d{constructor(){super(...arguments),this._open=!1,this._highlightedIndex=-1,this._menuItems=[],this.updateMenuItems=()=>{this._menuItems=Array.from(this.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')),this._menuItems.forEach((e,t)=>{e.id=e.id||`${this._id}-item-${t}`,e.setAttribute("tabindex","-1")})},this._lastClickTime=0,this.handleTriggerClick=()=>{const e=Date.now();e-this._lastClickTime<50||(this._lastClickTime=e,this.toggle())},this.handleTriggerKeyDown=e=>{switch(e.key){case"Enter":case" ":e.preventDefault(),this.toggle(),this._open&&this.highlightItem(0);break;case"ArrowDown":e.preventDefault(),this._open||this.show(),this.highlightItem(0);break;case"ArrowUp":e.preventDefault(),this._open||this.show(),this.highlightItem(this._menuItems.length-1);break}},this.handleMenuKeyDown=e=>{if(!this._open)return;const t=e.target;if(!(!t.hasAttribute("role")||t.getAttribute("role")!=="menuitem"))switch(e.key){case"ArrowDown":e.preventDefault(),this.highlightItem((this._highlightedIndex+1)%this._menuItems.length);break;case"ArrowUp":e.preventDefault(),this.highlightItem((this._highlightedIndex-1+this._menuItems.length)%this._menuItems.length);break;case"Home":e.preventDefault(),this.highlightItem(0);break;case"End":e.preventDefault(),this.highlightItem(this._menuItems.length-1);break;case"Enter":case" ":e.preventDefault(),this.selectItem(this._highlightedIndex);break;case"Escape":e.preventDefault(),this.close();break;case"Tab":this.close();break}},this.handleItemClick=e=>{const t=e.target;if(t.getAttribute("role")==="menuitem"&&t.getAttribute("aria-disabled")!=="true"){const i=this._menuItems.indexOf(t);this.selectItem(i)}},this.handleMouseOver=e=>{const t=e.target;if(t.getAttribute("role")==="menuitem"){const i=this._menuItems.indexOf(t);i!==-1&&this.highlightItem(i,!1)}},this.handleOutsideClick=e=>{if(!this._open)return;e.composedPath().includes(this)||this.close()}}static get observedAttributes(){return["open"]}get open(){return this._open}set open(e){const t=this._open;this._open=e,e!==t&&this.updateMenuVisibility(),this.toggleAttribute("open",e)}setupAccessibility(){const e=this.querySelector('[slot="trigger"]');e&&(e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded",String(this._open)),e.id=e.id||`${this._id}-trigger`,e.hasAttribute("tabindex")||e.setAttribute("tabindex","0"))}render(){const e=this.attachShadow({mode:"open"});e.innerHTML=`
440
- <style>${w}</style>
1323
+ `,this._open||(this.style.display="none")}setupEventListeners(){var i;const e=this.getAttribute("trigger");if(e){const s=()=>{this._triggerElement=document.querySelector(e),this._triggerElement&&(this._triggerElement.addEventListener("click",this.handleTriggerClick),this._triggerElement.hasAttribute("tabindex")||this._triggerElement.setAttribute("tabindex","0"))};s(),this._triggerElement||requestAnimationFrame(()=>{s(),this._triggerElement||setTimeout(s,0)})}const t=(i=this.shadowRoot)==null?void 0:i.querySelector(".overlay");this.getAttribute("close-on-outside-click")!=="false"&&(t==null||t.addEventListener("click",this.handleClose)),this.addEventListener("keydown",this.handleKeyDown)}cleanupEventListeners(){var e;(e=this._triggerElement)==null||e.removeEventListener("click",this.handleTriggerClick),this.removeEventListener("keydown",this.handleKeyDown)}onAttributeChange(e,t,i){e==="open"&&(this.open=i!==null)}getFocusableElements(){const e=[];return this.querySelectorAll(X).forEach(i=>e.push(i)),this.shadowRoot&&this.shadowRoot.querySelectorAll(X).forEach(s=>{s.classList.contains("overlay")||e.push(s)}),e}showDialog(){this._previouslyFocused=document.activeElement,this.style.display="flex",requestAnimationFrame(()=>{const t=this.getFocusableElements()[0];t&&t.focus()}),document.body.style.overflow="hidden",o.announce("Dialog opened",{politeness:"polite"}),this.emit("a11y-dialog-open")}hideDialog(){var e;this.style.display="none",document.body.style.overflow="",(e=this._previouslyFocused)==null||e.focus(),this._previouslyFocused=null,o.announce("Dialog closed",{politeness:"polite"}),this.emit("a11y-dialog-close")}show(){this.open=!0}close(){this.open=!1}}b("a11y-dialog",O);class z extends u{constructor(){super(...arguments),this._open=!1,this._highlightedIndex=-1,this._menuItems=[],this.updateMenuItems=()=>{this._menuItems=Array.from(this.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')),this._menuItems.forEach((e,t)=>{e.id=e.id||`${this._id}-item-${t}`,e.setAttribute("tabindex","-1")})},this._lastClickTime=0,this.handleTriggerClick=()=>{const e=Date.now();e-this._lastClickTime<50||(this._lastClickTime=e,this.toggle())},this.handleTriggerKeyDown=e=>{switch(e.key){case"Enter":case" ":e.preventDefault(),this.toggle(),this._open&&this.highlightItem(0);break;case"ArrowDown":e.preventDefault(),this._open||this.show(),this.highlightItem(0);break;case"ArrowUp":e.preventDefault(),this._open||this.show(),this.highlightItem(this._menuItems.length-1);break}},this.handleMenuKeyDown=e=>{if(!this._open)return;const t=e.target;if(!(!t.hasAttribute("role")||t.getAttribute("role")!=="menuitem"))switch(e.key){case"ArrowDown":e.preventDefault(),this.highlightItem((this._highlightedIndex+1)%this._menuItems.length);break;case"ArrowUp":e.preventDefault(),this.highlightItem((this._highlightedIndex-1+this._menuItems.length)%this._menuItems.length);break;case"Home":e.preventDefault(),this.highlightItem(0);break;case"End":e.preventDefault(),this.highlightItem(this._menuItems.length-1);break;case"Enter":case" ":e.preventDefault(),this.selectItem(this._highlightedIndex);break;case"Escape":e.preventDefault(),this.close();break;case"Tab":this.close();break}},this.handleItemClick=e=>{const t=e.target;if(t.getAttribute("role")==="menuitem"&&t.getAttribute("aria-disabled")!=="true"){const i=this._menuItems.indexOf(t);this.selectItem(i)}},this.handleMouseOver=e=>{const t=e.target;if(t.getAttribute("role")==="menuitem"){const i=this._menuItems.indexOf(t);i!==-1&&this.highlightItem(i,!1)}},this.handleOutsideClick=e=>{if(!this._open)return;e.composedPath().includes(this)||this.close()}}static get observedAttributes(){return["open"]}get open(){return this._open}set open(e){const t=this._open;this._open=e,e!==t&&this.updateMenuVisibility(),this.toggleAttribute("open",e)}setupAccessibility(){const e=this.querySelector('[slot="trigger"]');e&&(e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded",String(this._open)),e.id=e.id||`${this._id}-trigger`,e.hasAttribute("tabindex")||e.setAttribute("tabindex","0"))}render(){const e=this.attachShadow({mode:"open"});e.innerHTML=`
1324
+ <style>${J}</style>
441
1325
  <slot name="trigger"></slot>
442
1326
  <div
443
1327
  class="menu-content"
@@ -449,8 +1333,8 @@
449
1333
  >
450
1334
  <slot></slot>
451
1335
  </div>
452
- `}setupEventListeners(){var s,n;const e=this.querySelector('[slot="trigger"]');e==null||e.addEventListener("click",this.handleTriggerClick),e==null||e.addEventListener("keydown",this.handleTriggerKeyDown);const t=(s=this.shadowRoot)==null?void 0:s.querySelector('slot[name="trigger"]');t==null||t.addEventListener("click",this.handleTriggerClick),this.addEventListener("click",this.handleItemClick),this.addEventListener("keydown",this.handleMenuKeyDown),this.addEventListener("mouseover",this.handleMouseOver),document.addEventListener("mousedown",this.handleOutsideClick);const i=(n=this.shadowRoot)==null?void 0:n.querySelector("slot:not([name])");i==null||i.addEventListener("slotchange",this.updateMenuItems),this.updateMenuItems()}cleanupEventListeners(){document.removeEventListener("mousedown",this.handleOutsideClick)}onAttributeChange(e,t,i){e==="open"&&(this.open=i!==null)}highlightItem(e,t=!0){var s;if(this._highlightedIndex>=0){const n=this._menuItems[this._highlightedIndex];n==null||n.removeAttribute("data-highlighted")}this._highlightedIndex=e;const i=this._menuItems[e];if(i){i.setAttribute("data-highlighted","true"),t&&i.focus();const n=(s=this.shadowRoot)==null?void 0:s.querySelector('[role="menu"]');n==null||n.setAttribute("aria-activedescendant",i.id)}}selectItem(e){const t=this._menuItems[e];t&&(this.emit("a11y-menu-select",{item:t,index:e}),t.click()),this.close()}updateMenuVisibility(){var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelector(".menu-content"),t=this.querySelector('[slot="trigger"]');this._open?(e==null||e.removeAttribute("hidden"),t==null||t.setAttribute("aria-expanded","true"),this.updateMenuItems(),this.emit("a11y-menu-open")):(e==null||e.setAttribute("hidden",""),t==null||t.setAttribute("aria-expanded","false"),this._highlightedIndex=-1,this._menuItems.forEach(s=>{s.removeAttribute("data-highlighted")}),t==null||t.focus(),this.emit("a11y-menu-close"))}show(){this.open=!0}close(){this.open=!1}toggle(){this.open=!this._open}}c("a11y-menu",m);class g extends d{constructor(){super(...arguments),this._tabs=[],this._panels=[],this._selectedIndex=0,this.updateTabsAndPanels=()=>{this._tabs=Array.from(this.querySelectorAll('[role="tab"]')),this._panels=Array.from(this.querySelectorAll('[role="tabpanel"]')),this._tabs.forEach((e,t)=>{const i=this._panels[t],s=e.id||`${this._id}-tab-${t}`,n=(i==null?void 0:i.id)||`${this._id}-panel-${t}`;e.id=s,e.setAttribute("aria-controls",n),e.setAttribute("tabindex",t===this._selectedIndex?"0":"-1"),e.setAttribute("aria-selected",String(t===this._selectedIndex)),e.hasAttribute("slot")||e.setAttribute("slot","tab"),i&&(i.id=n,i.setAttribute("aria-labelledby",s),i.setAttribute("tabindex","0"),i.hidden=t!==this._selectedIndex,i.hasAttribute("slot")||i.setAttribute("slot","panel"))}),this.updateSelection()},this.handleClick=e=>{const t=e.target;if(t.getAttribute("role")==="tab"){const i=this._tabs.indexOf(t);i!==-1&&t.getAttribute("aria-disabled")!=="true"&&this.selectTab(i)}},this.handleKeyDown=e=>{var h;if(e.target.getAttribute("role")!=="tab")return;const i=this.orientation==="horizontal",s=i?"ArrowRight":"ArrowDown",n=i?"ArrowLeft":"ArrowUp";let r=this._selectedIndex;switch(e.key){case s:e.preventDefault(),r=(this._selectedIndex+1)%this._tabs.length;break;case n:e.preventDefault(),r=(this._selectedIndex-1+this._tabs.length)%this._tabs.length;break;case"Home":e.preventDefault(),r=0;break;case"End":e.preventDefault(),r=this._tabs.length-1;break;default:return}(h=this._tabs[r])==null||h.focus(),this.activationMode==="automatic"&&this.selectTab(r)}}static get observedAttributes(){return["orientation","activation-mode","selected-index"]}get selectedIndex(){return this._selectedIndex}set selectedIndex(e){e>=0&&e<this._tabs.length&&(this._selectedIndex=e,this.updateSelection())}get orientation(){return this.getAttribute("orientation")||"horizontal"}get activationMode(){return this.getAttribute("activation-mode")||"automatic"}setupAccessibility(){this.updateTabsAndPanels()}render(){const e=this.attachShadow({mode:"open"});e.innerHTML=`
453
- <style>${E}</style>
1336
+ `}setupEventListeners(){var s,a;const e=this.querySelector('[slot="trigger"]');e==null||e.addEventListener("click",this.handleTriggerClick),e==null||e.addEventListener("keydown",this.handleTriggerKeyDown);const t=(s=this.shadowRoot)==null?void 0:s.querySelector('slot[name="trigger"]');t==null||t.addEventListener("click",this.handleTriggerClick),this.addEventListener("click",this.handleItemClick),this.addEventListener("keydown",this.handleMenuKeyDown),this.addEventListener("mouseover",this.handleMouseOver),document.addEventListener("mousedown",this.handleOutsideClick);const i=(a=this.shadowRoot)==null?void 0:a.querySelector("slot:not([name])");i==null||i.addEventListener("slotchange",this.updateMenuItems),this.updateMenuItems()}cleanupEventListeners(){document.removeEventListener("mousedown",this.handleOutsideClick)}onAttributeChange(e,t,i){e==="open"&&(this.open=i!==null)}highlightItem(e,t=!0){var s;if(this._highlightedIndex>=0){const a=this._menuItems[this._highlightedIndex];a==null||a.removeAttribute("data-highlighted")}this._highlightedIndex=e;const i=this._menuItems[e];if(i){i.setAttribute("data-highlighted","true"),t&&i.focus();const a=(s=this.shadowRoot)==null?void 0:s.querySelector('[role="menu"]');a==null||a.setAttribute("aria-activedescendant",i.id)}}selectItem(e){const t=this._menuItems[e];t&&(this.emit("a11y-menu-select",{item:t,index:e}),t.click()),this.close()}updateMenuVisibility(){var i;const e=(i=this.shadowRoot)==null?void 0:i.querySelector(".menu-content"),t=this.querySelector('[slot="trigger"]');this._open?(e==null||e.removeAttribute("hidden"),t==null||t.setAttribute("aria-expanded","true"),this.updateMenuItems(),this.emit("a11y-menu-open")):(e==null||e.setAttribute("hidden",""),t==null||t.setAttribute("aria-expanded","false"),this._highlightedIndex=-1,this._menuItems.forEach(s=>{s.removeAttribute("data-highlighted")}),t==null||t.focus(),this.emit("a11y-menu-close"))}show(){this.open=!0}close(){this.open=!1}toggle(){this.open=!this._open}}b("a11y-menu",z);class q extends u{constructor(){super(...arguments),this._tabs=[],this._panels=[],this._selectedIndex=0,this.updateTabsAndPanels=()=>{this._tabs=Array.from(this.querySelectorAll('[role="tab"]')),this._panels=Array.from(this.querySelectorAll('[role="tabpanel"]')),this._tabs.forEach((e,t)=>{const i=this._panels[t],s=e.id||`${this._id}-tab-${t}`,a=(i==null?void 0:i.id)||`${this._id}-panel-${t}`;e.id=s,e.setAttribute("aria-controls",a),e.setAttribute("tabindex",t===this._selectedIndex?"0":"-1"),e.setAttribute("aria-selected",String(t===this._selectedIndex)),e.hasAttribute("slot")||e.setAttribute("slot","tab"),i&&(i.id=a,i.setAttribute("aria-labelledby",s),i.setAttribute("tabindex","0"),i.hidden=t!==this._selectedIndex,i.hasAttribute("slot")||i.setAttribute("slot","panel"))}),this.updateSelection()},this.handleClick=e=>{const t=e.target;if(t.getAttribute("role")==="tab"){const i=this._tabs.indexOf(t);i!==-1&&t.getAttribute("aria-disabled")!=="true"&&this.selectTab(i)}},this.handleKeyDown=e=>{var h;if(e.target.getAttribute("role")!=="tab")return;const i=this.orientation==="horizontal",s=i?"ArrowRight":"ArrowDown",a=i?"ArrowLeft":"ArrowUp";let r=this._selectedIndex;switch(e.key){case s:e.preventDefault(),r=(this._selectedIndex+1)%this._tabs.length;break;case a:e.preventDefault(),r=(this._selectedIndex-1+this._tabs.length)%this._tabs.length;break;case"Home":e.preventDefault(),r=0;break;case"End":e.preventDefault(),r=this._tabs.length-1;break;default:return}(h=this._tabs[r])==null||h.focus(),this.activationMode==="automatic"&&this.selectTab(r)}}static get observedAttributes(){return["orientation","activation-mode","selected-index"]}get selectedIndex(){return this._selectedIndex}set selectedIndex(e){e>=0&&e<this._tabs.length&&(this._selectedIndex=e,this.updateSelection())}get orientation(){return this.getAttribute("orientation")||"horizontal"}get activationMode(){return this.getAttribute("activation-mode")||"automatic"}setupAccessibility(){this.updateTabsAndPanels()}render(){const e=this.attachShadow({mode:"open"});e.innerHTML=`
1337
+ <style>${Q}</style>
454
1338
  <div class="tablist" role="tablist" aria-orientation="${this.orientation}" part="tablist">
455
1339
  <slot name="tab"></slot>
456
1340
  </div>
@@ -458,8 +1342,8 @@
458
1342
  <slot name="panel"></slot>
459
1343
  </div>
460
1344
  <slot></slot>
461
- `}setupEventListeners(){var s,n,r;this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown);const e=(s=this.shadowRoot)==null?void 0:s.querySelector('slot[name="tab"]'),t=(n=this.shadowRoot)==null?void 0:n.querySelector('slot[name="panel"]'),i=(r=this.shadowRoot)==null?void 0:r.querySelector("slot:not([name])");e==null||e.addEventListener("slotchange",this.updateTabsAndPanels),t==null||t.addEventListener("slotchange",this.updateTabsAndPanels),i==null||i.addEventListener("slotchange",this.updateTabsAndPanels)}onAttributeChange(e,t,i){var s;if(e==="orientation"){const n=(s=this.shadowRoot)==null?void 0:s.querySelector('[role="tablist"]');n==null||n.setAttribute("aria-orientation",i||"horizontal")}e==="selected-index"&&i&&(this.selectedIndex=parseInt(i,10))}selectTab(e){const t=this._selectedIndex;if(this._selectedIndex=e,this.updateSelection(),t!==e){const i=this._tabs[e];o.announce(`${(i==null?void 0:i.textContent)||"Tab"} selected`),this.emit("a11y-tabs-change",{index:e,tab:this._tabs[e],panel:this._panels[e]})}}updateSelection(){this._tabs.forEach((e,t)=>{const i=t===this._selectedIndex;e.setAttribute("aria-selected",String(i)),e.setAttribute("tabindex",i?"0":"-1")}),this._panels.forEach((e,t)=>{e.hidden=t!==this._selectedIndex})}select(e){this.selectTab(e)}next(){this.selectTab((this._selectedIndex+1)%this._tabs.length)}previous(){this.selectTab((this._selectedIndex-1+this._tabs.length)%this._tabs.length)}}c("a11y-tabs",g);class f extends d{constructor(){super(...arguments),this._open=!1,this._highlightedIndex=-1,this._options=[],this._filteredOptions=[],this._inputValue="",this._selectedValue=null,this._inputElement=null,this._listboxElement=null,this.updateOptions=()=>{const e=Array.from(this.querySelectorAll("option"));this._options=e.map(t=>({value:t.getAttribute("value")||t.textContent||"",label:t.textContent||"",disabled:t.hasAttribute("disabled"),element:t})),this._filteredOptions=[...this._options],this.renderOptions()},this.handleInput=e=>{const t=e.target;this._inputValue=t.value;const i=this._inputValue.toLowerCase();this._filteredOptions=i?this._options.filter(n=>n.label.toLowerCase().includes(i)):[...this._options],this.renderOptions(),this.open=!0,this._highlightedIndex=0,this.updateHighlight(),this.updateClearButton();const s=this._filteredOptions.length;o.announce(s===0?"No results":`${s} result${s===1?"":"s"} available`)},this.handleFocus=()=>{this.open=!0},this.handleBlur=()=>{setTimeout(()=>{var e;(e=this.shadowRoot)!=null&&e.activeElement||(this.open=!1)},150)},this.handleKeyDown=e=>{switch(e.key){case"ArrowDown":e.preventDefault(),this._open?this._highlightedIndex=Math.min(this._highlightedIndex+1,this._filteredOptions.length-1):(this.open=!0,this._highlightedIndex=0),this.updateHighlight();break;case"ArrowUp":e.preventDefault(),this._open?this._highlightedIndex=Math.max(this._highlightedIndex-1,0):(this.open=!0,this._highlightedIndex=this._filteredOptions.length-1),this.updateHighlight();break;case"Enter":if(e.preventDefault(),this._open&&this._highlightedIndex>=0){const t=this._filteredOptions[this._highlightedIndex];t&&!t.disabled&&this.selectOption(t)}break;case"Escape":e.preventDefault(),this.open=!1,this._highlightedIndex=-1;break;case"Home":this._open&&(e.preventDefault(),this._highlightedIndex=0,this.updateHighlight());break;case"End":this._open&&(e.preventDefault(),this._highlightedIndex=this._filteredOptions.length-1,this.updateHighlight());break;case"Tab":this._open&&(this.open=!1,this._highlightedIndex=-1);break}},this.handleOptionClick=e=>{const t=e.currentTarget,i=parseInt(t.dataset.index||"0",10),s=this._filteredOptions[i];s&&!s.disabled&&this.selectOption(s)},this.handleOptionHover=e=>{const t=e.currentTarget,i=parseInt(t.dataset.index||"0",10),s=this._filteredOptions[i];s&&!s.disabled&&(this._highlightedIndex=i,this.updateHighlight())},this.handleClear=()=>{this._inputValue="",this._selectedValue=null,this._inputElement&&(this._inputElement.value="",this._inputElement.focus()),this._filteredOptions=[...this._options],this.renderOptions(),this.updateClearButton(),this.emit("a11y-combobox-clear"),this.emit("a11y-combobox-change",{value:null,label:null})},this.handleOutsideClick=e=>{if(!this._open)return;e.composedPath().includes(this)||(this.open=!1)}}static get observedAttributes(){return["open","value","placeholder","disabled","clearable"]}get open(){return this._open}set open(e){const t=this._open;this._open=e,e!==t&&this.updateListboxVisibility(),this.toggleAttribute("open",e)}get value(){return this._selectedValue}set value(e){this._selectedValue=e;const t=this._options.find(i=>i.value===e);t&&(this._inputValue=t.label,this._inputElement&&(this._inputElement.value=t.label)),this.setAttribute("value",e||"")}setupAccessibility(){}render(){const e=this.attachShadow({mode:"open"}),t=`${this._id}-input`,i=`${this._id}-listbox`,s=this.getAttribute("placeholder")||"Search...",n=this.hasAttribute("clearable");e.innerHTML=`
462
- <style>${A}</style>
1345
+ `}setupEventListeners(){var s,a,r;this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown);const e=(s=this.shadowRoot)==null?void 0:s.querySelector('slot[name="tab"]'),t=(a=this.shadowRoot)==null?void 0:a.querySelector('slot[name="panel"]'),i=(r=this.shadowRoot)==null?void 0:r.querySelector("slot:not([name])");e==null||e.addEventListener("slotchange",this.updateTabsAndPanels),t==null||t.addEventListener("slotchange",this.updateTabsAndPanels),i==null||i.addEventListener("slotchange",this.updateTabsAndPanels)}onAttributeChange(e,t,i){var s;if(e==="orientation"){const a=(s=this.shadowRoot)==null?void 0:s.querySelector('[role="tablist"]');a==null||a.setAttribute("aria-orientation",i||"horizontal")}e==="selected-index"&&i&&(this.selectedIndex=parseInt(i,10))}selectTab(e){const t=this._selectedIndex;if(this._selectedIndex=e,this.updateSelection(),t!==e){const i=this._tabs[e];o.announce(`${(i==null?void 0:i.textContent)||"Tab"} selected`),this.emit("a11y-tabs-change",{index:e,tab:this._tabs[e],panel:this._panels[e]})}}updateSelection(){this._tabs.forEach((e,t)=>{const i=t===this._selectedIndex;e.setAttribute("aria-selected",String(i)),e.setAttribute("tabindex",i?"0":"-1")}),this._panels.forEach((e,t)=>{e.hidden=t!==this._selectedIndex})}select(e){this.selectTab(e)}next(){this.selectTab((this._selectedIndex+1)%this._tabs.length)}previous(){this.selectTab((this._selectedIndex-1+this._tabs.length)%this._tabs.length)}}b("a11y-tabs",q);class D extends u{constructor(){super(...arguments),this._open=!1,this._highlightedIndex=-1,this._options=[],this._filteredOptions=[],this._inputValue="",this._selectedValue=null,this._inputElement=null,this._listboxElement=null,this.updateOptions=()=>{const e=Array.from(this.querySelectorAll("option"));this._options=e.map(t=>({value:t.getAttribute("value")||t.textContent||"",label:t.textContent||"",disabled:t.hasAttribute("disabled"),element:t})),this._filteredOptions=[...this._options],this.renderOptions()},this.handleInput=e=>{const t=e.target;this._inputValue=t.value;const i=this._inputValue.toLowerCase();this._filteredOptions=i?this._options.filter(a=>a.label.toLowerCase().includes(i)):[...this._options],this.renderOptions(),this.open=!0,this._highlightedIndex=0,this.updateHighlight(),this.updateClearButton();const s=this._filteredOptions.length;o.announce(s===0?"No results":`${s} result${s===1?"":"s"} available`)},this.handleFocus=()=>{this.open=!0},this.handleBlur=()=>{setTimeout(()=>{var e;(e=this.shadowRoot)!=null&&e.activeElement||(this.open=!1)},150)},this.handleKeyDown=e=>{switch(e.key){case"ArrowDown":e.preventDefault(),this._open?this._highlightedIndex=Math.min(this._highlightedIndex+1,this._filteredOptions.length-1):(this.open=!0,this._highlightedIndex=0),this.updateHighlight();break;case"ArrowUp":e.preventDefault(),this._open?this._highlightedIndex=Math.max(this._highlightedIndex-1,0):(this.open=!0,this._highlightedIndex=this._filteredOptions.length-1),this.updateHighlight();break;case"Enter":if(e.preventDefault(),this._open&&this._highlightedIndex>=0){const t=this._filteredOptions[this._highlightedIndex];t&&!t.disabled&&this.selectOption(t)}break;case"Escape":e.preventDefault(),this.open=!1,this._highlightedIndex=-1;break;case"Home":this._open&&(e.preventDefault(),this._highlightedIndex=0,this.updateHighlight());break;case"End":this._open&&(e.preventDefault(),this._highlightedIndex=this._filteredOptions.length-1,this.updateHighlight());break;case"Tab":this._open&&(this.open=!1,this._highlightedIndex=-1);break}},this.handleOptionClick=e=>{const t=e.currentTarget,i=parseInt(t.dataset.index||"0",10),s=this._filteredOptions[i];s&&!s.disabled&&this.selectOption(s)},this.handleOptionHover=e=>{const t=e.currentTarget,i=parseInt(t.dataset.index||"0",10),s=this._filteredOptions[i];s&&!s.disabled&&(this._highlightedIndex=i,this.updateHighlight())},this.handleClear=()=>{this._inputValue="",this._selectedValue=null,this._inputElement&&(this._inputElement.value="",this._inputElement.focus()),this._filteredOptions=[...this._options],this.renderOptions(),this.updateClearButton(),this.emit("a11y-combobox-clear"),this.emit("a11y-combobox-change",{value:null,label:null})},this.handleOutsideClick=e=>{if(!this._open)return;e.composedPath().includes(this)||(this.open=!1)}}static get observedAttributes(){return["open","value","placeholder","disabled","clearable"]}get open(){return this._open}set open(e){const t=this._open;this._open=e,e!==t&&this.updateListboxVisibility(),this.toggleAttribute("open",e)}get value(){return this._selectedValue}set value(e){this._selectedValue=e;const t=this._options.find(i=>i.value===e);t&&(this._inputValue=t.label,this._inputElement&&(this._inputElement.value=t.label)),this.setAttribute("value",e||"")}setupAccessibility(){}render(){const e=this.attachShadow({mode:"open"}),t=`${this._id}-input`,i=`${this._id}-listbox`,s=this.getAttribute("placeholder")||"Search...",a=this.hasAttribute("clearable");e.innerHTML=`
1346
+ <style>${Z}</style>
463
1347
  <div class="combobox-wrapper" part="wrapper">
464
1348
  <div class="input-wrapper" part="input-wrapper">
465
1349
  <input
@@ -474,7 +1358,7 @@
474
1358
  placeholder="${s}"
475
1359
  part="input"
476
1360
  />
477
- ${n?`
1361
+ ${a?`
478
1362
  <button
479
1363
  type="button"
480
1364
  class="clear-button"
@@ -499,7 +1383,7 @@
499
1383
  <div class="options-source" hidden>
500
1384
  <slot></slot>
501
1385
  </div>
502
- `,this._inputElement=e.querySelector("input"),this._listboxElement=e.querySelector(".listbox")}setupEventListeners(){var i,s,n,r,h,p;(i=this._inputElement)==null||i.addEventListener("input",this.handleInput),(s=this._inputElement)==null||s.addEventListener("focus",this.handleFocus),(n=this._inputElement)==null||n.addEventListener("blur",this.handleBlur),(r=this._inputElement)==null||r.addEventListener("keydown",this.handleKeyDown);const e=(h=this.shadowRoot)==null?void 0:h.querySelector(".clear-button");e==null||e.addEventListener("click",this.handleClear),document.addEventListener("mousedown",this.handleOutsideClick);const t=(p=this.shadowRoot)==null?void 0:p.querySelector("slot");t==null||t.addEventListener("slotchange",this.updateOptions),this.updateOptions()}cleanupEventListeners(){document.removeEventListener("mousedown",this.handleOutsideClick)}onAttributeChange(e,t,i){e==="open"&&(this.open=i!==null),e==="value"&&(this.value=i),e==="disabled"&&this._inputElement&&(this._inputElement.disabled=i!==null),e==="placeholder"&&this._inputElement&&(this._inputElement.placeholder=i||"Search...")}renderOptions(){this._listboxElement&&(this._listboxElement.innerHTML=this._filteredOptions.length===0?'<li role="presentation" class="empty-message" part="empty">No results found</li>':this._filteredOptions.map((e,t)=>`
1386
+ `,this._inputElement=e.querySelector("input"),this._listboxElement=e.querySelector(".listbox")}setupEventListeners(){var i,s,a,r,h,n;(i=this._inputElement)==null||i.addEventListener("input",this.handleInput),(s=this._inputElement)==null||s.addEventListener("focus",this.handleFocus),(a=this._inputElement)==null||a.addEventListener("blur",this.handleBlur),(r=this._inputElement)==null||r.addEventListener("keydown",this.handleKeyDown);const e=(h=this.shadowRoot)==null?void 0:h.querySelector(".clear-button");e==null||e.addEventListener("click",this.handleClear),document.addEventListener("mousedown",this.handleOutsideClick);const t=(n=this.shadowRoot)==null?void 0:n.querySelector("slot");t==null||t.addEventListener("slotchange",this.updateOptions),this.updateOptions()}cleanupEventListeners(){document.removeEventListener("mousedown",this.handleOutsideClick)}onAttributeChange(e,t,i){e==="open"&&(this.open=i!==null),e==="value"&&(this.value=i),e==="disabled"&&this._inputElement&&(this._inputElement.disabled=i!==null),e==="placeholder"&&this._inputElement&&(this._inputElement.placeholder=i||"Search...")}renderOptions(){this._listboxElement&&(this._listboxElement.innerHTML=this._filteredOptions.length===0?'<li role="presentation" class="empty-message" part="empty">No results found</li>':this._filteredOptions.map((e,t)=>`
503
1387
  <li
504
1388
  id="${this._id}-option-${t}"
505
1389
  role="option"
@@ -510,15 +1394,15 @@
510
1394
  part="option"
511
1395
  ${e.disabled?'class="disabled"':""}
512
1396
  >${e.label}</li>
513
- `).join(""),this._listboxElement.querySelectorAll('[role="option"]').forEach(e=>{e.addEventListener("click",this.handleOptionClick),e.addEventListener("mouseenter",this.handleOptionHover)}))}selectOption(e){this._selectedValue=e.value,this._inputValue=e.label,this._inputElement&&(this._inputElement.value=e.label),this.open=!1,this._highlightedIndex=-1,this.renderOptions(),this.updateClearButton(),o.announce(`${e.label} selected`),this.emit("a11y-combobox-select",{value:e.value,label:e.label}),this.emit("a11y-combobox-change",{value:e.value,label:e.label})}updateHighlight(){var e,t,i,s;if((e=this._listboxElement)==null||e.querySelectorAll('[role="option"]').forEach((n,r)=>{n.classList.toggle("highlighted",r===this._highlightedIndex)}),this._highlightedIndex>=0){const n=`${this._id}-option-${this._highlightedIndex}`;(t=this._inputElement)==null||t.setAttribute("aria-activedescendant",n);const r=(i=this._listboxElement)==null?void 0:i.querySelector(`#${n}`);r==null||r.scrollIntoView({block:"nearest",behavior:"smooth"})}else(s=this._inputElement)==null||s.removeAttribute("aria-activedescendant")}updateListboxVisibility(){!this._listboxElement||!this._inputElement||(this._open?(this._listboxElement.hidden=!1,this._inputElement.setAttribute("aria-expanded","true"),this.updateListboxPosition(),this.emit("a11y-combobox-open")):(this._listboxElement.hidden=!0,this._inputElement.setAttribute("aria-expanded","false"),this._highlightedIndex=-1,this.updateHighlight(),this._listboxElement.style.top="",this._listboxElement.style.bottom="",this.removeAttribute("data-position"),this.emit("a11y-combobox-close")))}updateListboxPosition(){if(!this._listboxElement||!this._inputElement)return;const e=this._inputElement.getBoundingClientRect(),t=window.innerHeight,i=Math.min(this._listboxElement.scrollHeight,200),s=t-e.bottom,n=e.top;s<i+8&&n>s?(this._listboxElement.style.top="auto",this._listboxElement.style.bottom="100%",this._listboxElement.style.marginTop="0",this._listboxElement.style.marginBottom="4px",this.setAttribute("data-position","top")):(this._listboxElement.style.top="100%",this._listboxElement.style.bottom="auto",this._listboxElement.style.marginTop="4px",this._listboxElement.style.marginBottom="0",this.setAttribute("data-position","bottom"))}updateClearButton(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".clear-button");e&&(e.hidden=!this._inputValue)}show(){this.open=!0}close(){this.open=!1}clear(){this.handleClear()}}c("a11y-combobox",f);class y extends d{constructor(){super(...arguments),this._checked=!1,this._button=null,this._label=null,this.handleClick=()=>{this.toggle()},this.handleKeyDown=e=>{this.disabled||(e.key===" "||e.key==="Enter")&&(e.preventDefault(),this.toggle())},this.handleLabelClick=()=>{var e;this.disabled||(this.toggle(),(e=this._button)==null||e.focus())}}static get observedAttributes(){return["checked","disabled","label","size","aria-label"]}get checked(){return this._checked}set checked(e){const t=this._checked;this._checked=e,this.toggleAttribute("checked",e),e!==t&&(this.updateVisualState(),this.emit("change",{checked:e}))}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e),this.updateDisabledState()}get label(){return this.getAttribute("label")||""}set label(e){e?this.setAttribute("label",e):this.removeAttribute("label")}get size(){const e=this.getAttribute("size");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}setupAccessibility(){var e;this.getAttribute("role"),typeof process<"u"&&((e=process.env)==null?void 0:e.NODE_ENV)!=="production"&&!this.label&&!this.getAttribute("aria-label")&&console.warn(`[compa11y/Switch] Switch has no accessible label. Add label="..." or aria-label="..." attribute.
514
- 💡 Suggestion: <a11y-switch label="Enable feature"></a11y-switch>`)}render(){const e=this.attachShadow({mode:"open"}),t=`${this._id}-label`,i=!!this.label,s=this.getAttribute("aria-label"),n=i?"":s?`aria-label="${s}"`:"",r=i?`aria-labelledby="${t}"`:"";e.innerHTML=`
515
- <style>${k}</style>
1397
+ `).join(""),this._listboxElement.querySelectorAll('[role="option"]').forEach(e=>{e.addEventListener("click",this.handleOptionClick),e.addEventListener("mouseenter",this.handleOptionHover)}))}selectOption(e){this._selectedValue=e.value,this._inputValue=e.label,this._inputElement&&(this._inputElement.value=e.label),this.open=!1,this._highlightedIndex=-1,this.renderOptions(),this.updateClearButton(),o.announce(`${e.label} selected`),this.emit("a11y-combobox-select",{value:e.value,label:e.label}),this.emit("a11y-combobox-change",{value:e.value,label:e.label})}updateHighlight(){var e,t,i,s;if((e=this._listboxElement)==null||e.querySelectorAll('[role="option"]').forEach((a,r)=>{a.classList.toggle("highlighted",r===this._highlightedIndex)}),this._highlightedIndex>=0){const a=`${this._id}-option-${this._highlightedIndex}`;(t=this._inputElement)==null||t.setAttribute("aria-activedescendant",a);const r=(i=this._listboxElement)==null?void 0:i.querySelector(`#${a}`);r==null||r.scrollIntoView({block:"nearest",behavior:"smooth"})}else(s=this._inputElement)==null||s.removeAttribute("aria-activedescendant")}updateListboxVisibility(){!this._listboxElement||!this._inputElement||(this._open?(this._listboxElement.hidden=!1,this._inputElement.setAttribute("aria-expanded","true"),this.updateListboxPosition(),this.emit("a11y-combobox-open")):(this._listboxElement.hidden=!0,this._inputElement.setAttribute("aria-expanded","false"),this._highlightedIndex=-1,this.updateHighlight(),this._listboxElement.style.top="",this._listboxElement.style.bottom="",this.removeAttribute("data-position"),this.emit("a11y-combobox-close")))}updateListboxPosition(){if(!this._listboxElement||!this._inputElement)return;const e=this._inputElement.getBoundingClientRect(),t=window.innerHeight,i=Math.min(this._listboxElement.scrollHeight,200),s=t-e.bottom,a=e.top;s<i+8&&a>s?(this._listboxElement.style.top="auto",this._listboxElement.style.bottom="100%",this._listboxElement.style.marginTop="0",this._listboxElement.style.marginBottom="4px",this.setAttribute("data-position","top")):(this._listboxElement.style.top="100%",this._listboxElement.style.bottom="auto",this._listboxElement.style.marginTop="4px",this._listboxElement.style.marginBottom="0",this.setAttribute("data-position","bottom"))}updateClearButton(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".clear-button");e&&(e.hidden=!this._inputValue)}show(){this.open=!0}close(){this.open=!1}clear(){this.handleClear()}}b("a11y-combobox",D);class T extends u{constructor(){super(...arguments),this._checked=!1,this._button=null,this._label=null,this.handleClick=()=>{this.toggle()},this.handleKeyDown=e=>{this.disabled||(e.key===" "||e.key==="Enter")&&(e.preventDefault(),this.toggle())},this.handleLabelClick=()=>{var e;this.disabled||(this.toggle(),(e=this._button)==null||e.focus())}}static get observedAttributes(){return["checked","disabled","label","size","aria-label"]}get checked(){return this._checked}set checked(e){const t=this._checked;this._checked=e,this.toggleAttribute("checked",e),e!==t&&(this.updateVisualState(),this.emit("change",{checked:e}))}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e),this.updateDisabledState()}get label(){return this.getAttribute("label")||""}set label(e){e?this.setAttribute("label",e):this.removeAttribute("label")}get size(){const e=this.getAttribute("size");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}setupAccessibility(){var e;this.getAttribute("role"),typeof process<"u"&&((e=process.env)==null?void 0:e.NODE_ENV)!=="production"&&!this.label&&!this.getAttribute("aria-label")&&console.warn(`[compa11y/Switch] Switch has no accessible label. Add label="..." or aria-label="..." attribute.
1398
+ 💡 Suggestion: <a11y-switch label="Enable feature"></a11y-switch>`)}render(){const e=this.attachShadow({mode:"open"}),t=`${this._id}-label`,i=!!this.label,s=this.getAttribute("aria-label"),a=i?"":s?`aria-label="${s}"`:"",r=i?`aria-labelledby="${t}"`:"";e.innerHTML=`
1399
+ <style>${te}</style>
516
1400
  <div class="switch-wrapper size-${this.size}" part="wrapper">
517
1401
  <button
518
1402
  type="button"
519
1403
  role="switch"
520
1404
  aria-checked="${this._checked}"
521
- ${n}
1405
+ ${a}
522
1406
  ${r}
523
1407
  ${this.disabled?"disabled":""}
524
1408
  class="switch-track ${this._checked?"checked":""}"
@@ -529,5 +1413,221 @@
529
1413
  </button>
530
1414
  ${i?`<label id="${t}" class="switch-label ${this.disabled?"disabled":""}" part="label">${this.label}</label>`:""}
531
1415
  </div>
532
- `,this._button=e.querySelector("button"),this._label=e.querySelector("label")}setupEventListeners(){var e,t,i;(e=this._button)==null||e.addEventListener("click",this.handleClick),(t=this._button)==null||t.addEventListener("keydown",this.handleKeyDown),(i=this._label)==null||i.addEventListener("click",this.handleLabelClick)}cleanupEventListeners(){var e,t,i;(e=this._button)==null||e.removeEventListener("click",this.handleClick),(t=this._button)==null||t.removeEventListener("keydown",this.handleKeyDown),(i=this._label)==null||i.removeEventListener("click",this.handleLabelClick)}onAttributeChange(e,t,i){switch(e){case"checked":this._checked=i!==null,this.updateVisualState();break;case"disabled":this.updateDisabledState();break;case"label":case"aria-label":this.shadowRoot&&(this.shadowRoot.innerHTML="",this.render(),this.setupEventListeners());break;case"size":this.updateSizeClass();break}}updateVisualState(){this._button&&(this._button.setAttribute("aria-checked",String(this._checked)),this._button.classList.toggle("checked",this._checked))}updateDisabledState(){this._button&&(this.disabled?(this._button.setAttribute("disabled",""),this._button.setAttribute("tabindex","-1")):(this._button.removeAttribute("disabled"),this._button.setAttribute("tabindex","0"))),this._label&&this._label.classList.toggle("disabled",this.disabled)}updateSizeClass(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".switch-wrapper");e&&(e.classList.remove("size-sm","size-md","size-lg"),e.classList.add(`size-${this.size}`))}toggle(){if(this.disabled)return;this.checked=!this.checked;const e=this.label||this.getAttribute("aria-label")||"Switch";o.announcePolite(`${e} ${this.checked?"on":"off"}`)}setChecked(e){this.checked=e}}if(c("a11y-switch",y),typeof window<"u"){const l=()=>{o.initAnnouncer(),o.initFocusVisible()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",l):l(),window.compa11y={A11yDialog:b,A11yMenu:m,A11yTabs:g,A11yCombobox:f,A11ySwitch:y,initAnnouncer:o.initAnnouncer,announce:o.announce,announcePolite:o.announcePolite,announceAssertive:o.announceAssertive,announceStatus:o.announceStatus,announceError:o.announceError,initFocusVisible:o.initFocusVisible,createFocusTrap:o.createFocusTrap,createFocusScope:o.createFocusScope,createRovingTabindex:o.createRovingTabindex,createKeyboardManager:o.createKeyboardManager,KeyboardPatterns:o.KeyboardPatterns,createTypeAhead:o.createTypeAhead,aria:o.aria,buildAriaProps:o.buildAriaProps,hasAccessibleName:o.hasAccessibleName,isBrowser:o.isBrowser,prefersReducedMotion:o.prefersReducedMotion,prefersHighContrast:o.prefersHighContrast,prefersDarkMode:o.prefersDarkMode}}Object.defineProperty(a,"KeyboardPatterns",{enumerable:!0,get:()=>o.KeyboardPatterns}),Object.defineProperty(a,"announce",{enumerable:!0,get:()=>o.announce}),Object.defineProperty(a,"announceAssertive",{enumerable:!0,get:()=>o.announceAssertive}),Object.defineProperty(a,"announceError",{enumerable:!0,get:()=>o.announceError}),Object.defineProperty(a,"announcePolite",{enumerable:!0,get:()=>o.announcePolite}),Object.defineProperty(a,"announceStatus",{enumerable:!0,get:()=>o.announceStatus}),Object.defineProperty(a,"aria",{enumerable:!0,get:()=>o.aria}),Object.defineProperty(a,"buildAriaProps",{enumerable:!0,get:()=>o.buildAriaProps}),Object.defineProperty(a,"createFocusScope",{enumerable:!0,get:()=>o.createFocusScope}),Object.defineProperty(a,"createFocusTrap",{enumerable:!0,get:()=>o.createFocusTrap}),Object.defineProperty(a,"createKeyboardManager",{enumerable:!0,get:()=>o.createKeyboardManager}),Object.defineProperty(a,"createRovingTabindex",{enumerable:!0,get:()=>o.createRovingTabindex}),Object.defineProperty(a,"createTypeAhead",{enumerable:!0,get:()=>o.createTypeAhead}),Object.defineProperty(a,"hasAccessibleName",{enumerable:!0,get:()=>o.hasAccessibleName}),Object.defineProperty(a,"initAnnouncer",{enumerable:!0,get:()=>o.initAnnouncer}),Object.defineProperty(a,"initFocusVisible",{enumerable:!0,get:()=>o.initFocusVisible}),Object.defineProperty(a,"isBrowser",{enumerable:!0,get:()=>o.isBrowser}),Object.defineProperty(a,"prefersDarkMode",{enumerable:!0,get:()=>o.prefersDarkMode}),Object.defineProperty(a,"prefersHighContrast",{enumerable:!0,get:()=>o.prefersHighContrast}),Object.defineProperty(a,"prefersReducedMotion",{enumerable:!0,get:()=>o.prefersReducedMotion}),a.A11yCombobox=f,a.A11yDialog=b,a.A11yMenu=m,a.A11ySwitch=y,a.A11yTabs=g,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
1416
+ `,this._button=e.querySelector("button"),this._label=e.querySelector("label")}setupEventListeners(){var e,t,i;(e=this._button)==null||e.addEventListener("click",this.handleClick),(t=this._button)==null||t.addEventListener("keydown",this.handleKeyDown),(i=this._label)==null||i.addEventListener("click",this.handleLabelClick)}cleanupEventListeners(){var e,t,i;(e=this._button)==null||e.removeEventListener("click",this.handleClick),(t=this._button)==null||t.removeEventListener("keydown",this.handleKeyDown),(i=this._label)==null||i.removeEventListener("click",this.handleLabelClick)}onAttributeChange(e,t,i){switch(e){case"checked":this._checked=i!==null,this.updateVisualState();break;case"disabled":this.updateDisabledState();break;case"label":case"aria-label":this.shadowRoot&&(this.shadowRoot.innerHTML="",this.render(),this.setupEventListeners());break;case"size":this.updateSizeClass();break}}updateVisualState(){this._button&&(this._button.setAttribute("aria-checked",String(this._checked)),this._button.classList.toggle("checked",this._checked))}updateDisabledState(){this._button&&(this.disabled?(this._button.setAttribute("disabled",""),this._button.setAttribute("tabindex","-1")):(this._button.removeAttribute("disabled"),this._button.setAttribute("tabindex","0"))),this._label&&this._label.classList.toggle("disabled",this.disabled)}updateSizeClass(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".switch-wrapper");e&&(e.classList.remove("size-sm","size-md","size-lg"),e.classList.add(`size-${this.size}`))}toggle(){if(this.disabled)return;this.checked=!this.checked;const e=this.label||this.getAttribute("aria-label")||"Switch";o.announcePolite(`${e} ${this.checked?"on":"off"}`)}setChecked(e){this.checked=e}}b("a11y-switch",T);class R extends u{constructor(){super(...arguments),this._open=!1,this._highlightedIndex=-1,this._options=[],this._selectedValue=null,this._triggerElement=null,this._listboxElement=null,this._typeAhead=null,this.updateOptions=()=>{const e=Array.from(this.querySelectorAll("option"));this._options=e.map(t=>({value:t.getAttribute("value")||t.textContent||"",label:t.textContent||"",disabled:t.hasAttribute("disabled"),element:t})),this._typeAhead=o.createTypeAhead(this._options.map(t=>t.label),{timeout:500}),this.renderOptions(),this.updateTriggerText()},this.handleTriggerClick=()=>{var e;(e=this._triggerElement)!=null&&e.disabled||(this._open?(this.open=!1,this._highlightedIndex=-1):this.openAndHighlight())},this.handleKeyDown=e=>{var t;switch(e.key){case"ArrowDown":e.preventDefault(),this._open?this.highlightNext():this.openAndHighlight();break;case"ArrowUp":e.preventDefault(),this._open?this.highlightPrevious():this.openAndHighlight(!0);break;case"Enter":if(e.preventDefault(),this._open&&this._highlightedIndex>=0){const i=this._options[this._highlightedIndex];i&&!i.disabled&&this.selectOption(i)}else this._open||this.openAndHighlight();break;case" ":if(e.preventDefault(),this._open&&this._highlightedIndex>=0){const i=this._options[this._highlightedIndex];i&&!i.disabled&&this.selectOption(i)}else this._open||this.openAndHighlight();break;case"Escape":e.preventDefault(),this._open&&(this.open=!1,this._highlightedIndex=-1);break;case"Home":this._open&&(e.preventDefault(),this._highlightedIndex=this.findFirstEnabled(),this.updateHighlight());break;case"End":this._open&&(e.preventDefault(),this._highlightedIndex=this.findLastEnabled(),this.updateHighlight());break;case"Tab":this._open&&(this.open=!1,this._highlightedIndex=-1);break;default:if(e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey){const i=(t=this._typeAhead)==null?void 0:t.type(e.key);if(i){const s=this._options.findIndex(a=>a.label===i&&!a.disabled);s>=0&&(this._open||(this.open=!0),this._highlightedIndex=s,this.updateHighlight())}}break}},this.handleBlur=()=>{setTimeout(()=>{var e;(e=this.shadowRoot)!=null&&e.activeElement||(this.open=!1,this._highlightedIndex=-1)},150)},this.handleListboxMouseDown=e=>{e.preventDefault()},this.handleOptionClick=e=>{const t=e.currentTarget,i=parseInt(t.dataset.index||"0",10),s=this._options[i];s&&!s.disabled&&this.selectOption(s)},this.handleOptionHover=e=>{const t=e.currentTarget,i=parseInt(t.dataset.index||"0",10),s=this._options[i];s&&!s.disabled&&(this._highlightedIndex=i,this.updateHighlight())},this.handleOutsideClick=e=>{if(!this._open)return;e.composedPath().includes(this)||(this.open=!1,this._highlightedIndex=-1)}}static get observedAttributes(){return["open","value","placeholder","disabled"]}get open(){return this._open}set open(e){const t=this._open;this._open=e,e!==t&&this.updateListboxVisibility(),this.toggleAttribute("open",e)}get value(){return this._selectedValue}set value(e){this._selectedValue=e,this.updateTriggerText(),this.setAttribute("value",e||"")}setupAccessibility(){}render(){const e=this.attachShadow({mode:"open"}),t=`${this._id}-trigger`,i=`${this._id}-listbox`,s=this.getAttribute("placeholder")||"Select an option...",a=this.getAttribute("aria-label")||"",r=this.getAttribute("aria-labelledby")||"";e.innerHTML=`
1417
+ <style>${ee}</style>
1418
+ <div class="select-wrapper" part="wrapper">
1419
+ <button
1420
+ id="${t}"
1421
+ type="button"
1422
+ role="combobox"
1423
+ aria-expanded="false"
1424
+ aria-controls="${i}"
1425
+ aria-haspopup="listbox"
1426
+ ${a?`aria-label="${a}"`:""}
1427
+ ${r?`aria-labelledby="${r}"`:""}
1428
+ class="select-trigger"
1429
+ part="trigger"
1430
+ >
1431
+ <span class="select-value placeholder" part="value">${s}</span>
1432
+ <span class="chevron" aria-hidden="true" part="chevron">&#9660;</span>
1433
+ </button>
1434
+ <ul
1435
+ id="${i}"
1436
+ role="listbox"
1437
+ aria-labelledby="${t}"
1438
+ class="listbox"
1439
+ tabindex="-1"
1440
+ hidden
1441
+ part="listbox"
1442
+ ></ul>
1443
+ </div>
1444
+ <div class="options-source" hidden>
1445
+ <slot></slot>
1446
+ </div>
1447
+ `,this._triggerElement=e.querySelector(".select-trigger"),this._listboxElement=e.querySelector(".listbox")}setupEventListeners(){var t,i,s,a,r;(t=this._triggerElement)==null||t.addEventListener("click",this.handleTriggerClick),(i=this._triggerElement)==null||i.addEventListener("keydown",this.handleKeyDown),(s=this._triggerElement)==null||s.addEventListener("blur",this.handleBlur),(a=this._listboxElement)==null||a.addEventListener("mousedown",this.handleListboxMouseDown),document.addEventListener("mousedown",this.handleOutsideClick);const e=(r=this.shadowRoot)==null?void 0:r.querySelector("slot");e==null||e.addEventListener("slotchange",this.updateOptions),this.updateOptions()}cleanupEventListeners(){document.removeEventListener("mousedown",this.handleOutsideClick)}onAttributeChange(e,t,i){e==="open"&&(this.open=i!==null),e==="value"&&(this.value=i),e==="disabled"&&this._triggerElement&&(this._triggerElement.disabled=i!==null),e==="placeholder"&&this.updateTriggerText()}renderOptions(){this._listboxElement&&(this._listboxElement.innerHTML=this._options.map((e,t)=>`
1448
+ <li
1449
+ id="${this._id}-option-${t}"
1450
+ role="option"
1451
+ aria-selected="${this._selectedValue===e.value}"
1452
+ aria-disabled="${e.disabled}"
1453
+ data-value="${e.value}"
1454
+ data-index="${t}"
1455
+ part="option"
1456
+ ${e.disabled?'class="disabled"':""}
1457
+ >
1458
+ <span class="option-text">${e.label}</span>
1459
+ ${this._selectedValue===e.value?'<span class="check-mark" aria-hidden="true">&#10003;</span>':""}
1460
+ </li>
1461
+ `).join(""),this._listboxElement.querySelectorAll('[role="option"]').forEach(e=>{e.addEventListener("click",this.handleOptionClick),e.addEventListener("mouseenter",this.handleOptionHover)}))}openAndHighlight(e=!1){this.open=!0;const t=this._options.findIndex(i=>i.value===this._selectedValue);t>=0?this._highlightedIndex=t:this._highlightedIndex=e?this.findLastEnabled():this.findFirstEnabled(),this.updateHighlight(),o.announce(`${this._options.length} option${this._options.length===1?"":"s"} available`)}selectOption(e){this._selectedValue=e.value,this.updateTriggerText(),this.open=!1,this._highlightedIndex=-1,this.renderOptions(),o.announce(`${e.label} selected`),this.emit("a11y-select-change",{value:e.value,label:e.label}),this.emit("change",{value:e.value,label:e.label})}updateTriggerText(){var s;const e=(s=this.shadowRoot)==null?void 0:s.querySelector(".select-value");if(!e)return;const t=this._options.find(a=>a.value===this._selectedValue),i=this.getAttribute("placeholder")||"Select an option...";t?(e.textContent=t.label,e.classList.remove("placeholder")):(e.textContent=i,e.classList.add("placeholder"))}highlightNext(){const e=this.findNextEnabled(this._highlightedIndex,1);e>=0&&(this._highlightedIndex=e,this.updateHighlight())}highlightPrevious(){const e=this.findNextEnabled(this._highlightedIndex,-1);e>=0&&(this._highlightedIndex=e,this.updateHighlight())}findNextEnabled(e,t){var r;const i=this._options.length;let s=e+t;s<0&&(s=i-1),s>=i&&(s=0);const a=s;for(;(r=this._options[s])!=null&&r.disabled;)if(s+=t,s<0&&(s=i-1),s>=i&&(s=0),s===a)return-1;return s}findFirstEnabled(){return this._options.findIndex(e=>!e.disabled)}findLastEnabled(){var e;for(let t=this._options.length-1;t>=0;t--)if(!((e=this._options[t])!=null&&e.disabled))return t;return-1}updateHighlight(){var e,t,i,s;if((e=this._listboxElement)==null||e.querySelectorAll('[role="option"]').forEach((a,r)=>{a.classList.toggle("highlighted",r===this._highlightedIndex)}),this._highlightedIndex>=0){const a=`${this._id}-option-${this._highlightedIndex}`;(t=this._triggerElement)==null||t.setAttribute("aria-activedescendant",a);const r=(i=this._listboxElement)==null?void 0:i.querySelector(`#${a}`);r==null||r.scrollIntoView({block:"nearest",behavior:"smooth"})}else(s=this._triggerElement)==null||s.removeAttribute("aria-activedescendant")}updateListboxVisibility(){!this._listboxElement||!this._triggerElement||(this._open?(this._listboxElement.hidden=!1,this._triggerElement.setAttribute("aria-expanded","true"),this.updateListboxPosition(),this.emit("a11y-select-open")):(this._listboxElement.hidden=!0,this._triggerElement.setAttribute("aria-expanded","false"),this._highlightedIndex=-1,this.updateHighlight(),this._listboxElement.style.top="",this._listboxElement.style.bottom="",this.removeAttribute("data-position"),this.emit("a11y-select-close")))}updateListboxPosition(){if(!this._listboxElement||!this._triggerElement)return;const e=this._triggerElement.getBoundingClientRect(),t=window.innerHeight,i=Math.min(this._listboxElement.scrollHeight,200),s=t-e.bottom,a=e.top;s<i+8&&a>s?(this._listboxElement.style.top="auto",this._listboxElement.style.bottom="100%",this._listboxElement.style.marginTop="0",this._listboxElement.style.marginBottom="4px",this.setAttribute("data-position","top")):(this._listboxElement.style.top="100%",this._listboxElement.style.bottom="auto",this._listboxElement.style.marginTop="4px",this._listboxElement.style.marginBottom="0",this.setAttribute("data-position","bottom"))}show(){this.open=!0}close(){this.open=!1}}b("a11y-select",R);class B extends u{constructor(){super(...arguments),this._value="",this._inputEl=null,this._labelEl=null,this._hintEl=null,this._errorEl=null,this.handleInput=e=>{const t=e.target;this._value=t.value,this.emit("input",{value:this._value})},this.handleChange=e=>{const t=e.target;this._value=t.value,this.emit("change",{value:this._value})},this.handleFocus=()=>{this.emit("a11y-input-focus")},this.handleBlur=()=>{this.emit("a11y-input-blur")}}static get observedAttributes(){return["label","hint","error","type","placeholder","value","disabled","readonly","required","name","autocomplete","maxlength","minlength","pattern","inputmode","aria-label","aria-labelledby"]}get value(){return this._value}set value(e){const t=this._value;this._value=e,this._inputEl&&this._inputEl.value!==e&&(this._inputEl.value=e),e!==t&&this.setAttribute("value",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e)}get readOnly(){return this.hasAttribute("readonly")}set readOnly(e){this.toggleAttribute("readonly",e)}get required(){return this.hasAttribute("required")}set required(e){this.toggleAttribute("required",e)}get error(){return this.getAttribute("error")||""}set error(e){e?this.setAttribute("error",e):this.removeAttribute("error")}setupAccessibility(){var e;typeof process<"u"&&((e=process.env)==null?void 0:e.NODE_ENV)!=="production"&&(this.hasAttribute("label")||this.hasAttribute("aria-label")||this.hasAttribute("aria-labelledby")||console.warn(`[compa11y/Input] Input has no accessible label. Add label="...", aria-label="...", or aria-labelledby="..." attribute.
1462
+ 💡 Suggestion: <a11y-input label="Full Name"></a11y-input>`))}render(){const e=this.attachShadow({mode:"open"}),t=`${this._id}-field`,i=`${this._id}-label`,s=`${this._id}-hint`,a=`${this._id}-error`,r=this.getAttribute("label")||"",h=this.getAttribute("hint")||"",n=this.getAttribute("error")||"",g=this.getAttribute("type")||"text",c=this.getAttribute("placeholder")||"",m=this.getAttribute("name")||"",f=this.getAttribute("autocomplete")||"",v=this.getAttribute("maxlength"),y=this.getAttribute("minlength"),k=this.getAttribute("pattern"),w=this.getAttribute("inputmode"),S=this.getAttribute("aria-label")||"",I=this.getAttribute("aria-labelledby")||"",C=this.disabled,x=this.readOnly,_=this.required,A=!!n,E=[];h&&E.push(s),A&&E.push(a);const Y=E.length?`aria-describedby="${E.join(" ")}"`:"",$=!r&&S?`aria-label="${S}"`:"",pe=!r&&I?`aria-labelledby="${I}"`:r?`aria-labelledby="${i}"`:"";this.setAttribute("data-error",A?"true":"false"),e.innerHTML=`
1463
+ <style>${ie}</style>
1464
+ <div class="input-wrapper" part="wrapper">
1465
+ ${r?`<label id="${i}" for="${t}" class="input-label" part="label">
1466
+ ${r}${_?'<span class="input-required" aria-hidden="true" part="required">*</span>':""}
1467
+ </label>`:""}
1468
+ <input
1469
+ id="${t}"
1470
+ type="${g}"
1471
+ value="${this._value}"
1472
+ ${c?`placeholder="${c}"`:""}
1473
+ ${m?`name="${m}"`:""}
1474
+ ${f?`autocomplete="${f}"`:""}
1475
+ ${v?`maxlength="${v}"`:""}
1476
+ ${y?`minlength="${y}"`:""}
1477
+ ${k?`pattern="${k}"`:""}
1478
+ ${w?`inputmode="${w}"`:""}
1479
+ ${$}
1480
+ ${pe}
1481
+ ${Y}
1482
+ ${A?'aria-invalid="true"':""}
1483
+ ${_?'aria-required="true"':""}
1484
+ ${C?"disabled":""}
1485
+ ${x?"readonly":""}
1486
+ part="field"
1487
+ />
1488
+ ${h?`<div id="${s}" class="input-hint" part="hint">${h}</div>`:""}
1489
+ ${A?`<div id="${a}" class="input-error" role="alert" part="error">${n}</div>`:""}
1490
+ </div>
1491
+ `,this._inputEl=e.querySelector("input"),this._labelEl=e.querySelector("label"),this._hintEl=e.querySelector(".input-hint"),this._errorEl=e.querySelector(".input-error");const G=this.getAttribute("value");G&&this._inputEl&&(this._value=G,this._inputEl.value=G)}setupEventListeners(){var e,t,i,s;(e=this._inputEl)==null||e.addEventListener("input",this.handleInput),(t=this._inputEl)==null||t.addEventListener("change",this.handleChange),(i=this._inputEl)==null||i.addEventListener("focus",this.handleFocus),(s=this._inputEl)==null||s.addEventListener("blur",this.handleBlur)}cleanupEventListeners(){var e,t,i,s;(e=this._inputEl)==null||e.removeEventListener("input",this.handleInput),(t=this._inputEl)==null||t.removeEventListener("change",this.handleChange),(i=this._inputEl)==null||i.removeEventListener("focus",this.handleFocus),(s=this._inputEl)==null||s.removeEventListener("blur",this.handleBlur)}onAttributeChange(e,t,i){switch(e){case"value":this._value=i||"",this._inputEl&&this._inputEl.value!==this._value&&(this._inputEl.value=this._value);break;case"error":this.updateError(i||"");break;case"hint":this.updateHint(i||"");break;case"disabled":this._inputEl&&(i!==null?this._inputEl.setAttribute("disabled",""):this._inputEl.removeAttribute("disabled"));break;case"readonly":this._inputEl&&(i!==null?this._inputEl.setAttribute("readonly",""):this._inputEl.removeAttribute("readonly"));break;case"required":this._inputEl&&(i!==null?this._inputEl.setAttribute("aria-required","true"):this._inputEl.removeAttribute("aria-required")),this.updateRequiredIndicator(i!==null);break;case"placeholder":this._inputEl&&(i?this._inputEl.setAttribute("placeholder",i):this._inputEl.removeAttribute("placeholder"));break;case"type":this._inputEl&&(this._inputEl.type=i||"text");break;case"name":this._inputEl&&(i?this._inputEl.setAttribute("name",i):this._inputEl.removeAttribute("name"));break;case"autocomplete":this._inputEl&&(i?this._inputEl.setAttribute("autocomplete",i):this._inputEl.removeAttribute("autocomplete"));break;case"maxlength":this._inputEl&&(i?this._inputEl.setAttribute("maxlength",i):this._inputEl.removeAttribute("maxlength"));break;case"minlength":this._inputEl&&(i?this._inputEl.setAttribute("minlength",i):this._inputEl.removeAttribute("minlength"));break;case"pattern":this._inputEl&&(i?this._inputEl.setAttribute("pattern",i):this._inputEl.removeAttribute("pattern"));break;case"inputmode":this._inputEl&&(i?this._inputEl.setAttribute("inputmode",i):this._inputEl.removeAttribute("inputmode"));break;case"label":case"aria-label":case"aria-labelledby":this.shadowRoot&&(this.cleanupEventListeners(),this.shadowRoot.innerHTML="",this.render(),this.setupEventListeners());break}}updateError(e){var i;const t=!!e;if(this.setAttribute("data-error",t?"true":"false"),this._inputEl&&(t?this._inputEl.setAttribute("aria-invalid","true"):this._inputEl.removeAttribute("aria-invalid")),t){if(this._errorEl)this._errorEl.textContent=e;else{const s=`${this._id}-error`,a=document.createElement("div");a.id=s,a.className="input-error",a.setAttribute("role","alert"),a.setAttribute("part","error"),a.textContent=e;const r=(i=this.shadowRoot)==null?void 0:i.querySelector(".input-wrapper");r==null||r.appendChild(a),this._errorEl=a,o.announceAssertive(e)}this.updateAriaDescribedBy()}else this._errorEl&&(this._errorEl.remove(),this._errorEl=null),this.updateAriaDescribedBy()}updateHint(e){var t;if(e)if(this._hintEl)this._hintEl.textContent=e;else{const i=`${this._id}-hint`,s=document.createElement("div");s.id=i,s.className="input-hint",s.setAttribute("part","hint"),s.textContent=e;const a=(t=this.shadowRoot)==null?void 0:t.querySelector(".input-wrapper");this._errorEl?a==null||a.insertBefore(s,this._errorEl):a==null||a.appendChild(s),this._hintEl=s}else this._hintEl&&(this._hintEl.remove(),this._hintEl=null);this.updateAriaDescribedBy()}updateAriaDescribedBy(){if(!this._inputEl)return;const e=[];this._hintEl&&e.push(this._hintEl.id),this._errorEl&&e.push(this._errorEl.id),e.length>0?this._inputEl.setAttribute("aria-describedby",e.join(" ")):this._inputEl.removeAttribute("aria-describedby")}updateRequiredIndicator(e){if(!this._labelEl)return;const t=this._labelEl.querySelector(".input-required");if(e&&!t){const i=document.createElement("span");i.className="input-required",i.setAttribute("aria-hidden","true"),i.setAttribute("part","required"),i.textContent="*",this._labelEl.appendChild(i)}else!e&&t&&t.remove()}focus(){var e;(e=this._inputEl)==null||e.focus()}blur(){var e;(e=this._inputEl)==null||e.blur()}select(){var e;(e=this._inputEl)==null||e.select()}}b("a11y-input",B);class H extends u{constructor(){super(...arguments),this._value="",this._textareaEl=null,this._labelEl=null,this._hintEl=null,this._errorEl=null,this.handleInput=e=>{const t=e.target;this._value=t.value,this.emit("input",{value:this._value})},this.handleChange=e=>{const t=e.target;this._value=t.value,this.emit("change",{value:this._value})},this.handleFocus=()=>{this.emit("a11y-textarea-focus")},this.handleBlur=()=>{this.emit("a11y-textarea-blur")}}static get observedAttributes(){return["label","hint","error","rows","resize","placeholder","value","disabled","readonly","required","name","autocomplete","maxlength","minlength","aria-label","aria-labelledby"]}get value(){return this._value}set value(e){const t=this._value;this._value=e,this._textareaEl&&this._textareaEl.value!==e&&(this._textareaEl.value=e),e!==t&&this.setAttribute("value",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e)}get readOnly(){return this.hasAttribute("readonly")}set readOnly(e){this.toggleAttribute("readonly",e)}get required(){return this.hasAttribute("required")}set required(e){this.toggleAttribute("required",e)}get error(){return this.getAttribute("error")||""}set error(e){e?this.setAttribute("error",e):this.removeAttribute("error")}setupAccessibility(){var e;typeof process<"u"&&((e=process.env)==null?void 0:e.NODE_ENV)!=="production"&&(this.hasAttribute("label")||this.hasAttribute("aria-label")||this.hasAttribute("aria-labelledby")||console.warn(`[compa11y/Textarea] Textarea has no accessible label. Add label="...", aria-label="...", or aria-labelledby="..." attribute.
1492
+ 💡 Suggestion: <a11y-textarea label="Description"></a11y-textarea>`))}render(){const e=this.attachShadow({mode:"open"}),t=`${this._id}-field`,i=`${this._id}-label`,s=`${this._id}-hint`,a=`${this._id}-error`,r=this.getAttribute("label")||"",h=this.getAttribute("hint")||"",n=this.getAttribute("error")||"",g=this.getAttribute("rows")||"3",c=this.getAttribute("placeholder")||"",m=this.getAttribute("name")||"",f=this.getAttribute("autocomplete")||"",v=this.getAttribute("maxlength"),y=this.getAttribute("minlength"),k=this.getAttribute("aria-label")||"",w=this.getAttribute("aria-labelledby")||"",S=this.disabled,I=this.readOnly,C=this.required,x=!!n,_=[];h&&_.push(s),x&&_.push(a);const A=_.length?`aria-describedby="${_.join(" ")}"`:"",E=!r&&k?`aria-label="${k}"`:"",Y=!r&&w?`aria-labelledby="${w}"`:r?`aria-labelledby="${i}"`:"";this.setAttribute("data-error",x?"true":"false"),e.innerHTML=`
1493
+ <style>${se}</style>
1494
+ <div class="textarea-wrapper" part="wrapper">
1495
+ ${r?`<label id="${i}" for="${t}" class="textarea-label" part="label">
1496
+ ${r}${C?'<span class="textarea-required" aria-hidden="true" part="required">*</span>':""}
1497
+ </label>`:""}
1498
+ <textarea
1499
+ id="${t}"
1500
+ rows="${g}"
1501
+ ${c?`placeholder="${c}"`:""}
1502
+ ${m?`name="${m}"`:""}
1503
+ ${f?`autocomplete="${f}"`:""}
1504
+ ${v?`maxlength="${v}"`:""}
1505
+ ${y?`minlength="${y}"`:""}
1506
+ ${E}
1507
+ ${Y}
1508
+ ${A}
1509
+ ${x?'aria-invalid="true"':""}
1510
+ ${C?'aria-required="true"':""}
1511
+ ${S?"disabled":""}
1512
+ ${I?"readonly":""}
1513
+ part="field"
1514
+ >${this._value}</textarea>
1515
+ ${h?`<div id="${s}" class="textarea-hint" part="hint">${h}</div>`:""}
1516
+ ${x?`<div id="${a}" class="textarea-error" role="alert" part="error">${n}</div>`:""}
1517
+ </div>
1518
+ `,this._textareaEl=e.querySelector("textarea"),this._labelEl=e.querySelector("label"),this._hintEl=e.querySelector(".textarea-hint"),this._errorEl=e.querySelector(".textarea-error");const $=this.getAttribute("value");$&&this._textareaEl&&(this._value=$,this._textareaEl.value=$)}setupEventListeners(){var e,t,i,s;(e=this._textareaEl)==null||e.addEventListener("input",this.handleInput),(t=this._textareaEl)==null||t.addEventListener("change",this.handleChange),(i=this._textareaEl)==null||i.addEventListener("focus",this.handleFocus),(s=this._textareaEl)==null||s.addEventListener("blur",this.handleBlur)}cleanupEventListeners(){var e,t,i,s;(e=this._textareaEl)==null||e.removeEventListener("input",this.handleInput),(t=this._textareaEl)==null||t.removeEventListener("change",this.handleChange),(i=this._textareaEl)==null||i.removeEventListener("focus",this.handleFocus),(s=this._textareaEl)==null||s.removeEventListener("blur",this.handleBlur)}onAttributeChange(e,t,i){switch(e){case"value":this._value=i||"",this._textareaEl&&this._textareaEl.value!==this._value&&(this._textareaEl.value=this._value);break;case"error":this.updateError(i||"");break;case"hint":this.updateHint(i||"");break;case"disabled":this._textareaEl&&(i!==null?this._textareaEl.setAttribute("disabled",""):this._textareaEl.removeAttribute("disabled"));break;case"readonly":this._textareaEl&&(i!==null?this._textareaEl.setAttribute("readonly",""):this._textareaEl.removeAttribute("readonly"));break;case"required":this._textareaEl&&(i!==null?this._textareaEl.setAttribute("aria-required","true"):this._textareaEl.removeAttribute("aria-required")),this.updateRequiredIndicator(i!==null);break;case"placeholder":this._textareaEl&&(i?this._textareaEl.setAttribute("placeholder",i):this._textareaEl.removeAttribute("placeholder"));break;case"rows":this._textareaEl&&(this._textareaEl.rows=parseInt(i||"3",10));break;case"name":this._textareaEl&&(i?this._textareaEl.setAttribute("name",i):this._textareaEl.removeAttribute("name"));break;case"autocomplete":this._textareaEl&&(i?this._textareaEl.setAttribute("autocomplete",i):this._textareaEl.removeAttribute("autocomplete"));break;case"maxlength":this._textareaEl&&(i?this._textareaEl.setAttribute("maxlength",i):this._textareaEl.removeAttribute("maxlength"));break;case"minlength":this._textareaEl&&(i?this._textareaEl.setAttribute("minlength",i):this._textareaEl.removeAttribute("minlength"));break;case"resize":this._textareaEl&&(this._textareaEl.style.resize=i||"vertical");break;case"label":case"aria-label":case"aria-labelledby":this.shadowRoot&&(this.cleanupEventListeners(),this.shadowRoot.innerHTML="",this.render(),this.setupEventListeners());break}}updateError(e){var i;const t=!!e;if(this.setAttribute("data-error",t?"true":"false"),this._textareaEl&&(t?this._textareaEl.setAttribute("aria-invalid","true"):this._textareaEl.removeAttribute("aria-invalid")),t){if(this._errorEl)this._errorEl.textContent=e;else{const s=`${this._id}-error`,a=document.createElement("div");a.id=s,a.className="textarea-error",a.setAttribute("role","alert"),a.setAttribute("part","error"),a.textContent=e;const r=(i=this.shadowRoot)==null?void 0:i.querySelector(".textarea-wrapper");r==null||r.appendChild(a),this._errorEl=a,o.announceAssertive(e)}this.updateAriaDescribedBy()}else this._errorEl&&(this._errorEl.remove(),this._errorEl=null),this.updateAriaDescribedBy()}updateHint(e){var t;if(e)if(this._hintEl)this._hintEl.textContent=e;else{const i=`${this._id}-hint`,s=document.createElement("div");s.id=i,s.className="textarea-hint",s.setAttribute("part","hint"),s.textContent=e;const a=(t=this.shadowRoot)==null?void 0:t.querySelector(".textarea-wrapper");this._errorEl?a==null||a.insertBefore(s,this._errorEl):a==null||a.appendChild(s),this._hintEl=s}else this._hintEl&&(this._hintEl.remove(),this._hintEl=null);this.updateAriaDescribedBy()}updateAriaDescribedBy(){if(!this._textareaEl)return;const e=[];this._hintEl&&e.push(this._hintEl.id),this._errorEl&&e.push(this._errorEl.id),e.length>0?this._textareaEl.setAttribute("aria-describedby",e.join(" ")):this._textareaEl.removeAttribute("aria-describedby")}updateRequiredIndicator(e){if(!this._labelEl)return;const t=this._labelEl.querySelector(".textarea-required");if(e&&!t){const i=document.createElement("span");i.className="textarea-required",i.setAttribute("aria-hidden","true"),i.setAttribute("part","required"),i.textContent="*",this._labelEl.appendChild(i)}else!e&&t&&t.remove()}focus(){var e;(e=this._textareaEl)==null||e.focus()}blur(){var e;(e=this._textareaEl)==null||e.blur()}select(){var e;(e=this._textareaEl)==null||e.select()}}b("a11y-textarea",H);class P extends u{constructor(){super(...arguments),this._buttonEl=null,this.handleClick=e=>{if(this.disabled||this.loading){e.preventDefault(),e.stopPropagation();return}this.emit("a11y-button-click")}}static get observedAttributes(){return["variant","size","disabled","discoverable","loading","type","aria-label"]}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e)}get discoverable(){return this.hasAttribute("discoverable")}set discoverable(e){this.toggleAttribute("discoverable",e)}get loading(){return this.hasAttribute("loading")}set loading(e){this.toggleAttribute("loading",e)}get variant(){return this.getAttribute("variant")||"secondary"}set variant(e){this.setAttribute("variant",e)}get size(){return this.getAttribute("size")||"md"}set size(e){this.setAttribute("size",e)}setupAccessibility(){var e,t;typeof process<"u"&&((e=process.env)==null?void 0:e.NODE_ENV)!=="production"&&((t=this.textContent)!=null&&t.trim()||this.hasAttribute("aria-label")||this.hasAttribute("aria-labelledby")||console.warn(`[compa11y/Button] Button has no accessible label. Add text content, aria-label="...", or aria-labelledby="..." attribute.
1519
+ 💡 Suggestion: <a11y-button>Click me</a11y-button>`))}render(){const e=this.attachShadow({mode:"open"}),t=this.variant,i=this.size,s=this.getAttribute("type")||"button",a=this.getAttribute("aria-label")||"",r=this.disabled,h=this.discoverable,n=this.loading,g=r||n,c=r&&!h;e.innerHTML=`
1520
+ <style>${ae}</style>
1521
+ <button
1522
+ class="variant-${t} size-${i}"
1523
+ type="${s}"
1524
+ ${c?"disabled":""}
1525
+ ${g?'aria-disabled="true"':""}
1526
+ ${n?'aria-busy="true"':""}
1527
+ ${a?`aria-label="${a}"`:""}
1528
+ part="button"
1529
+ >${n?'<span class="button-spinner" aria-hidden="true" part="spinner"></span>':""}<slot></slot></button>
1530
+ `,this._buttonEl=e.querySelector("button")}setupEventListeners(){var e;(e=this._buttonEl)==null||e.addEventListener("click",this.handleClick)}cleanupEventListeners(){var e;(e=this._buttonEl)==null||e.removeEventListener("click",this.handleClick)}onAttributeChange(e,t,i){switch(e){case"variant":{if(!this._buttonEl)break;const a=this._buttonEl.className.split(" ").filter(r=>!r.startsWith("variant-"));a.push(`variant-${i||"secondary"}`),this._buttonEl.className=a.join(" ");break}case"size":{if(!this._buttonEl)break;const a=this._buttonEl.className.split(" ").filter(r=>!r.startsWith("size-"));a.push(`size-${i||"md"}`),this._buttonEl.className=a.join(" ");break}case"disabled":case"discoverable":this.updateDisabledState();break;case"loading":this.updateLoadingState();break;case"type":this._buttonEl&&(this._buttonEl.type=i||"button");break;case"aria-label":this._buttonEl&&(i?this._buttonEl.setAttribute("aria-label",i):this._buttonEl.removeAttribute("aria-label"));break}}updateDisabledState(){if(!this._buttonEl)return;const e=this.disabled,t=this.discoverable,i=this.loading,s=e&&!t,a=e||i;s?this._buttonEl.setAttribute("disabled",""):this._buttonEl.removeAttribute("disabled"),a?this._buttonEl.setAttribute("aria-disabled","true"):this._buttonEl.removeAttribute("aria-disabled")}updateLoadingState(){if(!this._buttonEl)return;if(this.loading){if(this._buttonEl.setAttribute("aria-busy","true"),this._buttonEl.setAttribute("aria-disabled","true"),!this._buttonEl.querySelector(".button-spinner")){const t=document.createElement("span");t.className="button-spinner",t.setAttribute("aria-hidden","true"),t.setAttribute("part","spinner"),this._buttonEl.insertBefore(t,this._buttonEl.firstChild)}}else{this._buttonEl.removeAttribute("aria-busy");const t=this._buttonEl.querySelector(".button-spinner");t==null||t.remove(),this.updateDisabledState()}}focus(){var e;(e=this._buttonEl)==null||e.focus()}blur(){var e;(e=this._buttonEl)==null||e.blur()}click(){var e;(e=this._buttonEl)==null||e.click()}}b("a11y-button",P);class M extends u{constructor(){super(...arguments),this._label="",this._disabled=!1}static get observedAttributes(){return["label","disabled"]}get label(){return this._label}set label(e){this._label=e,this.setAttribute("label",e),this.updateLabel()}get disabled(){return this._disabled}set disabled(e){const t=!!e;this._disabled!==t&&(this._disabled=t,t?(this.setAttribute("disabled",""),this.setAttribute("aria-disabled","true")):(this.removeAttribute("disabled"),this.removeAttribute("aria-disabled")))}setupAccessibility(){this.setAttribute("role","group"),this._label=this.getAttribute("label")||"",this._disabled=this.hasAttribute("disabled"),this._disabled&&this.setAttribute("aria-disabled","true")}render(){this.shadowRoot||this.attachShadow({mode:"open"});const e=`${this._id}-label`;this.shadowRoot.innerHTML=`
1531
+ <style>${le}</style>
1532
+ <div class="optgroup-wrapper" part="group">
1533
+ <div class="optgroup-label" part="label" id="${e}" role="presentation">
1534
+ ${this._label}
1535
+ </div>
1536
+ <div class="optgroup-options" part="options" role="none">
1537
+ <slot></slot>
1538
+ </div>
1539
+ </div>
1540
+ `,this.setAttribute("aria-labelledby",e)}setupEventListeners(){}cleanupEventListeners(){}updateLabel(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".optgroup-label");e&&(e.textContent=this._label)}attributeChangedCallback(e,t,i){if(t!==i)switch(e){case"label":this._label=i||"",this.updateLabel();break;case"disabled":this._disabled=i!==null,this._disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled");break}}}class F extends u{constructor(){super(...arguments),this._value="",this._disabled=!1,this._selected=!1,this._discoverable=!0,this.handleClick=e=>{if(this.effectivelyDisabled){e.preventDefault();return}this.dispatchEvent(new CustomEvent("option-select",{detail:{value:this._value},bubbles:!0,composed:!0}))}}static get observedAttributes(){return["value","disabled","discoverable"]}get value(){return this._value}set value(e){this._value=e,this.setAttribute("value",e)}get disabled(){return this._disabled}set disabled(e){const t=!!e;this._disabled!==t&&(this._disabled=t,t?(this.setAttribute("disabled",""),this.setAttribute("aria-disabled","true")):(this.removeAttribute("disabled"),this.removeAttribute("aria-disabled")))}get selected(){return this._selected}set selected(e){const t=!!e;this._selected!==t&&(this._selected=t,this.setAttribute("aria-selected",String(t)))}get discoverable(){return this._discoverable}set discoverable(e){this._discoverable=!!e}get effectivelyDisabled(){if(this._disabled)return!0;const e=this.closest("a11y-optgroup");return(e==null?void 0:e.disabled)??!1}setupAccessibility(){this.setAttribute("role","option"),this.setAttribute("aria-selected","false"),this._value=this.getAttribute("value")||"",this._disabled=this.hasAttribute("disabled"),this._disabled&&this.setAttribute("aria-disabled","true");const e=this.getAttribute("discoverable");(e==="false"||e==="0")&&(this._discoverable=!1)}render(){this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
1541
+ <style>${oe}</style>
1542
+ <div class="option-wrapper" part="option">
1543
+ <span class="option-content" part="content"><slot></slot></span>
1544
+ <span class="check-mark" part="check" aria-hidden="true">&#10003;</span>
1545
+ </div>
1546
+ `}setupEventListeners(){this.addEventListener("click",this.handleClick)}cleanupEventListeners(){this.removeEventListener("click",this.handleClick)}attributeChangedCallback(e,t,i){if(t!==i)switch(e){case"value":this._value=i||"";break;case"disabled":this._disabled=i!==null,this._disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled");break;case"discoverable":i===null?this._discoverable=!0:i==="false"||i==="0"?this._discoverable=!1:this._discoverable=!0;break}}}class K extends u{constructor(){super(...arguments),this._value=null,this._values=new Set,this._multiple=!1,this._disabled=!1,this._discoverable=!0,this._orientation="vertical",this._focusedIndex=-1,this._typeAhead=null,this.handleFocus=()=>{if(this._focusedIndex>=0)return;const e=this.getAllOptions();if(!this._multiple&&this._value){const t=e.findIndex(i=>i.value===this._value);if(t>=0){this._focusedIndex=t,this.updateFocusHighlight();return}}else if(this._multiple&&this._values.size>0){const t=e.findIndex(i=>this._values.has(i.value));if(t>=0){this._focusedIndex=t,this.updateFocusHighlight();return}}this._focusedIndex=this.findFirstEnabled(),this.updateFocusHighlight()},this.handleOptionSelect=e=>{var r;if(this._disabled)return;const t=(r=e.detail)==null?void 0:r.value;if(t===void 0)return;const i=this.getAllOptions(),s=i.find(h=>h.value===t);if(!s)return;const a=i.indexOf(s);this._focusedIndex=a,this.updateFocusHighlight(),this.selectOption(s),this.focus()},this.handleKeyDown=e=>{var a,r,h;if(this._disabled&&!this._discoverable)return;const t=this.getAllOptions();if(t.length===0)return;let i=null,s=!1;if(this._multiple)switch(e.key){case"ArrowDown":e.shiftKey?(i=this.findNextEnabled(this._focusedIndex,1),i>=0&&this.toggleOptionSelection(t[i])):i=this.findNextEnabled(this._focusedIndex,1),s=!0;break;case"ArrowUp":e.shiftKey?(i=this.findNextEnabled(this._focusedIndex,-1),i>=0&&this.toggleOptionSelection(t[i])):i=this.findNextEnabled(this._focusedIndex,-1),s=!0;break;case" ":this._focusedIndex>=0&&t[this._focusedIndex]!=null&&this.toggleOptionSelection(t[this._focusedIndex]),s=!0;break;case"Home":e.ctrlKey&&e.shiftKey?(this.selectRange(this.findFirstEnabled(),this._focusedIndex),i=this.findFirstEnabled()):i=this.findFirstEnabled(),s=!0;break;case"End":e.ctrlKey&&e.shiftKey?(this.selectRange(this._focusedIndex,this.findLastEnabled()),i=this.findLastEnabled()):i=this.findLastEnabled(),s=!0;break;case"a":(e.ctrlKey||e.metaKey)&&(this.toggleSelectAll(),s=!0);break;default:if(e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey){const n=(a=this._typeAhead)==null?void 0:a.type(e.key);if(n){const g=t.findIndex(c=>{var m;return(((m=c.textContent)==null?void 0:m.trim())||"")===n&&!c.effectivelyDisabled});g>=0&&(i=g,s=!0)}}break}else switch(e.key){case"ArrowDown":i=this.findNextEnabled(this._focusedIndex,1),s=!0;break;case"ArrowUp":i=this.findNextEnabled(this._focusedIndex,-1),s=!0;break;case"Home":i=this.findFirstEnabled(),s=!0;break;case"End":i=this.findLastEnabled(),s=!0;break;default:if(e.key.length===1&&!e.ctrlKey&&!e.altKey&&!e.metaKey){const n=(r=this._typeAhead)==null?void 0:r.type(e.key);if(n){const g=t.findIndex(c=>{var m;return(((m=c.textContent)==null?void 0:m.trim())||"")===n&&!c.effectivelyDisabled});g>=0&&(i=g,s=!0)}}break}if(s&&(e.preventDefault(),e.stopPropagation()),i!==null&&i>=0){this._focusedIndex=i,this.updateFocusHighlight();const n=t[i];if(!this._multiple&&n)this.selectSingle(n);else if(n){const g=((h=n.textContent)==null?void 0:h.trim())||n.value,c=this._values.has(n.value);o.announcePolite(`${g}${c?", selected":""}`)}}}}static get observedAttributes(){return["value","multiple","disabled","discoverable","orientation","aria-label","aria-labelledby"]}get value(){return this._multiple?Array.from(this._values):this._value||""}set value(e){if(this._multiple){const t=Array.isArray(e)?e:String(e).split(",").filter(Boolean);this._values=new Set(t),this.setAttribute("value",t.join(","))}else{const t=Array.isArray(e)?e[0]||"":String(e);this._value=t,this.setAttribute("value",t)}this.syncOptionStates()}get multiple(){return this._multiple}set multiple(e){const t=!!e;this._multiple!==t&&(this._multiple=t,t?(this.setAttribute("multiple",""),this.setAttribute("aria-multiselectable","true")):(this.removeAttribute("multiple"),this.removeAttribute("aria-multiselectable")))}get disabled(){return this._disabled}set disabled(e){const t=!!e;this._disabled!==t&&(this._disabled=t,t?(this.setAttribute("disabled",""),this.setAttribute("aria-disabled","true")):(this.removeAttribute("disabled"),this.removeAttribute("aria-disabled")))}get discoverable(){return this._discoverable}set discoverable(e){this._discoverable=!!e}get orientation(){return this._orientation}set orientation(e){this._orientation=e,this.setAttribute("orientation",e),this.setAttribute("aria-orientation",e)}setupAccessibility(){this.setAttribute("role","listbox"),this.setAttribute("aria-orientation",this._orientation),!(this.hasAttribute("aria-label")||this.hasAttribute("aria-labelledby"))&&process.env.NODE_ENV!=="production"&&console.warn("[Compa11y Listbox]: Listbox has no accessible label. Use aria-label or aria-labelledby."),this._multiple=this.hasAttribute("multiple"),this._multiple&&this.setAttribute("aria-multiselectable","true"),this._disabled=this.hasAttribute("disabled"),this._disabled&&this.setAttribute("aria-disabled","true");const t=this.getAttribute("orientation");(t==="horizontal"||t==="vertical")&&(this._orientation=t);const i=this.getAttribute("discoverable");(i==="false"||i==="0")&&(this._discoverable=!1);const s=this.getAttribute("value");s&&(this._multiple?this._values=new Set(s.split(",").filter(Boolean)):this._value=s),this._disabled&&!this._discoverable?this.setAttribute("tabindex","-1"):this.setAttribute("tabindex","0")}render(){this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
1547
+ <style>${re}</style>
1548
+ <div class="listbox-wrapper" part="wrapper">
1549
+ <slot></slot>
1550
+ </div>
1551
+ `}setupEventListeners(){var t;this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("focus",this.handleFocus),this.addEventListener("option-select",this.handleOptionSelect);const e=(t=this.shadowRoot)==null?void 0:t.querySelector("slot");e&&e.addEventListener("slotchange",()=>{this.rebuildTypeAhead(),this.syncOptionStates()}),this.rebuildTypeAhead(),this.syncOptionStates()}cleanupEventListeners(){this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("focus",this.handleFocus),this.removeEventListener("option-select",this.handleOptionSelect)}getAllOptions(){return Array.from(this.querySelectorAll("a11y-option"))}getEnabledOptions(){return this.getAllOptions().filter(e=>!e.effectivelyDisabled)}getEnabledIndices(){const e=this.getAllOptions(),t=[];return e.forEach((i,s)=>{i.effectivelyDisabled||t.push(s)}),t}syncOptionStates(){this.getAllOptions().forEach(t=>{this._multiple?t.selected=this._values.has(t.value):t.selected=t.value===this._value})}updateFocusHighlight(){const e=this.getAllOptions();e.forEach((i,s)=>{s===this._focusedIndex?i.toggleAttribute("data-focused",!0):i.removeAttribute("data-focused")});const t=this._focusedIndex>=0?e[this._focusedIndex]:void 0;t?(this.setAttribute("aria-activedescendant",t.id),t.scrollIntoView({block:"nearest"})):this.removeAttribute("aria-activedescendant")}findNextEnabled(e,t){const i=this.getEnabledIndices();if(i.length===0)return-1;const s=i.indexOf(e);if(s===-1)return t===1?i[0]:i[i.length-1];const a=s+t;return a<0||a>=i.length?-1:i[a]}findFirstEnabled(){const e=this.getEnabledIndices();return e.length>0?e[0]:-1}findLastEnabled(){const e=this.getEnabledIndices();return e.length>0?e[e.length-1]:-1}selectOption(e){e.effectivelyDisabled||this._disabled||(this._multiple?this.toggleOptionSelection(e):this.selectSingle(e))}selectSingle(e){var i;const t=this._value;if(this._value=e.value,this.setAttribute("value",e.value),this.syncOptionStates(),t!==this._value){const s=((i=e.textContent)==null?void 0:i.trim())||e.value;this.emit("change",{value:this._value,label:s}),this.emit("a11y-listbox-change",{value:this._value,label:s}),o.announcePolite(`${s} selected`)}}toggleOptionSelection(e){var s;if(e.effectivelyDisabled||this._disabled)return;const t=((s=e.textContent)==null?void 0:s.trim())||e.value;this._values.has(e.value)?(this._values.delete(e.value),e.selected=!1,o.announcePolite(`${t} deselected`)):(this._values.add(e.value),e.selected=!0,o.announcePolite(`${t} selected`));const i=Array.from(this._values);this.setAttribute("value",i.join(",")),this.emit("change",{value:i}),this.emit("a11y-listbox-change",{value:i})}selectRange(e,t){const i=this.getAllOptions(),s=Math.min(e,t),a=Math.max(e,t);for(let h=s;h<=a;h++){const n=i[h];n&&!n.effectivelyDisabled&&(this._values.add(n.value),n.selected=!0)}const r=Array.from(this._values);this.setAttribute("value",r.join(",")),this.emit("change",{value:r}),this.emit("a11y-listbox-change",{value:r}),o.announcePolite(`${a-s+1} items selected`)}toggleSelectAll(){const e=this.getEnabledOptions();e.every(s=>this._values.has(s.value))?(this._values.clear(),this.getAllOptions().forEach(s=>s.selected=!1),o.announcePolite("All deselected")):(e.forEach(s=>{this._values.add(s.value),s.selected=!0}),o.announcePolite("All selected"));const i=Array.from(this._values);this.setAttribute("value",i.join(",")),this.emit("change",{value:i}),this.emit("a11y-listbox-change",{value:i})}rebuildTypeAhead(){const e=this.getAllOptions().map(t=>{var i;return((i=t.textContent)==null?void 0:i.trim())||""});this._typeAhead=o.createTypeAhead(e,{timeout:500})}attributeChangedCallback(e,t,i){if(t!==i)switch(e){case"value":this._multiple?this._values=new Set((i||"").split(",").filter(Boolean)):this._value=i||null,this.syncOptionStates();break;case"multiple":this._multiple=i!==null,this._multiple?(this.setAttribute("aria-multiselectable","true"),this._value&&(this._values=new Set([this._value]),this._value=null)):(this.removeAttribute("aria-multiselectable"),this._values.size>0&&(this._value=Array.from(this._values)[0]??null,this._values.clear())),this.syncOptionStates();break;case"disabled":this._disabled=i!==null,this._disabled?(this.setAttribute("aria-disabled","true"),this._discoverable||this.setAttribute("tabindex","-1")):(this.removeAttribute("aria-disabled"),this.setAttribute("tabindex","0"));break;case"discoverable":i===null?this._discoverable=!0:i==="false"||i==="0"?this._discoverable=!1:this._discoverable=!0;break;case"orientation":(i==="horizontal"||i==="vertical")&&(this._orientation=i,this.setAttribute("aria-orientation",i));break}}}b("a11y-optgroup",M),b("a11y-option",F),b("a11y-listbox",K);const ue=`<svg class="checkbox-check" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
1552
+ <path d="M2.5 6L5 8.5L9.5 3.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
1553
+ </svg>`,be=`<svg class="checkbox-dash" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true">
1554
+ <path d="M3 6H9" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
1555
+ </svg>`;class L extends u{constructor(){super(...arguments),this._checked=!1,this._indeterminate=!1,this._input=null,this.handleChange=()=>{if(!this._input)return;this._checked=this._input.checked,this.toggleAttribute("checked",this._checked),this._indeterminate&&(this._indeterminate=!1,this.removeAttribute("indeterminate"),this._input.indeterminate=!1),this.updateVisualState(),this.emit("change",{checked:this._checked,value:this.value});const e=this.label||this.getAttribute("aria-label")||"Checkbox";o.announcePolite(`${e} ${this._checked?"checked":"unchecked"}`)}}static get observedAttributes(){return["checked","indeterminate","disabled","label","hint","error","value","name","required","size","aria-label","aria-describedby"]}get checked(){return this._checked}set checked(e){const t=this._checked;this._checked=e,this.toggleAttribute("checked",e),e!==t&&(this.updateVisualState(),this.emit("change",{checked:e,value:this.value}))}get indeterminate(){return this._indeterminate}set indeterminate(e){const t=this._indeterminate;this._indeterminate=e,this.toggleAttribute("indeterminate",e),e!==t&&this.updateVisualState()}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e),this.updateDisabledState()}get value(){return this.getAttribute("value")||""}set value(e){e?this.setAttribute("value",e):this.removeAttribute("value")}get label(){return this.getAttribute("label")||""}set label(e){e?this.setAttribute("label",e):this.removeAttribute("label")}get hint(){return this.getAttribute("hint")||""}set hint(e){e?this.setAttribute("hint",e):this.removeAttribute("hint")}get error(){return this.getAttribute("error")||""}set error(e){e?this.setAttribute("error",e):this.removeAttribute("error")}get size(){const e=this.getAttribute("size");return e==="sm"||e==="lg"?e:"md"}set size(e){this.setAttribute("size",e)}get required(){return this.hasAttribute("required")}set required(e){this.toggleAttribute("required",e)}setupAccessibility(){var e;this._checked=this.hasAttribute("checked"),this._indeterminate=this.hasAttribute("indeterminate"),typeof process<"u"&&((e=process.env)==null?void 0:e.NODE_ENV)!=="production"&&!this.label&&!this.getAttribute("aria-label")&&console.warn(`[compa11y/Checkbox] Checkbox has no accessible label. Add label="..." or aria-label="..." attribute.
1556
+ 💡 Suggestion: <a11y-checkbox label="Accept terms"></a11y-checkbox>`)}render(){const e=this.attachShadow({mode:"open"}),t=`${this._id}-input`,i=`${this._id}-label`,s=`${this._id}-hint`,a=`${this._id}-error`,r=!!this.label,h=!!this.hint,n=!!this.error,g=this.getAttribute("aria-label"),c=this.getAttribute("name")||"",m=this.getAttribute("aria-describedby")||"",f=[];m&&f.push(m),h&&f.push(s),n&&f.push(a);const v=f.length?`aria-describedby="${f.join(" ")}"`:"",y=!r&&g?`aria-label="${g}"`:"";e.innerHTML=`
1557
+ <style>${ne}</style>
1558
+ <div class="checkbox-wrapper size-${this.size}" part="wrapper">
1559
+ <div class="checkbox-control">
1560
+ <input
1561
+ type="checkbox"
1562
+ class="checkbox-input"
1563
+ id="${t}"
1564
+ ${c?`name="${c}"`:""}
1565
+ ${this.value?`value="${this.value}"`:""}
1566
+ ${this._checked?"checked":""}
1567
+ ${this.disabled?"disabled":""}
1568
+ ${this.required?'required aria-required="true"':""}
1569
+ ${v}
1570
+ ${y}
1571
+ ${n?'aria-invalid="true"':""}
1572
+ part="input"
1573
+ />
1574
+ <div class="checkbox-indicator" part="indicator" aria-hidden="true">
1575
+ ${ue}
1576
+ ${be}
1577
+ </div>
1578
+ </div>
1579
+ ${r||h||n?`<div class="checkbox-content">
1580
+ ${r?`<label for="${t}" id="${i}" class="checkbox-label" part="label">${this.label}${this.required?'<span class="checkbox-required" aria-hidden="true">*</span>':""}</label>`:""}
1581
+ ${h?`<div id="${s}" class="checkbox-hint" part="hint">${this.hint}</div>`:""}
1582
+ ${n?`<div id="${a}" class="checkbox-error" role="alert" part="error">${this.error}</div>`:""}
1583
+ </div>`:""}
1584
+ </div>
1585
+ `,this._input=e.querySelector("input"),this._input&&this._indeterminate&&(this._input.indeterminate=!0)}setupEventListeners(){var e;(e=this._input)==null||e.addEventListener("change",this.handleChange)}cleanupEventListeners(){var e;(e=this._input)==null||e.removeEventListener("change",this.handleChange)}onAttributeChange(e,t,i){switch(e){case"checked":this._checked=i!==null,this.updateVisualState();break;case"indeterminate":this._indeterminate=i!==null,this.updateVisualState();break;case"disabled":this.updateDisabledState();break;case"label":case"hint":case"error":case"aria-label":case"aria-describedby":case"required":case"name":this.shadowRoot&&(this.cleanupEventListeners(),this.shadowRoot.innerHTML="",this.render(),this.setupEventListeners());break;case"size":this.updateSizeClass();break}}updateVisualState(){this._input&&(this._input.checked=this._checked,this._input.indeterminate=this._indeterminate)}updateDisabledState(){this._input&&(this.disabled?this._input.setAttribute("disabled",""):this._input.removeAttribute("disabled"))}updateSizeClass(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector(".checkbox-wrapper");e&&(e.classList.remove("size-sm","size-md","size-lg"),e.classList.add(`size-${this.size}`))}toggle(){if(this.disabled)return;this._indeterminate?(this.indeterminate=!1,this.checked=!0):this.checked=!this.checked;const e=this.label||this.getAttribute("aria-label")||"Checkbox";o.announcePolite(`${e} ${this.checked?"checked":"unchecked"}`)}setChecked(e){this.checked=e}}class N extends u{constructor(){super(...arguments),this._value=[],this.handleChildChange=e=>{const t=e.target;if(!(t instanceof L)||t===this)return;const i=t.value;i&&(t.checked?this._value.includes(i)||(this._value=[...this._value,i]):this._value=this._value.filter(s=>s!==i),this.emit("change",{value:this._value}))}}static get observedAttributes(){return["disabled","legend","error","orientation","aria-label","aria-labelledby"]}get value(){return[...this._value]}set value(e){this._value=[...e],this.syncCheckboxStates()}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",e),this.syncDisabledState()}get legend(){return this.getAttribute("legend")||""}set legend(e){e?this.setAttribute("legend",e):this.removeAttribute("legend")}get error(){return this.getAttribute("error")||""}set error(e){e?this.setAttribute("error",e):this.removeAttribute("error")}get orientation(){return this.getAttribute("orientation")==="horizontal"?"horizontal":"vertical"}set orientation(e){this.setAttribute("orientation",e)}setupAccessibility(){var e;typeof process<"u"&&((e=process.env)==null?void 0:e.NODE_ENV)!=="production"&&!this.legend&&!this.getAttribute("aria-label")&&!this.getAttribute("aria-labelledby")&&console.warn(`[compa11y/CheckboxGroup] CheckboxGroup has no accessible label. Add legend="..." or aria-label="..." attribute.
1586
+ 💡 Suggestion: <a11y-checkbox-group legend="Select options"></a11y-checkbox-group>`),this.initValueFromChildren()}render(){const e=this.attachShadow({mode:"open"}),t=`${this._id}-error`,i=!!this.legend,s=!!this.error,a=this.getAttribute("aria-label"),r=this.getAttribute("aria-labelledby");e.innerHTML=`
1587
+ <style>${he}</style>
1588
+ <fieldset
1589
+ part="fieldset"
1590
+ ${a?`aria-label="${a}"`:""}
1591
+ ${r?`aria-labelledby="${r}"`:""}
1592
+ ${s?`aria-describedby="${t}"`:""}
1593
+ ${this.disabled?"disabled":""}
1594
+ >
1595
+ ${i?`<legend part="legend">${this.legend}</legend>`:""}
1596
+ <div class="checkbox-group-items" part="items">
1597
+ <slot></slot>
1598
+ </div>
1599
+ ${s?`<div id="${t}" class="checkbox-group-error" role="alert" part="error">${this.error}</div>`:""}
1600
+ </fieldset>
1601
+ `}setupEventListeners(){this.addEventListener("change",this.handleChildChange)}cleanupEventListeners(){this.removeEventListener("change",this.handleChildChange)}onAttributeChange(e,t,i){switch(e){case"disabled":this.syncDisabledState();break;case"legend":case"error":case"aria-label":case"aria-labelledby":this.shadowRoot&&(this.cleanupEventListeners(),this.shadowRoot.innerHTML="",this.render(),this.setupEventListeners());break}}initValueFromChildren(){requestAnimationFrame(()=>{const e=this.querySelectorAll("a11y-checkbox"),t=[];e.forEach(i=>{i.hasAttribute("checked")&&i.getAttribute("value")&&t.push(i.getAttribute("value"))}),this._value=t})}syncCheckboxStates(){this.querySelectorAll("a11y-checkbox").forEach(t=>{const i=t.value;i&&(t.checked=this._value.includes(i))})}syncDisabledState(){var t;const e=(t=this.shadowRoot)==null?void 0:t.querySelector("fieldset");e&&(this.disabled?e.setAttribute("disabled",""):e.removeAttribute("disabled"))}}b("a11y-checkbox",L),b("a11y-checkbox-group",N);class j extends u{constructor(){super(...arguments),this._value="",this._disabled=!1,this._discoverable=!0,this._orientation="vertical",this._required=!1,this._name="",this.handleRadioSelect=e=>{var i;if(this._disabled)return;const t=(i=e.detail)==null?void 0:i.value;t!==void 0&&this.selectRadio(t)},this.handleKeyDown=e=>{if(this._disabled)return;const t=this.getEnabledRadios();if(t.length===0)return;const i=t.findIndex(a=>a.value===this._value);let s=null;switch(e.key){case"ArrowDown":case"ArrowRight":s=i<0?0:(i+1)%t.length;break;case"ArrowUp":case"ArrowLeft":s=i<0?t.length-1:(i-1+t.length)%t.length;break;case"Home":s=0;break;case"End":s=t.length-1;break;case" ":e.preventDefault(),e.stopPropagation();{const a=t.find(r=>r===document.activeElement||r.contains(document.activeElement));if(a&&a.value!==this._value){this.selectRadio(a.value);const r=a.getAttribute("label")||a.value;o.announcePolite(`${r} selected`)}}return;default:return}if(s!==null){e.preventDefault(),e.stopPropagation();const a=t[s];if(a){this.selectRadio(a.value),a.focus();const r=a.getAttribute("label")||a.value;o.announcePolite(`${r} selected`)}}}}static get observedAttributes(){return["value","disabled","discoverable","orientation","required","name","legend","hint","error","aria-label","aria-labelledby"]}get value(){return this._value}set value(e){this._value!==e&&(this._value=e,this.setAttribute("value",e),this.syncRadioStates())}get disabled(){return this._disabled}set disabled(e){const t=!!e;this._disabled!==t&&(this._disabled=t,t?(this.setAttribute("disabled",""),this.setAttribute("aria-disabled","true")):(this.removeAttribute("disabled"),this.removeAttribute("aria-disabled")),this.syncRadioStates())}get discoverable(){return this._discoverable}set discoverable(e){this._discoverable=!!e}get required(){return this._required}set required(e){this._required=!!e,this._required?this.setAttribute("aria-required","true"):this.removeAttribute("aria-required")}get name(){return this._name}set name(e){this._name=e,this.setAttribute("name",e)}get orientation(){return this._orientation}set orientation(e){this._orientation=e,this.setAttribute("orientation",e),this.setAttribute("aria-orientation",e)}setupAccessibility(){this.setAttribute("role","radiogroup"),this.setAttribute("aria-orientation",this._orientation),!(this.hasAttribute("aria-label")||this.hasAttribute("aria-labelledby")||this.hasAttribute("legend"))&&process.env.NODE_ENV!=="production"&&console.warn("[Compa11y RadioGroup]: RadioGroup has no accessible label. Use legend, aria-label, or aria-labelledby.");const t=this.getAttribute("value");t&&(this._value=t),this._disabled=this.hasAttribute("disabled"),this._disabled&&this.setAttribute("aria-disabled","true");const i=this.getAttribute("orientation");(i==="horizontal"||i==="vertical")&&(this._orientation=i),this._required=this.hasAttribute("required"),this._required&&this.setAttribute("aria-required","true"),this._name=this.getAttribute("name")||this._id;const s=this.getAttribute("discoverable");(s==="false"||s==="0")&&(this._discoverable=!1),this.hasAttribute("error")&&this.getAttribute("error")&&this.setAttribute("aria-invalid","true")}render(){this.shadowRoot||this.attachShadow({mode:"open"});const e=this.shadowRoot,t=this.getAttribute("legend")||"",i=this.getAttribute("hint")||"",s=this.getAttribute("error")||"",a=i?`${this._id}-hint`:"",r=s?`${this._id}-error`:"",h=[a,r].filter(Boolean).join(" ");h?this.setAttribute("aria-describedby",h):this.removeAttribute("aria-describedby"),e.innerHTML=`
1602
+ <style>${de}</style>
1603
+ <fieldset part="fieldset">
1604
+ ${t?`<legend part="legend">${t}${this._required?'<span class="radio-group-required" aria-hidden="true"> *</span>':""}</legend>`:""}
1605
+ <div class="radio-group-items" part="items">
1606
+ <slot></slot>
1607
+ </div>
1608
+ ${i?`<div class="radio-group-hint" id="${a}" part="hint">${i}</div>`:""}
1609
+ ${s?`<div class="radio-group-error" id="${r}" part="error" role="alert">${s}</div>`:""}
1610
+ </fieldset>
1611
+ `}setupEventListeners(){var t;this.addEventListener("keydown",this.handleKeyDown),this.addEventListener("radio-select",this.handleRadioSelect);const e=(t=this.shadowRoot)==null?void 0:t.querySelector("slot");e&&e.addEventListener("slotchange",()=>{this.syncRadioStates()})}cleanupEventListeners(){this.removeEventListener("keydown",this.handleKeyDown),this.removeEventListener("radio-select",this.handleRadioSelect)}getRadios(){return Array.from(this.querySelectorAll("a11y-radio"))}getEnabledRadios(){return this.getRadios().filter(e=>!e.disabled&&!this._disabled)}syncRadioStates(){const e=this.getRadios(),t=this.getEnabledRadios();e.forEach(i=>{const s=i.value===this._value;i.checked=s,s||!this._value&&t[0]===i?i.setAttribute("tabindex","0"):i.setAttribute("tabindex","-1")})}selectRadio(e){this._disabled||(this._value=e,this.setAttribute("value",e),this.syncRadioStates(),this.hasAttribute("aria-invalid")&&this.removeAttribute("aria-invalid"),this.emit("change",{value:e}),this.emit("a11y-radiogroup-change",{value:e}))}attributeChangedCallback(e,t,i){if(t!==i)switch(e){case"value":this._value=i||"",this.syncRadioStates();break;case"disabled":this._disabled=i!==null,this._disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled"),this.syncRadioStates();break;case"discoverable":i===null?this._discoverable=!0:i==="false"||i==="0"?this._discoverable=!1:this._discoverable=!0;break;case"orientation":(i==="horizontal"||i==="vertical")&&(this._orientation=i,this.setAttribute("aria-orientation",i));break;case"required":this._required=i!==null,this._required?this.setAttribute("aria-required","true"):this.removeAttribute("aria-required");break;case"name":this._name=i||"";break;case"error":i?this.setAttribute("aria-invalid","true"):this.removeAttribute("aria-invalid"),this.render();break;case"legend":case"hint":this.render();break}}}class U extends u{constructor(){super(...arguments),this._value="",this._checked=!1,this._disabled=!1,this._discoverable=!0,this.handleClick=e=>{if(this._disabled){e.preventDefault();return}this.dispatchEvent(new CustomEvent("radio-select",{detail:{value:this._value},bubbles:!0,composed:!0}));const t=this.getAttribute("label")||this._value;o.announcePolite(`${t} selected`)},this.handleKeyDown=e=>{if(!this._disabled&&e.key==="Enter"){e.preventDefault(),this.dispatchEvent(new CustomEvent("radio-select",{detail:{value:this._value},bubbles:!0,composed:!0}));const t=this.getAttribute("label")||this._value;o.announcePolite(`${t} selected`)}}}static get observedAttributes(){return["value","label","hint","disabled","discoverable","checked"]}get value(){return this._value}set value(e){this._value=e,this.setAttribute("value",e)}get checked(){return this._checked}set checked(e){const t=!!e;this._checked!==t&&(this._checked=t,t?this.setAttribute("checked",""):this.removeAttribute("checked"),this.setAttribute("aria-checked",String(t)),this.updateVisual())}get disabled(){return this._disabled}set disabled(e){const t=!!e;this._disabled!==t&&(this._disabled=t,t?(this.setAttribute("disabled",""),this.setAttribute("aria-disabled","true")):(this.removeAttribute("disabled"),this.removeAttribute("aria-disabled")))}get discoverable(){return this._discoverable}set discoverable(e){let t;typeof e=="string"?t=e!=="false"&&e!=="0":t=!!e,this._discoverable!==t&&(this._discoverable=t,t?this.setAttribute("discoverable",""):this.removeAttribute("discoverable"))}setupAccessibility(){this.setAttribute("role","radio"),this.setAttribute("aria-checked","false"),this._value=this.getAttribute("value")||"",this._checked=this.hasAttribute("checked"),this._disabled=this.hasAttribute("disabled"),this._checked&&this.setAttribute("aria-checked","true"),this._disabled&&this.setAttribute("aria-disabled","true");const e=this.getAttribute("discoverable");(e==="false"||e==="0")&&(this._discoverable=!1),this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1")}render(){this.shadowRoot||this.attachShadow({mode:"open"});const e=this.shadowRoot,t=this.getAttribute("label")||"",i=this.getAttribute("hint")||"",s=t?`${this._id}-label`:"",a=i?`${this._id}-hint`:"";s&&this.setAttribute("aria-labelledby",s),a&&this.setAttribute("aria-describedby",a),e.innerHTML=`
1612
+ <style>${ce}</style>
1613
+ <div class="radio-wrapper" part="wrapper">
1614
+ <div class="radio-control" part="control">
1615
+ <input
1616
+ type="radio"
1617
+ class="radio-input"
1618
+ tabindex="-1"
1619
+ aria-hidden="true"
1620
+ ${this._disabled?"disabled":""}
1621
+ />
1622
+ <div class="radio-circle" part="circle">
1623
+ <div class="radio-dot" part="dot" aria-hidden="true"></div>
1624
+ </div>
1625
+ </div>
1626
+ ${t||i?`<div class="radio-content">
1627
+ ${t?`<span class="radio-label" id="${s}" part="label">${t}</span>`:""}
1628
+ ${i?`<span class="radio-hint" id="${a}" part="hint">${i}</span>`:""}
1629
+ </div>`:""}
1630
+ <slot></slot>
1631
+ </div>
1632
+ `}setupEventListeners(){this.addEventListener("click",this.handleClick),this.addEventListener("keydown",this.handleKeyDown)}cleanupEventListeners(){this.removeEventListener("click",this.handleClick),this.removeEventListener("keydown",this.handleKeyDown)}updateVisual(){if(!this.shadowRoot)return;const e=this.shadowRoot.querySelector(".radio-dot");e&&(e.style.opacity=this._checked?"1":"0",e.style.transform=this._checked?"scale(1)":"scale(0)");const t=this.shadowRoot.querySelector(".radio-circle");t&&(this._checked?(t.style.background="var(--compa11y-radio-checked-bg, #0066cc)",t.style.borderColor="var(--compa11y-radio-checked-border, #0066cc)"):(t.style.background="var(--compa11y-radio-bg, white)",t.style.borderColor=""))}attributeChangedCallback(e,t,i){if(t!==i)switch(e){case"value":this._value=i||"";break;case"checked":this._checked=i!==null,this.setAttribute("aria-checked",String(this._checked)),this.updateVisual();break;case"disabled":this._disabled=i!==null,this._disabled?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled");break;case"discoverable":i===null?this._discoverable=!0:i==="false"||i==="0"?this._discoverable=!1:this._discoverable=!0;break;case"label":case"hint":this.render();break}}}if(b("a11y-radio-group",j),b("a11y-radio",U),typeof window<"u"){const d=()=>{o.initAnnouncer(),o.initFocusVisible()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",d):d(),window.compa11y={A11yDialog:O,A11yMenu:z,A11yTabs:q,A11yCombobox:D,A11ySwitch:T,A11ySelect:R,A11yInput:B,A11yTextarea:H,A11yButton:P,A11yListbox:K,A11yOption:F,A11yOptgroup:M,A11yCheckbox:L,A11yCheckboxGroup:N,A11yRadioGroup:j,A11yRadio:U,initAnnouncer:o.initAnnouncer,announce:o.announce,announcePolite:o.announcePolite,announceAssertive:o.announceAssertive,announceStatus:o.announceStatus,announceError:o.announceError,initFocusVisible:o.initFocusVisible,createFocusTrap:o.createFocusTrap,createFocusScope:o.createFocusScope,createRovingTabindex:o.createRovingTabindex,createKeyboardManager:o.createKeyboardManager,KeyboardPatterns:o.KeyboardPatterns,createTypeAhead:o.createTypeAhead,aria:o.aria,buildAriaProps:o.buildAriaProps,hasAccessibleName:o.hasAccessibleName,isBrowser:o.isBrowser,prefersReducedMotion:o.prefersReducedMotion,prefersHighContrast:o.prefersHighContrast,prefersDarkMode:o.prefersDarkMode}}Object.defineProperty(l,"KeyboardPatterns",{enumerable:!0,get:()=>o.KeyboardPatterns}),Object.defineProperty(l,"announce",{enumerable:!0,get:()=>o.announce}),Object.defineProperty(l,"announceAssertive",{enumerable:!0,get:()=>o.announceAssertive}),Object.defineProperty(l,"announceError",{enumerable:!0,get:()=>o.announceError}),Object.defineProperty(l,"announcePolite",{enumerable:!0,get:()=>o.announcePolite}),Object.defineProperty(l,"announceStatus",{enumerable:!0,get:()=>o.announceStatus}),Object.defineProperty(l,"aria",{enumerable:!0,get:()=>o.aria}),Object.defineProperty(l,"buildAriaProps",{enumerable:!0,get:()=>o.buildAriaProps}),Object.defineProperty(l,"createFocusScope",{enumerable:!0,get:()=>o.createFocusScope}),Object.defineProperty(l,"createFocusTrap",{enumerable:!0,get:()=>o.createFocusTrap}),Object.defineProperty(l,"createKeyboardManager",{enumerable:!0,get:()=>o.createKeyboardManager}),Object.defineProperty(l,"createRovingTabindex",{enumerable:!0,get:()=>o.createRovingTabindex}),Object.defineProperty(l,"createTypeAhead",{enumerable:!0,get:()=>o.createTypeAhead}),Object.defineProperty(l,"hasAccessibleName",{enumerable:!0,get:()=>o.hasAccessibleName}),Object.defineProperty(l,"initAnnouncer",{enumerable:!0,get:()=>o.initAnnouncer}),Object.defineProperty(l,"initFocusVisible",{enumerable:!0,get:()=>o.initFocusVisible}),Object.defineProperty(l,"isBrowser",{enumerable:!0,get:()=>o.isBrowser}),Object.defineProperty(l,"prefersDarkMode",{enumerable:!0,get:()=>o.prefersDarkMode}),Object.defineProperty(l,"prefersHighContrast",{enumerable:!0,get:()=>o.prefersHighContrast}),Object.defineProperty(l,"prefersReducedMotion",{enumerable:!0,get:()=>o.prefersReducedMotion}),l.A11yButton=P,l.A11yCheckbox=L,l.A11yCheckboxGroup=N,l.A11yCombobox=D,l.A11yDialog=O,l.A11yInput=B,l.A11yListbox=K,l.A11yMenu=z,l.A11yOptgroup=M,l.A11yOption=F,l.A11yRadio=U,l.A11yRadioGroup=j,l.A11ySelect=R,l.A11ySwitch=T,l.A11yTabs=q,l.A11yTextarea=H,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
533
1633
  //# sourceMappingURL=compa11y.umd.cjs.map