@smilodon/core 1.5.1 → 1.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -674,6 +674,9 @@ enhanced-select.dark-mode {
674
674
 
675
675
  /* Group headers (when using groupedItems or flat items with `group` property) */
676
676
  --select-group-header-padding /* Padding inside header (8px 12px) */
677
+ --select-group-header-separator-margin-top /* Extra gap before later groups */
678
+ --select-group-header-separator-padding-top /* Adds separator spacing without changing header title padding */
679
+ --select-group-header-separator-border-top /* Divider above later groups */
677
680
  --select-group-header-color /* Text color (#6b7280) */
678
681
  --select-group-header-bg /* Background (#f3f4f6) */
679
682
  --select-group-header-font-size
@@ -794,13 +797,16 @@ Full control over the vertical separator line (works in all modes):
794
797
  ```css
795
798
  enhanced-select {
796
799
  --select-separator-width: 2px; /* Line thickness */
797
- --select-separator-height: 60%; /* Line height (% of container) */
800
+ --select-separator-height: 60%; /* Line height for single-select (% of container) */
801
+ --select-multi-separator-height: 40px; /* Fixed height for multi-select (default: auto) */
798
802
  --select-separator-display: none; /* Hide separator completely */
799
803
  --select-separator-bg: #e5e7eb; /* Custom color/gradient */
800
804
  --select-separator-opacity: 0.8; /* Line opacity */
801
805
  }
802
806
  ```
803
807
 
808
+ **Note:** Multi-select uses `--select-multi-separator-height` (default: `auto` to stretch with container). Set a fixed pixel value like `40px` to maintain consistent separator height regardless of how many items are selected.
809
+
804
810
  #### Input & Badge Typography
805
811
 
806
812
  ```css
package/dist/index.cjs CHANGED
@@ -1600,7 +1600,7 @@ class SelectOption extends HTMLElement {
1600
1600
  transform: var(--select-option-selected-hover-transform, var(--select-option-selected-transform, var(--select-option-transform, none)));
1601
1601
  }
1602
1602
 
1603
- .option-container.active {
1603
+ .option-container.active:not(.disabled) {
1604
1604
  background: var(--select-option-active-bg, var(--select-option-hover-bg, #f0f0f0));
1605
1605
  color: var(--select-option-active-color, var(--select-option-hover-color, var(--select-option-color, var(--select-text-color, #1f2937))));
1606
1606
  border: var(--select-option-active-border, var(--select-option-hover-border, var(--select-option-border, none)));
@@ -1728,7 +1728,7 @@ class SelectOption extends HTMLElement {
1728
1728
  toggleClasses(this._container, [...selectedClasses, 'smilodon-option--selected'], false);
1729
1729
  toggleClasses(this, [...selectedClasses, 'smilodon-option--selected'], false);
1730
1730
  }
1731
- if (active) {
1731
+ if (active && !disabled) {
1732
1732
  toggleClasses(this._container, [...activeClasses, 'smilodon-option--active'], true);
1733
1733
  toggleClasses(this, [...activeClasses, 'smilodon-option--active'], true); // Make focus ring visible on host
1734
1734
  }
@@ -1796,8 +1796,12 @@ class SelectOption extends HTMLElement {
1796
1796
  // Set ARIA attributes and State attributes on Host
1797
1797
  this.setAttribute('role', 'option');
1798
1798
  this.setAttribute('aria-selected', String(selected));
1799
- if (disabled)
1799
+ if (disabled) {
1800
1800
  this.setAttribute('aria-disabled', 'true');
1801
+ }
1802
+ else {
1803
+ this.removeAttribute('aria-disabled');
1804
+ }
1801
1805
  this.id = this._config.id || `select-option-${index}`;
1802
1806
  // Add checkmark (part="checkmark") - standard for object mode
1803
1807
  // Only show if NOT showing remove button (avoid clutter)
@@ -1816,7 +1820,7 @@ class SelectOption extends HTMLElement {
1816
1820
  const state = [];
1817
1821
  if (selected)
1818
1822
  state.push('selected');
1819
- if (active)
1823
+ if (active && !disabled)
1820
1824
  state.push('active');
1821
1825
  if (state.length) {
1822
1826
  this.dataset.smState = state.join(' ');
@@ -1940,7 +1944,7 @@ class SelectOption extends HTMLElement {
1940
1944
  * Set active state
1941
1945
  */
1942
1946
  setActive(active) {
1943
- this._config.active = active;
1947
+ this._config.active = active && !this._config.disabled;
1944
1948
  this._render();
1945
1949
  }
1946
1950
  /**
@@ -2453,11 +2457,11 @@ class EnhancedSelect extends HTMLElement {
2453
2457
  this._inputContainer.removeAttribute('data-multi-scroll-mode');
2454
2458
  this._inputContainer.removeAttribute('data-drag-scroll');
2455
2459
  this._inputContainer.classList.remove('is-dragging-scroll');
2456
- this._inputContainer.style.removeProperty('--select-multi-input-max-height');
2457
- this._inputContainer.style.removeProperty('--select-multi-input-overflow-x');
2458
- this._inputContainer.style.removeProperty('--select-multi-input-overflow-y');
2459
- this._inputContainer.style.removeProperty('--select-multi-input-flex-wrap');
2460
- this._inputContainer.style.removeProperty('--select-multi-input-align-content');
2460
+ this._inputContainer.style.removeProperty('--select-multi-input-max-height-config');
2461
+ this._inputContainer.style.removeProperty('--select-multi-input-overflow-x-config');
2462
+ this._inputContainer.style.removeProperty('--select-multi-input-overflow-y-config');
2463
+ this._inputContainer.style.removeProperty('--select-multi-input-flex-wrap-config');
2464
+ this._inputContainer.style.removeProperty('--select-multi-input-align-content-config');
2461
2465
  return;
2462
2466
  }
2463
2467
  const maxHeight = this._config.multiSelectDisplay?.maxHeight ?? '160px';
@@ -2467,11 +2471,11 @@ class EnhancedSelect extends HTMLElement {
2467
2471
  const alignContent = mode === 'horizontal' ? 'center' : 'flex-start';
2468
2472
  this._inputContainer.setAttribute('data-multi-scroll-mode', mode);
2469
2473
  this._inputContainer.setAttribute('data-drag-scroll', String(dragEnabled && mode === 'horizontal'));
2470
- this._inputContainer.style.setProperty('--select-multi-input-max-height', maxHeight);
2471
- this._inputContainer.style.setProperty('--select-multi-input-overflow-x', overflowX);
2472
- this._inputContainer.style.setProperty('--select-multi-input-overflow-y', overflowY);
2473
- this._inputContainer.style.setProperty('--select-multi-input-flex-wrap', flexWrap);
2474
- this._inputContainer.style.setProperty('--select-multi-input-align-content', alignContent);
2474
+ this._inputContainer.style.setProperty('--select-multi-input-max-height-config', maxHeight);
2475
+ this._inputContainer.style.setProperty('--select-multi-input-overflow-x-config', overflowX);
2476
+ this._inputContainer.style.setProperty('--select-multi-input-overflow-y-config', overflowY);
2477
+ this._inputContainer.style.setProperty('--select-multi-input-flex-wrap-config', flexWrap);
2478
+ this._inputContainer.style.setProperty('--select-multi-input-align-content-config', alignContent);
2475
2479
  }
2476
2480
  _canUseHorizontalMultiScroll(target) {
2477
2481
  if (this._config.selection.mode !== 'multi')
@@ -2721,7 +2725,7 @@ class EnhancedSelect extends HTMLElement {
2721
2725
  --select-accent: #0f3460;
2722
2726
  --select-accent-hover: #e94560;
2723
2727
  --select-surface: #ffffff;
2724
- --select-surface-elevated: #fafbfc;
2728
+ --select-surface-elevated: rgba(0, 0, 0, 0.04);
2725
2729
  --select-border: #e1e5eb;
2726
2730
  --select-border-focus: #0f3460;
2727
2731
  --select-text: #1a1a2e;
@@ -2769,16 +2773,15 @@ class EnhancedSelect extends HTMLElement {
2769
2773
  --select-multi-input-horizontal-cursor: grab;
2770
2774
  --select-multi-input-horizontal-active-cursor: grabbing;
2771
2775
  --select-multi-separator-inset-block: 10px;
2776
+ --select-multi-separator-height: auto;
2772
2777
  --select-multi-action-surface-bg: var(--select-input-bg, var(--select-surface));
2773
2778
  --select-multi-action-divider: 1px solid var(--select-border);
2774
2779
  --select-separator-width: 1px;
2775
- --select-separator-height: 50%;
2780
+ --select-separator-inset-block: 10px;
2781
+ --select-separator-height: auto;
2776
2782
  --select-separator-display: block;
2777
2783
  --select-separator-opacity: 0.6;
2778
2784
  --select-separator-active-opacity: 1;
2779
- --select-separator-width: 1px;
2780
- --select-separator-height: 50%;
2781
- --select-separator-display: block;
2782
2785
  --select-separator-position: var(--select-arrow-width, 42px);
2783
2786
  --select-separator-position-with-clear: calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px));
2784
2787
  --select-separator-dark-bg: linear-gradient(
@@ -2849,9 +2852,9 @@ class EnhancedSelect extends HTMLElement {
2849
2852
  --select-searching-spinner-size: 24px;
2850
2853
  --select-searching-spinner-border: 2px solid var(--select-border);
2851
2854
  --select-searching-spinner-animation: var(--select-spinner-animation);
2852
- --select-group-header-separator-margin-top: 8px;
2853
- --select-group-header-separator-padding-top: 14px;
2854
- --select-group-header-separator-border-top: 1px solid var(--select-border);
2855
+ --select-group-header-separator-margin-top: 0;
2856
+ --select-group-header-separator-padding-top: 0;
2857
+ --select-group-header-separator-border-top: none;
2855
2858
  --select-reduced-motion-duration: 0.01ms;
2856
2859
  --select-reduced-motion-iteration-count: 1;
2857
2860
  --select-high-contrast-border-width: 2px;
@@ -3100,21 +3103,20 @@ class EnhancedSelect extends HTMLElement {
3100
3103
  }
3101
3104
 
3102
3105
  .input-container.input-container--multi {
3103
- max-height: var(--select-multi-input-max-height, var(--select-input-max-height, 160px));
3106
+ max-height: var(--select-multi-input-max-height, var(--select-multi-input-max-height-config, var(--select-input-max-height, 160px)));
3104
3107
  }
3105
3108
 
3106
3109
  .input-container.input-container--multi .input-content {
3107
- flex-wrap: var(--select-multi-input-flex-wrap, wrap);
3108
- align-content: var(--select-multi-input-align-content, flex-start);
3109
- overflow-x: var(--select-multi-input-overflow-x, hidden);
3110
- overflow-y: var(--select-multi-input-overflow-y, auto);
3110
+ flex-wrap: var(--select-multi-input-flex-wrap, var(--select-multi-input-flex-wrap-config, wrap));
3111
+ align-content: var(--select-multi-input-align-content, var(--select-multi-input-align-content-config, flex-start));
3112
+ overflow-x: var(--select-multi-input-overflow-x, var(--select-multi-input-overflow-x-config, hidden));
3113
+ overflow-y: var(--select-multi-input-overflow-y, var(--select-multi-input-overflow-y-config, auto));
3111
3114
  }
3112
3115
 
3113
3116
  .input-container.input-container--multi::after {
3114
- top: var(--select-multi-separator-inset-block, 10px);
3115
- bottom: var(--select-multi-separator-inset-block, 10px);
3116
- height: auto;
3117
- transform: none;
3117
+ top: var(--select-multi-separator-inset-block, var(--select-separator-inset-block, 10px));
3118
+ bottom: var(--select-multi-separator-inset-block, var(--select-separator-inset-block, 10px));
3119
+ height: var(--select-multi-separator-height, auto);
3118
3120
  }
3119
3121
 
3120
3122
  .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] {
@@ -3125,6 +3127,11 @@ class EnhancedSelect extends HTMLElement {
3125
3127
  cursor: var(--select-multi-input-horizontal-cursor, grab);
3126
3128
  overflow-y: hidden;
3127
3129
  overscroll-behavior-x: contain;
3130
+ padding-right: calc(var(--select-arrow-width, 42px) + var(--select-multi-horizontal-end-gap, 12px));
3131
+ }
3132
+
3133
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"].has-clear-control .input-content {
3134
+ padding-right: calc(var(--select-arrow-width, 42px) + var(--select-clear-button-size, 26px) + var(--select-clear-button-right, 8px) + var(--select-multi-horizontal-end-gap, 12px));
3128
3135
  }
3129
3136
 
3130
3137
  .input-container.input-container--multi[data-multi-scroll-mode="horizontal"]::after {
@@ -3166,6 +3173,15 @@ class EnhancedSelect extends HTMLElement {
3166
3173
  left: var(--select-arrow-right-with-clear, 34px);
3167
3174
  }
3168
3175
 
3176
+ :host([dir="rtl"]) .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content {
3177
+ padding-right: 0;
3178
+ padding-left: calc(var(--select-arrow-width, 42px) + var(--select-multi-horizontal-end-gap, 12px));
3179
+ }
3180
+
3181
+ :host([dir="rtl"]) .input-container.input-container--multi[data-multi-scroll-mode="horizontal"].has-clear-control .input-content {
3182
+ padding-left: calc(var(--select-arrow-width, 42px) + var(--select-clear-button-size, 26px) + var(--select-clear-button-right, 8px) + var(--select-multi-horizontal-end-gap, 12px));
3183
+ }
3184
+
3169
3185
  .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .clear-control-button {
3170
3186
  background: var(--select-multi-action-surface-bg, var(--select-input-bg, var(--select-surface)));
3171
3187
  z-index: 4;
@@ -3181,11 +3197,11 @@ class EnhancedSelect extends HTMLElement {
3181
3197
  content: '';
3182
3198
  display: var(--select-separator-display, block);
3183
3199
  position: absolute;
3184
- top: 50%;
3200
+ top: var(--select-separator-inset-block, 10px);
3201
+ bottom: var(--select-separator-inset-block, 10px);
3185
3202
  right: var(--select-separator-position, var(--select-arrow-width, 42px));
3186
- transform: translateY(-50%);
3187
3203
  width: var(--select-separator-width, 1px);
3188
- height: var(--select-separator-height, 50%);
3204
+ height: var(--select-separator-height, auto);
3189
3205
  background: var(--select-separator-bg, linear-gradient(
3190
3206
  to bottom,
3191
3207
  transparent 0%,
@@ -3519,8 +3535,10 @@ class EnhancedSelect extends HTMLElement {
3519
3535
  }
3520
3536
 
3521
3537
  .group-header:not(:first-child) {
3522
- margin-top: var(--select-group-header-separator-margin-top);
3523
- padding-top: var(--select-group-header-separator-padding-top);
3538
+ margin-top: calc(
3539
+ var(--select-group-header-separator-margin-top, 0px) +
3540
+ var(--select-group-header-separator-padding-top, 0px)
3541
+ );
3524
3542
  border-top: var(--select-group-header-separator-border-top);
3525
3543
  }
3526
3544
 
@@ -3535,13 +3553,15 @@ class EnhancedSelect extends HTMLElement {
3535
3553
  color: var(--select-option-color, var(--select-text));
3536
3554
  background: var(--select-option-bg, transparent);
3537
3555
  border: var(--select-option-border, none);
3556
+ box-sizing: border-box;
3538
3557
  text-align: var(--select-option-text-align, start);
3539
- transition:
3558
+ transition: var(--select-option-transition,
3540
3559
  background var(--select-transition-fast),
3541
3560
  color var(--select-transition-fast),
3542
- border-color var(--select-transition-fast),
3561
+ border var(--select-transition-fast),
3543
3562
  transform var(--select-transition-fast),
3544
- box-shadow var(--select-transition-fast);
3563
+ box-shadow var(--select-transition-fast)
3564
+ );
3545
3565
  user-select: none;
3546
3566
  font-size: var(--select-option-font-size, inherit);
3547
3567
  font-weight: var(--select-option-font-weight);
@@ -3551,10 +3571,10 @@ class EnhancedSelect extends HTMLElement {
3551
3571
  }
3552
3572
 
3553
3573
  .option:hover {
3554
- background: calc(var(--select-option-hover-enabled, 1) * 1) > 0 ? var(--select-option-hover-bg, var(--select-surface-elevated)) : var(--select-option-bg, transparent);
3555
- border: calc(var(--select-option-hover-enabled, 1) * 1) > 0 ? var(--select-option-hover-border, var(--select-option-border, none)) : var(--select-option-border, none);
3556
- color: calc(var(--select-option-hover-enabled, 1) * 1) > 0 ? var(--select-option-hover-color, var(--select-text)) : var(--select-option-color, var(--select-text));
3557
- transform: calc(var(--select-option-hover-enabled, 1) * 1) > 0 ? var(--select-option-hover-transform) : none;
3574
+ background: var(--select-option-hover-bg, var(--select-surface-elevated));
3575
+ border: var(--select-option-hover-border, var(--select-option-border, none));
3576
+ color: var(--select-option-hover-color, var(--select-text));
3577
+ transform: var(--select-option-hover-transform, none);
3558
3578
  }
3559
3579
 
3560
3580
  .option.selected {
@@ -3600,7 +3620,7 @@ class EnhancedSelect extends HTMLElement {
3600
3620
  color: var(--select-option-selected-hover-color, var(--select-option-selected-color, var(--select-accent)));
3601
3621
  }
3602
3622
 
3603
- .option.active:not(.selected) {
3623
+ .option.active:not(.selected):not(.disabled) {
3604
3624
  background: var(--select-option-active-bg, var(--select-surface-elevated));
3605
3625
  color: var(--select-option-active-color, var(--select-option-hover-color, var(--select-option-color, var(--select-text))));
3606
3626
  border: var(--select-option-active-border, var(--select-option-hover-border, var(--select-option-border, none)));
@@ -3610,7 +3630,7 @@ class EnhancedSelect extends HTMLElement {
3610
3630
  transform: var(--select-option-active-transform, none);
3611
3631
  }
3612
3632
 
3613
- .option.selected.active {
3633
+ .option.selected.active:not(.disabled) {
3614
3634
  outline: var(--select-option-selected-active-outline, 2px solid rgba(15, 52, 96, 0.4));
3615
3635
  outline-offset: var(--select-option-selected-active-outline-offset);
3616
3636
  }
@@ -3828,6 +3848,9 @@ class EnhancedSelect extends HTMLElement {
3828
3848
 
3829
3849
  --select-badge-bg: var(--select-dark-badge-bg, rgba(99, 102, 241, 0.2));
3830
3850
  --select-badge-color: var(--select-dark-badge-color, #e0e7ff);
3851
+ --select-badge-border: var(--select-dark-badge-border, var(--select-badge-border, none));
3852
+ --select-badge-hover-border: var(--select-dark-badge-hover-border, var(--select-badge-hover-border, var(--select-badge-border, none)));
3853
+ --select-badge-active-border: var(--select-dark-badge-active-border, var(--select-badge-active-border, var(--select-badge-hover-border, var(--select-badge-border, none))));
3831
3854
 
3832
3855
  --select-group-header-bg: var(--select-group-header-dark-bg, #1a1a2e);
3833
3856
  --select-group-header-color: var(--select-group-header-dark-color, #9ca3af);
@@ -3836,12 +3859,16 @@ class EnhancedSelect extends HTMLElement {
3836
3859
 
3837
3860
  --select-option-bg: var(--select-dark-option-bg, transparent);
3838
3861
  --select-option-color: var(--select-dark-option-color, var(--select-text));
3862
+ --select-option-border: var(--select-dark-option-border, none);
3839
3863
  --select-option-hover-bg: var(--select-dark-option-hover-bg, var(--select-surface-elevated));
3840
3864
  --select-option-hover-color: var(--select-dark-option-hover-color, var(--select-text));
3865
+ --select-option-hover-border: var(--select-dark-option-hover-border, var(--select-option-border, none));
3841
3866
  --select-option-selected-bg: var(--select-dark-option-selected-bg, linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.08) 100%));
3842
3867
  --select-option-selected-color: var(--select-dark-option-selected-color, #a5b4fc);
3868
+ --select-option-selected-border: var(--select-dark-option-selected-border, var(--select-option-border, none));
3843
3869
  --select-option-selected-hover-bg: var(--select-dark-option-selected-hover-bg, var(--select-option-selected-bg));
3844
3870
  --select-option-selected-hover-color: var(--select-dark-option-selected-hover-color, var(--select-option-selected-color));
3871
+ --select-option-selected-hover-border: var(--select-dark-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-hover-border, var(--select-option-border, none))));
3845
3872
  }
3846
3873
 
3847
3874
  :host(.dark-mode) .input-container,
@@ -3859,6 +3886,36 @@ class EnhancedSelect extends HTMLElement {
3859
3886
  border-color: var(--select-border);
3860
3887
  }
3861
3888
 
3889
+ :host(.dark-mode) .input-container:hover,
3890
+ :host([dark-mode]) .input-container:hover,
3891
+ :host([darkmode]) .input-container:hover,
3892
+ :host([data-theme="dark"]) .input-container:hover,
3893
+ :host([theme="dark"]) .input-container:hover,
3894
+ :host-context(.dark-mode) .input-container:hover,
3895
+ :host-context(.dark) .input-container:hover,
3896
+ :host-context([dark-mode]) .input-container:hover,
3897
+ :host-context([darkmode]) .input-container:hover,
3898
+ :host-context([data-theme="dark"]) .input-container:hover,
3899
+ :host-context([theme="dark"]) .input-container:hover {
3900
+ border-color: var(--select-dark-input-hover-border, var(--select-input-hover-border, var(--select-dark-border-focus, var(--select-border-focus, #6366f1))));
3901
+ box-shadow: var(--select-dark-input-hover-shadow, var(--select-input-hover-shadow, var(--select-shadow-sm), 0 0 0 1px rgba(99, 102, 241, 0.12)));
3902
+ }
3903
+
3904
+ :host(.dark-mode) .input-container:focus-within,
3905
+ :host([dark-mode]) .input-container:focus-within,
3906
+ :host([darkmode]) .input-container:focus-within,
3907
+ :host([data-theme="dark"]) .input-container:focus-within,
3908
+ :host([theme="dark"]) .input-container:focus-within,
3909
+ :host-context(.dark-mode) .input-container:focus-within,
3910
+ :host-context(.dark) .input-container:focus-within,
3911
+ :host-context([dark-mode]) .input-container:focus-within,
3912
+ :host-context([darkmode]) .input-container:focus-within,
3913
+ :host-context([data-theme="dark"]) .input-container:focus-within,
3914
+ :host-context([theme="dark"]) .input-container:focus-within {
3915
+ border-color: var(--select-dark-border-focus, var(--select-border-focus, #6366f1));
3916
+ box-shadow: var(--select-dark-shadow-focus, var(--select-shadow-focus, 0 0 0 3px rgba(99, 102, 241, 0.25))), var(--select-shadow-sm);
3917
+ }
3918
+
3862
3919
  :host(.dark-mode) .input-container::after,
3863
3920
  :host([dark-mode]) .input-container::after,
3864
3921
  :host([darkmode]) .input-container::after,
@@ -3914,7 +3971,8 @@ class EnhancedSelect extends HTMLElement {
3914
3971
  :host-context([darkmode]) .selection-badge,
3915
3972
  :host-context([data-theme="dark"]) .selection-badge,
3916
3973
  :host-context([theme="dark"]) .selection-badge {
3917
- background: var(--select-badge-dark-bg);
3974
+ background: var(--select-dark-badge-bg, var(--select-badge-bg, var(--select-badge-dark-bg)));
3975
+ color: var(--select-dark-badge-color, var(--select-badge-color, #e0e7ff));
3918
3976
  }
3919
3977
 
3920
3978
  :host(.dark-mode) .group-header:not(:first-child),
@@ -4095,6 +4153,10 @@ class EnhancedSelect extends HTMLElement {
4095
4153
  this._inputContent.addEventListener('wheel', (e) => {
4096
4154
  if (this._config.selection.mode === 'multi'
4097
4155
  && (this._config.multiSelectDisplay?.mode ?? 'wrap') === 'horizontal') {
4156
+ const primaryDelta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY;
4157
+ if (primaryDelta !== 0) {
4158
+ this._inputContent.scrollLeft += primaryDelta;
4159
+ }
4098
4160
  e.preventDefault();
4099
4161
  }
4100
4162
  }, { passive: false });
@@ -4489,6 +4551,8 @@ class EnhancedSelect extends HTMLElement {
4489
4551
  }
4490
4552
  }
4491
4553
  _handleKeydown(e) {
4554
+ if (!this._config.enabled)
4555
+ return;
4492
4556
  switch (e.key) {
4493
4557
  case 'ArrowDown':
4494
4558
  e.preventDefault();
@@ -4511,17 +4575,23 @@ class EnhancedSelect extends HTMLElement {
4511
4575
  case 'Home':
4512
4576
  e.preventDefault();
4513
4577
  if (this._state.isOpen) {
4514
- this._setActive(0);
4578
+ const selectableIndices = this._getSelectableOptionIndices();
4579
+ const firstIndex = selectableIndices[0];
4580
+ if (firstIndex === undefined)
4581
+ break;
4582
+ this._setActive(firstIndex);
4515
4583
  if (this._config.selection.mode === 'multi' && e.shiftKey) {
4516
- this._selectRange(this._rangeAnchorIndex ?? 0, 0, { clear: !(e.ctrlKey || e.metaKey) });
4584
+ this._selectRange(this._rangeAnchorIndex ?? firstIndex, firstIndex, { clear: !(e.ctrlKey || e.metaKey) });
4517
4585
  }
4518
4586
  }
4519
4587
  break;
4520
4588
  case 'End':
4521
4589
  e.preventDefault();
4522
4590
  if (this._state.isOpen) {
4523
- const options = Array.from(this._optionsContainer.children);
4524
- const lastIndex = Math.max(0, options.length - 1);
4591
+ const selectableIndices = this._getSelectableOptionIndices();
4592
+ const lastIndex = selectableIndices[selectableIndices.length - 1];
4593
+ if (lastIndex === undefined)
4594
+ break;
4525
4595
  this._setActive(lastIndex);
4526
4596
  if (this._config.selection.mode === 'multi' && e.shiftKey) {
4527
4597
  this._selectRange(this._rangeAnchorIndex ?? lastIndex, lastIndex, { clear: !(e.ctrlKey || e.metaKey) });
@@ -4575,8 +4645,17 @@ class EnhancedSelect extends HTMLElement {
4575
4645
  }
4576
4646
  }
4577
4647
  _moveActive(delta, opts) {
4578
- const options = Array.from(this._optionsContainer.children);
4579
- const next = Math.max(0, Math.min(options.length - 1, this._state.activeIndex + delta));
4648
+ const selectableIndices = this._getSelectableOptionIndices();
4649
+ if (selectableIndices.length === 0)
4650
+ return;
4651
+ const currentPosition = selectableIndices.indexOf(this._state.activeIndex);
4652
+ const basePosition = currentPosition >= 0
4653
+ ? currentPosition
4654
+ : delta >= 0
4655
+ ? -1
4656
+ : selectableIndices.length;
4657
+ const nextPosition = Math.max(0, Math.min(selectableIndices.length - 1, basePosition + delta));
4658
+ const next = selectableIndices[nextPosition];
4580
4659
  this._setActive(next);
4581
4660
  if (this._config.selection.mode === 'multi' && opts?.shiftKey) {
4582
4661
  const anchor = this._rangeAnchorIndex ?? this._state.activeIndex;
@@ -4588,6 +4667,10 @@ class EnhancedSelect extends HTMLElement {
4588
4667
  }
4589
4668
  }
4590
4669
  _setActive(index) {
4670
+ const option = this._getOptionElementByIndex(index);
4671
+ if (!option || option.getAttribute('aria-disabled') === 'true') {
4672
+ return;
4673
+ }
4591
4674
  // Clear previous active state
4592
4675
  if (this._state.activeIndex >= 0) {
4593
4676
  const prevOption = this._getOptionElementByIndex(this._state.activeIndex);
@@ -4604,7 +4687,6 @@ class EnhancedSelect extends HTMLElement {
4604
4687
  }
4605
4688
  this._state.activeIndex = index;
4606
4689
  // Set new active state
4607
- const option = this._getOptionElementByIndex(index);
4608
4690
  if (option) {
4609
4691
  // Check if it's a custom SelectOption or a lightweight DOM element
4610
4692
  if ('setActive' in option && typeof option.setActive === 'function') {
@@ -4629,6 +4711,19 @@ class EnhancedSelect extends HTMLElement {
4629
4711
  _getOptionElementByIndex(index) {
4630
4712
  return this._optionsContainer.querySelector(`[data-index="${index}"]`);
4631
4713
  }
4714
+ _getSelectableOptions() {
4715
+ // Filter out group headers and other non-selectable elements
4716
+ // Only return elements with data-index or data-sm-selectable attributes
4717
+ return Array.from(this._optionsContainer.children).filter((child) => {
4718
+ return (child.hasAttribute('data-index') || child.hasAttribute('data-sm-selectable'))
4719
+ && child.getAttribute('aria-disabled') !== 'true';
4720
+ });
4721
+ }
4722
+ _getSelectableOptionIndices() {
4723
+ return this._getSelectableOptions()
4724
+ .map((option) => Number(option.getAttribute('data-sm-index') ?? option.getAttribute('data-index')))
4725
+ .filter((index) => Number.isFinite(index));
4726
+ }
4632
4727
  _buildRendererHelpers() {
4633
4728
  return {
4634
4729
  onSelect: (_item, index) => this._selectOption(index),
@@ -4663,26 +4758,29 @@ class EnhancedSelect extends HTMLElement {
4663
4758
  _selectAll() {
4664
4759
  if (this._config.selection.mode !== 'multi')
4665
4760
  return;
4666
- const options = Array.from(this._optionsContainer.children);
4761
+ const options = this._getSelectableOptions();
4667
4762
  const maxSelections = this._config.selection.maxSelections || 0;
4668
- options.forEach((option, index) => {
4763
+ options.forEach((option) => {
4764
+ const optionIndex = Number(option.getAttribute('data-sm-index') ?? option.getAttribute('data-index'));
4765
+ if (!Number.isFinite(optionIndex))
4766
+ return;
4669
4767
  if (maxSelections > 0 && this._state.selectedIndices.size >= maxSelections) {
4670
4768
  return;
4671
4769
  }
4672
- if (!this._state.selectedIndices.has(index)) {
4770
+ if (!this._state.selectedIndices.has(optionIndex)) {
4673
4771
  // Check if it's a custom SelectOption or a lightweight DOM element
4674
4772
  if ('getConfig' in option && typeof option.getConfig === 'function') {
4675
4773
  const config = option.getConfig();
4676
- this._state.selectedIndices.add(index);
4677
- this._state.selectedItems.set(index, config.item);
4774
+ this._state.selectedIndices.add(optionIndex);
4775
+ this._state.selectedItems.set(optionIndex, config.item);
4678
4776
  option.setSelected(true);
4679
4777
  }
4680
4778
  else {
4681
4779
  // Lightweight option - get item from data attribute or state
4682
- const item = this._state.loadedItems[index];
4780
+ const item = this._state.loadedItems[optionIndex];
4683
4781
  if (item) {
4684
- this._state.selectedIndices.add(index);
4685
- this._state.selectedItems.set(index, item);
4782
+ this._state.selectedIndices.add(optionIndex);
4783
+ this._state.selectedItems.set(optionIndex, item);
4686
4784
  option.classList.add('smilodon-option--selected');
4687
4785
  option.setAttribute('aria-selected', 'true');
4688
4786
  }
@@ -4706,6 +4804,9 @@ class EnhancedSelect extends HTMLElement {
4706
4804
  if (maxSelections > 0 && this._state.selectedIndices.size >= maxSelections)
4707
4805
  break;
4708
4806
  const item = this._state.loadedItems[i];
4807
+ const optionEl = this._getOptionElementByIndex(i);
4808
+ if (optionEl?.getAttribute('aria-disabled') === 'true')
4809
+ continue;
4709
4810
  if (!item)
4710
4811
  continue;
4711
4812
  this._state.selectedIndices.add(i);
@@ -4717,8 +4818,8 @@ class EnhancedSelect extends HTMLElement {
4717
4818
  this._announce(`${this._state.selectedIndices.size} items selected`);
4718
4819
  }
4719
4820
  _setInitialActiveOption() {
4720
- const options = Array.from(this._optionsContainer.children);
4721
- if (options.length === 0)
4821
+ const selectableIndices = this._getSelectableOptionIndices();
4822
+ if (selectableIndices.length === 0)
4722
4823
  return;
4723
4824
  const selected = Array.from(this._state.selectedIndices).sort((a, b) => a - b);
4724
4825
  if (this._config.selection.mode === 'multi' && selected.length === 0) {
@@ -4726,8 +4827,8 @@ class EnhancedSelect extends HTMLElement {
4726
4827
  this._input.removeAttribute('aria-activedescendant');
4727
4828
  return;
4728
4829
  }
4729
- const target = selected.length > 0 ? selected[0] : 0;
4730
- this._setActive(Math.min(target, options.length - 1));
4830
+ const target = selected.find((index) => selectableIndices.includes(index)) ?? selectableIndices[0];
4831
+ this._setActive(target);
4731
4832
  }
4732
4833
  _announce(message) {
4733
4834
  if (this._liveRegion) {