@smilodon/core 1.21.0 → 1.23.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.cjs CHANGED
@@ -2206,6 +2206,7 @@ const defaultConfig = {
2206
2206
  selectable: false,
2207
2207
  hoverable: false,
2208
2208
  focusable: false,
2209
+ closeOnClick: false,
2209
2210
  },
2210
2211
  maxSelections: 0,
2211
2212
  showRemoveButton: true,
@@ -2252,6 +2253,7 @@ const defaultConfig = {
2252
2253
  minDisplayTime: 200,
2253
2254
  contentMode: 'append',
2254
2255
  },
2256
+ searchingMessage: 'Searching...',
2255
2257
  styles: {
2256
2258
  classNames: {},
2257
2259
  },
@@ -2740,6 +2742,7 @@ class SelectOption extends HTMLElement {
2740
2742
  :host {
2741
2743
  display: block;
2742
2744
  position: relative;
2745
+ z-index: var(--select-option-z-index, auto);
2743
2746
  font: inherit;
2744
2747
  color: var(--select-option-color, var(--select-text-color, #1f2937));
2745
2748
  background: var(--select-option-bg, var(--select-dropdown-bg, var(--select-bg, white)));
@@ -2802,7 +2805,7 @@ class SelectOption extends HTMLElement {
2802
2805
  border-bottom: var(--select-option-disabled-border-bottom, var(--select-option-border-bottom, none));
2803
2806
  opacity: var(--select-option-disabled-opacity, 0.5);
2804
2807
  cursor: var(--select-option-disabled-cursor, not-allowed);
2805
- pointer-events: none;
2808
+ pointer-events: auto;
2806
2809
  }
2807
2810
 
2808
2811
  :host(.smilodon-option--disabled-interactive) {
@@ -2872,7 +2875,7 @@ class SelectOption extends HTMLElement {
2872
2875
  border-bottom: inherit;
2873
2876
  opacity: inherit;
2874
2877
  cursor: inherit;
2875
- pointer-events: none;
2878
+ pointer-events: auto;
2876
2879
  }
2877
2880
 
2878
2881
  .option-content {
@@ -2940,6 +2943,15 @@ class SelectOption extends HTMLElement {
2940
2943
  pointer-events: none;
2941
2944
  }
2942
2945
 
2946
+ .remove-button-icon > [data-smilodon-fallback-icon],
2947
+ .remove-button-icon > [data-smilodon-react-icon-root] {
2948
+ display: contents;
2949
+ }
2950
+
2951
+ .remove-button-icon[data-smilodon-icon-owner="react"] > [data-smilodon-fallback-icon] {
2952
+ display: none;
2953
+ }
2954
+
2943
2955
  .remove-button-icon svg {
2944
2956
  width: 100%;
2945
2957
  height: 100%;
@@ -2964,6 +2976,7 @@ class SelectOption extends HTMLElement {
2964
2976
  selectable: behavior.selectable === true,
2965
2977
  hoverable: behavior.hoverable === true,
2966
2978
  focusable: behavior.focusable === true,
2979
+ closeOnClick: behavior.closeOnClick === true,
2967
2980
  };
2968
2981
  }
2969
2982
  _isDisabledSelectionBlocked() {
@@ -3062,15 +3075,20 @@ class SelectOption extends HTMLElement {
3062
3075
  const removeIcon = document.createElement('span');
3063
3076
  removeIcon.className = 'remove-button-icon';
3064
3077
  removeIcon.setAttribute('part', 'chip-remove-icon');
3078
+ const fallbackIcon = document.createElement('span');
3079
+ fallbackIcon.setAttribute('data-smilodon-fallback-icon', '');
3080
+ const portalRoot = document.createElement('span');
3081
+ portalRoot.setAttribute('data-smilodon-react-icon-root', '');
3065
3082
  const iconMarkup = this._config.removeButtonIcon && this._config.removeButtonIcon.trim()
3066
3083
  ? this._config.removeButtonIcon
3067
3084
  : '×';
3068
3085
  if (iconMarkup.trim().startsWith('<')) {
3069
- removeIcon.innerHTML = iconMarkup;
3086
+ fallbackIcon.innerHTML = iconMarkup;
3070
3087
  }
3071
3088
  else {
3072
- removeIcon.textContent = iconMarkup;
3089
+ fallbackIcon.textContent = iconMarkup;
3073
3090
  }
3091
+ removeIcon.append(fallbackIcon, portalRoot);
3074
3092
  this._removeButton.appendChild(removeIcon);
3075
3093
  this._container.appendChild(this._removeButton);
3076
3094
  }
@@ -4336,6 +4354,12 @@ class DataRequestCoordinator {
4336
4354
  *
4337
4355
  * Redesigned with formal elegance, refined microinteractions, and polished UX
4338
4356
  */
4357
+ const DROPDOWN_BORDER_LONGHANDS = [
4358
+ 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width',
4359
+ 'border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style',
4360
+ 'border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color',
4361
+ 'border-image-source', 'border-image-slice', 'border-image-width', 'border-image-outset', 'border-image-repeat',
4362
+ ];
4339
4363
  const LEGACY_DATA_LOADING_CONFIG = {
4340
4364
  protocol: 'legacy',
4341
4365
  searchMode: 'local',
@@ -4454,6 +4478,8 @@ class EnhancedSelect extends HTMLElement {
4454
4478
  this._selectedLabelTooltipResizeObserver = null;
4455
4479
  this._selectedLabelTooltipMeasureFrame = null;
4456
4480
  this._selectedLabelKeys = new WeakMap();
4481
+ this._dropdownConfigInlineStyles = new Map();
4482
+ this._managedLoaderClasses = new Set();
4457
4483
  this._busyPresentationVisible = false;
4458
4484
  this._busyPresentationStartedAt = null;
4459
4485
  this._busyPresentationGeneration = 0;
@@ -4684,9 +4710,11 @@ class EnhancedSelect extends HTMLElement {
4684
4710
  this._inputContent = this._createInputContent();
4685
4711
  this._input = this._createInput();
4686
4712
  this._selectedLabelTooltip = this._createSelectedLabelTooltip();
4713
+ this._selectedLabelTooltipTextMeasure = this._createSelectedLabelTooltipTextMeasure();
4687
4714
  this._arrowContainer = this._createArrowContainer();
4688
4715
  this._clearControl = this._createClearControl();
4689
4716
  this._dropdown = this._createDropdown();
4717
+ this._syncDropdownConfigInlineStyles();
4690
4718
  this._optionsContainer = this._createOptionsContainer();
4691
4719
  this._liveRegion = this._createLiveRegion();
4692
4720
  this._errorDescription = this._createErrorDescription();
@@ -4703,6 +4731,9 @@ class EnhancedSelect extends HTMLElement {
4703
4731
  }
4704
4732
  connectedCallback() {
4705
4733
  this._hasEverConnected = true;
4734
+ // Adapter capability marker without adding a field to the public class
4735
+ // declaration. React-node remove icons require the isolated root contract.
4736
+ this.setAttribute('data-smilodon-react-icon-portals', 'isolated-v1');
4706
4737
  // register instance
4707
4738
  EnhancedSelect._instances.add(this);
4708
4739
  this._runEngineEffects(this._engine.dispatch({ type: 'CONNECT' }));
@@ -4710,6 +4741,7 @@ class EnhancedSelect extends HTMLElement {
4710
4741
  this._connectionController?.abort();
4711
4742
  this._connectionController = new AbortController();
4712
4743
  this._observeSelectedLabelTooltipTargets();
4744
+ this._inputContent.addEventListener('scroll', this._scheduleSelectedLabelTooltipMeasure, { passive: true });
4713
4745
  document.addEventListener('pointerdown', this._onDocumentPointerDown, {
4714
4746
  signal: this._connectionController.signal,
4715
4747
  });
@@ -4793,6 +4825,7 @@ class EnhancedSelect extends HTMLElement {
4793
4825
  this._handleClose('disconnect');
4794
4826
  }
4795
4827
  this._runEngineEffects(this._engine.dispatch({ type: 'DISCONNECT' }));
4828
+ this._inputContent.removeEventListener('scroll', this._scheduleSelectedLabelTooltipMeasure);
4796
4829
  this._connectionController?.abort();
4797
4830
  this._connectionController = undefined;
4798
4831
  this._hideSelectedLabelTooltip(true);
@@ -5293,6 +5326,7 @@ class EnhancedSelect extends HTMLElement {
5293
5326
  selectable: behavior.selectable === true,
5294
5327
  hoverable: behavior.hoverable === true,
5295
5328
  focusable: behavior.focusable === true,
5329
+ closeOnClick: behavior.closeOnClick === true,
5296
5330
  };
5297
5331
  }
5298
5332
  _isDisabledOptionSelectable(item) {
@@ -5536,6 +5570,7 @@ class EnhancedSelect extends HTMLElement {
5536
5570
  const styles = this._config.styles;
5537
5571
  if (!styles)
5538
5572
  return;
5573
+ this._syncLoaderClassNames();
5539
5574
  this._applyStyleVariableMap(styles.option, {
5540
5575
  background: '--select-option-bg',
5541
5576
  backgroundColor: '--select-option-bg',
@@ -5551,6 +5586,7 @@ class EnhancedSelect extends HTMLElement {
5551
5586
  fontWeight: '--select-option-font-weight',
5552
5587
  lineHeight: '--select-option-line-height',
5553
5588
  textAlign: '--select-option-text-align',
5589
+ zIndex: '--select-option-z-index',
5554
5590
  });
5555
5591
  this._applyStyleVariableMap(styles.selectedOption, {
5556
5592
  background: '--select-option-selected-bg',
@@ -5704,8 +5740,35 @@ class EnhancedSelect extends HTMLElement {
5704
5740
  fontWeight: '--select-group-header-weight',
5705
5741
  textTransform: '--select-group-header-text-transform',
5706
5742
  letterSpacing: '--select-group-header-letter-spacing',
5743
+ position: '--select-group-header-position',
5744
+ top: '--select-group-header-top',
5745
+ zIndex: '--select-group-header-z-index',
5746
+ });
5747
+ this._applyStyleVariableMap(styles.loader, {
5748
+ gap: '--select-loader-gap',
5749
+ padding: '--select-loader-padding',
5750
+ color: '--select-loader-color',
5751
+ background: '--select-loader-bg',
5752
+ backgroundColor: '--select-loader-bg',
5753
+ fontSize: '--select-loader-font-size',
5754
+ textAlign: '--select-loader-text-align',
5755
+ alignItems: '--select-loader-align-items',
5756
+ justifyContent: '--select-loader-justify-content',
5707
5757
  });
5708
5758
  }
5759
+ _syncLoaderClassNames(additionalTarget) {
5760
+ const classNames = new Set((this._config.styles.classNames?.loader ?? '').split(/\s+/).filter(Boolean));
5761
+ const targets = [
5762
+ this._busyBucket,
5763
+ this._optionsContainer?.querySelector('.searching-state'),
5764
+ additionalTarget,
5765
+ ].filter((element) => Boolean(element));
5766
+ for (const target of targets) {
5767
+ target.classList.remove(...this._managedLoaderClasses);
5768
+ target.classList.add(...classNames);
5769
+ }
5770
+ this._managedLoaderClasses = classNames;
5771
+ }
5709
5772
  _resolveDropdownPlacement() {
5710
5773
  const placementMode = this._config.dropdownPlacement?.mode ?? 'bottom';
5711
5774
  if (placementMode === 'bottom' || placementMode === 'top') {
@@ -5733,12 +5796,25 @@ class EnhancedSelect extends HTMLElement {
5733
5796
  }
5734
5797
  _setIconContent(target, markup, fallback) {
5735
5798
  const content = markup && markup.trim() ? markup : fallback;
5736
- target.innerHTML = '';
5799
+ let fallbackTarget = target.querySelector(':scope > [data-smilodon-fallback-icon]');
5800
+ if (!fallbackTarget) {
5801
+ fallbackTarget = document.createElement('span');
5802
+ fallbackTarget.setAttribute('data-smilodon-fallback-icon', '');
5803
+ target.prepend(fallbackTarget);
5804
+ }
5805
+ if (!target.querySelector(':scope > [data-smilodon-react-icon-root]')) {
5806
+ const portalRoot = document.createElement('span');
5807
+ portalRoot.setAttribute('data-smilodon-react-icon-root', '');
5808
+ target.append(portalRoot);
5809
+ }
5810
+ // Only Core's fallback subtree is replaceable. React may reconcile a
5811
+ // separate portal root beneath this stable icon target.
5812
+ fallbackTarget.replaceChildren();
5737
5813
  if (content.trim().startsWith('<')) {
5738
- target.innerHTML = content;
5814
+ fallbackTarget.innerHTML = content;
5739
5815
  return;
5740
5816
  }
5741
- target.textContent = content;
5817
+ fallbackTarget.textContent = content;
5742
5818
  }
5743
5819
  _syncInputContainerMode() {
5744
5820
  if (!this._inputContainer || !this._input)
@@ -5961,6 +6037,27 @@ class EnhancedSelect extends HTMLElement {
5961
6037
  tooltip.hidden = true;
5962
6038
  return tooltip;
5963
6039
  }
6040
+ _createSelectedLabelTooltipTextMeasure() {
6041
+ const measure = document.createElement('span');
6042
+ measure.setAttribute('aria-hidden', 'true');
6043
+ measure.dataset.selectInternal = 'tooltip-measure';
6044
+ measure.style.cssText = [
6045
+ 'all: initial',
6046
+ 'position: fixed',
6047
+ 'left: -100000px',
6048
+ 'top: 0',
6049
+ 'display: inline-block',
6050
+ 'width: max-content',
6051
+ 'height: auto',
6052
+ 'padding: 0',
6053
+ 'margin: 0',
6054
+ 'border: 0',
6055
+ 'white-space: pre',
6056
+ 'visibility: hidden',
6057
+ 'pointer-events: none',
6058
+ ].join(';');
6059
+ return measure;
6060
+ }
5964
6061
  _createDropdown() {
5965
6062
  const dropdown = document.createElement('div');
5966
6063
  dropdown.className = 'select-dropdown';
@@ -5969,11 +6066,139 @@ class EnhancedSelect extends HTMLElement {
5969
6066
  if (this._config.styles.classNames?.dropdown) {
5970
6067
  dropdown.className += ' ' + this._config.styles.classNames.dropdown;
5971
6068
  }
5972
- if (this._config.styles.dropdown) {
5973
- Object.assign(dropdown.style, this._config.styles.dropdown);
5974
- }
5975
6069
  return dropdown;
5976
6070
  }
6071
+ _syncDropdownConfigInlineStyles() {
6072
+ if (!this._dropdown)
6073
+ return;
6074
+ const toCssProperty = (property) => {
6075
+ if (property.startsWith('--'))
6076
+ return property;
6077
+ if (property === 'cssFloat')
6078
+ return 'float';
6079
+ return property.replace(/[A-Z]/g, (character) => `-${character.toLowerCase()}`);
6080
+ };
6081
+ const configured = new Map();
6082
+ for (const [property, value] of Object.entries(this._config.styles.dropdown ?? {})) {
6083
+ if (value === undefined || value === null || String(value).trim() === '')
6084
+ continue;
6085
+ configured.set(toCssProperty(property), String(value));
6086
+ }
6087
+ const style = this._dropdown.style;
6088
+ const readValue = (property) => style.getPropertyValue(property).trim();
6089
+ const readSnapshot = (property) => ({
6090
+ value: readValue(property),
6091
+ priority: style.getPropertyPriority(property),
6092
+ });
6093
+ const sameSnapshot = (left, right) => left.value === right.value && left.priority === right.priority;
6094
+ const readBorderParts = () => new Map(DROPDOWN_BORDER_LONGHANDS.map((part) => [part, readSnapshot(part)]));
6095
+ const restoreValue = (property, value, priority) => {
6096
+ if (value)
6097
+ style.setProperty(property, value, priority);
6098
+ else
6099
+ style.removeProperty(property);
6100
+ };
6101
+ for (const [property, previousOwnership] of this._dropdownConfigInlineStyles) {
6102
+ const currentValue = readValue(property);
6103
+ const currentPriority = style.getPropertyPriority(property);
6104
+ const isStillCoreOwned = currentValue === previousOwnership.appliedValue
6105
+ && currentPriority === previousOwnership.appliedPriority;
6106
+ const previousValue = isStillCoreOwned ? previousOwnership.previousValue : currentValue;
6107
+ const previousPriority = isStillCoreOwned ? previousOwnership.previousPriority : currentPriority;
6108
+ const nextValue = configured.get(property);
6109
+ const relatedBorderParts = previousOwnership.relatedBorderParts;
6110
+ if (nextValue === undefined) {
6111
+ const borderPartRestorations = relatedBorderParts
6112
+ ? [...relatedBorderParts].map(([part, ownership]) => {
6113
+ const current = readSnapshot(part);
6114
+ return [part, sameSnapshot(current, ownership.applied) ? ownership.previous : current];
6115
+ })
6116
+ : [];
6117
+ if (isStillCoreOwned)
6118
+ restoreValue(property, previousValue, previousPriority);
6119
+ for (const [part, restore] of borderPartRestorations) {
6120
+ restoreValue(part, restore.value, restore.priority);
6121
+ }
6122
+ // A shorthand and a longhand can both own the same border components.
6123
+ // When one layer is released, rebase any still-active layer whose saved
6124
+ // baseline came from the released layer's applied value. Otherwise the
6125
+ // final release can resurrect an intermediate Core value instead of
6126
+ // the consumer-authored declaration.
6127
+ if (relatedBorderParts) {
6128
+ for (const [otherProperty, otherOwnership] of this._dropdownConfigInlineStyles) {
6129
+ if (otherProperty === property || !otherOwnership.relatedBorderParts)
6130
+ continue;
6131
+ for (const [part, released] of relatedBorderParts) {
6132
+ const other = otherOwnership.relatedBorderParts.get(part);
6133
+ if (!other)
6134
+ continue;
6135
+ const current = readSnapshot(part);
6136
+ if (sameSnapshot(current, other.applied) && sameSnapshot(other.previous, released.applied)) {
6137
+ otherOwnership.relatedBorderParts.set(part, {
6138
+ ...other,
6139
+ previous: released.previous,
6140
+ });
6141
+ }
6142
+ }
6143
+ }
6144
+ }
6145
+ this._dropdownConfigInlineStyles.delete(property);
6146
+ continue;
6147
+ }
6148
+ const tracksBorderParts = property === 'border' || property === 'border-width';
6149
+ const beforeBorderParts = tracksBorderParts ? readBorderParts() : undefined;
6150
+ style.setProperty(property, nextValue);
6151
+ const afterBorderParts = tracksBorderParts ? readBorderParts() : undefined;
6152
+ let nextRelatedBorderParts;
6153
+ if (beforeBorderParts && afterBorderParts) {
6154
+ nextRelatedBorderParts = new Map();
6155
+ for (const part of DROPDOWN_BORDER_LONGHANDS) {
6156
+ const before = beforeBorderParts.get(part);
6157
+ const after = afterBorderParts.get(part);
6158
+ const previous = relatedBorderParts?.get(part);
6159
+ if (previous || !sameSnapshot(before, after)) {
6160
+ nextRelatedBorderParts.set(part, {
6161
+ previous: previous && sameSnapshot(before, previous.applied) ? previous.previous : before,
6162
+ applied: after,
6163
+ });
6164
+ }
6165
+ }
6166
+ }
6167
+ this._dropdownConfigInlineStyles.set(property, {
6168
+ appliedValue: readValue(property),
6169
+ appliedPriority: style.getPropertyPriority(property),
6170
+ previousValue,
6171
+ previousPriority,
6172
+ ...(nextRelatedBorderParts ? { relatedBorderParts: nextRelatedBorderParts } : {}),
6173
+ });
6174
+ configured.delete(property);
6175
+ }
6176
+ for (const [property, value] of configured) {
6177
+ const previousValue = readValue(property);
6178
+ const previousPriority = style.getPropertyPriority(property);
6179
+ const tracksBorderParts = property === 'border' || property === 'border-width';
6180
+ const beforeBorderParts = tracksBorderParts ? readBorderParts() : undefined;
6181
+ style.setProperty(property, value);
6182
+ const afterBorderParts = tracksBorderParts ? readBorderParts() : undefined;
6183
+ let relatedBorderParts;
6184
+ if (beforeBorderParts && afterBorderParts) {
6185
+ relatedBorderParts = new Map();
6186
+ for (const part of DROPDOWN_BORDER_LONGHANDS) {
6187
+ const before = beforeBorderParts.get(part);
6188
+ const after = afterBorderParts.get(part);
6189
+ if (!sameSnapshot(before, after))
6190
+ relatedBorderParts.set(part, { previous: before, applied: after });
6191
+ }
6192
+ }
6193
+ this._dropdownConfigInlineStyles.set(property, {
6194
+ appliedValue: readValue(property),
6195
+ appliedPriority: style.getPropertyPriority(property),
6196
+ previousValue,
6197
+ previousPriority,
6198
+ ...(relatedBorderParts ? { relatedBorderParts } : {}),
6199
+ });
6200
+ }
6201
+ }
5977
6202
  _createOptionsContainer() {
5978
6203
  const container = document.createElement('div');
5979
6204
  container.className = `options-container ${EnhancedSelect._MIRRORED_STYLES_SCOPE_CLASS}`;
@@ -6056,6 +6281,7 @@ class EnhancedSelect extends HTMLElement {
6056
6281
  this._shadow.appendChild(this._errorDescription);
6057
6282
  }
6058
6283
  this._shadow.appendChild(this._selectedLabelTooltip);
6284
+ this._shadow.appendChild(this._selectedLabelTooltipTextMeasure);
6059
6285
  // Set ARIA relationships
6060
6286
  const listboxId = `${this._uniqueId}-listbox`;
6061
6287
  this._dropdown.id = listboxId;
@@ -6240,7 +6466,6 @@ class EnhancedSelect extends HTMLElement {
6240
6466
  --select-group-header-separator-border-top: none;
6241
6467
  --select-reduced-motion-duration: 0.01ms;
6242
6468
  --select-reduced-motion-iteration-count: 1;
6243
- --select-high-contrast-border-width: 2px;
6244
6469
  --select-high-contrast-indicator-width: 4px;
6245
6470
  --select-high-contrast-focus-outline-width: 3px;
6246
6471
  --select-high-contrast-focus-outline-color: Highlight;
@@ -6407,6 +6632,15 @@ class EnhancedSelect extends HTMLElement {
6407
6632
  pointer-events: none;
6408
6633
  }
6409
6634
 
6635
+ .badge-remove-icon > [data-smilodon-fallback-icon],
6636
+ .badge-remove-icon > [data-smilodon-react-icon-root] {
6637
+ display: contents;
6638
+ }
6639
+
6640
+ .badge-remove-icon[data-smilodon-icon-owner="react"] > [data-smilodon-fallback-icon] {
6641
+ display: none;
6642
+ }
6643
+
6410
6644
  .badge-remove-icon svg {
6411
6645
  width: 100%;
6412
6646
  height: 100%;
@@ -6901,7 +7135,10 @@ class EnhancedSelect extends HTMLElement {
6901
7135
  overflow: hidden;
6902
7136
  box-sizing: border-box;
6903
7137
  background: var(--select-dropdown-bg, var(--select-surface));
6904
- border: 1px solid var(--select-dropdown-border, var(--select-border));
7138
+ border:
7139
+ var(--select-dropdown-border-width, 1px)
7140
+ var(--select-dropdown-border-style, solid)
7141
+ var(--select-dropdown-border, var(--select-border));
6905
7142
  border-radius: var(--select-dropdown-border-radius, var(--select-radius-lg));
6906
7143
  box-shadow: var(--select-dropdown-shadow, var(--select-shadow-lg));
6907
7144
  z-index: var(--select-dropdown-z-index, 1000);
@@ -6992,11 +7229,11 @@ class EnhancedSelect extends HTMLElement {
6992
7229
  font-size: var(--select-group-header-font-size, 0.7333em);
6993
7230
  text-transform: var(--select-group-header-text-transform, uppercase);
6994
7231
  letter-spacing: var(--select-group-header-letter-spacing, 0.08em);
6995
- position: sticky;
6996
- top: calc(var(--select-options-padding, 6px) * -1);
7232
+ position: var(--select-group-header-position, sticky);
7233
+ top: var(--select-group-header-top, calc(var(--select-options-padding, 6px) * -1));
6997
7234
  left: 0;
6998
7235
  right: 0;
6999
- z-index: 100;
7236
+ z-index: var(--select-group-header-z-index, 100);
7000
7237
  border: var(--select-group-header-border, none);
7001
7238
  border-bottom: var(--select-group-header-border-bottom, 1px solid rgba(0, 0, 0, 0.08));
7002
7239
  border-radius: var(--select-group-header-border-radius, 0);
@@ -7019,6 +7256,7 @@ class EnhancedSelect extends HTMLElement {
7019
7256
 
7020
7257
  .option {
7021
7258
  position: relative;
7259
+ z-index: var(--select-option-z-index, auto);
7022
7260
  padding: var(--select-option-padding, 10px 14px);
7023
7261
  cursor: pointer;
7024
7262
  color: var(--select-option-color, var(--select-text));
@@ -7123,7 +7361,7 @@ class EnhancedSelect extends HTMLElement {
7123
7361
  border: var(--select-option-disabled-border, var(--select-option-border, none));
7124
7362
  opacity: var(--select-option-disabled-opacity, 0.5);
7125
7363
  cursor: var(--select-option-disabled-cursor, not-allowed);
7126
- pointer-events: var(--select-option-disabled-pointer-events, none);
7364
+ pointer-events: var(--select-option-disabled-pointer-events, auto);
7127
7365
  }
7128
7366
 
7129
7367
  .option.smilodon-option--disabled-interactive {
@@ -7187,14 +7425,14 @@ class EnhancedSelect extends HTMLElement {
7187
7425
  .busy-bucket {
7188
7426
  display: flex;
7189
7427
  flex-direction: column;
7190
- align-items: center;
7191
- justify-content: center;
7192
- gap: var(--select-busy-gap, 8px);
7193
- padding: var(--select-busy-padding, 20px);
7194
- text-align: center;
7195
- color: var(--select-busy-color, var(--select-text-muted));
7196
- background: var(--select-busy-bg, transparent);
7197
- font-size: var(--select-busy-font-size, 0.8667em);
7428
+ gap: var(--select-loader-gap, var(--select-busy-gap, 8px));
7429
+ padding: var(--select-loader-padding, var(--select-busy-padding, 20px));
7430
+ text-align: var(--select-loader-text-align, center);
7431
+ color: var(--select-loader-color, var(--select-busy-color, var(--select-text-muted)));
7432
+ background: var(--select-loader-bg, var(--select-busy-bg, transparent));
7433
+ font-size: var(--select-loader-font-size, var(--select-busy-font-size, 0.8667em));
7434
+ align-items: var(--select-loader-align-items, center);
7435
+ justify-content: var(--select-loader-justify-content, center);
7198
7436
  }
7199
7437
 
7200
7438
  .busy-icon {
@@ -7248,26 +7486,27 @@ class EnhancedSelect extends HTMLElement {
7248
7486
  }
7249
7487
 
7250
7488
  .searching-state {
7251
- padding: var(--select-searching-padding, 32px 24px);
7252
- text-align: center;
7253
- color: var(--select-searching-color, var(--select-accent));
7254
- font-size: var(--select-searching-font-size, 0.9333em);
7255
- background: var(--select-searching-bg, transparent);
7489
+ padding: var(--select-loader-padding, var(--select-searching-padding, 32px 24px));
7490
+ text-align: var(--select-loader-text-align, center);
7491
+ color: var(--select-loader-color, var(--select-searching-color, var(--select-accent)));
7492
+ font-size: var(--select-loader-font-size, var(--select-searching-font-size, 0.9333em));
7493
+ background: var(--select-loader-bg, var(--select-searching-bg, transparent));
7256
7494
  display: flex;
7257
7495
  flex-direction: column;
7258
- align-items: center;
7259
- justify-content: center;
7260
- gap: var(--select-searching-gap);
7496
+ align-items: var(--select-loader-align-items, center);
7497
+ justify-content: var(--select-loader-justify-content, center);
7498
+ gap: var(--select-loader-gap, var(--select-searching-gap, 8px));
7261
7499
  }
7262
7500
 
7263
- .searching-state::before {
7264
- content: '';
7501
+ .searching-spinner {
7502
+ display: inline-block;
7265
7503
  width: var(--select-searching-spinner-size);
7266
7504
  height: var(--select-searching-spinner-size);
7267
7505
  border: var(--select-searching-spinner-border);
7268
7506
  border-top-color: var(--select-searching-spinner-active-color);
7269
7507
  border-radius: 50%;
7270
7508
  animation: var(--select-searching-spinner-animation);
7509
+ flex: 0 0 auto;
7271
7510
  }
7272
7511
 
7273
7512
  /* ─────────────────────────────────────────────────────────────────────────
@@ -7301,14 +7540,10 @@ class EnhancedSelect extends HTMLElement {
7301
7540
  }
7302
7541
  }
7303
7542
 
7304
- @media (prefers-contrast: high) {
7305
- .select-input:focus {
7306
- outline-width: var(--select-high-contrast-focus-outline-width);
7307
- outline-color: var(--select-high-contrast-focus-outline-color);
7308
- }
7309
-
7310
- .input-container {
7311
- border-width: var(--select-high-contrast-border-width);
7543
+ @media (prefers-contrast: more) {
7544
+ .input-container:focus-within {
7545
+ outline: var(--select-high-contrast-focus-outline-width) solid var(--select-high-contrast-focus-outline-color);
7546
+ outline-offset: 2px;
7312
7547
  }
7313
7548
 
7314
7549
  .option.selected::before {
@@ -7400,7 +7635,6 @@ class EnhancedSelect extends HTMLElement {
7400
7635
  :host-context([data-theme="dark"]) .input-container,
7401
7636
  :host-context([theme="dark"]) .input-container {
7402
7637
  background: var(--select-surface);
7403
- border-color: var(--select-border);
7404
7638
  }
7405
7639
 
7406
7640
  :host(.dark-mode) .input-container:hover,
@@ -7429,7 +7663,7 @@ class EnhancedSelect extends HTMLElement {
7429
7663
  :host-context([darkmode]) .input-container:focus-within,
7430
7664
  :host-context([data-theme="dark"]) .input-container:focus-within,
7431
7665
  :host-context([theme="dark"]) .input-container:focus-within {
7432
- border-color: var(--select-dark-border-focus, var(--select-border-focus, #6366f1));
7666
+ border-color: var(--select-dark-border-focus, var(--select-input-focus-border, var(--select-border-focus, #6366f1)));
7433
7667
  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);
7434
7668
  }
7435
7669
 
@@ -7459,7 +7693,6 @@ class EnhancedSelect extends HTMLElement {
7459
7693
  :host-context([data-theme="dark"]) .select-dropdown,
7460
7694
  :host-context([theme="dark"]) .select-dropdown {
7461
7695
  background: var(--select-dropdown-bg, var(--select-surface));
7462
- border-color: var(--select-border);
7463
7696
  }
7464
7697
 
7465
7698
  :host(.dark-mode) .options-container,
@@ -7582,7 +7815,6 @@ class EnhancedSelect extends HTMLElement {
7582
7815
  keyboardEvent.stopPropagation();
7583
7816
  this._dismissSelectedLabelTooltip();
7584
7817
  });
7585
- this._inputContent.addEventListener('scroll', this._scheduleSelectedLabelTooltipMeasure, { passive: true });
7586
7818
  // Arrow click handler
7587
7819
  if (this._arrowContainer) {
7588
7820
  this._boundArrowClick = (e) => {
@@ -7595,7 +7827,7 @@ class EnhancedSelect extends HTMLElement {
7595
7827
  this._handleClose();
7596
7828
  }
7597
7829
  else if (!this._state.isOpen) {
7598
- this._handleOpen();
7830
+ this._handleOpen('pointer');
7599
7831
  }
7600
7832
  };
7601
7833
  this._arrowContainer.addEventListener('click', this._boundArrowClick);
@@ -7652,7 +7884,7 @@ class EnhancedSelect extends HTMLElement {
7652
7884
  }
7653
7885
  const wasClosed = !this._state.isOpen;
7654
7886
  if (wasClosed) {
7655
- this._handleOpen();
7887
+ this._handleOpen('pointer');
7656
7888
  }
7657
7889
  // Focus the input (do not prevent default behavior for input itself)
7658
7890
  this._applyFocusIntent('input', 'input-container-trigger');
@@ -7689,7 +7921,7 @@ class EnhancedSelect extends HTMLElement {
7689
7921
  this._suppressNextOpenClick = false;
7690
7922
  this._multiScrollDrag.moved = false;
7691
7923
  if (!this._state.isOpen) {
7692
- this._handleOpen();
7924
+ this._handleOpen('pointer');
7693
7925
  }
7694
7926
  this._applyFocusIntent('input', 'input-container-activation');
7695
7927
  });
@@ -7751,49 +7983,65 @@ class EnhancedSelect extends HTMLElement {
7751
7983
  if (!this._config.searchable)
7752
7984
  return;
7753
7985
  const query = e.target.value;
7754
- if (this._selectedLabelTooltipTrigger === this._input
7755
- && this._getSelectedLabelForTrigger(this._input) === null) {
7756
- this._hideSelectedLabelTooltip();
7986
+ if (this._selectedLabelTooltipDismissedTrigger === this._input) {
7987
+ this._selectedLabelTooltipDismissedTrigger = null;
7757
7988
  }
7758
7989
  this._handleSearch(query);
7759
7990
  });
7760
- // If the user presses down inside the options container we should
7761
- // temporarily suppress blur-based closing until after the click has
7762
- // been handled. Setting a flag that gets cleared in the next tick is
7763
- // sufficient.
7764
- this._optionsContainer.addEventListener('pointerdown', () => {
7991
+ const findOptionElement = (event) => {
7992
+ const path = typeof event.composedPath === 'function' ? event.composedPath() : [event.target];
7993
+ for (const node of path) {
7994
+ if (!(node instanceof Element))
7995
+ continue;
7996
+ if (node.matches('select-option[data-sm-index], [data-sm-selectable][data-sm-index], [data-selectable][data-index]')) {
7997
+ return node;
7998
+ }
7999
+ }
8000
+ return null;
8001
+ };
8002
+ const resolveOptionRecord = (event, option = findOptionElement(event)) => {
8003
+ if (!option)
8004
+ return null;
8005
+ const index = Number(option.getAttribute('data-sm-index') ?? option.getAttribute('data-index'));
8006
+ if (!Number.isSafeInteger(index) || index < 0)
8007
+ return null;
8008
+ this._ensureRegistryCurrent();
8009
+ const record = this._getRecordByIndex(index);
8010
+ return record ? { option, record } : null;
8011
+ };
8012
+ // Keep the input focused when a blocked disabled option is pressed. This
8013
+ // prevents the delayed blur-close path from racing the delegated click.
8014
+ this._optionsContainer.addEventListener('pointerdown', (event) => {
7765
8015
  this._suppressBlurClose = true;
7766
8016
  this._setLifecycleTimeout(() => {
7767
8017
  this._suppressBlurClose = false;
7768
8018
  }, 150); // Increased timeout to ensure click finishes before blur checks
8019
+ const option = findOptionElement(event);
8020
+ if (!option?.matches('[aria-disabled="true"], .smilodon-option--disabled, .disabled'))
8021
+ return;
8022
+ const resolved = resolveOptionRecord(event, option);
8023
+ if (!resolved || !resolved.record.disabled)
8024
+ return;
8025
+ if (this._getDisabledOptionBehavior().selectable)
8026
+ return;
8027
+ event.preventDefault();
7769
8028
  });
7770
8029
  // Delegated click listener for improved event handling (robust across shadow DOM)
7771
8030
  const handleOptionEvent = (e) => {
7772
- const path = (e.composedPath && e.composedPath()) || [e.target];
7773
- let option = null;
7774
- for (const node of path) {
7775
- if (!(node instanceof Element))
7776
- continue;
7777
- try {
7778
- if (node.matches('[data-sm-selectable], [data-selectable], [data-sm-state]')) {
7779
- option = node;
7780
- break;
7781
- }
7782
- }
7783
- catch (err) {
7784
- continue;
7785
- }
7786
- }
7787
- if (option && (!option.hasAttribute('aria-disabled') || option.classList.contains('smilodon-option--disabled-selectable'))) {
7788
- const indexStr = option.getAttribute('data-sm-index') ?? option.getAttribute('data-index');
7789
- const index = Number(indexStr);
7790
- if (!Number.isNaN(index)) {
7791
- this._selectOption(index, {
7792
- shiftKey: e.shiftKey,
7793
- toggleKey: e.ctrlKey || e.metaKey,
7794
- });
7795
- }
8031
+ const resolved = resolveOptionRecord(e);
8032
+ if (!resolved)
8033
+ return;
8034
+ const behavior = this._getDisabledOptionBehavior();
8035
+ if (resolved.record.disabled && !behavior.selectable) {
8036
+ e.preventDefault();
8037
+ if (behavior.closeOnClick)
8038
+ this._handleClose('disabled-option-click');
8039
+ return;
7796
8040
  }
8041
+ this._selectOption(resolved.record.index, {
8042
+ shiftKey: e.shiftKey,
8043
+ toggleKey: e.ctrlKey || e.metaKey,
8044
+ });
7797
8045
  };
7798
8046
  this._optionsContainer.addEventListener('click', handleOptionEvent);
7799
8047
  // Keyboard navigation
@@ -7930,7 +8178,7 @@ class EnhancedSelect extends HTMLElement {
7930
8178
  _getSelectedLabelForTrigger(trigger) {
7931
8179
  const entries = this._getSelectedEntries();
7932
8180
  if (trigger === this._input) {
7933
- if (this._config.selection.mode !== 'single' || this._state.searchQuery.length > 0)
8181
+ if (this._config.selection.mode !== 'single')
7934
8182
  return null;
7935
8183
  const item = entries[0]?.item;
7936
8184
  if (item === undefined)
@@ -7954,6 +8202,57 @@ class EnhancedSelect extends HTMLElement {
7954
8202
  return false;
7955
8203
  return trigger.clientWidth > 0 && trigger.scrollWidth > trigger.clientWidth + 1;
7956
8204
  }
8205
+ _getSelectedLabelTooltipContent(trigger) {
8206
+ if (trigger === this._input && this._config.searchable) {
8207
+ const visibleText = this._input.value;
8208
+ const pendingQuery = this._acknowledgedPendingSearchQuery;
8209
+ const committedQuery = this._state.searchQuery;
8210
+ const isPendingQuery = pendingQuery !== null && pendingQuery.length > 0 && visibleText === pendingQuery;
8211
+ const isCommittedQuery = committedQuery.length > 0 && visibleText === committedQuery;
8212
+ if (visibleText.length > 0 && (isPendingQuery || isCommittedQuery)) {
8213
+ return { kind: 'search-query', text: visibleText };
8214
+ }
8215
+ }
8216
+ const selectedLabel = this._getSelectedLabelForTrigger(trigger);
8217
+ return selectedLabel === null ? null : { kind: 'selected-label', text: selectedLabel };
8218
+ }
8219
+ _isSelectedLabelTooltipContentTruncated(trigger, content) {
8220
+ if (trigger !== this._input)
8221
+ return this._isSelectedLabelTruncated(trigger);
8222
+ if (!trigger.isConnected || !content.text)
8223
+ return false;
8224
+ const style = getComputedStyle(this._input);
8225
+ const measure = this._selectedLabelTooltipTextMeasure;
8226
+ measure.textContent = content.text;
8227
+ const mirroredProperties = [
8228
+ 'font',
8229
+ 'font-family',
8230
+ 'font-size',
8231
+ 'font-style',
8232
+ 'font-weight',
8233
+ 'font-stretch',
8234
+ 'font-variant',
8235
+ 'font-kerning',
8236
+ 'font-feature-settings',
8237
+ 'font-variation-settings',
8238
+ 'letter-spacing',
8239
+ 'word-spacing',
8240
+ 'text-transform',
8241
+ 'direction',
8242
+ 'unicode-bidi',
8243
+ ];
8244
+ for (const property of mirroredProperties) {
8245
+ const value = style.getPropertyValue(property);
8246
+ if (value)
8247
+ measure.style.setProperty(property, value);
8248
+ }
8249
+ const contentWidth = measure.getBoundingClientRect().width;
8250
+ const inputStyle = style;
8251
+ const horizontalPadding = Number.parseFloat(inputStyle.paddingLeft) + Number.parseFloat(inputStyle.paddingRight);
8252
+ const textIndent = Number.parseFloat(inputStyle.textIndent) || 0;
8253
+ const availableWidth = this._input.clientWidth - (Number.isFinite(horizontalPadding) ? horizontalPadding : 0) - textIndent;
8254
+ return availableWidth > 0 && contentWidth > availableWidth + 1;
8255
+ }
7957
8256
  _handleSelectedLabelPointerOver(event) {
7958
8257
  const target = event.target;
7959
8258
  if (target?.closest('.selected-label-tooltip') === this._selectedLabelTooltip) {
@@ -8019,8 +8318,8 @@ class EnhancedSelect extends HTMLElement {
8019
8318
  this._hideSelectedLabelTooltip();
8020
8319
  return;
8021
8320
  }
8022
- const label = this._getSelectedLabelForTrigger(trigger);
8023
- if (label === null || !this._isSelectedLabelTruncated(trigger)) {
8321
+ const content = this._getSelectedLabelTooltipContent(trigger);
8322
+ if (content === null || !this._isSelectedLabelTooltipContentTruncated(trigger, content)) {
8024
8323
  if (trigger.classList.contains('selection-badge-label'))
8025
8324
  trigger.tabIndex = -1;
8026
8325
  if (this._selectedLabelTooltipTrigger === trigger)
@@ -8033,7 +8332,7 @@ class EnhancedSelect extends HTMLElement {
8033
8332
  this._removeSelectedLabelTooltipDescription(this._selectedLabelTooltipTrigger);
8034
8333
  this._selectedLabelTooltipTrigger = trigger;
8035
8334
  }
8036
- this._selectedLabelTooltip.textContent = label;
8335
+ this._selectedLabelTooltip.textContent = content.text;
8037
8336
  this._selectedLabelTooltip.hidden = false;
8038
8337
  this._positionSelectedLabelTooltip(trigger);
8039
8338
  this._syncSelectedLabelTooltipDescription();
@@ -8087,6 +8386,7 @@ class EnhancedSelect extends HTMLElement {
8087
8386
  this._removeSelectedLabelTooltipDescription(this._selectedLabelTooltipTrigger);
8088
8387
  this._selectedLabelTooltipTrigger = null;
8089
8388
  this._selectedLabelTooltip.hidden = true;
8389
+ this._selectedLabelTooltipTextMeasure.textContent = '';
8090
8390
  if (clearInteractionState) {
8091
8391
  this._selectedLabelTooltipPointerTrigger = null;
8092
8392
  this._selectedLabelTooltipFocusTrigger = null;
@@ -8144,10 +8444,12 @@ class EnhancedSelect extends HTMLElement {
8144
8444
  return;
8145
8445
  const hasSingleSelection = this._config.selection.mode === 'single'
8146
8446
  && this._getSelectedEntries().length > 0;
8447
+ const inputContent = this._getSelectedLabelTooltipContent(this._input);
8448
+ const shouldObserveInput = hasSingleSelection || inputContent?.kind === 'search-query';
8147
8449
  const chipLabels = this._getActiveChipBadges()
8148
8450
  .map((badge) => badge.querySelector('.selection-badge-label'))
8149
8451
  .filter((label) => label !== null);
8150
- if (!hasSingleSelection && chipLabels.length === 0) {
8452
+ if (!shouldObserveInput && chipLabels.length === 0) {
8151
8453
  this._selectedLabelTooltipResizeObserver?.disconnect();
8152
8454
  this._selectedLabelTooltipResizeObserver = null;
8153
8455
  return;
@@ -8156,7 +8458,7 @@ class EnhancedSelect extends HTMLElement {
8156
8458
  this._selectedLabelTooltipResizeObserver = new ResizeObserver(() => this._scheduleSelectedLabelTooltipMeasure());
8157
8459
  }
8158
8460
  this._selectedLabelTooltipResizeObserver.disconnect();
8159
- if (hasSingleSelection)
8461
+ if (shouldObserveInput)
8160
8462
  this._selectedLabelTooltipResizeObserver.observe(this._input);
8161
8463
  chipLabels.forEach((label) => {
8162
8464
  this._selectedLabelTooltipResizeObserver?.observe(label);
@@ -8190,8 +8492,8 @@ class EnhancedSelect extends HTMLElement {
8190
8492
  this._hideSelectedLabelTooltip();
8191
8493
  return;
8192
8494
  }
8193
- const label = this._getSelectedLabelForTrigger(trigger);
8194
- if (label === null || !this._isSelectedLabelTruncated(trigger)) {
8495
+ const content = this._getSelectedLabelTooltipContent(trigger);
8496
+ if (content === null || !this._isSelectedLabelTooltipContentTruncated(trigger, content)) {
8195
8497
  if (this._selectedLabelTooltipTrigger === trigger)
8196
8498
  this._hideSelectedLabelTooltip();
8197
8499
  return;
@@ -8253,7 +8555,7 @@ class EnhancedSelect extends HTMLElement {
8253
8555
  },
8254
8556
  }, { applyFocus: true });
8255
8557
  }
8256
- _handleOpen() {
8558
+ _handleOpen(intent = 'default') {
8257
8559
  if (!this._config.enabled) {
8258
8560
  this._runEngineEffects(this._engine.dispatch({ type: 'DISABLED_CHANGED', disabled: true }));
8259
8561
  return;
@@ -8287,10 +8589,17 @@ class EnhancedSelect extends HTMLElement {
8287
8589
  this._liftStackingAncestors();
8288
8590
  this._dropdown.style.display = 'block';
8289
8591
  this._updateArrowRotation();
8592
+ // Pointer opening must not turn the previous selection or stale active key
8593
+ // into a synthetic hover-like highlight. Clear engine identity before the
8594
+ // options are rendered so built-in and custom renderers share the same state.
8595
+ if (intent === 'pointer') {
8596
+ this._dispatchActiveKey(null, 'open', 'pointer dropdown open');
8597
+ }
8290
8598
  // Render options when opening
8291
8599
  this._renderOptions();
8292
8600
  this._syncDropdownPlacement();
8293
- this._setInitialActiveOption();
8601
+ if (intent !== 'pointer')
8602
+ this._setInitialActiveOption();
8294
8603
  this._emit('open', {});
8295
8604
  this._config.callbacks.onOpen?.();
8296
8605
  this._announce('Options expanded');
@@ -8793,10 +9102,8 @@ class EnhancedSelect extends HTMLElement {
8793
9102
  return results;
8794
9103
  }
8795
9104
  _handleSearch(query) {
8796
- if (this._selectedLabelTooltipTrigger === this._input
8797
- && (query.length > 0 || this._getSelectedLabelForTrigger(this._input) === null)) {
8798
- this._hideSelectedLabelTooltip();
8799
- }
9105
+ const previousQuery = this._acknowledgedPendingSearchQuery ?? this._state.searchQuery;
9106
+ const queryPresenceChanged = Boolean(previousQuery) !== Boolean(query);
8800
9107
  if (this._dataRequestCoordinator
8801
9108
  && (this._acknowledgedProjectionPending || this._acknowledgedProjectionSettling)) {
8802
9109
  // Keep the committed query/generation stable until the accepted snapshot
@@ -8805,6 +9112,9 @@ class EnhancedSelect extends HTMLElement {
8805
9112
  this._acknowledgedPendingSearchQuery = query;
8806
9113
  this._input.value = query;
8807
9114
  this._syncClearControlState();
9115
+ if (queryPresenceChanged)
9116
+ this._observeSelectedLabelTooltipTargets();
9117
+ this._refreshSelectedLabelTooltipMeasurements();
8808
9118
  return;
8809
9119
  }
8810
9120
  if (this._dataLoadingConfig.protocol === 'acknowledged'
@@ -8816,6 +9126,9 @@ class EnhancedSelect extends HTMLElement {
8816
9126
  this._cancelBusyPresentation();
8817
9127
  this._state.searchQuery = query;
8818
9128
  this._syncClearControlState();
9129
+ if (queryPresenceChanged)
9130
+ this._observeSelectedLabelTooltipTargets();
9131
+ this._refreshSelectedLabelTooltipMeasurements();
8819
9132
  this._state.lastNotifiedQuery = query;
8820
9133
  this._state.lastNotifiedResultCount = 0;
8821
9134
  if (this._dataRequestCoordinator) {
@@ -8854,6 +9167,9 @@ class EnhancedSelect extends HTMLElement {
8854
9167
  }
8855
9168
  this._state.searchQuery = query;
8856
9169
  this._syncClearControlState();
9170
+ if (queryPresenceChanged)
9171
+ this._observeSelectedLabelTooltipTargets();
9172
+ this._refreshSelectedLabelTooltipMeasurements();
8857
9173
  if (this._dataLoadingConfig.protocol === 'acknowledged' && this._dataRequestCoordinator) {
8858
9174
  // Local acknowledged search has no remote request, but pagination still
8859
9175
  // belongs to the coordinator's current query generation.
@@ -9368,7 +9684,7 @@ class EnhancedSelect extends HTMLElement {
9368
9684
  const selectableIndices = this._getSelectableOptionIndices();
9369
9685
  const selected = Array.from(this._state.selectedIndices).sort((a, b) => a - b);
9370
9686
  // Opening an empty select must not implicitly assign an active descendant.
9371
- // Keyboard navigation and pointer interaction establish active identity.
9687
+ // Keyboard navigation and option interaction establish active identity.
9372
9688
  if (selectableIndices.length === 0 || selected.length === 0) {
9373
9689
  this._dispatchActiveKey(null, 'open', 'initial active option');
9374
9690
  return;
@@ -9579,6 +9895,7 @@ class EnhancedSelect extends HTMLElement {
9579
9895
  this._chipElements.delete(key);
9580
9896
  expected.remove();
9581
9897
  if (this.isConnected) {
9898
+ this._syncMultiSelectPlaceholderVisibility();
9582
9899
  this._observeSelectedLabelTooltipTargets();
9583
9900
  this._refreshSelectedLabelTooltipMeasurements();
9584
9901
  }
@@ -9748,6 +10065,21 @@ class EnhancedSelect extends HTMLElement {
9748
10065
  nextSibling = badge;
9749
10066
  }
9750
10067
  }
10068
+ this._syncMultiSelectPlaceholderVisibility();
10069
+ }
10070
+ _syncMultiSelectPlaceholderVisibility() {
10071
+ if (this._config.selection.mode !== 'multi')
10072
+ return;
10073
+ const hasLogicalSelection = this._getSelectedEntries().length > 0;
10074
+ const hasMountedChipPresentation = this._inputContent.querySelector('.selection-badge') !== null;
10075
+ const isEmpty = !hasLogicalSelection && !hasMountedChipPresentation;
10076
+ this._input.placeholder = isEmpty
10077
+ ? (this._config.placeholder || 'Select an option...')
10078
+ : '';
10079
+ if (isEmpty
10080
+ && (this._config.multiSelectDisplay?.mode ?? 'wrap') === 'horizontal') {
10081
+ this._inputContent.scrollLeft = 0;
10082
+ }
9751
10083
  }
9752
10084
  _updateInputDisplay() {
9753
10085
  const selectedEntries = this._getSelectedEntries();
@@ -9776,14 +10108,8 @@ class EnhancedSelect extends HTMLElement {
9776
10108
  this._cancelLatestChipScroll();
9777
10109
  const getLabel = this._config.serverSide.getLabelFromItem || ((item) => item?.label ?? String(item));
9778
10110
  if (this._config.selection.mode === 'multi') {
9779
- if (selectedItems.length === 0) {
9780
- this._input.value = '';
9781
- this._input.placeholder = this._config.placeholder || 'Select an option...';
9782
- }
9783
- else {
9784
- this._input.value = '';
9785
- this._input.placeholder = '';
9786
- }
10111
+ this._input.value = '';
10112
+ this._input.placeholder = '';
9787
10113
  this._renderSelectedChips(selectedEntries);
9788
10114
  }
9789
10115
  else {
@@ -9805,7 +10131,10 @@ class EnhancedSelect extends HTMLElement {
9805
10131
  }
9806
10132
  // Preserve manual scrolling. Only a newly selected key can request auto-scroll.
9807
10133
  if (this._config.selection.mode === 'multi') {
9808
- this._inputContent.scrollLeft = previousChipScrollLeft;
10134
+ const hasMountedChipPresentation = this._inputContent.querySelector('.selection-badge') !== null;
10135
+ this._inputContent.scrollLeft = selectedEntries.length === 0 && !hasMountedChipPresentation
10136
+ ? 0
10137
+ : previousChipScrollLeft;
9809
10138
  if (newlyAddedKey !== undefined)
9810
10139
  this._scheduleLatestChipScroll(newlyAddedKey);
9811
10140
  }
@@ -10476,6 +10805,8 @@ class EnhancedSelect extends HTMLElement {
10476
10805
  }
10477
10806
  this._renderOptions();
10478
10807
  this._syncClearControlState();
10808
+ this._observeSelectedLabelTooltipTargets();
10809
+ this._refreshSelectedLabelTooltipMeasurements();
10479
10810
  }
10480
10811
  /**
10481
10812
  * Open dropdown
@@ -10591,7 +10922,10 @@ class EnhancedSelect extends HTMLElement {
10591
10922
  if (this._input) {
10592
10923
  this._input.readOnly = !this._config.searchable;
10593
10924
  this._syncComboboxAccessibility();
10594
- if (this._state.selectedIndices.size === 0) {
10925
+ if (this._config.selection.mode === 'multi') {
10926
+ this._syncMultiSelectPlaceholderVisibility();
10927
+ }
10928
+ else if (this._state.selectedIndices.size === 0) {
10595
10929
  this._input.placeholder = this._config.placeholder || 'Select an option...';
10596
10930
  }
10597
10931
  }
@@ -10608,6 +10942,7 @@ class EnhancedSelect extends HTMLElement {
10608
10942
  }
10609
10943
  }
10610
10944
  this._syncStyleConfigVariables();
10945
+ this._syncDropdownConfigInlineStyles();
10611
10946
  this._syncListboxAccessibility();
10612
10947
  if (this.isConnected) {
10613
10948
  this._syncDirectionConfig();
@@ -10684,6 +11019,8 @@ class EnhancedSelect extends HTMLElement {
10684
11019
  }
10685
11020
  }
10686
11021
  }
11022
+ this._observeSelectedLabelTooltipTargets();
11023
+ this._refreshSelectedLabelTooltipMeasurements();
10687
11024
  if (configErrorDetail) {
10688
11025
  this._emit('dataLoadingConfigError', configErrorDetail);
10689
11026
  try {
@@ -11971,8 +12308,12 @@ class EnhancedSelect extends HTMLElement {
11971
12308
  _createBusyBucket() {
11972
12309
  const bucket = document.createElement('div');
11973
12310
  bucket.setAttribute('part', 'loading');
12311
+ bucket.setAttribute('role', 'status');
12312
+ bucket.setAttribute('aria-live', 'polite');
12313
+ bucket.setAttribute('aria-atomic', 'true');
11974
12314
  bucket.className = 'busy-bucket';
11975
12315
  this._busyBucket = bucket;
12316
+ this._syncLoaderClassNames();
11976
12317
  const icon = document.createElement('div');
11977
12318
  icon.className = 'busy-icon';
11978
12319
  icon.setAttribute('part', 'loading-icon');
@@ -12020,6 +12361,25 @@ class EnhancedSelect extends HTMLElement {
12020
12361
  this._syncBusyBucketContent(bucket);
12021
12362
  return bucket;
12022
12363
  }
12364
+ _createSearchingState() {
12365
+ const searching = document.createElement('div');
12366
+ searching.className = 'searching-state';
12367
+ searching.setAttribute('part', 'loading searching');
12368
+ searching.setAttribute('role', 'status');
12369
+ searching.setAttribute('aria-live', 'polite');
12370
+ searching.setAttribute('aria-atomic', 'true');
12371
+ const spinner = document.createElement('span');
12372
+ spinner.className = 'searching-spinner';
12373
+ spinner.setAttribute('part', 'searching-spinner');
12374
+ spinner.setAttribute('aria-hidden', 'true');
12375
+ const message = document.createElement('span');
12376
+ message.className = 'searching-message';
12377
+ message.setAttribute('part', 'searching-message');
12378
+ message.textContent = this._config.searchingMessage ?? 'Searching...';
12379
+ searching.append(spinner, message);
12380
+ this._syncLoaderClassNames(searching);
12381
+ return searching;
12382
+ }
12023
12383
  _renderOptions() {
12024
12384
  this._syncBusyPresentation();
12025
12385
  this._clearBusyBucketContentObserver();
@@ -12062,10 +12422,7 @@ class EnhancedSelect extends HTMLElement {
12062
12422
  this._renderPlan = this._createLegacyRenderPlan([]);
12063
12423
  this._refreshVirtualizationScope(filteredIndicesForScope);
12064
12424
  this._syncLegacyActiveAria();
12065
- const searching = document.createElement('div');
12066
- searching.className = 'searching-state';
12067
- searching.setAttribute('part', 'loading');
12068
- searching.textContent = 'Searching...';
12425
+ const searching = this._createSearchingState();
12069
12426
  this._optionsContainer.appendChild(searching);
12070
12427
  this._syncEmptyStateContext(null);
12071
12428
  this._resolveRenderCycle(renderCycleId, true);
@@ -12545,6 +12902,7 @@ class EnhancedSelect extends HTMLElement {
12545
12902
  _addLoadMoreTrigger() {
12546
12903
  const container = document.createElement('div');
12547
12904
  container.className = 'load-more-container';
12905
+ container.setAttribute('part', 'load-more-container');
12548
12906
  if (this._dataRequestCoordinator) {
12549
12907
  const shouldObserve = this._config.infiniteScroll.enabled
12550
12908
  && Boolean(this._intersectionObserver)
@@ -12556,6 +12914,7 @@ class EnhancedSelect extends HTMLElement {
12556
12914
  sentinel.style.height = '10px';
12557
12915
  sentinel.style.width = '100%';
12558
12916
  sentinel.style.opacity = '0';
12917
+ sentinel.setAttribute('aria-hidden', 'true');
12559
12918
  this._acknowledgedSentinel = sentinel;
12560
12919
  this._loadMoreTrigger = sentinel;
12561
12920
  container.appendChild(sentinel);
@@ -12565,7 +12924,8 @@ class EnhancedSelect extends HTMLElement {
12565
12924
  if (this._config.loadMore.enabled || this._config.infiniteScroll.enabled) {
12566
12925
  const button = document.createElement('button');
12567
12926
  button.className = 'load-more-button';
12568
- button.textContent = `Load ${this._config.loadMore.itemsPerLoad} more`;
12927
+ button.setAttribute('part', 'load-more-button');
12928
+ button.textContent = this._config.loadMore.label ?? `Load ${this._config.loadMore.itemsPerLoad} more`;
12569
12929
  button.addEventListener('click', () => this._loadMoreItems('manual'));
12570
12930
  container.appendChild(button);
12571
12931
  if (!sentinel)
@@ -12593,6 +12953,7 @@ class EnhancedSelect extends HTMLElement {
12593
12953
  sentinel.style.height = '10px';
12594
12954
  sentinel.style.width = '100%';
12595
12955
  sentinel.style.opacity = '0'; // Invisible
12956
+ sentinel.setAttribute('aria-hidden', 'true');
12596
12957
  this._loadMoreTrigger = sentinel;
12597
12958
  container.appendChild(sentinel);
12598
12959
  }
@@ -12600,7 +12961,8 @@ class EnhancedSelect extends HTMLElement {
12600
12961
  // Manual Load More: Render a button
12601
12962
  const button = document.createElement('button');
12602
12963
  button.className = 'load-more-button';
12603
- button.textContent = `Load ${this._config.loadMore.itemsPerLoad} more`;
12964
+ button.setAttribute('part', 'load-more-button');
12965
+ button.textContent = this._config.loadMore.label ?? `Load ${this._config.loadMore.itemsPerLoad} more`;
12604
12966
  button.addEventListener('click', () => this._loadMoreItems());
12605
12967
  this._loadMoreTrigger = button;
12606
12968
  container.appendChild(button);