@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/dist/index.umd.js CHANGED
@@ -1604,7 +1604,7 @@
1604
1604
  transform: var(--select-option-selected-hover-transform, var(--select-option-selected-transform, var(--select-option-transform, none)));
1605
1605
  }
1606
1606
 
1607
- .option-container.active {
1607
+ .option-container.active:not(.disabled) {
1608
1608
  background: var(--select-option-active-bg, var(--select-option-hover-bg, #f0f0f0));
1609
1609
  color: var(--select-option-active-color, var(--select-option-hover-color, var(--select-option-color, var(--select-text-color, #1f2937))));
1610
1610
  border: var(--select-option-active-border, var(--select-option-hover-border, var(--select-option-border, none)));
@@ -1732,7 +1732,7 @@
1732
1732
  toggleClasses(this._container, [...selectedClasses, 'smilodon-option--selected'], false);
1733
1733
  toggleClasses(this, [...selectedClasses, 'smilodon-option--selected'], false);
1734
1734
  }
1735
- if (active) {
1735
+ if (active && !disabled) {
1736
1736
  toggleClasses(this._container, [...activeClasses, 'smilodon-option--active'], true);
1737
1737
  toggleClasses(this, [...activeClasses, 'smilodon-option--active'], true); // Make focus ring visible on host
1738
1738
  }
@@ -1800,8 +1800,12 @@
1800
1800
  // Set ARIA attributes and State attributes on Host
1801
1801
  this.setAttribute('role', 'option');
1802
1802
  this.setAttribute('aria-selected', String(selected));
1803
- if (disabled)
1803
+ if (disabled) {
1804
1804
  this.setAttribute('aria-disabled', 'true');
1805
+ }
1806
+ else {
1807
+ this.removeAttribute('aria-disabled');
1808
+ }
1805
1809
  this.id = this._config.id || `select-option-${index}`;
1806
1810
  // Add checkmark (part="checkmark") - standard for object mode
1807
1811
  // Only show if NOT showing remove button (avoid clutter)
@@ -1820,7 +1824,7 @@
1820
1824
  const state = [];
1821
1825
  if (selected)
1822
1826
  state.push('selected');
1823
- if (active)
1827
+ if (active && !disabled)
1824
1828
  state.push('active');
1825
1829
  if (state.length) {
1826
1830
  this.dataset.smState = state.join(' ');
@@ -1944,7 +1948,7 @@
1944
1948
  * Set active state
1945
1949
  */
1946
1950
  setActive(active) {
1947
- this._config.active = active;
1951
+ this._config.active = active && !this._config.disabled;
1948
1952
  this._render();
1949
1953
  }
1950
1954
  /**
@@ -2457,11 +2461,11 @@
2457
2461
  this._inputContainer.removeAttribute('data-multi-scroll-mode');
2458
2462
  this._inputContainer.removeAttribute('data-drag-scroll');
2459
2463
  this._inputContainer.classList.remove('is-dragging-scroll');
2460
- this._inputContainer.style.removeProperty('--select-multi-input-max-height');
2461
- this._inputContainer.style.removeProperty('--select-multi-input-overflow-x');
2462
- this._inputContainer.style.removeProperty('--select-multi-input-overflow-y');
2463
- this._inputContainer.style.removeProperty('--select-multi-input-flex-wrap');
2464
- this._inputContainer.style.removeProperty('--select-multi-input-align-content');
2464
+ this._inputContainer.style.removeProperty('--select-multi-input-max-height-config');
2465
+ this._inputContainer.style.removeProperty('--select-multi-input-overflow-x-config');
2466
+ this._inputContainer.style.removeProperty('--select-multi-input-overflow-y-config');
2467
+ this._inputContainer.style.removeProperty('--select-multi-input-flex-wrap-config');
2468
+ this._inputContainer.style.removeProperty('--select-multi-input-align-content-config');
2465
2469
  return;
2466
2470
  }
2467
2471
  const maxHeight = this._config.multiSelectDisplay?.maxHeight ?? '160px';
@@ -2471,11 +2475,11 @@
2471
2475
  const alignContent = mode === 'horizontal' ? 'center' : 'flex-start';
2472
2476
  this._inputContainer.setAttribute('data-multi-scroll-mode', mode);
2473
2477
  this._inputContainer.setAttribute('data-drag-scroll', String(dragEnabled && mode === 'horizontal'));
2474
- this._inputContainer.style.setProperty('--select-multi-input-max-height', maxHeight);
2475
- this._inputContainer.style.setProperty('--select-multi-input-overflow-x', overflowX);
2476
- this._inputContainer.style.setProperty('--select-multi-input-overflow-y', overflowY);
2477
- this._inputContainer.style.setProperty('--select-multi-input-flex-wrap', flexWrap);
2478
- this._inputContainer.style.setProperty('--select-multi-input-align-content', alignContent);
2478
+ this._inputContainer.style.setProperty('--select-multi-input-max-height-config', maxHeight);
2479
+ this._inputContainer.style.setProperty('--select-multi-input-overflow-x-config', overflowX);
2480
+ this._inputContainer.style.setProperty('--select-multi-input-overflow-y-config', overflowY);
2481
+ this._inputContainer.style.setProperty('--select-multi-input-flex-wrap-config', flexWrap);
2482
+ this._inputContainer.style.setProperty('--select-multi-input-align-content-config', alignContent);
2479
2483
  }
2480
2484
  _canUseHorizontalMultiScroll(target) {
2481
2485
  if (this._config.selection.mode !== 'multi')
@@ -2725,7 +2729,7 @@
2725
2729
  --select-accent: #0f3460;
2726
2730
  --select-accent-hover: #e94560;
2727
2731
  --select-surface: #ffffff;
2728
- --select-surface-elevated: #fafbfc;
2732
+ --select-surface-elevated: rgba(0, 0, 0, 0.04);
2729
2733
  --select-border: #e1e5eb;
2730
2734
  --select-border-focus: #0f3460;
2731
2735
  --select-text: #1a1a2e;
@@ -2773,16 +2777,15 @@
2773
2777
  --select-multi-input-horizontal-cursor: grab;
2774
2778
  --select-multi-input-horizontal-active-cursor: grabbing;
2775
2779
  --select-multi-separator-inset-block: 10px;
2780
+ --select-multi-separator-height: auto;
2776
2781
  --select-multi-action-surface-bg: var(--select-input-bg, var(--select-surface));
2777
2782
  --select-multi-action-divider: 1px solid var(--select-border);
2778
2783
  --select-separator-width: 1px;
2779
- --select-separator-height: 50%;
2784
+ --select-separator-inset-block: 10px;
2785
+ --select-separator-height: auto;
2780
2786
  --select-separator-display: block;
2781
2787
  --select-separator-opacity: 0.6;
2782
2788
  --select-separator-active-opacity: 1;
2783
- --select-separator-width: 1px;
2784
- --select-separator-height: 50%;
2785
- --select-separator-display: block;
2786
2789
  --select-separator-position: var(--select-arrow-width, 42px);
2787
2790
  --select-separator-position-with-clear: calc(var(--select-arrow-right-with-clear, 34px) + var(--select-arrow-width, 42px));
2788
2791
  --select-separator-dark-bg: linear-gradient(
@@ -2853,9 +2856,9 @@
2853
2856
  --select-searching-spinner-size: 24px;
2854
2857
  --select-searching-spinner-border: 2px solid var(--select-border);
2855
2858
  --select-searching-spinner-animation: var(--select-spinner-animation);
2856
- --select-group-header-separator-margin-top: 8px;
2857
- --select-group-header-separator-padding-top: 14px;
2858
- --select-group-header-separator-border-top: 1px solid var(--select-border);
2859
+ --select-group-header-separator-margin-top: 0;
2860
+ --select-group-header-separator-padding-top: 0;
2861
+ --select-group-header-separator-border-top: none;
2859
2862
  --select-reduced-motion-duration: 0.01ms;
2860
2863
  --select-reduced-motion-iteration-count: 1;
2861
2864
  --select-high-contrast-border-width: 2px;
@@ -3104,21 +3107,20 @@
3104
3107
  }
3105
3108
 
3106
3109
  .input-container.input-container--multi {
3107
- max-height: var(--select-multi-input-max-height, var(--select-input-max-height, 160px));
3110
+ max-height: var(--select-multi-input-max-height, var(--select-multi-input-max-height-config, var(--select-input-max-height, 160px)));
3108
3111
  }
3109
3112
 
3110
3113
  .input-container.input-container--multi .input-content {
3111
- flex-wrap: var(--select-multi-input-flex-wrap, wrap);
3112
- align-content: var(--select-multi-input-align-content, flex-start);
3113
- overflow-x: var(--select-multi-input-overflow-x, hidden);
3114
- overflow-y: var(--select-multi-input-overflow-y, auto);
3114
+ flex-wrap: var(--select-multi-input-flex-wrap, var(--select-multi-input-flex-wrap-config, wrap));
3115
+ align-content: var(--select-multi-input-align-content, var(--select-multi-input-align-content-config, flex-start));
3116
+ overflow-x: var(--select-multi-input-overflow-x, var(--select-multi-input-overflow-x-config, hidden));
3117
+ overflow-y: var(--select-multi-input-overflow-y, var(--select-multi-input-overflow-y-config, auto));
3115
3118
  }
3116
3119
 
3117
3120
  .input-container.input-container--multi::after {
3118
- top: var(--select-multi-separator-inset-block, 10px);
3119
- bottom: var(--select-multi-separator-inset-block, 10px);
3120
- height: auto;
3121
- transform: none;
3121
+ top: var(--select-multi-separator-inset-block, var(--select-separator-inset-block, 10px));
3122
+ bottom: var(--select-multi-separator-inset-block, var(--select-separator-inset-block, 10px));
3123
+ height: var(--select-multi-separator-height, auto);
3122
3124
  }
3123
3125
 
3124
3126
  .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] {
@@ -3129,6 +3131,11 @@
3129
3131
  cursor: var(--select-multi-input-horizontal-cursor, grab);
3130
3132
  overflow-y: hidden;
3131
3133
  overscroll-behavior-x: contain;
3134
+ padding-right: calc(var(--select-arrow-width, 42px) + var(--select-multi-horizontal-end-gap, 12px));
3135
+ }
3136
+
3137
+ .input-container.input-container--multi[data-multi-scroll-mode="horizontal"].has-clear-control .input-content {
3138
+ 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));
3132
3139
  }
3133
3140
 
3134
3141
  .input-container.input-container--multi[data-multi-scroll-mode="horizontal"]::after {
@@ -3170,6 +3177,15 @@
3170
3177
  left: var(--select-arrow-right-with-clear, 34px);
3171
3178
  }
3172
3179
 
3180
+ :host([dir="rtl"]) .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .input-content {
3181
+ padding-right: 0;
3182
+ padding-left: calc(var(--select-arrow-width, 42px) + var(--select-multi-horizontal-end-gap, 12px));
3183
+ }
3184
+
3185
+ :host([dir="rtl"]) .input-container.input-container--multi[data-multi-scroll-mode="horizontal"].has-clear-control .input-content {
3186
+ 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));
3187
+ }
3188
+
3173
3189
  .input-container.input-container--multi[data-multi-scroll-mode="horizontal"] .clear-control-button {
3174
3190
  background: var(--select-multi-action-surface-bg, var(--select-input-bg, var(--select-surface)));
3175
3191
  z-index: 4;
@@ -3185,11 +3201,11 @@
3185
3201
  content: '';
3186
3202
  display: var(--select-separator-display, block);
3187
3203
  position: absolute;
3188
- top: 50%;
3204
+ top: var(--select-separator-inset-block, 10px);
3205
+ bottom: var(--select-separator-inset-block, 10px);
3189
3206
  right: var(--select-separator-position, var(--select-arrow-width, 42px));
3190
- transform: translateY(-50%);
3191
3207
  width: var(--select-separator-width, 1px);
3192
- height: var(--select-separator-height, 50%);
3208
+ height: var(--select-separator-height, auto);
3193
3209
  background: var(--select-separator-bg, linear-gradient(
3194
3210
  to bottom,
3195
3211
  transparent 0%,
@@ -3523,8 +3539,10 @@
3523
3539
  }
3524
3540
 
3525
3541
  .group-header:not(:first-child) {
3526
- margin-top: var(--select-group-header-separator-margin-top);
3527
- padding-top: var(--select-group-header-separator-padding-top);
3542
+ margin-top: calc(
3543
+ var(--select-group-header-separator-margin-top, 0px) +
3544
+ var(--select-group-header-separator-padding-top, 0px)
3545
+ );
3528
3546
  border-top: var(--select-group-header-separator-border-top);
3529
3547
  }
3530
3548
 
@@ -3539,13 +3557,15 @@
3539
3557
  color: var(--select-option-color, var(--select-text));
3540
3558
  background: var(--select-option-bg, transparent);
3541
3559
  border: var(--select-option-border, none);
3560
+ box-sizing: border-box;
3542
3561
  text-align: var(--select-option-text-align, start);
3543
- transition:
3562
+ transition: var(--select-option-transition,
3544
3563
  background var(--select-transition-fast),
3545
3564
  color var(--select-transition-fast),
3546
- border-color var(--select-transition-fast),
3565
+ border var(--select-transition-fast),
3547
3566
  transform var(--select-transition-fast),
3548
- box-shadow var(--select-transition-fast);
3567
+ box-shadow var(--select-transition-fast)
3568
+ );
3549
3569
  user-select: none;
3550
3570
  font-size: var(--select-option-font-size, inherit);
3551
3571
  font-weight: var(--select-option-font-weight);
@@ -3555,10 +3575,10 @@
3555
3575
  }
3556
3576
 
3557
3577
  .option:hover {
3558
- background: calc(var(--select-option-hover-enabled, 1) * 1) > 0 ? var(--select-option-hover-bg, var(--select-surface-elevated)) : var(--select-option-bg, transparent);
3559
- 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);
3560
- 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));
3561
- transform: calc(var(--select-option-hover-enabled, 1) * 1) > 0 ? var(--select-option-hover-transform) : none;
3578
+ background: var(--select-option-hover-bg, var(--select-surface-elevated));
3579
+ border: var(--select-option-hover-border, var(--select-option-border, none));
3580
+ color: var(--select-option-hover-color, var(--select-text));
3581
+ transform: var(--select-option-hover-transform, none);
3562
3582
  }
3563
3583
 
3564
3584
  .option.selected {
@@ -3604,7 +3624,7 @@
3604
3624
  color: var(--select-option-selected-hover-color, var(--select-option-selected-color, var(--select-accent)));
3605
3625
  }
3606
3626
 
3607
- .option.active:not(.selected) {
3627
+ .option.active:not(.selected):not(.disabled) {
3608
3628
  background: var(--select-option-active-bg, var(--select-surface-elevated));
3609
3629
  color: var(--select-option-active-color, var(--select-option-hover-color, var(--select-option-color, var(--select-text))));
3610
3630
  border: var(--select-option-active-border, var(--select-option-hover-border, var(--select-option-border, none)));
@@ -3614,7 +3634,7 @@
3614
3634
  transform: var(--select-option-active-transform, none);
3615
3635
  }
3616
3636
 
3617
- .option.selected.active {
3637
+ .option.selected.active:not(.disabled) {
3618
3638
  outline: var(--select-option-selected-active-outline, 2px solid rgba(15, 52, 96, 0.4));
3619
3639
  outline-offset: var(--select-option-selected-active-outline-offset);
3620
3640
  }
@@ -3832,6 +3852,9 @@
3832
3852
 
3833
3853
  --select-badge-bg: var(--select-dark-badge-bg, rgba(99, 102, 241, 0.2));
3834
3854
  --select-badge-color: var(--select-dark-badge-color, #e0e7ff);
3855
+ --select-badge-border: var(--select-dark-badge-border, var(--select-badge-border, none));
3856
+ --select-badge-hover-border: var(--select-dark-badge-hover-border, var(--select-badge-hover-border, var(--select-badge-border, none)));
3857
+ --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))));
3835
3858
 
3836
3859
  --select-group-header-bg: var(--select-group-header-dark-bg, #1a1a2e);
3837
3860
  --select-group-header-color: var(--select-group-header-dark-color, #9ca3af);
@@ -3840,12 +3863,16 @@
3840
3863
 
3841
3864
  --select-option-bg: var(--select-dark-option-bg, transparent);
3842
3865
  --select-option-color: var(--select-dark-option-color, var(--select-text));
3866
+ --select-option-border: var(--select-dark-option-border, none);
3843
3867
  --select-option-hover-bg: var(--select-dark-option-hover-bg, var(--select-surface-elevated));
3844
3868
  --select-option-hover-color: var(--select-dark-option-hover-color, var(--select-text));
3869
+ --select-option-hover-border: var(--select-dark-option-hover-border, var(--select-option-border, none));
3845
3870
  --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%));
3846
3871
  --select-option-selected-color: var(--select-dark-option-selected-color, #a5b4fc);
3872
+ --select-option-selected-border: var(--select-dark-option-selected-border, var(--select-option-border, none));
3847
3873
  --select-option-selected-hover-bg: var(--select-dark-option-selected-hover-bg, var(--select-option-selected-bg));
3848
3874
  --select-option-selected-hover-color: var(--select-dark-option-selected-hover-color, var(--select-option-selected-color));
3875
+ --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))));
3849
3876
  }
3850
3877
 
3851
3878
  :host(.dark-mode) .input-container,
@@ -3863,6 +3890,36 @@
3863
3890
  border-color: var(--select-border);
3864
3891
  }
3865
3892
 
3893
+ :host(.dark-mode) .input-container:hover,
3894
+ :host([dark-mode]) .input-container:hover,
3895
+ :host([darkmode]) .input-container:hover,
3896
+ :host([data-theme="dark"]) .input-container:hover,
3897
+ :host([theme="dark"]) .input-container:hover,
3898
+ :host-context(.dark-mode) .input-container:hover,
3899
+ :host-context(.dark) .input-container:hover,
3900
+ :host-context([dark-mode]) .input-container:hover,
3901
+ :host-context([darkmode]) .input-container:hover,
3902
+ :host-context([data-theme="dark"]) .input-container:hover,
3903
+ :host-context([theme="dark"]) .input-container:hover {
3904
+ border-color: var(--select-dark-input-hover-border, var(--select-input-hover-border, var(--select-dark-border-focus, var(--select-border-focus, #6366f1))));
3905
+ 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)));
3906
+ }
3907
+
3908
+ :host(.dark-mode) .input-container:focus-within,
3909
+ :host([dark-mode]) .input-container:focus-within,
3910
+ :host([darkmode]) .input-container:focus-within,
3911
+ :host([data-theme="dark"]) .input-container:focus-within,
3912
+ :host([theme="dark"]) .input-container:focus-within,
3913
+ :host-context(.dark-mode) .input-container:focus-within,
3914
+ :host-context(.dark) .input-container:focus-within,
3915
+ :host-context([dark-mode]) .input-container:focus-within,
3916
+ :host-context([darkmode]) .input-container:focus-within,
3917
+ :host-context([data-theme="dark"]) .input-container:focus-within,
3918
+ :host-context([theme="dark"]) .input-container:focus-within {
3919
+ border-color: var(--select-dark-border-focus, var(--select-border-focus, #6366f1));
3920
+ 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);
3921
+ }
3922
+
3866
3923
  :host(.dark-mode) .input-container::after,
3867
3924
  :host([dark-mode]) .input-container::after,
3868
3925
  :host([darkmode]) .input-container::after,
@@ -3918,7 +3975,8 @@
3918
3975
  :host-context([darkmode]) .selection-badge,
3919
3976
  :host-context([data-theme="dark"]) .selection-badge,
3920
3977
  :host-context([theme="dark"]) .selection-badge {
3921
- background: var(--select-badge-dark-bg);
3978
+ background: var(--select-dark-badge-bg, var(--select-badge-bg, var(--select-badge-dark-bg)));
3979
+ color: var(--select-dark-badge-color, var(--select-badge-color, #e0e7ff));
3922
3980
  }
3923
3981
 
3924
3982
  :host(.dark-mode) .group-header:not(:first-child),
@@ -4099,6 +4157,10 @@
4099
4157
  this._inputContent.addEventListener('wheel', (e) => {
4100
4158
  if (this._config.selection.mode === 'multi'
4101
4159
  && (this._config.multiSelectDisplay?.mode ?? 'wrap') === 'horizontal') {
4160
+ const primaryDelta = Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY;
4161
+ if (primaryDelta !== 0) {
4162
+ this._inputContent.scrollLeft += primaryDelta;
4163
+ }
4102
4164
  e.preventDefault();
4103
4165
  }
4104
4166
  }, { passive: false });
@@ -4493,6 +4555,8 @@
4493
4555
  }
4494
4556
  }
4495
4557
  _handleKeydown(e) {
4558
+ if (!this._config.enabled)
4559
+ return;
4496
4560
  switch (e.key) {
4497
4561
  case 'ArrowDown':
4498
4562
  e.preventDefault();
@@ -4515,17 +4579,23 @@
4515
4579
  case 'Home':
4516
4580
  e.preventDefault();
4517
4581
  if (this._state.isOpen) {
4518
- this._setActive(0);
4582
+ const selectableIndices = this._getSelectableOptionIndices();
4583
+ const firstIndex = selectableIndices[0];
4584
+ if (firstIndex === undefined)
4585
+ break;
4586
+ this._setActive(firstIndex);
4519
4587
  if (this._config.selection.mode === 'multi' && e.shiftKey) {
4520
- this._selectRange(this._rangeAnchorIndex ?? 0, 0, { clear: !(e.ctrlKey || e.metaKey) });
4588
+ this._selectRange(this._rangeAnchorIndex ?? firstIndex, firstIndex, { clear: !(e.ctrlKey || e.metaKey) });
4521
4589
  }
4522
4590
  }
4523
4591
  break;
4524
4592
  case 'End':
4525
4593
  e.preventDefault();
4526
4594
  if (this._state.isOpen) {
4527
- const options = Array.from(this._optionsContainer.children);
4528
- const lastIndex = Math.max(0, options.length - 1);
4595
+ const selectableIndices = this._getSelectableOptionIndices();
4596
+ const lastIndex = selectableIndices[selectableIndices.length - 1];
4597
+ if (lastIndex === undefined)
4598
+ break;
4529
4599
  this._setActive(lastIndex);
4530
4600
  if (this._config.selection.mode === 'multi' && e.shiftKey) {
4531
4601
  this._selectRange(this._rangeAnchorIndex ?? lastIndex, lastIndex, { clear: !(e.ctrlKey || e.metaKey) });
@@ -4579,8 +4649,17 @@
4579
4649
  }
4580
4650
  }
4581
4651
  _moveActive(delta, opts) {
4582
- const options = Array.from(this._optionsContainer.children);
4583
- const next = Math.max(0, Math.min(options.length - 1, this._state.activeIndex + delta));
4652
+ const selectableIndices = this._getSelectableOptionIndices();
4653
+ if (selectableIndices.length === 0)
4654
+ return;
4655
+ const currentPosition = selectableIndices.indexOf(this._state.activeIndex);
4656
+ const basePosition = currentPosition >= 0
4657
+ ? currentPosition
4658
+ : delta >= 0
4659
+ ? -1
4660
+ : selectableIndices.length;
4661
+ const nextPosition = Math.max(0, Math.min(selectableIndices.length - 1, basePosition + delta));
4662
+ const next = selectableIndices[nextPosition];
4584
4663
  this._setActive(next);
4585
4664
  if (this._config.selection.mode === 'multi' && opts?.shiftKey) {
4586
4665
  const anchor = this._rangeAnchorIndex ?? this._state.activeIndex;
@@ -4592,6 +4671,10 @@
4592
4671
  }
4593
4672
  }
4594
4673
  _setActive(index) {
4674
+ const option = this._getOptionElementByIndex(index);
4675
+ if (!option || option.getAttribute('aria-disabled') === 'true') {
4676
+ return;
4677
+ }
4595
4678
  // Clear previous active state
4596
4679
  if (this._state.activeIndex >= 0) {
4597
4680
  const prevOption = this._getOptionElementByIndex(this._state.activeIndex);
@@ -4608,7 +4691,6 @@
4608
4691
  }
4609
4692
  this._state.activeIndex = index;
4610
4693
  // Set new active state
4611
- const option = this._getOptionElementByIndex(index);
4612
4694
  if (option) {
4613
4695
  // Check if it's a custom SelectOption or a lightweight DOM element
4614
4696
  if ('setActive' in option && typeof option.setActive === 'function') {
@@ -4633,6 +4715,19 @@
4633
4715
  _getOptionElementByIndex(index) {
4634
4716
  return this._optionsContainer.querySelector(`[data-index="${index}"]`);
4635
4717
  }
4718
+ _getSelectableOptions() {
4719
+ // Filter out group headers and other non-selectable elements
4720
+ // Only return elements with data-index or data-sm-selectable attributes
4721
+ return Array.from(this._optionsContainer.children).filter((child) => {
4722
+ return (child.hasAttribute('data-index') || child.hasAttribute('data-sm-selectable'))
4723
+ && child.getAttribute('aria-disabled') !== 'true';
4724
+ });
4725
+ }
4726
+ _getSelectableOptionIndices() {
4727
+ return this._getSelectableOptions()
4728
+ .map((option) => Number(option.getAttribute('data-sm-index') ?? option.getAttribute('data-index')))
4729
+ .filter((index) => Number.isFinite(index));
4730
+ }
4636
4731
  _buildRendererHelpers() {
4637
4732
  return {
4638
4733
  onSelect: (_item, index) => this._selectOption(index),
@@ -4667,26 +4762,29 @@
4667
4762
  _selectAll() {
4668
4763
  if (this._config.selection.mode !== 'multi')
4669
4764
  return;
4670
- const options = Array.from(this._optionsContainer.children);
4765
+ const options = this._getSelectableOptions();
4671
4766
  const maxSelections = this._config.selection.maxSelections || 0;
4672
- options.forEach((option, index) => {
4767
+ options.forEach((option) => {
4768
+ const optionIndex = Number(option.getAttribute('data-sm-index') ?? option.getAttribute('data-index'));
4769
+ if (!Number.isFinite(optionIndex))
4770
+ return;
4673
4771
  if (maxSelections > 0 && this._state.selectedIndices.size >= maxSelections) {
4674
4772
  return;
4675
4773
  }
4676
- if (!this._state.selectedIndices.has(index)) {
4774
+ if (!this._state.selectedIndices.has(optionIndex)) {
4677
4775
  // Check if it's a custom SelectOption or a lightweight DOM element
4678
4776
  if ('getConfig' in option && typeof option.getConfig === 'function') {
4679
4777
  const config = option.getConfig();
4680
- this._state.selectedIndices.add(index);
4681
- this._state.selectedItems.set(index, config.item);
4778
+ this._state.selectedIndices.add(optionIndex);
4779
+ this._state.selectedItems.set(optionIndex, config.item);
4682
4780
  option.setSelected(true);
4683
4781
  }
4684
4782
  else {
4685
4783
  // Lightweight option - get item from data attribute or state
4686
- const item = this._state.loadedItems[index];
4784
+ const item = this._state.loadedItems[optionIndex];
4687
4785
  if (item) {
4688
- this._state.selectedIndices.add(index);
4689
- this._state.selectedItems.set(index, item);
4786
+ this._state.selectedIndices.add(optionIndex);
4787
+ this._state.selectedItems.set(optionIndex, item);
4690
4788
  option.classList.add('smilodon-option--selected');
4691
4789
  option.setAttribute('aria-selected', 'true');
4692
4790
  }
@@ -4710,6 +4808,9 @@
4710
4808
  if (maxSelections > 0 && this._state.selectedIndices.size >= maxSelections)
4711
4809
  break;
4712
4810
  const item = this._state.loadedItems[i];
4811
+ const optionEl = this._getOptionElementByIndex(i);
4812
+ if (optionEl?.getAttribute('aria-disabled') === 'true')
4813
+ continue;
4713
4814
  if (!item)
4714
4815
  continue;
4715
4816
  this._state.selectedIndices.add(i);
@@ -4721,8 +4822,8 @@
4721
4822
  this._announce(`${this._state.selectedIndices.size} items selected`);
4722
4823
  }
4723
4824
  _setInitialActiveOption() {
4724
- const options = Array.from(this._optionsContainer.children);
4725
- if (options.length === 0)
4825
+ const selectableIndices = this._getSelectableOptionIndices();
4826
+ if (selectableIndices.length === 0)
4726
4827
  return;
4727
4828
  const selected = Array.from(this._state.selectedIndices).sort((a, b) => a - b);
4728
4829
  if (this._config.selection.mode === 'multi' && selected.length === 0) {
@@ -4730,8 +4831,8 @@
4730
4831
  this._input.removeAttribute('aria-activedescendant');
4731
4832
  return;
4732
4833
  }
4733
- const target = selected.length > 0 ? selected[0] : 0;
4734
- this._setActive(Math.min(target, options.length - 1));
4834
+ const target = selected.find((index) => selectableIndices.includes(index)) ?? selectableIndices[0];
4835
+ this._setActive(target);
4735
4836
  }
4736
4837
  _announce(message) {
4737
4838
  if (this._liveRegion) {