@smilodon/core 1.10.1 → 1.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2604,14 +2604,13 @@ class SelectOption extends HTMLElement {
2604
2604
  transition: var(--select-option-transition, background-color 0.2s ease);
2605
2605
  }
2606
2606
 
2607
- :host(:hover):not(.smilodon-option--disabled):not([aria-disabled="true"]),
2607
+ :host(:hover:not(.smilodon-option--disabled):not([aria-disabled="true"])),
2608
2608
  :host(.smilodon-option--disabled-hoverable:hover) {
2609
2609
  background: var(--select-option-hover-bg, #f0f0f0);
2610
2610
  color: var(--select-option-hover-color, var(--select-option-color, var(--select-text-color, #1f2937)));
2611
- border: var(--select-option-hover-border, var(--select-option-border, none));
2612
- border-bottom: var(--select-option-hover-border-bottom, var(--select-option-border-bottom, none));
2611
+ outline: var(--select-option-hover-border, none);
2612
+ outline-offset: -1px;
2613
2613
  box-shadow: var(--select-option-hover-shadow, var(--select-option-shadow, none));
2614
- transform: var(--select-option-hover-transform, var(--select-option-transform, none));
2615
2614
  }
2616
2615
 
2617
2616
  /* Keep the visual surface on the host so external utility classes applied
@@ -2632,10 +2631,9 @@ class SelectOption extends HTMLElement {
2632
2631
  :host(.smilodon-option--selected:hover) {
2633
2632
  background: var(--select-option-selected-hover-bg, var(--select-option-selected-bg, #e3f2fd));
2634
2633
  color: var(--select-option-selected-hover-color, var(--select-option-selected-color, #1976d2));
2635
- border: var(--select-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-border, none)));
2636
- border-bottom: var(--select-option-selected-hover-border-bottom, var(--select-option-selected-border-bottom, var(--select-option-border-bottom, none)));
2634
+ outline: var(--select-option-selected-hover-border, var(--select-option-hover-border, none));
2635
+ outline-offset: -1px;
2637
2636
  box-shadow: var(--select-option-selected-hover-shadow, var(--select-option-selected-shadow, var(--select-option-shadow, none)));
2638
- transform: var(--select-option-selected-hover-transform, var(--select-option-selected-transform, var(--select-option-transform, none)));
2639
2637
  }
2640
2638
 
2641
2639
  :host(.smilodon-option--active):not(.smilodon-option--disabled):not([aria-disabled="true"]),
@@ -5492,10 +5490,21 @@ class EnhancedSelect extends HTMLElement {
5492
5490
  const container = document.createElement('div');
5493
5491
  container.className = 'dropdown-arrow-container';
5494
5492
  container.innerHTML = `
5495
- <svg class="dropdown-arrow" part="arrow" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
5496
- <path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5497
- </svg>
5493
+ <slot name="arrow">
5494
+ <svg class="dropdown-arrow" part="arrow" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
5495
+ <path d="M4 6L8 10L12 6" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
5496
+ </svg>
5497
+ </slot>
5498
5498
  `;
5499
+ const slot = container.querySelector('slot[name="arrow"]');
5500
+ slot?.addEventListener('slotchange', () => {
5501
+ if (slot.assignedElements({ flatten: true }).length > 0) {
5502
+ this.setAttribute('data-custom-arrow', 'true');
5503
+ }
5504
+ else {
5505
+ this.removeAttribute('data-custom-arrow');
5506
+ }
5507
+ });
5499
5508
  return container;
5500
5509
  }
5501
5510
  _createClearControl() {
@@ -5651,7 +5660,7 @@ class EnhancedSelect extends HTMLElement {
5651
5660
  --select-scrollbar-width: 6px;
5652
5661
  --select-scrollbar-thumb-radius: 3px;
5653
5662
  --select-option-hover-enabled: 1;
5654
- --select-option-hover-transform: translateX(2px);
5663
+ --select-option-hover-transform: none;
5655
5664
  --select-option-font-weight: 450;
5656
5665
  --select-option-margin: 2px 0;
5657
5666
  --select-input-font-size: inherit;
@@ -6210,6 +6219,10 @@ class EnhancedSelect extends HTMLElement {
6210
6219
  .dropdown-arrow-container:hover {
6211
6220
  background-color: var(--select-arrow-hover-bg, rgba(15, 52, 96, 0.05));
6212
6221
  }
6222
+
6223
+ :host([data-custom-arrow="true"]) .dropdown-arrow-container:hover {
6224
+ background-color: transparent;
6225
+ }
6213
6226
 
6214
6227
  .dropdown-arrow {
6215
6228
  width: var(--select-arrow-width, var(--select-arrow-size, 16px));
@@ -6431,8 +6444,7 @@ class EnhancedSelect extends HTMLElement {
6431
6444
  transition: var(--select-option-transition,
6432
6445
  background var(--select-transition-fast),
6433
6446
  color var(--select-transition-fast),
6434
- border var(--select-transition-fast),
6435
- transform var(--select-transition-fast),
6447
+ outline-color var(--select-transition-fast),
6436
6448
  box-shadow var(--select-transition-fast)
6437
6449
  );
6438
6450
  user-select: none;
@@ -6446,9 +6458,10 @@ class EnhancedSelect extends HTMLElement {
6446
6458
  .option:hover:not(.disabled):not(.smilodon-option--disabled),
6447
6459
  .option.smilodon-option--disabled-hoverable:hover {
6448
6460
  background: var(--select-option-hover-bg, var(--select-surface-elevated));
6449
- border: var(--select-option-hover-border, var(--select-option-border, none));
6461
+ /* Hover decoration must not resize or translate the pointer hit target. */
6462
+ outline: var(--select-option-hover-border, none);
6463
+ outline-offset: -1px;
6450
6464
  color: var(--select-option-hover-color, var(--select-text));
6451
- transform: var(--select-option-hover-transform, none);
6452
6465
  }
6453
6466
 
6454
6467
  .option.selected {
@@ -6491,7 +6504,8 @@ class EnhancedSelect extends HTMLElement {
6491
6504
 
6492
6505
  .option.selected:hover {
6493
6506
  background: var(--select-option-selected-hover-bg, var(--select-option-selected-bg, linear-gradient(135deg, rgba(15, 52, 96, 0.12) 0%, rgba(15, 52, 96, 0.06) 100%)));
6494
- border: var(--select-option-selected-hover-border, var(--select-option-selected-border, var(--select-option-hover-border, var(--select-option-border, none))));
6507
+ outline: var(--select-option-selected-hover-border, var(--select-option-hover-border, none));
6508
+ outline-offset: -1px;
6495
6509
  color: var(--select-option-selected-hover-color, var(--select-option-selected-color, var(--select-accent)));
6496
6510
  }
6497
6511
 
@@ -7921,7 +7935,9 @@ class EnhancedSelect extends HTMLElement {
7921
7935
  _setInitialActiveOption() {
7922
7936
  const selectableIndices = this._getSelectableOptionIndices();
7923
7937
  const selected = Array.from(this._state.selectedIndices).sort((a, b) => a - b);
7924
- if (selectableIndices.length === 0 || (this._config.selection.mode === 'multi' && selected.length === 0)) {
7938
+ // Opening an empty select must not implicitly assign an active descendant.
7939
+ // Keyboard navigation and pointer interaction establish active identity.
7940
+ if (selectableIndices.length === 0 || selected.length === 0) {
7925
7941
  this._dispatchActiveKey(null, 'open', 'initial active option');
7926
7942
  return;
7927
7943
  }
@@ -8147,6 +8163,11 @@ class EnhancedSelect extends HTMLElement {
8147
8163
  }
8148
8164
  this._syncClearControlState();
8149
8165
  }
8166
+ _isActivelyEditingSearchInput() {
8167
+ return this._config.searchable === true
8168
+ && this._state.isOpen
8169
+ && this._shadow.activeElement === this._input;
8170
+ }
8150
8171
  _renderOptionsWithAnimation() {
8151
8172
  // Add fade-out animation
8152
8173
  this._optionsContainer.style.opacity = '0';
@@ -8456,7 +8477,7 @@ class EnhancedSelect extends HTMLElement {
8456
8477
  const previousLength = this._state.loadedItems.length;
8457
8478
  this._rebuildItemRegistry(items);
8458
8479
  this._state.groupedItems = this._groupItemsByProperty(items);
8459
- if (!this._state.searchQuery)
8480
+ if (!this._state.searchQuery && !this._isActivelyEditingSearchInput())
8460
8481
  this._updateInputDisplay();
8461
8482
  const newLength = this._state.loadedItems.length;
8462
8483
  if (this._dataRequestCoordinator) {
@@ -8537,7 +8558,7 @@ class EnhancedSelect extends HTMLElement {
8537
8558
  this._rebuildItemRegistry(groupedItems.flatMap(group => group.options));
8538
8559
  this._state.groupedItems = groupedItems;
8539
8560
  this._renderOptions();
8540
- if (!this._state.searchQuery)
8561
+ if (!this._state.searchQuery && !this._isActivelyEditingSearchInput())
8541
8562
  this._updateInputDisplay();
8542
8563
  }
8543
8564
  /**
@@ -8753,14 +8774,16 @@ class EnhancedSelect extends HTMLElement {
8753
8774
  // Re-initialize observers in case infinite scroll was enabled/disabled
8754
8775
  this._initializeObservers();
8755
8776
  this._syncClearControlState();
8756
- this._updateInputDisplay();
8777
+ if (!this._isActivelyEditingSearchInput())
8778
+ this._updateInputDisplay();
8757
8779
  this._renderOptions();
8758
8780
  }
8759
8781
  else {
8760
8782
  this._syncInputContainerMode();
8761
8783
  this._syncMultiSelectDisplayConfig();
8762
8784
  this._syncClearControlState();
8763
- this._updateInputDisplay();
8785
+ if (!this._isActivelyEditingSearchInput())
8786
+ this._updateInputDisplay();
8764
8787
  }
8765
8788
  this._acknowledgedSearchMode = this._dataLoadingConfig.searchMode;
8766
8789
  if (this._dataLoadingConfig.protocol === 'legacy')
@@ -9573,7 +9596,9 @@ class EnhancedSelect extends HTMLElement {
9573
9596
  this._acknowledgedProjectionFailureStageForTest = null;
9574
9597
  throw new Error('Injected acknowledged projection failure after publication');
9575
9598
  }
9576
- if (!this._state.searchQuery && this._acknowledgedPendingSearchQuery === null) {
9599
+ if (!this._state.searchQuery
9600
+ && this._acknowledgedPendingSearchQuery === null
9601
+ && !this._isActivelyEditingSearchInput()) {
9577
9602
  this._updateInputDisplay();
9578
9603
  }
9579
9604
  this._syncListboxAccessibility();